From: Takuo Yasunaga Date: Mon, 28 Mar 2016 05:31:04 +0000 (+0900) Subject: modified: bin/X86MAC64/ctfDisplay X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=1040aba819665adec444371825131bffd6f59992;p=eos%2FhostdependX86MAC64.git modified: bin/X86MAC64/ctfDisplay --- diff --git a/bin/X86MAC64/ctfDisplay b/bin/X86MAC64/ctfDisplay index a4b276c6b..5a48da770 100755 Binary files a/bin/X86MAC64/ctfDisplay and b/bin/X86MAC64/ctfDisplay differ diff --git a/lib/X86MAC64/libEosObjects.a b/lib/X86MAC64/libEosObjects.a index 51e59f02e..67b1e0a94 100644 Binary files a/lib/X86MAC64/libEosObjects.a and b/lib/X86MAC64/libEosObjects.a differ diff --git a/lib/X86MAC64/libmrcImage.a b/lib/X86MAC64/libmrcImage.a index feaba204d..fae0a391c 100644 Binary files a/lib/X86MAC64/libmrcImage.a and b/lib/X86MAC64/libmrcImage.a differ diff --git a/lib/X86MAC64/shared/lmrcFFTInfo.sharedo b/lib/X86MAC64/shared/lmrcFFTInfo.sharedo index faf861fea..9bf3fdf41 100644 Binary files a/lib/X86MAC64/shared/lmrcFFTInfo.sharedo and b/lib/X86MAC64/shared/lmrcFFTInfo.sharedo differ diff --git a/lib/X86MAC64/shared/mrcImageGet.sharedo b/lib/X86MAC64/shared/mrcImageGet.sharedo index d3e8efd95..56389384b 100644 Binary files a/lib/X86MAC64/shared/mrcImageGet.sharedo and b/lib/X86MAC64/shared/mrcImageGet.sharedo differ diff --git a/src/Objects/DataManip/mrcImage/src/X86MAC64/libmrcImage.a b/src/Objects/DataManip/mrcImage/src/X86MAC64/libmrcImage.a index feaba204d..fae0a391c 100644 Binary files a/src/Objects/DataManip/mrcImage/src/X86MAC64/libmrcImage.a and b/src/Objects/DataManip/mrcImage/src/X86MAC64/libmrcImage.a differ diff --git a/src/Objects/DataManip/mrcImage/src/X86MAC64/libmrcImage.debug.a b/src/Objects/DataManip/mrcImage/src/X86MAC64/libmrcImage.debug.a index b32a3e6b9..963ca0623 100644 Binary files a/src/Objects/DataManip/mrcImage/src/X86MAC64/libmrcImage.debug.a and b/src/Objects/DataManip/mrcImage/src/X86MAC64/libmrcImage.debug.a differ diff --git a/src/Objects/DataManip/mrcImage/src/X86MAC64/lmrcFFTInfo.debugo b/src/Objects/DataManip/mrcImage/src/X86MAC64/lmrcFFTInfo.debugo index 5cf1a6c35..237478a83 100644 Binary files a/src/Objects/DataManip/mrcImage/src/X86MAC64/lmrcFFTInfo.debugo and b/src/Objects/DataManip/mrcImage/src/X86MAC64/lmrcFFTInfo.debugo differ diff --git a/src/Objects/DataManip/mrcImage/src/X86MAC64/lmrcFFTInfo.o b/src/Objects/DataManip/mrcImage/src/X86MAC64/lmrcFFTInfo.o index faf861fea..9bf3fdf41 100644 Binary files a/src/Objects/DataManip/mrcImage/src/X86MAC64/lmrcFFTInfo.o and b/src/Objects/DataManip/mrcImage/src/X86MAC64/lmrcFFTInfo.o differ diff --git a/src/Objects/DataManip/mrcImage/src/X86MAC64/lmrcFFTInfo.sharedo b/src/Objects/DataManip/mrcImage/src/X86MAC64/lmrcFFTInfo.sharedo index faf861fea..9bf3fdf41 100644 Binary files a/src/Objects/DataManip/mrcImage/src/X86MAC64/lmrcFFTInfo.sharedo and b/src/Objects/DataManip/mrcImage/src/X86MAC64/lmrcFFTInfo.sharedo differ diff --git a/src/Objects/DataManip/mrcImage/src/X86MAC64/mrcImageGet.debugo b/src/Objects/DataManip/mrcImage/src/X86MAC64/mrcImageGet.debugo index b1af8cd8e..c450f224a 100644 Binary files a/src/Objects/DataManip/mrcImage/src/X86MAC64/mrcImageGet.debugo and b/src/Objects/DataManip/mrcImage/src/X86MAC64/mrcImageGet.debugo differ diff --git a/src/Objects/DataManip/mrcImage/src/X86MAC64/mrcImageGet.o b/src/Objects/DataManip/mrcImage/src/X86MAC64/mrcImageGet.o index d3e8efd95..56389384b 100644 Binary files a/src/Objects/DataManip/mrcImage/src/X86MAC64/mrcImageGet.o and b/src/Objects/DataManip/mrcImage/src/X86MAC64/mrcImageGet.o differ diff --git a/src/Objects/DataManip/mrcImage/src/X86MAC64/mrcImageGet.sharedo b/src/Objects/DataManip/mrcImage/src/X86MAC64/mrcImageGet.sharedo index d3e8efd95..56389384b 100644 Binary files a/src/Objects/DataManip/mrcImage/src/X86MAC64/mrcImageGet.sharedo and b/src/Objects/DataManip/mrcImage/src/X86MAC64/mrcImageGet.sharedo differ diff --git a/src/Tools/Integration/ctfDisplay/src/X86MAC64/.Depend b/src/Tools/Integration/ctfDisplay/src/X86MAC64/.Depend index a75a8d6e5..99c626800 100644 --- a/src/Tools/Integration/ctfDisplay/src/X86MAC64/.Depend +++ b/src/Tools/Integration/ctfDisplay/src/X86MAC64/.Depend @@ -19,7 +19,7 @@ argCheck.o: argCheck.c /usr/include/stdio.h /usr/include/sys/cdefs.h \ /usr/include/sys/_types/_ucontext.h \ /usr/include/sys/_types/_sigset_t.h /usr/include/sys/_types/_uid_t.h \ /usr/include/sys/resource.h \ - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/include/stdint.h \ + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include/stdint.h \ /usr/include/stdint.h /usr/include/sys/_types/_int8_t.h \ /usr/include/sys/_types/_int16_t.h /usr/include/sys/_types/_int32_t.h \ /usr/include/sys/_types/_int64_t.h /usr/include/_types/_uint8_t.h \ @@ -33,16 +33,104 @@ argCheck.o: argCheck.c /usr/include/stdio.h /usr/include/sys/cdefs.h \ /usr/include/sys/_types/_ct_rune_t.h /usr/include/sys/_types/_rune_t.h \ /usr/include/sys/_types/_wchar_t.h /usr/include/machine/types.h \ /usr/include/i386/types.h /usr/include/sys/_types/_dev_t.h \ - /usr/include/sys/_types/_mode_t.h \ - /Users/hisanagakouji/Eos/include/string.h /usr/include/math.h \ - ../inc/config.h ../inc/../inc/ctfDisplay.h \ - /Users/hisanagakouji/Eos/include/genUtil.h \ - /Users/hisanagakouji/Eos/include/File.h \ - /Users/hisanagakouji/Eos/include/Memory.h \ - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/include/limits.h \ + /usr/include/sys/_types/_mode_t.h /Users/tacyas/Eos/include/string.h \ + /usr/include/math.h ../inc/config.h ../inc/../inc/ctfDisplay.h \ + /Users/tacyas/Eos/include/genUtil.h /Users/tacyas/Eos/include/File.h \ + /Users/tacyas/Eos/include/Memory.h \ + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include/limits.h \ /usr/include/limits.h /usr/include/machine/limits.h \ /usr/include/i386/limits.h /usr/include/i386/_limits.h \ /usr/include/sys/syslimits.h +ctfDisplay.o: ctfDisplay.c /usr/include/stdio.h /usr/include/sys/cdefs.h \ + /usr/include/sys/_symbol_aliasing.h \ + /usr/include/sys/_posix_availability.h /usr/include/Availability.h \ + /usr/include/AvailabilityInternal.h /usr/include/_types.h \ + /usr/include/sys/_types.h /usr/include/machine/_types.h \ + /usr/include/i386/_types.h /usr/include/sys/_pthread/_pthread_types.h \ + /usr/include/sys/_types/_va_list.h /usr/include/sys/_types/_size_t.h \ + /usr/include/sys/_types/_null.h /usr/include/sys/stdio.h \ + /usr/include/sys/_types/_off_t.h /usr/include/sys/_types/_ssize_t.h \ + /usr/include/secure/_stdio.h /usr/include/secure/_common.h \ + /usr/include/stdlib.h /usr/include/sys/wait.h \ + /usr/include/sys/_types/_pid_t.h /usr/include/sys/_types/_id_t.h \ + /usr/include/sys/signal.h /usr/include/sys/appleapiopts.h \ + /usr/include/machine/signal.h /usr/include/i386/signal.h \ + /usr/include/machine/_mcontext.h /usr/include/i386/_mcontext.h \ + /usr/include/mach/i386/_structs.h \ + /usr/include/sys/_pthread/_pthread_attr_t.h \ + /usr/include/sys/_types/_sigaltstack.h \ + /usr/include/sys/_types/_ucontext.h \ + /usr/include/sys/_types/_sigset_t.h /usr/include/sys/_types/_uid_t.h \ + /usr/include/sys/resource.h \ + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include/stdint.h \ + /usr/include/stdint.h /usr/include/sys/_types/_int8_t.h \ + /usr/include/sys/_types/_int16_t.h /usr/include/sys/_types/_int32_t.h \ + /usr/include/sys/_types/_int64_t.h /usr/include/_types/_uint8_t.h \ + /usr/include/_types/_uint16_t.h /usr/include/_types/_uint32_t.h \ + /usr/include/_types/_uint64_t.h /usr/include/sys/_types/_intptr_t.h \ + /usr/include/sys/_types/_uintptr_t.h /usr/include/_types/_intmax_t.h \ + /usr/include/_types/_uintmax_t.h /usr/include/sys/_types/_timeval.h \ + /usr/include/machine/endian.h /usr/include/i386/endian.h \ + /usr/include/sys/_endian.h /usr/include/libkern/_OSByteOrder.h \ + /usr/include/libkern/i386/_OSByteOrder.h /usr/include/alloca.h \ + /usr/include/sys/_types/_ct_rune_t.h /usr/include/sys/_types/_rune_t.h \ + /usr/include/sys/_types/_wchar_t.h /usr/include/machine/types.h \ + /usr/include/i386/types.h /usr/include/sys/_types/_dev_t.h \ + /usr/include/sys/_types/_mode_t.h /Users/tacyas/Eos/include/string.h \ + /usr/include/math.h ../inc/config.h ../inc/../inc/ctfDisplay.h \ + /Users/tacyas/Eos/include/genUtil.h \ + /Users/tacyas/Eos/include/mrcImage.h \ + /Users/tacyas/Eos/include/Matrix3D.h \ + /Users/tacyas/Eos/include/Vector.h /Users/tacyas/Eos/include/Array.h \ + /Users/tacyas/Eos/include/ctfInfo.h \ + /Users/tacyas/Eos/util/X86MAC64/include/tcl.h \ + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include/stdarg.h \ + /Users/tacyas/Eos/util/X86MAC64/include/tclDecls.h \ + /Users/tacyas/Eos/util/X86MAC64/include/tclPlatDecls.h \ + /Users/tacyas/Eos/util/X86MAC64/include/tk.h /usr/include/X11/Xlib.h \ + /usr/include/sys/types.h /usr/include/sys/_types/_blkcnt_t.h \ + /usr/include/sys/_types/_blksize_t.h /usr/include/sys/_types/_gid_t.h \ + /usr/include/sys/_types/_in_addr_t.h \ + /usr/include/sys/_types/_in_port_t.h /usr/include/sys/_types/_ino_t.h \ + /usr/include/sys/_types/_ino64_t.h /usr/include/sys/_types/_key_t.h \ + /usr/include/sys/_types/_nlink_t.h /usr/include/sys/_types/_clock_t.h \ + /usr/include/sys/_types/_time_t.h \ + /usr/include/sys/_types/_useconds_t.h \ + /usr/include/sys/_types/_suseconds_t.h \ + /usr/include/sys/_types/_rsize_t.h /usr/include/sys/_types/_errno_t.h \ + /usr/include/sys/_types/_fd_def.h \ + /usr/include/sys/_types/_fd_setsize.h \ + /usr/include/sys/_types/_fd_set.h /usr/include/sys/_types/_fd_clr.h \ + /usr/include/sys/_types/_fd_zero.h /usr/include/sys/_types/_fd_isset.h \ + /usr/include/sys/_types/_fd_copy.h \ + /usr/include/sys/_pthread/_pthread_cond_t.h \ + /usr/include/sys/_pthread/_pthread_condattr_t.h \ + /usr/include/sys/_pthread/_pthread_mutex_t.h \ + /usr/include/sys/_pthread/_pthread_mutexattr_t.h \ + /usr/include/sys/_pthread/_pthread_once_t.h \ + /usr/include/sys/_pthread/_pthread_rwlock_t.h \ + /usr/include/sys/_pthread/_pthread_rwlockattr_t.h \ + /usr/include/sys/_pthread/_pthread_t.h \ + /usr/include/sys/_pthread/_pthread_key_t.h \ + /usr/include/sys/_types/_fsblkcnt_t.h \ + /usr/include/sys/_types/_fsfilcnt_t.h /usr/include/X11/X.h \ + /usr/include/X11/Xfuncproto.h /usr/include/X11/Xosdefs.h \ + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include/stddef.h \ + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include/__stddef_max_align_t.h \ + /Users/tacyas/Eos/util/X86MAC64/include/tkDecls.h \ + /Users/tacyas/Eos/util/X86MAC64/include/blt.h \ + /Users/tacyas/Eos/util/X86MAC64/include/bltVector.h \ + /Users/tacyas/Eos/util/X86MAC64/include/bltHash.h \ + /usr/include/inttypes.h \ + /Users/tacyas/Eos/util/X86MAC64/include/bltPool.h \ + /Users/tacyas/Eos/util/X86MAC64/include/bltOldConfig.h \ + /Users/tacyas/Eos/include/tkImgFmtMRC.h \ + /Users/tacyas/Eos/include/Memory.h \ + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include/limits.h \ + /usr/include/limits.h /usr/include/machine/limits.h \ + /usr/include/i386/limits.h /usr/include/i386/_limits.h \ + /usr/include/sys/syslimits.h /Users/tacyas/Eos/include/lmrcFFTInfo.h \ + /Users/tacyas/Eos/include/tkctfInfo.h init.o: init.c /usr/include/stdio.h /usr/include/sys/cdefs.h \ /usr/include/sys/_symbol_aliasing.h \ /usr/include/sys/_posix_availability.h /usr/include/Availability.h \ @@ -64,7 +152,7 @@ init.o: init.c /usr/include/stdio.h /usr/include/sys/cdefs.h \ /usr/include/sys/_types/_ucontext.h \ /usr/include/sys/_types/_sigset_t.h /usr/include/sys/_types/_uid_t.h \ /usr/include/sys/resource.h \ - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/include/stdint.h \ + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include/stdint.h \ /usr/include/stdint.h /usr/include/sys/_types/_int8_t.h \ /usr/include/sys/_types/_int16_t.h /usr/include/sys/_types/_int32_t.h \ /usr/include/sys/_types/_int64_t.h /usr/include/_types/_uint8_t.h \ @@ -78,13 +166,11 @@ init.o: init.c /usr/include/stdio.h /usr/include/sys/cdefs.h \ /usr/include/sys/_types/_ct_rune_t.h /usr/include/sys/_types/_rune_t.h \ /usr/include/sys/_types/_wchar_t.h /usr/include/machine/types.h \ /usr/include/i386/types.h /usr/include/sys/_types/_dev_t.h \ - /usr/include/sys/_types/_mode_t.h \ - /Users/hisanagakouji/Eos/include/string.h /usr/include/math.h \ - ../inc/config.h ../inc/../inc/ctfDisplay.h \ - /Users/hisanagakouji/Eos/include/genUtil.h \ - /Users/hisanagakouji/Eos/include/File.h \ - /Users/hisanagakouji/Eos/include/Memory.h \ - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/include/limits.h \ + /usr/include/sys/_types/_mode_t.h /Users/tacyas/Eos/include/string.h \ + /usr/include/math.h ../inc/config.h ../inc/../inc/ctfDisplay.h \ + /Users/tacyas/Eos/include/genUtil.h /Users/tacyas/Eos/include/File.h \ + /Users/tacyas/Eos/include/Memory.h \ + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include/limits.h \ /usr/include/limits.h /usr/include/machine/limits.h \ /usr/include/i386/limits.h /usr/include/i386/_limits.h \ /usr/include/sys/syslimits.h @@ -109,7 +195,7 @@ usage.o: usage.c /usr/include/stdio.h /usr/include/sys/cdefs.h \ /usr/include/sys/_types/_ucontext.h \ /usr/include/sys/_types/_sigset_t.h /usr/include/sys/_types/_uid_t.h \ /usr/include/sys/resource.h \ - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/include/stdint.h \ + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include/stdint.h \ /usr/include/stdint.h /usr/include/sys/_types/_int8_t.h \ /usr/include/sys/_types/_int16_t.h /usr/include/sys/_types/_int32_t.h \ /usr/include/sys/_types/_int64_t.h /usr/include/_types/_uint8_t.h \ @@ -146,7 +232,7 @@ util.o: util.c /usr/include/stdio.h /usr/include/sys/cdefs.h \ /usr/include/sys/_types/_ucontext.h \ /usr/include/sys/_types/_sigset_t.h /usr/include/sys/_types/_uid_t.h \ /usr/include/sys/resource.h \ - /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.0/include/stdint.h \ + /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include/stdint.h \ /usr/include/stdint.h /usr/include/sys/_types/_int8_t.h \ /usr/include/sys/_types/_int16_t.h /usr/include/sys/_types/_int32_t.h \ /usr/include/sys/_types/_int64_t.h /usr/include/_types/_uint8_t.h \ diff --git a/src/Tools/Integration/ctfDisplay/src/X86MAC64/ctfDisplay b/src/Tools/Integration/ctfDisplay/src/X86MAC64/ctfDisplay index a4b276c6b..5a48da770 100755 Binary files a/src/Tools/Integration/ctfDisplay/src/X86MAC64/ctfDisplay and b/src/Tools/Integration/ctfDisplay/src/X86MAC64/ctfDisplay differ diff --git a/util/X86MAC64/bin/em-ftpd b/util/X86MAC64/bin/em-ftpd new file mode 100755 index 000000000..cf9b818e6 --- /dev/null +++ b/util/X86MAC64/bin/em-ftpd @@ -0,0 +1,19 @@ +#!/Users/tacyas/Eos/util/X86MAC64/bin/ruby +# +# This file was generated by RubyGems. +# +# The application 'em-ftpd' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'rubygems' + +version = ">= 0" + +if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then + version = $1 + ARGV.shift +end + +gem 'em-ftpd', version +load Gem.bin_path('em-ftpd', 'em-ftpd', version) diff --git a/util/X86MAC64/bin/kramdown b/util/X86MAC64/bin/kramdown new file mode 100755 index 000000000..797aa09b9 --- /dev/null +++ b/util/X86MAC64/bin/kramdown @@ -0,0 +1,19 @@ +#!/Users/tacyas/Eos/util/X86MAC64/bin/ruby +# +# This file was generated by RubyGems. +# +# The application 'kramdown' is installed as part of a gem, and +# this file is here to facilitate running it. +# + +require 'rubygems' + +version = ">= 0" + +if ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then + version = $1 + ARGV.shift +end + +gem 'kramdown', version +load Gem.bin_path('kramdown', 'kramdown', version) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/blankslate-2.1.2.4.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/blankslate-2.1.2.4.gem new file mode 100644 index 000000000..0b13d0613 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/blankslate-2.1.2.4.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/childprocess-0.3.9.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/childprocess-0.3.9.gem new file mode 100644 index 000000000..c3131b2f9 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/childprocess-0.3.9.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/dropbox-sdk-1.6.5.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/dropbox-sdk-1.6.5.gem new file mode 100644 index 000000000..a5ef2f7ec Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/dropbox-sdk-1.6.5.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/em-ftpd-0.0.1.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/em-ftpd-0.0.1.gem new file mode 100644 index 000000000..70fe986c7 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/em-ftpd-0.0.1.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/eventmachine-1.0.0.rc.4.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/eventmachine-1.0.0.rc.4.gem new file mode 100644 index 000000000..60be06416 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/eventmachine-1.0.0.rc.4.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/ffi-1.9.10.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/ffi-1.9.10.gem new file mode 100644 index 000000000..b7a884a28 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/ffi-1.9.10.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/forwardablex-0.1.4.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/forwardablex-0.1.4.gem new file mode 100644 index 000000000..3c61b897f Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/forwardablex-0.1.4.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/hamster-0.4.3.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/hamster-0.4.3.gem new file mode 100644 index 000000000..af0959813 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/hamster-0.4.3.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/highline-1.6.21.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/highline-1.6.21.gem new file mode 100644 index 000000000..8ec6132bb Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/highline-1.6.21.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/json-1.8.3.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/json-1.8.3.gem new file mode 100644 index 000000000..6474a4fcf Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/json-1.8.3.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/kramdown-1.2.0.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/kramdown-1.2.0.gem new file mode 100644 index 000000000..ab19590c3 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/kramdown-1.2.0.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/lettercase-0.0.3.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/lettercase-0.0.3.gem new file mode 100644 index 000000000..627dd6e18 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/lettercase-0.0.3.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/naming-0.1.0.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/naming-0.1.0.gem new file mode 100644 index 000000000..b619fb669 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/naming-0.1.0.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/os-0.9.6.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/os-0.9.6.gem new file mode 100644 index 000000000..3816ba557 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/os-0.9.6.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/parslet-1.5.0.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/parslet-1.5.0.gem new file mode 100644 index 000000000..3c3acea5c Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/parslet-1.5.0.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/pione-0.5.0.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/pione-0.5.0.gem new file mode 100644 index 000000000..6b31baf60 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/pione-0.5.0.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/rainbow-1.1.4.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/rainbow-1.1.4.gem new file mode 100644 index 000000000..9212b3501 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/rainbow-1.1.4.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/retriable-1.3.3.1.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/retriable-1.3.3.1.gem new file mode 100644 index 000000000..5d0f31caa Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/retriable-1.3.3.1.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/ruby-xes-0.1.0.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/ruby-xes-0.1.0.gem new file mode 100644 index 000000000..c35cfb1b9 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/ruby-xes-0.1.0.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/rubyzip-1.0.0.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/rubyzip-1.0.0.gem new file mode 100644 index 000000000..12ae2b0eb Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/rubyzip-1.0.0.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/simple-identity-0.1.2.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/simple-identity-0.1.2.gem new file mode 100644 index 000000000..6a7f6f747 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/simple-identity-0.1.2.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/structx-0.1.3.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/structx-0.1.3.gem new file mode 100644 index 000000000..554246b8d Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/structx-0.1.3.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/sys-cpu-0.7.2.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/sys-cpu-0.7.2.gem new file mode 100644 index 000000000..6dbb0fb11 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/sys-cpu-0.7.2.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/sys-proctable-0.9.9-universal-darwin.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/sys-proctable-0.9.9-universal-darwin.gem new file mode 100644 index 000000000..4e6c99557 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/sys-proctable-0.9.9-universal-darwin.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/sys-uname-0.9.2.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/sys-uname-0.9.2.gem new file mode 100644 index 000000000..897faa3d4 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/sys-uname-0.9.2.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/syslog-logger-1.6.8.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/syslog-logger-1.6.8.gem new file mode 100644 index 000000000..168418da1 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/syslog-logger-1.6.8.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/temppath-0.3.1.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/temppath-0.3.1.gem new file mode 100644 index 000000000..efb255ec1 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/temppath-0.3.1.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/cache/uuidtools-2.1.5.gem b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/uuidtools-2.1.5.gem new file mode 100644 index 000000000..ce3295602 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/cache/uuidtools-2.1.5.gem differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/blankslate-2.1.2.4/README b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/blankslate-2.1.2.4/README new file mode 100644 index 000000000..fcd3f8790 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/blankslate-2.1.2.4/README @@ -0,0 +1,31 @@ +BlankSlate +=== + +BlankSlate provides an abstract base class with no predefined +methods (except for \_\_send__ and \_\_id__). +BlankSlate is useful as a base class when writing classes that +depend upon method_missing (e.g. dynamic proxies). + +Copyright 2004, 2006 by Jim Weirich (jim@weirichhouse.org). +All rights reserved. + + +Extracted from Builder because, for no conceivable reason, +blankslate isn't in its own gem. Gemified by David Masover, +moved to gemcutter by Jack Danger Canty (gemcutter@6brand.com +if you'd like to own this gem). + +Explanation on extraction from David Masover: + +So, Builder seems to have the most complete implementation of +BlankSlate, short of Ruby 1.9's BasicObject. The problem is, +this is part of Builder, and still inside the Builder gem. + +It's especially frustrating, because the Builder source +(lib/builder/blankslate.rb) seems to acknowledge that there +should be a separate gem. But the only reference I can find +refers to onestepback.org's gem repository, which isn't working. + +So I built my own. I'll try to keep it up to date with Builder. +The first three parts of the version number are +the Builder version; the last part is my revision. \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/blankslate-2.1.2.4/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/blankslate-2.1.2.4/Rakefile new file mode 100644 index 000000000..3464d648a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/blankslate-2.1.2.4/Rakefile @@ -0,0 +1,13 @@ + +require 'bundler' +Bundler::GemHelper.install_tasks + +task :default => :spec + +require 'rake/testtask' +Rake::TestTask.new(:spec) do |test| + test.libs << '.' + test.ruby_opts = ['-rubygems'] + test.pattern = 'spec/*_spec.rb' + test.verbose = true +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/blankslate-2.1.2.4/VERSION b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/blankslate-2.1.2.4/VERSION new file mode 100644 index 000000000..7ac8e7a4e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/blankslate-2.1.2.4/VERSION @@ -0,0 +1 @@ +2.1.2.4 \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/blankslate-2.1.2.4/blankslate.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/blankslate-2.1.2.4/blankslate.gemspec new file mode 100644 index 000000000..dded1b802 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/blankslate-2.1.2.4/blankslate.gemspec @@ -0,0 +1,22 @@ +# -*- encoding: utf-8 -*- +$:.push File.expand_path("../lib", __FILE__) +require "blankslate" + +Gem::Specification.new do |s| + s.name = "blankslate" + s.version = File.read('VERSION') + s.platform = Gem::Platform::RUBY + s.summary = 'BlankSlate extracted from Builder.' + s.email = 'rubygems@6brand.com' + s.authors = ['Jim Weirich', 'David Masover', 'Jack Danger Canty'] + s.email = "rubygems@6brand.com" + s.homepage = "http://github.com/masover/blankslate" + + s.add_development_dependency 'rspec' + s.add_development_dependency 'bundler' + + s.files = `git ls-files`.split("\n") + s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } + s.require_paths = ["lib"] +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/blankslate-2.1.2.4/lib/blankslate.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/blankslate-2.1.2.4/lib/blankslate.rb new file mode 100644 index 000000000..a90d5f7a8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/blankslate-2.1.2.4/lib/blankslate.rb @@ -0,0 +1,109 @@ +#!/usr/bin/env ruby +#-- +# Copyright 2004, 2006 by Jim Weirich (jim@weirichhouse.org). +# All rights reserved. + +# Permission is granted for use, copying, modification, distribution, +# and distribution of modified versions of this work as long as the +# above copyright notice is included. +#++ + +###################################################################### +# BlankSlate provides an abstract base class with no predefined +# methods (except for \_\_send__ and \_\_id__). +# BlankSlate is useful as a base class when writing classes that +# depend upon method_missing (e.g. dynamic proxies). +# +class BlankSlate + class << self + + # Hide the method named +name+ in the BlankSlate class. Don't + # hide +instance_eval+ or any method beginning with "__". + def hide(name) + if instance_methods.map(&:to_sym).include?(name.to_sym) and + name !~ /^(__|instance_eval|object_id)/ + @hidden_methods ||= {} + @hidden_methods[name.to_sym] = instance_method(name) + undef_method name + end + end + + def find_hidden_method(name) + @hidden_methods ||= {} + @hidden_methods[name] || superclass.find_hidden_method(name) + end + + # Redefine a previously hidden method so that it may be called on a blank + # slate object. + def reveal(name) + hidden_method = find_hidden_method(name) + fail "Don't know how to reveal method '#{name}'" unless hidden_method + define_method(name, hidden_method) + end + end + + instance_methods.each { |m| hide(m) } +end + +###################################################################### +# Since Ruby is very dynamic, methods added to the ancestors of +# BlankSlate after BlankSlate is defined will show up in the +# list of available BlankSlate methods. We handle this by defining a +# hook in the Object and Kernel classes that will hide any method +# defined after BlankSlate has been loaded. +# +module Kernel + class << self + alias_method :blank_slate_method_added, :method_added + + # Detect method additions to Kernel and remove them in the + # BlankSlate class. + def method_added(name) + result = blank_slate_method_added(name) + return result if self != Kernel + BlankSlate.hide(name) + result + end + end +end + +###################################################################### +# Same as above, except in Object. +# +class Object + class << self + alias_method :blank_slate_method_added, :method_added + + # Detect method additions to Object and remove them in the + # BlankSlate class. + def method_added(name) + result = blank_slate_method_added(name) + return result if self != Object + BlankSlate.hide(name) + result + end + + def find_hidden_method(name) + nil + end + end +end + +###################################################################### +# Also, modules included into Object need to be scanned and have their +# instance methods removed from blank slate. In theory, modules +# included into Kernel would have to be removed as well, but a +# "feature" of Ruby prevents late includes into modules from being +# exposed in the first place. +# +class Module + alias blankslate_original_append_features append_features + def append_features(mod) + result = blankslate_original_append_features(mod) + return result if mod != Object + instance_methods.each do |name| + BlankSlate.hide(name) + end + result + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/blankslate-2.1.2.4/spec/blankslate_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/blankslate-2.1.2.4/spec/blankslate_spec.rb new file mode 100644 index 000000000..03c89136a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/blankslate-2.1.2.4/spec/blankslate_spec.rb @@ -0,0 +1,39 @@ +require 'blankslate' +require 'rspec' + +describe BlankSlate do + let(:blank_slate) { BlankSlate.new } + + def call(obj, meth, *args) + BlankSlate.find_hidden_method(meth).bind(obj).call(*args) + end + + describe "cleanliness" do + it "should not have many methods" do + BlankSlate.instance_methods. + map(&:to_s).sort. + should == ["__id__", "__send__", "instance_eval", "object_id"] + end + end + + context "when methods are added to Object" do + after(:each) { + class Object + undef :foo + end + } + + it "should still be blank" do + class Object + def foo + end + end + Object.new.foo + + lambda { + BlankSlate.new.foo + }.should raise_error(NoMethodError) + end + + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/.document b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/.document new file mode 100644 index 000000000..ed6ef11a2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/.document @@ -0,0 +1,6 @@ +README.rdoc +lib/**/*.rb +bin/* +features/**/*.feature +- +LICENSE diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/.gitignore b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/.gitignore new file mode 100644 index 000000000..7f31718b6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/.gitignore @@ -0,0 +1,23 @@ +## MAC OS +.DS_Store + +## TEXTMATE +*.tmproj +tmtags + +## EMACS +*~ +\#* +.\#* + +## VIM +*.swp + +## PROJECT::GENERAL +coverage +rdoc +pkg +.rbx +Gemfile.lock + +## PROJECT::SPECIFIC diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/.rspec b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/.rspec new file mode 100644 index 000000000..4e1e0d2f7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/.rspec @@ -0,0 +1 @@ +--color diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/.travis.yml b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/.travis.yml new file mode 100644 index 000000000..a1f27258c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/.travis.yml @@ -0,0 +1,16 @@ +rvm: + - 1.8.7 + - 1.9.3 + - jruby + - rbx + - 2.0.0 + - ruby-head +env: + - CHILDPROCESS_POSIX_SPAWN=true + - CHILDPROCESS_POSIX_SPAWN=false +matrix: + allow_failures: + - rvm: jruby + env: CHILDPROCESS_POSIX_SPAWN=true + - rvm: rbx + env: CHILDPROCESS_POSIX_SPAWN=true diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/Gemfile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/Gemfile new file mode 100644 index 000000000..809e958dd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/Gemfile @@ -0,0 +1,4 @@ +source "http://rubygems.org" + +# Specify your gem's dependencies in child_process.gemspec +gemspec diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/LICENSE b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/LICENSE new file mode 100644 index 000000000..372e33509 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2010-2013 Jari Bakken + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/README.md b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/README.md new file mode 100644 index 000000000..214c0b3ba --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/README.md @@ -0,0 +1,150 @@ +# childprocess + +This gem aims at being a simple and reliable solution for controlling +external programs running in the background on any Ruby / OS combination. + +The code originated in the [selenium-webdriver](https://rubygems.org/gems/selenium-webdriver) gem, but should prove useful as +a standalone library. + +[![Build Status](https://secure.travis-ci.org/jarib/childprocess.png)](http://travis-ci.org/jarib/childprocess) + +# Usage + +The object returned from `ChildProcess.build` will implement `ChildProcess::AbstractProcess`. + +### Basic examples + +```ruby +process = ChildProcess.build("ruby", "-e", "sleep") + +# inherit stdout/stderr from parent... +process.io.inherit! + +# ...or pass an IO +process.io.stdout = Tempfile.new("child-output") + +# modify the environment for the child +process.environment["a"] = "b" +process.environment["c"] = nil + +# set the child's working directory +process.cwd = '/some/path' + +# start the process +process.start + +# check process status +process.alive? #=> true +process.exited? #=> false + +# wait indefinitely for process to exit... +process.wait +process.exited? #=> true + +# get the exit code +process.exit_code #=> 0 + +# ...or poll for exit + force quit +begin + process.poll_for_exit(10) +rescue ChildProcess::TimeoutError + process.stop # tries increasingly harsher methods to kill the process. +end +``` + +### Advanced examples + +#### Output to pipe + +```ruby +r, w = IO.pipe + +proc = ChildProcess.build("echo", "foo") +proc.io.stdout = proc.io.stderr = w +proc.start +w.close + +begin + loop { print r.readpartial(8192) } +rescue EOFError +end + +proc.wait +``` + +Note that if you just want to get the output of a command, the backtick method on Kernel may be a better fit. + +#### Write to stdin + +```ruby +process = ChildProcess.build("cat") + +out = Tempfile.new("duplex") +out.sync = true + +process.io.stdout = process.io.stderr = out +process.duplex = true # sets up pipe so process.io.stdin will be available after .start + +process.start +process.io.stdin.puts "hello world" +process.io.stdin.close + +process.poll_for_exit(exit_timeout_in_seconds) + +out.rewind +out.read #=> "hello world\n" +``` + +#### Pipe output to another ChildProcess + +```ruby +search = ChildProcess.build("grep", '-E', %w(redis memcached).join('|')) +search.duplex = true # sets up pipe so search.io.stdin will be available after .start +search.io.stdout = $stdout +search.start + +listing = ChildProcess.build("ps", "aux") +listing.io.stdout = search.io.stdin +listing.start +listing.wait + +search.io.stdin.close +search.wait +``` + +#### Prefer posix_spawn on *nix + +If the parent process is using a lot of memory, `fork+exec` can be very expensive. The `posix_spawn()` API removes this overhead. + +```ruby +ChildProcess.posix_spawn = true +process = ChildProcess.build(*args) +``` + +#### Detach from parent + +```ruby +process = ChildProcess.build("sleep", "10") +process.detach = true +process.start +``` + +# Implementation + +How the process is launched and killed depends on the platform: + +* Unix : `fork + exec` (or `posix_spawn` if enabled) +* Windows : `CreateProcess()` and friends +* JRuby : `java.lang.{Process,ProcessBuilder}` + +# Note on Patches/Pull Requests + +* Fork the project. +* Make your feature addition or bug fix. +* Add tests for it. This is important so I don't break it in a future version unintentionally. +* Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull) +* Send me a pull request. Bonus points for topic branches. + +# Copyright + +Copyright (c) 2010-2013 Jari Bakken. See LICENSE for details. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/Rakefile new file mode 100644 index 000000000..c886e1523 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/Rakefile @@ -0,0 +1,61 @@ +require 'rubygems' +require 'rake' +require 'tmpdir' + +require 'bundler' +Bundler::GemHelper.install_tasks + +include Rake::DSL if defined?(::Rake::DSL) + +require 'rspec/core/rake_task' +RSpec::Core::RakeTask.new(:spec) do |spec| + spec.ruby_opts = "-I lib:spec" + spec.pattern = 'spec/**/*_spec.rb' +end + +desc 'Run specs for rcov' +RSpec::Core::RakeTask.new(:rcov) do |spec| + spec.ruby_opts = "-I lib:spec" + spec.pattern = 'spec/**/*_spec.rb' + spec.rcov = true + spec.rcov_opts = %w[--exclude spec,ruby-debug,/Library/Ruby,.gem --include lib/childprocess] +end + +task :default => :spec + +begin + require 'yard' + YARD::Rake::YardocTask.new +rescue LoadError + task :yardoc do + abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard" + end +end + +task :clean do + rm_rf "pkg" + rm_rf "childprocess.jar" +end + +desc 'Create jar to bundle in selenium-webdriver' +task :jar => [:clean, :build] do + tmpdir = Dir.mktmpdir("childprocess-jar") + gem_to_package = Dir['pkg/*.gem'].first + gem_name = File.basename(gem_to_package, ".gem") + p :gem_to_package => gem_to_package, :gem_name => gem_name + + sh "gem install -i #{tmpdir} #{gem_to_package} --ignore-dependencies --no-rdoc --no-ri" + sh "jar cf childprocess.jar -C #{tmpdir}/gems/#{gem_name}/lib ." + sh "jar tf childprocess.jar" +end + +task :env do + $:.unshift File.expand_path("../lib", __FILE__) + require 'childprocess' +end + +desc 'Calculate size of posix_spawn structs for the current platform' +task :generate => :env do + require 'childprocess/tools/generator' + ChildProcess::Tools::Generator.generate +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/childprocess.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/childprocess.gemspec new file mode 100644 index 000000000..0b2cb5e92 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/childprocess.gemspec @@ -0,0 +1,27 @@ +# -*- encoding: utf-8 -*- +$:.push File.expand_path("../lib", __FILE__) +require "childprocess/version" + +Gem::Specification.new do |s| + s.name = "childprocess" + s.version = ChildProcess::VERSION + s.platform = Gem::Platform::RUBY + s.authors = ["Jari Bakken"] + s.email = ["jari.bakken@gmail.com"] + s.homepage = "http://github.com/jarib/childprocess" + s.summary = %q{This gem aims at being a simple and reliable solution for controlling external programs running in the background on any Ruby / OS combination.} + s.description = %q{This gem aims at being a simple and reliable solution for controlling external programs running in the background on any Ruby / OS combination.} + + s.rubyforge_project = "childprocess" + + s.files = `git ls-files`.split("\n") + s.test_files = `git ls-files -- spec/*`.split("\n") + s.require_paths = ["lib"] + + s.add_development_dependency "rspec", ">= 2.0.0" + s.add_development_dependency "yard", ">= 0" + s.add_development_dependency "rake", "~> 0.9.2" + s.add_runtime_dependency "ffi", "~> 1.0", ">= 1.0.11" +end + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess.rb new file mode 100644 index 000000000..84feece71 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess.rb @@ -0,0 +1,177 @@ +require 'childprocess/errors' +require 'childprocess/abstract_process' +require 'childprocess/abstract_io' +require "fcntl" + +module ChildProcess + + @posix_spawn = false + + class << self + def new(*args) + case os + when :macosx, :linux, :solaris, :bsd, :cygwin, :aix + if posix_spawn? + Unix::PosixSpawnProcess.new(args) + elsif jruby? + JRuby::Process.new(args) + else + Unix::ForkExecProcess.new(args) + end + when :windows + Windows::Process.new(args) + else + raise Error, "unsupported platform #{platform_name.inspect}" + end + end + alias_method :build, :new + + def platform + if RUBY_PLATFORM == "java" + :jruby + elsif defined?(RUBY_ENGINE) && RUBY_ENGINE == "ironruby" + :ironruby + else + os + end + end + + def platform_name + @platform_name ||= "#{arch}-#{os}" + end + + def unix? + !windows? + end + + def linux? + os == :linux + end + + def jruby? + platform == :jruby + end + + def windows? + os == :windows + end + + def posix_spawn? + enabled = @posix_spawn || %w[1 true].include?(ENV['CHILDPROCESS_POSIX_SPAWN']) + return false unless enabled + + require 'ffi' + begin + require "childprocess/unix/platform/#{ChildProcess.platform_name}" + rescue LoadError + raise ChildProcess::MissingPlatformError + end + + require "childprocess/unix/lib" + require 'childprocess/unix/posix_spawn_process' + + true + rescue ChildProcess::MissingPlatformError => ex + warn_once ex.message + false + end + + # + # Set this to true to enable experimental use of posix_spawn. + # + + def posix_spawn=(bool) + @posix_spawn = bool + end + + def os + @os ||= ( + require "rbconfig" + host_os = RbConfig::CONFIG['host_os'].downcase + + case host_os + when /linux/ + :linux + when /darwin|mac os/ + :macosx + when /mswin|msys|mingw32/ + :windows + when /cygwin/ + :cygwin + when /solaris|sunos/ + :solaris + when /bsd/ + :bsd + when /aix/ + :aix + else + raise Error, "unknown os: #{host_os.inspect}" + end + ) + end + + def arch + @arch ||= ( + host_cpu = RbConfig::CONFIG['host_cpu'].downcase + case host_cpu + when /i[3456]86/ + # Darwin always reports i686, even when running in 64bit mod + if os == :macosx && 0xfee1deadbeef.is_a?(Fixnum) + "x86_64" + else + "i386" + end + when /amd64|x86_64/ + "x86_64" + when /ppc|powerpc/ + "powerpc" + else + host_cpu + end + ) + end + + # + # By default, a child process will inherit open file descriptors from the + # parent process. This helper provides a cross-platform way of making sure + # that doesn't happen for the given file/io. + # + + def close_on_exec(file) + if file.respond_to?(:close_on_exec=) + file.close_on_exec = true + elsif file.respond_to?(:fcntl) && defined?(Fcntl::FD_CLOEXEC) + file.fcntl Fcntl::F_SETFD, Fcntl::FD_CLOEXEC + + if jruby? && posix_spawn? + # on JRuby, the fcntl call above apparently isn't enough when + # we're launching the process through posix_spawn. + fileno = JRuby.posix_fileno_for(file) + Unix::Lib.fcntl fileno, Fcntl::F_SETFD, Fcntl::FD_CLOEXEC + end + elsif windows? + Windows::Lib.dont_inherit file + else + raise Error, "not sure how to set close-on-exec for #{file.inspect} on #{platform_name.inspect}" + end + end + + private + + def warn_once(msg) + @warnings ||= {} + + unless @warnings[msg] + @warnings[msg] = true + $stderr.puts msg + end + end + + end # class << self +end # ChildProcess + +require 'jruby' if ChildProcess.jruby? + +require 'childprocess/unix' if ChildProcess.unix? +require 'childprocess/windows' if ChildProcess.windows? +require 'childprocess/jruby' if ChildProcess.jruby? diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/abstract_io.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/abstract_io.rb new file mode 100644 index 000000000..5d159b2b3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/abstract_io.rb @@ -0,0 +1,36 @@ +module ChildProcess + class AbstractIO + attr_reader :stderr, :stdout, :stdin + + def inherit! + @stdout = STDOUT + @stderr = STDERR + end + + def stderr=(io) + check_type io + @stderr = io + end + + def stdout=(io) + check_type io + @stdout = io + end + + # + # @api private + # + + def _stdin=(io) + check_type io + @stdin = io + end + + private + + def check_type(io) + raise SubclassResponsibility, "check_type" + end + + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/abstract_process.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/abstract_process.rb new file mode 100644 index 000000000..be59c5c16 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/abstract_process.rb @@ -0,0 +1,173 @@ +module ChildProcess + class AbstractProcess + POLL_INTERVAL = 0.1 + + attr_reader :exit_code + + # + # Set this to true if you do not care about when or if the process quits. + # + attr_accessor :detach + + # + # Set this to true if you want to write to the process' stdin (process.io.stdin) + # + attr_accessor :duplex + + # + # Modify the child's environment variables + # + attr_reader :environment + + # + # Set the child's current working directory. + # + attr_accessor :cwd + + # + # Create a new process with the given args. + # + # @api private + # @see ChildProcess.build + # + + def initialize(args) + unless args.all? { |e| e.kind_of?(String) } + raise ArgumentError, "all arguments must be String: #{args.inspect}" + end + + @args = args + @started = false + @exit_code = nil + @io = nil + @cwd = nil + @detach = false + @duplex = false + @environment = {} + end + + # + # Returns a ChildProcess::AbstractIO subclass to configure the child's IO streams. + # + + def io + raise SubclassResponsibility, "io" + end + + # + # @return [Fixnum] the pid of the process after it has started + # + + def pid + raise SubclassResponsibility, "pid" + end + + # + # Launch the child process + # + # @return [AbstractProcess] self + # + + def start + launch_process + @started = true + + self + end + + # + # Forcibly terminate the process, using increasingly harsher methods if possible. + # + # @param [Fixnum] timeout (3) Seconds to wait before trying the next method. + # + + def stop(timeout = 3) + raise SubclassResponsibility, "stop" + end + + # + # Block until the process has been terminated. + # + # @return [Fixnum] The exit status of the process + # + + def wait + raise SubclassResponsibility, "wait" + end + + # + # Did the process exit? + # + # @return [Boolean] + # + + def exited? + raise SubclassResponsibility, "exited?" + end + + # + # Is this process running? + # + # @return [Boolean] + # + + def alive? + started? && !exited? + end + + # + # Returns true if the process has exited and the exit code was not 0. + # + # @return [Boolean] + # + + def crashed? + exited? && @exit_code != 0 + end + + # + # Wait for the process to exit, raising a ChildProcess::TimeoutError if + # the timeout expires. + # + + def poll_for_exit(timeout) + log "polling #{timeout} seconds for exit" + + end_time = Time.now + timeout + until (ok = exited?) || Time.now > end_time + sleep POLL_INTERVAL + end + + unless ok + raise TimeoutError, "process still alive after #{timeout} seconds" + end + end + + private + + def launch_process + raise SubclassResponsibility, "launch_process" + end + + def started? + @started + end + + def detach? + @detach + end + + def duplex? + @duplex + end + + def log(*args) + $stderr.puts "#{self.inspect} : #{args.inspect}" if $DEBUG + end + + def assert_started + raise Error, "process not started" unless started? + end + + end # AbstractProcess +end # ChildProcess diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/errors.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/errors.rb new file mode 100644 index 000000000..e26cda217 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/errors.rb @@ -0,0 +1,26 @@ +module ChildProcess + class Error < StandardError + end + + class TimeoutError < Error + end + + class SubclassResponsibility < Error + end + + class InvalidEnvironmentVariable < Error + end + + class LaunchError < Error + end + + class MissingPlatformError < Error + def initialize + message = "posix_spawn is not yet supported on #{ChildProcess.platform_name} (#{RUBY_PLATFORM}), falling back to default implementation. " + + "If you believe this is an error, please file a bug at http://github.com/jarib/childprocess/issues" + + super(message) + end + + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/jruby.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/jruby.rb new file mode 100644 index 000000000..f8bbc0213 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/jruby.rb @@ -0,0 +1,56 @@ +require 'java' +require 'jruby' + +class Java::SunNioCh::FileChannelImpl + field_reader :fd +end + +class Java::JavaIo::FileDescriptor + if ChildProcess.os == :windows + field_reader :handle + end + + field_reader :fd +end + +module ChildProcess + module JRuby + def self.posix_fileno_for(obj) + channel = ::JRuby.reference(obj).channel + begin + channel.getFDVal + rescue NoMethodError + fileno = channel.fd + if fileno.kind_of?(Java::JavaIo::FileDescriptor) + fileno = fileno.fd + end + + fileno == -1 ? obj.fileno : fileno + end + rescue + # fall back + obj.fileno + end + + def self.windows_handle_for(obj) + channel = ::JRuby.reference(obj).channel + fileno = obj.fileno + + begin + fileno = channel.getFDVal + rescue NoMethodError + fileno = channel.fd if channel.respond_to?(:fd) + end + + if fileno.kind_of? Java::JavaIo::FileDescriptor + fileno.handle + else + Windows::Lib.handle_for fileno + end + end + end +end + +require "childprocess/jruby/pump" +require "childprocess/jruby/io" +require "childprocess/jruby/process" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/jruby/io.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/jruby/io.rb new file mode 100644 index 000000000..f4e8c2b14 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/jruby/io.rb @@ -0,0 +1,16 @@ +module ChildProcess + module JRuby + class IO < AbstractIO + private + + def check_type(output) + unless output.respond_to?(:to_outputstream) && output.respond_to?(:write) + raise ArgumentError, "expected #{output.inspect} to respond to :to_outputstream" + end + end + + end # IO + end # Unix +end # ChildProcess + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/jruby/process.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/jruby/process.rb new file mode 100755 index 000000000..7d2cb4108 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/jruby/process.rb @@ -0,0 +1,143 @@ +require "java" + +module ChildProcess + module JRuby + class Process < AbstractProcess + def initialize(args) + super(args) + + @pumps = [] + end + + def io + @io ||= JRuby::IO.new + end + + def exited? + return true if @exit_code + + assert_started + @exit_code = @process.exitValue + stop_pumps + + true + rescue java.lang.IllegalThreadStateException + false + ensure + log(:exit_code => @exit_code) + end + + def stop(timeout = nil) + assert_started + + @process.destroy + wait # no way to actually use the timeout here.. + end + + def wait + @process.waitFor + + stop_pumps + @exit_code = @process.exitValue + end + + # + # Only supported in JRuby on a Unix operating system, thanks to limitations + # in Java's classes + # + # @return [Fixnum] the pid of the process after it has started + # @raise [NotImplementedError] when trying to access pid on non-Unix platform + # + def pid + if @process.getClass.getName != "java.lang.UNIXProcess" + raise NotImplementedError, "pid is only supported by JRuby child processes on Unix" + end + + # About the best way we can do this is with a nasty reflection-based impl + # Thanks to Martijn Courteaux + # http://stackoverflow.com/questions/2950338/how-can-i-kill-a-linux-process-in-java-with-sigkill-process-destroy-does-sigter/2951193#2951193 + field = @process.getClass.getDeclaredField("pid") + field.accessible = true + field.get(@process) + end + + private + + def launch_process(&blk) + pb = java.lang.ProcessBuilder.new(@args) + + pb.directory java.io.File.new(@cwd || Dir.pwd) + set_env pb.environment + + begin + @process = pb.start + rescue java.io.IOException => ex + raise LaunchError, ex.message + end + + setup_io + end + + def setup_io + if @io + redirect(@process.getErrorStream, @io.stderr) + redirect(@process.getInputStream, @io.stdout) + else + @process.getErrorStream.close + @process.getInputStream.close + end + + if duplex? + io._stdin = create_stdin + else + @process.getOutputStream.close + end + end + + def redirect(input, output) + if output.nil? + input.close + return + end + + @pumps << Pump.new(input, output.to_outputstream).run + end + + def stop_pumps + @pumps.each { |pump| pump.stop } + end + + def set_env(env) + ENV.to_hash.merge(@environment).each do |k,v| + env.put(k.to_s, v.to_s) if v + end + end + + def create_stdin + output_stream = @process.getOutputStream + + stdin = output_stream.to_io + stdin.sync = true + stdin.instance_variable_set(:@childprocess_java_stream, output_stream) + + class << stdin + # The stream provided is a BufferedeOutputStream, so we + # have to flush it to make the bytes flow to the process + def __childprocess_flush__ + @childprocess_java_stream.flush + end + + [:flush, :print, :printf, :putc, :puts, :write, :write_nonblock].each do |m| + define_method(m) do |*args| + super(*args) + self.__childprocess_flush__ + end + end + end + + stdin + end + + end # Process + end # JRuby +end # ChildProcess diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/jruby/pump.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/jruby/pump.rb new file mode 100644 index 000000000..46ffaf471 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/jruby/pump.rb @@ -0,0 +1,52 @@ +module ChildProcess + module JRuby + class Pump + BUFFER_SIZE = 2048 + + def initialize(input, output) + @input = input + @output = output + @stop = false + end + + def stop + @stop = true + @thread && @thread.join + end + + def run + @thread = Thread.new { pump } + + self + end + + private + + def pump + buffer = Java.byte[BUFFER_SIZE].new + + until @stop && (@input.available == 0) + read, avail = 0, 0 + + while read != -1 + avail = [@input.available, 1].max + avail = BUFFER_SIZE if avail > BUFFER_SIZE + read = @input.read(buffer, 0, avail) + + if read > 0 + @output.write(buffer, 0, read) + @output.flush + end + end + + sleep 0.1 + end + + @output.flush + rescue java.io.IOException => ex + $stderr.puts ex.message, ex.backtrace if $DEBUG + end + + end # Pump + end # JRuby +end # ChildProcess diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/tools/generator.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/tools/generator.rb new file mode 100644 index 000000000..bb863df45 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/tools/generator.rb @@ -0,0 +1,146 @@ +require 'fileutils' + +module ChildProcess + module Tools + class Generator + EXE_NAME = "childprocess-sizeof-generator" + TMP_PROGRAM = "childprocess-sizeof-generator.c" + DEFAULT_INCLUDES = %w[stdio.h stddef.h] + + def self.generate + new.generate + end + + def initialize + @cc = ENV['CC'] || 'gcc' + @out = File.expand_path("../../unix/platform/#{ChildProcess.platform_name}.rb", __FILE__) + @sizeof = {} + @constants = {} + end + + def generate + fetch_size 'posix_spawn_file_actions_t', :include => "spawn.h" + fetch_size 'posix_spawnattr_t', :include => "spawn.h" + fetch_size 'sigset_t', :include => "signal.h" + + fetch_constant 'POSIX_SPAWN_RESETIDS', :include => 'spawn.h' + fetch_constant 'POSIX_SPAWN_SETPGROUP', :include => 'spawn.h' + fetch_constant 'POSIX_SPAWN_SETSIGDEF', :include => 'spawn.h' + fetch_constant 'POSIX_SPAWN_SETSIGMASK', :include => 'spawn.h' + + if ChildProcess.linux? + fetch_constant 'POSIX_SPAWN_USEVFORK', :include => 'spawn.h', :define => {'_GNU_SOURCE' => nil} + end + + write + end + + def write + FileUtils.mkdir_p(File.dirname(@out)) + File.open(@out, 'w') do |io| + io.puts result + end + + puts "wrote #{@out}" + end + + def fetch_size(type_name, opts = {}) + print "sizeof(#{type_name}): " + src = <<-EOF +int main() { + printf("%d", (unsigned int)sizeof(#{type_name})); + return 0; +} + EOF + + output = execute(src, opts) + + if output.to_i < 1 + raise "sizeof(#{type_name}) == #{output.to_i} (output=#{output})" + end + + size = output.to_i + @sizeof[type_name] = size + + puts size + end + + def fetch_constant(name, opts) + print "#{name}: " + src = <<-EOF +int main() { + printf("%d", (unsigned int)#{name}); + return 0; +} + EOF + + output = execute(src, opts) + value = Integer(output) + @constants[name] = value + + puts value + end + + + def execute(src, opts) + program = Array(opts[:define]).map do |key, value| + <<-SRC +#ifndef #{key} +#define #{key} #{value} +#endif + SRC + end.join("\n") + program << "\n" + + includes = Array(opts[:include]) + DEFAULT_INCLUDES + program << includes.map { |include| "#include <#{include}>" }.join("\n") + program << "\n#{src}" + + File.open(TMP_PROGRAM, 'w') do |file| + file << program + end + + cmd = "#{@cc} #{TMP_PROGRAM} -o #{EXE_NAME}" + system cmd + unless $?.success? + raise "failed to compile program: #{cmd.inspect}\n#{program}" + end + + output = `./#{EXE_NAME} 2>&1` + + unless $?.success? + raise "failed to run program: #{cmd.inspect}\n#{output}" + end + + output.chomp + ensure + File.delete TMP_PROGRAM if File.exist?(TMP_PROGRAM) + File.delete EXE_NAME if File.exist?(EXE_NAME) + end + + def result + if @sizeof.empty? && @constants.empty? + raise "no data collected, nothing to do" + end + + out = ['module ChildProcess::Unix::Platform'] + out << ' SIZEOF = {' + + max = @sizeof.keys.map { |e| e.length }.max + @sizeof.each_with_index do |(type, size), idx| + out << " :#{type.ljust max} => #{size}#{',' unless idx == @sizeof.size - 1}" + end + out << ' }' + + max = @constants.keys.map { |e| e.length }.max + @constants.each do |name, val| + out << " #{name.ljust max} = #{val}" + end + out << 'end' + + out.join "\n" + end + + end + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix.rb new file mode 100644 index 000000000..09a805467 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix.rb @@ -0,0 +1,9 @@ +module ChildProcess + module Unix + end +end + +require "childprocess/unix/io" +require "childprocess/unix/process" +require "childprocess/unix/fork_exec_process" +# PosixSpawnProcess + ffi is required on demand. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/fork_exec_process.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/fork_exec_process.rb new file mode 100644 index 000000000..14d7a7bf6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/fork_exec_process.rb @@ -0,0 +1,66 @@ +module ChildProcess + module Unix + class ForkExecProcess < Process + private + + def launch_process + if @io + stdout = @io.stdout + stderr = @io.stderr + end + + # pipe used to detect exec() failure + exec_r, exec_w = ::IO.pipe + ChildProcess.close_on_exec exec_w + + if duplex? + reader, writer = ::IO.pipe + end + + @pid = fork { + if @cwd + Dir.chdir(@cwd) + end + + exec_r.close + set_env + + STDOUT.reopen(stdout || "/dev/null") + STDERR.reopen(stderr || "/dev/null") + + if duplex? + STDIN.reopen(reader) + writer.close + end + + executable, *args = @args + + begin + exec([executable, executable], *args) + rescue SystemCallError => ex + exec_w << ex.message + end + } + + exec_w.close + + if duplex? + io._stdin = writer + reader.close + end + + # if we don't eventually get EOF, exec() failed + unless exec_r.eof? + raise LaunchError, exec_r.read || "executing command with #{@args.inspect} failed" + end + + ::Process.detach(@pid) if detach? + end + + def set_env + @environment.each { |k, v| ENV[k.to_s] = v.nil? ? nil : v.to_s } + end + + end # Process + end # Unix +end # ChildProcess diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/io.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/io.rb new file mode 100644 index 000000000..739f8c8dc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/io.rb @@ -0,0 +1,21 @@ +module ChildProcess + module Unix + class IO < AbstractIO + private + + def check_type(io) + unless io.respond_to? :to_io + raise ArgumentError, "expected #{io.inspect} to respond to :to_io" + end + + result = io.to_io + unless result && result.kind_of?(::IO) + raise TypeError, "expected IO, got #{result.inspect}:#{result.class}" + end + end + + end # IO + end # Unix +end # ChildProcess + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/lib.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/lib.rb new file mode 100644 index 000000000..addc85d7c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/lib.rb @@ -0,0 +1,181 @@ +module ChildProcess + module Unix + module Lib + extend FFI::Library + ffi_lib FFI::Library::LIBC + + if ChildProcess.os == :macosx + attach_function :_NSGetEnviron, [], :pointer + def self.environ + _NSGetEnviron().read_pointer + end + elsif respond_to? :attach_variable + attach_variable :environ, :pointer + end + + attach_function :strerror, [:int], :string + attach_function :chdir, [:string], :int + attach_function :fcntl, [:int, :int, :int], :int # fcntl actually takes varags, but we only need this version. + + # int posix_spawnp( + # pid_t *restrict pid, + # const char *restrict file, + # const posix_spawn_file_actions_t *file_actions, + # const posix_spawnattr_t *restrict attrp, + # char *const argv[restrict], + # char *const envp[restrict] + # ); + + attach_function :posix_spawnp, [ + :pointer, + :string, + :pointer, + :pointer, + :pointer, + :pointer + ], :int + + # int posix_spawn_file_actions_init(posix_spawn_file_actions_t *file_actions); + attach_function :posix_spawn_file_actions_init, [:pointer], :int + + # int posix_spawn_file_actions_destroy(posix_spawn_file_actions_t *file_actions); + attach_function :posix_spawn_file_actions_destroy, [:pointer], :int + + # int posix_spawn_file_actions_addclose(posix_spawn_file_actions_t *file_actions, int filedes); + attach_function :posix_spawn_file_actions_addclose, [:pointer, :int], :int + + # int posix_spawn_file_actions_addopen( + # posix_spawn_file_actions_t *restrict file_actions, + # int filedes, + # const char *restrict path, + # int oflag, + # mode_t mode + # ); + attach_function :posix_spawn_file_actions_addopen, [:pointer, :int, :string, :int, :mode_t], :int + + # int posix_spawn_file_actions_adddup2( + # posix_spawn_file_actions_t *file_actions, + # int filedes, + # int newfiledes + # ); + attach_function :posix_spawn_file_actions_adddup2, [:pointer, :int, :int], :int + + # int posix_spawnattr_init(posix_spawnattr_t *attr); + attach_function :posix_spawnattr_init, [:pointer], :int + + # int posix_spawnattr_destroy(posix_spawnattr_t *attr); + attach_function :posix_spawnattr_destroy, [:pointer], :int + + # int posix_spawnattr_setflags(posix_spawnattr_t *attr, short flags); + attach_function :posix_spawnattr_setflags, [:pointer, :short], :int + + # int posix_spawnattr_getflags(const posix_spawnattr_t *restrict attr, short *restrict flags); + attach_function :posix_spawnattr_getflags, [:pointer, :pointer], :int + + # int posix_spawnattr_setpgroup(posix_spawnattr_t *attr, pid_t pgroup); + attach_function :posix_spawnattr_setpgroup, [:pointer, :pid_t], :int + + # int posix_spawnattr_getpgroup(const posix_spawnattr_t *restrict attr, pid_t *restrict pgroup); + attach_function :posix_spawnattr_getpgroup, [:pointer, :pointer], :int + + # int posix_spawnattr_setsigdefault(posix_spawnattr_t *restrict attr, const sigset_t *restrict sigdefault); + attach_function :posix_spawnattr_setsigdefault, [:pointer, :pointer], :int + + # int posix_spawnattr_getsigdefault(const posix_spawnattr_t *restrict attr, sigset_t *restrict sigdefault); + attach_function :posix_spawnattr_getsigdefault, [:pointer, :pointer], :int + + # int posix_spawnattr_setsigmask(posix_spawnattr_t *restrict attr, const sigset_t *restrict sigmask); + attach_function :posix_spawnattr_setsigmask, [:pointer, :pointer], :int + + # int posix_spawnattr_getsigmask(const posix_spawnattr_t *restrict attr, sigset_t *restrict sigmask); + attach_function :posix_spawnattr_getsigmask, [:pointer, :pointer], :int + + def self.check(errno) + if errno != 0 + raise Error, Lib.strerror(errno) + end + end + + class FileActions + def initialize + @ptr = FFI::MemoryPointer.new(1, Platform::SIZEOF.fetch(:posix_spawn_file_actions_t), false) + Lib.check Lib.posix_spawn_file_actions_init(@ptr) + end + + def add_close(fileno) + Lib.check Lib.posix_spawn_file_actions_addclose( + @ptr, + fileno + ) + end + + def add_open(fileno, path, oflag, mode) + Lib.check Lib.posix_spawn_file_actions_addopen( + @ptr, + fileno, + path, + oflag, + mode + ) + end + + def add_dup(fileno, new_fileno) + Lib.check Lib.posix_spawn_file_actions_adddup2( + @ptr, + fileno, + new_fileno + ) + end + + def free + Lib.check Lib.posix_spawn_file_actions_destroy(@ptr) + @ptr = nil + end + + def to_ptr + @ptr + end + end # FileActions + + class Attrs + def initialize + @ptr = FFI::MemoryPointer.new(1, Platform::SIZEOF.fetch(:posix_spawnattr_t), false) + Lib.check Lib.posix_spawnattr_init(@ptr) + end + + def free + Lib.check Lib.posix_spawnattr_destroy(@ptr) + @ptr = nil + end + + def flags=(flags) + Lib.check Lib.posix_spawnattr_setflags(@ptr, flags) + end + + def flags + ptr = FFI::MemoryPointer.new(:short) + Lib.check Lib.posix_spawnattr_getflags(@ptr, ptr) + + ptr.read_short + end + + def to_ptr + @ptr + end + end # Attrs + + end + end +end + +# missing on rubinius +class FFI::MemoryPointer + unless method_defined?(:from_string) + def self.from_string(str) + ptr = new(1, str.bytesize + 1) + ptr.write_string("#{str}\0") + + ptr + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/platform/i386-linux.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/platform/i386-linux.rb new file mode 100644 index 000000000..ecf86eda9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/platform/i386-linux.rb @@ -0,0 +1,12 @@ +module ChildProcess::Unix::Platform + SIZEOF = { + :posix_spawn_file_actions_t => 76, + :posix_spawnattr_t => 336, + :sigset_t => 128 + } + POSIX_SPAWN_RESETIDS = 1 + POSIX_SPAWN_SETPGROUP = 2 + POSIX_SPAWN_SETSIGDEF = 4 + POSIX_SPAWN_SETSIGMASK = 8 + POSIX_SPAWN_USEVFORK = 64 +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/platform/i386-solaris.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/platform/i386-solaris.rb new file mode 100644 index 000000000..5b5578831 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/platform/i386-solaris.rb @@ -0,0 +1,11 @@ +module ChildProcess::Unix::Platform + SIZEOF = { + :posix_spawn_file_actions_t => 4, + :posix_spawnattr_t => 4, + :sigset_t => 16 + } + POSIX_SPAWN_RESETIDS = 1 + POSIX_SPAWN_SETPGROUP = 2 + POSIX_SPAWN_SETSIGDEF = 4 + POSIX_SPAWN_SETSIGMASK = 8 +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/platform/x86_64-linux.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/platform/x86_64-linux.rb new file mode 100644 index 000000000..b0c8777b2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/platform/x86_64-linux.rb @@ -0,0 +1,12 @@ +module ChildProcess::Unix::Platform + SIZEOF = { + :posix_spawn_file_actions_t => 80, + :posix_spawnattr_t => 336, + :sigset_t => 128 + } + POSIX_SPAWN_RESETIDS = 1 + POSIX_SPAWN_SETPGROUP = 2 + POSIX_SPAWN_SETSIGDEF = 4 + POSIX_SPAWN_SETSIGMASK = 8 + POSIX_SPAWN_USEVFORK = 64 +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/platform/x86_64-macosx.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/platform/x86_64-macosx.rb new file mode 100644 index 000000000..fc0383de7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/platform/x86_64-macosx.rb @@ -0,0 +1,11 @@ +module ChildProcess::Unix::Platform + SIZEOF = { + :posix_spawn_file_actions_t => 8, + :posix_spawnattr_t => 8, + :sigset_t => 4 + } + POSIX_SPAWN_RESETIDS = 1 + POSIX_SPAWN_SETPGROUP = 2 + POSIX_SPAWN_SETSIGDEF = 4 + POSIX_SPAWN_SETSIGMASK = 8 +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/posix_spawn_process.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/posix_spawn_process.rb new file mode 100644 index 000000000..b5e9a849e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/posix_spawn_process.rb @@ -0,0 +1,140 @@ +require 'ffi' +require 'thread' + +module ChildProcess + module Unix + class PosixSpawnProcess < Process + private + + @@cwd_lock = Mutex.new + + def launch_process + pid_ptr = FFI::MemoryPointer.new(:pid_t) + actions = Lib::FileActions.new + attrs = Lib::Attrs.new + flags = 0 + + if @io + if @io.stdout + actions.add_dup fileno_for(@io.stdout), fileno_for($stdout) + else + actions.add_open fileno_for($stdout), "/dev/null", File::WRONLY, 0644 + end + + if @io.stderr + actions.add_dup fileno_for(@io.stderr), fileno_for($stderr) + else + actions.add_open fileno_for($stderr), "/dev/null", File::WRONLY, 0644 + end + end + + if duplex? + reader, writer = ::IO.pipe + actions.add_dup fileno_for(reader), fileno_for($stdin) + actions.add_close fileno_for(writer) + end + + if defined? Platform::POSIX_SPAWN_USEVFORK + flags |= Platform::POSIX_SPAWN_USEVFORK + end + + attrs.flags = flags + + # wrap in helper classes in order to avoid GC'ed pointers + argv = Argv.new(@args) + envp = Envp.new(ENV.to_hash.merge(@environment)) + + ret = 0 + @@cwd_lock.synchronize do + Dir.chdir(@cwd || Dir.pwd) do + if ChildProcess.jruby? + # on JRuby, the current working directory is for some reason not inherited. + # We'll work around it by making a chdir call through FFI. + # TODO: report this to JRuby + Lib.chdir Dir.pwd + end + + ret = Lib.posix_spawnp( + pid_ptr, + @args.first, # TODO: not sure this matches exec() behaviour + actions, + attrs, + argv, + envp + ) + end + end + + if duplex? + io._stdin = writer + reader.close + end + + actions.free + attrs.free + + if ret != 0 + raise LaunchError, "#{Lib.strerror(ret)} (#{ret})" + end + + @pid = pid_ptr.read_int + ::Process.detach(@pid) if detach? + end + + if ChildProcess.jruby? + def fileno_for(obj) + ChildProcess::JRuby.posix_fileno_for(obj) + end + else + def fileno_for(obj) + obj.fileno + end + end + + class Argv + def initialize(args) + @ptrs = args.map do |e| + if e.include?("\0") + raise ArgumentError, "argument cannot contain null bytes: #{e.inspect}" + end + + FFI::MemoryPointer.from_string(e.to_s) + end + + @ptrs << FFI::Pointer.new(0) + end + + def to_ptr + argv = FFI::MemoryPointer.new(:pointer, @ptrs.size) + argv.put_array_of_pointer(0, @ptrs) + + argv + end + end # Argv + + class Envp + def initialize(env) + @ptrs = env.map do |key, val| + next if val.nil? + + if key =~ /=|\0/ || val.include?("\0") + raise InvalidEnvironmentVariable, "#{key.inspect} => #{val.inspect}" + end + + FFI::MemoryPointer.from_string("#{key}=#{val}") + end.compact + + @ptrs << FFI::Pointer.new(0) + end + + def to_ptr + env = FFI::MemoryPointer.new(:pointer, @ptrs.size) + env.put_array_of_pointer(0, @ptrs) + + env + end + end # Envp + + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/process.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/process.rb new file mode 100644 index 000000000..89ee2382b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/unix/process.rb @@ -0,0 +1,70 @@ +module ChildProcess + module Unix + class Process < AbstractProcess + attr_reader :pid + + def io + @io ||= Unix::IO.new + end + + def stop(timeout = 3) + assert_started + send_term + + begin + return poll_for_exit(timeout) + rescue TimeoutError + # try next + end + + send_kill + wait + rescue Errno::ECHILD, Errno::ESRCH + # handle race condition where process dies between timeout + # and send_kill + true + end + + def exited? + return true if @exit_code + + assert_started + pid, status = ::Process.waitpid2(@pid, ::Process::WNOHANG) + pid = nil if pid == 0 # may happen on jruby + + log(:pid => pid, :status => status) + + if pid + @exit_code = status.exitstatus || status.termsig + end + + !!pid + end + + def wait + assert_started + pid, status = ::Process.waitpid2 @pid + + @exit_code = status.exitstatus || status.termsig + end + + private + + def send_term + send_signal 'TERM' + end + + def send_kill + send_signal 'KILL' + end + + def send_signal(sig) + assert_started + + log "sending #{sig}" + ::Process.kill sig, @pid + end + + end # Process + end # Unix +end # ChildProcess diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/version.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/version.rb new file mode 100644 index 000000000..accf95bac --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/version.rb @@ -0,0 +1,3 @@ +module ChildProcess + VERSION = "0.3.9" +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows.rb new file mode 100644 index 000000000..e537372d2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows.rb @@ -0,0 +1,33 @@ +require "ffi" +require "rbconfig" + +module ChildProcess + module Windows + module Lib + extend FFI::Library + + def self.msvcrt_name + host_part = RbConfig::CONFIG['host_os'].split("_")[1] + manifest = File.join(RbConfig::CONFIG['bindir'], 'ruby.exe.manifest') + + if host_part && host_part.to_i > 80 && File.exists?(manifest) + "msvcr#{host_part}" + else + "msvcrt" + end + end + + ffi_lib "kernel32", msvcrt_name + ffi_convention :stdcall + + + end # Library + end # Windows +end # ChildProcess + +require "childprocess/windows/lib" +require "childprocess/windows/structs" +require "childprocess/windows/handle" +require "childprocess/windows/io" +require "childprocess/windows/process_builder" +require "childprocess/windows/process" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows/handle.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows/handle.rb new file mode 100644 index 000000000..6fde5d358 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows/handle.rb @@ -0,0 +1,89 @@ +module ChildProcess + module Windows + class Handle + + class << self + private :new + + def open(pid, access = PROCESS_ALL_ACCESS) + handle = Lib.open_process(access, false, pid) + + if handle.null? + raise Error, Lib.last_error_message + end + + h = new(handle, pid) + return h unless block_given? + + begin + yield h + ensure + h.close + end + end + end + + def initialize(handle, pid) + unless handle.kind_of?(FFI::Pointer) + raise TypeError, "invalid handle: #{handle.inspect}" + end + + if handle.null? + raise ArgumentError, "handle is null: #{handle.inspect}" + end + + @pid = pid + @handle = handle + @closed = false + end + + def exit_code + code_pointer = FFI::MemoryPointer.new :ulong + ok = Lib.get_exit_code(@handle, code_pointer) + + if ok + code_pointer.get_ulong(0) + else + close + raise Error, Lib.last_error_message + end + end + + def send(signal) + case signal + when 0 + exit_code == PROCESS_STILL_ALIVE + when WIN_SIGINT + Lib.generate_console_ctrl_event(CTRL_C_EVENT, @pid) + when WIN_SIGBREAK + Lib.generate_console_ctrl_event(CTRL_BREAK_EVENT, @pid) + when WIN_SIGKILL + ok = Lib.terminate_process(@handle, @pid) + Lib.check_error ok + else + thread_id = FFI::MemoryPointer.new(:ulong) + module_handle = Lib.get_module_handle("kernel32") + proc_address = Lib.get_proc_address(module_handle, "ExitProcess") + + thread = Lib.create_remote_thread(@handle, 0, 0, proc_address, 0, 0, thread_id) + check_error thread + + Lib.wait_for_single_object(thread, 5) + true + end + end + + def close + return if @closed + + Lib.close_handle(@handle) + @closed = true + end + + def wait(milliseconds = nil) + Lib.wait_for_single_object(@handle, milliseconds || INFINITE) + end + + end # Handle + end # Windows +end # ChildProcess diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows/io.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows/io.rb new file mode 100644 index 000000000..6658cc9a4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows/io.rb @@ -0,0 +1,25 @@ +module ChildProcess + module Windows + class IO < AbstractIO + private + + def check_type(io) + return if has_fileno?(io) + return if has_to_io?(io) + + raise ArgumentError, "#{io.inspect}:#{io.class} must have :fileno or :to_io" + end + + def has_fileno?(io) + io.respond_to?(:fileno) && io.fileno + end + + def has_to_io?(io) + io.respond_to?(:to_io) && io.to_io.kind_of?(::IO) + end + + end # IO + end # Windows +end # ChildProcess + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows/lib.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows/lib.rb new file mode 100644 index 000000000..01d74f6bd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows/lib.rb @@ -0,0 +1,363 @@ +module ChildProcess + module Windows + FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000 + FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000 + + PROCESS_ALL_ACCESS = 0x1F0FFF + PROCESS_QUERY_INFORMATION = 0x0400 + PROCESS_VM_READ = 0x0010 + PROCESS_STILL_ACTIVE = 259 + + INFINITE = 0xFFFFFFFF + + WIN_SIGINT = 2 + WIN_SIGBREAK = 3 + WIN_SIGKILL = 9 + + CTRL_C_EVENT = 0 + CTRL_BREAK_EVENT = 1 + + DETACHED_PROCESS = 0x00000008 + + STARTF_USESTDHANDLES = 0x00000100 + INVALID_HANDLE_VALUE = -1 + HANDLE_FLAG_INHERIT = 0x00000001 + + DUPLICATE_SAME_ACCESS = 0x00000002 + CREATE_UNICODE_ENVIRONMENT = 0x00000400 + + module Lib + enum :wait_status, [ + :wait_object_0, 0, + :wait_timeout, 0x102, + :wait_abandoned, 0x80, + :wait_failed, 0xFFFFFFFF + ] + + # + # BOOL WINAPI CreateProcess( + # __in_opt LPCTSTR lpApplicationName, + # __inout_opt LPTSTR lpCommandLine, + # __in_opt LPSECURITY_ATTRIBUTES lpProcessAttributes, + # __in_opt LPSECURITY_ATTRIBUTES lpThreadAttributes, + # __in BOOL bInheritHandles, + # __in DWORD dwCreationFlags, + # __in_opt LPVOID lpEnvironment, + # __in_opt LPCTSTR lpCurrentDirectory, + # __in LPSTARTUPINFO lpStartupInfo, + # __out LPPROCESS_INFORMATION lpProcessInformation + # ); + # + + attach_function :create_process, :CreateProcessA, [ + :pointer, + :pointer, + :pointer, + :pointer, + :bool, + :ulong, + :pointer, + :pointer, + :pointer, + :pointer], :bool + + # + # DWORD WINAPI GetLastError(void); + # + + attach_function :get_last_error, :GetLastError, [], :ulong + + # + # DWORD WINAPI FormatMessage( + # __in DWORD dwFlags, + # __in_opt LPCVOID lpSource, + # __in DWORD dwMessageId, + # __in DWORD dwLanguageId, + # __out LPTSTR lpBuffer, + # __in DWORD nSize, + # __in_opt va_list *Arguments + # ); + # + + attach_function :format_message, :FormatMessageA, [ + :ulong, + :pointer, + :ulong, + :ulong, + :pointer, + :ulong, + :pointer], :ulong + + + attach_function :close_handle, :CloseHandle, [:pointer], :bool + + # + # HANDLE WINAPI OpenProcess( + # __in DWORD dwDesiredAccess, + # __in BOOL bInheritHandle, + # __in DWORD dwProcessId + # ); + # + + attach_function :open_process, :OpenProcess, [:ulong, :bool, :ulong], :pointer + + # + # DWORD WINAPI WaitForSingleObject( + # __in HANDLE hHandle, + # __in DWORD dwMilliseconds + # ); + # + + attach_function :wait_for_single_object, :WaitForSingleObject, [:pointer, :ulong], :wait_status + + # + # BOOL WINAPI GetExitCodeProcess( + # __in HANDLE hProcess, + # __out LPDWORD lpExitCode + # ); + # + + attach_function :get_exit_code, :GetExitCodeProcess, [:pointer, :pointer], :bool + + # + # BOOL WINAPI GenerateConsoleCtrlEvent( + # __in DWORD dwCtrlEvent, + # __in DWORD dwProcessGroupId + # ); + # + + attach_function :generate_console_ctrl_event, :GenerateConsoleCtrlEvent, [:ulong, :ulong], :bool + + # + # BOOL WINAPI TerminateProcess( + # __in HANDLE hProcess, + # __in UINT uExitCode + # ); + # + + attach_function :terminate_process, :TerminateProcess, [:pointer, :uint], :bool + + # + # intptr_t _get_osfhandle( + # int fd + # ); + # + + attach_function :get_osfhandle, :_get_osfhandle, [:int], :intptr_t + + # + # int _open_osfhandle ( + # intptr_t osfhandle, + # int flags + # ); + # + + attach_function :open_osfhandle, :_open_osfhandle, [:pointer, :int], :int + + # BOOL WINAPI SetHandleInformation( + # __in HANDLE hObject, + # __in DWORD dwMask, + # __in DWORD dwFlags + # ); + + attach_function :set_handle_information, :SetHandleInformation, [:pointer, :ulong, :ulong], :bool + + # BOOL WINAPI GetHandleInformation( + # __in HANDLE hObject, + # __out LPDWORD lpdwFlags + # ); + + attach_function :get_handle_information, :GetHandleInformation, [:pointer, :pointer], :bool + + # BOOL WINAPI CreatePipe( + # __out PHANDLE hReadPipe, + # __out PHANDLE hWritePipe, + # __in_opt LPSECURITY_ATTRIBUTES lpPipeAttributes, + # __in DWORD nSize + # ); + + attach_function :create_pipe, :CreatePipe, [:pointer, :pointer, :pointer, :ulong], :bool + + # + # HANDLE WINAPI GetCurrentProcess(void); + # + + attach_function :current_process, :GetCurrentProcess, [], :pointer + + # + # BOOL WINAPI DuplicateHandle( + # __in HANDLE hSourceProcessHandle, + # __in HANDLE hSourceHandle, + # __in HANDLE hTargetProcessHandle, + # __out LPHANDLE lpTargetHandle, + # __in DWORD dwDesiredAccess, + # __in BOOL bInheritHandle, + # __in DWORD dwOptions + # ); + # + + attach_function :_duplicate_handle, :DuplicateHandle, [ + :pointer, + :pointer, + :pointer, + :pointer, + :ulong, + :bool, + :ulong + ], :bool + + class << self + def kill(signal, *pids) + case signal + when 'SIGINT', 'INT', :SIGINT, :INT + signal = WIN_SIGINT + when 'SIGBRK', 'BRK', :SIGBREAK, :BRK + signal = WIN_SIGBREAK + when 'SIGKILL', 'KILL', :SIGKILL, :KILL + signal = WIN_SIGKILL + when 0..9 + # Do nothing + else + raise Error, "invalid signal #{signal.inspect}" + end + + pids.map { |pid| pid if Lib.send_signal(signal, pid) }.compact + end + + def waitpid(pid, flags = 0) + wait_for_pid(pid, no_hang?(flags)) + end + + def waitpid2(pid, flags = 0) + code = wait_for_pid(pid, no_hang?(flags)) + + [pid, code] if code + end + + def dont_inherit(file) + unless file.respond_to?(:fileno) + raise ArgumentError, "expected #{file.inspect} to respond to :fileno" + end + + set_handle_inheritance(handle_for(file.fileno), false) + end + + def last_error_message + errnum = get_last_error + buf = FFI::MemoryPointer.new :char, 512 + + size = format_message( + FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY, + nil, errnum, 0, buf, buf.size, nil + ) + + str = buf.read_string(size).strip + if errnum == 0 + "Unknown error (Windows says #{str.inspect}, but it did not.)" + else + "#{str} (#{errnum})" + end + end + + def handle_for(fd_or_io) + if fd_or_io.kind_of?(IO) || fd_or_io.respond_to?(:fileno) + if ChildProcess.jruby? + handle = ChildProcess::JRuby.windows_handle_for(fd_or_io) + else + handle = get_osfhandle(fd_or_io.fileno) + end + elsif fd_or_io.kind_of?(Fixnum) + handle = get_osfhandle(fd_or_io) + elsif fd_or_io.respond_to?(:to_io) + io = fd_or_io.to_io + + unless io.kind_of?(IO) + raise TypeError, "expected #to_io to return an instance of IO" + end + + handle = get_osfhandle(io.fileno) + else + raise TypeError, "invalid type: #{fd_or_io.inspect}" + end + + if handle == INVALID_HANDLE_VALUE + raise Error, last_error_message + end + + FFI::Pointer.new handle + end + + def io_for(handle, flags = File::RDONLY) + fd = open_osfhandle(handle, flags) + if fd == -1 + raise Error, last_error_message + end + + FFI::IO.for_fd fd, flags + end + + def duplicate_handle(handle) + dup = FFI::MemoryPointer.new(:pointer) + proc = current_process + + ok = Lib._duplicate_handle( + proc, + handle, + proc, + dup, + 0, + false, + DUPLICATE_SAME_ACCESS + ) + + check_error ok + + dup.read_pointer + ensure + close_handle proc + end + + def set_handle_inheritance(handle, bool) + status = set_handle_information( + handle, + HANDLE_FLAG_INHERIT, + bool ? HANDLE_FLAG_INHERIT : 0 + ) + + check_error status + end + + def get_handle_inheritance(handle) + flags = FFI::MemoryPointer.new(:uint) + + status = get_handle_information( + handle, + flags + ) + + check_error status + + flags.read_uint + end + + def check_error(bool) + bool or raise Error, last_error_message + end + + def no_hang?(flags) + (flags & Process::WNOHANG) == Process::WNOHANG + end + + def wait_for_pid(pid, no_hang) + code = Handle.open(pid) { |handle| + handle.wait unless no_hang + handle.exit_code + } + + code if code != PROCESS_STILL_ACTIVE + end + end + + end # Lib + end # Windows +end # ChildProcess diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows/process.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows/process.rb new file mode 100755 index 000000000..ce86d9a47 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows/process.rb @@ -0,0 +1,76 @@ +module ChildProcess + module Windows + class Process < AbstractProcess + + attr_reader :pid + + def io + @io ||= Windows::IO.new + end + + def stop(timeout = 3) + assert_started + + # just kill right away on windows. + log "sending KILL" + @handle.send(WIN_SIGKILL) + + poll_for_exit(timeout) + ensure + @handle.close + end + + def wait + @handle.wait + @exit_code = @handle.exit_code + @handle.close + + @exit_code + end + + def exited? + return true if @exit_code + assert_started + + code = @handle.exit_code + exited = code != PROCESS_STILL_ACTIVE + + log(:exited? => exited, :code => code) + + if exited + @exit_code = code + @handle.close + end + + exited + end + + private + + def launch_process + builder = ProcessBuilder.new(@args) + builder.inherit = false + builder.detach = detach? + builder.duplex = duplex? + builder.environment = @environment unless @environment.empty? + builder.cwd = @cwd + + if @io + builder.stdout = @io.stdout + builder.stderr = @io.stderr + end + + @pid = builder.start + @handle = Handle.open @pid + + if duplex? + raise Error, "no stdin stream" unless builder.stdin + io._stdin = builder.stdin + end + + self + end + + end # Process + end # Windows +end # ChildProcess diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows/process_builder.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows/process_builder.rb new file mode 100644 index 000000000..92c0e8c08 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows/process_builder.rb @@ -0,0 +1,179 @@ +module ChildProcess + module Windows + class ProcessBuilder + attr_accessor :inherit, :detach, :duplex, :environment, :stdout, :stderr, :cwd + attr_reader :stdin + + def initialize(args) + @args = args + + @inherit = false + @detach = false + @duplex = false + @environment = nil + @cwd = nil + + @stdout = nil + @stderr = nil + @stdin = nil + + @flags = 0 + @cmd_ptr = nil + @env_ptr = nil + @cwd_ptr = nil + end + + def start + create_command_pointer + create_environment_pointer + create_cwd_pointer + + setup_detach + setup_io + + pid = create_process + close_handles + + pid + end + + private + + def create_command_pointer + string = @args.map { |arg| quote_if_necessary(arg.to_s) }.join ' ' + @cmd_ptr = FFI::MemoryPointer.from_string string + end + + def create_environment_pointer + return unless @environment.kind_of?(Hash) && @environment.any? + + strings = [] + + ENV.to_hash.merge(@environment).each do |key, val| + next if val.nil? + + if key.to_s =~ /=|\0/ || val.to_s.include?("\0") + raise InvalidEnvironmentVariable, "#{key.inspect} => #{val.inspect}" + end + + strings << "#{key}=#{val}\0" + end + + strings << "\0" # terminate the env block + env_str = strings.join + + @env_ptr = FFI::MemoryPointer.new(:long, env_str.bytesize) + @env_ptr.put_bytes 0, env_str, 0, env_str.bytesize + end + + def create_cwd_pointer + @cwd_ptr = FFI::MemoryPointer.from_string(@cwd || Dir.pwd) + end + + def create_process + ok = Lib.create_process( + nil, # application name + @cmd_ptr, # command line + nil, # process attributes + nil, # thread attributes + @inherit, # inherit handles + @flags, # creation flags + @env_ptr, # environment + @cwd_ptr, # current directory + startup_info, # startup info + process_info # process info + ) + + ok or raise LaunchError, Lib.last_error_message + + process_info[:dwProcessId] + end + + def startup_info + @startup_info ||= StartupInfo.new + end + + def process_info + @process_info ||= ProcessInfo.new + end + + def setup_detach + @flags |= DETACHED_PROCESS if @detach + end + + def setup_io + if @stdout || @stderr + startup_info[:dwFlags] ||= 0 + startup_info[:dwFlags] |= STARTF_USESTDHANDLES + + @inherit = true + + if @stdout + startup_info[:hStdOutput] = std_stream_handle_for(@stdout) + end + + if @stderr + startup_info[:hStdError] = std_stream_handle_for(@stderr) + end + end + + setup_stdin if @duplex + end + + def setup_stdin + read_pipe_ptr = FFI::MemoryPointer.new(:pointer) + write_pipe_ptr = FFI::MemoryPointer.new(:pointer) + sa = SecurityAttributes.new(:inherit => true) + + ok = Lib.create_pipe(read_pipe_ptr, write_pipe_ptr, sa, 0) + Lib.check_error ok + + @read_pipe = read_pipe_ptr.read_pointer + @write_pipe = write_pipe_ptr.read_pointer + + @inherit = true + Lib.set_handle_inheritance @read_pipe, true + Lib.set_handle_inheritance @write_pipe, false + + startup_info[:hStdInput] = @read_pipe + end + + def std_stream_handle_for(io) + handle = Lib.handle_for(io) + + begin + Lib.set_handle_inheritance handle, true + rescue ChildProcess::Error + # If the IO was set to close on exec previously, this call will fail. + # That's probably OK, since the user explicitly asked for it to be + # closed (at least I have yet to find other cases where this will + # happen...) + end + + handle + end + + def close_handles + Lib.close_handle process_info[:hProcess] + Lib.close_handle process_info[:hThread] + + if @duplex + @stdin = Lib.io_for(Lib.duplicate_handle(@write_pipe), File::WRONLY) + Lib.close_handle @read_pipe + Lib.close_handle @write_pipe + end + end + + def quote_if_necessary(str) + quote = str.start_with?('"') ? "'" : '"' + + case str + when /[\s\\'"]/ + [quote, str, quote].join + else + str + end + end + end # ProcessBuilder + end # Windows +end # ChildProcess diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows/structs.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows/structs.rb new file mode 100644 index 000000000..b797241b5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/lib/childprocess/windows/structs.rb @@ -0,0 +1,83 @@ +module ChildProcess + module Windows + # typedef struct _STARTUPINFO { + # DWORD cb; + # LPTSTR lpReserved; + # LPTSTR lpDesktop; + # LPTSTR lpTitle; + # DWORD dwX; + # DWORD dwY; + # DWORD dwXSize; + # DWORD dwYSize; + # DWORD dwXCountChars; + # DWORD dwYCountChars; + # DWORD dwFillAttribute; + # DWORD dwFlags; + # WORD wShowWindow; + # WORD cbReserved2; + # LPBYTE lpReserved2; + # HANDLE hStdInput; + # HANDLE hStdOutput; + # HANDLE hStdError; + # } STARTUPINFO, *LPSTARTUPINFO; + + class StartupInfo < FFI::Struct + layout :cb, :ulong, + :lpReserved, :pointer, + :lpDesktop, :pointer, + :lpTitle, :pointer, + :dwX, :ulong, + :dwY, :ulong, + :dwXSize, :ulong, + :dwYSize, :ulong, + :dwXCountChars, :ulong, + :dwYCountChars, :ulong, + :dwFillAttribute, :ulong, + :dwFlags, :ulong, + :wShowWindow, :ushort, + :cbReserved2, :ushort, + :lpReserved2, :pointer, + :hStdInput, :pointer, # void ptr + :hStdOutput, :pointer, # void ptr + :hStdError, :pointer # void ptr + end + + # + # typedef struct _PROCESS_INFORMATION { + # HANDLE hProcess; + # HANDLE hThread; + # DWORD dwProcessId; + # DWORD dwThreadId; + # } PROCESS_INFORMATION, *LPPROCESS_INFORMATION; + # + + class ProcessInfo < FFI::Struct + layout :hProcess, :pointer, # void ptr + :hThread, :pointer, # void ptr + :dwProcessId, :ulong, + :dwThreadId, :ulong + end + + # + # typedef struct _SECURITY_ATTRIBUTES { + # DWORD nLength; + # LPVOID lpSecurityDescriptor; + # BOOL bInheritHandle; + # } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES; + # + + class SecurityAttributes < FFI::Struct + layout :nLength, :ulong, + :lpSecurityDescriptor, :pointer, # void ptr + :bInheritHandle, :int + + def initialize(opts = {}) + super() + + self[:nLength] = self.class.size + self[:lpSecurityDescriptor] = nil + self[:bInheritHandle] = opts[:inherit] ? 1 : 0 + end + end + end # Windows +end # ChildProcess \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/abstract_io_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/abstract_io_spec.rb new file mode 100644 index 000000000..06d763b8a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/abstract_io_spec.rb @@ -0,0 +1,12 @@ +require File.expand_path('../spec_helper', __FILE__) + +describe ChildProcess::AbstractIO do + let(:io) { ChildProcess::AbstractIO.new } + + it "inherits the parent's IO streams" do + io.inherit! + + io.stdout.should == STDOUT + io.stderr.should == STDERR + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/childprocess_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/childprocess_spec.rb new file mode 100644 index 000000000..ab7021faa --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/childprocess_spec.rb @@ -0,0 +1,206 @@ +# encoding: utf-8 + +require File.expand_path('../spec_helper', __FILE__) + +describe ChildProcess do + it "returns self when started" do + process = sleeping_ruby + + process.start.should == process + process.should be_started + end + + # We can't detect failure to execve() when using posix_spawn() on Linux + # without waiting for the child to exit with code 127. + # + # See e.g. http://repo.or.cz/w/glibc.git/blob/669704fd:/sysdeps/posix/spawni.c#l34 + # + # We could work around this by doing the PATH search ourselves, but not sure + # it's worth it. + it "raises ChildProcess::LaunchError if the process can't be started", :posix_spawn_on_linux => false do + expect { invalid_process.start }.to raise_error(ChildProcess::LaunchError) + end + + it 'raises ArgumentError if given a non-string argument' do + expect { ChildProcess.build(nil, "unlikelytoexist") }.to raise_error(ArgumentError) + expect { ChildProcess.build("foo", 1) }.to raise_error(ArgumentError) + end + + it "knows if the process crashed" do + process = exit_with(1).start + process.wait + + process.should be_crashed + end + + it "knows if the process didn't crash" do + process = exit_with(0).start + process.wait + + process.should_not be_crashed + end + + it "can wait for a process to finish" do + process = exit_with(0).start + return_value = process.wait + + process.should_not be_alive + return_value.should == 0 + end + + it "escalates if TERM is ignored" do + process = ignored('TERM').start + process.stop + process.should be_exited + end + + it "accepts a timeout argument to #stop" do + process = sleeping_ruby.start + process.stop(exit_timeout) + end + + it "lets child process inherit the environment of the current process" do + Tempfile.open("env-spec") do |file| + with_env('INHERITED' => 'yes') do + process = write_env(file.path).start + process.wait + end + + file.rewind + child_env = eval(file.read) + child_env['INHERITED'].should == 'yes' + end + end + + it "can override env vars only for the current process" do + Tempfile.open("env-spec") do |file| + process = write_env(file.path) + process.environment['CHILD_ONLY'] = '1' + process.start + + ENV['CHILD_ONLY'].should be_nil + + process.wait + file.rewind + + child_env = eval(file.read) + child_env['CHILD_ONLY'].should == '1' + end + end + + it "inherits the parent's env vars also when some are overridden" do + Tempfile.open("env-spec") do |file| + with_env('INHERITED' => 'yes', 'CHILD_ONLY' => 'no') do + process = write_env(file.path) + process.environment['CHILD_ONLY'] = 'yes' + + process.start + process.wait + + file.rewind + child_env = eval(file.read) + + child_env['INHERITED'].should == 'yes' + child_env['CHILD_ONLY'].should == 'yes' + end + end + end + + it "can unset env vars" do + Tempfile.open("env-spec") do |file| + ENV['CHILDPROCESS_UNSET'] = '1' + process = write_env(file.path) + process.environment['CHILDPROCESS_UNSET'] = nil + process.start + + process.wait + file.rewind + + child_env = eval(file.read) + child_env.should_not have_key('CHILDPROCESS_UNSET') + end + end + + + it "passes arguments to the child" do + args = ["foo", "bar"] + + Tempfile.open("argv-spec") do |file| + process = write_argv(file.path, *args).start + process.wait + + file.rewind + file.read.should == args.inspect + end + end + + it "lets a detached child live on" do + pending "how do we spec this?" + end + + it "preserves Dir.pwd in the child" do + Tempfile.open("dir-spec-out") do |file| + process = ruby("print Dir.pwd") + process.io.stdout = process.io.stderr = file + + expected_dir = nil + Dir.chdir(Dir.tmpdir) do + expected_dir = Dir.pwd + process.start + end + + process.wait + + file.rewind + file.read.should == expected_dir + end + end + + it "can handle whitespace, special characters and quotes in arguments" do + args = ["foo bar", 'foo\bar', "'i-am-quoted'", '"i am double quoted"'] + + Tempfile.open("argv-spec") do |file| + process = write_argv(file.path, *args).start + process.wait + + file.rewind + file.read.should == args.inspect + end + end + + it 'handles whitespace in the executable name' do + path = File.expand_path('foo bar') + + with_executable_at(path) do |proc| + proc.start.should == proc + proc.should be_started + end + end + + it "times out when polling for exit" do + process = sleeping_ruby.start + lambda { process.poll_for_exit(0.1) }.should raise_error(ChildProcess::TimeoutError) + end + + it "can change working directory" do + process = ruby "print Dir.pwd" + + with_tmpdir { |dir| + process.cwd = dir + + orig_pwd = Dir.pwd + + Tempfile.open('cwd') do |file| + process.io.stdout = file + + process.start + process.wait + + file.rewind + file.read.should == dir + end + + Dir.pwd.should == orig_pwd + } + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/io_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/io_spec.rb new file mode 100644 index 000000000..1ab5efae9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/io_spec.rb @@ -0,0 +1,217 @@ +require File.expand_path('../spec_helper', __FILE__) + +describe ChildProcess do + it "can redirect stdout, stderr" do + process = ruby(<<-CODE) + [STDOUT, STDERR].each_with_index do |io, idx| + io.sync = true + io.puts idx + end + CODE + + out = Tempfile.new("stdout-spec") + err = Tempfile.new("stderr-spec") + + begin + process.io.stdout = out + process.io.stderr = err + + process.start + process.io.stdin.should be_nil + process.wait + + out.rewind + err.rewind + + out.read.should == "0\n" + err.read.should == "1\n" + ensure + out.close + err.close + end + end + + it "can redirect stdout only" do + process = ruby(<<-CODE) + [STDOUT, STDERR].each_with_index do |io, idx| + io.sync = true + io.puts idx + end + CODE + + out = Tempfile.new("stdout-spec") + + begin + process.io.stdout = out + + process.start + process.wait + + out.rewind + out.read.should == "0\n" + ensure + out.close + end + end + + it "pumps all output" do + 10.times do |i| + process = echo + + out = Tempfile.new("duplex") + + begin + process.io.stdout = out + + process.start + process.poll_for_exit(exit_timeout) + + out.rewind + out.read.should == "hello\n" + ensure + out.close + end + end + end + + it "can write to stdin if duplex = true" do + process = cat + + out = Tempfile.new("duplex") + out.sync = true + + begin + process.io.stdout = out + process.io.stderr = out + process.duplex = true + + process.start + process.io.stdin.puts "hello world" + process.io.stdin.close + + process.poll_for_exit(exit_timeout) + + out.rewind + out.read.should == "hello world\n" + ensure + out.close + end + end + + it "can write to stdin interactively if duplex = true" do + process = cat + + out = Tempfile.new("duplex") + out.sync = true + + out_receiver = File.open(out.path, "rb") + begin + process.io.stdout = out + process.io.stderr = out + process.duplex = true + + process.start + + stdin = process.io.stdin + lf = ChildProcess.windows? ? "\r\n" : "\n" + + stdin.puts "hello" + stdin.flush + wait_until { rewind_and_read(out_receiver).should == "hello#{lf}" } + + stdin.putc "n" + stdin.flush + wait_until { rewind_and_read(out_receiver).should == "hello#{lf}n" } + + stdin.print "e" + stdin.flush + wait_until { rewind_and_read(out_receiver).should == "hello#{lf}ne" } + + stdin.printf "w" + stdin.flush + wait_until { rewind_and_read(out_receiver).should == "hello#{lf}new" } + + stdin.write "\nworld\n" + stdin.flush + wait_until { rewind_and_read(out_receiver).should == "hello#{lf}new#{lf}world#{lf}" } + + stdin.close + process.poll_for_exit(exit_timeout) + ensure + out_receiver.close + out.close + end + end + + # + # this works on JRuby 1.6.5 on my Mac, but for some reason + # hangs on Travis (running 1.6.5.1 + OpenJDK). + # + # http://travis-ci.org/#!/jarib/childprocess/jobs/487331 + # + + it "works with pipes", :process_builder => false do + process = ruby(<<-CODE) + STDOUT.print "stdout" + STDERR.print "stderr" + CODE + + stdout, stdout_w = IO.pipe + stderr, stderr_w = IO.pipe + + process.io.stdout = stdout_w + process.io.stderr = stderr_w + + process.duplex = true + + process.start + process.wait + + # write streams are closed *after* the process + # has exited - otherwise it won't work on JRuby + # with the current Process implementation + + stdout_w.close + stderr_w.close + + out = stdout.read + err = stderr.read + + [out, err].should == %w[stdout stderr] + end + + it "can set close-on-exec when IO is inherited" do + port = random_free_port + server = TCPServer.new("127.0.0.1", port) + ChildProcess.close_on_exec server + + process = sleeping_ruby + process.io.inherit! + + process.start + server.close + + wait_until { can_bind? "127.0.0.1", port } + end + + it "handles long output" do + process = ruby <<-CODE + print 'a'*3000 + CODE + + out = Tempfile.new("long-output") + out.sync = true + + begin + process.io.stdout = out + + process.start + process.wait + + out.rewind + out.read.size.should == 3000 + ensure + out.close + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/jruby_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/jruby_spec.rb new file mode 100644 index 000000000..f0b6a5f8e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/jruby_spec.rb @@ -0,0 +1,24 @@ +require File.expand_path('../spec_helper', __FILE__) +require "pid_behavior" + +if ChildProcess.jruby? && !ChildProcess.windows? + describe ChildProcess::JRuby::IO do + let(:io) { ChildProcess::JRuby::IO.new } + + it "raises an ArgumentError if given IO does not respond to :to_outputstream" do + lambda { io.stdout = nil }.should raise_error(ArgumentError) + end + end + + describe ChildProcess::JRuby::Process do + if ChildProcess.unix? + it_behaves_like "a platform that provides the child's pid" + else + it "raises an error when trying to access the child's pid" do + process = exit_with(0) + process.start + lambda { process.pid }.should raise_error(NotImplementedError) + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/pid_behavior.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/pid_behavior.rb new file mode 100644 index 000000000..432e69a97 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/pid_behavior.rb @@ -0,0 +1,13 @@ +require File.expand_path('../spec_helper', __FILE__) + +shared_examples_for "a platform that provides the child's pid" do + it "knows the child's pid" do + Tempfile.open("pid-spec") do |file| + process = write_pid(file.path).start + process.wait + file.rewind + + process.pid.should == file.read.chomp.to_i + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/spec_helper.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/spec_helper.rb new file mode 100644 index 000000000..9cedec67e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/spec_helper.rb @@ -0,0 +1,216 @@ +$LOAD_PATH.unshift(File.dirname(__FILE__)) +$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib')) + +require 'childprocess' +require 'rspec' +require 'tempfile' +require 'socket' +require 'stringio' + +module ChildProcessSpecHelper + RUBY = defined?(Gem) ? Gem.ruby : 'ruby' + + def ruby_process(*args) + @process = ChildProcess.build(RUBY , *args) + end + + def sleeping_ruby + ruby_process("-e", "sleep") + end + + def invalid_process + @process = ChildProcess.build("unlikelytoexist") + end + + def ignored(signal) + code = <<-RUBY + trap(#{signal.inspect}, "IGNORE") + sleep + RUBY + + ruby_process tmp_script(code) + end + + def write_env(path) + code = <<-RUBY + File.open(#{path.inspect}, "w") { |f| f << ENV.inspect } + RUBY + + ruby_process tmp_script(code) + end + + def write_argv(path, *args) + code = <<-RUBY + File.open(#{path.inspect}, "w") { |f| f << ARGV.inspect } + RUBY + + ruby_process(tmp_script(code), *args) + end + + def write_pid(path) + code = <<-RUBY + File.open(#{path.inspect}, "w") { |f| f << Process.pid } + RUBY + + ruby_process tmp_script(code) + end + + def exit_with(exit_code) + ruby_process(tmp_script("exit(#{exit_code})")) + end + + def with_env(hash) + hash.each { |k,v| ENV[k] = v } + begin + yield + ensure + hash.each_key { |k| ENV[k] = nil } + end + end + + def tmp_script(code) + # use an ivar to avoid GC + @tf = Tempfile.new("childprocess-temp") + @tf << code + @tf.close + + puts code if $DEBUG + + @tf.path + end + + def within(seconds, &blk) + end_time = Time.now + seconds + ok = false + last_error = nil + + until ok || Time.now >= end_time + begin + ok = yield + rescue RSpec::Expectations::ExpectationNotMetError => last_error + end + end + + raise last_error unless ok + end + + def cat + if ChildProcess.os == :windows + ruby(<<-CODE) + STDIN.sync = STDOUT.sync = true + IO.copy_stream(STDIN, STDOUT) + CODE + else + ChildProcess.build("cat") + end + end + + def echo + if ChildProcess.os == :windows + ruby(<<-CODE) + STDIN.sync = true + STDOUT.sync = true + + puts "hello" + CODE + else + ChildProcess.build("echo", "hello") + end + end + + def ruby(code) + ruby_process(tmp_script(code)) + end + + def with_executable_at(path, &blk) + if ChildProcess.os == :windows + path << ".cmd" + content = "@echo foo" + else + content = "#!/bin/sh\necho foo" + end + + File.open(path, 'w', 0744) { |io| io << content } + proc = ChildProcess.build(path) + + begin + yield proc + ensure + proc.stop if proc.alive? + File.delete path + end + end + + def exit_timeout + 10 + end + + def random_free_port + server = TCPServer.new('127.0.0.1', 0) + port = server.addr[1] + server.close + + port + end + + def with_tmpdir(&blk) + name = "#{Time.now.strftime("%Y%m%d")}-#{$$}-#{rand(0x100000000).to_s(36)}" + FileUtils.mkdir_p(name) + + begin + yield File.expand_path(name) + ensure + FileUtils.rm_rf name + end + end + + def wait_until(timeout = 10, &blk) + end_time = Time.now + timeout + last_exception = nil + + until Time.now >= end_time + begin + return if yield + rescue RSpec::Expectations::ExpectationNotMetError => ex + last_exception = ex + end + + sleep 0.05 + end + + msg = "timed out after #{timeout} seconds" + msg << ":\n#{last_exception.message}" if last_exception + + raise msg + end + + def can_bind?(host, port) + TCPServer.new(host, port).close + true + rescue + false + end + + def rewind_and_read(io) + io.rewind + io.read + end + +end # ChildProcessSpecHelper + +Thread.abort_on_exception = true + +RSpec.configure do |c| + c.include(ChildProcessSpecHelper) + c.after(:each) { + @process && @process.alive? && @process.stop + } + + if ChildProcess.jruby? && ChildProcess.new("true").instance_of?(ChildProcess::JRuby::Process) + c.filter_run_excluding :process_builder => false + end + + if ChildProcess.linux? && ChildProcess.posix_spawn? + c.filter_run_excluding :posix_spawn_on_linux => false + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/unix_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/unix_spec.rb new file mode 100644 index 000000000..de7fa13fe --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/unix_spec.rb @@ -0,0 +1,53 @@ +require File.expand_path('../spec_helper', __FILE__) +require "pid_behavior" + +if ChildProcess.unix? && !ChildProcess.jruby? && !ChildProcess.posix_spawn? + + describe ChildProcess::Unix::Process do + it_behaves_like "a platform that provides the child's pid" + + it "handles ECHILD race condition where process dies between timeout and KILL" do + process = sleeping_ruby + + process.stub!(:fork).and_return('fakepid') + process.stub!(:send_term) + process.stub!(:poll_for_exit).and_raise(ChildProcess::TimeoutError) + process.stub!(:send_kill).and_raise(Errno::ECHILD.new) + + process.start + lambda { process.stop }.should_not raise_error + + process.stub(:alive?).and_return(false) + end + + it "handles ESRCH race condition where process dies between timeout and KILL" do + process = sleeping_ruby + + process.stub!(:fork).and_return('fakepid') + process.stub!(:send_term) + process.stub!(:poll_for_exit).and_raise(ChildProcess::TimeoutError) + process.stub!(:send_kill).and_raise(Errno::ESRCH.new) + + process.start + lambda { process.stop }.should_not raise_error + + process.stub(:alive?).and_return(false) + end + end + + describe ChildProcess::Unix::IO do + let(:io) { ChildProcess::Unix::IO.new } + + it "raises an ArgumentError if given IO does not respond to :to_io" do + lambda { io.stdout = nil }.should raise_error(ArgumentError, /to respond to :to_io/) + end + + it "raises a TypeError if #to_io does not return an IO" do + fake_io = Object.new + def fake_io.to_io() StringIO.new end + + lambda { io.stdout = fake_io }.should raise_error(TypeError, /expected IO, got/) + end + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/windows_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/windows_spec.rb new file mode 100644 index 000000000..f31dbcf3f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/childprocess-0.3.9/spec/windows_spec.rb @@ -0,0 +1,23 @@ +require File.expand_path('../spec_helper', __FILE__) +require "pid_behavior" + +if ChildProcess.windows? + describe ChildProcess::Windows::Process do + it_behaves_like "a platform that provides the child's pid" + end + + describe ChildProcess::Windows::IO do + let(:io) { ChildProcess::Windows::IO.new } + + it "raises an ArgumentError if given IO does not respond to :fileno" do + lambda { io.stdout = nil }.should raise_error(ArgumentError, /must have :fileno or :to_io/) + end + + it "raises an ArgumentError if the #to_io does not return an IO " do + fake_io = Object.new + def fake_io.to_io() StringIO.new end + + lambda { io.stdout = fake_io }.should raise_error(ArgumentError, /must have :fileno or :to_io/) + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/CHANGELOG b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/CHANGELOG new file mode 100644 index 000000000..0cc35e804 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/CHANGELOG @@ -0,0 +1,77 @@ +* Add support for /previews endpoint. + +1.6.5 (2015-7-28) +* Update SDK to include a few new fixes +* Sync up github and rubygems version of this SDK + +1.6.4 (2014-4-12) +* Bugfixes +* Update gemspec to include all examples +* Release tests and other internal scripts + +1.6.3 (2013-12-11) +* Stricter SSL: Update certs, use only approved ciphersuites, work around + Ruby SSL bugs. +* Upgrade OAuth 1 tokens with DropboxClient.create_oauth2_access_token and + DropboxClient.disable_oauth2_access_token. +* delta(): Add support for "path_prefix" parameter. + +1.6.2 (2013-10-10) +* Put params in body for POST requests (they were being put in the URL). + Fixes bug with /delta and really long cursors. + +1.6.1 (2013-07-08) +* Fixed syntax error (Ruby 1.8.7 didn't mind, but Ruby 1.9 did). + +1.6 (2013-07-07) +* Added OAuth 2 support (DropboxOAuth2Flow). OAuth 1 still works. +* Fixed many minor bugs. + +1.5.1 (2012-8-20) +* Fixed packaging. + +1.5 (2012-8-15) +* Support for uploading large files via /chunked_upload + +1.3.1 (2012-5-16) +* Increase metadata() file list limit to 25,000 (used to be 10,000). +* Use CGI.escape() instead of the deprecated URI.escape(). + +1.3 (2012-3-26) +* Add support for the /delta API. +* Add support for the "copy ref" API. + +1.2 (2012-1-11) +* Adds a method to the SDK that returns the file metadata when downloading a + file or its thumbnail. +* Validate server's SSL certificate against CAs in included certificate file. + +1.1 (2011-10-17) +* Various bug fixes found during beta period +* Improved documentation +* Improved module structure +* Removed dependency on the oauth module, using plaintext authentication over https + +1.0 (2011-8-16) +* Backwards compatibility broken + - Changed interface + - Change 'sandbox' references to 'app_folder' +* Updated SDK to Dropbox API Version 1, supporting all calls + - Added 'rev' parameter to metadata and get_file + - Added 'parent_rev' parameter to put_file + - Added search, share, media, revisions, and restore + - put_file uses /files_put instead of multipart POST + - Removed methods for calls that were removed from v1 of the REST API +* Changed return format for calls + - On error (non-200 response), an exception is raised + - On success, the JSON is parsed and a Hash is returned +* Updated examples + - Improved CLI example + - Added a Ruby on Rails 3 controller example + - Added a web based file browser/uploader that uses Sinatra +* put_file no longer takes a "name" arugment, only takes a full path +* Removed reliance on config files +* Assorted bugfixes and improvements +* All calls are now made over SSL +* Fully documented code for RDoc generation +* Added a CHANGELOG diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/LICENSE b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/LICENSE new file mode 100644 index 000000000..bd449e123 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2009-2011 Dropbox Inc., http://www.dropbox.com/ + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/README b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/README new file mode 100644 index 000000000..d7efa14e8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/README @@ -0,0 +1,61 @@ +Dropbox Core SDK for Ruby + +A Ruby library that for Dropbox's HTTP-based Core API. + + https://www.dropbox.com/developers/core/docs + +---------------------------------- +Setup + +You can install this package using 'gem': + + # gem install dropbox-sdk + +---------------------------------- +Getting a Dropbox API key + +You need a Dropbox API key to make API requests. +- Go to: https://dropbox.com/developers/apps +- If you've already registered an app, click on the "Options" link to see the + app's API key and secret. +- Otherwise, click "Create an app" to register an app. Choose "Full Dropbox" or + "App Folder" depending on your needs. + See: https://www.dropbox.com/developers/reference#permissions + +---------------------------------- +Using the Dropbox API + +Full documentation: https://www.dropbox.com/developers/core/ + +Before your app can access a Dropbox user's files, the user must authorize your +application using OAuth 2. Successfully completing this authorization flow +gives you an "access token" for the user's Dropbox account, which grants you the +ability to make Dropbox API calls to access their files. + +- Authorization example for a web app: web_file_browser.rb +- Authorization example for a command-line tool: + https://www.dropbox.com/developers/core/start/ruby + +Once you have an access token, create a DropboxClient instance and start making +API calls. + +You only need to perform the authorization process once per user. Once you have +an access token for a user, save it somewhere persistent, like in a database. +The next time that user visits your app, you can skip the authorization process +and go straight to making API calls. + +---------------------------------- +Running the Examples + +There are example programs included in the tarball. Before you can run an +example, you need to edit the ".rb" file and put your Dropbox API app key and +secret in the "APP_KEY" and "APP_SECRET" constants. + +---------------------------------- +Running the Tests + +# gem install bundler + +# bundle install +# cd test +# DROPBOX_RUBY_SDK_ACCESS_TOKEN= bundle exec ruby sdk_test.rb diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/chunked_upload.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/chunked_upload.rb new file mode 100644 index 000000000..aad571c3a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/chunked_upload.rb @@ -0,0 +1,71 @@ +# An example use of the /chunked_upload API call. + +require File.expand_path('../../lib/dropbox_sdk', __FILE__) + +# You must use your Dropbox App key and secret to use the API. +# Find this at https://www.dropbox.com/developers +APP_KEY = '' +APP_SECRET = '' + +STATE_FILE = 'search_cache.json' + +def main() + if APP_KEY == '' or APP_SECRET == '' + warn "ERROR: Set your APP_KEY and APP_SECRET at the top of search_cache.rb" + exit + end + prog_name = __FILE__ + args = ARGV + if args.size == 0 + warn("Usage:\n") + warn(" #{prog_name} ") + exit + end + + if args.size != 3 + warn "ERROR: expecting exactly three arguments. Run with no arguments for help." + exit(1) + end + + web_auth = DropboxOAuth2FlowNoRedirect.new(APP_KEY, APP_SECRET) + authorize_url = web_auth.start() + puts "1. Go to: #{authorize_url}" + puts "2. Click \"Allow\" (you might have to log in first)." + puts "3. Copy the authorization code." + + print "Enter the authorization code here: " + STDOUT.flush + auth_code = STDIN.gets.strip + + access_token, user_id = web_auth.finish(auth_code) + + c = DropboxClient.new(access_token) + + local_file_path = args[0] + dropbox_target_path = args[1] + chunk_size = args[2].to_i + + # Upload the file + local_file_size = File.size(local_file_path) + uploader = c.get_chunked_uploader(File.new(local_file_path, "r"), local_file_size) + retries = 0 + puts "Uploading..." + while uploader.offset < uploader.total_size + begin + uploader.upload(chunk_size) + rescue DropboxError => e + if retries > 10 + puts "- Error uploading, giving up." + break + end + puts "- Error uploading, trying again..." + retries += 1 + end + end + puts "Finishing upload..." + uploader.finish(dropbox_target_path) + puts "Done." + +end + +main() diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/cli_example.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/cli_example.rb new file mode 100755 index 000000000..3ec7169b2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/cli_example.rb @@ -0,0 +1,193 @@ +require File.expand_path('../../lib/dropbox_sdk', __FILE__) +require 'pp' +require 'shellwords' + +#### +# An example app using the Dropbox API Ruby Client +# This ruby script sets up a basic command line interface (CLI) +# that prompts a user to authenticate on the web, then +# allows them to type commands to manipulate their dropbox. +#### + +# You must use your Dropbox App key and secret to use the API. +# Find this at https://www.dropbox.com/developers +APP_KEY = '' +APP_SECRET = '' + +class DropboxCLI + LOGIN_REQUIRED = %w{put get cp mv rm ls mkdir info logout search thumbnail} + + def initialize + if APP_KEY == '' or APP_SECRET == '' + puts "You must set your APP_KEY and APP_SECRET in cli_example.rb!" + puts "Find this in your apps page at https://www.dropbox.com/developers/" + exit + end + + @client = nil + end + + def login + if not @client.nil? + puts "already logged in!" + else + web_auth = DropboxOAuth2FlowNoRedirect.new(APP_KEY, APP_SECRET) + authorize_url = web_auth.start() + puts "1. Go to: #{authorize_url}" + puts "2. Click \"Allow\" (you might have to log in first)." + puts "3. Copy the authorization code." + + print "Enter the authorization code here: " + STDOUT.flush + auth_code = STDIN.gets.strip + + access_token, user_id = web_auth.finish(auth_code) + + @client = DropboxClient.new(access_token) + puts "You are logged in. Your access token is #{access_token}." + end + end + + def command_loop + puts "Enter a command or 'help' or 'exit'" + command_line = '' + while command_line.strip != 'exit' + begin + execute_dropbox_command(command_line) + rescue RuntimeError => e + puts "Command Line Error! #{e.class}: #{e}" + puts e.backtrace + end + print '> ' + command_line = gets.strip + end + puts 'goodbye' + exit(0) + end + + def execute_dropbox_command(cmd_line) + command = Shellwords.shellwords cmd_line + method = command.first + if LOGIN_REQUIRED.include? method + if @client + send(method.to_sym, command) + else + puts 'must be logged in; type \'login\' to get started.' + end + elsif ['login', 'help'].include? method + send(method.to_sym) + else + if command.first && !command.first.strip.empty? + puts 'invalid command. type \'help\' to see commands.' + end + end + end + + def logout(command) + @client = nil + puts "You are logged out." + end + + def put(command) + fname = command[1] + + #If the user didn't specifiy the file name, just use the name of the file on disk + if command[2] + new_name = command[2] + else + new_name = File.basename(fname) + end + + if fname && !fname.empty? && File.exists?(fname) && (File.ftype(fname) == 'file') && File.stat(fname).readable? + #This is where we call the the Dropbox Client + pp @client.put_file(new_name, open(fname)) + else + puts "couldn't find the file #{ fname }" + end + end + + def get(command) + dest = command[2] + if !command[1] || command[1].empty? + puts "please specify item to get" + elsif !dest || dest.empty? + puts "please specify full local path to dest, i.e. the file to write to" + elsif File.exists?(dest) + puts "error: File #{dest} already exists." + else + src = clean_up(command[1]) + out,metadata = @client.get_file_and_metadata('/' + src) + puts "Metadata:" + pp metadata + open(dest, 'w'){|f| f.write out } + puts "wrote file #{dest}." + end + end + + def mkdir(command) + pp @client.file_create_folder(command[1]) + end + + # Example: + # > thumbnail pic1.jpg ~/pic1-local.jpg large + def thumbnail(command) + dest = command[2] + command[3] ||= 'small' + out,metadata = @client.thumbnail_and_metadata(command[1], command[3]) + puts "Metadata:" + pp metadata + open(dest, 'w'){|f| f.write out } + puts "wrote thumbnail#{dest}." + end + + def cp(command) + src = clean_up(command[1]) + dest = clean_up(command[2]) + pp @client.file_copy(src, dest) + end + + def mv(command) + src = clean_up(command[1]) + dest = clean_up(command[2]) + pp @client.file_move(src, dest) + end + + def rm(command) + pp @client.file_delete(clean_up(command[1])) + end + + def search(command) + resp = @client.search('/',clean_up(command[1])) + + for item in resp + puts item['path'] + end + end + + def info(command) + pp @client.account_info + end + + def ls(command) + command[1] = '/' + clean_up(command[1] || '') + resp = @client.metadata(command[1]) + + if resp['contents'].length > 0 + for item in resp['contents'] + puts item['path'] + end + end + end + + def help + puts "commands are: login #{LOGIN_REQUIRED.join(' ')} help exit" + end + + def clean_up(str) + return str.gsub(/^\/+/, '') if str + str + end +end + +cli = DropboxCLI.new +cli.command_loop diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/copy_between_accounts.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/copy_between_accounts.rb new file mode 100644 index 000000000..797d4ffcf --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/copy_between_accounts.rb @@ -0,0 +1,148 @@ +require File.expand_path('../../lib/dropbox_sdk', __FILE__) +require 'json' + +# You must use your Dropbox App key and secret to use the API. +# Find this at https://www.dropbox.com/developers +APP_KEY = '' +APP_SECRET = '' + +STATE_FILE = 'copy_between_accounts.json' + +def main() + prog_name = __FILE__ + if APP_KEY == '' or APP_SECRET == '' + warn "ERROR: Set your APP_KEY and APP_SECRET at the top of #{prog_name}" + exit + end + args = ARGV + if args.size == 0 + warn("Usage:\n") + warn(" #{prog_name} link Link to a user's account. Also displays UID.") + warn(" #{prog_name} list List linked users including UID.") + warn(" #{prog_name} copy ':' ':' Copies a file from the first user's path, to the second user's path.") + warn("\n\n is the account UID shown when linked. is a path to a file on that user's dropbox.") + exit + end + + command = args[0] + if command == 'link' + command_link(args) + elsif command == 'list' + command_list(args) + elsif command == 'copy' + command_copy(args) + else + warn "ERROR: Unknown command: #{command}" + warn "Run with no arguments for help." + exit(1) + end +end + +def command_link(args) + if args.size != 1 + warn "ERROR: \"link\" doesn't take any arguments" + exit + end + + web_auth = DropboxOAuth2FlowNoRedirect.new(APP_KEY, APP_SECRET) + authorize_url = web_auth.start() + puts "1. Go to: #{authorize_url}" + puts "2. Click \"Allow\" (you might have to log in first)." + puts "3. Copy the authorization code." + + print "Enter the authorization code here: " + STDOUT.flush + auth_code = STDIN.gets.strip + + access_token, user_id = web_auth.finish(auth_code) + + c = DropboxClient.new(access_token) + account_info = c.account_info() + puts "Link successful. #{account_info['display_name']} is uid #{account_info['uid']} " + + state = load_state() + state[account_info['uid']] = { + 'access_token' => access_token, + 'display_name' => account_info['display_name'], + } + + if account_info['team'] + state[account_info['uid']]['team_name'] = account_info['team']['name'] + end + + save_state(state) +end + +def command_list(args) + if args.size != 1 + warn "ERROR: \"list\" doesn't take any arguments" + exit + end + + state = load_state() + for e in state.keys() + if state[e]['team_name'] + puts "#{state[e]['display_name']} (#{state[e]['team_name']}) is uid #{e}" + else + puts "#{state[e]['display_name']} is uid #{e}" + end + end +end + +def command_copy(args) + if args.size != 3 + warn "ERROR: \"copy\" takes exactly two arguments" + exit + end + + state = load_state() + + if state.keys().length < 2 + warn "ERROR: You can't use the copy command until at least two users have linked" + exit + end + + from = args[1].gsub(/['"]/,'') + to = args[2].gsub(/['"]/,'') + + if not to.index(':') or not from.index(':') + warn "ERROR: Ill-formated paths. Run #{prog_name} without arugments to see documentation." + exit + end + + from_uid, from_path = from.split ":" + to_uid, to_path = to.split ":" + + if not state.has_key?(to_uid) or not state.has_key?(from_uid) + warn "ERROR: Those UIDs have not linked. Run #{prog_name} list to see linked UIDs." + exit + end + + from_client = DropboxClient.new(state[from_uid]['access_token']) + to_client = DropboxClient.new(state[to_uid]['access_token']) + + #Create a copy ref under the identity of the from user + copy_ref = from_client.create_copy_ref(from_path)['copy_ref'] + + metadata = to_client.add_copy_ref(to_path, copy_ref) + + puts "File successly copied from #{state[from_uid]['display_name']} to #{state[to_uid]['display_name']}!" + puts "The file now exists at #{metadata['path']}" + +end + +def save_state(state) + File.open(STATE_FILE,"w") do |f| + f.write(JSON.pretty_generate(state)) + end +end + +def load_state() + if not FileTest.exists?(STATE_FILE) + return {} + end + JSON.parse(File.read(STATE_FILE)) +end + + +main() diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/dropbox_controller.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/dropbox_controller.rb new file mode 100644 index 000000000..20eb9d763 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/dropbox_controller.rb @@ -0,0 +1,113 @@ +# --------------------------------------------------------------------------------------- +# A Rails 3 controller that: +# - Runs the through Dropbox's OAuth 2 flow, yielding a Dropbox API access token. +# - Makes a Dropbox API call to upload a file. +# +# To set up: +# 1. Create a Dropbox App key and secret to use the API. https://www.dropbox.com/developers +# 2. Add http://localhost:3000/dropbox/auth_finish as a Redirect URI for your Dropbox app. +# 3. Copy your App key and App secret into APP_KEY and APP_SECRET below. +# +# To run: +# 1. You need a Rails 3 project (to create one, run: rails new ) +# 2. Copy dropbox_sdk.rb into /vendor +# 3. Copy this file into /app/controllers/ +# 4. Add the following lines to /config/routes.rb +# get "dropbox/main" +# post "dropbox/upload" +# get "dropbox/auth_start" +# get "dropbox/auth_finish" +# 5. Run: rails server +# 6. Point your browser at: https://localhost:3000/dropbox/main + +require 'dropbox_sdk' +require 'securerandom' + +APP_KEY = "" +APP_SECRET = "" + +class DropboxController < ApplicationController + + def main + client = get_dropbox_client + unless client + redirect_to(:action => 'auth_start') and return + end + + account_info = client.account_info + + # Show a file upload page + render :inline => + "#{account_info['email']}
<%= form_tag({:action => :upload}, :multipart => true) do %><%= file_field_tag 'file' %><%= submit_tag 'Upload' %><% end %>" + end + + def upload + client = get_dropbox_client + unless client + redirect_to(:action => 'auth_start') and return + end + + begin + # Upload the POST'd file to Dropbox, keeping the same name + resp = client.put_file(params[:file].original_filename, params[:file].read) + render :text => "Upload successful. File now at #{resp['path']}" + rescue DropboxAuthError => e + session.delete(:access_token) # An auth error means the access token is probably bad + logger.info "Dropbox auth error: #{e}" + render :text => "Dropbox auth error" + rescue DropboxError => e + logger.info "Dropbox API error: #{e}" + render :text => "Dropbox API error" + end + end + + def get_dropbox_client + if session[:access_token] + begin + access_token = session[:access_token] + DropboxClient.new(access_token) + rescue + # Maybe something's wrong with the access token? + session.delete(:access_token) + raise + end + end + end + + def get_web_auth() + redirect_uri = url_for(:action => 'auth_finish') + DropboxOAuth2Flow.new(APP_KEY, APP_SECRET, redirect_uri, session, :dropbox_auth_csrf_token) + end + + def auth_start + authorize_url = get_web_auth().start() + + # Send the user to the Dropbox website so they can authorize our app. After the user + # authorizes our app, Dropbox will redirect them here with a 'code' parameter. + redirect_to authorize_url + end + + def auth_finish + begin + access_token, user_id, url_state = get_web_auth.finish(params) + session[:access_token] = access_token + redirect_to :action => 'main' + rescue DropboxOAuth2Flow::BadRequestError => e + render :text => "Error in OAuth 2 flow: Bad request: #{e}" + rescue DropboxOAuth2Flow::BadStateError => e + logger.info("Error in OAuth 2 flow: No CSRF token in session: #{e}") + redirect_to(:action => 'auth_start') + rescue DropboxOAuth2Flow::CsrfError => e + logger.info("Error in OAuth 2 flow: CSRF mismatch: #{e}") + render :text => "CSRF error" + rescue DropboxOAuth2Flow::NotApprovedError => e + render :text => "Not approved? Why not, bro?" + rescue DropboxOAuth2Flow::ProviderError => e + logger.info "Error in OAuth 2 flow: Error redirect from Dropbox: #{e}" + render :text => "Strange error." + rescue DropboxError => e + logger.info "Error getting OAuth 2 access token: #{e}" + render :text => "Error communicating with Dropbox servers." + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/oauth1_upgrade.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/oauth1_upgrade.rb new file mode 100644 index 000000000..9962f0b5a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/oauth1_upgrade.rb @@ -0,0 +1,40 @@ +require File.expand_path('../../lib/dropbox_sdk', __FILE__) +require 'pp' + +# You must use your Dropbox App key and secret to use the API. +# Find this at https://www.dropbox.com/developers +APP_KEY = '' +APP_SECRET = '' + +def main + if APP_KEY == '' or APP_SECRET == '' + warn "ERROR: Set your APP_KEY and APP_SECRET at the top of search_cache.rb" + exit + end + + prog_name = __FILE__ + args = ARGV + if args.size != 2 + warn "Usage: #{prog_name} " + exit 1 + end + + access_token_key = args[0] + access_token_secret = args[1] + + sess = DropboxSession.new(APP_KEY, APP_SECRET) + sess.set_access_token(access_token_key, access_token_secret) + c = DropboxClient.new(sess) + + print "Creating OAuth 2 access token...\n" + oauth2_access_token = c.create_oauth2_access_token + + print "Using OAuth 2 access token to get account info...\n" + c2 = DropboxClient.new(oauth2_access_token) + pp c2.account_info + + print "Disabling OAuth 1 access token...\n" + c.disable_access_token +end + +main() diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/search_cache.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/search_cache.rb new file mode 100644 index 000000000..62350213d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/search_cache.rb @@ -0,0 +1,322 @@ +# An example use of the /delta API call. Maintains a local cache of +# the App Folder's contents. Use the 'update' sub-command to update +# the local cache. Use the 'find' sub-command to search the local +# cache. +# +# Example usage: +# +# 1. Link to your Dropbox account +# > ruby search_cache.rb link +# +# 2. Go to Dropbox and make changes to the contents. +# +# 3. Update the local cache to match what's on Dropbox. +# > ruby search_cache.rb update +# +# 4. Search the local cache. +# > ruby search_cache.rb find 'txt' + +# Repeat steps 2-4 any number of times. + + + +require File.expand_path('../../lib/dropbox_sdk', __FILE__) +require 'json' + +# You must use your Dropbox App key and secret to use the API. +# Find this at https://www.dropbox.com/developers +APP_KEY = '' +APP_SECRET = '' + +STATE_FILE = 'search_cache.json' + +def main() + if APP_KEY == '' or APP_SECRET == '' + warn "ERROR: Set your APP_KEY and APP_SECRET at the top of search_cache.rb" + exit + end + prog_name = __FILE__ + args = ARGV + if args.size == 0 + warn("Usage:\n") + warn(" #{prog_name} link Link to a user's account.") + warn(" #{prog_name} update Update cache to the latest on Dropbox.") + warn(" #{prog_name} update Update cache, limit to pages of /delta.") + warn(" #{prog_name} find Search cache for .") + warn(" #{prog_name} find Display entire cache contents") + warn(" #{prog_name} reset Delete the cache.") + exit + end + + command = args[0] + if command == 'link' + command_link(args) + elsif command == 'update' + command_update(args) + elsif command == 'find' + command_find(args) + elsif command == 'reset' + command_reset(args) + else + warn "ERROR: Unknown command: #{command}" + warn "Run with no arguments for help." + exit(1) + end +end + + +def command_link(args) + if args.size != 1 + warn "ERROR: \"link\" doesn't take any arguments" + exit + end + + web_auth = DropboxOAuth2FlowNoRedirect.new(APP_KEY, APP_SECRET) + authorize_url = web_auth.start() + puts "1. Go to: #{authorize_url}" + puts "2. Click \"Allow\" (you might have to log in first)." + puts "3. Copy the authorization code." + + print "Enter the authorization code here: " + STDOUT.flush + auth_code = STDIN.gets.strip + + access_token, user_id = web_auth.finish(auth_code) + puts "Link successful." + + save_state({ + 'access_token' => access_token, + 'tree' => {} + }) +end + + +def command_update(args) + if args.size == 1 + page_limit = nil + elsif args.size == 2 + page_limit = Integer(args[1]) + else + warn "ERROR: \"update\" takes either zero or one argument." + exit + end + + # Load state + state = load_state() + access_token = state['access_token'] + cursor = state['cursor'] + tree = state['tree'] + + # Connect to Dropbox + c = DropboxClient.new(access_token) + + page = 0 + changed = false + while (page_limit == nil) or (page < page_limit) + # Get /delta results from Dropbox + result = c.delta(cursor) + page += 1 + if result['reset'] == true + puts 'reset' + changed = true + tree = {} + end + cursor = result['cursor'] + # Apply the entries one by one to our cached tree. + for delta_entry in result['entries'] + changed = true + apply_delta(tree, delta_entry) + end + cursor = result['cursor'] + if not result['has_more'] + break + end + end + + # Save state + if changed + state['cursor'] = cursor + state['tree'] = tree + save_state(state) + else + puts "No updates." + end + +end + +# We track folder state as a tree of Node objects. +class Node + attr_accessor :path, :content + def initialize(path, content) + # The "original" page (i.e. not the lower-case path) + @path = path + # For files, content is a pair (size, modified) + # For folders, content is a hash of children Nodes, keyed by lower-case file names. + @content = content + end + def folder?() + @content.is_a? Hash + end + def to_json() + [@path, Node.to_json_content(@content)] + end + def self.from_json(jnode) + path, jcontent = jnode + Node.new(path, Node.from_json_content(jcontent)) + end + def self.to_json_content(content) + if content.is_a? Hash + map_hash_values(content) { |child| child.to_json } + else + content + end + end + def self.from_json_content(jcontent) + if jcontent.is_a? Hash + map_hash_values(jcontent) { |jchild| Node.from_json jchild } + else + jcontent + end + end +end + +# Run a mapping function over every value in a Hash, returning a new Hash. +def map_hash_values(h) + new = {} + h.each { |k,v| new[k] = yield v } + new +end + + +def apply_delta(root, e) + path, metadata = e + branch, leaf = split_path(path) + + if metadata != nil + puts "+ #{path}" + # Traverse down the tree until we find the parent folder of the entry + # we want to add. Create any missing folders along the way. + children = root + branch.each do |part| + node = get_or_create_child(children, part) + # If there's no folder here, make an empty one. + if not node.folder? + node.content = {} + end + children = node.content + end + + # Create the file/folder. + node = get_or_create_child(children, leaf) + node.path = metadata['path'] # Save the un-lower-cased path. + if metadata['is_dir'] + # Only create a folder if there isn't one there already. + node.content = {} if not node.folder? + else + node.content = metadata['size'], metadata['modified'] + end + else + puts "- #{path}" + # Traverse down the tree until we find the parent of the entry we + # want to delete. + children = root + missing_parent = false + branch.each do |part| + node = children[part] + # If one of the parent folders is missing, then we're done. + if node == nil or not node.folder? + missing_parent = true + break + end + children = node.content + end + # If we made it all the way, delete the file/folder. + if not missing_parent + children.delete(leaf) + end + end +end + +def get_or_create_child(children, name) + child = children[name] + if child == nil + children[name] = child = Node.new(nil, nil) + end + child +end + +def split_path(path) + bad, *parts = path.split '/' + [parts, parts.pop] +end + + +def command_find(args) + if args.size == 1 + term = '' + elsif args.size == 2 + term = args[1] + else + warn("ERROR: \"find\" takes either zero or one arguments.") + exit + end + + state = load_state() + results = [] + search_tree(results, state['tree'], term) + for r in results + puts("#{r}") + end + puts("[Matches: #{results.size}]") +end + + +def command_reset(args) + if args.size != 1 + warn("ERROR: \"reset\" takes no arguments.") + exit + end + + # Delete cursor, empty tree. + state = load_state() + if state.has_key?('cursor') + state.delete('cursor') + end + state['tree'] = {} + save_state(state) +end + + +# Recursively search 'tree' for files that contain the string in 'term'. +# Print out any matches. +def search_tree(results, tree, term) + tree.each do |name_lc, node| + path = node.path + if (path != nil) and path.include?(term) + if node.folder? + results.push("#{path}") + else + size, modified = node.content + results.push("#{path} (#{size}, #{modified})") + end + end + if node.folder? + search_tree(results, node.content, term) + end + end +end + +def save_state(state) + state['tree'] = Node.to_json_content(state['tree']) + File.open(STATE_FILE,"w") do |f| + f.write(JSON.pretty_generate(state, :max_nesting => false)) + end +end + +def load_state() + state = JSON.parse(File.read(STATE_FILE), :max_nesting => false) + state['tree'] = Node.from_json_content(state['tree']) + state +end + +main() diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/web_file_browser.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/web_file_browser.rb new file mode 100644 index 000000000..c0d69063a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/examples/web_file_browser.rb @@ -0,0 +1,193 @@ +# ------------------------------------------------------------------- +# An example webapp that lets you browse and upload files to Dropbox. +# Demonstrates: +# - The webapp OAuth process. +# - The metadata() and put_file() calls. +# +# To set up: +# 1. Create a Dropbox App key and secret to use the API. https://www.dropbox.com/developers +# 2. Add http://localhost:5000/dropbox-auth-finish as a Redirect URI for your Dropbox app. +# 3. Copy your App key and App secret into APP_KEY and APP_SECRET below. +# +# To run: +# 1. Install Sinatra $ gem install sinatra +# 2. Launch server $ ruby web_file_browser.rb +# 3. Browse to http://localhost:5000/ +# ------------------------------------------------------------------- + +require 'rubygems' +require 'sinatra' +require 'pp' +require 'securerandom' +require File.expand_path('../../lib/dropbox_sdk', __FILE__) + +# Get your app's key and secret from https://www.dropbox.com/developers/ +APP_KEY = '' +APP_SECRET = '' + +# ------------------------------------------------------------------- +# OAuth stuff + +def get_web_auth() + return DropboxOAuth2Flow.new(APP_KEY, APP_SECRET, url('/dropbox-auth-finish'), + session, :dropbox_auth_csrf_token) +end + +get '/dropbox-auth-start' do + authorize_url = get_web_auth().start() + + # Send the user to the Dropbox website so they can authorize our app. After the user + # authorizes our app, Dropbox will redirect them to our '/dropbox-auth-finish' endpoint. + redirect authorize_url +end + +get '/dropbox-auth-finish' do + begin + access_token, user_id, url_state = get_web_auth.finish(params) + rescue DropboxOAuth2Flow::BadRequestError => e + return html_page "Error in OAuth 2 flow", "

Bad request to /dropbox-auth-finish: #{e}

" + rescue DropboxOAuth2Flow::BadStateError => e + return html_page "Error in OAuth 2 flow", "

Auth session expired: #{e}

" + rescue DropboxOAuth2Flow::CsrfError => e + logger.info("/dropbox-auth-finish: CSRF mismatch: #{e}") + return html_page "Error in OAuth 2 flow", "

CSRF mismatch

" + rescue DropboxOAuth2Flow::NotApprovedError => e + return html_page "Not Approved?", "

Why not, bro?

" + rescue DropboxOAuth2Flow::ProviderError => e + return html_page "Error in OAuth 2 flow", "Error redirect from Dropbox: #{e}" + rescue DropboxError => e + logger.info "Error getting OAuth 2 access token: #{e}" + return html_page "Error in OAuth 2 flow", "

Error getting access token

" + end + + # In this simple example, we store the authorized DropboxSession in the session. + # A real webapp might store it somewhere more persistent. + session[:access_token] = access_token + redirect url('/') +end + +get '/dropbox-unlink' do + session.delete(:access_token) + nil +end + +# If we already have an authorized DropboxSession, returns a DropboxClient. +def get_dropbox_client + if session[:access_token] + return DropboxClient.new(session[:access_token]) + end +end + +# ------------------------------------------------------------------- +# File/folder display stuff + +get '/' do + # Get the DropboxClient object. Redirect to OAuth flow if necessary. + client = get_dropbox_client + unless client + redirect url("/dropbox-auth-start") + end + + # Call DropboxClient.metadata + path = params[:path] || '/' + begin + entry = client.metadata(path) + rescue DropboxAuthError => e + session.delete(:access_token) # An auth error means the access token is probably bad + logger.info "Dropbox auth error: #{e}" + return html_page "Dropbox auth error" + rescue DropboxError => e + if e.http_response.code == '404' + return html_page "Path not found: #{h path}" + else + logger.info "Dropbox API error: #{e}" + return html_page "Dropbox API error" + end + end + + if entry['is_dir'] + render_folder(client, entry) + else + render_file(client, entry) + end +end + +def render_folder(client, entry) + # Provide an upload form (so the user can add files to this folder) + out = "
" + out += " " + out += "" + out += "" + out += "
" # TODO: Add a token to counter CSRF attacks. + # List of folder contents + entry['contents'].each do |child| + cp = child['path'] # child path + cn = File.basename(cp) # child name + if (child['is_dir']) then cn += '/' end + out += "" + end + + html_page "Folder: #{entry['path']}", out +end + +def render_file(client, entry) + # Just dump out metadata hash + html_page "File: #{entry['path']}", "
#{h entry.pretty_inspect}
" +end + +# ------------------------------------------------------------------- +# File upload handler + +post '/upload' do + # Check POST parameter. + file = params[:file] + unless file && (temp_file = file[:tempfile]) && (name = file[:filename]) + return html_page "Upload error", "

No file selected.

" + end + + # Get the DropboxClient object. + client = get_dropbox_client + unless client + return html_page "Upload error", "

Not linked with a Dropbox account.

" + end + + # Call DropboxClient.put_file + begin + entry = client.put_file("#{params[:folder]}/#{name}", temp_file.read) + rescue DropboxAuthError => e + session.delete(:access_token) # An auth error means the access token is probably bad + logger.info "Dropbox auth error: #{e}" + return html_page "Dropbox auth error" + rescue DropboxError => e + logger.info "Dropbox API error: #{e}" + return html_page "Dropbox API error" + end + + html_page "Upload complete", "
#{h entry.pretty_inspect}
" +end + +# ------------------------------------------------------------------- + +def html_page(title, body='') + "" + + "#{h title}" + + "

#{h title}

#{body}" + + "" +end + +# Rack will issue a warning if no session secret key is set. A real web app would not have +# a hard-coded secret in the code but would load it from a config file. +use Rack::Session::Cookie, :secret => 'dummy_secret' + +set :port, 5000 +enable :sessions + +helpers do + include Rack::Utils + alias_method :h, :escape_html +end + +if APP_KEY == '' or APP_SECRET == '' + puts "You must set APP_KEY and APP_SECRET at the top of \"#{__FILE__}\"!" + exit 1 +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/lib/dropbox_sdk.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/lib/dropbox_sdk.rb new file mode 100755 index 000000000..2baf84a36 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/lib/dropbox_sdk.rb @@ -0,0 +1,1434 @@ +require 'uri' +require 'net/https' +require 'cgi' +require 'json' +require 'yaml' +require 'base64' +require 'securerandom' +require 'pp' + +module Dropbox # :nodoc: + API_SERVER = "api.dropbox.com" + API_CONTENT_SERVER = "api-content.dropbox.com" + API_NOTIFY_SERVER = "api-notify.dropbox.com" + WEB_SERVER = "www.dropbox.com" + + SERVERS = { + :api => API_SERVER, + :content => API_CONTENT_SERVER, + :notify => API_NOTIFY_SERVER, + :web => WEB_SERVER + } + + API_VERSION = 1 + SDK_VERSION = "1.6.5" + + TRUSTED_CERT_FILE = File.join(File.dirname(__FILE__), 'trusted-certs.crt') + + def self.clean_params(params) + r = {} + params.each do |k, v| + r[k] = v.to_s if not v.nil? + end + r + end + + def self.make_query_string(params) + clean_params(params).collect {|k, v| + CGI.escape(k) + "=" + CGI.escape(v) + }.join("&") + end + + def self.do_http(uri, request) # :nodoc: + + http = Net::HTTP.new(uri.host, uri.port) + + http.use_ssl = true + http.verify_mode = OpenSSL::SSL::VERIFY_PEER + http.ca_file = Dropbox::TRUSTED_CERT_FILE + http.read_timeout = 600 + + if RUBY_VERSION >= '1.9' + # SSL protocol and ciphersuite settings are supported strating with version 1.9 + http.ssl_version = 'TLSv1' + http.ciphers = 'ECDHE-RSA-AES256-GCM-SHA384:'\ + 'ECDHE-RSA-AES256-SHA384:'\ + 'ECDHE-RSA-AES256-SHA:'\ + 'ECDHE-RSA-AES128-GCM-SHA256:'\ + 'ECDHE-RSA-AES128-SHA256:'\ + 'ECDHE-RSA-AES128-SHA:'\ + 'ECDHE-RSA-RC4-SHA:'\ + 'DHE-RSA-AES256-GCM-SHA384:'\ + 'DHE-RSA-AES256-SHA256:'\ + 'DHE-RSA-AES256-SHA:'\ + 'DHE-RSA-AES128-GCM-SHA256:'\ + 'DHE-RSA-AES128-SHA256:'\ + 'DHE-RSA-AES128-SHA:'\ + 'AES256-GCM-SHA384:'\ + 'AES256-SHA256:'\ + 'AES256-SHA:'\ + 'AES128-GCM-SHA256:'\ + 'AES128-SHA256:'\ + 'AES128-SHA' + end + + # Important security note! + # Some Ruby versions (e.g. the one that ships with OS X) do not raise + # an exception if certificate validation fails. We therefore have to + # add a custom callback to ensure that invalid certs are not accepted. + # Some specific error codes are let through, so we change the error + # code to make sure that Ruby throws an exception if certificate + # validation fails. + # + # See the man page for 'verify' for more information on error codes. + # + # You can comment out this code if your Ruby version is not vulnerable. + http.verify_callback = proc do |preverify_ok, ssl_context| + # 0 is the error code for success + if preverify_ok && ssl_context.error == 0 + true + else + # 7 is the error code for certification signature failure + ssl_context.error = 7 + false + end + end + + #We use this to better understand how developers are using our SDKs. + request['User-Agent'] = "OfficialDropboxRubySDK/#{Dropbox::SDK_VERSION}" + + begin + http.request(request) + rescue OpenSSL::SSL::SSLError => e + raise DropboxError.new("SSL error connecting to Dropbox. " + + "There may be a problem with the set of certificates in \"#{Dropbox::TRUSTED_CERT_FILE}\". #{e.message}") + end + end + + # Parse response. You probably shouldn't be calling this directly. This takes responses from the server + # and parses them. It also checks for errors and raises exceptions with the appropriate messages. + def self.parse_response(response, raw=false) # :nodoc: + if response.is_a?(Net::HTTPServerError) + raise DropboxError.new("Dropbox Server Error: #{response} - #{response.body}", response) + elsif response.is_a?(Net::HTTPUnauthorized) + raise DropboxAuthError.new("User is not authenticated.", response) + elsif !response.is_a?(Net::HTTPSuccess) + begin + d = JSON.parse(response.body) + rescue + raise DropboxError.new("Dropbox Server Error: body=#{response.body}", response) + end + if d['user_error'] and d['error'] + raise DropboxError.new(d['error'], response, d['user_error']) #user_error is translated + elsif d['error'] + raise DropboxError.new(d['error'], response) + else + raise DropboxError.new(response.body, response) + end + end + + return response.body if raw + + begin + return JSON.parse(response.body) + rescue JSON::ParserError + raise DropboxError.new("Unable to parse JSON response: #{response.body}", response) + end + end + + # A string comparison function that is resistant to timing attacks. If you're comparing a + # string you got from the outside world with a string that is supposed to be a secret, use + # this function to check equality. + def self.safe_string_equals(a, b) + if a.length != b.length + false + else + a.chars.zip(b.chars).map {|ac,bc| ac == bc}.all? + end + end +end + +class DropboxSessionBase # :nodoc: + + attr_writer :locale + + def initialize(locale) + @locale = locale + end + + private + + def build_url(path, server) + port = 443 + host = Dropbox::SERVERS[server] + full_path = "/#{Dropbox::API_VERSION}#{path}" + return URI::HTTPS.build({:host => host, :path => full_path}) + end + + def build_url_with_params(path, params, server) # :nodoc: + target = build_url(path, server) + params['locale'] = @locale + target.query = Dropbox::make_query_string(params) + return target + end + + protected + + def do_http(uri, request) # :nodoc: + sign_request(request) + Dropbox::do_http(uri, request) + end + + public + + def do_get(path, params=nil, server=:api) # :nodoc: + params ||= {} + assert_authorized + uri = build_url_with_params(path, params, server) + do_http(uri, Net::HTTP::Get.new(uri.request_uri)) + end + + def do_http_with_body(uri, request, body) + if body != nil + if body.is_a?(Hash) + request.set_form_data(Dropbox::clean_params(body)) + elsif body.respond_to?(:read) + if body.respond_to?(:length) + request["Content-Length"] = body.length.to_s + elsif body.respond_to?(:stat) && body.stat.respond_to?(:size) + request["Content-Length"] = body.stat.size.to_s + else + raise ArgumentError, "Don't know how to handle 'body' (responds to 'read' but not to 'length' or 'stat.size')." + end + request.body_stream = body + else + s = body.to_s + request["Content-Length"] = s.length + request.body = s + end + end + do_http(uri, request) + end + + def do_post(path, params=nil, headers=nil, server=:api) # :nodoc: + params ||= {} + assert_authorized + uri = build_url(path, server) + params['locale'] = @locale + do_http_with_body(uri, Net::HTTP::Post.new(uri.request_uri, headers), params) + end + + def do_put(path, params=nil, headers=nil, body=nil, server=:api) # :nodoc: + params ||= {} + assert_authorized + uri = build_url_with_params(path, params, server) + do_http_with_body(uri, Net::HTTP::Put.new(uri.request_uri, headers), body) + end +end + +# DropboxSession is responsible for holding OAuth 1 information. It knows how to take your consumer key and secret +# and request an access token, an authorize url, and get an access token. You just need to pass it to +# DropboxClient after its been authorized. +class DropboxSession < DropboxSessionBase # :nodoc: + + # * consumer_key - Your Dropbox application's "app key". + # * consumer_secret - Your Dropbox application's "app secret". + def initialize(consumer_key, consumer_secret, locale=nil) + super(locale) + @consumer_key = consumer_key + @consumer_secret = consumer_secret + @request_token = nil + @access_token = nil + end + + private + + def build_auth_header(token) # :nodoc: + header = "OAuth oauth_version=\"1.0\", oauth_signature_method=\"PLAINTEXT\", " + + "oauth_consumer_key=\"#{URI.escape(@consumer_key)}\", " + if token + key = URI.escape(token.key) + secret = URI.escape(token.secret) + header += "oauth_token=\"#{key}\", oauth_signature=\"#{URI.escape(@consumer_secret)}&#{secret}\"" + else + header += "oauth_signature=\"#{URI.escape(@consumer_secret)}&\"" + end + header + end + + def do_get_with_token(url, token) # :nodoc: + uri = URI.parse(url) + request = Net::HTTP::Get.new(uri.request_uri) + request.add_field('Authorization', build_auth_header(token)) + Dropbox::do_http(uri, request) + end + + protected + + def sign_request(request) # :nodoc: + request.add_field('Authorization', build_auth_header(@access_token)) + end + + public + + def get_token(url_end, input_token, error_message_prefix) #: nodoc: + response = do_get_with_token("https://#{Dropbox::API_SERVER}:443/#{Dropbox::API_VERSION}/oauth#{url_end}", input_token) + if not response.kind_of?(Net::HTTPSuccess) # it must be a 200 + raise DropboxAuthError.new("#{error_message_prefix} Server returned #{response.code}: #{response.message}.", response) + end + parts = CGI.parse(response.body) + + if !parts.has_key? "oauth_token" and parts["oauth_token"].length != 1 + raise DropboxAuthError.new("Invalid response from #{url_end}: missing \"oauth_token\" parameter: #{response.body}", response) + end + if !parts.has_key? "oauth_token_secret" and parts["oauth_token_secret"].length != 1 + raise DropboxAuthError.new("Invalid response from #{url_end}: missing \"oauth_token\" parameter: #{response.body}", response) + end + + OAuthToken.new(parts["oauth_token"][0], parts["oauth_token_secret"][0]) + end + + # This returns a request token. Requests one from the dropbox server using the provided application key and secret if nessecary. + def get_request_token() + @request_token ||= get_token("/request_token", nil, "Error getting request token. Is your app key and secret correctly set?") + end + + # This returns a URL that your user must visit to grant + # permissions to this application. + def get_authorize_url(callback=nil) + get_request_token() + + url = "/#{Dropbox::API_VERSION}/oauth/authorize?oauth_token=#{URI.escape(@request_token.key)}" + if callback + url += "&oauth_callback=#{URI.escape(callback)}" + end + if @locale + url += "&locale=#{URI.escape(@locale)}" + end + + "https://#{Dropbox::WEB_SERVER}#{url}" + end + + # Clears the access_token + def clear_access_token + @access_token = nil + end + + # Returns the request token, or nil if one hasn't been acquired yet. + def request_token + @request_token + end + + # Returns the access token, or nil if one hasn't been acquired yet. + def access_token + @access_token + end + + # Given a saved request token and secret, set this location's token and secret + # * token - this is the request token + # * secret - this is the request token secret + def set_request_token(key, secret) + @request_token = OAuthToken.new(key, secret) + end + + # Given a saved access token and secret, you set this Session to use that token and secret + # * token - this is the access token + # * secret - this is the access token secret + def set_access_token(key, secret) + @access_token = OAuthToken.new(key, secret) + end + + # Returns the access token. If this DropboxSession doesn't yet have an access_token, it requests one + # using the request_token generate from your app's token and secret. This request will fail unless + # your user has gone to the authorize_url and approved your request + def get_access_token + return @access_token if authorized? + + if @request_token.nil? + raise RuntimeError.new("No request token. You must set this or get an authorize url first.") + end + + @access_token = get_token("/access_token", @request_token, "Couldn't get access token.") + end + + # If we have an access token, then do nothing. If not, throw a RuntimeError. + def assert_authorized + unless authorized? + raise RuntimeError.new('Session does not yet have a request token') + end + end + + # Returns true if this Session has been authorized and has an access_token. + def authorized? + !!@access_token + end + + # serialize the DropboxSession. + # At DropboxSession's state is capture in three key/secret pairs. Consumer, request, and access. + # Serialize returns these in a YAML string, generated from a converted array of the form: + # [consumer_key, consumer_secret, request_token.token, request_token.secret, access_token.token, access_token.secret] + # access_token is only included if it already exists in the DropboxSesssion + def serialize + toreturn = [] + if @access_token + toreturn.push @access_token.secret, @access_token.key + end + + get_request_token + + toreturn.push @request_token.secret, @request_token.key + toreturn.push @consumer_secret, @consumer_key + + toreturn.to_yaml + end + + # Takes a serialized DropboxSession YAML String and returns a new DropboxSession object + def self.deserialize(ser) + ser = YAML::load(ser) + session = DropboxSession.new(ser.pop, ser.pop) + session.set_request_token(ser.pop, ser.pop) + + if ser.length > 0 + session.set_access_token(ser.pop, ser.pop) + end + session + end +end + + +class DropboxOAuth2Session < DropboxSessionBase # :nodoc: + + def initialize(oauth2_access_token, locale=nil) + super(locale) + if not oauth2_access_token.is_a?(String) + raise "bad type for oauth2_access_token (expecting String)" + end + @access_token = oauth2_access_token + end + + def assert_authorized + true + end + + protected + + def sign_request(request) # :nodoc: + request.add_field('Authorization', 'Bearer ' + @access_token) + end +end + +# Base class for the two OAuth 2 authorization helpers. +class DropboxOAuth2FlowBase # :nodoc: + def initialize(consumer_key, consumer_secret, locale=nil) + if not consumer_key.is_a?(String) + raise ArgumentError, "consumer_key must be a String, got #{consumer_key.inspect}" + end + if not consumer_secret.is_a?(String) + raise ArgumentError, "consumer_secret must be a String, got #{consumer_secret.inspect}" + end + if not (locale.nil? or locale.is_a?(String)) + raise ArgumentError, "locale must be a String or nil, got #{locale.inspect}" + end + @consumer_key = consumer_key + @consumer_secret = consumer_secret + @locale = locale + end + + def _get_authorize_url(redirect_uri, state) + params = { + "client_id" => @consumer_key, + "response_type" => "code", + "redirect_uri" => redirect_uri, + "state" => state, + "locale" => @locale, + } + + host = Dropbox::WEB_SERVER + path = "/#{Dropbox::API_VERSION}/oauth2/authorize" + + target = URI::Generic.new("https", nil, host, nil, nil, path, nil, nil, nil) + target.query = Dropbox::make_query_string(params) + + target.to_s + end + + # Finish the OAuth 2 authorization process. If you used a redirect_uri, pass that in. + # Will return an access token string that you can use with DropboxClient. + def _finish(code, original_redirect_uri) + if not code.is_a?(String) + raise ArgumentError, "code must be a String" + end + + uri = URI.parse("https://#{Dropbox::API_SERVER}/1/oauth2/token") + request = Net::HTTP::Post.new(uri.request_uri) + client_credentials = @consumer_key + ':' + @consumer_secret + request.add_field('Authorization', 'Basic ' + Base64.encode64(client_credentials).chomp("\n")) + + params = { + "grant_type" => "authorization_code", + "code" => code, + "redirect_uri" => original_redirect_uri, + "locale" => @locale, + } + + request.set_form_data(Dropbox::clean_params(params)) + + response = Dropbox::do_http(uri, request) + + j = Dropbox::parse_response(response) + ["token_type", "access_token", "uid"].each { |k| + if not j.has_key?(k) + raise DropboxError.new("Bad response from /token: missing \"#{k}\".") + end + if not j[k].is_a?(String) + raise DropboxError.new("Bad response from /token: field \"#{k}\" is not a string.") + end + } + if j["token_type"] != "bearer" and j["token_type"] != "Bearer" + raise DropboxError.new("Bad response from /token: \"token_type\" is \"#{token_type}\".") + end + + return j['access_token'], j['uid'] + end +end + +# OAuth 2 authorization helper for apps that can't provide a redirect URI +# (such as the command line example apps). +class DropboxOAuth2FlowNoRedirect < DropboxOAuth2FlowBase + + # * consumer_key: Your Dropbox API app's "app key" + # * consumer_secret: Your Dropbox API app's "app secret" + # * locale: The locale of the user currently using your app. + def initialize(consumer_key, consumer_secret, locale=nil) + super(consumer_key, consumer_secret, locale) + end + + # Returns a authorization_url, which is a page on Dropbox's website. Have the user + # visit this URL and approve your app. + def start() + _get_authorize_url(nil, nil) + end + + # If the user approves your app, they will be presented with an "authorization code". + # Have the user copy/paste that authorization code into your app and then call this + # method to get an access token. + # + # Returns a two-entry list (access_token, user_id) + # * access_token is an access token string that can be passed to DropboxClient. + # * user_id is the Dropbox user ID of the user that just approved your app. + def finish(code) + _finish(code, nil) + end +end + +# The standard OAuth 2 authorization helper. Use this if you're writing a web app. +class DropboxOAuth2Flow < DropboxOAuth2FlowBase + + # * consumer_key: Your Dropbox API app's "app key" + # * consumer_secret: Your Dropbox API app's "app secret" + # * redirect_uri: The URI that the Dropbox server will redirect the user to after the user + # finishes authorizing your app. This URI must be HTTPs-based and pre-registered with + # the Dropbox servers, though localhost URIs are allowed without pre-registration and can + # be either HTTP or HTTPS. + # * session: A hash that represents the current web app session (will be used to save the CSRF + # token) + # * csrf_token_key: The key to use when storing the CSRF token in the session (for example, + # :dropbox_auth_csrf_token) + # * locale: The locale of the user currently using your app (ex: "en" or "en_US"). + def initialize(consumer_key, consumer_secret, redirect_uri, session, csrf_token_session_key, locale=nil) + super(consumer_key, consumer_secret, locale) + if not redirect_uri.is_a?(String) + raise ArgumentError, "redirect_uri must be a String, got #{consumer_secret.inspect}" + end + @redirect_uri = redirect_uri + @session = session + @csrf_token_session_key = csrf_token_session_key + end + + # Starts the OAuth 2 authorizaton process, which involves redirecting the user to + # the returned "authorization URL" (a URL on the Dropbox website). When the user then + # either approves or denies your app access, Dropbox will redirect them to the + # redirect_uri you provided to the constructor, at which point you should call finish() + # to complete the process. + # + # This function will also save a CSRF token to the session and csrf_token_session_key + # you provided to the constructor. This CSRF token will be checked on finish() to prevent + # request forgery. + # + # * url_state: Any data you would like to keep in the URL through the authorization + # process. This exact value will be returned to you by finish(). + # + # Returns the URL to redirect the user to. + def start(url_state=nil) + unless url_state.nil? or url_state.is_a?(String) + raise ArgumentError, "url_state must be a String" + end + + csrf_token = SecureRandom.base64(16) + state = csrf_token + unless url_state.nil? + state += "|" + url_state + end + @session[@csrf_token_session_key] = csrf_token + + return _get_authorize_url(@redirect_uri, state) + end + + # Call this after the user has visited the authorize URL (see: start()), approved your app, + # and was redirected to your redirect URI. + # + # * query_params: The query params on the GET request to your redirect URI. + # + # Returns a tuple of (access_token, user_id, url_state). access_token can be used to + # construct a DropboxClient. user_id is the Dropbox user ID of the user that jsut approved + # your app. url_state is the value you originally passed in to start(). + # + # Can throw BadRequestError, BadStateError, CsrfError, NotApprovedError, + # ProviderError, and the standard DropboxError. + def finish(query_params) + csrf_token_from_session = @session[@csrf_token_session_key] + + # Check well-formedness of request. + + state = query_params['state'] + if state.nil? + raise BadRequestError.new("Missing query parameter 'state'.") + end + + error = query_params['error'] + error_description = query_params['error_description'] + code = query_params['code'] + + if not error.nil? and not code.nil? + raise BadRequestError.new("Query parameters 'code' and 'error' are both set;" + + " only one must be set.") + end + if error.nil? and code.nil? + raise BadRequestError.new("Neither query parameter 'code' or 'error' is set.") + end + + # Check CSRF token + + if csrf_token_from_session.nil? + raise BadStateError.new("Missing CSRF token in session."); + end + unless csrf_token_from_session.length > 20 + raise RuntimeError.new("CSRF token unexpectedly short: #{csrf_token_from_session.inspect}") + end + + split_pos = state.index('|') + if split_pos.nil? + given_csrf_token = state + url_state = nil + else + given_csrf_token, url_state = state.split('|', 2) + end + if not Dropbox::safe_string_equals(csrf_token_from_session, given_csrf_token) + raise CsrfError.new("Expected #{csrf_token_from_session.inspect}, " + + "got #{given_csrf_token.inspect}.") + end + @session.delete(@csrf_token_session_key) + + # Check for error identifier + + if not error.nil? + if error == 'access_denied' + # The user clicked "Deny" + if error_description.nil? + raise NotApprovedError.new("No additional description from Dropbox.") + else + raise NotApprovedError.new("Additional description from Dropbox: #{error_description}") + end + else + # All other errors. + full_message = error + if not error_description.nil? + full_message += ": " + error_description + end + raise ProviderError.new(full_message) + end + end + + # If everything went ok, make the network call to get an access token. + + access_token, user_id = _finish(code, @redirect_uri) + return access_token, user_id, url_state + end + + # Thrown if the redirect URL was missing parameters or if the given parameters were not valid. + # + # The recommended action is to show an HTTP 400 error page. + class BadRequestError < Exception; end + + # Thrown if all the parameters are correct, but there's no CSRF token in the session. This + # probably means that the session expired. + # + # The recommended action is to redirect the user's browser to try the approval process again. + class BadStateError < Exception; end + + # Thrown if the given 'state' parameter doesn't contain the CSRF token from the user's session. + # This is blocked to prevent CSRF attacks. + # + # The recommended action is to respond with an HTTP 403 error page. + class CsrfError < Exception; end + + # The user chose not to approve your app. + class NotApprovedError < Exception; end + + # Dropbox redirected to your redirect URI with some unexpected error identifier and error + # message. + class ProviderError < Exception; end +end + + +# A class that represents either an OAuth request token or an OAuth access token. +class OAuthToken # :nodoc: + attr_reader :key, :secret + def initialize(key, secret) + @key = key + @secret = secret + end +end + + +# This is the usual error raised on any Dropbox related Errors +class DropboxError < RuntimeError + attr_accessor :http_response, :error, :user_error + def initialize(error, http_response=nil, user_error=nil) + @error = error + @http_response = http_response + @user_error = user_error + end + + def to_s + return "#{user_error} (#{error})" if user_error + "#{error}" + end +end + +# This is the error raised on Authentication failures. Usually this means +# one of three things +# * Your user failed to go to the authorize url and approve your application +# * You set an invalid or expired token and secret on your Session +# * Your user deauthorized the application after you stored a valid token and secret +class DropboxAuthError < DropboxError +end + +# This is raised when you call metadata with a hash and that hash matches +# See documentation in metadata function +class DropboxNotModified < DropboxError +end + +# Use this class to make Dropbox API calls. You'll need to obtain an OAuth 2 access token +# first; you can get one using either DropboxOAuth2Flow or DropboxOAuth2FlowNoRedirect. +class DropboxClient + + # Args: + # * +oauth2_access_token+: Obtained via DropboxOAuth2Flow or DropboxOAuth2FlowNoRedirect. + # * +locale+: The user's current locale (used to localize error messages). + def initialize(oauth2_access_token, root="auto", locale=nil) + if oauth2_access_token.is_a?(String) + @session = DropboxOAuth2Session.new(oauth2_access_token, locale) + elsif oauth2_access_token.is_a?(DropboxSession) + @session = oauth2_access_token + @session.get_access_token + if not locale.nil? + @session.locale = locale + end + else + raise ArgumentError.new("oauth2_access_token doesn't have a valid type") + end + + @root = root.to_s # If they passed in a symbol, make it a string + + if not ["dropbox","app_folder","auto"].include?(@root) + raise ArgumentError.new("root must be :dropbox, :app_folder, or :auto") + end + if @root == "app_folder" + #App Folder is the name of the access type, but for historical reasons + #sandbox is the URL root component that indicates this + @root = "sandbox" + end + end + + # Returns some information about the current user's Dropbox account (the "current user" + # is the user associated with the access token you're using). + # + # For a detailed description of what this call returns, visit: + # https://www.dropbox.com/developers/reference/api#account-info + def account_info() + response = @session.do_get "/account/info" + Dropbox::parse_response(response) + end + + # Disables the access token that this +DropboxClient+ is using. If this call + # succeeds, further API calls using this object will fail. + def disable_access_token + @session.do_post "/disable_access_token" + nil + end + + # If this +DropboxClient+ was created with an OAuth 1 access token, this method + # can be used to create an equivalent OAuth 2 access token. This can be used to + # upgrade your app's existing access tokens from OAuth 1 to OAuth 2. + def create_oauth2_access_token + if not @session.is_a?(DropboxSession) + raise ArgumentError.new("This call requires a DropboxClient that is configured with " \ + "an OAuth 1 access token.") + end + response = @session.do_post "/oauth2/token_from_oauth1" + Dropbox::parse_response(response)['access_token'] + end + + # Uploads a file to a server. This uses the HTTP PUT upload method for simplicity + # + # Args: + # * +to_path+: The directory path to upload the file to. If the destination + # directory does not yet exist, it will be created. + # * +file_obj+: A file-like object to upload. If you would like, you can + # pass a string as file_obj. + # * +overwrite+: Whether to overwrite an existing file at the given path. [default is False] + # If overwrite is False and a file already exists there, Dropbox + # will rename the upload to make sure it doesn't overwrite anything. + # You must check the returned metadata to know what this new name is. + # This field should only be True if your intent is to potentially + # clobber changes to a file that you don't know about. + # * +parent_rev+: The rev field from the 'parent' of this upload. [optional] + # If your intent is to update the file at the given path, you should + # pass the parent_rev parameter set to the rev value from the most recent + # metadata you have of the existing file at that path. If the server + # has a more recent version of the file at the specified path, it will + # automatically rename your uploaded file, spinning off a conflict. + # Using this parameter effectively causes the overwrite parameter to be ignored. + # The file will always be overwritten if you send the most-recent parent_rev, + # and it will never be overwritten you send a less-recent one. + # Returns: + # * a Hash containing the metadata of the newly uploaded file. The file may have a different + # name if it conflicted. + # + # Simple Example + # client = DropboxClient(oauth2_access_token) + # #session is a DropboxSession I've already authorized + # client.put_file('/test_file_on_dropbox', open('/tmp/test_file')) + # This will upload the "/tmp/test_file" from my computer into the root of my App's app folder + # and call it "test_file_on_dropbox". + # The file will not overwrite any pre-existing file. + def put_file(to_path, file_obj, overwrite=false, parent_rev=nil) + path = "/files_put/#{@root}#{format_path(to_path)}" + params = { + 'overwrite' => overwrite.to_s, + 'parent_rev' => parent_rev, + } + + headers = {"Content-Type" => "application/octet-stream"} + response = @session.do_put path, params, headers, file_obj, :content + + Dropbox::parse_response(response) + end + + # Returns a ChunkedUploader object. + # + # Args: + # * +file_obj+: The file-like object to be uploaded. Must support .read() + # * +total_size+: The total size of file_obj + def get_chunked_uploader(file_obj, total_size) + ChunkedUploader.new(self, file_obj, total_size) + end + + # ChunkedUploader is responsible for uploading a large file to Dropbox in smaller chunks. + # This allows large files to be uploaded and makes allows recovery during failure. + class ChunkedUploader + attr_accessor :file_obj, :total_size, :offset, :upload_id, :client + + def initialize(client, file_obj, total_size) + @client = client + @file_obj = file_obj + @total_size = total_size + @upload_id = nil + @offset = 0 + end + + # Uploads data from this ChunkedUploader's file_obj in chunks, until + # an error occurs. Throws an exception when an error occurs, and can + # be called again to resume the upload. + # + # Args: + # * +chunk_size+: The chunk size for each individual upload. Defaults to 4MB. + def upload(chunk_size=4*1024*1024) + last_chunk = nil + + while @offset < @total_size + if not last_chunk + last_chunk = @file_obj.read(chunk_size) + end + + resp = {} + begin + resp = Dropbox::parse_response(@client.partial_chunked_upload(last_chunk, @upload_id, @offset)) + last_chunk = nil + rescue SocketError => e + raise e + rescue SystemCallError => e + raise e + rescue DropboxError => e + raise e if e.http_response.nil? or e.http_response.code[0] == '5' + begin + resp = JSON.parse(e.http_response.body) + raise DropboxError.new('server response does not have offset key') unless resp.has_key? 'offset' + rescue JSON::ParserError + raise DropboxError.new("Unable to parse JSON response: #{e.http_response.body}") + end + end + + if resp.has_key? 'offset' and resp['offset'] > @offset + @offset += (resp['offset'] - @offset) if resp['offset'] + last_chunk = nil + end + @upload_id = resp['upload_id'] if resp['upload_id'] + end + end + + # Completes a file upload + # + # Args: + # * +to_path+: The directory path to upload the file to. If the destination + # directory does not yet exist, it will be created. + # * +overwrite+: Whether to overwrite an existing file at the given path. [default is False] + # If overwrite is False and a file already exists there, Dropbox + # will rename the upload to make sure it doesn't overwrite anything. + # You must check the returned metadata to know what this new name is. + # This field should only be True if your intent is to potentially + # clobber changes to a file that you don't know about. + # * parent_rev: The rev field from the 'parent' of this upload. + # If your intent is to update the file at the given path, you should + # pass the parent_rev parameter set to the rev value from the most recent + # metadata you have of the existing file at that path. If the server + # has a more recent version of the file at the specified path, it will + # automatically rename your uploaded file, spinning off a conflict. + # Using this parameter effectively causes the overwrite parameter to be ignored. + # The file will always be overwritten if you send the most-recent parent_rev, + # and it will never be overwritten you send a less-recent one. + # + # Returns: + # * A Hash with the metadata of file just uploaded. + # For a detailed description of what this call returns, visit: + # https://www.dropbox.com/developers/reference/api#metadata + def finish(to_path, overwrite=false, parent_rev=nil) + response = @client.commit_chunked_upload(to_path, @upload_id, overwrite, parent_rev) + Dropbox::parse_response(response) + end + end + + def commit_chunked_upload(to_path, upload_id, overwrite=false, parent_rev=nil) #:nodoc + path = "/commit_chunked_upload/#{@root}#{format_path(to_path)}" + params = {'overwrite' => overwrite.to_s, + 'upload_id' => upload_id, + 'parent_rev' => parent_rev + } + headers = nil + @session.do_post path, params, headers, :content + end + + def partial_chunked_upload(data, upload_id=nil, offset=nil) #:nodoc + params = { + 'upload_id' => upload_id, + 'offset' => offset, + } + headers = {'Content-Type' => "application/octet-stream"} + @session.do_put '/chunked_upload', params, headers, data, :content + end + + # Download a file + # + # Args: + # * +from_path+: The path to the file to be downloaded + # * +rev+: A previous revision value of the file to be downloaded + # + # Returns: + # * The file contents. + def get_file(from_path, rev=nil) + response = get_file_impl(from_path, rev) + Dropbox::parse_response(response, raw=true) + end + + # Download a file and get its metadata. + # + # Args: + # * +from_path+: The path to the file to be downloaded + # * +rev+: A previous revision value of the file to be downloaded + # + # Returns: + # * The file contents. + # * The file metadata as a hash. + def get_file_and_metadata(from_path, rev=nil) + response = get_file_impl(from_path, rev) + parsed_response = Dropbox::parse_response(response, raw=true) + metadata = parse_metadata(response) + return parsed_response, metadata + end + + # Download a file (helper method - don't call this directly). + # + # Args: + # * +from_path+: The path to the file to be downloaded + # * +rev+: A previous revision value of the file to be downloaded + # + # Returns: + # * The HTTPResponse for the file download request. + def get_file_impl(from_path, rev=nil) # :nodoc: + path = "/files/#{@root}#{format_path(from_path)}" + params = { + 'rev' => rev, + } + @session.do_get path, params, :content + end + private :get_file_impl + + # Parses out file metadata from a raw dropbox HTTP response. + # + # Args: + # * +dropbox_raw_response+: The raw, unparsed HTTPResponse from Dropbox. + # + # Returns: + # * The metadata of the file as a hash. + def parse_metadata(dropbox_raw_response) # :nodoc: + begin + raw_metadata = dropbox_raw_response['x-dropbox-metadata'] + metadata = JSON.parse(raw_metadata) + rescue + raise DropboxError.new("Dropbox Server Error: x-dropbox-metadata=#{raw_metadata}", + dropbox_raw_response) + end + metadata + end + private :parse_metadata + + # Copy a file or folder to a new location. + # + # Args: + # * +from_path+: The path to the file or folder to be copied. + # * +to_path+: The destination path of the file or folder to be copied. + # This parameter should include the destination filename (e.g. + # from_path: '/test.txt', to_path: '/dir/test.txt'). If there's + # already a file at the to_path, this copy will be renamed to + # be unique. + # + # Returns: + # * A hash with the metadata of the new copy of the file or folder. + # For a detailed description of what this call returns, visit: + # https://www.dropbox.com/developers/reference/api#fileops-copy + def file_copy(from_path, to_path) + params = { + "root" => @root, + "from_path" => format_path(from_path, false), + "to_path" => format_path(to_path, false), + } + response = @session.do_post "/fileops/copy", params + Dropbox::parse_response(response) + end + + # Create a folder. + # + # Arguments: + # * +path+: The path of the new folder. + # + # Returns: + # * A hash with the metadata of the newly created folder. + # For a detailed description of what this call returns, visit: + # https://www.dropbox.com/developers/reference/api#fileops-create-folder + def file_create_folder(path) + params = { + "root" => @root, + "path" => format_path(path, false), + } + response = @session.do_post "/fileops/create_folder", params + + Dropbox::parse_response(response) + end + + # Deletes a file + # + # Arguments: + # * +path+: The path of the file to delete + # + # Returns: + # * A Hash with the metadata of file just deleted. + # For a detailed description of what this call returns, visit: + # https://www.dropbox.com/developers/reference/api#fileops-delete + def file_delete(path) + params = { + "root" => @root, + "path" => format_path(path, false), + } + response = @session.do_post "/fileops/delete", params + Dropbox::parse_response(response) + end + + # Moves a file + # + # Arguments: + # * +from_path+: The path of the file to be moved + # * +to_path+: The destination path of the file or folder to be moved + # If the file or folder already exists, it will be renamed to be unique. + # + # Returns: + # * A Hash with the metadata of file or folder just moved. + # For a detailed description of what this call returns, visit: + # https://www.dropbox.com/developers/reference/api#fileops-delete + def file_move(from_path, to_path) + params = { + "root" => @root, + "from_path" => format_path(from_path, false), + "to_path" => format_path(to_path, false), + } + response = @session.do_post "/fileops/move", params + Dropbox::parse_response(response) + end + + # Retrives metadata for a file or folder + # + # Arguments: + # * path: The path to the file or folder. + # * list: Whether to list all contained files (only applies when + # path refers to a folder). + # * file_limit: The maximum number of file entries to return within + # a folder. If the number of files in the directory exceeds this + # limit, an exception is raised. The server will return at max + # 25,000 files within a folder. + # * hash: Every directory listing has a hash parameter attached that + # can then be passed back into this function later to save on + # bandwidth. Rather than returning an unchanged folder's contents, if + # the hash matches a DropboxNotModified exception is raised. + # * rev: Optional. The revision of the file to retrieve the metadata for. + # This parameter only applies for files. If omitted, you'll receive + # the most recent revision metadata. + # * include_deleted: Specifies whether to include deleted files in metadata results. + # * include_media_info: Specifies to include media info, such as time_taken for photos + # + # Returns: + # * A Hash object with the metadata of the file or folder (and contained files if + # appropriate). For a detailed description of what this call returns, visit: + # https://www.dropbox.com/developers/reference/api#metadata + def metadata(path, file_limit=25000, list=true, hash=nil, rev=nil, include_deleted=false, include_media_info=false) + params = { + "file_limit" => file_limit.to_s, + "list" => list.to_s, + "include_deleted" => include_deleted.to_s, + "hash" => hash, + "rev" => rev, + "include_media_info" => include_media_info + } + + response = @session.do_get "/metadata/#{@root}#{format_path(path)}", params + if response.kind_of? Net::HTTPRedirection + raise DropboxNotModified.new("metadata not modified") + end + Dropbox::parse_response(response) + end + + # Search directory for filenames matching query + # + # Arguments: + # * path: The directory to search within + # * query: The query to search on (3 character minimum) + # * file_limit: The maximum number of file entries to return/ + # If the number of files exceeds this + # limit, an exception is raised. The server will return at max 1,000 + # * include_deleted: Whether to include deleted files in search results + # + # Returns: + # * A Hash object with a list the metadata of the file or folders matching query + # inside path. For a detailed description of what this call returns, visit: + # https://www.dropbox.com/developers/reference/api#search + def search(path, query, file_limit=1000, include_deleted=false) + params = { + 'query' => query, + 'file_limit' => file_limit.to_s, + 'include_deleted' => include_deleted.to_s + } + + response = @session.do_get "/search/#{@root}#{format_path(path)}", params + Dropbox::parse_response(response) + end + + # Retrive revisions of a file + # + # Arguments: + # * path: The file to fetch revisions for. Note that revisions + # are not available for folders. + # * rev_limit: The maximum number of file entries to return within + # a folder. The server will return at max 1,000 revisions. + # + # Returns: + # * A Hash object with a list of the metadata of the all the revisions of + # all matches files (up to rev_limit entries) + # For a detailed description of what this call returns, visit: + # https://www.dropbox.com/developers/reference/api#revisions + def revisions(path, rev_limit=1000) + params = { + 'rev_limit' => rev_limit.to_s + } + + response = @session.do_get "/revisions/#{@root}#{format_path(path)}", params + Dropbox::parse_response(response) + end + + # Restore a file to a previous revision. + # + # Arguments: + # * path: The file to restore. Note that folders can't be restored. + # * rev: A previous rev value of the file to be restored to. + # + # Returns: + # * A Hash object with a list the metadata of the file or folders restored + # For a detailed description of what this call returns, visit: + # https://www.dropbox.com/developers/reference/api#search + def restore(path, rev) + params = { + 'rev' => rev.to_s + } + + response = @session.do_post "/restore/#{@root}#{format_path(path)}", params + Dropbox::parse_response(response) + end + + # Returns a direct link to a media file + # All of Dropbox's API methods require OAuth, which may cause problems in + # situations where an application expects to be able to hit a URL multiple times + # (for example, a media player seeking around a video file). This method + # creates a time-limited URL that can be accessed without any authentication. + # + # Arguments: + # * path: The file to stream. + # + # Returns: + # * A Hash object that looks like the following: + # {'url': 'https://dl.dropboxusercontent.com/1/view/abcdefghijk/example', 'expires': 'Thu, 16 Sep 2011 01:01:25 +0000'} + def media(path) + response = @session.do_get "/media/#{@root}#{format_path(path)}" + Dropbox::parse_response(response) + end + + # Get a URL to share a media file + # Shareable links created on Dropbox are time-limited, but don't require any + # authentication, so they can be given out freely. The time limit should allow + # at least a day of shareability, though users have the ability to disable + # a link from their account if they like. + # + # Arguments: + # * path: The file to share. + # * short_url: When true (default), the url returned will be shortened using the Dropbox url shortener. If false, + # the url will link directly to the file's preview page. + # + # Returns: + # * A Hash object that looks like the following example: + # {'url': 'https://db.tt/c0mFuu1Y', 'expires': 'Tue, 01 Jan 2030 00:00:00 +0000'} + # For a detailed description of what this call returns, visit: + # https://www.dropbox.com/developers/reference/api#shares + def shares(path, short_url=true) + response = @session.do_get "/shares/#{@root}#{format_path(path)}", {"short_url"=>short_url} + Dropbox::parse_response(response) + end + + # Download a PDF or HTML preview for a file. + # + # Arguments: + # * path: The path to the file to be previewed. + # * rev: Optional. The revision of the file to retrieve the metadata for. + # If omitted, you'll get the most recent version. + # Returns: + # * The preview data + def preview(path, rev=nil) + path = "/previews/#{@root}#{format_path(path)}" + params = { 'rev' => rev } + response = @session.do_get path, params, :content + Dropbox::parse_response(response, raw=true) + end + + # Download a thumbnail for an image. + # + # Arguments: + # * from_path: The path to the file to be thumbnailed. + # * size: A string describing the desired thumbnail size. At this time, + # 'small' (32x32), 'medium' (64x64), 'large' (128x128), 's' (64x64), + # 'm' (128x128), 'l' (640x640), and 'xl' (1024x1024) are officially supported sizes. + # Check https://www.dropbox.com/developers/reference/api#thumbnails + # for more details. [defaults to large] + # Returns: + # * The thumbnail data + def thumbnail(from_path, size='large') + response = thumbnail_impl(from_path, size) + Dropbox::parse_response(response, raw=true) + end + + # Download a thumbnail for an image along with the image's metadata. + # + # Arguments: + # * from_path: The path to the file to be thumbnailed. + # * size: A string describing the desired thumbnail size. See thumbnail() + # for details. + # Returns: + # * The thumbnail data + # * The metadata for the image as a hash + def thumbnail_and_metadata(from_path, size='large') + response = thumbnail_impl(from_path, size) + parsed_response = Dropbox::parse_response(response, raw=true) + metadata = parse_metadata(response) + return parsed_response, metadata + end + + # A way of letting you keep a local representation of the Dropbox folder + # heirarchy. You can periodically call delta() to get a list of "delta + # entries", which are instructions on how to update your local state to + # match the server's state. + # + # Arguments: + # * +cursor+: On the first call, omit this argument (or pass in +nil+). On + # subsequent calls, pass in the +cursor+ string returned by the previous + # call. + # * +path_prefix+: If provided, results will be limited to files and folders + # whose paths are equal to or under +path_prefix+. The +path_prefix+ is + # fixed for a given cursor. Whatever +path_prefix+ you use on the first + # +delta()+ must also be passed in on subsequent calls that use the returned + # cursor. + # + # Returns: A hash with three fields. + # * +entries+: A list of "delta entries" (described below) + # * +reset+: If +true+, you should reset local state to be an empty folder + # before processing the list of delta entries. This is only +true+ only + # in rare situations. + # * +cursor+: A string that is used to keep track of your current state. + # On the next call to delta(), pass in this value to return entries + # that were recorded since the cursor was returned. + # * +has_more+: If +true+, then there are more entries available; you can + # call delta() again immediately to retrieve those entries. If +false+, + # then wait at least 5 minutes (preferably longer) before checking again. + # + # Delta Entries: Each entry is a 2-item list of one of following forms: + # * [_path_, _metadata_]: Indicates that there is a file/folder at the given + # path. You should add the entry to your local state. (The _metadata_ + # value is the same as what would be returned by the #metadata() call.) + # * If the path refers to parent folders that don't yet exist in your + # local state, create those parent folders in your local state. You + # will eventually get entries for those parent folders. + # * If the new entry is a file, replace whatever your local state has at + # _path_ with the new entry. + # * If the new entry is a folder, check what your local state has at + # _path_. If it's a file, replace it with the new entry. If it's a + # folder, apply the new _metadata_ to the folder, but do not modify + # the folder's children. + # * [path, +nil+]: Indicates that there is no file/folder at the _path_ on + # Dropbox. To update your local state to match, delete whatever is at + # _path_, including any children (you will sometimes also get separate + # delta entries for each child, but this is not guaranteed). If your + # local state doesn't have anything at _path_, ignore this entry. + # + # Remember: Dropbox treats file names in a case-insensitive but case-preserving + # way. To facilitate this, the _path_ strings above are lower-cased versions of + # the actual path. The _metadata_ dicts have the original, case-preserved path. + def delta(cursor=nil, path_prefix=nil) + params = { + 'cursor' => cursor, + 'path_prefix' => path_prefix, + } + + response = @session.do_post "/delta", params + Dropbox::parse_response(response) + end + + # Calls the long-poll endpoint which waits for changes on an account. In + # conjunction with #delta, this call gives you a low-latency way to monitor + # an account for file changes. + # + # The passed in cursor can only be acquired via a call to #delta + # + # Arguments: + # * +cursor+: A delta cursor as returned from a call to #delta + # * +timeout+: An optional integer indicating a timeout, in seconds. The + # default value is 30 seconds, which is also the minimum allowed value. The + # maximum is 480 seconds. + # + # Returns: A hash with one or two fields. + # * +changes+: A boolean value indicating whether new changes are available. + # * +backoff+: If present, indicates how many seconds your code should wait + # before calling #longpoll_delta again. + def longpoll_delta(cursor, timeout=30) + params = { + 'cursor' => cursor, + 'timeout' => timeout + } + + response = @session.do_get "/longpoll_delta", params, :notify + Dropbox::parse_response(response) + end + + # Download a thumbnail (helper method - don't call this directly). + # + # Args: + # * +from_path+: The path to the file to be thumbnailed. + # * +size+: A string describing the desired thumbnail size. See thumbnail() + # for details. + # + # Returns: + # * The HTTPResponse for the thumbnail request. + def thumbnail_impl(from_path, size='large') # :nodoc: + path = "/thumbnails/#{@root}#{format_path(from_path, true)}" + params = { + "size" => size + } + @session.do_get path, params, :content + end + private :thumbnail_impl + + + # Creates and returns a copy ref for a specific file. The copy ref can be + # used to instantly copy that file to the Dropbox of another account. + # + # Args: + # * +path+: The path to the file for a copy ref to be created on. + # + # Returns: + # * A Hash object that looks like the following example: + # {"expires"=>"Fri, 31 Jan 2042 21:01:05 +0000", "copy_ref"=>"z1X6ATl6aWtzOGq0c3g5Ng"} + def create_copy_ref(path) + path = "/copy_ref/#{@root}#{format_path(path)}" + response = @session.do_get path + Dropbox::parse_response(response) + end + + # Adds the file referenced by the copy ref to the specified path + # + # Args: + # * +copy_ref+: A copy ref string that was returned from a create_copy_ref call. + # The copy_ref can be created from any other Dropbox account, or from the same account. + # * +to_path+: The path to where the file will be created. + # + # Returns: + # * A hash with the metadata of the new file. + def add_copy_ref(to_path, copy_ref) + params = {'from_copy_ref' => copy_ref, + 'to_path' => "#{to_path}", + 'root' => @root} + + response = @session.do_post "/fileops/copy", params + Dropbox::parse_response(response) + end + + #From the oauth spec plus "/". Slash should not be ecsaped + RESERVED_CHARACTERS = /[^a-zA-Z0-9\-\.\_\~\/]/ # :nodoc: + + def format_path(path, escape=true) # :nodoc: + path = path.gsub(/\/+/,"/") + # replace multiple slashes with a single one + + path = path.gsub(/^\/?/,"/") + # ensure the path starts with a slash + + path.gsub(/\/?$/,"") + # ensure the path doesn't end with a slash + + return URI.escape(path, RESERVED_CHARACTERS) if escape + path + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/lib/trusted-certs.crt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/lib/trusted-certs.crt new file mode 100644 index 000000000..00c2f2e75 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/dropbox-sdk-1.6.5/lib/trusted-certs.crt @@ -0,0 +1,1396 @@ +# DigiCert Assured ID Root CA.pem +# Certificate: +# Data: +# Version: 3 (0x2) +# Serial Number: +# 0c:e7:e0:e5:17:d8:46:fe:8f:e5:60:fc:1b:f0:30:39 +# Signature Algorithm: sha1WithRSAEncryption +# Issuer: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Assured ID Root CA +# Validity +# Not Before: Nov 10 00:00:00 2006 GMT +# Not After : Nov 10 00:00:00 2031 GMT +# Subject: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Assured ID Root CA +# Subject Public Key Info: +# Public Key Algorithm: rsaEncryption +# Public-Key: (2048 bit) +# Modulus: +# 00:ad:0e:15:ce:e4:43:80:5c:b1:87:f3:b7:60:f9: +# 71:12:a5:ae:dc:26:94:88:aa:f4:ce:f5:20:39:28: +# 58:60:0c:f8:80:da:a9:15:95:32:61:3c:b5:b1:28: +# 84:8a:8a:dc:9f:0a:0c:83:17:7a:8f:90:ac:8a:e7: +# 79:53:5c:31:84:2a:f6:0f:98:32:36:76:cc:de:dd: +# 3c:a8:a2:ef:6a:fb:21:f2:52:61:df:9f:20:d7:1f: +# e2:b1:d9:fe:18:64:d2:12:5b:5f:f9:58:18:35:bc: +# 47:cd:a1:36:f9:6b:7f:d4:b0:38:3e:c1:1b:c3:8c: +# 33:d9:d8:2f:18:fe:28:0f:b3:a7:83:d6:c3:6e:44: +# c0:61:35:96:16:fe:59:9c:8b:76:6d:d7:f1:a2:4b: +# 0d:2b:ff:0b:72:da:9e:60:d0:8e:90:35:c6:78:55: +# 87:20:a1:cf:e5:6d:0a:c8:49:7c:31:98:33:6c:22: +# e9:87:d0:32:5a:a2:ba:13:82:11:ed:39:17:9d:99: +# 3a:72:a1:e6:fa:a4:d9:d5:17:31:75:ae:85:7d:22: +# ae:3f:01:46:86:f6:28:79:c8:b1:da:e4:57:17:c4: +# 7e:1c:0e:b0:b4:92:a6:56:b3:bd:b2:97:ed:aa:a7: +# f0:b7:c5:a8:3f:95:16:d0:ff:a1:96:eb:08:5f:18: +# 77:4f +# Exponent: 65537 (0x10001) +# X509v3 extensions: +# X509v3 Key Usage: critical +# Digital Signature, Certificate Sign, CRL Sign +# X509v3 Basic Constraints: critical +# CA:TRUE +# X509v3 Subject Key Identifier: +# 45:EB:A2:AF:F4:92:CB:82:31:2D:51:8B:A7:A7:21:9D:F3:6D:C8:0F +# X509v3 Authority Key Identifier: +# keyid:45:EB:A2:AF:F4:92:CB:82:31:2D:51:8B:A7:A7:21:9D:F3:6D:C8:0F +# +# Signature Algorithm: sha1WithRSAEncryption +# a2:0e:bc:df:e2:ed:f0:e3:72:73:7a:64:94:bf:f7:72:66:d8: +# 32:e4:42:75:62:ae:87:eb:f2:d5:d9:de:56:b3:9f:cc:ce:14: +# 28:b9:0d:97:60:5c:12:4c:58:e4:d3:3d:83:49:45:58:97:35: +# 69:1a:a8:47:ea:56:c6:79:ab:12:d8:67:81:84:df:7f:09:3c: +# 94:e6:b8:26:2c:20:bd:3d:b3:28:89:f7:5f:ff:22:e2:97:84: +# 1f:e9:65:ef:87:e0:df:c1:67:49:b3:5d:eb:b2:09:2a:eb:26: +# ed:78:be:7d:3f:2b:f3:b7:26:35:6d:5f:89:01:b6:49:5b:9f: +# 01:05:9b:ab:3d:25:c1:cc:b6:7f:c2:f1:6f:86:c6:fa:64:68: +# eb:81:2d:94:eb:42:b7:fa:8c:1e:dd:62:f1:be:50:67:b7:6c: +# bd:f3:f1:1f:6b:0c:36:07:16:7f:37:7c:a9:5b:6d:7a:f1:12: +# 46:60:83:d7:27:04:be:4b:ce:97:be:c3:67:2a:68:11:df:80: +# e7:0c:33:66:bf:13:0d:14:6e:f3:7f:1f:63:10:1e:fa:8d:1b: +# 25:6d:6c:8f:a5:b7:61:01:b1:d2:a3:26:a1:10:71:9d:ad:e2: +# c3:f9:c3:99:51:b7:2b:07:08:ce:2e:e6:50:b2:a7:fa:0a:45: +# 2f:a2:f0:f2 +-----BEGIN CERTIFICATE----- +MIIDtzCCAp+gAwIBAgIQDOfg5RfYRv6P5WD8G/AwOTANBgkqhkiG9w0BAQUFADBl +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJv +b3QgQ0EwHhcNMDYxMTEwMDAwMDAwWhcNMzExMTEwMDAwMDAwWjBlMQswCQYDVQQG +EwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3d3cuZGlnaWNl +cnQuY29tMSQwIgYDVQQDExtEaWdpQ2VydCBBc3N1cmVkIElEIFJvb3QgQ0EwggEi +MA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCtDhXO5EOAXLGH87dg+XESpa7c +JpSIqvTO9SA5KFhgDPiA2qkVlTJhPLWxKISKityfCgyDF3qPkKyK53lTXDGEKvYP +mDI2dsze3Tyoou9q+yHyUmHfnyDXH+Kx2f4YZNISW1/5WBg1vEfNoTb5a3/UsDg+ +wRvDjDPZ2C8Y/igPs6eD1sNuRMBhNZYW/lmci3Zt1/GiSw0r/wty2p5g0I6QNcZ4 +VYcgoc/lbQrISXwxmDNsIumH0DJaoroTghHtORedmTpyoeb6pNnVFzF1roV9Iq4/ +AUaG9ih5yLHa5FcXxH4cDrC0kqZWs72yl+2qp/C3xag/lRbQ/6GW6whfGHdPAgMB +AAGjYzBhMA4GA1UdDwEB/wQEAwIBhjAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQW +BBRF66Kv9JLLgjEtUYunpyGd823IDzAfBgNVHSMEGDAWgBRF66Kv9JLLgjEtUYun +pyGd823IDzANBgkqhkiG9w0BAQUFAAOCAQEAog683+Lt8ONyc3pklL/3cmbYMuRC +dWKuh+vy1dneVrOfzM4UKLkNl2BcEkxY5NM9g0lFWJc1aRqoR+pWxnmrEthngYTf +fwk8lOa4JiwgvT2zKIn3X/8i4peEH+ll74fg38FnSbNd67IJKusm7Xi+fT8r87cm +NW1fiQG2SVufAQWbqz0lwcy2f8Lxb4bG+mRo64EtlOtCt/qMHt1i8b5QZ7dsvfPx +H2sMNgcWfzd8qVttevESRmCD1ycEvkvOl77DZypoEd+A5wwzZr8TDRRu838fYxAe ++o0bJW1sj6W3YQGx0qMmoRBxna3iw/nDmVG3KwcIzi7mULKn+gpFL6Lw8g== +-----END CERTIFICATE----- +# DigiCert Global Root CA.pem +# Certificate: +# Data: +# Version: 3 (0x2) +# Serial Number: +# 08:3b:e0:56:90:42:46:b1:a1:75:6a:c9:59:91:c7:4a +# Signature Algorithm: sha1WithRSAEncryption +# Issuer: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Global Root CA +# Validity +# Not Before: Nov 10 00:00:00 2006 GMT +# Not After : Nov 10 00:00:00 2031 GMT +# Subject: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert Global Root CA +# Subject Public Key Info: +# Public Key Algorithm: rsaEncryption +# Public-Key: (2048 bit) +# Modulus: +# 00:e2:3b:e1:11:72:de:a8:a4:d3:a3:57:aa:50:a2: +# 8f:0b:77:90:c9:a2:a5:ee:12:ce:96:5b:01:09:20: +# cc:01:93:a7:4e:30:b7:53:f7:43:c4:69:00:57:9d: +# e2:8d:22:dd:87:06:40:00:81:09:ce:ce:1b:83:bf: +# df:cd:3b:71:46:e2:d6:66:c7:05:b3:76:27:16:8f: +# 7b:9e:1e:95:7d:ee:b7:48:a3:08:da:d6:af:7a:0c: +# 39:06:65:7f:4a:5d:1f:bc:17:f8:ab:be:ee:28:d7: +# 74:7f:7a:78:99:59:85:68:6e:5c:23:32:4b:bf:4e: +# c0:e8:5a:6d:e3:70:bf:77:10:bf:fc:01:f6:85:d9: +# a8:44:10:58:32:a9:75:18:d5:d1:a2:be:47:e2:27: +# 6a:f4:9a:33:f8:49:08:60:8b:d4:5f:b4:3a:84:bf: +# a1:aa:4a:4c:7d:3e:cf:4f:5f:6c:76:5e:a0:4b:37: +# 91:9e:dc:22:e6:6d:ce:14:1a:8e:6a:cb:fe:cd:b3: +# 14:64:17:c7:5b:29:9e:32:bf:f2:ee:fa:d3:0b:42: +# d4:ab:b7:41:32:da:0c:d4:ef:f8:81:d5:bb:8d:58: +# 3f:b5:1b:e8:49:28:a2:70:da:31:04:dd:f7:b2:16: +# f2:4c:0a:4e:07:a8:ed:4a:3d:5e:b5:7f:a3:90:c3: +# af:27 +# Exponent: 65537 (0x10001) +# X509v3 extensions: +# X509v3 Key Usage: critical +# Digital Signature, Certificate Sign, CRL Sign +# X509v3 Basic Constraints: critical +# CA:TRUE +# X509v3 Subject Key Identifier: +# 03:DE:50:35:56:D1:4C:BB:66:F0:A3:E2:1B:1B:C3:97:B2:3D:D1:55 +# X509v3 Authority Key Identifier: +# keyid:03:DE:50:35:56:D1:4C:BB:66:F0:A3:E2:1B:1B:C3:97:B2:3D:D1:55 +# +# Signature Algorithm: sha1WithRSAEncryption +# cb:9c:37:aa:48:13:12:0a:fa:dd:44:9c:4f:52:b0:f4:df:ae: +# 04:f5:79:79:08:a3:24:18:fc:4b:2b:84:c0:2d:b9:d5:c7:fe: +# f4:c1:1f:58:cb:b8:6d:9c:7a:74:e7:98:29:ab:11:b5:e3:70: +# a0:a1:cd:4c:88:99:93:8c:91:70:e2:ab:0f:1c:be:93:a9:ff: +# 63:d5:e4:07:60:d3:a3:bf:9d:5b:09:f1:d5:8e:e3:53:f4:8e: +# 63:fa:3f:a7:db:b4:66:df:62:66:d6:d1:6e:41:8d:f2:2d:b5: +# ea:77:4a:9f:9d:58:e2:2b:59:c0:40:23:ed:2d:28:82:45:3e: +# 79:54:92:26:98:e0:80:48:a8:37:ef:f0:d6:79:60:16:de:ac: +# e8:0e:cd:6e:ac:44:17:38:2f:49:da:e1:45:3e:2a:b9:36:53: +# cf:3a:50:06:f7:2e:e8:c4:57:49:6c:61:21:18:d5:04:ad:78: +# 3c:2c:3a:80:6b:a7:eb:af:15:14:e9:d8:89:c1:b9:38:6c:e2: +# 91:6c:8a:ff:64:b9:77:25:57:30:c0:1b:24:a3:e1:dc:e9:df: +# 47:7c:b5:b4:24:08:05:30:ec:2d:bd:0b:bf:45:bf:50:b9:a9: +# f3:eb:98:01:12:ad:c8:88:c6:98:34:5f:8d:0a:3c:c6:e9:d5: +# 95:95:6d:de +-----BEGIN CERTIFICATE----- +MIIDrzCCApegAwIBAgIQCDvgVpBCRrGhdWrJWZHHSjANBgkqhkiG9w0BAQUFADBh +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSAwHgYDVQQDExdEaWdpQ2VydCBHbG9iYWwgUm9vdCBD +QTAeFw0wNjExMTAwMDAwMDBaFw0zMTExMTAwMDAwMDBaMGExCzAJBgNVBAYTAlVT +MRUwEwYDVQQKEwxEaWdpQ2VydCBJbmMxGTAXBgNVBAsTEHd3dy5kaWdpY2VydC5j +b20xIDAeBgNVBAMTF0RpZ2lDZXJ0IEdsb2JhbCBSb290IENBMIIBIjANBgkqhkiG +9w0BAQEFAAOCAQ8AMIIBCgKCAQEA4jvhEXLeqKTTo1eqUKKPC3eQyaKl7hLOllsB +CSDMAZOnTjC3U/dDxGkAV53ijSLdhwZAAIEJzs4bg7/fzTtxRuLWZscFs3YnFo97 +nh6Vfe63SKMI2tavegw5BmV/Sl0fvBf4q77uKNd0f3p4mVmFaG5cIzJLv07A6Fpt +43C/dxC//AH2hdmoRBBYMql1GNXRor5H4idq9Joz+EkIYIvUX7Q6hL+hqkpMfT7P +T19sdl6gSzeRntwi5m3OFBqOasv+zbMUZBfHWymeMr/y7vrTC0LUq7dBMtoM1O/4 +gdW7jVg/tRvoSSiicNoxBN33shbyTApOB6jtSj1etX+jkMOvJwIDAQABo2MwYTAO +BgNVHQ8BAf8EBAMCAYYwDwYDVR0TAQH/BAUwAwEB/zAdBgNVHQ4EFgQUA95QNVbR +TLtm8KPiGxvDl7I90VUwHwYDVR0jBBgwFoAUA95QNVbRTLtm8KPiGxvDl7I90VUw +DQYJKoZIhvcNAQEFBQADggEBAMucN6pIExIK+t1EnE9SsPTfrgT1eXkIoyQY/Esr +hMAtudXH/vTBH1jLuG2cenTnmCmrEbXjcKChzUyImZOMkXDiqw8cvpOp/2PV5Adg +06O/nVsJ8dWO41P0jmP6P6fbtGbfYmbW0W5BjfIttep3Sp+dWOIrWcBAI+0tKIJF +PnlUkiaY4IBIqDfv8NZ5YBberOgOzW6sRBc4L0na4UU+Krk2U886UAb3LujEV0ls +YSEY1QSteDwsOoBrp+uvFRTp2InBuThs4pFsiv9kuXclVzDAGySj4dzp30d8tbQk +CAUw7C29C79Fv1C5qfPrmAESrciIxpg0X40KPMbp1ZWVbd4= +-----END CERTIFICATE----- +# DigiCert High Assurance EV Root CA.pem +# Certificate: +# Data: +# Version: 3 (0x2) +# Serial Number: +# 02:ac:5c:26:6a:0b:40:9b:8f:0b:79:f2:ae:46:25:77 +# Signature Algorithm: sha1WithRSAEncryption +# Issuer: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert High Assurance EV Root CA +# Validity +# Not Before: Nov 10 00:00:00 2006 GMT +# Not After : Nov 10 00:00:00 2031 GMT +# Subject: C=US, O=DigiCert Inc, OU=www.digicert.com, CN=DigiCert High Assurance EV Root CA +# Subject Public Key Info: +# Public Key Algorithm: rsaEncryption +# Public-Key: (2048 bit) +# Modulus: +# 00:c6:cc:e5:73:e6:fb:d4:bb:e5:2d:2d:32:a6:df: +# e5:81:3f:c9:cd:25:49:b6:71:2a:c3:d5:94:34:67: +# a2:0a:1c:b0:5f:69:a6:40:b1:c4:b7:b2:8f:d0:98: +# a4:a9:41:59:3a:d3:dc:94:d6:3c:db:74:38:a4:4a: +# cc:4d:25:82:f7:4a:a5:53:12:38:ee:f3:49:6d:71: +# 91:7e:63:b6:ab:a6:5f:c3:a4:84:f8:4f:62:51:be: +# f8:c5:ec:db:38:92:e3:06:e5:08:91:0c:c4:28:41: +# 55:fb:cb:5a:89:15:7e:71:e8:35:bf:4d:72:09:3d: +# be:3a:38:50:5b:77:31:1b:8d:b3:c7:24:45:9a:a7: +# ac:6d:00:14:5a:04:b7:ba:13:eb:51:0a:98:41:41: +# 22:4e:65:61:87:81:41:50:a6:79:5c:89:de:19:4a: +# 57:d5:2e:e6:5d:1c:53:2c:7e:98:cd:1a:06:16:a4: +# 68:73:d0:34:04:13:5c:a1:71:d3:5a:7c:55:db:5e: +# 64:e1:37:87:30:56:04:e5:11:b4:29:80:12:f1:79: +# 39:88:a2:02:11:7c:27:66:b7:88:b7:78:f2:ca:0a: +# a8:38:ab:0a:64:c2:bf:66:5d:95:84:c1:a1:25:1e: +# 87:5d:1a:50:0b:20:12:cc:41:bb:6e:0b:51:38:b8: +# 4b:cb +# Exponent: 65537 (0x10001) +# X509v3 extensions: +# X509v3 Key Usage: critical +# Digital Signature, Certificate Sign, CRL Sign +# X509v3 Basic Constraints: critical +# CA:TRUE +# X509v3 Subject Key Identifier: +# B1:3E:C3:69:03:F8:BF:47:01:D4:98:26:1A:08:02:EF:63:64:2B:C3 +# X509v3 Authority Key Identifier: +# keyid:B1:3E:C3:69:03:F8:BF:47:01:D4:98:26:1A:08:02:EF:63:64:2B:C3 +# +# Signature Algorithm: sha1WithRSAEncryption +# 1c:1a:06:97:dc:d7:9c:9f:3c:88:66:06:08:57:21:db:21:47: +# f8:2a:67:aa:bf:18:32:76:40:10:57:c1:8a:f3:7a:d9:11:65: +# 8e:35:fa:9e:fc:45:b5:9e:d9:4c:31:4b:b8:91:e8:43:2c:8e: +# b3:78:ce:db:e3:53:79:71:d6:e5:21:94:01:da:55:87:9a:24: +# 64:f6:8a:66:cc:de:9c:37:cd:a8:34:b1:69:9b:23:c8:9e:78: +# 22:2b:70:43:e3:55:47:31:61:19:ef:58:c5:85:2f:4e:30:f6: +# a0:31:16:23:c8:e7:e2:65:16:33:cb:bf:1a:1b:a0:3d:f8:ca: +# 5e:8b:31:8b:60:08:89:2d:0c:06:5c:52:b7:c4:f9:0a:98:d1: +# 15:5f:9f:12:be:7c:36:63:38:bd:44:a4:7f:e4:26:2b:0a:c4: +# 97:69:0d:e9:8c:e2:c0:10:57:b8:c8:76:12:91:55:f2:48:69: +# d8:bc:2a:02:5b:0f:44:d4:20:31:db:f4:ba:70:26:5d:90:60: +# 9e:bc:4b:17:09:2f:b4:cb:1e:43:68:c9:07:27:c1:d2:5c:f7: +# ea:21:b9:68:12:9c:3c:9c:bf:9e:fc:80:5c:9b:63:cd:ec:47: +# aa:25:27:67:a0:37:f3:00:82:7d:54:d7:a9:f8:e9:2e:13:a3: +# 77:e8:1f:4a +-----BEGIN CERTIFICATE----- +MIIDxTCCAq2gAwIBAgIQAqxcJmoLQJuPC3nyrkYldzANBgkqhkiG9w0BAQUFADBs +MQswCQYDVQQGEwJVUzEVMBMGA1UEChMMRGlnaUNlcnQgSW5jMRkwFwYDVQQLExB3 +d3cuZGlnaWNlcnQuY29tMSswKQYDVQQDEyJEaWdpQ2VydCBIaWdoIEFzc3VyYW5j +ZSBFViBSb290IENBMB4XDTA2MTExMDAwMDAwMFoXDTMxMTExMDAwMDAwMFowbDEL +MAkGA1UEBhMCVVMxFTATBgNVBAoTDERpZ2lDZXJ0IEluYzEZMBcGA1UECxMQd3d3 +LmRpZ2ljZXJ0LmNvbTErMCkGA1UEAxMiRGlnaUNlcnQgSGlnaCBBc3N1cmFuY2Ug +RVYgUm9vdCBDQTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMbM5XPm ++9S75S0tMqbf5YE/yc0lSbZxKsPVlDRnogocsF9ppkCxxLeyj9CYpKlBWTrT3JTW +PNt0OKRKzE0lgvdKpVMSOO7zSW1xkX5jtqumX8OkhPhPYlG++MXs2ziS4wblCJEM +xChBVfvLWokVfnHoNb9Ncgk9vjo4UFt3MRuNs8ckRZqnrG0AFFoEt7oT61EKmEFB +Ik5lYYeBQVCmeVyJ3hlKV9Uu5l0cUyx+mM0aBhakaHPQNAQTXKFx01p8VdteZOE3 +hzBWBOURtCmAEvF5OYiiAhF8J2a3iLd48soKqDirCmTCv2ZdlYTBoSUeh10aUAsg +EsxBu24LUTi4S8sCAwEAAaNjMGEwDgYDVR0PAQH/BAQDAgGGMA8GA1UdEwEB/wQF +MAMBAf8wHQYDVR0OBBYEFLE+w2kD+L9HAdSYJhoIAu9jZCvDMB8GA1UdIwQYMBaA +FLE+w2kD+L9HAdSYJhoIAu9jZCvDMA0GCSqGSIb3DQEBBQUAA4IBAQAcGgaX3Nec +nzyIZgYIVyHbIUf4KmeqvxgydkAQV8GK83rZEWWONfqe/EW1ntlMMUu4kehDLI6z +eM7b41N5cdblIZQB2lWHmiRk9opmzN6cN82oNLFpmyPInngiK3BD41VHMWEZ71jF +hS9OMPagMRYjyOfiZRYzy78aG6A9+MpeizGLYAiJLQwGXFK3xPkKmNEVX58Svnw2 +Yzi9RKR/5CYrCsSXaQ3pjOLAEFe4yHYSkVXySGnYvCoCWw9E1CAx2/S6cCZdkGCe +vEsXCS+0yx5DaMkHJ8HSXPfqIbloEpw8nL+e/IBcm2PN7EeqJSdnoDfzAIJ9VNep ++OkuE6N36B9K +-----END CERTIFICATE----- +# Entrust Root Certification Authority - EC1.pem +# Certificate: +# Data: +# Version: 3 (0x2) +# Serial Number: +# a6:8b:79:29:00:00:00:00:50:d0:91:f9 +# Signature Algorithm: ecdsa-with-SHA384 +# Issuer: C=US, O=Entrust, Inc., OU=See www.entrust.net/legal-terms, OU=(c) 2012 Entrust, Inc. - for authorized use only, CN=Entrust Root Certification Authority - EC1 +# Validity +# Not Before: Dec 18 15:25:36 2012 GMT +# Not After : Dec 18 15:55:36 2037 GMT +# Subject: C=US, O=Entrust, Inc., OU=See www.entrust.net/legal-terms, OU=(c) 2012 Entrust, Inc. - for authorized use only, CN=Entrust Root Certification Authority - EC1 +# Subject Public Key Info: +# Public Key Algorithm: id-ecPublicKey +# Public-Key: (384 bit) +# pub: +# 04:84:13:c9:d0:ba:6d:41:7b:e2:6c:d0:eb:55:5f: +# 66:02:1a:24:f4:5b:89:69:47:e3:b8:c2:7d:f1:f2: +# 02:c5:9f:a0:f6:5b:d5:8b:06:19:86:4f:53:10:6d: +# 07:24:27:a1:a0:f8:d5:47:19:61:4c:7d:ca:93:27: +# ea:74:0c:ef:6f:96:09:fe:63:ec:70:5d:36:ad:67: +# 77:ae:c9:9d:7c:55:44:3a:a2:63:51:1f:f5:e3:62: +# d4:a9:47:07:3e:cc:20 +# ASN1 OID: secp384r1 +# X509v3 extensions: +# X509v3 Key Usage: critical +# Certificate Sign, CRL Sign +# X509v3 Basic Constraints: critical +# CA:TRUE +# X509v3 Subject Key Identifier: +# B7:63:E7:1A:DD:8D:E9:08:A6:55:83:A4:E0:6A:50:41:65:11:42:49 +# Signature Algorithm: ecdsa-with-SHA384 +# 30:64:02:30:61:79:d8:e5:42:47:df:1c:ae:53:99:17:b6:6f: +# 1c:7d:e1:bf:11:94:d1:03:88:75:e4:8d:89:a4:8a:77:46:de: +# 6d:61:ef:02:f5:fb:b5:df:cc:fe:4e:ff:fe:a9:e6:a7:02:30: +# 5b:99:d7:85:37:06:b5:7b:08:fd:eb:27:8b:4a:94:f9:e1:fa: +# a7:8e:26:08:e8:7c:92:68:6d:73:d8:6f:26:ac:21:02:b8:99: +# b7:26:41:5b:25:60:ae:d0:48:1a:ee:06 +-----BEGIN CERTIFICATE----- +MIIC+TCCAoCgAwIBAgINAKaLeSkAAAAAUNCR+TAKBggqhkjOPQQDAzCBvzELMAkG +A1UEBhMCVVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3 +d3cuZW50cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDEyIEVu +dHJ1c3QsIEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEzMDEGA1UEAxMq +RW50cnVzdCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRUMxMB4XDTEy +MTIxODE1MjUzNloXDTM3MTIxODE1NTUzNlowgb8xCzAJBgNVBAYTAlVTMRYwFAYD +VQQKEw1FbnRydXN0LCBJbmMuMSgwJgYDVQQLEx9TZWUgd3d3LmVudHJ1c3QubmV0 +L2xlZ2FsLXRlcm1zMTkwNwYDVQQLEzAoYykgMjAxMiBFbnRydXN0LCBJbmMuIC0g +Zm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxMzAxBgNVBAMTKkVudHJ1c3QgUm9vdCBD +ZXJ0aWZpY2F0aW9uIEF1dGhvcml0eSAtIEVDMTB2MBAGByqGSM49AgEGBSuBBAAi +A2IABIQTydC6bUF74mzQ61VfZgIaJPRbiWlH47jCffHyAsWfoPZb1YsGGYZPUxBt +ByQnoaD41UcZYUx9ypMn6nQM72+WCf5j7HBdNq1nd67JnXxVRDqiY1Ef9eNi1KlH +Bz7MIKNCMEAwDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQFMAMBAf8wHQYDVR0O +BBYEFLdj5xrdjekIplWDpOBqUEFlEUJJMAoGCCqGSM49BAMDA2cAMGQCMGF52OVC +R98crlOZF7ZvHH3hvxGU0QOIdeSNiaSKd0bebWHvAvX7td/M/k7//qnmpwIwW5nX +hTcGtXsI/esni0qU+eH6p44mCOh8kmhtc9hvJqwhAriZtyZBWyVgrtBIGu4G +-----END CERTIFICATE----- +# Entrust Root Certification Authority - G2.pem +# Certificate: +# Data: +# Version: 3 (0x2) +# Serial Number: 1246989352 (0x4a538c28) +# Signature Algorithm: sha256WithRSAEncryption +# Issuer: C=US, O=Entrust, Inc., OU=See www.entrust.net/legal-terms, OU=(c) 2009 Entrust, Inc. - for authorized use only, CN=Entrust Root Certification Authority - G2 +# Validity +# Not Before: Jul 7 17:25:54 2009 GMT +# Not After : Dec 7 17:55:54 2030 GMT +# Subject: C=US, O=Entrust, Inc., OU=See www.entrust.net/legal-terms, OU=(c) 2009 Entrust, Inc. - for authorized use only, CN=Entrust Root Certification Authority - G2 +# Subject Public Key Info: +# Public Key Algorithm: rsaEncryption +# Public-Key: (2048 bit) +# Modulus: +# 00:ba:84:b6:72:db:9e:0c:6b:e2:99:e9:30:01:a7: +# 76:ea:32:b8:95:41:1a:c9:da:61:4e:58:72:cf:fe: +# f6:82:79:bf:73:61:06:0a:a5:27:d8:b3:5f:d3:45: +# 4e:1c:72:d6:4e:32:f2:72:8a:0f:f7:83:19:d0:6a: +# 80:80:00:45:1e:b0:c7:e7:9a:bf:12:57:27:1c:a3: +# 68:2f:0a:87:bd:6a:6b:0e:5e:65:f3:1c:77:d5:d4: +# 85:8d:70:21:b4:b3:32:e7:8b:a2:d5:86:39:02:b1: +# b8:d2:47:ce:e4:c9:49:c4:3b:a7:de:fb:54:7d:57: +# be:f0:e8:6e:c2:79:b2:3a:0b:55:e2:50:98:16:32: +# 13:5c:2f:78:56:c1:c2:94:b3:f2:5a:e4:27:9a:9f: +# 24:d7:c6:ec:d0:9b:25:82:e3:cc:c2:c4:45:c5:8c: +# 97:7a:06:6b:2a:11:9f:a9:0a:6e:48:3b:6f:db:d4: +# 11:19:42:f7:8f:07:bf:f5:53:5f:9c:3e:f4:17:2c: +# e6:69:ac:4e:32:4c:62:77:ea:b7:e8:e5:bb:34:bc: +# 19:8b:ae:9c:51:e7:b7:7e:b5:53:b1:33:22:e5:6d: +# cf:70:3c:1a:fa:e2:9b:67:b6:83:f4:8d:a5:af:62: +# 4c:4d:e0:58:ac:64:34:12:03:f8:b6:8d:94:63:24: +# a4:71 +# Exponent: 65537 (0x10001) +# X509v3 extensions: +# X509v3 Key Usage: critical +# Certificate Sign, CRL Sign +# X509v3 Basic Constraints: critical +# CA:TRUE +# X509v3 Subject Key Identifier: +# 6A:72:26:7A:D0:1E:EF:7D:E7:3B:69:51:D4:6C:8D:9F:90:12:66:AB +# Signature Algorithm: sha256WithRSAEncryption +# 79:9f:1d:96:c6:b6:79:3f:22:8d:87:d3:87:03:04:60:6a:6b: +# 9a:2e:59:89:73:11:ac:43:d1:f5:13:ff:8d:39:2b:c0:f2:bd: +# 4f:70:8c:a9:2f:ea:17:c4:0b:54:9e:d4:1b:96:98:33:3c:a8: +# ad:62:a2:00:76:ab:59:69:6e:06:1d:7e:c4:b9:44:8d:98:af: +# 12:d4:61:db:0a:19:46:47:f3:eb:f7:63:c1:40:05:40:a5:d2: +# b7:f4:b5:9a:36:bf:a9:88:76:88:04:55:04:2b:9c:87:7f:1a: +# 37:3c:7e:2d:a5:1a:d8:d4:89:5e:ca:bd:ac:3d:6c:d8:6d:af: +# d5:f3:76:0f:cd:3b:88:38:22:9d:6c:93:9a:c4:3d:bf:82:1b: +# 65:3f:a6:0f:5d:aa:fc:e5:b2:15:ca:b5:ad:c6:bc:3d:d0:84: +# e8:ea:06:72:b0:4d:39:32:78:bf:3e:11:9c:0b:a4:9d:9a:21: +# f3:f0:9b:0b:30:78:db:c1:dc:87:43:fe:bc:63:9a:ca:c5:c2: +# 1c:c9:c7:8d:ff:3b:12:58:08:e6:b6:3d:ec:7a:2c:4e:fb:83: +# 96:ce:0c:3c:69:87:54:73:a4:73:c2:93:ff:51:10:ac:15:54: +# 01:d8:fc:05:b1:89:a1:7f:74:83:9a:49:d7:dc:4e:7b:8a:48: +# 6f:8b:45:f6 +-----BEGIN CERTIFICATE----- +MIIEPjCCAyagAwIBAgIESlOMKDANBgkqhkiG9w0BAQsFADCBvjELMAkGA1UEBhMC +VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50 +cnVzdC5uZXQvbGVnYWwtdGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3Qs +IEluYy4gLSBmb3IgYXV0aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVz +dCBSb290IENlcnRpZmljYXRpb24gQXV0aG9yaXR5IC0gRzIwHhcNMDkwNzA3MTcy +NTU0WhcNMzAxMjA3MTc1NTU0WjCBvjELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUVu +dHJ1c3QsIEluYy4xKDAmBgNVBAsTH1NlZSB3d3cuZW50cnVzdC5uZXQvbGVnYWwt +dGVybXMxOTA3BgNVBAsTMChjKSAyMDA5IEVudHJ1c3QsIEluYy4gLSBmb3IgYXV0 +aG9yaXplZCB1c2Ugb25seTEyMDAGA1UEAxMpRW50cnVzdCBSb290IENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5IC0gRzIwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEK +AoIBAQC6hLZy254Ma+KZ6TABp3bqMriVQRrJ2mFOWHLP/vaCeb9zYQYKpSfYs1/T +RU4cctZOMvJyig/3gxnQaoCAAEUesMfnmr8SVycco2gvCoe9amsOXmXzHHfV1IWN +cCG0szLni6LVhjkCsbjSR87kyUnEO6fe+1R9V77w6G7CebI6C1XiUJgWMhNcL3hW +wcKUs/Ja5CeanyTXxuzQmyWC48zCxEXFjJd6BmsqEZ+pCm5IO2/b1BEZQvePB7/1 +U1+cPvQXLOZprE4yTGJ36rfo5bs0vBmLrpxR57d+tVOxMyLlbc9wPBr64ptntoP0 +jaWvYkxN4FisZDQSA/i2jZRjJKRxAgMBAAGjQjBAMA4GA1UdDwEB/wQEAwIBBjAP +BgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBRqciZ60B7vfec7aVHUbI2fkBJmqzAN +BgkqhkiG9w0BAQsFAAOCAQEAeZ8dlsa2eT8ijYfThwMEYGprmi5ZiXMRrEPR9RP/ +jTkrwPK9T3CMqS/qF8QLVJ7UG5aYMzyorWKiAHarWWluBh1+xLlEjZivEtRh2woZ +Rkfz6/djwUAFQKXSt/S1mja/qYh2iARVBCuch38aNzx+LaUa2NSJXsq9rD1s2G2v +1fN2D807iDginWyTmsQ9v4IbZT+mD12q/OWyFcq1rca8PdCE6OoGcrBNOTJ4vz4R +nAuknZoh8/CbCzB428Hch0P+vGOaysXCHMnHjf87ElgI5rY97HosTvuDls4MPGmH +VHOkc8KT/1EQrBVUAdj8BbGJoX90g5pJ19xOe4pIb4tF9g== +-----END CERTIFICATE----- +# Entrust Root Certification Authority.pem +# Certificate: +# Data: +# Version: 3 (0x2) +# Serial Number: 1164660820 (0x456b5054) +# Signature Algorithm: sha1WithRSAEncryption +# Issuer: C=US, O=Entrust, Inc., OU=www.entrust.net/CPS is incorporated by reference, OU=(c) 2006 Entrust, Inc., CN=Entrust Root Certification Authority +# Validity +# Not Before: Nov 27 20:23:42 2006 GMT +# Not After : Nov 27 20:53:42 2026 GMT +# Subject: C=US, O=Entrust, Inc., OU=www.entrust.net/CPS is incorporated by reference, OU=(c) 2006 Entrust, Inc., CN=Entrust Root Certification Authority +# Subject Public Key Info: +# Public Key Algorithm: rsaEncryption +# Public-Key: (2048 bit) +# Modulus: +# 00:b6:95:b6:43:42:fa:c6:6d:2a:6f:48:df:94:4c: +# 39:57:05:ee:c3:79:11:41:68:36:ed:ec:fe:9a:01: +# 8f:a1:38:28:fc:f7:10:46:66:2e:4d:1e:1a:b1:1a: +# 4e:c6:d1:c0:95:88:b0:c9:ff:31:8b:33:03:db:b7: +# 83:7b:3e:20:84:5e:ed:b2:56:28:a7:f8:e0:b9:40: +# 71:37:c5:cb:47:0e:97:2a:68:c0:22:95:62:15:db: +# 47:d9:f5:d0:2b:ff:82:4b:c9:ad:3e:de:4c:db:90: +# 80:50:3f:09:8a:84:00:ec:30:0a:3d:18:cd:fb:fd: +# 2a:59:9a:23:95:17:2c:45:9e:1f:6e:43:79:6d:0c: +# 5c:98:fe:48:a7:c5:23:47:5c:5e:fd:6e:e7:1e:b4: +# f6:68:45:d1:86:83:5b:a2:8a:8d:b1:e3:29:80:fe: +# 25:71:88:ad:be:bc:8f:ac:52:96:4b:aa:51:8d:e4: +# 13:31:19:e8:4e:4d:9f:db:ac:b3:6a:d5:bc:39:54: +# 71:ca:7a:7a:7f:90:dd:7d:1d:80:d9:81:bb:59:26: +# c2:11:fe:e6:93:e2:f7:80:e4:65:fb:34:37:0e:29: +# 80:70:4d:af:38:86:2e:9e:7f:57:af:9e:17:ae:eb: +# 1c:cb:28:21:5f:b6:1c:d8:e7:a2:04:22:f9:d3:da: +# d8:cb +# Exponent: 65537 (0x10001) +# X509v3 extensions: +# X509v3 Key Usage: critical +# Certificate Sign, CRL Sign +# X509v3 Basic Constraints: critical +# CA:TRUE +# X509v3 Private Key Usage Period: +# Not Before: Nov 27 20:23:42 2006 GMT, Not After: Nov 27 20:53:42 2026 GMT +# X509v3 Authority Key Identifier: +# keyid:68:90:E4:67:A4:A6:53:80:C7:86:66:A4:F1:F7:4B:43:FB:84:BD:6D +# +# X509v3 Subject Key Identifier: +# 68:90:E4:67:A4:A6:53:80:C7:86:66:A4:F1:F7:4B:43:FB:84:BD:6D +# 1.2.840.113533.7.65.0: +# 0...V7.1:4.0.... +# Signature Algorithm: sha1WithRSAEncryption +# 93:d4:30:b0:d7:03:20:2a:d0:f9:63:e8:91:0c:05:20:a9:5f: +# 19:ca:7b:72:4e:d4:b1:db:d0:96:fb:54:5a:19:2c:0c:08:f7: +# b2:bc:85:a8:9d:7f:6d:3b:52:b3:2a:db:e7:d4:84:8c:63:f6: +# 0f:cb:26:01:91:50:6c:f4:5f:14:e2:93:74:c0:13:9e:30:3a: +# 50:e3:b4:60:c5:1c:f0:22:44:8d:71:47:ac:c8:1a:c9:e9:9b: +# 9a:00:60:13:ff:70:7e:5f:11:4d:49:1b:b3:15:52:7b:c9:54: +# da:bf:9d:95:af:6b:9a:d8:9e:e9:f1:e4:43:8d:e2:11:44:3a: +# bf:af:bd:83:42:73:52:8b:aa:bb:a7:29:cf:f5:64:1c:0a:4d: +# d1:bc:aa:ac:9f:2a:d0:ff:7f:7f:da:7d:ea:b1:ed:30:25:c1: +# 84:da:34:d2:5b:78:83:56:ec:9c:36:c3:26:e2:11:f6:67:49: +# 1d:92:ab:8c:fb:eb:ff:7a:ee:85:4a:a7:50:80:f0:a7:5c:4a: +# 94:2e:5f:05:99:3c:52:41:e0:cd:b4:63:cf:01:43:ba:9c:83: +# dc:8f:60:3b:f3:5a:b4:b4:7b:ae:da:0b:90:38:75:ef:81:1d: +# 66:d2:f7:57:70:36:b3:bf:fc:28:af:71:25:85:5b:13:fe:1e: +# 7f:5a:b4:3c +-----BEGIN CERTIFICATE----- +MIIEkTCCA3mgAwIBAgIERWtQVDANBgkqhkiG9w0BAQUFADCBsDELMAkGA1UEBhMC +VVMxFjAUBgNVBAoTDUVudHJ1c3QsIEluYy4xOTA3BgNVBAsTMHd3dy5lbnRydXN0 +Lm5ldC9DUFMgaXMgaW5jb3Jwb3JhdGVkIGJ5IHJlZmVyZW5jZTEfMB0GA1UECxMW +KGMpIDIwMDYgRW50cnVzdCwgSW5jLjEtMCsGA1UEAxMkRW50cnVzdCBSb290IENl +cnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA2MTEyNzIwMjM0MloXDTI2MTEyNzIw +NTM0MlowgbAxCzAJBgNVBAYTAlVTMRYwFAYDVQQKEw1FbnRydXN0LCBJbmMuMTkw +NwYDVQQLEzB3d3cuZW50cnVzdC5uZXQvQ1BTIGlzIGluY29ycG9yYXRlZCBieSBy +ZWZlcmVuY2UxHzAdBgNVBAsTFihjKSAyMDA2IEVudHJ1c3QsIEluYy4xLTArBgNV +BAMTJEVudHJ1c3QgUm9vdCBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASIwDQYJ +KoZIhvcNAQEBBQADggEPADCCAQoCggEBALaVtkNC+sZtKm9I35RMOVcF7sN5EUFo +Nu3s/poBj6E4KPz3EEZmLk0eGrEaTsbRwJWIsMn/MYszA9u3g3s+IIRe7bJWKKf4 +4LlAcTfFy0cOlypowCKVYhXbR9n10Cv/gkvJrT7eTNuQgFA/CYqEAOwwCj0Yzfv9 +KlmaI5UXLEWeH25DeW0MXJj+SKfFI0dcXv1u5x609mhF0YaDW6KKjbHjKYD+JXGI +rb68j6xSlkuqUY3kEzEZ6E5Nn9uss2rVvDlUccp6en+Q3X0dgNmBu1kmwhH+5pPi +94DkZfs0Nw4pgHBNrziGLp5/V6+eF67rHMsoIV+2HNjnogQi+dPa2MsCAwEAAaOB +sDCBrTAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zArBgNVHRAEJDAi +gA8yMDA2MTEyNzIwMjM0MlqBDzIwMjYxMTI3MjA1MzQyWjAfBgNVHSMEGDAWgBRo +kORnpKZTgMeGZqTx90tD+4S9bTAdBgNVHQ4EFgQUaJDkZ6SmU4DHhmak8fdLQ/uE +vW0wHQYJKoZIhvZ9B0EABBAwDhsIVjcuMTo0LjADAgSQMA0GCSqGSIb3DQEBBQUA +A4IBAQCT1DCw1wMgKtD5Y+iRDAUgqV8ZyntyTtSx29CW+1RaGSwMCPeyvIWonX9t +O1KzKtvn1ISMY/YPyyYBkVBs9F8U4pN0wBOeMDpQ47RgxRzwIkSNcUesyBrJ6Zua +AGAT/3B+XxFNSRuzFVJ7yVTav52Vr2ua2J7p8eRDjeIRRDq/r72DQnNSi6q7pynP +9WQcCk3RvKqsnyrQ/39/2n3qse0wJcGE2jTSW3iDVuycNsMm4hH2Z0kdkquM++v/ +eu6FSqdQgPCnXEqULl8FmTxSQeDNtGPPAUO6nIPcj2A781q0tHuu2guQOHXvgR1m +0vdXcDazv/wor3ElhVsT/h5/WrQ8 +-----END CERTIFICATE----- +# Entrust.net Certification Authority (2048).pem +# Certificate: +# Data: +# Version: 3 (0x2) +# Serial Number: 946069240 (0x3863def8) +# Signature Algorithm: sha1WithRSAEncryption +# Issuer: O=Entrust.net, OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Certification Authority (2048) +# Validity +# Not Before: Dec 24 17:50:51 1999 GMT +# Not After : Jul 24 14:15:12 2029 GMT +# Subject: O=Entrust.net, OU=www.entrust.net/CPS_2048 incorp. by ref. (limits liab.), OU=(c) 1999 Entrust.net Limited, CN=Entrust.net Certification Authority (2048) +# Subject Public Key Info: +# Public Key Algorithm: rsaEncryption +# Public-Key: (2048 bit) +# Modulus: +# 00:ad:4d:4b:a9:12:86:b2:ea:a3:20:07:15:16:64: +# 2a:2b:4b:d1:bf:0b:4a:4d:8e:ed:80:76:a5:67:b7: +# 78:40:c0:73:42:c8:68:c0:db:53:2b:dd:5e:b8:76: +# 98:35:93:8b:1a:9d:7c:13:3a:0e:1f:5b:b7:1e:cf: +# e5:24:14:1e:b1:81:a9:8d:7d:b8:cc:6b:4b:03:f1: +# 02:0c:dc:ab:a5:40:24:00:7f:74:94:a1:9d:08:29: +# b3:88:0b:f5:87:77:9d:55:cd:e4:c3:7e:d7:6a:64: +# ab:85:14:86:95:5b:97:32:50:6f:3d:c8:ba:66:0c: +# e3:fc:bd:b8:49:c1:76:89:49:19:fd:c0:a8:bd:89: +# a3:67:2f:c6:9f:bc:71:19:60:b8:2d:e9:2c:c9:90: +# 76:66:7b:94:e2:af:78:d6:65:53:5d:3c:d6:9c:b2: +# cf:29:03:f9:2f:a4:50:b2:d4:48:ce:05:32:55:8a: +# fd:b2:64:4c:0e:e4:98:07:75:db:7f:df:b9:08:55: +# 60:85:30:29:f9:7b:48:a4:69:86:e3:35:3f:1e:86: +# 5d:7a:7a:15:bd:ef:00:8e:15:22:54:17:00:90:26: +# 93:bc:0e:49:68:91:bf:f8:47:d3:9d:95:42:c1:0e: +# 4d:df:6f:26:cf:c3:18:21:62:66:43:70:d6:d5:c0: +# 07:e1 +# Exponent: 65537 (0x10001) +# X509v3 extensions: +# X509v3 Key Usage: critical +# Certificate Sign, CRL Sign +# X509v3 Basic Constraints: critical +# CA:TRUE +# X509v3 Subject Key Identifier: +# 55:E4:81:D1:11:80:BE:D8:89:B9:08:A3:31:F9:A1:24:09:16:B9:70 +# Signature Algorithm: sha1WithRSAEncryption +# 3b:9b:8f:56:9b:30:e7:53:99:7c:7a:79:a7:4d:97:d7:19:95: +# 90:fb:06:1f:ca:33:7c:46:63:8f:96:66:24:fa:40:1b:21:27: +# ca:e6:72:73:f2:4f:fe:31:99:fd:c8:0c:4c:68:53:c6:80:82: +# 13:98:fa:b6:ad:da:5d:3d:f1:ce:6e:f6:15:11:94:82:0c:ee: +# 3f:95:af:11:ab:0f:d7:2f:de:1f:03:8f:57:2c:1e:c9:bb:9a: +# 1a:44:95:eb:18:4f:a6:1f:cd:7d:57:10:2f:9b:04:09:5a:84: +# b5:6e:d8:1d:3a:e1:d6:9e:d1:6c:79:5e:79:1c:14:c5:e3:d0: +# 4c:93:3b:65:3c:ed:df:3d:be:a6:e5:95:1a:c3:b5:19:c3:bd: +# 5e:5b:bb:ff:23:ef:68:19:cb:12:93:27:5c:03:2d:6f:30:d0: +# 1e:b6:1a:ac:de:5a:f7:d1:aa:a8:27:a6:fe:79:81:c4:79:99: +# 33:57:ba:12:b0:a9:e0:42:6c:93:ca:56:de:fe:6d:84:0b:08: +# 8b:7e:8d:ea:d7:98:21:c6:f3:e7:3c:79:2f:5e:9c:d1:4c:15: +# 8d:e1:ec:22:37:cc:9a:43:0b:97:dc:80:90:8d:b3:67:9b:6f: +# 48:08:15:56:cf:bf:f1:2b:7c:5e:9a:76:e9:59:90:c5:7c:83: +# 35:11:65:51 +-----BEGIN CERTIFICATE----- +MIIEKjCCAxKgAwIBAgIEOGPe+DANBgkqhkiG9w0BAQUFADCBtDEUMBIGA1UEChML +RW50cnVzdC5uZXQxQDA+BgNVBAsUN3d3dy5lbnRydXN0Lm5ldC9DUFNfMjA0OCBp +bmNvcnAuIGJ5IHJlZi4gKGxpbWl0cyBsaWFiLikxJTAjBgNVBAsTHChjKSAxOTk5 +IEVudHJ1c3QubmV0IExpbWl0ZWQxMzAxBgNVBAMTKkVudHJ1c3QubmV0IENlcnRp +ZmljYXRpb24gQXV0aG9yaXR5ICgyMDQ4KTAeFw05OTEyMjQxNzUwNTFaFw0yOTA3 +MjQxNDE1MTJaMIG0MRQwEgYDVQQKEwtFbnRydXN0Lm5ldDFAMD4GA1UECxQ3d3d3 +LmVudHJ1c3QubmV0L0NQU18yMDQ4IGluY29ycC4gYnkgcmVmLiAobGltaXRzIGxp +YWIuKTElMCMGA1UECxMcKGMpIDE5OTkgRW50cnVzdC5uZXQgTGltaXRlZDEzMDEG +A1UEAxMqRW50cnVzdC5uZXQgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgKDIwNDgp +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEArU1LqRKGsuqjIAcVFmQq +K0vRvwtKTY7tgHalZ7d4QMBzQshowNtTK91euHaYNZOLGp18EzoOH1u3Hs/lJBQe +sYGpjX24zGtLA/ECDNyrpUAkAH90lKGdCCmziAv1h3edVc3kw37XamSrhRSGlVuX +MlBvPci6Zgzj/L24ScF2iUkZ/cCovYmjZy/Gn7xxGWC4LeksyZB2ZnuU4q941mVT +XTzWnLLPKQP5L6RQstRIzgUyVYr9smRMDuSYB3Xbf9+5CFVghTAp+XtIpGmG4zU/ +HoZdenoVve8AjhUiVBcAkCaTvA5JaJG/+EfTnZVCwQ5N328mz8MYIWJmQ3DW1cAH +4QIDAQABo0IwQDAOBgNVHQ8BAf8EBAMCAQYwDwYDVR0TAQH/BAUwAwEB/zAdBgNV +HQ4EFgQUVeSB0RGAvtiJuQijMfmhJAkWuXAwDQYJKoZIhvcNAQEFBQADggEBADub +j1abMOdTmXx6eadNl9cZlZD7Bh/KM3xGY4+WZiT6QBshJ8rmcnPyT/4xmf3IDExo +U8aAghOY+rat2l098c5u9hURlIIM7j+VrxGrD9cv3h8Dj1csHsm7mhpElesYT6Yf +zX1XEC+bBAlahLVu2B064dae0Wx5XnkcFMXj0EyTO2U87d89vqbllRrDtRnDvV5b +u/8j72gZyxKTJ1wDLW8w0B62GqzeWvfRqqgnpv55gcR5mTNXuhKwqeBCbJPKVt7+ +bYQLCIt+jerXmCHG8+c8eS9enNFMFY3h7CI3zJpDC5fcgJCNs2ebb0gIFVbPv/Er +fF6adulZkMV8gzURZVE= +-----END CERTIFICATE----- +# GeoTrust Global CA.pem +# Certificate: +# Data: +# Version: 3 (0x2) +# Serial Number: 144470 (0x23456) +# Signature Algorithm: sha1WithRSAEncryption +# Issuer: C=US, O=GeoTrust Inc., CN=GeoTrust Global CA +# Validity +# Not Before: May 21 04:00:00 2002 GMT +# Not After : May 21 04:00:00 2022 GMT +# Subject: C=US, O=GeoTrust Inc., CN=GeoTrust Global CA +# Subject Public Key Info: +# Public Key Algorithm: rsaEncryption +# Public-Key: (2048 bit) +# Modulus: +# 00:da:cc:18:63:30:fd:f4:17:23:1a:56:7e:5b:df: +# 3c:6c:38:e4:71:b7:78:91:d4:bc:a1:d8:4c:f8:a8: +# 43:b6:03:e9:4d:21:07:08:88:da:58:2f:66:39:29: +# bd:05:78:8b:9d:38:e8:05:b7:6a:7e:71:a4:e6:c4: +# 60:a6:b0:ef:80:e4:89:28:0f:9e:25:d6:ed:83:f3: +# ad:a6:91:c7:98:c9:42:18:35:14:9d:ad:98:46:92: +# 2e:4f:ca:f1:87:43:c1:16:95:57:2d:50:ef:89:2d: +# 80:7a:57:ad:f2:ee:5f:6b:d2:00:8d:b9:14:f8:14: +# 15:35:d9:c0:46:a3:7b:72:c8:91:bf:c9:55:2b:cd: +# d0:97:3e:9c:26:64:cc:df:ce:83:19:71:ca:4e:e6: +# d4:d5:7b:a9:19:cd:55:de:c8:ec:d2:5e:38:53:e5: +# 5c:4f:8c:2d:fe:50:23:36:fc:66:e6:cb:8e:a4:39: +# 19:00:b7:95:02:39:91:0b:0e:fe:38:2e:d1:1d:05: +# 9a:f6:4d:3e:6f:0f:07:1d:af:2c:1e:8f:60:39:e2: +# fa:36:53:13:39:d4:5e:26:2b:db:3d:a8:14:bd:32: +# eb:18:03:28:52:04:71:e5:ab:33:3d:e1:38:bb:07: +# 36:84:62:9c:79:ea:16:30:f4:5f:c0:2b:e8:71:6b: +# e4:f9 +# Exponent: 65537 (0x10001) +# X509v3 extensions: +# X509v3 Basic Constraints: critical +# CA:TRUE +# X509v3 Subject Key Identifier: +# C0:7A:98:68:8D:89:FB:AB:05:64:0C:11:7D:AA:7D:65:B8:CA:CC:4E +# X509v3 Authority Key Identifier: +# keyid:C0:7A:98:68:8D:89:FB:AB:05:64:0C:11:7D:AA:7D:65:B8:CA:CC:4E +# +# Signature Algorithm: sha1WithRSAEncryption +# 35:e3:29:6a:e5:2f:5d:54:8e:29:50:94:9f:99:1a:14:e4:8f: +# 78:2a:62:94:a2:27:67:9e:d0:cf:1a:5e:47:e9:c1:b2:a4:cf: +# dd:41:1a:05:4e:9b:4b:ee:4a:6f:55:52:b3:24:a1:37:0a:eb: +# 64:76:2a:2e:2c:f3:fd:3b:75:90:bf:fa:71:d8:c7:3d:37:d2: +# b5:05:95:62:b9:a6:de:89:3d:36:7b:38:77:48:97:ac:a6:20: +# 8f:2e:a6:c9:0c:c2:b2:99:45:00:c7:ce:11:51:22:22:e0:a5: +# ea:b6:15:48:09:64:ea:5e:4f:74:f7:05:3e:c7:8a:52:0c:db: +# 15:b4:bd:6d:9b:e5:c6:b1:54:68:a9:e3:69:90:b6:9a:a5:0f: +# b8:b9:3f:20:7d:ae:4a:b5:b8:9c:e4:1d:b6:ab:e6:94:a5:c1: +# c7:83:ad:db:f5:27:87:0e:04:6c:d5:ff:dd:a0:5d:ed:87:52: +# b7:2b:15:02:ae:39:a6:6a:74:e9:da:c4:e7:bc:4d:34:1e:a9: +# 5c:4d:33:5f:92:09:2f:88:66:5d:77:97:c7:1d:76:13:a9:d5: +# e5:f1:16:09:11:35:d5:ac:db:24:71:70:2c:98:56:0b:d9:17: +# b4:d1:e3:51:2b:5e:75:e8:d5:d0:dc:4f:34:ed:c2:05:66:80: +# a1:cb:e6:33 +-----BEGIN CERTIFICATE----- +MIIDVDCCAjygAwIBAgIDAjRWMA0GCSqGSIb3DQEBBQUAMEIxCzAJBgNVBAYTAlVT +MRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMRswGQYDVQQDExJHZW9UcnVzdCBHbG9i +YWwgQ0EwHhcNMDIwNTIxMDQwMDAwWhcNMjIwNTIxMDQwMDAwWjBCMQswCQYDVQQG +EwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjEbMBkGA1UEAxMSR2VvVHJ1c3Qg +R2xvYmFsIENBMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2swYYzD9 +9BcjGlZ+W988bDjkcbd4kdS8odhM+KhDtgPpTSEHCIjaWC9mOSm9BXiLnTjoBbdq +fnGk5sRgprDvgOSJKA+eJdbtg/OtppHHmMlCGDUUna2YRpIuT8rxh0PBFpVXLVDv +iS2Aelet8u5fa9IAjbkU+BQVNdnARqN7csiRv8lVK83Qlz6cJmTM386DGXHKTubU +1XupGc1V3sjs0l44U+VcT4wt/lAjNvxm5suOpDkZALeVAjmRCw7+OC7RHQWa9k0+ +bw8HHa8sHo9gOeL6NlMTOdReJivbPagUvTLrGAMoUgRx5aszPeE4uwc2hGKceeoW +MPRfwCvocWvk+QIDAQABo1MwUTAPBgNVHRMBAf8EBTADAQH/MB0GA1UdDgQWBBTA +ephojYn7qwVkDBF9qn1luMrMTjAfBgNVHSMEGDAWgBTAephojYn7qwVkDBF9qn1l +uMrMTjANBgkqhkiG9w0BAQUFAAOCAQEANeMpauUvXVSOKVCUn5kaFOSPeCpilKIn +Z57QzxpeR+nBsqTP3UEaBU6bS+5Kb1VSsyShNwrrZHYqLizz/Tt1kL/6cdjHPTfS +tQWVYrmm3ok9Nns4d0iXrKYgjy6myQzCsplFAMfOEVEiIuCl6rYVSAlk6l5PdPcF +PseKUgzbFbS9bZvlxrFUaKnjaZC2mqUPuLk/IH2uSrW4nOQdtqvmlKXBx4Ot2/Un +hw4EbNX/3aBd7YdStysVAq45pmp06drE57xNNB6pXE0zX5IJL4hmXXeXxx12E6nV +5fEWCRE11azbJHFwLJhWC9kXtNHjUStedejV0NxPNO3CBWaAocvmMw== +-----END CERTIFICATE----- +# GeoTrust Primary Certification Authority - G2.pem +# Certificate: +# Data: +# Version: 3 (0x2) +# Serial Number: +# 3c:b2:f4:48:0a:00:e2:fe:eb:24:3b:5e:60:3e:c3:6b +# Signature Algorithm: ecdsa-with-SHA384 +# Issuer: C=US, O=GeoTrust Inc., OU=(c) 2007 GeoTrust Inc. - For authorized use only, CN=GeoTrust Primary Certification Authority - G2 +# Validity +# Not Before: Nov 5 00:00:00 2007 GMT +# Not After : Jan 18 23:59:59 2038 GMT +# Subject: C=US, O=GeoTrust Inc., OU=(c) 2007 GeoTrust Inc. - For authorized use only, CN=GeoTrust Primary Certification Authority - G2 +# Subject Public Key Info: +# Public Key Algorithm: id-ecPublicKey +# Public-Key: (384 bit) +# pub: +# 04:15:b1:e8:fd:03:15:43:e5:ac:eb:87:37:11:62: +# ef:d2:83:36:52:7d:45:57:0b:4a:8d:7b:54:3b:3a: +# 6e:5f:15:02:c0:50:a6:cf:25:2f:7d:ca:48:b8:c7: +# 50:63:1c:2a:21:08:7c:9a:36:d8:0b:fe:d1:26:c5: +# 58:31:30:28:25:f3:5d:5d:a3:b8:b6:a5:b4:92:ed: +# 6c:2c:9f:eb:dd:43:89:a2:3c:4b:48:91:1d:50:ec: +# 26:df:d6:60:2e:bd:21 +# ASN1 OID: secp384r1 +# X509v3 extensions: +# X509v3 Basic Constraints: critical +# CA:TRUE +# X509v3 Key Usage: critical +# Certificate Sign, CRL Sign +# X509v3 Subject Key Identifier: +# 15:5F:35:57:51:55:FB:25:B2:AD:03:69:FC:01:A3:FA:BE:11:55:D5 +# Signature Algorithm: ecdsa-with-SHA384 +# 30:64:02:30:64:96:59:a6:e8:09:de:8b:ba:fa:5a:88:88:f0: +# 1f:91:d3:46:a8:f2:4a:4c:02:63:fb:6c:5f:38:db:2e:41:93: +# a9:0e:e6:9d:dc:31:1c:b2:a0:a7:18:1c:79:e1:c7:36:02:30: +# 3a:56:af:9a:74:6c:f6:fb:83:e0:33:d3:08:5f:a1:9c:c2:5b: +# 9f:46:d6:b6:cb:91:06:63:a2:06:e7:33:ac:3e:a8:81:12:d0: +# cb:ba:d0:92:0b:b6:9e:96:aa:04:0f:8a +-----BEGIN CERTIFICATE----- +MIICrjCCAjWgAwIBAgIQPLL0SAoA4v7rJDteYD7DazAKBggqhkjOPQQDAzCBmDEL +MAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsTMChj +KSAyMDA3IEdlb1RydXN0IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25seTE2 +MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0 +eSAtIEcyMB4XDTA3MTEwNTAwMDAwMFoXDTM4MDExODIzNTk1OVowgZgxCzAJBgNV +BAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykgMjAw +NyBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0BgNV +BAMTLUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkgLSBH +MjB2MBAGByqGSM49AgEGBSuBBAAiA2IABBWx6P0DFUPlrOuHNxFi79KDNlJ9RVcL +So17VDs6bl8VAsBQps8lL33KSLjHUGMcKiEIfJo22Av+0SbFWDEwKCXzXV2juLal +tJLtbCyf691DiaI8S0iRHVDsJt/WYC69IaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAO +BgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYEFBVfNVdRVfslsq0DafwBo/q+EVXVMAoG +CCqGSM49BAMDA2cAMGQCMGSWWaboCd6LuvpaiIjwH5HTRqjySkwCY/tsXzjbLkGT +qQ7mndwxHLKgpxgceeHHNgIwOlavmnRs9vuD4DPTCF+hnMJbn0bWtsuRBmOiBucz +rD6ogRLQy7rQkgu2npaqBA+K +-----END CERTIFICATE----- +# GeoTrust Primary Certification Authority - G3.pem +# Certificate: +# Data: +# Version: 3 (0x2) +# Serial Number: +# 15:ac:6e:94:19:b2:79:4b:41:f6:27:a9:c3:18:0f:1f +# Signature Algorithm: sha256WithRSAEncryption +# Issuer: C=US, O=GeoTrust Inc., OU=(c) 2008 GeoTrust Inc. - For authorized use only, CN=GeoTrust Primary Certification Authority - G3 +# Validity +# Not Before: Apr 2 00:00:00 2008 GMT +# Not After : Dec 1 23:59:59 2037 GMT +# Subject: C=US, O=GeoTrust Inc., OU=(c) 2008 GeoTrust Inc. - For authorized use only, CN=GeoTrust Primary Certification Authority - G3 +# Subject Public Key Info: +# Public Key Algorithm: rsaEncryption +# Public-Key: (2048 bit) +# Modulus: +# 00:dc:e2:5e:62:58:1d:33:57:39:32:33:fa:eb:cb: +# 87:8c:a7:d4:4a:dd:06:88:ea:64:8e:31:98:a5:38: +# 90:1e:98:cf:2e:63:2b:f0:46:bc:44:b2:89:a1:c0: +# 28:0c:49:70:21:95:9f:64:c0:a6:93:12:02:65:26: +# 86:c6:a5:89:f0:fa:d7:84:a0:70:af:4f:1a:97:3f: +# 06:44:d5:c9:eb:72:10:7d:e4:31:28:fb:1c:61:e6: +# 28:07:44:73:92:22:69:a7:03:88:6c:9d:63:c8:52: +# da:98:27:e7:08:4c:70:3e:b4:c9:12:c1:c5:67:83: +# 5d:33:f3:03:11:ec:6a:d0:53:e2:d1:ba:36:60:94: +# 80:bb:61:63:6c:5b:17:7e:df:40:94:1e:ab:0d:c2: +# 21:28:70:88:ff:d6:26:6c:6c:60:04:25:4e:55:7e: +# 7d:ef:bf:94:48:de:b7:1d:dd:70:8d:05:5f:88:a5: +# 9b:f2:c2:ee:ea:d1:40:41:6d:62:38:1d:56:06:c5: +# 03:47:51:20:19:fc:7b:10:0b:0e:62:ae:76:55:bf: +# 5f:77:be:3e:49:01:53:3d:98:25:03:76:24:5a:1d: +# b4:db:89:ea:79:e5:b6:b3:3b:3f:ba:4c:28:41:7f: +# 06:ac:6a:8e:c1:d0:f6:05:1d:7d:e6:42:86:e3:a5: +# d5:47 +# Exponent: 65537 (0x10001) +# X509v3 extensions: +# X509v3 Basic Constraints: critical +# CA:TRUE +# X509v3 Key Usage: critical +# Certificate Sign, CRL Sign +# X509v3 Subject Key Identifier: +# C4:79:CA:8E:A1:4E:03:1D:1C:DC:6B:DB:31:5B:94:3E:3F:30:7F:2D +# Signature Algorithm: sha256WithRSAEncryption +# 2d:c5:13:cf:56:80:7b:7a:78:bd:9f:ae:2c:99:e7:ef:da:df: +# 94:5e:09:69:a7:e7:6e:68:8c:bd:72:be:47:a9:0e:97:12:b8: +# 4a:f1:64:d3:39:df:25:34:d4:c1:cd:4e:81:f0:0f:04:c4:24: +# b3:34:96:c6:a6:aa:30:df:68:61:73:d7:f9:8e:85:89:ef:0e: +# 5e:95:28:4a:2a:27:8f:10:8e:2e:7c:86:c4:02:9e:da:0c:77: +# 65:0e:44:0d:92:fd:fd:b3:16:36:fa:11:0d:1d:8c:0e:07:89: +# 6a:29:56:f7:72:f4:dd:15:9c:77:35:66:57:ab:13:53:d8:8e: +# c1:40:c5:d7:13:16:5a:72:c7:b7:69:01:c4:7a:b1:83:01:68: +# 7d:8d:41:a1:94:18:c1:25:5c:fc:f0:fe:83:02:87:7c:0d:0d: +# cf:2e:08:5c:4a:40:0d:3e:ec:81:61:e6:24:db:ca:e0:0e:2d: +# 07:b2:3e:56:dc:8d:f5:41:85:07:48:9b:0c:0b:cb:49:3f:7d: +# ec:b7:fd:cb:8d:67:89:1a:ab:ed:bb:1e:a3:00:08:08:17:2a: +# 82:5c:31:5d:46:8a:2d:0f:86:9b:74:d9:45:fb:d4:40:b1:7a: +# aa:68:2d:86:b2:99:22:e1:c1:2b:c7:9c:f8:f3:5f:a8:82:12: +# eb:19:11:2d +-----BEGIN CERTIFICATE----- +MIID/jCCAuagAwIBAgIQFaxulBmyeUtB9iepwxgPHzANBgkqhkiG9w0BAQsFADCB +mDELMAkGA1UEBhMCVVMxFjAUBgNVBAoTDUdlb1RydXN0IEluYy4xOTA3BgNVBAsT +MChjKSAyMDA4IEdlb1RydXN0IEluYy4gLSBGb3IgYXV0aG9yaXplZCB1c2Ugb25s +eTE2MDQGA1UEAxMtR2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhv +cml0eSAtIEczMB4XDTA4MDQwMjAwMDAwMFoXDTM3MTIwMTIzNTk1OVowgZgxCzAJ +BgNVBAYTAlVTMRYwFAYDVQQKEw1HZW9UcnVzdCBJbmMuMTkwNwYDVQQLEzAoYykg +MjAwOCBHZW9UcnVzdCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxNjA0 +BgNVBAMTLUdlb1RydXN0IFByaW1hcnkgQ2VydGlmaWNhdGlvbiBBdXRob3JpdHkg +LSBHMzCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBANziXmJYHTNXOTIz ++uvLh4yn1ErdBojqZI4xmKU4kB6Yzy5jK/BGvESyiaHAKAxJcCGVn2TAppMSAmUm +hsalifD614SgcK9PGpc/BkTVyetyEH3kMSj7HGHmKAdEc5IiaacDiGydY8hS2pgn +5whMcD60yRLBxWeDXTPzAxHsatBT4tG6NmCUgLthY2xbF37fQJQeqw3CIShwiP/W +JmxsYAQlTlV+fe+/lEjetx3dcI0FX4ilm/LC7urRQEFtYjgdVgbFA0dRIBn8exAL +DmKudlW/X3e+PkkBUz2YJQN2JFodtNuJ6nnltrM7P7pMKEF/BqxqjsHQ9gUdfeZC +huOl1UcCAwEAAaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYw +HQYDVR0OBBYEFMR5yo6hTgMdHNxr2zFblD4/MH8tMA0GCSqGSIb3DQEBCwUAA4IB +AQAtxRPPVoB7eni9n64smefv2t+UXglpp+duaIy9cr5HqQ6XErhK8WTTOd8lNNTB +zU6B8A8ExCSzNJbGpqow32hhc9f5joWJ7w5elShKKiePEI4ufIbEAp7aDHdlDkQN +kv39sxY2+hENHYwOB4lqKVb3cvTdFZx3NWZXqxNT2I7BQMXXExZacse3aQHEerGD +AWh9jUGhlBjBJVz88P6DAod8DQ3PLghcSkANPuyBYeYk28rgDi0Hsj5W3I31QYUH +SJsMC8tJP33st/3LjWeJGqvtux6jAAgIFyqCXDFdRootD4abdNlF+9RAsXqqaC2G +spki4cErx5z481+oghLrGREt +-----END CERTIFICATE----- +# GeoTrust Primary Certification Authority.pem +# Certificate: +# Data: +# Version: 3 (0x2) +# Serial Number: +# 18:ac:b5:6a:fd:69:b6:15:3a:63:6c:af:da:fa:c4:a1 +# Signature Algorithm: sha1WithRSAEncryption +# Issuer: C=US, O=GeoTrust Inc., CN=GeoTrust Primary Certification Authority +# Validity +# Not Before: Nov 27 00:00:00 2006 GMT +# Not After : Jul 16 23:59:59 2036 GMT +# Subject: C=US, O=GeoTrust Inc., CN=GeoTrust Primary Certification Authority +# Subject Public Key Info: +# Public Key Algorithm: rsaEncryption +# Public-Key: (2048 bit) +# Modulus: +# 00:be:b8:15:7b:ff:d4:7c:7d:67:ad:83:64:7b:c8: +# 42:53:2d:df:f6:84:08:20:61:d6:01:59:6a:9c:44: +# 11:af:ef:76:fd:95:7e:ce:61:30:bb:7a:83:5f:02: +# bd:01:66:ca:ee:15:8d:6f:a1:30:9c:bd:a1:85:9e: +# 94:3a:f3:56:88:00:31:cf:d8:ee:6a:96:02:d9:ed: +# 03:8c:fb:75:6d:e7:ea:b8:55:16:05:16:9a:f4:e0: +# 5e:b1:88:c0:64:85:5c:15:4d:88:c7:b7:ba:e0:75: +# e9:ad:05:3d:9d:c7:89:48:e0:bb:28:c8:03:e1:30: +# 93:64:5e:52:c0:59:70:22:35:57:88:8a:f1:95:0a: +# 83:d7:bc:31:73:01:34:ed:ef:46:71:e0:6b:02:a8: +# 35:72:6b:97:9b:66:e0:cb:1c:79:5f:d8:1a:04:68: +# 1e:47:02:e6:9d:60:e2:36:97:01:df:ce:35:92:df: +# be:67:c7:6d:77:59:3b:8f:9d:d6:90:15:94:bc:42: +# 34:10:c1:39:f9:b1:27:3e:7e:d6:8a:75:c5:b2:af: +# 96:d3:a2:de:9b:e4:98:be:7d:e1:e9:81:ad:b6:6f: +# fc:d7:0e:da:e0:34:b0:0d:1a:77:e7:e3:08:98:ef: +# 58:fa:9c:84:b7:36:af:c2:df:ac:d2:f4:10:06:70: +# 71:35 +# Exponent: 65537 (0x10001) +# X509v3 extensions: +# X509v3 Basic Constraints: critical +# CA:TRUE +# X509v3 Key Usage: critical +# Certificate Sign, CRL Sign +# X509v3 Subject Key Identifier: +# 2C:D5:50:41:97:15:8B:F0:8F:36:61:5B:4A:FB:6B:D9:99:C9:33:92 +# Signature Algorithm: sha1WithRSAEncryption +# 5a:70:7f:2c:dd:b7:34:4f:f5:86:51:a9:26:be:4b:b8:aa:f1: +# 71:0d:dc:61:c7:a0:ea:34:1e:7a:77:0f:04:35:e8:27:8f:6c: +# 90:bf:91:16:24:46:3e:4a:4e:ce:2b:16:d5:0b:52:1d:fc:1f: +# 67:a2:02:45:31:4f:ce:f3:fa:03:a7:79:9d:53:6a:d9:da:63: +# 3a:f8:80:d7:d3:99:e1:a5:e1:be:d4:55:71:98:35:3a:be:93: +# ea:ae:ad:42:b2:90:6f:e0:fc:21:4d:35:63:33:89:49:d6:9b: +# 4e:ca:c7:e7:4e:09:00:f7:da:c7:ef:99:62:99:77:b6:95:22: +# 5e:8a:a0:ab:f4:b8:78:98:ca:38:19:99:c9:72:9e:78:cd:4b: +# ac:af:19:a0:73:12:2d:fc:c2:41:ba:81:91:da:16:5a:31:b7: +# f9:b4:71:80:12:48:99:72:73:5a:59:53:c1:63:52:33:ed:a7: +# c9:d2:39:02:70:fa:e0:b1:42:66:29:aa:9b:51:ed:30:54:22: +# 14:5f:d9:ab:1d:c1:e4:94:f0:f8:f5:2b:f7:ea:ca:78:46:d6: +# b8:91:fd:a6:0d:2b:1a:14:01:3e:80:f0:42:a0:95:07:5e:6d: +# cd:cc:4b:a4:45:8d:ab:12:e8:b3:de:5a:e5:a0:7c:e8:0f:22: +# 1d:5a:e9:59 +-----BEGIN CERTIFICATE----- +MIIDfDCCAmSgAwIBAgIQGKy1av1pthU6Y2yv2vrEoTANBgkqhkiG9w0BAQUFADBY +MQswCQYDVQQGEwJVUzEWMBQGA1UEChMNR2VvVHJ1c3QgSW5jLjExMC8GA1UEAxMo +R2VvVHJ1c3QgUHJpbWFyeSBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjEx +MjcwMDAwMDBaFw0zNjA3MTYyMzU5NTlaMFgxCzAJBgNVBAYTAlVTMRYwFAYDVQQK +Ew1HZW9UcnVzdCBJbmMuMTEwLwYDVQQDEyhHZW9UcnVzdCBQcmltYXJ5IENlcnRp +ZmljYXRpb24gQXV0aG9yaXR5MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKC +AQEAvrgVe//UfH1nrYNke8hCUy3f9oQIIGHWAVlqnEQRr+92/ZV+zmEwu3qDXwK9 +AWbK7hWNb6EwnL2hhZ6UOvNWiAAxz9juapYC2e0DjPt1befquFUWBRaa9OBesYjA +ZIVcFU2Ix7e64HXprQU9nceJSOC7KMgD4TCTZF5SwFlwIjVXiIrxlQqD17wxcwE0 +7e9GceBrAqg1cmuXm2bgyxx5X9gaBGgeRwLmnWDiNpcB3841kt++Z8dtd1k7j53W +kBWUvEI0EME5+bEnPn7WinXFsq+W06Lem+SYvn3h6YGttm/81w7a4DSwDRp35+MI +mO9Y+pyEtzavwt+s0vQQBnBxNQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4G +A1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQULNVQQZcVi/CPNmFbSvtr2ZnJM5IwDQYJ +KoZIhvcNAQEFBQADggEBAFpwfyzdtzRP9YZRqSa+S7iq8XEN3GHHoOo0Hnp3DwQ1 +6CePbJC/kRYkRj5KTs4rFtULUh38H2eiAkUxT87z+gOneZ1TatnaYzr4gNfTmeGl +4b7UVXGYNTq+k+qurUKykG/g/CFNNWMziUnWm07Kx+dOCQD32sfvmWKZd7aVIl6K +oKv0uHiYyjgZmclynnjNS6yvGaBzEi38wkG6gZHaFloxt/m0cYASSJlyc1pZU8Fj +UjPtp8nSOQJw+uCxQmYpqptR7TBUIhRf2asdweSU8Pj1K/fqynhG1riR/aYNKxoU +AT6A8EKglQdebc3MS6RFjasS6LPeWuWgfOgPIh1a6Vk= +-----END CERTIFICATE----- +# Go Daddy Class 2 Certification Authority.pem +# Certificate: +# Data: +# Version: 3 (0x2) +# Serial Number: 0 (0x0) +# Signature Algorithm: sha1WithRSAEncryption +# Issuer: C=US, O=The Go Daddy Group, Inc., OU=Go Daddy Class 2 Certification Authority +# Validity +# Not Before: Jun 29 17:06:20 2004 GMT +# Not After : Jun 29 17:06:20 2034 GMT +# Subject: C=US, O=The Go Daddy Group, Inc., OU=Go Daddy Class 2 Certification Authority +# Subject Public Key Info: +# Public Key Algorithm: rsaEncryption +# Public-Key: (2048 bit) +# Modulus: +# 00:de:9d:d7:ea:57:18:49:a1:5b:eb:d7:5f:48:86: +# ea:be:dd:ff:e4:ef:67:1c:f4:65:68:b3:57:71:a0: +# 5e:77:bb:ed:9b:49:e9:70:80:3d:56:18:63:08:6f: +# da:f2:cc:d0:3f:7f:02:54:22:54:10:d8:b2:81:d4: +# c0:75:3d:4b:7f:c7:77:c3:3e:78:ab:1a:03:b5:20: +# 6b:2f:6a:2b:b1:c5:88:7e:c4:bb:1e:b0:c1:d8:45: +# 27:6f:aa:37:58:f7:87:26:d7:d8:2d:f6:a9:17:b7: +# 1f:72:36:4e:a6:17:3f:65:98:92:db:2a:6e:5d:a2: +# fe:88:e0:0b:de:7f:e5:8d:15:e1:eb:cb:3a:d5:e2: +# 12:a2:13:2d:d8:8e:af:5f:12:3d:a0:08:05:08:b6: +# 5c:a5:65:38:04:45:99:1e:a3:60:60:74:c5:41:a5: +# 72:62:1b:62:c5:1f:6f:5f:1a:42:be:02:51:65:a8: +# ae:23:18:6a:fc:78:03:a9:4d:7f:80:c3:fa:ab:5a: +# fc:a1:40:a4:ca:19:16:fe:b2:c8:ef:5e:73:0d:ee: +# 77:bd:9a:f6:79:98:bc:b1:07:67:a2:15:0d:dd:a0: +# 58:c6:44:7b:0a:3e:62:28:5f:ba:41:07:53:58:cf: +# 11:7e:38:74:c5:f8:ff:b5:69:90:8f:84:74:ea:97: +# 1b:af +# Exponent: 3 (0x3) +# X509v3 extensions: +# X509v3 Subject Key Identifier: +# D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3 +# X509v3 Authority Key Identifier: +# keyid:D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3 +# DirName:/C=US/O=The Go Daddy Group, Inc./OU=Go Daddy Class 2 Certification Authority +# serial:00 +# +# X509v3 Basic Constraints: +# CA:TRUE +# Signature Algorithm: sha1WithRSAEncryption +# 32:4b:f3:b2:ca:3e:91:fc:12:c6:a1:07:8c:8e:77:a0:33:06: +# 14:5c:90:1e:18:f7:08:a6:3d:0a:19:f9:87:80:11:6e:69:e4: +# 96:17:30:ff:34:91:63:72:38:ee:cc:1c:01:a3:1d:94:28:a4: +# 31:f6:7a:c4:54:d7:f6:e5:31:58:03:a2:cc:ce:62:db:94:45: +# 73:b5:bf:45:c9:24:b5:d5:82:02:ad:23:79:69:8d:b8:b6:4d: +# ce:cf:4c:ca:33:23:e8:1c:88:aa:9d:8b:41:6e:16:c9:20:e5: +# 89:9e:cd:3b:da:70:f7:7e:99:26:20:14:54:25:ab:6e:73:85: +# e6:9b:21:9d:0a:6c:82:0e:a8:f8:c2:0c:fa:10:1e:6c:96:ef: +# 87:0d:c4:0f:61:8b:ad:ee:83:2b:95:f8:8e:92:84:72:39:eb: +# 20:ea:83:ed:83:cd:97:6e:08:bc:eb:4e:26:b6:73:2b:e4:d3: +# f6:4c:fe:26:71:e2:61:11:74:4a:ff:57:1a:87:0f:75:48:2e: +# cf:51:69:17:a0:02:12:61:95:d5:d1:40:b2:10:4c:ee:c4:ac: +# 10:43:a6:a5:9e:0a:d5:95:62:9a:0d:cf:88:82:c5:32:0c:e4: +# 2b:9f:45:e6:0d:9f:28:9c:b1:b9:2a:5a:57:ad:37:0f:af:1d: +# 7f:db:bd:9f +-----BEGIN CERTIFICATE----- +MIIEADCCAuigAwIBAgIBADANBgkqhkiG9w0BAQUFADBjMQswCQYDVQQGEwJVUzEh +MB8GA1UEChMYVGhlIEdvIERhZGR5IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBE +YWRkeSBDbGFzcyAyIENlcnRpZmljYXRpb24gQXV0aG9yaXR5MB4XDTA0MDYyOTE3 +MDYyMFoXDTM0MDYyOTE3MDYyMFowYzELMAkGA1UEBhMCVVMxITAfBgNVBAoTGFRo +ZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28gRGFkZHkgQ2xhc3Mg +MiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTCCASAwDQYJKoZIhvcNAQEBBQADggEN +ADCCAQgCggEBAN6d1+pXGEmhW+vXX0iG6r7d/+TvZxz0ZWizV3GgXne77ZtJ6XCA +PVYYYwhv2vLM0D9/AlQiVBDYsoHUwHU9S3/Hd8M+eKsaA7Ugay9qK7HFiH7Eux6w +wdhFJ2+qN1j3hybX2C32qRe3H3I2TqYXP2WYktsqbl2i/ojgC95/5Y0V4evLOtXi +EqITLdiOr18SPaAIBQi2XKVlOARFmR6jYGB0xUGlcmIbYsUfb18aQr4CUWWoriMY +avx4A6lNf4DD+qta/KFApMoZFv6yyO9ecw3ud72a9nmYvLEHZ6IVDd2gWMZEewo+ +YihfukEHU1jPEX44dMX4/7VpkI+EdOqXG68CAQOjgcAwgb0wHQYDVR0OBBYEFNLE +sNKR1EwRcbNhyz2h/t2oatTjMIGNBgNVHSMEgYUwgYKAFNLEsNKR1EwRcbNhyz2h +/t2oatTjoWekZTBjMQswCQYDVQQGEwJVUzEhMB8GA1UEChMYVGhlIEdvIERhZGR5 +IEdyb3VwLCBJbmMuMTEwLwYDVQQLEyhHbyBEYWRkeSBDbGFzcyAyIENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5ggEAMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQEFBQAD +ggEBADJL87LKPpH8EsahB4yOd6AzBhRckB4Y9wimPQoZ+YeAEW5p5JYXMP80kWNy +OO7MHAGjHZQopDH2esRU1/blMVgDoszOYtuURXO1v0XJJLXVggKtI3lpjbi2Tc7P +TMozI+gciKqdi0FuFskg5YmezTvacPd+mSYgFFQlq25zheabIZ0KbIIOqPjCDPoQ +HmyW74cNxA9hi63ugyuV+I6ShHI56yDqg+2DzZduCLzrTia2cyvk0/ZM/iZx4mER +dEr/VxqHD3VILs9RaRegAhJhldXRQLIQTO7ErBBDpqWeCtWVYpoNz4iCxTIM5Cuf +ReYNnyicsbkqWletNw+vHX/bvZ8= +-----END CERTIFICATE----- +# Go Daddy Root Certificate Authority - G2.pem +# Certificate: +# Data: +# Version: 3 (0x2) +# Serial Number: 0 (0x0) +# Signature Algorithm: sha256WithRSAEncryption +# Issuer: C=US, ST=Arizona, L=Scottsdale, O=GoDaddy.com, Inc., CN=Go Daddy Root Certificate Authority - G2 +# Validity +# Not Before: Sep 1 00:00:00 2009 GMT +# Not After : Dec 31 23:59:59 2037 GMT +# Subject: C=US, ST=Arizona, L=Scottsdale, O=GoDaddy.com, Inc., CN=Go Daddy Root Certificate Authority - G2 +# Subject Public Key Info: +# Public Key Algorithm: rsaEncryption +# Public-Key: (2048 bit) +# Modulus: +# 00:bf:71:62:08:f1:fa:59:34:f7:1b:c9:18:a3:f7: +# 80:49:58:e9:22:83:13:a6:c5:20:43:01:3b:84:f1: +# e6:85:49:9f:27:ea:f6:84:1b:4e:a0:b4:db:70:98: +# c7:32:01:b1:05:3e:07:4e:ee:f4:fa:4f:2f:59:30: +# 22:e7:ab:19:56:6b:e2:80:07:fc:f3:16:75:80:39: +# 51:7b:e5:f9:35:b6:74:4e:a9:8d:82:13:e4:b6:3f: +# a9:03:83:fa:a2:be:8a:15:6a:7f:de:0b:c3:b6:19: +# 14:05:ca:ea:c3:a8:04:94:3b:46:7c:32:0d:f3:00: +# 66:22:c8:8d:69:6d:36:8c:11:18:b7:d3:b2:1c:60: +# b4:38:fa:02:8c:ce:d3:dd:46:07:de:0a:3e:eb:5d: +# 7c:c8:7c:fb:b0:2b:53:a4:92:62:69:51:25:05:61: +# 1a:44:81:8c:2c:a9:43:96:23:df:ac:3a:81:9a:0e: +# 29:c5:1c:a9:e9:5d:1e:b6:9e:9e:30:0a:39:ce:f1: +# 88:80:fb:4b:5d:cc:32:ec:85:62:43:25:34:02:56: +# 27:01:91:b4:3b:70:2a:3f:6e:b1:e8:9c:88:01:7d: +# 9f:d4:f9:db:53:6d:60:9d:bf:2c:e7:58:ab:b8:5f: +# 46:fc:ce:c4:1b:03:3c:09:eb:49:31:5c:69:46:b3: +# e0:47 +# Exponent: 65537 (0x10001) +# X509v3 extensions: +# X509v3 Basic Constraints: critical +# CA:TRUE +# X509v3 Key Usage: critical +# Certificate Sign, CRL Sign +# X509v3 Subject Key Identifier: +# 3A:9A:85:07:10:67:28:B6:EF:F6:BD:05:41:6E:20:C1:94:DA:0F:DE +# Signature Algorithm: sha256WithRSAEncryption +# 99:db:5d:79:d5:f9:97:59:67:03:61:f1:7e:3b:06:31:75:2d: +# a1:20:8e:4f:65:87:b4:f7:a6:9c:bc:d8:e9:2f:d0:db:5a:ee: +# cf:74:8c:73:b4:38:42:da:05:7b:f8:02:75:b8:fd:a5:b1:d7: +# ae:f6:d7:de:13:cb:53:10:7e:8a:46:d1:97:fa:b7:2e:2b:11: +# ab:90:b0:27:80:f9:e8:9f:5a:e9:37:9f:ab:e4:df:6c:b3:85: +# 17:9d:3d:d9:24:4f:79:91:35:d6:5f:04:eb:80:83:ab:9a:02: +# 2d:b5:10:f4:d8:90:c7:04:73:40:ed:72:25:a0:a9:9f:ec:9e: +# ab:68:12:99:57:c6:8f:12:3a:09:a4:bd:44:fd:06:15:37:c1: +# 9b:e4:32:a3:ed:38:e8:d8:64:f3:2c:7e:14:fc:02:ea:9f:cd: +# ff:07:68:17:db:22:90:38:2d:7a:8d:d1:54:f1:69:e3:5f:33: +# ca:7a:3d:7b:0a:e3:ca:7f:5f:39:e5:e2:75:ba:c5:76:18:33: +# ce:2c:f0:2f:4c:ad:f7:b1:e7:ce:4f:a8:c4:9b:4a:54:06:c5: +# 7f:7d:d5:08:0f:e2:1c:fe:7e:17:b8:ac:5e:f6:d4:16:b2:43: +# 09:0c:4d:f6:a7:6b:b4:99:84:65:ca:7a:88:e2:e2:44:be:5c: +# f7:ea:1c:f5 +-----BEGIN CERTIFICATE----- +MIIDxTCCAq2gAwIBAgIBADANBgkqhkiG9w0BAQsFADCBgzELMAkGA1UEBhMCVVMx +EDAOBgNVBAgTB0FyaXpvbmExEzARBgNVBAcTClNjb3R0c2RhbGUxGjAYBgNVBAoT +EUdvRGFkZHkuY29tLCBJbmMuMTEwLwYDVQQDEyhHbyBEYWRkeSBSb290IENlcnRp +ZmljYXRlIEF1dGhvcml0eSAtIEcyMB4XDTA5MDkwMTAwMDAwMFoXDTM3MTIzMTIz +NTk1OVowgYMxCzAJBgNVBAYTAlVTMRAwDgYDVQQIEwdBcml6b25hMRMwEQYDVQQH +EwpTY290dHNkYWxlMRowGAYDVQQKExFHb0RhZGR5LmNvbSwgSW5jLjExMC8GA1UE +AxMoR28gRGFkZHkgUm9vdCBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkgLSBHMjCCASIw +DQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAL9xYgjx+lk09xvJGKP3gElY6SKD +E6bFIEMBO4Tx5oVJnyfq9oQbTqC023CYxzIBsQU+B07u9PpPL1kwIuerGVZr4oAH +/PMWdYA5UXvl+TW2dE6pjYIT5LY/qQOD+qK+ihVqf94Lw7YZFAXK6sOoBJQ7Rnwy +DfMAZiLIjWltNowRGLfTshxgtDj6AozO091GB94KPutdfMh8+7ArU6SSYmlRJQVh +GkSBjCypQ5Yj36w6gZoOKcUcqeldHraenjAKOc7xiID7S13MMuyFYkMlNAJWJwGR +tDtwKj9useiciAF9n9T521NtYJ2/LOdYq7hfRvzOxBsDPAnrSTFcaUaz4EcCAwEA +AaNCMEAwDwYDVR0TAQH/BAUwAwEB/zAOBgNVHQ8BAf8EBAMCAQYwHQYDVR0OBBYE +FDqahQcQZyi27/a9BUFuIMGU2g/eMA0GCSqGSIb3DQEBCwUAA4IBAQCZ21151fmX +WWcDYfF+OwYxdS2hII5PZYe096acvNjpL9DbWu7PdIxztDhC2gV7+AJ1uP2lsdeu +9tfeE8tTEH6KRtGX+rcuKxGrkLAngPnon1rpN5+r5N9ss4UXnT3ZJE95kTXWXwTr +gIOrmgIttRD02JDHBHNA7XIloKmf7J6raBKZV8aPEjoJpL1E/QYVN8Gb5DKj7Tjo +2GTzLH4U/ALqn83/B2gX2yKQOC16jdFU8WnjXzPKej17CuPKf1855eJ1usV2GDPO +LPAvTK33sefOT6jEm0pUBsV/fdUID+Ic/n4XuKxe9tQWskMJDE32p2u0mYRlynqI +4uJEvlz36hz1 +-----END CERTIFICATE----- +# Go Daddy Secure Certification Authority serialNumber=07969287.pem +# Certificate: +# Data: +# Version: 3 (0x2) +# Serial Number: 769 (0x301) +# Signature Algorithm: sha1WithRSAEncryption +# Issuer: C=US, O=The Go Daddy Group, Inc., OU=Go Daddy Class 2 Certification Authority +# Validity +# Not Before: Nov 16 01:54:37 2006 GMT +# Not After : Nov 16 01:54:37 2026 GMT +# Subject: C=US, ST=Arizona, L=Scottsdale, O=GoDaddy.com, Inc., OU=http://certificates.godaddy.com/repository, CN=Go Daddy Secure Certification Authority/serialNumber=07969287 +# Subject Public Key Info: +# Public Key Algorithm: rsaEncryption +# Public-Key: (2048 bit) +# Modulus: +# 00:c4:2d:d5:15:8c:9c:26:4c:ec:32:35:eb:5f:b8: +# 59:01:5a:a6:61:81:59:3b:70:63:ab:e3:dc:3d:c7: +# 2a:b8:c9:33:d3:79:e4:3a:ed:3c:30:23:84:8e:b3: +# 30:14:b6:b2:87:c3:3d:95:54:04:9e:df:99:dd:0b: +# 25:1e:21:de:65:29:7e:35:a8:a9:54:eb:f6:f7:32: +# 39:d4:26:55:95:ad:ef:fb:fe:58:86:d7:9e:f4:00: +# 8d:8c:2a:0c:bd:42:04:ce:a7:3f:04:f6:ee:80:f2: +# aa:ef:52:a1:69:66:da:be:1a:ad:5d:da:2c:66:ea: +# 1a:6b:bb:e5:1a:51:4a:00:2f:48:c7:98:75:d8:b9: +# 29:c8:ee:f8:66:6d:0a:9c:b3:f3:fc:78:7c:a2:f8: +# a3:f2:b5:c3:f3:b9:7a:91:c1:a7:e6:25:2e:9c:a8: +# ed:12:65:6e:6a:f6:12:44:53:70:30:95:c3:9c:2b: +# 58:2b:3d:08:74:4a:f2:be:51:b0:bf:87:d0:4c:27: +# 58:6b:b5:35:c5:9d:af:17:31:f8:0b:8f:ee:ad:81: +# 36:05:89:08:98:cf:3a:af:25:87:c0:49:ea:a7:fd: +# 67:f7:45:8e:97:cc:14:39:e2:36:85:b5:7e:1a:37: +# fd:16:f6:71:11:9a:74:30:16:fe:13:94:a3:3f:84: +# 0d:4f +# Exponent: 65537 (0x10001) +# X509v3 extensions: +# X509v3 Subject Key Identifier: +# FD:AC:61:32:93:6C:45:D6:E2:EE:85:5F:9A:BA:E7:76:99:68:CC:E7 +# X509v3 Authority Key Identifier: +# keyid:D2:C4:B0:D2:91:D4:4C:11:71:B3:61:CB:3D:A1:FE:DD:A8:6A:D4:E3 +# +# X509v3 Basic Constraints: critical +# CA:TRUE, pathlen:0 +# Authority Information Access: +# OCSP - URI:http://ocsp.godaddy.com +# +# X509v3 CRL Distribution Points: +# +# Full Name: +# URI:http://certificates.godaddy.com/repository/gdroot.crl +# +# X509v3 Certificate Policies: +# Policy: X509v3 Any Policy +# CPS: http://certificates.godaddy.com/repository +# +# X509v3 Key Usage: critical +# Certificate Sign, CRL Sign +# Signature Algorithm: sha1WithRSAEncryption +# d2:86:c0:ec:bd:f9:a1:b6:67:ee:66:0b:a2:06:3a:04:50:8e: +# 15:72:ac:4a:74:95:53:cb:37:cb:44:49:ef:07:90:6b:33:d9: +# 96:f0:94:56:a5:13:30:05:3c:85:32:21:7b:c9:c7:0a:a8:24: +# a4:90:de:46:d3:25:23:14:03:67:c2:10:d6:6f:0f:5d:7b:7a: +# cc:9f:c5:58:2a:c1:c4:9e:21:a8:5a:f3:ac:a4:46:f3:9e:e4: +# 63:cb:2f:90:a4:29:29:01:d9:72:2c:29:df:37:01:27:bc:4f: +# ee:68:d3:21:8f:c0:b3:e4:f5:09:ed:d2:10:aa:53:b4:be:f0: +# cc:59:0b:d6:3b:96:1c:95:24:49:df:ce:ec:fd:a7:48:91:14: +# 45:0e:3a:36:6f:da:45:b3:45:a2:41:c9:d4:d7:44:4e:3e:b9: +# 74:76:d5:a2:13:55:2c:c6:87:a3:b5:99:ac:06:84:87:7f:75: +# 06:fc:bf:14:4c:0e:cc:6e:c4:df:3d:b7:12:71:f4:e8:f1:51: +# 40:22:28:49:e0:1d:4b:87:a8:34:cc:06:a2:dd:12:5a:d1:86: +# 36:64:03:35:6f:6f:77:6e:eb:f2:85:50:98:5e:ab:03:53:ad: +# 91:23:63:1f:16:9c:cd:b9:b2:05:63:3a:e1:f4:68:1b:17:05: +# 35:95:53:ee +-----BEGIN CERTIFICATE----- +MIIE3jCCA8agAwIBAgICAwEwDQYJKoZIhvcNAQEFBQAwYzELMAkGA1UEBhMCVVMx +ITAfBgNVBAoTGFRoZSBHbyBEYWRkeSBHcm91cCwgSW5jLjExMC8GA1UECxMoR28g +RGFkZHkgQ2xhc3MgMiBDZXJ0aWZpY2F0aW9uIEF1dGhvcml0eTAeFw0wNjExMTYw +MTU0MzdaFw0yNjExMTYwMTU0MzdaMIHKMQswCQYDVQQGEwJVUzEQMA4GA1UECBMH +QXJpem9uYTETMBEGA1UEBxMKU2NvdHRzZGFsZTEaMBgGA1UEChMRR29EYWRkeS5j +b20sIEluYy4xMzAxBgNVBAsTKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5j +b20vcmVwb3NpdG9yeTEwMC4GA1UEAxMnR28gRGFkZHkgU2VjdXJlIENlcnRpZmlj +YXRpb24gQXV0aG9yaXR5MREwDwYDVQQFEwgwNzk2OTI4NzCCASIwDQYJKoZIhvcN +AQEBBQADggEPADCCAQoCggEBAMQt1RWMnCZM7DI161+4WQFapmGBWTtwY6vj3D3H +KrjJM9N55DrtPDAjhI6zMBS2sofDPZVUBJ7fmd0LJR4h3mUpfjWoqVTr9vcyOdQm +VZWt7/v+WIbXnvQAjYwqDL1CBM6nPwT27oDyqu9SoWlm2r4arV3aLGbqGmu75RpR +SgAvSMeYddi5Kcju+GZtCpyz8/x4fKL4o/K1w/O5epHBp+YlLpyo7RJlbmr2EkRT +cDCVw5wrWCs9CHRK8r5RsL+H0EwnWGu1NcWdrxcx+AuP7q2BNgWJCJjPOq8lh8BJ +6qf9Z/dFjpfMFDniNoW1fho3/Rb2cRGadDAW/hOUoz+EDU8CAwEAAaOCATIwggEu +MB0GA1UdDgQWBBT9rGEyk2xF1uLuhV+auud2mWjM5zAfBgNVHSMEGDAWgBTSxLDS +kdRMEXGzYcs9of7dqGrU4zASBgNVHRMBAf8ECDAGAQH/AgEAMDMGCCsGAQUFBwEB +BCcwJTAjBggrBgEFBQcwAYYXaHR0cDovL29jc3AuZ29kYWRkeS5jb20wRgYDVR0f +BD8wPTA7oDmgN4Y1aHR0cDovL2NlcnRpZmljYXRlcy5nb2RhZGR5LmNvbS9yZXBv +c2l0b3J5L2dkcm9vdC5jcmwwSwYDVR0gBEQwQjBABgRVHSAAMDgwNgYIKwYBBQUH +AgEWKmh0dHA6Ly9jZXJ0aWZpY2F0ZXMuZ29kYWRkeS5jb20vcmVwb3NpdG9yeTAO +BgNVHQ8BAf8EBAMCAQYwDQYJKoZIhvcNAQEFBQADggEBANKGwOy9+aG2Z+5mC6IG +OgRQjhVyrEp0lVPLN8tESe8HkGsz2ZbwlFalEzAFPIUyIXvJxwqoJKSQ3kbTJSMU +A2fCENZvD117esyfxVgqwcSeIaha86ykRvOe5GPLL5CkKSkB2XIsKd83ASe8T+5o +0yGPwLPk9Qnt0hCqU7S+8MxZC9Y7lhyVJEnfzuz9p0iRFEUOOjZv2kWzRaJBydTX +RE4+uXR21aITVSzGh6O1mawGhId/dQb8vxRMDsxuxN89txJx9OjxUUAiKEngHUuH +qDTMBqLdElrRhjZkAzVvb3du6/KFUJheqwNTrZEjYx8WnM25sgVjOuH0aBsXBTWV +U+4= +-----END CERTIFICATE----- +# Thawte Premium Server CA.pem +# Certificate: +# Data: +# Version: 3 (0x2) +# Serial Number: 1 (0x1) +# Signature Algorithm: md5WithRSAEncryption +# Issuer: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Premium Server CA/emailAddress=premium-server@thawte.com +# Validity +# Not Before: Aug 1 00:00:00 1996 GMT +# Not After : Dec 31 23:59:59 2020 GMT +# Subject: C=ZA, ST=Western Cape, L=Cape Town, O=Thawte Consulting cc, OU=Certification Services Division, CN=Thawte Premium Server CA/emailAddress=premium-server@thawte.com +# Subject Public Key Info: +# Public Key Algorithm: rsaEncryption +# Public-Key: (1024 bit) +# Modulus: +# 00:d2:36:36:6a:8b:d7:c2:5b:9e:da:81:41:62:8f: +# 38:ee:49:04:55:d6:d0:ef:1c:1b:95:16:47:ef:18: +# 48:35:3a:52:f4:2b:6a:06:8f:3b:2f:ea:56:e3:af: +# 86:8d:9e:17:f7:9e:b4:65:75:02:4d:ef:cb:09:a2: +# 21:51:d8:9b:d0:67:d0:ba:0d:92:06:14:73:d4:93: +# cb:97:2a:00:9c:5c:4e:0c:bc:fa:15:52:fc:f2:44: +# 6e:da:11:4a:6e:08:9f:2f:2d:e3:f9:aa:3a:86:73: +# b6:46:53:58:c8:89:05:bd:83:11:b8:73:3f:aa:07: +# 8d:f4:42:4d:e7:40:9d:1c:37 +# Exponent: 65537 (0x10001) +# X509v3 extensions: +# X509v3 Basic Constraints: critical +# CA:TRUE +# Signature Algorithm: md5WithRSAEncryption +# 26:48:2c:16:c2:58:fa:e8:16:74:0c:aa:aa:5f:54:3f:f2:d7: +# c9:78:60:5e:5e:6e:37:63:22:77:36:7e:b2:17:c4:34:b9:f5: +# 08:85:fc:c9:01:38:ff:4d:be:f2:16:42:43:e7:bb:5a:46:fb: +# c1:c6:11:1f:f1:4a:b0:28:46:c9:c3:c4:42:7d:bc:fa:ab:59: +# 6e:d5:b7:51:88:11:e3:a4:85:19:6b:82:4c:a4:0c:12:ad:e9: +# a4:ae:3f:f1:c3:49:65:9a:8c:c5:c8:3e:25:b7:94:99:bb:92: +# 32:71:07:f0:86:5e:ed:50:27:a6:0d:a6:23:f9:bb:cb:a6:07: +# 14:42 +-----BEGIN CERTIFICATE----- +MIIDJzCCApCgAwIBAgIBATANBgkqhkiG9w0BAQQFADCBzjELMAkGA1UEBhMCWkEx +FTATBgNVBAgTDFdlc3Rlcm4gQ2FwZTESMBAGA1UEBxMJQ2FwZSBUb3duMR0wGwYD +VQQKExRUaGF3dGUgQ29uc3VsdGluZyBjYzEoMCYGA1UECxMfQ2VydGlmaWNhdGlv +biBTZXJ2aWNlcyBEaXZpc2lvbjEhMB8GA1UEAxMYVGhhd3RlIFByZW1pdW0gU2Vy +dmVyIENBMSgwJgYJKoZIhvcNAQkBFhlwcmVtaXVtLXNlcnZlckB0aGF3dGUuY29t +MB4XDTk2MDgwMTAwMDAwMFoXDTIwMTIzMTIzNTk1OVowgc4xCzAJBgNVBAYTAlpB +MRUwEwYDVQQIEwxXZXN0ZXJuIENhcGUxEjAQBgNVBAcTCUNhcGUgVG93bjEdMBsG +A1UEChMUVGhhd3RlIENvbnN1bHRpbmcgY2MxKDAmBgNVBAsTH0NlcnRpZmljYXRp +b24gU2VydmljZXMgRGl2aXNpb24xITAfBgNVBAMTGFRoYXd0ZSBQcmVtaXVtIFNl +cnZlciBDQTEoMCYGCSqGSIb3DQEJARYZcHJlbWl1bS1zZXJ2ZXJAdGhhd3RlLmNv +bTCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEA0jY2aovXwlue2oFBYo847kkE +VdbQ7xwblRZH7xhINTpS9CtqBo87L+pW46+GjZ4X9560ZXUCTe/LCaIhUdib0GfQ +ug2SBhRz1JPLlyoAnFxODLz6FVL88kRu2hFKbgifLy3j+ao6hnO2RlNYyIkFvYMR +uHM/qgeN9EJN50CdHDcCAwEAAaMTMBEwDwYDVR0TAQH/BAUwAwEB/zANBgkqhkiG +9w0BAQQFAAOBgQAmSCwWwlj66BZ0DKqqX1Q/8tfJeGBeXm43YyJ3Nn6yF8Q0ufUI +hfzJATj/Tb7yFkJD57taRvvBxhEf8UqwKEbJw8RCfbz6q1lu1bdRiBHjpIUZa4JM +pAwSremkrj/xw0llmozFyD4lt5SZu5IycQfwhl7tUCemDaYj+bvLpgcUQg== +-----END CERTIFICATE----- +# Thawte Primary Root CA - G2.pem +# Certificate: +# Data: +# Version: 3 (0x2) +# Serial Number: +# 35:fc:26:5c:d9:84:4f:c9:3d:26:3d:57:9b:ae:d7:56 +# Signature Algorithm: ecdsa-with-SHA384 +# Issuer: C=US, O=thawte, Inc., OU=(c) 2007 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA - G2 +# Validity +# Not Before: Nov 5 00:00:00 2007 GMT +# Not After : Jan 18 23:59:59 2038 GMT +# Subject: C=US, O=thawte, Inc., OU=(c) 2007 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA - G2 +# Subject Public Key Info: +# Public Key Algorithm: id-ecPublicKey +# Public-Key: (384 bit) +# pub: +# 04:a2:d5:9c:82:7b:95:9d:f1:52:78:87:fe:8a:16: +# bf:05:e6:df:a3:02:4f:0d:07:c6:00:51:ba:0c:02: +# 52:2d:22:a4:42:39:c4:fe:8f:ea:c9:c1:be:d4:4d: +# ff:9f:7a:9e:e2:b1:7c:9a:ad:a7:86:09:73:87:d1: +# e7:9a:e3:7a:a5:aa:6e:fb:ba:b3:70:c0:67:88:a2: +# 35:d4:a3:9a:b1:fd:ad:c2:ef:31:fa:a8:b9:f3:fb: +# 08:c6:91:d1:fb:29:95 +# ASN1 OID: secp384r1 +# X509v3 extensions: +# X509v3 Basic Constraints: critical +# CA:TRUE +# X509v3 Key Usage: critical +# Certificate Sign, CRL Sign +# X509v3 Subject Key Identifier: +# 9A:D8:00:30:00:E7:6B:7F:85:18:EE:8B:B6:CE:8A:0C:F8:11:E1:BB +# Signature Algorithm: ecdsa-with-SHA384 +# 30:66:02:31:00:dd:f8:e0:57:47:5b:a7:e6:0a:c3:bd:f5:80: +# 8a:97:35:0d:1b:89:3c:54:86:77:28:ca:a1:f4:79:de:b5:e6: +# 38:b0:f0:65:70:8c:7f:02:54:c2:bf:ff:d8:a1:3e:d9:cf:02: +# 31:00:c4:8d:94:fc:dc:53:d2:dc:9d:78:16:1f:15:33:23:53: +# 52:e3:5a:31:5d:9d:ca:ae:bd:13:29:44:0d:27:5b:a8:e7:68: +# 9c:12:f7:58:3f:2e:72:02:57:a3:8f:a1:14:2e +-----BEGIN CERTIFICATE----- +MIICiDCCAg2gAwIBAgIQNfwmXNmET8k9Jj1Xm67XVjAKBggqhkjOPQQDAzCBhDEL +MAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjE4MDYGA1UECxMvKGMp +IDIwMDcgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAi +BgNVBAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMjAeFw0wNzExMDUwMDAw +MDBaFw0zODAxMTgyMzU5NTlaMIGEMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhh +d3RlLCBJbmMuMTgwNgYDVQQLEy8oYykgMjAwNyB0aGF3dGUsIEluYy4gLSBGb3Ig +YXV0aG9yaXplZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9v +dCBDQSAtIEcyMHYwEAYHKoZIzj0CAQYFK4EEACIDYgAEotWcgnuVnfFSeIf+iha/ +BebfowJPDQfGAFG6DAJSLSKkQjnE/o/qycG+1E3/n3qe4rF8mq2nhglzh9HnmuN6 +papu+7qzcMBniKI11KOasf2twu8x+qi58/sIxpHR+ymVo0IwQDAPBgNVHRMBAf8E +BTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNVHQ4EFgQUmtgAMADna3+FGO6Lts6K +DPgR4bswCgYIKoZIzj0EAwMDaQAwZgIxAN344FdHW6fmCsO99YCKlzUNG4k8VIZ3 +KMqh9HneteY4sPBlcIx/AlTCv//YoT7ZzwIxAMSNlPzcU9LcnXgWHxUzI1NS41ox +XZ3Krr0TKUQNJ1uo52icEvdYPy5yAlejj6EULg== +-----END CERTIFICATE----- +# Thawte Primary Root CA - G3.pem +# Certificate: +# Data: +# Version: 3 (0x2) +# Serial Number: +# 60:01:97:b7:46:a7:ea:b4:b4:9a:d6:4b:2f:f7:90:fb +# Signature Algorithm: sha256WithRSAEncryption +# Issuer: C=US, O=thawte, Inc., OU=Certification Services Division, OU=(c) 2008 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA - G3 +# Validity +# Not Before: Apr 2 00:00:00 2008 GMT +# Not After : Dec 1 23:59:59 2037 GMT +# Subject: C=US, O=thawte, Inc., OU=Certification Services Division, OU=(c) 2008 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA - G3 +# Subject Public Key Info: +# Public Key Algorithm: rsaEncryption +# Public-Key: (2048 bit) +# Modulus: +# 00:b2:bf:27:2c:fb:db:d8:5b:dd:78:7b:1b:9e:77: +# 66:81:cb:3e:bc:7c:ae:f3:a6:27:9a:34:a3:68:31: +# 71:38:33:62:e4:f3:71:66:79:b1:a9:65:a3:a5:8b: +# d5:8f:60:2d:3f:42:cc:aa:6b:32:c0:23:cb:2c:41: +# dd:e4:df:fc:61:9c:e2:73:b2:22:95:11:43:18:5f: +# c4:b6:1f:57:6c:0a:05:58:22:c8:36:4c:3a:7c:a5: +# d1:cf:86:af:88:a7:44:02:13:74:71:73:0a:42:59: +# 02:f8:1b:14:6b:42:df:6f:5f:ba:6b:82:a2:9d:5b: +# e7:4a:bd:1e:01:72:db:4b:74:e8:3b:7f:7f:7d:1f: +# 04:b4:26:9b:e0:b4:5a:ac:47:3d:55:b8:d7:b0:26: +# 52:28:01:31:40:66:d8:d9:24:bd:f6:2a:d8:ec:21: +# 49:5c:9b:f6:7a:e9:7f:55:35:7e:96:6b:8d:93:93: +# 27:cb:92:bb:ea:ac:40:c0:9f:c2:f8:80:cf:5d:f4: +# 5a:dc:ce:74:86:a6:3e:6c:0b:53:ca:bd:92:ce:19: +# 06:72:e6:0c:5c:38:69:c7:04:d6:bc:6c:ce:5b:f6: +# f7:68:9c:dc:25:15:48:88:a1:e9:a9:f8:98:9c:e0: +# f3:d5:31:28:61:11:6c:67:96:8d:39:99:cb:c2:45: +# 24:39 +# Exponent: 65537 (0x10001) +# X509v3 extensions: +# X509v3 Basic Constraints: critical +# CA:TRUE +# X509v3 Key Usage: critical +# Certificate Sign, CRL Sign +# X509v3 Subject Key Identifier: +# AD:6C:AA:94:60:9C:ED:E4:FF:FA:3E:0A:74:2B:63:03:F7:B6:59:BF +# Signature Algorithm: sha256WithRSAEncryption +# 1a:40:d8:95:65:ac:09:92:89:c6:39:f4:10:e5:a9:0e:66:53: +# 5d:78:de:fa:24:91:bb:e7:44:51:df:c6:16:34:0a:ef:6a:44: +# 51:ea:2b:07:8a:03:7a:c3:eb:3f:0a:2c:52:16:a0:2b:43:b9: +# 25:90:3f:70:a9:33:25:6d:45:1a:28:3b:27:cf:aa:c3:29:42: +# 1b:df:3b:4c:c0:33:34:5b:41:88:bf:6b:2b:65:af:28:ef:b2: +# f5:c3:aa:66:ce:7b:56:ee:b7:c8:cb:67:c1:c9:9c:1a:18:b8: +# c4:c3:49:03:f1:60:0e:50:cd:46:c5:f3:77:79:f7:b6:15:e0: +# 38:db:c7:2f:28:a0:0c:3f:77:26:74:d9:25:12:da:31:da:1a: +# 1e:dc:29:41:91:22:3c:69:a7:bb:02:f2:b6:5c:27:03:89:f4: +# 06:ea:9b:e4:72:82:e3:a1:09:c1:e9:00:19:d3:3e:d4:70:6b: +# ba:71:a6:aa:58:ae:f4:bb:e9:6c:b6:ef:87:cc:9b:bb:ff:39: +# e6:56:61:d3:0a:a7:c4:5c:4c:60:7b:05:77:26:7a:bf:d8:07: +# 52:2c:62:f7:70:63:d9:39:bc:6f:1c:c2:79:dc:76:29:af:ce: +# c5:2c:64:04:5e:88:36:6e:31:d4:40:1a:62:34:36:3f:35:01: +# ae:ac:63:a0 +-----BEGIN CERTIFICATE----- +MIIEKjCCAxKgAwIBAgIQYAGXt0an6rS0mtZLL/eQ+zANBgkqhkiG9w0BAQsFADCB +rjELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMf +Q2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIw +MDggdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxJDAiBgNV +BAMTG3RoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EgLSBHMzAeFw0wODA0MDIwMDAwMDBa +Fw0zNzEyMDEyMzU5NTlaMIGuMQswCQYDVQQGEwJVUzEVMBMGA1UEChMMdGhhd3Rl +LCBJbmMuMSgwJgYDVQQLEx9DZXJ0aWZpY2F0aW9uIFNlcnZpY2VzIERpdmlzaW9u +MTgwNgYDVQQLEy8oYykgMjAwOCB0aGF3dGUsIEluYy4gLSBGb3IgYXV0aG9yaXpl +ZCB1c2Ugb25seTEkMCIGA1UEAxMbdGhhd3RlIFByaW1hcnkgUm9vdCBDQSAtIEcz +MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAsr8nLPvb2FvdeHsbnndm +gcs+vHyu86YnmjSjaDFxODNi5PNxZnmxqWWjpYvVj2AtP0LMqmsywCPLLEHd5N/8 +YZzic7IilRFDGF/Eth9XbAoFWCLINkw6fKXRz4aviKdEAhN0cXMKQlkC+BsUa0Lf +b1+6a4KinVvnSr0eAXLbS3ToO39/fR8EtCab4LRarEc9VbjXsCZSKAExQGbY2SS9 +9irY7CFJXJv2eul/VTV+lmuNk5Mny5K76qxAwJ/C+IDPXfRa3M50hqY+bAtTyr2S +zhkGcuYMXDhpxwTWvGzOW/b3aJzcJRVIiKHpqfiYnODz1TEoYRFsZ5aNOZnLwkUk +OQIDAQABo0IwQDAPBgNVHRMBAf8EBTADAQH/MA4GA1UdDwEB/wQEAwIBBjAdBgNV +HQ4EFgQUrWyqlGCc7eT/+j4KdCtjA/e2Wb8wDQYJKoZIhvcNAQELBQADggEBABpA +2JVlrAmSicY59BDlqQ5mU1143vokkbvnRFHfxhY0Cu9qRFHqKweKA3rD6z8KLFIW +oCtDuSWQP3CpMyVtRRooOyfPqsMpQhvfO0zAMzRbQYi/aytlryjvsvXDqmbOe1bu +t8jLZ8HJnBoYuMTDSQPxYA5QzUbF83d597YV4Djbxy8ooAw/dyZ02SUS2jHaGh7c +KUGRIjxpp7sC8rZcJwOJ9Abqm+RyguOhCcHpABnTPtRwa7pxpqpYrvS76Wy274fM +m7v/OeZWYdMKp8RcTGB7BXcmer/YB1IsYvdwY9k5vG8cwnncdimvzsUsZAReiDZu +MdRAGmI0Nj81Aa6sY6A= +-----END CERTIFICATE----- +# Thawte Primary Root CA.pem +# Certificate: +# Data: +# Version: 3 (0x2) +# Serial Number: +# 34:4e:d5:57:20:d5:ed:ec:49:f4:2f:ce:37:db:2b:6d +# Signature Algorithm: sha1WithRSAEncryption +# Issuer: C=US, O=thawte, Inc., OU=Certification Services Division, OU=(c) 2006 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA +# Validity +# Not Before: Nov 17 00:00:00 2006 GMT +# Not After : Jul 16 23:59:59 2036 GMT +# Subject: C=US, O=thawte, Inc., OU=Certification Services Division, OU=(c) 2006 thawte, Inc. - For authorized use only, CN=thawte Primary Root CA +# Subject Public Key Info: +# Public Key Algorithm: rsaEncryption +# Public-Key: (2048 bit) +# Modulus: +# 00:ac:a0:f0:fb:80:59:d4:9c:c7:a4:cf:9d:a1:59: +# 73:09:10:45:0c:0d:2c:6e:68:f1:6c:5b:48:68:49: +# 59:37:fc:0b:33:19:c2:77:7f:cc:10:2d:95:34:1c: +# e6:eb:4d:09:a7:1c:d2:b8:c9:97:36:02:b7:89:d4: +# 24:5f:06:c0:cc:44:94:94:8d:02:62:6f:eb:5a:dd: +# 11:8d:28:9a:5c:84:90:10:7a:0d:bd:74:66:2f:6a: +# 38:a0:e2:d5:54:44:eb:1d:07:9f:07:ba:6f:ee:e9: +# fd:4e:0b:29:f5:3e:84:a0:01:f1:9c:ab:f8:1c:7e: +# 89:a4:e8:a1:d8:71:65:0d:a3:51:7b:ee:bc:d2:22: +# 60:0d:b9:5b:9d:df:ba:fc:51:5b:0b:af:98:b2:e9: +# 2e:e9:04:e8:62:87:de:2b:c8:d7:4e:c1:4c:64:1e: +# dd:cf:87:58:ba:4a:4f:ca:68:07:1d:1c:9d:4a:c6: +# d5:2f:91:cc:7c:71:72:1c:c5:c0:67:eb:32:fd:c9: +# 92:5c:94:da:85:c0:9b:bf:53:7d:2b:09:f4:8c:9d: +# 91:1f:97:6a:52:cb:de:09:36:a4:77:d8:7b:87:50: +# 44:d5:3e:6e:29:69:fb:39:49:26:1e:09:a5:80:7b: +# 40:2d:eb:e8:27:85:c9:fe:61:fd:7e:e6:7c:97:1d: +# d5:9d +# Exponent: 65537 (0x10001) +# X509v3 extensions: +# X509v3 Basic Constraints: critical +# CA:TRUE +# X509v3 Key Usage: critical +# Certificate Sign, CRL Sign +# X509v3 Subject Key Identifier: +# 7B:5B:45:CF:AF:CE:CB:7A:FD:31:92:1A:6A:B6:F3:46:EB:57:48:50 +# Signature Algorithm: sha1WithRSAEncryption +# 79:11:c0:4b:b3:91:b6:fc:f0:e9:67:d4:0d:6e:45:be:55:e8: +# 93:d2:ce:03:3f:ed:da:25:b0:1d:57:cb:1e:3a:76:a0:4c:ec: +# 50:76:e8:64:72:0c:a4:a9:f1:b8:8b:d6:d6:87:84:bb:32:e5: +# 41:11:c0:77:d9:b3:60:9d:eb:1b:d5:d1:6e:44:44:a9:a6:01: +# ec:55:62:1d:77:b8:5c:8e:48:49:7c:9c:3b:57:11:ac:ad:73: +# 37:8e:2f:78:5c:90:68:47:d9:60:60:e6:fc:07:3d:22:20:17: +# c4:f7:16:e9:c4:d8:72:f9:c8:73:7c:df:16:2f:15:a9:3e:fd: +# 6a:27:b6:a1:eb:5a:ba:98:1f:d5:e3:4d:64:0a:9d:13:c8:61: +# ba:f5:39:1c:87:ba:b8:bd:7b:22:7f:f6:fe:ac:40:79:e5:ac: +# 10:6f:3d:8f:1b:79:76:8b:c4:37:b3:21:18:84:e5:36:00:eb: +# 63:20:99:b9:e9:fe:33:04:bb:41:c8:c1:02:f9:44:63:20:9e: +# 81:ce:42:d3:d6:3f:2c:76:d3:63:9c:59:dd:8f:a6:e1:0e:a0: +# 2e:41:f7:2e:95:47:cf:bc:fd:33:f3:f6:0b:61:7e:7e:91:2b: +# 81:47:c2:27:30:ee:a7:10:5d:37:8f:5c:39:2b:e4:04:f0:7b: +# 8d:56:8c:68 +-----BEGIN CERTIFICATE----- +MIIEIDCCAwigAwIBAgIQNE7VVyDV7exJ9C/ON9srbTANBgkqhkiG9w0BAQUFADCB +qTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5jLjEoMCYGA1UECxMf +Q2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYGA1UECxMvKGMpIDIw +MDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNlIG9ubHkxHzAdBgNV +BAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwHhcNMDYxMTE3MDAwMDAwWhcNMzYw +NzE2MjM1OTU5WjCBqTELMAkGA1UEBhMCVVMxFTATBgNVBAoTDHRoYXd0ZSwgSW5j +LjEoMCYGA1UECxMfQ2VydGlmaWNhdGlvbiBTZXJ2aWNlcyBEaXZpc2lvbjE4MDYG +A1UECxMvKGMpIDIwMDYgdGhhd3RlLCBJbmMuIC0gRm9yIGF1dGhvcml6ZWQgdXNl +IG9ubHkxHzAdBgNVBAMTFnRoYXd0ZSBQcmltYXJ5IFJvb3QgQ0EwggEiMA0GCSqG +SIb3DQEBAQUAA4IBDwAwggEKAoIBAQCsoPD7gFnUnMekz52hWXMJEEUMDSxuaPFs +W0hoSVk3/AszGcJ3f8wQLZU0HObrTQmnHNK4yZc2AreJ1CRfBsDMRJSUjQJib+ta +3RGNKJpchJAQeg29dGYvajig4tVUROsdB58Hum/u6f1OCyn1PoSgAfGcq/gcfomk +6KHYcWUNo1F77rzSImANuVud37r8UVsLr5iy6S7pBOhih94ryNdOwUxkHt3Ph1i6 +Sk/KaAcdHJ1KxtUvkcx8cXIcxcBn6zL9yZJclNqFwJu/U30rCfSMnZEfl2pSy94J +NqR32HuHUETVPm4pafs5SSYeCaWAe0At6+gnhcn+Yf1+5nyXHdWdAgMBAAGjQjBA +MA8GA1UdEwEB/wQFMAMBAf8wDgYDVR0PAQH/BAQDAgEGMB0GA1UdDgQWBBR7W0XP +r87Lev0xkhpqtvNG61dIUDANBgkqhkiG9w0BAQUFAAOCAQEAeRHAS7ORtvzw6WfU +DW5FvlXok9LOAz/t2iWwHVfLHjp2oEzsUHboZHIMpKnxuIvW1oeEuzLlQRHAd9mz +YJ3rG9XRbkREqaYB7FViHXe4XI5ISXycO1cRrK1zN44veFyQaEfZYGDm/Ac9IiAX +xPcW6cTYcvnIc3zfFi8VqT79aie2oetaupgf1eNNZAqdE8hhuvU5HIe6uL17In/2 +/qxAeeWsEG89jxt5dovEN7MhGITlNgDrYyCZuen+MwS7QcjBAvlEYyCegc5C09Y/ +LHbTY5xZ3Y+m4Q6gLkH3LpVHz7z9M/P2C2F+fpErgUfCJzDupxBdN49cOSvkBPB7 +jVaMaA== +-----END CERTIFICATE----- diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/Gemfile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/Gemfile new file mode 100644 index 000000000..632c37e04 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/Gemfile @@ -0,0 +1,3 @@ +source :gemcutter + +gemspec diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/MIT-LICENSE b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/MIT-LICENSE new file mode 100644 index 000000000..36df84f05 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/MIT-LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2008 James Healy + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/README.markdown b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/README.markdown new file mode 100644 index 000000000..6cf3578c5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/README.markdown @@ -0,0 +1,149 @@ +# em-ftpd + +A mini-FTP server framework built on top of the EventMacine gem. By providing a +simple driver class that responds to a handful of methods you can have a +complete FTP server. + +The library is extracted from real world situations where an FTP interface was +required to sit in front of a non-filesystem persistence layer. + +Some sample use cases include persisting data to: + +* an Amazon S3 bucket +* a relational database +* redis +* memory + +For some examples that demonstrate redis and memory persistence, check the +examples/ directory. + +## Usage + +To boot an FTP server you will need to provide a driver that speaks to your +persistence layer. + +Create a config.rb file that loads the driver and then configures the server + + require 'my_fancy_driver' + + driver MyFancyDriver + user 'ftp' + group 'ftp' + +Run your server like so: + + em-ftpd config.rb + +## Config File + +Valid options for the config file are: + +* user [name of system user to run the process as] +* group [name of group to run the process as] +* daemonise [true/false] +* name [a string to include in the process description] +* pid_file [a path to save the pid to. Useful in conjunction with daemonise] +* port [the TCP port to bind to. Defaults to 21] +* driver [the class that connects to the persistance layer] +* driver_args [any arguments that need to be passed to the driver constructor] + +## The Driver Contract + +The driver MUST have the following methods. Each method MUST accept a block and +yield the appropriate value: + + authenticate(user, pass, &block) + - boolean indicating if the provided details are valid + + bytes(path, &block) + - an integer with the number of bytes in the file or nil if the file + doesn't exist + + change_dir(path, &block) + - a boolen indicating if the current user is permitted to change to the + requested path + + dir_contents(path, &block) + - an array of the contents of the requested path or nil if the dir + doesn't exist. Each entry in the array should be + EM::FTPD::DirectoryItem-ish + + delete_dir(path, &block) + - a boolean indicating if the directory was successfully deleted + + delete_file(path, &block) + - a boolean indicating if path was successfully deleted + + rename(from_path, to_path, &block) + - a boolean indicating if from_path was successfully renamed to to_path + + make_dir(path, &block) + - a boolean indicating if path was successfully created as a new directory + + get_file(path, &block) + - nil if the user isn't permitted to access that path + - an IOish (File, StringIO, IO, etc) object with data to send back to the + client + - a string with the file data to send to the client + - an array of strings to join with the standard FTP line break and send to + the client + +The driver MUST have one of the following methods. Each method MUST accept a +block and yield the appropriate value: + + put_file(path, tmp_file_path, &block) + - an integer indicating the number of bytes received or False if there + was an error + + put_file_streamed(path, datasocket, &block) + - an integer indicating the number of bytes received or False if there + was an error + +## Authors + +James Healy [http://www.yob.id.au](http://www.yob.id.au) +John Nunemaker +Elijah Miller + +## Warning + +FTP is an incredibly insecure protocol. Be careful about forcing users to authenticate +with a username or password that are important. + +## License + +This library is distributed under the terms of the MIT License. See the included file for +more detail. + +## Contributing + +All suggestions and patches welcome, preferably via a git repository I can pull from. +If this library proves useful to you, please let me know. + +## Further Reading + +There are a range of RFCs that together specify the FTP protocol. In chronological +order, the more useful ones are: + +- [http://tools.ietf.org/rfc/rfc959.txt](http://tools.ietf.org/rfc/rfc959.txt) +- [http://tools.ietf.org/rfc/rfc1123.txt](http://tools.ietf.org/rfc/rfc1123.txt) +- [http://tools.ietf.org/rfc/rfc2228.txt](http://tools.ietf.org/rfc/rfc2228.txt) +- [http://tools.ietf.org/rfc/rfc2389.txt](http://tools.ietf.org/rfc/rfc2389.txt) +- [http://tools.ietf.org/rfc/rfc2428.txt](http://tools.ietf.org/rfc/rfc2428.txt) +- [http://tools.ietf.org/rfc/rfc3659.txt](http://tools.ietf.org/rfc/rfc3659.txt) +- [http://tools.ietf.org/rfc/rfc4217.txt](http://tools.ietf.org/rfc/rfc4217.txt) + +For an english summary that's somewhat more legible than the RFCs, and provides +some commentary on what features are actually useful or relevant 24 years after +RFC959 was published: + +- [http://cr.yp.to/ftp.html](http://cr.yp.to/ftp.html) + +For a history lesson, check out Appendix III of RCF959. It lists the preceding +(obsolete) RFC documents that relate to file transfers, including the ye old +RFC114 from 1971, "A File Transfer Protocol" + +For more information on EventMacine, a library that (among other things) simplifies +writing applications that use sockets, check out their website. + +- [http://rubyeventmachine.com/](http://rubyeventmachine.com/) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/bin/em-ftpd b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/bin/em-ftpd new file mode 100755 index 000000000..6d0b25cbe --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/bin/em-ftpd @@ -0,0 +1,18 @@ +#!/usr/bin/ruby + +# Boot an FTP server +# +# Usage: +# +# em-ftpd config.rb + +require 'em-ftpd' + +config_file = ARGV.first + +if config_file && File.file?(config_file) + EM::FTPD::App.start(config_file) +else + $stderr.puts "USAGE: em-ftpd " + exit 1 +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/examples/fake.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/examples/fake.rb new file mode 100644 index 000000000..c23f54c20 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/examples/fake.rb @@ -0,0 +1,90 @@ +# coding: utf-8 + +# a super simple FTP server with hard coded auth details and only two files +# available for download. +# +# Usage: +# +# em-ftpd examples/fake.rb + +class FakeFTPDriver + FILE_ONE = "This is the first file available for download.\n\nBy James" + FILE_TWO = "This is the file number two.\n\n2009-03-21" + + def change_dir(path, &block) + yield path == "/" || path == "/files" + end + + def dir_contents(path, &block) + case path + when "/" then + yield [ dir_item("files"), file_item("one.txt", FILE_ONE.bytesize) ] + when "/files" then + yield [ file_item("two.txt", FILE_TWO.bytesize) ] + else + yield [] + end + end + + def authenticate(user, pass, &block) + yield user == "test" && pass == "1234" + end + + def bytes(path, &block) + yield case path + when "/one.txt" then FILE_ONE.size + when "/files/two.txt" then FILE_TWO.size + else + false + end + end + + def get_file(path, &block) + yield case path + when "/one.txt" then FILE_ONE + when "/files/two.txt" then FILE_TWO + else + false + end + end + + def put_file(path, data, &block) + yield false + end + + def delete_file(path, &block) + yield false + end + + def delete_dir(path, &block) + yield false + end + + def rename(from, to, &block) + yield false + end + + def make_dir(path, &block) + yield false + end + + private + + def dir_item(name) + EM::FTPD::DirectoryItem.new(:name => name, :directory => true, :size => 0) + end + + def file_item(name, bytes) + EM::FTPD::DirectoryItem.new(:name => name, :directory => false, :size => bytes) + end + +end + +# configure the server +driver FakeFTPDriver +#driver_args 1, 2, 3 +#user "ftp" +#group "ftp" +#daemonise false +#name "fakeftp" +#pid_file "/var/run/fakeftp.pid" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/examples/redis.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/examples/redis.rb new file mode 100644 index 000000000..7df4dd70f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/examples/redis.rb @@ -0,0 +1,121 @@ +# coding: utf-8 + +# an FTP server that uses redis for persistance. +# +# NOTE: This may not be working as I don't have redis installed +# to test it. Feel free to fix it and submit a patch +# +# Usage: +# +# em-ftpd examples/redis.rb + +class RedisFTPDriver + + def initialize(redis) + @redis = redis + end + + def change_dir(path, &block) + yield path == "/" || @redis.sismember(directory_key(File.dirname(path)), File.basename(path) + "/") + end + + def dir_contents(path, &block) + response = @redis.smembers(directory_key(path)) + + yield response.map do |key| + name, size = key.sub(/ftp:\//, '').sub(%r{/$}, '') + dir = key.match(%r{/$}) + EM::FPD::DirectoryItem.new( + :name => name, + :directory => dir, + :size => size + ) + end + end + + def authenticate(user, pass, &block) + yield true + end + + def get_file(path, &block) + yield @redis.get(file_data_key(path)) + end + + def put_file(path, data, &block) + @redis.set(file_data_key(path), data) + @redis.sadd(directory_key(File.dirname(path)), File.basename(path)) + yield + end + + def delete_file(path, &block) + @redis.del(file_data_key(path)) + @redis.srem(directory_key(File.dirname(path)), File.basename(path)) + yield true + end + + + def delete_dir(path, &block) + (@redis.keys(directory_key(path + "/*") + @redis.keys(file_data_key(path + "/*")))).each do |key| + @redis.del(key) + end + @redis.srem(directory_key(File.dirname(path), File.basename(path) + "/")) + yield true + end + + def rename(from, to, &block) + if @redis.sismember(directory_key(File.dirname(from)), File.basename(from)) + yield move_file(from, to) + elsif @redis.sismember(directory_key(File.dirname(from)), File.basename(from) + '/') + yield move_dir(from, to) + else + yield false + end + end + + def make_dir(path, &block) + @redis.sadd(directory_key(File.dirname(path)), File.basename(path) + "/") + yield true + end + + private + + def file_data_key(path) + "ftp:data:#{path}" + end + + def directory_key(path) + "ftp:dir:#{path}" + end + + def move_file(from, to) + @redis.rename(file_data_key(from), file_data_key(to)) + @redis.srem(directory_key(File.dirname(from)), File.basename(from)) + @redis.sadd(directory_key(File.dirname(to)), File.basename(to)) + end + + def move_dir(from, to) + if @redis.exists(directory_key(from)) + @redis.rename(directory_key(from), directory_key(to)) + end + @redis.srem(directory_key(File.dirname(from)), File.basename(from) + "/") + @redis.sadd(directory_key(File.dirname(to)), File.basename(to) + "/") + @redis.keys(directory_key(from + "/*")).each do |key| + new_key = directory_key(File.dirname(to)) + key.sub(directory_key(File.dirname(from)), '') + @redis.rename(key, new_key) + end + @redis.keys(file_data_key(from + "/*")).each do |key| + new_key = file_data_key(to) + key.sub(file_data_key(from), '/') + @redis.rename(key, new_key) + end + end + +end + +# configure the server +driver FakeFTPDriver +#driver_args 1, 2, 3 +#user "ftp" +#group "ftp" +#daemonise false +#name "fakeftp" +#pid_file "/var/run/fakeftp.pid" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd.rb new file mode 100644 index 000000000..db7a1d73a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd.rb @@ -0,0 +1,12 @@ +require 'eventmachine' + +require 'em-ftpd/authentication' +require 'em-ftpd/directories' +require 'em-ftpd/files' +require 'em-ftpd/directory_item' +require 'em-ftpd/server' +require 'em-ftpd/base_socket' +require 'em-ftpd/passive_socket' +require 'em-ftpd/active_socket' +require 'em-ftpd/configurator' +require 'em-ftpd/app' diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/active_socket.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/active_socket.rb new file mode 100644 index 000000000..bdbd91dba --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/active_socket.rb @@ -0,0 +1,14 @@ +module EM::FTPD + # An eventmachine module for connecting to a remote + # port and downloading a file + # + class ActiveSocket < EventMachine::Connection + include EM::Deferrable + include BaseSocket + + def self.open(host, port) + EventMachine.connect(host, port, self) + end + + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/app.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/app.rb new file mode 100644 index 000000000..320436109 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/app.rb @@ -0,0 +1,88 @@ +# coding: utf-8 + +require 'singleton' + +module EM::FTPD + + class App + include Singleton + + def daemonise!(config) + return unless config.daemonise + + ## close unneeded descriptors, + $stdin.reopen("/dev/null") + $stdout.reopen("/dev/null","w") + $stderr.reopen("/dev/null","w") + + ## drop into the background. + pid = fork + if pid + ## parent: save pid of child, then exit + if config.pid_file + File.open(config.pid_file, "w") { |io| io.write pid } + end + exit! + end + end + + def self.start(config_path) + self.instance.start(config_path) + end + + def start(config_path) + config_data = File.read(config_path) + config = EM::FTPD::Configurator.new + config.instance_eval(config_data) + config.check! + update_procline(config.name) + + EventMachine.epoll + + EventMachine::run do + puts "Starting ftp server on 0.0.0.0:#{config.port}" + EventMachine::start_server("0.0.0.0", config.port, EM::FTPD::Server, config.driver, *config.driver_args) + + daemonise!(config) + change_gid(config.gid) + change_uid(config.uid) + setup_signal_handlers + end + end + + private + + def update_procline(name) + if name + $0 = "em-ftp [#{name}]" + else + $0 = "em-ftp" + end + end + + def change_gid(gid) + if gid && Process.gid == 0 + Process.gid = gid + end + end + + def change_uid(uid) + if uid && Process.euid == 0 + Process::Sys.setuid(uid) + end + end + + def setup_signal_handlers + trap('QUIT') do + EM.stop + end + trap('TERM') do + EM.stop + end + trap('INT') do + EM.stop + end + end + + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/authentication.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/authentication.rb new file mode 100644 index 000000000..52645d3e6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/authentication.rb @@ -0,0 +1,48 @@ +module EM::FTPD + module Authentication + + def initialize + @user = nil + @requested_user = nil + super + end + + def logged_in? + @user.nil? ? false : true + end + + # handle the USER FTP command. This is a user attempting to login. + # we simply store the requested user name as an instance variable + # and wait for the password to be submitted before doing anything + def cmd_user(param) + send_param_required and return if param.nil? + send_response("500 Already logged in") and return unless @user.nil? + @requested_user = param + send_response "331 OK, password required" + end + + # handle the PASS FTP command. This is the second stage of a user logging in + def cmd_pass(param) + send_response "202 User already logged in" and return unless @user.nil? + send_param_required and return if param.nil? + send_response "530 password with no username" and return if @requested_user.nil? + + # return an error message if: + # - the specified username isn't in our system + # - the password is wrong + + @driver.authenticate(@requested_user, param) do |result| + if result + @name_prefix = "/" + @user = @requested_user + @requested_user = nil + send_response "230 OK, password correct" + else + @user = nil + send_response "530 incorrect login. not logged in." + end + end + end + + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/base_socket.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/base_socket.rb new file mode 100644 index 000000000..549acad40 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/base_socket.rb @@ -0,0 +1,47 @@ +module BaseSocket + + attr_reader :aborted + + def initialize + @on_stream = nil + @aborted = false + end + + def on_stream &blk + @on_stream = blk if block_given? + unless data.empty? + @on_stream.call(data) # send all data that was collected before the stream hanlder was set + @data = "" + end + @on_stream + end + + def data + @data ||= "" + end + + def receive_data(chunk) + if @on_stream + @on_stream.call(chunk) + else + data << chunk + end + end + + def unbind + if @aborted + fail + else + if @on_stream + succeed + else + succeed data + end + end + end + + def abort + @aborted = true + close_connection_after_writing + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/configurator.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/configurator.rb new file mode 100644 index 000000000..65230ae26 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/configurator.rb @@ -0,0 +1,120 @@ +# coding: utf-8 + +module EM::FTPD + + class Configurator + + def initialize + @user = nil + @group = nil + @daemonise = false + @name = nil + @pid_file = nil + @port = 21 + + @driver = nil + @driver_args = [] + end + + def user(val = nil) + if val + @user = val.to_s + else + @user + end + end + + def uid + return nil if @user.nil? + + begin + detail = Etc.getpwnam(@user) + return detail.uid + rescue + $stderr.puts "user must be nil or a real account" if detail.nil? + end + end + + def group(val = nil) + if val + @group = val.to_s + else + @group + end + end + + def gid + return nil if @group.nil? + + begin + detail = Etc.getpwnam(@group) + return detail.gid + rescue + $stderr.puts "group must be nil or a real group" if detail.nil? + end + end + + + def daemonise(val = nil) + if val + @daemonise = val + else + @daemonise + end + end + + def driver(klass = nil) + if klass + @driver = klass + else + @driver + end + end + + def driver_args(*args) + if args.empty? + @driver_args + else + @driver_args = args + end + end + + def name(val = nil) + if val + @name = val.to_s + else + @name + end + end + + def pid_file(val = nil) + if val + @pid_file = val.to_s + else + @pid_file + end + end + + def port(val = nil) + if val + @port = val.to_i + else + @port + end + end + + def check! + if @driver.nil? + die("driver MUST be specified in the config file") + end + end + + private + + def die(msg) + $stderr.puts msg + exit 1 + end + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/directories.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/directories.rb new file mode 100644 index 000000000..806b9cb95 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/directories.rb @@ -0,0 +1,110 @@ +module EM::FTPD + module Directories + # go up a directory, really just an alias + def cmd_cdup(param) + send_unauthorised and return unless logged_in? + cmd_cwd("..") + end + + # As per RFC1123, XCUP is a synonym for CDUP + alias cmd_xcup cmd_cdup + + + # change directory + def cmd_cwd(param) + send_unauthorised and return unless logged_in? + path = build_path(param) + + @driver.change_dir(path) do |result| + if result + @name_prefix = path + send_response "250 Directory changed to #{path}" + else + send_permission_denied + end + end + end + + # As per RFC1123, XCWD is a synonym for CWD + alias cmd_xcwd cmd_cwd + + # make directory + def cmd_mkd(param) + send_unauthorised and return unless logged_in? + send_param_required and return if param.nil? + + @driver.make_dir(build_path(param)) do |result| + if result + send_response "257 Directory created" + else + send_action_not_taken + end + end + end + + # return a listing of the current directory, one per line, each line + # separated by the standard FTP EOL sequence. The listing is returned + # to the client over a data socket. + # + def cmd_nlst(param) + send_unauthorised and return unless logged_in? + send_response "150 Opening ASCII mode data connection for file list" + + @driver.dir_contents(build_path(param)) do |files| + send_outofband_data(files.map(&:name)) + end + end + + + def default_files(dir) + [ + DirectoryItem.new(:name => '.', :permissions => 'rwxrwxrwx', :directory => true), + DirectoryItem.new(:name => '..', :permissions => 'rwxrwxrwx', :directory => true), + ] + end + + # return a detailed list of files and directories + def cmd_list(param) + send_unauthorised and return unless logged_in? + send_response "150 Opening ASCII mode data connection for file list" + + param = '' if param.to_s == '-a' + + @driver.dir_contents(build_path(param)) do |files| + now = Time.now + lines = files.map { |item| + sizestr = (item.size || 0).to_s.rjust(12) + "#{item.directory ? 'd' : '-'}#{item.permissions || 'rwxrwxrwx'} 1 #{item.owner || 'owner'} #{item.group || 'group'} #{sizestr} #{(item.time || now).strftime("%b %d %H:%M")} #{item.name}" + } + send_outofband_data(lines) + end + end + + # return the current directory + def cmd_pwd(param) + send_unauthorised and return unless logged_in? + send_response "257 \"#{@name_prefix}\" is the current directory" + end + + # As per RFC1123, XPWD is a synonym for PWD + alias cmd_xpwd cmd_pwd + + # delete a directory + def cmd_rmd(param) + send_unauthorised and return unless logged_in? + send_param_required and return if param.nil? + + @driver.delete_dir(build_path(param)) do |result| + if result + send_response "250 Directory deleted." + else + send_action_not_taken + end + end + end + + # As per RFC1123, XRMD is a synonym for RMD + alias cmd_xrmd cmd_rmd + + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/directory_item.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/directory_item.rb new file mode 100644 index 000000000..b3ba81249 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/directory_item.rb @@ -0,0 +1,12 @@ +module EM::FTPD + class DirectoryItem + ATTRS = [:name, :owner, :group, :size, :time, :permissions, :directory] + attr_accessor(*ATTRS) + + def initialize(options) + options.each do |attr, value| + self.send("#{attr}=", value) + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/files.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/files.rb new file mode 100644 index 000000000..c7e6463ff --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/files.rb @@ -0,0 +1,141 @@ +require 'tempfile' + +module EM::FTPD + module Files + + # delete a file + def cmd_dele(param) + send_unauthorised and return unless logged_in? + send_param_required and return if param.nil? + + path = build_path(param) + + @driver.delete_file(path) do |result| + if result + send_response "250 File deleted" + else + send_action_not_taken + end + end + end + + # resume downloads + def cmd_rest(param) + send_response "500 Feature not implemented" + end + + # send a file to the client + def cmd_retr(param) + send_unauthorised and return unless logged_in? + send_param_required and return if param.nil? + + path = build_path(param) + + @driver.get_file(path) do |data| + if data + send_response "150 Data transfer starting #{data.size} bytes" + send_outofband_data(data) + else + send_response "551 file not available" + end + end + end + + # rename a file + def cmd_rnfr(param) + send_unauthorised and return unless logged_in? + send_param_required and return if param.nil? + + @from_filename = build_path(param) + send_response "350 Requested file action pending further information." + end + + # rename a file + def cmd_rnto(param) + send_unauthorised and return unless logged_in? + send_param_required and return if param.nil? + + @driver.rename(@from_filename, build_path(param)) do |result| + if result + send_response "250 File renamed." + else + send_action_not_taken + end + end + end + + # return the size of a file in bytes + def cmd_size(param) + send_unauthorised and return unless logged_in? + send_param_required and return if param.nil? + + @driver.bytes(build_path(param)) do |bytes| + if bytes + send_response "213 #{bytes}" + else + send_response "450 file not available" + end + end + end + + # save a file from a client + def cmd_stor(param) + send_unauthorised and return unless logged_in? + send_param_required and return if param.nil? + + path = build_path(param) + + if @driver.respond_to?(:put_file_streamed) + cmd_stor_streamed(path) + elsif @driver.respond_to?(:put_file) + cmd_stor_tempfile(path) + else + raise "driver MUST respond to put_file OR put_file_streamed" + end + end + + def cmd_stor_streamed(target_path) + wait_for_datasocket do |datasocket| + if datasocket + send_response "150 Data transfer starting" + @driver.put_file_streamed(target_path, datasocket) do |bytes| + if bytes + send_response "200 OK, received #{bytes} bytes" + else + send_action_not_taken + end + end + else + send_response "425 Error establishing connection" + end + end + end + + def cmd_stor_tempfile(target_path) + tmpfile = Tempfile.new("em-ftp") + + wait_for_datasocket do |datasocket| + datasocket.on_stream { |chunk| + tmpfile.write chunk + } + send_response "150 Data transfer starting" + datasocket.callback { + puts "data transfer finished" + tmpfile.flush + @driver.put_file(target_path, tmpfile.path) do |bytes| + if bytes + send_response "200 OK, received #{bytes} bytes" + else + send_action_not_taken + end + end + tmpfile.unlink + } + datasocket.errback { + tmpfile.unlink + } + end + end + + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/passive_socket.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/passive_socket.rb new file mode 100644 index 000000000..a8f8b77ea --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/passive_socket.rb @@ -0,0 +1,30 @@ +module EM::FTPD + + # An eventmachine module for opening a socket for the client to connect + # to and send a file + # + class PassiveSocket < EventMachine::Connection + include EM::Deferrable + include BaseSocket + + + def self.start(host, control_server) + EventMachine.start_server(host, 0, self) do |conn| + control_server.datasocket = conn + end + end + + # stop the server with signature "sig" + def self.stop(sig) + EventMachine.stop_server(sig) + end + + # return the port the server with signature "sig" is listening on + # + def self.get_port(sig) + Socket.unpack_sockaddr_in( EM.get_sockname( sig ) ).first + end + + + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/server.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/server.rb new file mode 100644 index 000000000..3a65b7d8b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/em-ftpd-0.0.1/lib/em-ftpd/server.rb @@ -0,0 +1,343 @@ +require 'socket' +require 'stringio' + +require 'eventmachine' +require 'em/protocols/line_protocol' + +module EM::FTPD + class Server < EM::Connection + + LBRK = "\r\n" + + include EM::Protocols::LineProtocol + include Authentication + include Directories + include Files + + COMMANDS = %w[quit type user retr stor port cdup cwd dele rmd pwd list size + syst mkd pass xcup xpwd xcwd xrmd rest allo nlst pasv help + noop mode rnfr rnto stru] + + attr_reader :root, :name_prefix + attr_accessor :datasocket + + def initialize(driver, *args) + if driver.is_a?(Class) && args.empty? + @driver = driver.new + elsif driver.is_a?(Class) + @driver = driver.new *args + else + @driver = driver + end + @datasocket = nil + @listen_sig = nil + super() + end + + def post_init + @mode = :binary + @name_prefix = "/" + + send_response "220 FTP server (em-ftpd) ready" + end + + def receive_line(str) + cmd, param = parse_request(str) + + # if the command is contained in the whitelist, and there is a method + # to handle it, call it. Otherwise send an appropriate response to the + # client + if COMMANDS.include?(cmd) && self.respond_to?("cmd_#{cmd}".to_sym, true) + begin + self.__send__("cmd_#{cmd}".to_sym, param) + rescue Exception => err + puts "#{err.class}: #{err}" + puts err.backtrace.join("\n") + end + else + send_response "500 Sorry, I don't understand #{cmd.upcase}" + end + end + + private + + def build_path(filename = nil) + if filename && filename[0,1] == "/" + path = File.expand_path(filename) + elsif filename && filename != '-a' + path = File.expand_path("#{@name_prefix}/#{filename}") + else + path = File.expand_path(@name_prefix) + end + path.gsub(/\/+/,"/") + end + + # split a client's request into command and parameter components + def parse_request(data) + data.strip! + space = data.index(" ") + if space + cmd = data[0, space] + param = data[space+1, data.length - space] + param = nil if param.strip.size == 0 + else + cmd = data + param = nil + end + + [cmd.downcase, param] + end + + def close_datasocket + if @datasocket + @datasocket.close_connection_after_writing + @datasocket = nil + end + + # stop listening for data socket connections, we have one + if @listen_sig + PassiveSocket.stop(@listen_sig) + @listen_sig = nil + end + end + + def cmd_allo(param) + send_response "202 Obsolete" + end + + # handle the HELP FTP command by sending a list of available commands. + def cmd_help(param) + send_response "214- The following commands are recognized." + commands = COMMANDS + str = "" + commands.sort.each_slice(3) { |slice| + str += " " + slice.join("\t\t") + LBRK + } + send_response str, true + send_response "214 End of list." + end + + # the original FTP spec had various options for hosts to negotiate how data + # would be sent over the data socket, In reality these days (S)tream mode + # is all that is used for the mode - data is just streamed down the data + # socket unchanged. + # + def cmd_mode(param) + send_unauthorised and return unless logged_in? + send_param_required and return if param.nil? + if param.upcase.eql?("S") + send_response "200 OK" + else + send_response "504 MODE is an obsolete command" + end + end + + # handle the NOOP FTP command. This is essentially a ping from the client + # so we just respond with an empty 200 message. + def cmd_noop(param) + send_response "200" + end + + # Passive FTP. At the clients request, listen on a port for an incoming + # data connection. The listening socket is opened on a random port, so + # the host and port is sent back to the client on the control socket. + def cmd_pasv(param) + send_unauthorised and return unless logged_in? + + # close any existing data socket + close_datasocket + + # grab the host/address the current connection is + # operating on + host = Socket.unpack_sockaddr_in( self.get_sockname ).last + + # open a listening socket on the appropriate host + # and on a random port + @listen_sig = PassiveSocket.start(host, self) + port = PassiveSocket.get_port(@listen_sig) + + # let the client know where to connect + p1 = (port / 256).to_i + p2 = port % 256 + + send_response "227 Entering Passive Mode (" + host.split(".").join(",") + ",#{p1},#{p2})" + end + + # Active FTP. An alternative to Passive FTP. The client has a listening socket + # open, waiting for us to connect and establish a data socket. Attempt to + # open a connection to the host and port they specify and save the connection, + # ready for either end to send something down it. + def cmd_port(param) + send_unauthorised and return unless logged_in? + send_param_required and return if param.nil? + + nums = param.split(',') + port = nums[4].to_i * 256 + nums[5].to_i + host = nums[0..3].join('.') + close_datasocket + + puts "connecting to client #{host} on #{port}" + @datasocket = ActiveSocket.open(host, port) + + puts "Opened active connection at #{host}:#{port}" + send_response "200 Connection established (#{port})" + rescue + puts "Error opening data connection to #{host}:#{port}" + send_response "425 Data connection failed" + end + + # handle the QUIT FTP command by closing the connection + def cmd_quit(param) + send_response "221 Bye" + close_datasocket + close_connection_after_writing + end + + + # like the MODE and TYPE commands, stru[cture] dates back to a time when the FTP + # protocol was more aware of the content of the files it was transferring, and + # would sometimes be expected to translate things like EOL markers on the fly. + # + # These days files are sent unmodified, and F(ile) mode is the only one we + # really need to support. + def cmd_stru(param) + send_param_required and return if param.nil? + send_unauthorised and return unless logged_in? + if param.upcase.eql?("F") + send_response "200 OK" + else + send_response "504 STRU is an obsolete command" + end + end + + # return the name of the server + def cmd_syst(param) + send_unauthorised and return unless logged_in? + send_response "215 UNIX Type: L8" + end + + # like the MODE and STRU commands, TYPE dates back to a time when the FTP + # protocol was more aware of the content of the files it was transferring, and + # would sometimes be expected to translate things like EOL markers on the fly. + # + # Valid options were A(SCII), I(mage), E(BCDIC) or LN (for local type). Since + # we plan to just accept bytes from the client unchanged, I think Image mode is + # adequate. The RFC requires we accept ASCII mode however, so accept it, but + # ignore it. + def cmd_type(param) + send_unauthorised and return unless logged_in? + send_param_required and return if param.nil? + if param.upcase.eql?("A") + send_response "200 Type set to ASCII" + elsif param.upcase.eql?("I") + send_response "200 Type set to binary" + else + send_response "500 Invalid type" + end + end + + # send data to the client across the data socket. + # + # The data socket is NOT guaranteed to be setup by the time this method runs. + # If it isn't ready yet, exit the method and try again on the next reactor + # tick. This is particularly likely with some clients that operate in passive + # mode. They get a message on the control port with the data port details, so + # they start up a new data connection AND send they command that will use it + # in close succession. + # + # The data port setup needs to complete a TCP handshake before it will be + # ready to use, so it may take a few RTTs after the command is received at + # the server before the data socket is ready. + # + def send_outofband_data(data) + wait_for_datasocket do |datasocket| + if datasocket.nil? + send_response "425 Error establishing connection" + return + end + + if data.is_a?(Array) + data = data.join(LBRK) << LBRK + end + data = StringIO.new(data) if data.kind_of?(String) + + begin + bytes = 0 + data.each do |line| + datasocket.send_data(line) + bytes += line.bytesize + end + send_response "226 Closing data connection, sent #{bytes} bytes" + ensure + close_datasocket + data.close if data.respond_to?(:close) + end + end + end + + # waits for the data socket to be established + def wait_for_datasocket(interval = 0.1, &block) + if @datasocket.nil? && interval < 25 + if EM.reactor_running? + EventMachine.add_timer(interval) { wait_for_datasocket(interval * 2, &block) } + else + sleep interval + wait_for_datasocket(interval * 2, &block) + end + return + end + yield @datasocket + end + + # receive a file data from the client across the data socket. + # + # The data socket is NOT guaranteed to be setup by the time this method runs. + # If this happens, exit the method early and try again later. See the method + # comments to send_outofband_data for further explanation. + # + def receive_outofband_data(&block) + wait_for_datasocket do |datasocket| + if datasocket.nil? + send_response "425 Error establishing connection" + yield false + return + end + + # let the client know we're ready to start + send_response "150 Data transfer starting" + + datasocket.callback do |data| + block.call(data) + end + end + end + + # all responses from an FTP server end with \r\n, so wrap the + # send_data callback + def send_response(msg, no_linebreak = false) + msg += LBRK unless no_linebreak + send_data msg + end + + def send_param_required + send_response "553 action aborted, required param missing" + end + + def send_permission_denied + send_response "550 Permission denied" + end + + def send_action_not_taken + send_response "550 Action not taken" + end + + def send_illegal_params + send_response "553 action aborted, illegal params" + end + + def send_unauthorised + send_response "530 Not logged in" + end + + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/.gitignore b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/.gitignore new file mode 100644 index 000000000..d741ebc92 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/.gitignore @@ -0,0 +1,21 @@ +pkg +rdoc +Makefile + +*.bundle +*.dll +*.so +*.jar +*.class +*.o +*.log +*.def +*.pdb +*.dSYM +java/src/.project +*.rbc +Gemfile.lock + +.yardoc/* +doc/* + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/.yardopts b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/.yardopts new file mode 100644 index 000000000..8eade9edf --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/.yardopts @@ -0,0 +1,7 @@ +--no-private +--protected +--markup="markdown" lib/**/*.rb +--main README.md +--exclude jeventmachine --exclude pure_ruby +- +docs/*.md \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/GNU b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/GNU new file mode 100644 index 000000000..3b70c5be5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/GNU @@ -0,0 +1,281 @@ +. + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your + freedom to share and change it. By contrast, the GNU General Public + License is intended to guarantee your freedom to share and change free + software--to make sure the software is free for all its users. This + General Public License applies to most of the Free Software + Foundation's software and to any other program whose authors commit to + using it. (Some other Free Software Foundation software is covered by + the GNU Lesser General Public License instead.) You can apply it to + your programs, too. + + When we speak of free software, we are referring to freedom, not + price. Our General Public Licenses are designed to make sure that you + have the freedom to distribute copies of free software (and charge for + this service if you wish), that you receive source code or can get it + if you want it, that you can change the software or use pieces of it + in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid + anyone to deny you these rights or to ask you to surrender the rights. + These restrictions translate to certain responsibilities for you if you + distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether + gratis or for a fee, you must give the recipients all the rights that + you have. You must make sure that they, too, receive or can get the + source code. And you must show them these terms so they know their + rights. + + We protect your rights with two steps: (1) copyright the software, and + (2) offer you this license which gives you legal permission to copy, + distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain + that everyone understands that there is no warranty for this free + software. If the software is modified by someone else and passed on, we + want its recipients to know that what they have is not the original, so + that any problems introduced by others will not reflect on the original + authors' reputations. + + Finally, any free program is threatened constantly by software + patents. We wish to avoid the danger that redistributors of a free + program will individually obtain patent licenses, in effect making the + program proprietary. To prevent this, we have made it clear that any + patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and + modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains + a notice placed by the copyright holder saying it may be distributed + under the terms of this General Public License. The "Program", below, + refers to any such program or work, and a "work based on the Program" + means either the Program or any derivative work under copyright law: + that is to say, a work containing the Program or a portion of it, + either verbatim or with modifications and/or translated into another + language. (Hereinafter, translation is included without limitation in + the term "modification".) Each licensee is addressed as "you". + + Activities other than copying, distribution and modification are not + covered by this License; they are outside its scope. The act of + running the Program is not restricted, and the output from the Program + is covered only if its contents constitute a work based on the + Program (independent of having been made by running the Program). + Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's + source code as you receive it, in any medium, provided that you + conspicuously and appropriately publish on each copy an appropriate + copyright notice and disclaimer of warranty; keep intact all the + notices that refer to this License and to the absence of any warranty; + and give any other recipients of the Program a copy of this License + along with the Program. + + You may charge a fee for the physical act of transferring a copy, and + you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion + of it, thus forming a work based on the Program, and copy and + distribute such modifications or work under the terms of Section 1 + above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + + These requirements apply to the modified work as a whole. If + identifiable sections of that work are not derived from the Program, + and can be reasonably considered independent and separate works in + themselves, then this License, and its terms, do not apply to those + sections when you distribute them as separate works. But when you + distribute the same sections as part of a whole which is a work based + on the Program, the distribution of the whole must be on the terms of + this License, whose permissions for other licensees extend to the + entire whole, and thus to each and every part regardless of who wrote it. + + Thus, it is not the intent of this section to claim rights or contest + your rights to work written entirely by you; rather, the intent is to + exercise the right to control the distribution of derivative or + collective works based on the Program. + + In addition, mere aggregation of another work not based on the Program + with the Program (or with a work based on the Program) on a volume of + a storage or distribution medium does not bring the other work under + the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, + under Section 2) in object code or executable form under the terms of + Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + + The source code for a work means the preferred form of the work for + making modifications to it. For an executable work, complete source + code means all the source code for all modules it contains, plus any + associated interface definition files, plus the scripts used to + control compilation and installation of the executable. However, as a + special exception, the source code distributed need not include + anything that is normally distributed (in either source or binary + form) with the major components (compiler, kernel, and so on) of the + operating system on which the executable runs, unless that component + itself accompanies the executable. + + If distribution of executable or object code is made by offering + access to copy from a designated place, then offering equivalent + access to copy the source code from the same place counts as + distribution of the source code, even though third parties are not + compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program + except as expressly provided under this License. Any attempt + otherwise to copy, modify, sublicense or distribute the Program is + void, and will automatically terminate your rights under this License. + However, parties who have received copies, or rights, from you under + this License will not have their licenses terminated so long as such + parties remain in full compliance. + + 5. You are not required to accept this License, since you have not + signed it. However, nothing else grants you permission to modify or + distribute the Program or its derivative works. These actions are + prohibited by law if you do not accept this License. Therefore, by + modifying or distributing the Program (or any work based on the + Program), you indicate your acceptance of this License to do so, and + all its terms and conditions for copying, distributing or modifying + the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the + Program), the recipient automatically receives a license from the + original licensor to copy, distribute or modify the Program subject to + these terms and conditions. You may not impose any further + restrictions on the recipients' exercise of the rights granted herein. + You are not responsible for enforcing compliance by third parties to + this License. + + 7. If, as a consequence of a court judgment or allegation of patent + infringement or for any other reason (not limited to patent issues), + conditions are imposed on you (whether by court order, agreement or + otherwise) that contradict the conditions of this License, they do not + excuse you from the conditions of this License. If you cannot + distribute so as to satisfy simultaneously your obligations under this + License and any other pertinent obligations, then as a consequence you + may not distribute the Program at all. For example, if a patent + license would not permit royalty-free redistribution of the Program by + all those who receive copies directly or indirectly through you, then + the only way you could satisfy both it and this License would be to + refrain entirely from distribution of the Program. + + If any portion of this section is held invalid or unenforceable under + any particular circumstance, the balance of the section is intended to + apply and the section as a whole is intended to apply in other + circumstances. + + It is not the purpose of this section to induce you to infringe any + patents or other property right claims or to contest validity of any + such claims; this section has the sole purpose of protecting the + integrity of the free software distribution system, which is + implemented by public license practices. Many people have made + generous contributions to the wide range of software distributed + through that system in reliance on consistent application of that + system; it is up to the author/donor to decide if he or she is willing + to distribute software through any other system and a licensee cannot + impose that choice. + + This section is intended to make thoroughly clear what is believed to + be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in + certain countries either by patents or by copyrighted interfaces, the + original copyright holder who places the Program under this License + may add an explicit geographical distribution limitation excluding + those countries, so that distribution is permitted only in or among + countries not thus excluded. In such case, this License incorporates + the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions + of the General Public License from time to time. Such new versions will + be similar in spirit to the present version, but may differ in detail to + address new problems or concerns. + + Each version is given a distinguishing version number. If the Program + specifies a version number of this License which applies to it and "any + later version", you have the option of following the terms and conditions + either of that version or of any later version published by the Free + Software Foundation. If the Program does not specify a version number of + this License, you may choose any version ever published by the Free Software + Foundation. + + 10. If you wish to incorporate parts of the Program into other free + programs whose distribution conditions are different, write to the author + to ask for permission. For software which is copyrighted by the Free + Software Foundation, write to the Free Software Foundation; we sometimes + make exceptions for this. Our decision will be guided by the two goals + of preserving the free status of all derivatives of our free software and + of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY + FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN + OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES + PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED + OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF + MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS + TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE + PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, + REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING + WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR + REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, + INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING + OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED + TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY + YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER + PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE + POSSIBILITY OF SUCH DAMAGES. + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/Gemfile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/Gemfile new file mode 100644 index 000000000..ee356d2ef --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/Gemfile @@ -0,0 +1,3 @@ +source :rubygems +gemspec + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/LICENSE b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/LICENSE new file mode 100644 index 000000000..fbe8c83b8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/LICENSE @@ -0,0 +1,60 @@ +EventMachine is copyrighted free software owned by Francis Cianfrocca +(blackhedd ... gmail.com). The Owner of this software permits you to +redistribute and/or modify the software under either the terms of the GPL +version 2 (see the file GPL), or the conditions below ("Ruby License"): + + 1. You may make and give away verbatim copies of the source form of this + software without restriction, provided that you retain ALL of the + original copyright notices and associated disclaimers. + + 2. You may modify your copy of the software in any way, provided that + you do at least ONE of the following: + + a) place your modifications in the Public Domain or otherwise + make them Freely Available, such as by posting said + modifications to Usenet or an equivalent medium, or by allowing + the author to include your modifications in the software. + + b) use the modified software only within your corporation or + organization. + + c) give non-standard binaries non-standard names, with + instructions on where to get the original software distribution. + + d) make other distribution arrangements with the Owner. + + 3. You may distribute the software in object code or binary form, + provided that you do at least ONE of the following: + + a) distribute the binaries and library files of the software, + together with instructions (in a manual page or equivalent) + on where to get the original distribution. + + b) accompany the distribution with the machine-readable source of + the software. + + c) give non-standard binaries non-standard names, with + instructions on where to get the original software distribution. + + d) make other distribution arrangements with the Owner. + + 4. You may modify and include parts of the software into any other + software (possibly commercial), provided you comply with the terms in + Sections 1, 2, and 3 above. But some files in the distribution + are not written by the Owner, so they may be made available to you + under different terms. + + For the list of those files and their copying conditions, see the + file LEGAL. + + 5. The scripts and library files supplied as input to or produced as + output from the software do not automatically fall under the + copyright of the software, but belong to whoever generated them, + and may be sold commercially, and may be aggregated with this + software. + + 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE. + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/README.md b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/README.md new file mode 100644 index 000000000..0138f748d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/README.md @@ -0,0 +1,109 @@ +# About EventMachine # + + +## What is EventMachine ## + +EventMachine is an event-driven I/O and lightweight concurrency library for Ruby. +It provides event-driven I/O using the [Reactor pattern](http://en.wikipedia.org/wiki/Reactor_pattern), +much like [JBoss Netty](http://www.jboss.org/netty), [Apache MINA](http://mina.apache.org/), +Python's [Twisted](http://twistedmatrix.com), [Node.js](http://nodejs.org), libevent and libev. + +EventMachine is designed to simultaneously meet two key needs: + + * Extremely high scalability, performance and stability for the most demanding production environments. + * An API that eliminates the complexities of high-performance threaded network programming, + allowing engineers to concentrate on their application logic. + +This unique combination makes EventMachine a premier choice for designers of critical networked +applications, including Web servers and proxies, email and IM production systems, authentication/authorization +processors, and many more. + +EventMachine has been around since the early 2000s and is a mature and battle tested library. + + +## What EventMachine is good for? ## + + * Scalable event-driven servers. Examples: [Thin](http://code.macournoyer.com/thin/) or [Goliath](https://github.com/postrank-labs/goliath/). + * Scalable asynchronous clients for various protocols, RESTful APIs and so on. Examples: [em-http-request](https://github.com/igrigorik/em-http-request) or [amqp gem](https://github.com/ruby-amqp/amqp). + * Efficient network proxies with custom logic. Examples: [Proxymachine](https://github.com/mojombo/proxymachine/). + * File and network monitoring tools. Examples: [eventmachine-tail](https://github.com/jordansissel/eventmachine-tail) and [logstash](https://github.com/logstash/logstash). + + + +## What platforms are supported by EventMachine? ## + +EventMachine supports Ruby 1.8.7, 1.9.2, REE, JRuby and **works well on Windows** as well +as many operating systems from the Unix family (Linux, Mac OS X, BSD flavors). + + + +## Install the gem ## + +Install it with [RubyGems](https://rubygems.org/) + + gem install eventmachine + +or add this to your Gemfile if you use [Bundler](http://gembundler.com/): + + gem "eventmachine" + + + +## Getting started ## + +For an introduction to EventMachine, check out: + + * [blog post about EventMachine by Ilya Grigorik](http://www.igvita.com/2008/05/27/ruby-eventmachine-the-speed-demon/). + * [EventMachine Introductions by Dan Sinclair](http://everburning.com/news/eventmachine-introductions/). + + +### Server example: Echo server ### + +Here's a fully-functional echo server written with EventMachine: + + require 'eventmachine' + + module EchoServer + def post_init + puts "-- someone connected to the echo server!" + end + + def receive_data data + send_data ">>>you sent: #{data}" + close_connection if data =~ /quit/i + end + + def unbind + puts "-- someone disconnected from the echo server!" + end + end + + # Note that this will block current thread. + EventMachine.run { + EventMachine.start_server "127.0.0.1", 8081, EchoServer + } + + +## EventMachine documentation ## + +Currently we only have [reference documentation](http://eventmachine.rubyforge.org) and a [wiki](https://github.com/eventmachine/eventmachine/wiki). + + +## Community and where to get help ## + + * Join the [mailing list](http://groups.google.com/group/eventmachine) (Google Group) + * Join IRC channel #eventmachine on irc.freenode.net + + +## License and copyright ## + +EventMachine is copyrighted free software made available under the terms +of either the GPL or Ruby's License. + +Copyright: (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. + + +## Alternatives ## + +If you are unhappy with EventMachine and want to use Ruby, check out [Cool.io](http://coolio.github.com/). +One caveat: by May 2011, it did not support JRuby and Windows. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/Rakefile new file mode 100644 index 000000000..dce01359c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/Rakefile @@ -0,0 +1,20 @@ +require 'rubygems' +GEMSPEC = Gem::Specification.load('eventmachine.gemspec') + +require 'rake/clean' +task :clobber => :clean + +desc "Build eventmachine, then run tests." +task :default => [:compile, :test] + +desc 'Generate documentation' +begin + require 'yard' + YARD::Rake::YardocTask.new do |t| + t.files = ['lib/**/*.rb', '-', 'docs/*.md'] + t.options = ['--main', 'README.md', '--no-private'] + t.options = ['--exclude', 'lib/jeventmachine', '--exclude', 'lib/pr_eventmachine'] + end +rescue LoadError + task :yard do puts "Please install yard first!"; end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/DocumentationGuidesIndex.md b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/DocumentationGuidesIndex.md new file mode 100644 index 000000000..b8ce5a2ae --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/DocumentationGuidesIndex.md @@ -0,0 +1,27 @@ +# EventMachine documentation guides # + +Welcome to the documentation guides for [EventMachine](http://github.com/eventmachine/eventmachine), +a fast and simple event-processing library for Ruby programs (à la JBoss Netty, Twisted, Node.js +and so on). + +## Guide list ## + + * {file:docs/GettingStarted.md Getting started with EventMachine} + * {file:docs/EventDrivenServers.md Writing event-driven servers} + * {file:docs/EventDrivenClients.md Writing event-driven clients} + * {file:docs/ConnectionFailureAndRecovery.md Connection Failure and Recovery} + * {file:docs/TLS.md TLS (aka SSL)} + * {file:docs/Ecosystem.md EventMachine ecosystem}: Thin, Goliath, em-http-request, em-websockets, Proxymachine and beyond + * {file:docs/BlockingEventLoop.md On blocking the event loop: why it is harmful for performance and how to avoid it} + * {file:docs/LightweightConcurrency.md Lightweight concurrency with EventMachine} + * {file:docs/Deferrables.md Deferrables} + * {file:docs/ModernKernelInputOutputAPIs.md Brief introduction to epoll, kqueue, select} + * {file:docs/WorkingWithOtherIOSources.md Working with other IO sources such as the keyboard} + + +## Tell us what you think! ## + +Please take a moment and tell us what you think about this guide on the [EventMachine mailing list](http://bit.ly/jW3cR3) +or in the #eventmachine channel on irc.freenode.net: what was unclear? What wasn't covered? +Maybe you don't like the guide style or the grammar and spelling are incorrect? Reader feedback is +key to making documentation better. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/GettingStarted.md b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/GettingStarted.md new file mode 100644 index 000000000..63acbb78b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/GettingStarted.md @@ -0,0 +1,521 @@ +# @title Getting Started with Ruby EventMachine +# @markup markdown +# @author Michael S. Klishin, Dan Sinclair + +# Getting started with Ruby EventMachine # + + +## About this guide ## + +This guide is a quick tutorial that helps you to get started with EventMachine for writing event-driven +servers, clients and using it as a lightweight concurrency library. +It should take about 20 minutes to read and study the provided code examples. This guide covers + + * Installing EventMachine via [Rubygems](http://rubygems.org) and [Bundler](http://gembundler.com). + * Building an Echo server, the "Hello, world"-like code example of network servers. + * Building a simple chat, both server and client. + * Building a very small asynchronous Websockets client. + + +## Covered versions ## + +This guide covers EventMachine v0.12.10 and 1.0 (including betas). + + +## Level ## + +This guide assumes you are comfortable (but not necessary a guru) with the command line. On Microsoft Windows™, +we recommend you to use [JRuby](http://jruby.org) when running these examples. + + +## Installing EventMachine ## + +### Make sure you have Ruby installed ### + +This guide assumes you have one of the supported Ruby implementations installed: + + * Ruby 1.8.7 + * Ruby 1.9.2 + * [JRuby](http://jruby.org) (we recommend 1.6) + * [Rubinius](http://rubini.us) 1.2 or higher + * [Ruby Enterprise Edition](http://www.rubyenterpriseedition.com) + +EventMachine works on Microsoft Windows™. + + +### With Rubygems ### + +To install the EventMachine gem do + + gem install eventmachine + + +### With Bundler ### + + gem "eventmachine" + + +### Verifying your installation ### + +Lets verify your installation with this quick IRB session: + + irb -rubygems + + ruby-1.9.2-p180 :001 > require "eventmachine" + => true + ruby-1.9.2-p180 :002 > EventMachine::VERSION + => "1.0.0.beta.3" + + +## An Echo Server Example ## + +Lets begin with the classic "Hello, world"-like example, an echo server. The echo server responds clients with the +same data that was provided. First, here's the code: + +{include:file:examples/guides/getting\_started/01\_eventmachine\_echo_server.rb} + + +When run, the server binds to port 10000. We can connect using Telnet and verify it's working: + + telnet localhost 10000 + +On my machine the output looks like: + + ~ telnet localhost 10000 + Trying 127.0.0.1... + Connected to localhost. + Escape character is '^]'. + +Let's send something to our server. Type in "Hello, EventMachine" and hit Enter. The server will respond with +the same string: + + ~ telnet localhost 10000 + Trying 127.0.0.1... + Connected to localhost. + Escape character is '^]'. + Hello, EventMachine + # (here we hit Enter) + Hello, EventMachine + # (this ^^^ is our echo server reply) + +It works! Congratulations, you now can tell your Node.js-loving friends that you "have done some event-driven programming, too". +Oh, and to stop Telnet, hit Control + Shift + ] and then Control + C. + +Lets walk this example line by line and see what's going on. These lines + + require 'rubygems' # or use Bundler.setup + require 'eventmachine' + +probably look familiar: you use [RubyGems](http://rubygems.org) (or [Bundler](http://gembundler.com/)) for dependencies and then require EventMachine gem. Boring. + +Next: + + class EchoServer < EventMachine::Connection + def receive_data(data) + send_data(data) + end + end + +Is the implementation of our echo server. We define a class that inherits from {EventMachine::Connection} +and a handler (aka callback) for one event: when we receive data from a client. + +EventMachine handles the connection setup, receiving data and passing it to our handler, {EventMachine::Connection#receive_data}. + +Then we implement our protocol logic, which in the case of Echo is pretty trivial: we send back whatever we receive. +To do so, we're using {EventMachine::Connection#send_data}. + +Lets modify the example to recognize `exit` command: + +{include:file:examples/guides/getting\_started/02\_eventmachine\_echo_server\_that\_recognizes\_exit\_command.rb} + +Our `receive\_data` changed slightly and now looks like this: + + def receive_data(data) + if data.strip =~ /exit$/i + EventMachine.stop_event_loop + else + send_data(data) + end + end + +Because incoming data has trailing newline character, we strip it off before matching it against a simple regular +expression. If the data ends in `exit`, we stop EventMachine event loop with {EventMachine.stop_event_loop}. This unblocks +main thread and it finishes execution, and our little program exits as the result. + +To summarize this first example: + + * Subclass {EventMachine::Connection} and override {EventMachine::Connection#send_data} to handle incoming data. + * Use {EventMachine.run} to start EventMachine event loop and then bind echo server with {EventMachine.start_server}. + * To stop the event loop, use {EventMachine.stop_event_loop} (aliased as {EventMachine.stop}) + +Lets move on to a slightly more sophisticated example that will introduce several more features and methods +EventMachine has to offer. + + +## A Simple Chat Server Example ## + +Next we will write a simple chat. Initially clients will still use telnet to connect, but then we will add little +client application that will serve as a proxy between telnet and the chat server. This example is certainly longer +(~ 150 lines with whitespace and comments) so instead of looking at the final version and going through it line by line, +we will instead begin with a very simple version that only keeps track of connected clients and then add features +as we go. + +To set some expectations about our example: + + * It will keep track of connected clients + * It will support a couple of commands, à la IRC + * It will support direct messages using Twitter-like @usernames + * It won't use MongoDB, fibers or distributed map/reduce for anything but will be totally [Web Scale™](http://bit.ly/webscaletm) nonetheless. Maybe even [ROFLscale](http://bit.ly/roflscalevideo). + +### Step one: detecting connections and disconnectons ### + +First step looks like this: + +{include:file:examples/guides/getting\_started/04\_simple\_chat\_server\_step\_one.rb} + +We see familiar {EventMachine.run} and {EventMachine.start_server}, but also {EventMachine::Connection#post_init} and {EventMachine::Connection#unbind} we haven't +met yet. We don't use them in this code, so when are they run? Like {EventMachine::Connection#receive_data}, these methods are callbacks. EventMachine calls them +when certain events happen: + + * {EventMachine#post_init} is called by the event loop immediately after the network connection has been established. + In the chat server example case, this is when a new client connects. + * {EventMachine#unbind} is called when client disconnects, connection is closed or is lost (because of a network issue, for example). + +All our chat server does so far is logging connections or disconnections. What we want it to do next is to keep track of connected clients. + + +### Step two: keep track of connected clients ### + +Next iteration of the code looks like this: + +{include:file:examples/guides/getting\_started/05\_simple\_chat\_server\_step\_two.rb} + +While the code we added is very straightforward, we have to clarify one this first: subclasses of {EventMachine::Connection} are instantiated by +EventMachine for every new connected peer. So for 10 connected chat clients, there will be 10 separate `SimpleChatServer` instances in our +server process. Like any other objects, they can be stored in a collection, can provide public API other objects use, can instantiate or inject +dependencies and in general live a happy life all Ruby objects live until garbage collection happens. + +In the example above we use a @@class_variable to keep track of connected clients. In Ruby, @@class variables are accessible from instance +methods so we can add new connections to the list from `SimpleChatServer#post_init` and remove them in `SimpleChatServer#unbind`. We can also +filter connections by some criteria, as `SimpleChatServer#other_peers demonstrates`. + +So, we keep track of connections but how do we identify them? For a chat app, it's pretty common to use usernames for that. Lets ask our clients +to enter usernames when they connect. + + +### Step three: adding usernames ## + +To add usernames, we need to add a few things: + + * We need to invite newly connected clients to enter their username. + * A reader (getter) method on our {EventMachine::Connection} subclass. + * An idea of connection state (keeping track of whether a particular participant had entered username before). + +Here is one way to do it: + +{include:file:examples/guides/getting\_started/06\_simple\_chat\_server\_step\_three.rb} + +This is quite an update so lets take a look at each method individually. First, `SimpleChatServer#post_init`: + + def post_init + @username = nil + puts "A client has connected..." + ask_username + end + +To keep track of username we ask chat participants for, we add @username instance variable to our connection class. Connection +instances are just Ruby objects associated with a particular connected peer, so using @ivars is very natural. To make username +value accessible to other objects, we added a reader method that was not shown on the snippet above. + +Lets dig into `SimpleChatServer#ask_username`: + + def ask_username + self.send_line("[info] Enter your username:") + end # ask_username + + # ... + + def send_line(line) + self.send_data("#{line}\n") + end # send_line(line) + +Nothing new here, we are using {EventMachine::Connection#send_data} which we have seen before. + + +In `SimpleChatServer#receive_data` we now have to check if the username was entered or we need +to ask for it: + + def receive_data(data) + if entered_username? + handle_chat_message(data.strip) + else + handle_username(data.strip) + end + end + + # ... + + def entered_username? + !@username.nil? && !@username.empty? + end # entered_username? + +Finally, handler of chat messages is not yet implemented: + + def handle_chat_message(msg) + raise NotImplementedError + end + +Lets try this example out using Telnet: + + ~ telnet localhost 10000 + Trying 127.0.0.1... + Connected to localhost. + Escape character is '^]'. + [info] Enter your username: + antares_ + [info] Ohai, antares_ + +and the server output: + + A client has connected... + antares_ has joined + +This version requires you to remember how to terminate your Telnet session (Ctrl + Shift + ], then Ctrl + C). +It is annoying, so why don't we add the same `exit` command to our chat server? + + +### Step four: adding exit command and delivering chat messages #### + +{include:file:examples/guides/getting\_started/07\_simple\_chat\_server\_step\_four.rb} + +TBD + +Lets test-drive this version. Client A: + + ~ telnet localhost 10000 + Trying 127.0.0.1... + Connected to localhost. + Escape character is '^]'. + [info] Enter your username: + michael + [info] Ohai, michael + Hi everyone + michael: Hi everyone + joe has joined the room + # here ^^^ client B connects, lets greet him + hi joe + michael: hi joe + joe: hey michael + # ^^^ client B replies + exit + # ^^^ out command in action + Connection closed by foreign host. + +Client B: + + ~ telnet localhost 10000 + Trying 127.0.0.1... + Connected to localhost. + Escape character is '^]'. + [info] Enter your username: + joe + [info] Ohai, joe + michael: hi joe + # ^^^ client A greets us, lets reply + hey michael + joe: hey michael + exit + # ^^^ out command in action + Connection closed by foreign host. + +And finally, the server output: + + A client has connected... + michael has joined + A client has connected... + _antares has joined + [info] _antares has left + [info] michael has left + +Our little char server now supports usernames, sending messages and the `exit` command. Next up, private (aka direct) messages. + + +### Step five: adding direct messages and one more command ### + +To add direct messages, we come up with a simple convention: private messages begin with @username and may have optional colon before +message text, like this: + + @joe: hey, how do you like eventmachine? + +This convention makes parsing of messages simple so that we can concentrate on delivering them to a particular client connection. +Remember when we added `username` reader on our connection class? That tiny change makes this step possible: when a new direct +message comes in, we extract username and message text and then find then connection for @username in question: + + # + # Message handling + # + + def handle_chat_message(msg) + if command?(msg) + self.handle_command(msg) + else + if direct_message?(msg) + self.handle_direct_message(msg) + else + self.announce(msg, "#{@username}:") + end + end + end # handle_chat_message(msg) + + def direct_message?(input) + input =~ DM_REGEXP + end # direct_message?(input) + + def handle_direct_message(input) + username, message = parse_direct_message(input) + + if connection = @@connected_clients.find { |c| c.username == username } + puts "[dm] @#{@username} => @#{username}" + connection.send_line("[dm] @#{@username}: #{message}") + else + send_line "@#{username} is not in the room. Here's who is: #{usernames.join(', ')}" + end + end # handle_direct_message(input) + + def parse_direct_message(input) + return [$1, $2] if input =~ DM_REGEXP + end # parse_direct_message(input) + +This snippet demonstrates how one connection instance can obtain another connection instance and send data to it. +This is a very powerful feature, consider just a few use cases: + + * Peer-to-peer protocols + * Content-aware routing + * Efficient streaming with optional filtering + +Less common use cases include extending C++ core of EventMachine to provide access to hardware that streams events that +can be re-broadcasted to any interested parties connected via TCP, UDP or something like AMQP or WebSockets. With this, +sky is the limit. Actually, EventMachine has several features for efficient proxying data between connections. +We will not cover them in this guide. + +One last feature that we are going to add to our chat server is the `status` command that tells you current server time and how many people +are there in the chat room: + + # + # Commands handling + # + + def command?(input) + input =~ /(exit|status)$/i + end # command?(input) + + def handle_command(cmd) + case cmd + when /exit$/i then self.close_connection + when /status$/i then self.send_line("[chat server] It's #{Time.now.strftime('%H:%M')} and there are #{self.number_of_connected_clients} people in the room") + end + end # handle_command(cmd) + +Hopefully this piece of code is easy to follow. Try adding a few more commands, for example, the `whoishere` command that lists people +currently in the chat room. + +In the end, our chat server looks like this: + +{include:file:examples/guides/getting\_started/08\_simple\_chat\_server\_step\_five.rb} + +We are almost done with the server but there are some closing thoughts. + + +### Step six: final version ### + +Just in case, here is the final version of the chat server code we have built: + +{include:file:examples/guides/getting\_started/03\_simple\_chat\_server.rb} + + +### Step seven: future directions and some closing thoughts ### + +The chat server is just about 150 lines of Ruby including empty lines and comments, yet it has a few features most of chat server +examples never add. We did not, however, implement many other features that popular IRC clients like [Colloquy](http://colloquy.info) have: + + * Chat moderation + * Multiple rooms + * Connection timeout detection + +How would one go about implementing them? We thought it is worth discussing what else EventMachine has to offer and what ecosystem projects +one can use to build a really feature-rich Web-based IRC chat client. + +With multiple rooms it's more or less straightforward, just add one more hash and a bunch of commands and use the information about which rooms participant +is in when you are delivering messages. There is nothing in EventMachine itself that can make the job much easier for developer. + +To implement chat moderation feature you may want to do a few things: + + * Work with client IP addresses. Maybe we want to consider everyone who connects from certain IPs a moderator. + * Access persistent data about usernames of moderators and their credentials. + +Does EventMachine have anything to offer here? It does. To obtain peer IP address, take a look at {EventMachine::Connection#get_peername}. The name of this method is +a little bit misleading and originates from low-level socket programming APIs. + +#### A whirlwind tour of the EventMachine ecosystem #### + +To work with data stores you can use several database drivers that ship with EventMachine itself, however, quite often there are some 3rd party projects in +the EventMachine ecosystem that have more features, are faster or just better maintained. So we figured it will be helpful to provide a few pointers +to some of those projects: + + * For MySQL, check out [em-mysql](https://github.com/eventmachine/em-mysql) project. + * For PostgreSQL, have a look at Mike Perham's [EventMachine-based PostgreSQL driver](https://github.com/mperham/em_postgresql). + * For Redis, there is a young but already popular [em-hiredis](https://github.com/mloughran/em-hiredis) library that combines EventMachine's non-blocking I/O with + extreme performance of the official Redis C client, [hiredis](https://github.com/antirez/hiredis). + * For MongoDB, see [em-mongo](https://github.com/bcg/em-mongo) + * For Cassandra, Mike Perham [added transport agnosticism feature](http://www.mikeperham.com/2010/02/09/cassandra-and-eventmachine/) to the [cassandra gem](https://rubygems.org/gems/cassandra). + +[Riak](http://www.basho.com/products_riak_overview.php) and CouchDB talk HTTP so it's possible to use [em-http-request](https://github.com/igrigorik/em-http-request). +If you are aware of EventMachine-based non-blocking drivers for these databases, as well as for HBase, let us know on the [EventMachine mailing list](http://groups.google.com/group/eventmachine). +Also, EventMachine supports TLS (aka SSL) and works well on [JRuby](http://jruby.org) and Windows. + +Learn more in our {file:docs/Ecosystem.md EventMachine ecosystem} and {file:docs/TLS.md TLS (aka SSL)} guides. + + +#### Connection loss detection #### + +Finally, connection loss detection. When our chat participant closes her laptop lid, how do we know that she is no longer active? The answer is, when EventMachine +detects TCP connectin closure, it calls {EventMachine::Connection#unbind}. Version 1.0.beta3 and later also pass an optional argument to that method. The argument +indicates what error (if any) caused the connection to be closed. + +Learn more in our {file:docs/ConnectionFailureAndRecovery.md Connection Failure and Recovery} guide. + + +#### What the Chat Server Example doesn't demonstrate #### + +This chat server also leaves out something production quality clients and servers must take care of: buffering. We intentionally did not include any buffering in +our chat server example: it would only distract you from learning what you really came here to learn: how to use EventMachine to build blazing fast asynchronous +networking programs quickly. However, {EventMachine::Connection#receive_data} does not offer any guarantees that you will be receiving "whole messages" all the time, +largely because the underlying transport (UDP or TCP) does not offer such guarantees. Many protocols, for example, AMQP, mandate that large content chunks are +split into smaller _frames_ of certain size. This means that [amq-client](https://github.com/ruby-amqp/amq-client) library, for instance, that has EventMachine-based driver, +has to deal with figuring out when exactly we received "the whole message". To do so, it uses buffering and employs various checks to detect _frame boundaries_. +So **don't be deceived by the simplicity of this chat example**: it intentionally leaves framing out, but real world protocols usually require it. + + + +## A (Proxying) Chat Client Example ## + +TBD + + +## Wrapping up ## + +This tutorial ends here. Congratulations! You have learned quite a bit about EventMachine. + + +## What to read next ## + +The documentation is organized as a {file:docs/DocumentationGuidesIndex.md number of guides}, covering all kinds of +topics. TBD + + +## Tell us what you think! ## + +Please take a moment and tell us what you think about this guide on the [EventMachine mailing list](http://bit.ly/jW3cR3) +or in the #eventmachine channel on irc.freenode.net: what was unclear? What wasn't covered? +Maybe you don't like the guide style or the grammar and spelling are incorrect? Reader feedback is +key to making documentation better. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/ChangeLog b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/ChangeLog new file mode 100644 index 000000000..c7a6c48e4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/ChangeLog @@ -0,0 +1,211 @@ +01Oct06: Replaced EventMachine#open_datagram_server with a version that can + take a Class or a Module, instead of just a Module. Thanks to Tobias + Gustafsson for pointing out the missing case. +04Oct06: Supported subsecond timer resolutions, per request by Jason Roelofs. +05Oct06: Added EventMachine#set_quantum, which sets the timer resolution. +15Nov06: Added Connection#set_comm_inactivity_timeout. +15Nov06: Checked in a Line-and-Text Protocol Handler. +18Nov06: Checked in a Header-and-Body Protocol Handler. +22Nov06: Changed EventMachine#reconnect: no longer excepts when called on an + already-connected handler. +28Nov06: Supported a binary-unix gem. +19Dec06: Added EventMachine#set_effective_user. +05Jan07: Upped max outstanding timers to 1000. +15May07: Applied Solaris patches from Brett Eisenberg +22May07: Cleaned up the license text in all the source files. +22May07: Released version 0.7.2 + +23May07: Per suggestion from Bill Kelly, fixed a bug with the initialization + of the network libraries under Windows. The goal is to enable EM to + be used without Ruby. +28May07: Applied patch from Bill Kelly, refactors the declarations of + event names to make EM easier to use from C programs without Ruby. +31May07: Added a preliminary implementation of EventMachine#popen. +01Jun07: Added EM, a "pseudo-alias" for EventMachine. +01Jun07: Added EM#next_tick. +01Jun07: Added EM::Connection#get_outbound_data_size +05Jun07: Removed the code which loads a pure-Ruby EM library in case the + compiled extension is unavailable. Suggested by Moshe Litvin. +06Jun07: Preliminary epoll implementation. +12Jun07: Added an evented popen implementation that, like Ruby's, is + full-duplex and makes the subprocess PID available to the caller. +06Jul07: Performance-tweaked the callback dispatcher in eventmachine.rb. +10Jul07: Released version 0.8.0. +12Jul07: Applied patches from Tim Pease to fix Solaris build problems. +15Jul07: Created a new provisional source branch, experiments/jruby-1. + This is a preliminary implementation of the EM reactor in Java, + suitable for use with JRuby. +17Jul07: Added EventMachine#stop_server, per request from Kirk Haines, + and associated unit tests. +22Jul07: Added EventMachine#stream_file_data. This is a very fast and scalable + way of sending data from static files over network connections. It + has separate implementations for small files and large file, and + has tunings to minimize memory consumption. +26Jul07: Added some patches by Kirk Haines to improve the behavior of + EM::Connection#send_file_data_to_connection. +26Jul07: Added a C++ module for directly integrating EM into C++ programs + with no Ruby dependencies. Needs example code. +29Jul07: Added EventMachine::Protocols::LineText2. +29Jul07: Added EventMachine::Protocols::Stomp. +30Jul07: Added sys/stat.h to project.h to fix compilation bug on Darwin. +13Aug07: Added EventMachine#reactor_running? +15Aug07: Added parameters for EventMachine::Connection:start_tls that can be + used to specify client-side private keys and certificates. +17Aug07: Added EventMachine#run_block, a sugaring for a common use case. +24Aug07: Added a preliminary keyboard handler. Needs docs and testing on + windows. +26Aug07: Created EventMachine::Spawnable, an implementation of Erlang-like + processes. +27Aug07: Silenced some -w warnings, requested by James Edward Gray II. +30Aug07: Added cookies to EM::HttpClient#request. +04Sep07: Added an initial implementation of an evented SMTP client. +04Sep07: Added an initial implementation of an evented SMTP server. +10Sep07: Changed EM#spawn to run spawned blocks in the context of the + SpawnedProcess object, not of whatever was the active object at the + time of the spawn. +14Sep07: Heartbeats weren't working with EPOLL. Noticed by Brian Candler. +15Sep07: Added some features, tests and documents to Deferrable. +16Sep07: Added [:content] parameter to EM::Protocols::SmtpClient#send. +16Sep07: Bumped version to 0.9.0 in anticipation of a release. +18Sep07: Released version 0.9.0. +19Sep07: Added #receive_reset to EM::Protocols::SmtpServer. +19Sep07: User overrides of EM::Protocols::SmtpServer#receive_recipient can now + return a Deferrable. Also fixed bug: SmtpClient now raises a protocol + error if none of its RCPT TO: commands are accepted by the server. +26Sep07: Fixed missing keyboard support for Windows. +03Oct07: Added a default handler for RuntimeErrors emitted from user-written + code. Suggested by Brian Candler. +19Oct07: Set the SO_BROADCAST option automatically on all UDP sockets. +10Nov07: Forced integer conversion of send_datagram's port parameter. +Suggested by Matthieu Riou. +12Nov07: Added saslauth.rb, a protocol module to replace the Cyrus SASL +daemons saslauthd and pwcheck. +15Nov07: Fixed bug reported by Mark Zvillius. We were failing to dispatch + zero-length datagrams under certain conditions. +19Nov07: Added EventMachine#set_max_timers. Requested by Matthieu Riou and + others. +19Nov07: Fixed bug with EM::Connection#start_tls. Was not working with server + connections. Reported by Michael S. Fischer. +26Nov07: Supported a hack for EventMachine#popen so it can return an exit + status from subprocesses. Requested by Michael S. Fischer. +30Nov07: Changed Pipe descriptors so that the child-side of the socketpair is + NOT set nonblocking. Suggested by Duane Johnson. +05Dec07: Re-enabled the pure-Ruby implementation. +06Dec07: Released Version 0.10.0. +13Dec07: Added EM::DeferrableChildProcess +24Dec07: Added a SASL client for simple password authentication. +27Dec07: Removed the hookable error handler. No one was using it and it significantly + degraded performance. +30Dec07: Implemented Kqueue support for OSX and BSD. +04Jan08: Fixed bug in epoll ("Bad file descriptor"), patch supplied by Chris + Heath. +04Jan08: Fixed bug reported by Michael S. Fischer. We were terminating + SSL connections that sent data before the handshake was complete. +08Jan08: Added an OpenBSD branch for extconf.rb, contributed by Guillaume + Sellier. +19Jan08: Added EM::Connection::get_sockname per request by Michael Fischer. +19Jan08: Supported IPv6 addresses. +30Apr08: Set the NODELAY option on sockets that we connect to other servers. + Omission noted by Roger Pack. +14May08: Generated a 0.12 release. +15May08: Supported EM#get_sockname for acceptors (TCP server sockets). + Requested by Roger Pack. +15May08; Accepted a patch from Dan Aquino that allows the interval of a + PeriodicTimer to be changed on the fly. +15Jun08: Supported nested calls to EM#run. Many people contributed ideas to + this, notably raggi and tmm1. +20Jul08: Accepted patch from tmm1 for EM#fork_reactor. +28Jul08: Added a Postgres3 implementation, written by FCianfrocca. +14Aug08: Added a patch by Mike Murphy to support basic auth in the http +client. +28Aug08: Added a patch by tmm1 to fix a longstanding problem with Java +data-sends. +13Sep08: Added LineText2#set_binary_mode, a back-compatibility alias. +13Sep08: Modified the load order of protocol libraries in eventmachine.rb + to permit a modification of HeaderAndContentProtocol. +13Sep08: Modified HeaderAndContent to use LineText2, which is less buggy + than LineAndTextProtocol. This change may be reversed if we can fix + the bugs in buftok. +13Sep08: Improved the password handling in the Postgres protocol handler. +15Sep08: Added attach/detach, contributed by Aman Gupta (tmm1) and Riham Aldakkak, + to support working with file descriptors not created in the reactor. +16Sep08: Added an optional version string to the HTTP client. This is a hack + that allows a client to specify a version 1.0 request, which + keeps the server from sending a chunked response. The right way to + solve this, of course, is to support chunked responses. +23Sep08: ChangeLog Summary for Merge of branches/raggi +Most notable work and patches by Aman Gupta, Roger Pack, and James Tucker. +Patches / Tickets also submitted by: Jeremy Evans, aanand, darix, mmmurf, +danielaquino, macournoyer. + - Moved docs into docs/ dir + - Major refactor of rakefile, added generic rakefile helpers in tasks + - Added example CPP build rakefile in tasks/cpp.rake + - Moved rake tests out to tasks/tests.rake + - Added svn ignores where appropriate + - Fixed jruby build on older java platforms + - Gem now builds from Rakefile rather than directly via extconf + - Gem unified for jruby, C++ and pure ruby. + - Correction for pure C++ build, removing ruby dependency + - Fix for CYGWIN builds on ipv6 + - Major refactor for extconf.rb + - Working mingw builds + - extconf optionally uses pkg_config over manual configuration + - extconf builds for 1.9 on any system that has 1.9 + - extconf no longer links pthread explicitly + - looks for kqueue on all *nix systems + - better error output on std::runtime_error, now says where it came from + - Fixed some tests on jruby + - Added test for general send_data flaw, required for a bugfix in jruby build + - Added timeout to epoll tests + - Added fixes for java reactor ruby api + - Small addition of some docs in httpclient.rb and httpcli2.rb + - Some refactor and fixes in smtpserver.rb + - Added parenthesis where possible to avoid excess ruby warnings + - Refactor of $eventmachine_library logic for accuracy and maintenance, jruby + - EM::start_server now supports unix sockets + - EM::connect now supports unix sockets + - EM::defer @threadqueue now handled more gracefully + - Added better messages on exceptions raised + - Fix edge case in timer fires + - Explicitly require buftok.rb + - Add protocols to autoload, rather than require them all immediately + - Fix a bug in pr_eventmachine for outbound_q + - Refactors to take some of the use of defer out of tests. + - Fixes in EM.defer under start/stop conditions. Reduced scope of threads. +23Sep08: Added patch from tmm1 to avoid popen errors on exit. +30Sep08: Added File.exists? checks in the args for start_tls, as suggested by + Brian Lopez (brianmario). +10Nov08: ruby 1.9 compatibility enhancements +28Nov08: Allow for older ruby builds where RARRAY_LEN is not defined +03Dec08: allow passing arguments to popen handlers +13Jan09: SSL support for httpclient2 (David Smalley) +22Jan09: Fixed errors on OSX with the kqueue reactor, fixed errors in the pure + ruby reactor. Added EM.current_time. Added EM.epoll? and EM.kqueue? +27Jan09: Reactor errors are now raised as ruby RuntimeErrors. +28Jan09: Documentation patch from alloy +29Jan09: (Late sign-off) Use a longer timeout for connect_server (Ilya + Grigorik) +07Feb09: Fix signal handling issues with threads+epoll +07Feb09: Use rb_thread_schedule in the epoll reactor +07Feb09: Use TRAP_BEG/END and rb_thread_schedule in kqueue reactor +08Feb09: Added fastfilereader from swiftiply +08Feb09: 1.9 fix for rb_trap_immediate +08Feb09: Enable rb_thread_blocking_region for 1.9.0 and 1.9.1 +10Feb09: Support win32 builds for fastfilereader +10Feb09: Added a new event to indicate completion of SSL handshake on TCP + connections +10Feb09: Working get_peer_cert method. Returns the certificate as a Ruby + String in PEM format. (Jake Douglas) +10Feb09: Added EM.get_max_timers +11Feb09: Fix compile options for sun compiler (Alasdairrr) +11Feb09: get_status returns a Process::Status object +12Feb09: Add EM::Protocols::Memcache with simple get/set functionality +19Feb09: Add catch-all EM.error_handler +20Feb09: Support miniunit (1.9) +20Feb09: Return success on content-length = 0 instead of start waiting forever + (Ugo Riboni) +25Feb09: Allow next_tick to be used to pre-schedule reactor operations before + EM.run +26Feb09: Added EM.get_connection_count +01Mar09: Switch back to extconf for compiling gem extensions +01Mar09: fixed a small bug with basic auth (mmmurf) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/DEFERRABLES b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/DEFERRABLES new file mode 100644 index 000000000..6e8856cc5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/DEFERRABLES @@ -0,0 +1,246 @@ +EventMachine (EM) adds two different formalisms for lightweight concurrency +to the Ruby programmer's toolbox: spawned processes and deferrables. This +note will show you how to use deferrables. For more information, see the +separate document LIGHTWEIGHT_CONCURRENCY. + +=== What are Deferrables? + +EventMachine's Deferrable borrows heavily from the "deferred" object in +Python's "Twisted" event-handling framework. Here's a minimal example that +illustrates Deferrable: + + require 'eventmachine' + + class MyClass + include EM::Deferrable + + def print_value x + puts "MyClass instance received #{x}" + end + end + + EM.run { + df = MyClass.new + df.callback {|x| + df.print_value(x) + EM.stop + } + + EM::Timer.new(2) { + df.set_deferred_status :succeeded, 100 + } + } + + +This program will spin for two seconds, print out the string "MyClass +instance received 100" and then exit. The Deferrable pattern relies on +an unusual metaphor that may be unfamiliar to you, unless you've used +Python's Twisted. You may need to read the following material through +more than once before you get the idea. + +EventMachine::Deferrable is simply a Ruby Module that you can include +in your own classes. (There also is a class named +EventMachine::DefaultDeferrable for when you want to create one without +including it in code of your own.) + +An object that includes EventMachine::Deferrable is like any other Ruby +object: it can be created whenever you want, returned from your functions, +or passed as an argument to other functions. + +The Deferrable pattern allows you to specify any number of Ruby code +blocks (callbacks or errbacks) that will be executed at some future time +when the status of the Deferrable object changes. + +How might that be useful? Well, imagine that you're implementing an HTTP +server, but you need to make a call to some other server in order to fulfill +a client request. + +When you receive a request from one of your clients, you can create and +return a Deferrable object. Some other section of your program can add a +callback to the Deferrable that will cause the client's request to be +fulfilled. Simultaneously, you initiate an event-driven or threaded client +request to some different server. And then your EM program will continue to +process other events and service other client requests. + +When your client request to the other server completes some time later, you +will call the #set_deferred_status method on the Deferrable object, passing +either a success or failure status, and an arbitrary number of parameters +(which might include the data you received from the other server). + +At that point, the status of the Deferrable object becomes known, and its +callback or errback methods are immediately executed. Callbacks and errbacks +are code blocks that are attached to Deferrable objects at any time through +the methods #callback and #errback. + +The deep beauty of this pattern is that it decouples the disposition of one +operation (such as a client request to an outboard server) from the +subsequent operations that depend on that disposition (which may include +responding to a different client or any other operation). + +The code which invokes the deferred operation (that will eventually result +in a success or failure status together with associated data) is completely +separate from the code which depends on that status and data. This achieves +one of the primary goals for which threading is typically used in +sophisticated applications, with none of the nondeterminacy or debugging +difficulties of threads. + +As soon as the deferred status of a Deferrable becomes known by way of a call +to #set_deferred_status, the Deferrable will IMMEDIATELY execute all of its +callbacks or errbacks in the order in which they were added to the Deferrable. + +Callbacks and errbacks can be added to a Deferrable object at any time, not +just when the object is created. They can even be added after the status of +the object has been determined! (In this case, they will be executed +immediately when they are added.) + +A call to Deferrable#set_deferred_status takes :succeeded or :failed as its +first argument. (This determines whether the object will call its callbacks +or its errbacks.) #set_deferred_status also takes zero or more additional +parameters, that will in turn be passed as parameters to the callbacks or +errbacks. + +In general, you can only call #set_deferred_status ONCE on a Deferrable +object. A call to #set_deferred_status will not return until all of the +associated callbacks or errbacks have been called. If you add callbacks or +errbacks AFTER making a call to #set_deferred_status, those additional +callbacks or errbacks will execute IMMEDIATELY. Any given callback or +errback will be executed AT MOST once. + +It's possible to call #set_deferred_status AGAIN, during the execution a +callback or errback. This makes it possible to change the parameters which +will be sent to the callbacks or errbacks farther down the chain, enabling +some extremely elegant use-cases. You can transform the data returned from +a deferred operation in arbitrary ways as needed by subsequent users, without +changing any of the code that generated the original data. + +A call to #set_deferred_status will not return until all of the associated +callbacks or errbacks have been called. If you add callbacks or errbacks +AFTER making a call to #set_deferred_status, those additional callbacks or +errbacks will execute IMMEDIATELY. + +Let's look at some more sample code. It turns out that many of the internal +protocol implementations in the EventMachine package rely on Deferrable. One +of these is EM::Protocols::HttpClient. + +To make an evented HTTP request, use the module function +EM::Protocols::HttpClient#request, which returns a Deferrable object. +Here's how: + + require 'eventmachine' + + EM.run { + df = EM::Protocols::HttpClient.request( :host=>"www.example.com", + :request=>"/index.html" ) + + df.callback {|response| + puts "Succeeded: #{response[:content]}" + EM.stop + } + + df.errback {|response| + puts "ERROR: #{response[:status]}" + EM.stop + } + } + +(See the documentation of EventMachine::Protocols::HttpClient for information +on the object returned by #request.) + +In this code, we make a call to HttpClient#request, which immediately returns +a Deferrable object. In the background, an HTTP client request is being made +to www.example.com, although your code will continue to run concurrently. + +At some future point, the HTTP client request will complete, and the code in +EM::Protocols::HttpClient will process either a valid HTTP response (including +returned content), or an error. + +At that point, EM::Protocols::HttpClient will call +EM::Deferrable#set_deferred_status on the Deferrable object that was returned +to your program, as the return value from EM::Protocols::HttpClient.request. +You don't have to do anything to make this happen. All you have to do is tell +the Deferrable what to do in case of either success, failure, or both. + +In our code sample, we set one callback and one errback. The former will be +called if the HTTP call succeeds, and the latter if it fails. (For +simplicity, we have both of them calling EM#stop to end the program, although +real programs would be very unlikely to do this.) + +Setting callbacks and errbacks is optional. They are handlers to defined +events in the lifecycle of the Deferrable event. It's not an error if you +fail to set either a callback, an errback, or both. But of course your +program will then fail to receive those notifications. + +If through some bug it turns out that #set_deferred_status is never called +on a Deferrable object, then that object's callbacks or errbacks will NEVER +be called. It's also possible to set a timeout on a Deferrable. If the +timeout elapses before any other call to #set_deferred_status, the Deferrable +object will behave as is you had called set_deferred_status(:failed) on it. + + +Now let's modify the example to illustrate some additional points: + + require 'eventmachine' + + EM.run { + df = EM::Protocols::HttpClient.request( :host=>"www.example.com", + :request=>"/index.html" ) + + df.callback {|response| + df.set_deferred_status :succeeded, response[:content] + } + + df.callback {|string| + puts "Succeeded: #{string}" + EM.stop + } + + df.errback {|response| + puts "ERROR: #{response[:status]}" + EM.stop + } + } + + +Just for the sake of illustration, we've now set two callbacks instead of +one. If the deferrable operation (the HTTP client-request) succeeds, then +both of the callbacks will be executed in order. + +But notice that we've also made our own call to #set_deferred_status in the +first callback. This isn't required, because the HttpClient implementation +already made a call to #set_deferred_status. (Otherwise, of course, the +callback would not be executing.) + +But we used #set_deferred_status in the first callback in order to change the +parameters that will be sent to subsequent callbacks in the chain. In this +way, you can construct powerful sequences of layered functionality. If you +want, you can even change the status of the Deferrable from :succeeded to +:failed, which would abort the chain of callback calls, and invoke the chain +of errbacks instead. + +Now of course it's somewhat trivial to define two callbacks in the same +method, even with the parameter-changing effect we just described. It would +be much more interesting to pass the Deferrable to some other function (for +example, a function defined in another module or a different gem), that would +in turn add callbacks and/or errbacks of its own. That would illustrate the +true power of the Deferrable pattern: to isolate the HTTP client-request +from other functions that use the data that it returns without caring where +those data came from. + +Remember that you can add a callback or an errback to a Deferrable at any +point in time, regardless of whether the status of the deferred operation is +known (more precisely, regardless of when #set_deferred_status is called on +the object). Even hours or days later. + +When you add a callback or errback to a Deferrable object on which +#set_deferred_status has not yet been called, the callback/errback is queued +up for future execution, inside the Deferrable object. When you add a +callback or errback to a Deferrable on which #set_deferred_status has +already been called, the callback/errback will be executed immediately. +Your code doesn't have to worry about the ordering, and there are no timing +issues, as there would be with a threaded approach. + +For more information on Deferrables and their typical usage patterns, look +in the EM unit tests. There are also quite a few sugarings (including +EM::Deferrable#future) that make typical Deferrable usages syntactically +easier to work with. + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/EPOLL b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/EPOLL new file mode 100644 index 000000000..13cea8f41 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/EPOLL @@ -0,0 +1,141 @@ +EventMachine now supports epoll, bringing large increases in performance and scalability to Ruby programs. + +Epoll(7) is a alternative mechanism for multiplexed I/O that is available in Linux 2.6 kernels. +It features significantly greater performance than the standard select(2) mechanism, when used in +applications that require very large numbers of open I/O descriptors. + +EventMachine has always used select(2) because its behavior is well standardized and broadly supported. +But select becomes unreasonably slow when a program has a +very large number of file descriptors or sockets. Ruby's version of select hardcodes a limit +of 1024 descriptors per process, but heavily loaded processes will start to show performance +degradation even after only a few hundred descriptors are in use. + +Epoll is an extended version of the poll(2) call, and it solves the problems with select. Programs +based on epoll can easily scale past Ruby's 1024-descriptor limit, potentially to tens of thousands +of connectors, with no significant impact on performance. + +(Another alternative which is very similar to epoll in principle is kqueue, supplied on BSD and its +variants.) + + + +This note shows you how to use epoll in your programs. + +=== Compiling EventMachine to use epoll. + +You don't have to do anything to get epoll support in EventMachine. +When you compile EventMachine on a platform that supports epoll, EM will +automatically generate a Makefile that includes epoll. (At this writing, this will only work +on Linux 2.6 kernels.) If you compile EM on a platform without epoll, then epoll support will +be omitted from the Makefile, and EM will work just as it always has. + +=== Using epoll in your programs. + +First, you need to tell EventMachine to use epoll instead of select (but see below, as this requirement +will be removed in a future EventMachine version). Second, you need to prepare your program to use +more than 1024 descriptors, an operation that generally requires superuser privileges. Third, you will probably +want your process to drop the superuser privileges after you increase your process's descriptor limit. + +=== Using EventMachine#epoll + +Call the method EventMachine#epoll anytime before you call EventMachine#run, and your program will +automatically use epoll, if available. It's safe to call EventMachine#epoll on any platform because +it compiles to a no-op on platforms that don't support epoll. + + require 'rubygems' + require 'eventmachine' + + EM.epoll + EM.run { + ... + } + + +EventMachine#epoll was included in this initial release only to avoid changing the behavior of existing +programs. However, it's expected that a future release of EM will convert EventMachine#epoll to a no-op, +and run epoll by default on platforms that support it. + +=== Using EventMachine#set_descriptor_table_size + +In Linux (as in every Unix-like platform), every process has a internal table that determines the maximum +number of file and socket descriptors you may have open at any given time. The size of this table is +generally fixed at 1024, although it may be increased within certain system-defined hard and soft limits. + +If you want your EventMachine program to support more than 1024 total descriptors, you must use +EventMachine#set_descriptor_table_size, as follows: + + require 'rubygems' + require 'eventmachine' + + new_size = EM.set_descriptor_table_size( 60000 ) + $>.puts "New descriptor-table size is #{new_size}" + + EM.run { + ... + } + +If successful, this example will increase the maximum number of descriptors that epoll can use to 60,000. +Call EventMachine#set_descriptor_table_size without an argument at any time to find out the current +size of the descriptor table. + +Using EventMachine#set_descriptor_table_size ONLY affects the number of descriptors that can be used +by epoll. It has no useful effect on platforms that don't support epoll, and it does NOT increase the +number of descriptors that Ruby's own I/O functions can use. + +#set_descriptor_table_size can fail if your process is not running as superuser, or if you try to set a +table size that exceeds the hard limits imposed by your system. In the latter case, try a smaller number. + + +=== Using EventMachine#set_effective_user + +In general, you must run your program with elevated or superuser privileges if you want to increase +your descriptor-table size beyond 1024 descriptors. This is easy enough to verify. Try running the +sample program given above, that increases the descriptor limit to 60,000. You will probably find that +the table size will not be increased if you don't run your program as root or with elevated privileges. + +But of course network servers, especially long-running ones, should not run with elevated privileges. +You will want to drop superuser privileges as soon as possible after initialization. To do this, +use EventMachine#set_effective_user: + + require 'rubygems' + require 'eventmachine' + + # (Here, program is running as superuser) + + EM.set_descriptor_table_size( 60000 ) + EM.set_effective_user( "nobody" ) + # (Here, program is running as nobody) + + EM.run { + ... + } + +Of course, you will need to replace "nobody" in the example with the name of an unprivileged user +that is valid on your system. What if you want to drop privileges after opening a server socket +on a privileged (low-numbered) port? Easy, just call #set_effective_user after opening your sockets: + + require 'rubygems' + require 'eventmachine' + + # (Here, program is running as superuser) + + EM.set_descriptor_table_size( 60000 ) + + EM.run { + EM.start_server( "0.0.0.0", 80, MyHttpServer ) + EM.start_server( "0.0.0.0", 443, MyEncryptedHttpServer ) + + EM.set_effective_user( "nobody" ) + # (Here, program is running as nobody) + + ... + } + + +Because EventMachine#set_effective_user is used to enforce security +requirements, it has no nonfatal errors. If you try to set a nonexistent or invalid effective user, +#set_effective_user will abort your program, rather than continue to run with elevated privileges. + +EventMachine#set_effective_user is a silent no-op on platforms that don't support it, such as Windows. + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/INSTALL b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/INSTALL new file mode 100644 index 000000000..dee2e4294 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/INSTALL @@ -0,0 +1,13 @@ +If you have obtained an EventMachine source-tarball (.tar.gz): +unzip and untar the tarball, and enter the directory that is +created. In that directory, say: +ruby setup.rb +(You may need to be root to execute this command.) + +To create documentation for EventMachine, simply type: +rake rdoc +in the distro directory. Rdocs will be created in subdirectory rdoc. + +If you have obtained a gem version of EventMachine, install it in the +usual way (gem install eventmachine). You may need superuser privileges +to execute this command. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/KEYBOARD b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/KEYBOARD new file mode 100644 index 000000000..6c699e498 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/KEYBOARD @@ -0,0 +1,42 @@ +EventMachine (EM) can respond to keyboard events. This gives your event-driven +programs the ability to respond to input from local users. + +Programming EM to handle keyboard input in Ruby is simplicity itself. Just use +EventMachine#open_keyboard, and supply the name of a Ruby module or class that +will receive the input: + + require 'rubygems' + require 'eventmachine' + + module MyKeyboardHandler + def receive_data keystrokes + puts "I received the following data from the keyboard: #{keystrokes}" + end + end + + EM.run { + EM.open_keyboard(MyKeyboardHandler) + } + +If you want EM to send line-buffered keyboard input to your program, just +include the LineText2 protocol module in your handler class or module: + + require 'rubygems' + require 'eventmachine' + + module MyKeyboardHandler + include EM::Protocols::LineText2 + def receive_line data + puts "I received the following line from the keyboard: #{data}" + end + end + + EM.run { + EM.open_keyboard(MyKeyboardHandler) + } + +As we said, simplicity itself. You can call EventMachine#open_keyboard at any +time while the EM reactor loop is running. In other words, the method +invocation may appear anywhere in an EventMachine#run block, or in any code +invoked in the #run block. + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/LEGAL b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/LEGAL new file mode 100644 index 000000000..ee018255d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/LEGAL @@ -0,0 +1,25 @@ +LEGAL NOTICE INFORMATION +------------------------ + +EventMachine is Copyright (C) 2006-07 by Francis Cianfrocca. + +EventMachine is copyrighted software owned by Francis Cianfrocca +(blackhedd ... gmail.com). You may redistribute and/or modify this +software as long as you comply with either the terms of the GPL +(see the file GPL), or Ruby's license (see the file COPYING). + +Your use of all the files in this distribution is controlled by these +license terms, except for those files specifically mentioned below: + + + +setup.rb + This file is Copyright (C) 2000-2005 by Minero Aoki + You can distribute/modify this file under the terms of + the GNU LGPL, Lesser General Public License version 2.1. + + +lib/em/buftok.rb + This file is Copyright (C) 2007 by Tony Arcieri. This file is + covered by the terms of Ruby's License (see the file COPYING). + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/LIGHTWEIGHT_CONCURRENCY b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/LIGHTWEIGHT_CONCURRENCY new file mode 100644 index 000000000..3c2cfa039 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/LIGHTWEIGHT_CONCURRENCY @@ -0,0 +1,130 @@ +EventMachine (EM) adds two different formalisms for lightweight concurrency to +the Ruby programmer's toolbox: spawned processes and deferrables. This note +will show you how to use them. + + +=== What is Lightweight Concurrency? + +We use the term "Lightweight Concurrency" (LC) to refer to concurrency +mechanisms that are lighter than Ruby threads. By "lighter," we mean: less +resource-intensive in one or more dimensions, usually including memory and +CPU usage. In general, you turn to LC in the hope of improving the +performance and scalability of your programs. + +In addition to the two EventMachine mechanisms we will discuss here, Ruby +has at least one other LC construct: Fibers, which are currently under +development in Ruby 1.9. + +The technical feature that makes all of these LC mechanisms different from +standard Ruby threads is that they are not scheduled automatically. + +When you create and run Ruby threads, you can assume (within certain +constraints) that your threads will all be scheduled fairly by Ruby's runtime. +Ruby itself is responsible for giving each of your threads its own share of +the total runtime. + +But with LC, your program is responsible for causing different execution +paths to run. In effect, your program has to act as a "thread scheduler." +Scheduled entities in LC run to completion and are never preempted. The +runtime system has far less work to do since it has no need to interrupt +threads or to schedule them fairly. This is what makes LC lighter and faster. + +You'll learn exactly how LC scheduling works in practice as we work through +specific examples. + + +=== EventMachine Lightweight Concurrency + +Recall that EM provides a reactor loop that must be running in order for +your programs to perform event-driven logic. An EM program typically has a +structure like this: + + require 'eventmachine' + + # your initializations + + EM.run { + # perform event-driven I/O here, including network clients, + # servers, timers, and thread-pool operations. + } + + # your cleanup + # end of the program + + +EventMachine#run executes the reactor loop, which causes your code to be +called as events of interest to your program occur. The block you pass to +EventMachine#run is executed right after the reactor loop starts, and is +the right place to start socket acceptors, etc. + +Because the reactor loop runs constantly in an EM program (until it is +stopped by a call to EventMachine#stop), it has the ability to schedule +blocks of code for asynchronous execution. Unlike a pre-emptive thread +scheduler, it's NOT able to interrupt code blocks while they execute. But +the scheduling capability it does have is enough to enable lightweight +concurrency. + + +For information on Spawned Processes, see the separate document +SPAWNED_PROCESSES. + +For information on Deferrables, see the separate document DEFERRABLES. + + +=== [SIDEBAR]: I Heard That EventMachine Doesn't Work With Ruby Threads. + +This is incorrect. EM is fully interoperable with all versions of Ruby +threads, and has been since its earliest releases. + +It's very true that EM encourages an "evented" (non-threaded) programming +style. The specific benefits of event-driven programming are far better +performance and scalability for well-written programs, and far easier +debugging. + +The benefit of using threads for similar applications is a possibly more +intuitive programming model, as well as the fact that threads are already +familiar to most programmers. Also, bugs in threaded programs often fail +to show up until programs go into production. These factors create the +illusion that threaded programs are easier to write. + +However, some operations that occur frequently in professional-caliber +applications simply can't be done without threads. (The classic example +is making calls to database client-libraries that block on network I/O +until they complete.) + +EventMachine not only allows the use of Ruby threads in these cases, but +it even provides a built-in thread-pool object to make them easier to +work with. + +You may have heard a persistent criticism that evented I/O is fundamentally +incompatible with Ruby threads. It is true that some well-publicized attempts +to incorporate event-handling libraries into Ruby were not successful. But +EventMachine was designed from the ground up with Ruby compatibility in mind, +so EM never suffered from the problems that defeated the earlier attempts. + + +=== [SIDEBAR]: I Heard That EventMachine Doesn't Work Very Well On Windows. + +This too is incorrect. EventMachine is an extension written in C++ and Java, +and therefore it requires compilation. Many Windows computers (and some Unix +computers, especially in production environments) don't have a build stack. +Attempting to install EventMachine on a machine without a compiler usually +produces a confusing error. + +In addition, Ruby has a much-debated issue with Windows compiler versions. +Ruby on Windows works best with Visual Studio 6, a compiler version that is +long out-of-print, no longer supported by Microsoft, and difficult to obtain. +(This problem is not specific to EventMachine.) + +Shortly after EventMachine was first released, the compiler issues led to +criticism that EM was incompatible with Windows. Since that time, every +EventMachine release has been supplied in a precompiled binary form for +Windows users, that does not require you to compile the code yourself. EM +binary Gems for Windows are compiled using Visual Studio 6. + +EventMachine does supply some advanced features (such as Linux EPOLL support, +reduced-privilege operation, UNIX-domain sockets, etc.) that have no +meaningful implementation on Windows. Apart from these special cases, all EM +functionality (including lightweight concurrency) works perfectly well on +Windows. + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/PURE_RUBY b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/PURE_RUBY new file mode 100644 index 000000000..157d59ebb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/PURE_RUBY @@ -0,0 +1,75 @@ +EventMachine is supplied in three alternative versions. + +1) A version that includes a Ruby extension written in C++. This version requires compilation; +2) A version for JRuby that contains a precompiled JAR file written in Java; +3) A pure Ruby version that has no external dependencies and can run in any Ruby environment. + +The Java version of EventMachine is packaged in a distinct manner and must be installed using a +special procedure. This version is described fully in a different document, and not considered +further here. + +The C++ and pure-Ruby versions, however, are shipped in the same distribution. You use the same +files (either tarball or Ruby gem) to install both of these versions. + +If you intend to use the C++ version, you must successfully compile EventMachine after you install it. +(The gem installation attempts to perform this step automatically.) + +If you choose not to compile the EventMachine C++ extension, or if your compilation fails for any +reason, you still have a fully-functional installation of the pure-Ruby version of EM. + +However, for technical reasons, a default EM installation (whether or not the compilation succeeds) +will always assume that the compiled ("extension") implementation should be used. + +If you want your EM program to use the pure Ruby version, you must specifically request it. There +are two ways to do this: by setting either a Ruby global variable, or an environment string. + +The following code will invoke the pure-Ruby implementation of EM: + + $eventmachine_library = :pure_ruby + require 'eventmachine' + + EM.library_type #=> "pure_ruby" + +Notice that this requires a code change and is not the preferred way to select pure Ruby, unless +for some reason you are absolutely sure you will never want the compiled implementation. + +Setting the following environment string has the same effect: + + export EVENTMACHINE_LIBRARY="pure_ruby" + +This technique gives you the flexibility to select either version at runtime with no code changes. + +Support + +The EventMachine development team has committed to support precisely the same APIs for all the +various implementations of EM. + +This means that you can expect any EM program to behave identically, whether you use pure Ruby, +the compiled C++ extension, or JRuby. Deviations from this behavior are to be considered bugs +and should be reported as such. + +There is a small number of exceptions to this rule, which arise from underlying platform +distinctions. Notably, EM#epoll is a silent no-op in the pure Ruby implementation. + + +When Should You Use the Pure-Ruby Implementation of EM? + + +Use the pure Ruby implementation of EM when you must support a platform for which no C++ compiler +is available, or on which the standard EM C++ code can't be compiled. + +Keep in mind that you don't need a C++ compiler in order to deploy EM applications that rely on +the compiled version, so long as appropriate C++ runtime libraries are available on the target platform. + +In extreme cases, you may find that you can develop software with the compiled EM version, but are +not allowed to install required runtime libraries on the deployment system(s). This would be another +case in which the pure Ruby implementation can be useful. + +In general you should avoid the pure Ruby version of EM when performance and scalability are important. +EM in pure Ruby will necessarily run slower than the compiled version. Depending on your application +this may or may not be a key issue. + +Also, since EPOLL is not supported in pure Ruby, your applications will be affected by Ruby's built-in +limit of 1024 file and socket descriptors that may be open in a single process. For maximum scalability +and performance, always use EPOLL if possible. + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/RELEASE_NOTES b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/RELEASE_NOTES new file mode 100644 index 000000000..6110820ac --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/RELEASE_NOTES @@ -0,0 +1,94 @@ +RUBY/EventMachine RELEASE NOTES + +-------------------------------------------------- +Version: 0.9.0, released xxXXX07 +Added Erlang-like distributed-computing features + +-------------------------------------------------- +Version: 0.8.0, released 23Jun07 +Added an epoll implementation for Linux 2.6 kernels. +Added evented #popen. + +-------------------------------------------------- +Version: 0.7.3, released 22May07 +Added a large variety of small features. See the ChangeLog. + +-------------------------------------------------- +Version: 0.7.1, released xxNov06 +Added protocol handlers for line-oriented protocols. +Various bug fixes. + +-------------------------------------------------- +Version: 0.7.0, released 20Nov06 +Added a fix in em.cpp/ConnectToServer to fix a fatal exception that +occurred in FreeBSD when connecting successfully to a remote server. + +-------------------------------------------------- +Version: 0.6.0, released xxJul06 +Added deferred operations, suggested by Don Stocks, amillionhitpoints@yahoo.com. + +-------------------------------------------------- +Version: 0.5.4, released xxJun06 +Added get_peername support for streams and datagrams. + +-------------------------------------------------- +Version: 0.5.3, released 17May06 +Fixed bugs in extconf.rb, thanks to Daniel Harple, dharple@generalconsumption.org. +Added proper setup.rb and rake tasks, thanks to Austin Ziegler. +Fixed a handful of reported problems with builds on various platforms. + +-------------------------------------------------- +Version: 0.5.2, released 05May06 +Made several nonvisible improvements to the Windows +implementation. +Added an exception-handling patch contributed by Jeff Rose, jeff@rosejn.net. +Added a dir-config patch contributed anonymously. +Supported builds on Solaris. + +-------------------------------------------------- +Version: 0.5.1, released 05May06 +Made it possible to pass a Class rather than a Module +to a protocol handler. +Added Windows port. + +-------------------------------------------------- +Version: 0.5.0, released 30Apr06 +Added a preliminary SSL/TLS extension. This will probably +change over the next few releases. + +-------------------------------------------------- +Version: 0.4.5, released 29Apr06 +Changed ext files so the ruby.h is installed after unistd.h +otherwise it doesn't compile on gcc 4.1 + +-------------------------------------------------- +Version: 0.4.2, released 19Apr06 +Changed the Ruby-glue so the extension will play nicer +in the sandbox with Ruby threads. +Added an EventMachine::run_without_threads API to +switch off the thread-awareness for better performance +in programs that do not spin any Ruby threads. + +-------------------------------------------------- +Version: 0.4.1, released 15Apr06 +Reworked the shared-object interface to make it easier to +use EventMachine from languages other than Ruby. + +-------------------------------------------------- +Version: 0.3.2, released 12Apr06 +Added support for a user-supplied block in EventMachine#connect. + +-------------------------------------------------- +Version: 0.3.1, released 11Apr06 +Fixed bug that prevented EventMachine from being run multiple +times in a single process. + +-------------------------------------------------- +Version: 0.3.0, released 10Apr06 +Added method EventHandler::Connection::post_init + +-------------------------------------------------- +Version: 0.2.0, released 10Apr06 +Added method EventHandler::stop + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/SMTP b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/SMTP new file mode 100644 index 000000000..92bf3110e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/SMTP @@ -0,0 +1,4 @@ +This note details the usage of EventMachine's built-in support for SMTP. EM +supports both client and server connections, which will be described in +separate sections. + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/SPAWNED_PROCESSES b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/SPAWNED_PROCESSES new file mode 100644 index 000000000..ee68e3e85 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/SPAWNED_PROCESSES @@ -0,0 +1,148 @@ +EventMachine (EM) adds two different formalisms for lightweight concurrency +to the Ruby programmer's toolbox: spawned processes and deferrables. This +note will show you how to use spawned processes. For more information, see +the separate document LIGHTWEIGHT_CONCURRENCY. + + +=== What are Spawned Processes? + +Spawned Processes in EventMachine are inspired directly by the "processes" +found in the Erlang programming language. EM deliberately borrows much (but +not all) of Erlang's terminology. However, EM's spawned processes differ from +Erlang's in ways that reflect not only Ruby style, but also the fact that +Ruby is not a functional language like Erlang. + +Let's proceed with a complete, working code sample that we will analyze line +by line. Here's an EM implementation of the "ping-pong" program that also +appears in the Erlang tutorial: + + + require 'eventmachine' + + EM.run { + pong = EM.spawn {|x, ping| + puts "Pong received #{x}" + ping.notify( x-1 ) + } + + ping = EM.spawn {|x| + if x > 0 + puts "Pinging #{x}" + pong.notify x, self + else + EM.stop + end + } + + ping.notify 3 + } + +If you run this program, you'll see the following output: + + Pinging 3 + Pong received 3 + Pinging 2 + Pong received 2 + Pinging 1 + Pong received 1 + +Let's take it step by step. + +EventMachine#spawn works very much like the built-in function spawn in +Erlang. It returns a reference to a Ruby object of class +EventMachine::SpawnedProcess, which is actually a schedulable entity. In +Erlang, the value returned from spawn is called a "process identifier" or +"pid." But we'll refer to the Ruby object returned from EM#spawn simply as a +"spawned process." + +You pass a Ruby block with zero or more parameters to EventMachine#spawn. +Like all Ruby blocks, this one is a closure, so it can refer to variables +defined in the local context when you call EM#spawn. + +However, the code block passed to EM#spawn does NOT execute immediately by +default. Rather, it will execute only when the Spawned Object is "notified." +In Erlang, this process is called "message passing," and is done with the +operator !, but in Ruby it's done simply by calling the #notify method of a +spawned-process object. The parameters you pass to #notify must match those +defined in the block that was originally passed to EM#spawn. + +When you call the #notify method of a spawned-process object, EM's reactor +core will execute the code block originally passed to EM#spawn, at some point +in the future. (#notify itself merely adds a notification to the object's +message queue and ALWAYS returns immediately.) + +When a SpawnedProcess object executes a notification, it does so in the +context of the SpawnedProcess object itself. The notified code block can see +local context from the point at which EM#spawn was called. However, the value +of "self" inside the notified code block is a reference to the SpawnedProcesss +object itself. + +An EM spawned process is nothing more than a Ruby object with a message +queue attached to it. You can have any number of spawned processes in your +program without compromising scalability. You can notify a spawned process +any number of times, and each notification will cause a "message" to be +placed in the queue of the spawned process. Spawned processes with non-empty +message queues are scheduled for execution automatically by the EM reactor. +Spawned processes with no visible references are garbage-collected like any +other Ruby object. + +Back to our code sample: + + pong = EM.spawn {|x, ping| + puts "Pong received #{x}" + ping.notify( x-1 ) + } + +This simply creates a spawned process and assigns it to the local variable +pong. You can see that the spawned code block takes a numeric parameter and a +reference to another spawned process. When pong is notified, it expects to +receive arguments corresponding to these two parameters. It simply prints out +the number it receives as the first argument. Then it notifies the spawned +process referenced by the second argument, passing it the first argument +minus 1. + +And then the block ends, which is crucial because otherwise nothing else +can run. (Remember that in LC, scheduled entities run to completion and are +never preempted.) + +On to the next bit of the code sample: + + ping = EM.spawn {|x| + if x > 0 + puts "Pinging #{x}" + pong.notify x, self + else + EM.stop + end + } + +Here, we're spawning a process that takes a single (numeric) parameter. If +the parameter is greater than zero, the block writes it to the console. It +then notifies the spawned process referenced by the pong local variable, +passing as arguments its number argument, and a reference to itself. The +latter reference, as you saw above, is used by pong to send a return +notification. + +If the ping process receives a zero value, it will stop the reactor loop and +end the program. + +Now we've created a pair of spawned processes, but nothing else has happened. +If we stop now, the program will spin in the EM reactor loop, doing nothing +at all. Our spawned processes will never be scheduled for execution. + +But look at the next line in the code sample: + + ping.notify 3 + +This line gets the ping-pong ball rolling. We call ping's #notify method, +passing the argument 3. This causes a message to be sent to the ping spawned +process. The message contains the single argument, and it causes the EM +reactor to schedule the ping process. And this in turn results in the +execution of the Ruby code block passed to EM#spawn when ping was created. +Everything else proceeds as a result of the messages that are subsequently +passed to each other by the spawned processes. + +[TODO, present the outbound network i/o use case, and clarify that spawned +processes are interleaved with normal i/o operations and don't interfere +with them at all. Also, blame Erlang for the confusing term "process"] + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/TODO b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/TODO new file mode 100644 index 000000000..686a0d53d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/docs/old/TODO @@ -0,0 +1,8 @@ +TODO List: + +12Aug06: Noticed by Don Stocks. A TCP connect-request that results +in a failed DNS resolution fires a fatal error back to user code. +Uuuuuugly. We should probably cause an unbind event to get fired +instead, and add some parameterization so the caller can detect +the nature of the failure. + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/eventmachine.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/eventmachine.gemspec new file mode 100644 index 000000000..dafc1890c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/eventmachine.gemspec @@ -0,0 +1,34 @@ +# -*- encoding: utf-8 -*- +require File.expand_path('../lib/em/version', __FILE__) + +Gem::Specification.new do |s| + s.name = 'eventmachine' + s.version = EventMachine::VERSION + s.homepage = 'http://rubyeventmachine.com' + s.rubyforge_project = 'eventmachine' + + s.authors = ["Francis Cianfrocca", "Aman Gupta"] + s.email = ["garbagecat10@gmail.com", "aman@tmm1.net"] + + s.files = `git ls-files`.split("\n") + s.extensions = ["ext/extconf.rb", "ext/fastfilereader/extconf.rb"] + + s.add_development_dependency 'rake-compiler', '~> 0.8.1' + s.add_development_dependency 'yard', ">= 0.7.2" + #s.add_development_dependency 'bluecloth' + + s.summary = 'Ruby/EventMachine library' + s.description = "EventMachine implements a fast, single-threaded engine for arbitrary network +communications. It's extremely easy to use in Ruby. EventMachine wraps all +interactions with IP sockets, allowing programs to concentrate on the +implementation of network protocols. It can be used to create both network +servers and clients. To create a server or client, a Ruby program only needs +to specify the IP address and port, and provide a Module that implements the +communications protocol. Implementations of several standard network protocols +are provided with the package, primarily to serve as examples. The real goal +of EventMachine is to enable programs to easily interface with other programs +using TCP/IP, especially if custom protocols are required." + + s.rdoc_options = ["--title", "EventMachine", "--main", "README.md", "-x", "lib/em/version", "-x", "lib/jeventmachine"] + s.extra_rdoc_files = ["README.md"] + `git ls-files -- docs/*`.split("\n") +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/01_eventmachine_echo_server.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/01_eventmachine_echo_server.rb new file mode 100644 index 000000000..51c5c7db1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/01_eventmachine_echo_server.rb @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby + +require 'rubygems' # or use Bundler.setup +require 'eventmachine' + +class EchoServer < EM::Connection + def receive_data(data) + send_data(data) + end +end + +EventMachine.run do + # hit Control + C to stop + Signal.trap("INT") { EventMachine.stop } + Signal.trap("TERM") { EventMachine.stop } + + EventMachine.start_server("0.0.0.0", 10000, EchoServer) +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/02_eventmachine_echo_server_that_recognizes_exit_command.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/02_eventmachine_echo_server_that_recognizes_exit_command.rb new file mode 100644 index 000000000..4cfff19b4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/02_eventmachine_echo_server_that_recognizes_exit_command.rb @@ -0,0 +1,22 @@ +#!/usr/bin/env ruby + +require 'rubygems' # or use Bundler.setup +require 'eventmachine' + +class EchoServer < EM::Connection + def receive_data(data) + if data.strip =~ /exit$/i + EventMachine.stop + else + send_data(data) + end + end +end + +EventMachine.run do + # hit Control + C to stop + Signal.trap("INT") { EventMachine.stop } + Signal.trap("TERM") { EventMachine.stop } + + EventMachine.start_server("0.0.0.0", 10000, EchoServer) +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/03_simple_chat_server.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/03_simple_chat_server.rb new file mode 100644 index 000000000..3352551e0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/03_simple_chat_server.rb @@ -0,0 +1,149 @@ +#!/usr/bin/env ruby + +require 'rubygems' # or use Bundler.setup +require 'eventmachine' + +class SimpleChatServer < EM::Connection + + @@connected_clients = Array.new + DM_REGEXP = /^@([a-zA-Z0-9]+)\s*:?\s*(.+)/.freeze + + attr_reader :username + + + # + # EventMachine handlers + # + + def post_init + @username = nil + + puts "A client has connected..." + ask_username + end + + def unbind + @@connected_clients.delete(self) + puts "[info] #{@username} has left" if entered_username? + end + + def receive_data(data) + if entered_username? + handle_chat_message(data.strip) + else + handle_username(data.strip) + end + end + + + # + # Username handling + # + + def entered_username? + !@username.nil? && !@username.empty? + end # entered_username? + + def handle_username(input) + if input.empty? + send_line("Blank usernames are not allowed. Try again.") + ask_username + else + @username = input + @@connected_clients.push(self) + self.other_peers.each { |c| c.send_data("#{@username} has joined the room\n") } + puts "#{@username} has joined" + + self.send_line("[info] Ohai, #{@username}") + end + end # handle_username(input) + + def ask_username + self.send_line("[info] Enter your username:") + end # ask_username + + + # + # Message handling + # + + def handle_chat_message(msg) + if command?(msg) + self.handle_command(msg) + else + if direct_message?(msg) + self.handle_direct_message(msg) + else + self.announce(msg, "#{@username}:") + end + end + end # handle_chat_message(msg) + + def direct_message?(input) + input =~ DM_REGEXP + end # direct_message?(input) + + def handle_direct_message(input) + username, message = parse_direct_message(input) + + if connection = @@connected_clients.find { |c| c.username == username } + puts "[dm] @#{@username} => @#{username}" + connection.send_line("[dm] @#{@username}: #{message}") + else + send_line "@#{username} is not in the room. Here's who is: #{usernames.join(', ')}" + end + end # handle_direct_message(input) + + def parse_direct_message(input) + return [$1, $2] if input =~ DM_REGEXP + end # parse_direct_message(input) + + + # + # Commands handling + # + + def command?(input) + input =~ /(exit|status)$/i + end # command?(input) + + def handle_command(cmd) + case cmd + when /exit$/i then self.close_connection + when /status$/i then self.send_line("[chat server] It's #{Time.now.strftime('%H:%M')} and there are #{self.number_of_connected_clients} people in the room") + end + end # handle_command(cmd) + + + # + # Helpers + # + + def announce(msg = nil, prefix = "[chat server]") + @@connected_clients.each { |c| c.send_line("#{prefix} #{msg}") } unless msg.empty? + end # announce(msg) + + def number_of_connected_clients + @@connected_clients.size + end # number_of_connected_clients + + def other_peers + @@connected_clients.reject { |c| self == c } + end # other_peers + + def send_line(line) + self.send_data("#{line}\n") + end # send_line(line) + + def usernames + @@connected_clients.map { |c| c.username } + end # usernames +end + +EventMachine.run do + # hit Control + C to stop + Signal.trap("INT") { EventMachine.stop } + Signal.trap("TERM") { EventMachine.stop } + + EventMachine.start_server("0.0.0.0", 10000, SimpleChatServer) +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/04_simple_chat_server_step_one.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/04_simple_chat_server_step_one.rb new file mode 100644 index 000000000..bb283a7a2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/04_simple_chat_server_step_one.rb @@ -0,0 +1,27 @@ +#!/usr/bin/env ruby + +require 'rubygems' # or use Bundler.setup +require 'eventmachine' + +class SimpleChatServer < EM::Connection + + # + # EventMachine handlers + # + + def post_init + puts "A client has connected..." + end + + def unbind + puts "A client has left..." + end +end + +EventMachine.run do + # hit Control + C to stop + Signal.trap("INT") { EventMachine.stop } + Signal.trap("TERM") { EventMachine.stop } + + EventMachine.start_server("0.0.0.0", 10000, SimpleChatServer) +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/05_simple_chat_server_step_two.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/05_simple_chat_server_step_two.rb new file mode 100644 index 000000000..1361c5da5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/05_simple_chat_server_step_two.rb @@ -0,0 +1,43 @@ +#!/usr/bin/env ruby + +require 'rubygems' # or use Bundler.setup +require 'eventmachine' + +class SimpleChatServer < EM::Connection + + @@connected_clients = Array.new + + + # + # EventMachine handlers + # + + def post_init + @@connected_clients.push(self) + puts "A client has connected..." + end + + def unbind + @@connected_clients.delete(self) + puts "A client has left..." + end + + + + + # + # Helpers + # + + def other_peers + @@connected_clients.reject { |c| self == c } + end # other_peers +end + +EventMachine.run do + # hit Control + C to stop + Signal.trap("INT") { EventMachine.stop } + Signal.trap("TERM") { EventMachine.stop } + + EventMachine.start_server("0.0.0.0", 10000, SimpleChatServer) +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/06_simple_chat_server_step_three.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/06_simple_chat_server_step_three.rb new file mode 100644 index 000000000..d9b85e215 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/06_simple_chat_server_step_three.rb @@ -0,0 +1,98 @@ +#!/usr/bin/env ruby + +require 'rubygems' # or use Bundler.setup +require 'eventmachine' + +class SimpleChatServer < EM::Connection + + @@connected_clients = Array.new + + + attr_reader :username + + + # + # EventMachine handlers + # + + def post_init + @username = nil + + puts "A client has connected..." + ask_username + end + + def unbind + @@connected_clients.delete(self) + puts "A client has left..." + end + + def receive_data(data) + if entered_username? + handle_chat_message(data.strip) + else + handle_username(data.strip) + end + end + + + + + # + # Username handling + # + + def entered_username? + !@username.nil? && !@username.empty? + end # entered_username? + + def handle_username(input) + if input.empty? + send_line("Blank usernames are not allowed. Try again.") + ask_username + else + @username = input + @@connected_clients.push(self) + self.other_peers.each { |c| c.send_data("#{@username} has joined the room\n") } + puts "#{@username} has joined" + + self.send_line("[info] Ohai, #{@username}") + end + end # handle_username(input) + + def ask_username + self.send_line("[info] Enter your username:") + end # ask_username + + + + # + # Message handling + # + + def handle_chat_message(msg) + raise NotImplementedError + end + + + + # + # Helpers + # + + def other_peers + @@connected_clients.reject { |c| self == c } + end # other_peers + + def send_line(line) + self.send_data("#{line}\n") + end # send_line(line) +end + +EventMachine.run do + # hit Control + C to stop + Signal.trap("INT") { EventMachine.stop } + Signal.trap("TERM") { EventMachine.stop } + + EventMachine.start_server("0.0.0.0", 10000, SimpleChatServer) +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/07_simple_chat_server_step_four.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/07_simple_chat_server_step_four.rb new file mode 100644 index 000000000..d4948af8d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/07_simple_chat_server_step_four.rb @@ -0,0 +1,121 @@ +#!/usr/bin/env ruby + +require 'rubygems' # or use Bundler.setup +require 'eventmachine' + +class SimpleChatServer < EM::Connection + + @@connected_clients = Array.new + + + attr_reader :username + + + # + # EventMachine handlers + # + + def post_init + @username = nil + + puts "A client has connected..." + ask_username + end + + def unbind + @@connected_clients.delete(self) + puts "[info] #{@username} has left" if entered_username? + end + + def receive_data(data) + if entered_username? + handle_chat_message(data.strip) + else + handle_username(data.strip) + end + end + + + + + # + # Username handling + # + + def entered_username? + !@username.nil? && !@username.empty? + end # entered_username? + + def handle_username(input) + if input.empty? + send_line("Blank usernames are not allowed. Try again.") + ask_username + else + @username = input + @@connected_clients.push(self) + self.other_peers.each { |c| c.send_data("#{@username} has joined the room\n") } + puts "#{@username} has joined" + + self.send_line("[info] Ohai, #{@username}") + end + end # handle_username(input) + + def ask_username + self.send_line("[info] Enter your username:") + end # ask_username + + + + # + # Message handling + # + + def handle_chat_message(msg) + if command?(msg) + self.handle_command(msg) + else + self.announce(msg, "#{@username}:") + end + end + + + # + # Commands handling + # + + def command?(input) + input =~ /exit$/i + end # command?(input) + + def handle_command(cmd) + case cmd + when /exit$/i then self.close_connection + end + end # handle_command(cmd) + + + + # + # Helpers + # + + def announce(msg = nil, prefix = "[chat server]") + @@connected_clients.each { |c| c.send_line("#{prefix} #{msg}") } unless msg.empty? + end # announce(msg) + + def other_peers + @@connected_clients.reject { |c| self == c } + end # other_peers + + def send_line(line) + self.send_data("#{line}\n") + end # send_line(line) +end + +EventMachine.run do + # hit Control + C to stop + Signal.trap("INT") { EventMachine.stop } + Signal.trap("TERM") { EventMachine.stop } + + EventMachine.start_server("0.0.0.0", 10000, SimpleChatServer) +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/08_simple_chat_server_step_five.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/08_simple_chat_server_step_five.rb new file mode 100644 index 000000000..03da66bf7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/guides/getting_started/08_simple_chat_server_step_five.rb @@ -0,0 +1,141 @@ +#!/usr/bin/env ruby + +require 'rubygems' # or use Bundler.setup +require 'eventmachine' + +class SimpleChatServer < EM::Connection + + @@connected_clients = Array.new + DM_REGEXP = /^@([a-zA-Z0-9]+)\s*:?\s+(.+)/.freeze + + attr_reader :username + + + # + # EventMachine handlers + # + + def post_init + @username = nil + + puts "A client has connected..." + ask_username + end + + def unbind + @@connected_clients.delete(self) + puts "[info] #{@username} has left" if entered_username? + end + + def receive_data(data) + if entered_username? + handle_chat_message(data.strip) + else + handle_username(data.strip) + end + end + + + # + # Username handling + # + + def entered_username? + !@username.nil? && !@username.empty? + end # entered_username? + + def handle_username(input) + if input.empty? + send_line("Blank usernames are not allowed. Try again.") + ask_username + else + @username = input + @@connected_clients.push(self) + self.other_peers.each { |c| c.send_data("#{@username} has joined the room\n") } + puts "#{@username} has joined" + + self.send_line("[info] Ohai, #{@username}") + end + end # handle_username(input) + + def ask_username + self.send_line("[info] Enter your username:") + end # ask_username + + + # + # Message handling + # + + def handle_chat_message(msg) + if command?(msg) + self.handle_command(msg) + else + if direct_message?(msg) + self.handle_direct_message(msg) + else + self.announce(msg, "#{@username}:") + end + end + end # handle_chat_message(msg) + + def direct_message?(input) + input =~ DM_REGEXP + end # direct_message?(input) + + def handle_direct_message(input) + username, message = parse_direct_message(input) + + if connection = @@connected_clients.find { |c| c.username == username } + puts "[dm] @#{@username} => @#{username}" + connection.send_line("[dm] @#{@username}: #{message}") + else + send_line "@#{username} is not in the room. Here's who is: #{usernames.join(', ')}" + end + end # handle_direct_message(input) + + def parse_direct_message(input) + return [$1, $2] if input =~ DM_REGEXP + end # parse_direct_message(input) + + + # + # Commands handling + # + + def command?(input) + input =~ /(exit|status)$/i + end # command?(input) + + def handle_command(cmd) + case cmd + when /exit$/i then self.close_connection + when /status$/i then self.send_line("[chat server] It's #{Time.now.strftime('%H:%M')} and there are #{self.number_of_connected_clients} people in the room") + end + end # handle_command(cmd) + + + # + # Helpers + # + + def announce(msg = nil, prefix = "[chat server]") + @@connected_clients.each { |c| c.send_line("#{prefix} #{msg}") } unless msg.empty? + end # announce(msg) + + def other_peers + @@connected_clients.reject { |c| self == c } + end # other_peers + + def send_line(line) + self.send_data("#{line}\n") + end # send_line(line) +end + +EventMachine.run do + # hit Control + C to stop + Signal.trap("INT") { EventMachine.stop } + Signal.trap("TERM") { EventMachine.stop } + + EventMachine.start_server("0.0.0.0", 10000, SimpleChatServer) +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/old/ex_channel.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/old/ex_channel.rb new file mode 100644 index 000000000..16e8d083d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/old/ex_channel.rb @@ -0,0 +1,43 @@ +require File.dirname(__FILE__) + '/helper' + +EM.run do + + # Create a channel to push data to, this could be stocks... + RandChannel = EM::Channel.new + + # The server simply subscribes client connections to the channel on connect, + # and unsubscribes them on disconnect. + class Server < EM::Connection + def self.start(host = '127.0.0.1', port = 8000) + EM.start_server(host, port, self) + end + + def post_init + @sid = RandChannel.subscribe { |m| send_data "#{m.inspect}\n" } + end + + def unbind + RandChannel.unsubscribe @sid + end + end + Server.start + + # Two client connections, that just print what they receive. + 2.times do + EM.connect('127.0.0.1', 8000) do |c| + c.extend EM::P::LineText2 + def c.receive_line(line) + puts "Subscriber: #{signature} got #{line}" + end + EM.add_timer(2) { c.close_connection } + end + end + + # This part of the example is more fake, but imagine sleep was in fact a + # long running calculation to achieve the value. + 40.times do + EM.defer lambda { v = sleep(rand * 2); RandChannel << [Time.now, v] } + end + + EM.add_timer(5) { EM.stop } +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/old/ex_queue.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/old/ex_queue.rb new file mode 100644 index 000000000..761ea7643 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/old/ex_queue.rb @@ -0,0 +1,2 @@ +require File.dirname(__FILE__) + '/helper' + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/old/ex_tick_loop_array.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/old/ex_tick_loop_array.rb new file mode 100644 index 000000000..81b0ae3e8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/old/ex_tick_loop_array.rb @@ -0,0 +1,15 @@ +require File.dirname(__FILE__) + '/helper' + +EM.run do + array = (1..100).to_a + + tickloop = EM.tick_loop do + if array.empty? + :stop + else + puts array.shift + end + end + + tickloop.on_stop { EM.stop } +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/old/ex_tick_loop_counter.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/old/ex_tick_loop_counter.rb new file mode 100644 index 000000000..58e51ffd6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/old/ex_tick_loop_counter.rb @@ -0,0 +1,32 @@ +require File.dirname(__FILE__) + '/helper' + +class TickCounter + attr_reader :start_time, :count + + def initialize + reset + @tick_loop = EM.tick_loop(method(:tick)) + end + + def reset + @count = 0 + @start_time = EM.current_time + end + + def tick + @count += 1 + end + + def rate + @count / (EM.current_time - @start_time) + end +end + +period = 5 +EM.run do + counter = TickCounter.new + EM.add_periodic_timer(period) do + puts "Ticks per second: #{counter.rate} (mean of last #{period}s)" + counter.reset + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/old/helper.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/old/helper.rb new file mode 100644 index 000000000..835ded27d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/examples/old/helper.rb @@ -0,0 +1,2 @@ +$:.unshift File.expand_path(File.dirname(__FILE__) + '/../lib') +require 'eventmachine' \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/binder.cpp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/binder.cpp new file mode 100644 index 000000000..1b7d1727e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/binder.cpp @@ -0,0 +1,124 @@ +/***************************************************************************** + +$Id$ + +File: binder.cpp +Date: 07Apr06 + +Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +Gmail: blackhedd + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + +#include "project.h" + +#define DEV_URANDOM "/dev/urandom" + + +map Bindable_t::BindingBag; + + +/******************************** +STATIC Bindable_t::CreateBinding +********************************/ + +unsigned long Bindable_t::CreateBinding() +{ + static unsigned long num = 0; + while(BindingBag[++num]); + return num; +} + +#if 0 +string Bindable_t::CreateBinding() +{ + static int index = 0; + static string seed; + + if ((index >= 1000000) || (seed.length() == 0)) { + #ifdef OS_UNIX + int fd = open (DEV_URANDOM, O_RDONLY); + if (fd < 0) + throw std::runtime_error ("No entropy device"); + + unsigned char u[16]; + size_t r = read (fd, u, sizeof(u)); + if (r < sizeof(u)) + throw std::runtime_error ("Unable to read entropy device"); + + unsigned char *u1 = (unsigned char*)u; + char u2 [sizeof(u) * 2 + 1]; + + for (size_t i=0; i < sizeof(u); i++) + sprintf (u2 + (i * 2), "%02x", u1[i]); + + seed = string (u2); + #endif + + + #ifdef OS_WIN32 + UUID uuid; + UuidCreate (&uuid); + unsigned char *uuidstring = NULL; + UuidToString (&uuid, &uuidstring); + if (!uuidstring) + throw std::runtime_error ("Unable to read uuid"); + seed = string ((const char*)uuidstring); + + RpcStringFree (&uuidstring); + #endif + + index = 0; + + + } + + stringstream ss; + ss << seed << (++index); + return ss.str(); +} +#endif + +/***************************** +STATIC: Bindable_t::GetObject +*****************************/ + +Bindable_t *Bindable_t::GetObject (const unsigned long binding) +{ + map::const_iterator i = BindingBag.find (binding); + if (i != BindingBag.end()) + return i->second; + else + return NULL; +} + + +/********************** +Bindable_t::Bindable_t +**********************/ + +Bindable_t::Bindable_t() +{ + Binding = Bindable_t::CreateBinding(); + BindingBag [Binding] = this; +} + + + +/*********************** +Bindable_t::~Bindable_t +***********************/ + +Bindable_t::~Bindable_t() +{ + BindingBag.erase (Binding); +} + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/binder.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/binder.h new file mode 100644 index 000000000..20817b1a2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/binder.h @@ -0,0 +1,46 @@ +/***************************************************************************** + +$Id$ + +File: binder.h +Date: 07Apr06 + +Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +Gmail: blackhedd + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + +#ifndef __ObjectBindings__H_ +#define __ObjectBindings__H_ + + +class Bindable_t +{ + public: + static unsigned long CreateBinding(); + static Bindable_t *GetObject (const unsigned long); + static map BindingBag; + + public: + Bindable_t(); + virtual ~Bindable_t(); + + const unsigned long GetBinding() {return Binding;} + + private: + unsigned long Binding; +}; + + + + + +#endif // __ObjectBindings__H_ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/cmain.cpp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/cmain.cpp new file mode 100644 index 000000000..b354d2d97 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/cmain.cpp @@ -0,0 +1,876 @@ +/***************************************************************************** + +$Id$ + +File: cmain.cpp +Date: 06Apr06 + +Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +Gmail: blackhedd + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + +#include "project.h" + +/* 21Sep09: ruby 1.9 defines macros for common i/o functions that point to rb_w32_* implementations. + We need to undef the stat to fix a build failure in evma_send_file_data_to_connection. + See http://groups.google.com/group/eventmachine/browse_thread/thread/fc60d9bb738ffc71 +*/ +#if defined(BUILD_FOR_RUBY) && defined(OS_WIN32) +#undef stat +#undef fstat +#endif + +static EventMachine_t *EventMachine; +static int bUseEpoll = 0; +static int bUseKqueue = 0; + +extern "C" void ensure_eventmachine (const char *caller = "unknown caller") +{ + if (!EventMachine) { + const int err_size = 128; + char err_string[err_size]; + snprintf (err_string, err_size, "eventmachine not initialized: %s", caller); + #ifdef BUILD_FOR_RUBY + rb_raise(rb_eRuntimeError, "%s", err_string); + #else + throw std::runtime_error (err_string); + #endif + } +} + +/*********************** +evma_initialize_library +***********************/ + +extern "C" void evma_initialize_library (EMCallback cb) +{ + if (EventMachine) + #ifdef BUILD_FOR_RUBY + rb_raise(rb_eRuntimeError, "eventmachine already initialized: evma_initialize_library"); + #else + throw std::runtime_error ("eventmachine already initialized: evma_initialize_library"); + #endif + EventMachine = new EventMachine_t (cb); + if (bUseEpoll) + EventMachine->_UseEpoll(); + if (bUseKqueue) + EventMachine->_UseKqueue(); +} + + +/******************** +evma_release_library +********************/ + +extern "C" void evma_release_library() +{ + ensure_eventmachine("evma_release_library"); + delete EventMachine; + EventMachine = NULL; +} + + +/**************** +evma_run_machine +****************/ + +extern "C" void evma_run_machine() +{ + ensure_eventmachine("evma_run_machine"); + EventMachine->Run(); +} + + +/************************** +evma_install_oneshot_timer +**************************/ + +extern "C" const unsigned long evma_install_oneshot_timer (int seconds) +{ + ensure_eventmachine("evma_install_oneshot_timer"); + return EventMachine->InstallOneshotTimer (seconds); +} + + +/********************** +evma_connect_to_server +**********************/ + +extern "C" const unsigned long evma_connect_to_server (const char *bind_addr, int bind_port, const char *server, int port) +{ + ensure_eventmachine("evma_connect_to_server"); + return EventMachine->ConnectToServer (bind_addr, bind_port, server, port); +} + +/*************************** +evma_connect_to_unix_server +***************************/ + +extern "C" const unsigned long evma_connect_to_unix_server (const char *server) +{ + ensure_eventmachine("evma_connect_to_unix_server"); + return EventMachine->ConnectToUnixServer (server); +} + +/************** +evma_attach_fd +**************/ + +extern "C" const unsigned long evma_attach_fd (int file_descriptor, int watch_mode) +{ + ensure_eventmachine("evma_attach_fd"); + return EventMachine->AttachFD (file_descriptor, watch_mode ? true : false); +} + +/************** +evma_detach_fd +**************/ + +extern "C" int evma_detach_fd (const unsigned long binding) +{ + ensure_eventmachine("evma_detach_fd"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (binding)); + if (ed) + return EventMachine->DetachFD (ed); + else + #ifdef BUILD_FOR_RUBY + rb_raise(rb_eRuntimeError, "invalid binding to detach"); + #else + throw std::runtime_error ("invalid binding to detach"); + #endif + return -1; +} + +/************************ +evma_get_file_descriptor +************************/ + +extern "C" int evma_get_file_descriptor (const unsigned long binding) +{ + ensure_eventmachine("evma_get_file_descriptor"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (binding)); + if (ed) + return ed->GetSocket(); + else + #ifdef BUILD_FOR_RUBY + rb_raise(rb_eRuntimeError, "invalid binding to get_fd"); + #else + throw std::runtime_error ("invalid binding to get_fd"); + #endif + return -1; +} + +/*********************** +evma_is_notify_readable +***********************/ + +extern "C" int evma_is_notify_readable (const unsigned long binding) +{ + ConnectionDescriptor *cd = dynamic_cast (Bindable_t::GetObject (binding)); + if (cd) + return cd->IsNotifyReadable() ? 1 : 0; + return -1; +} + +/************************ +evma_set_notify_readable +************************/ + +extern "C" void evma_set_notify_readable (const unsigned long binding, int mode) +{ + ConnectionDescriptor *cd = dynamic_cast (Bindable_t::GetObject (binding)); + if (cd) + cd->SetNotifyReadable (mode ? true : false); +} + +/*********************** +evma_is_notify_writable +***********************/ + +extern "C" int evma_is_notify_writable (const unsigned long binding) +{ + ConnectionDescriptor *cd = dynamic_cast (Bindable_t::GetObject (binding)); + if (cd) + return cd->IsNotifyWritable() ? 1 : 0; + return -1; +} + +/************************ +evma_set_notify_writable +************************/ + +extern "C" void evma_set_notify_writable (const unsigned long binding, int mode) +{ + ConnectionDescriptor *cd = dynamic_cast (Bindable_t::GetObject (binding)); + if (cd) + cd->SetNotifyWritable (mode ? true : false); +} + +/********** +evma_pause +**********/ + +extern "C" int evma_pause (const unsigned long binding) +{ + EventableDescriptor *cd = dynamic_cast (Bindable_t::GetObject (binding)); + if (cd) + return cd->Pause() ? 1 : 0; + + return 0; +} + +/*********** +evma_resume +***********/ + +extern "C" int evma_resume (const unsigned long binding) +{ + EventableDescriptor *cd = dynamic_cast (Bindable_t::GetObject (binding)); + if (cd) + return cd->Resume() ? 1 : 0; + + return 0; +} + +/************** +evma_is_paused +**************/ + +extern "C" int evma_is_paused (const unsigned long binding) +{ + EventableDescriptor *cd = dynamic_cast (Bindable_t::GetObject (binding)); + if (cd) + return cd->IsPaused() ? 1 : 0; + + return 0; +} + +/************************ +evma_num_close_scheduled +************************/ + +extern "C" int evma_num_close_scheduled () +{ + return EventMachine->NumCloseScheduled; +} + +/********************** +evma_create_tcp_server +**********************/ + +extern "C" const unsigned long evma_create_tcp_server (const char *address, int port) +{ + ensure_eventmachine("evma_create_tcp_server"); + return EventMachine->CreateTcpServer (address, port); +} + +/****************************** +evma_create_unix_domain_server +******************************/ + +extern "C" const unsigned long evma_create_unix_domain_server (const char *filename) +{ + ensure_eventmachine("evma_create_unix_domain_server"); + return EventMachine->CreateUnixDomainServer (filename); +} + +/************************* +evma_open_datagram_socket +*************************/ + +extern "C" const unsigned long evma_open_datagram_socket (const char *address, int port) +{ + ensure_eventmachine("evma_open_datagram_socket"); + return EventMachine->OpenDatagramSocket (address, port); +} + +/****************** +evma_open_keyboard +******************/ + +extern "C" const unsigned long evma_open_keyboard() +{ + ensure_eventmachine("evma_open_keyboard"); + return EventMachine->OpenKeyboard(); +} + +/******************* +evma_watch_filename +*******************/ + +extern "C" const unsigned long evma_watch_filename (const char *fname) +{ + ensure_eventmachine("evma_watch_filename"); + return EventMachine->WatchFile(fname); +} + +/********************* +evma_unwatch_filename +*********************/ + +extern "C" void evma_unwatch_filename (const unsigned long sig) +{ + ensure_eventmachine("evma_unwatch_file"); + EventMachine->UnwatchFile(sig); +} + +/************** +evma_watch_pid +**************/ + +extern "C" const unsigned long evma_watch_pid (int pid) +{ + ensure_eventmachine("evma_watch_pid"); + return EventMachine->WatchPid(pid); +} + +/**************** +evma_unwatch_pid +****************/ + +extern "C" void evma_unwatch_pid (const unsigned long sig) +{ + ensure_eventmachine("evma_unwatch_pid"); + EventMachine->UnwatchPid(sig); +} + +/**************************** +evma_send_data_to_connection +****************************/ + +extern "C" int evma_send_data_to_connection (const unsigned long binding, const char *data, int data_length) +{ + ensure_eventmachine("evma_send_data_to_connection"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (binding)); + if (ed) + return ed->SendOutboundData(data, data_length); + return -1; +} + +/****************** +evma_send_datagram +******************/ + +extern "C" int evma_send_datagram (const unsigned long binding, const char *data, int data_length, const char *address, int port) +{ + ensure_eventmachine("evma_send_datagram"); + DatagramDescriptor *dd = dynamic_cast (Bindable_t::GetObject (binding)); + if (dd) + return dd->SendOutboundDatagram(data, data_length, address, port); + return -1; +} + + +/********************* +evma_close_connection +*********************/ + +extern "C" void evma_close_connection (const unsigned long binding, int after_writing) +{ + ensure_eventmachine("evma_close_connection"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (binding)); + if (ed) + ed->ScheduleClose (after_writing ? true : false); +} + +/*********************************** +evma_report_connection_error_status +***********************************/ + +extern "C" int evma_report_connection_error_status (const unsigned long binding) +{ + ensure_eventmachine("evma_report_connection_error_status"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (binding)); + if (ed) + return ed->ReportErrorStatus(); + return -1; +} + +/******************** +evma_stop_tcp_server +********************/ + +extern "C" void evma_stop_tcp_server (const unsigned long binding) +{ + ensure_eventmachine("evma_stop_tcp_server"); + AcceptorDescriptor::StopAcceptor (binding); +} + + +/***************** +evma_stop_machine +*****************/ + +extern "C" void evma_stop_machine() +{ + ensure_eventmachine("evma_stop_machine"); + EventMachine->ScheduleHalt(); +} + + +/************** +evma_start_tls +**************/ + +extern "C" void evma_start_tls (const unsigned long binding) +{ + ensure_eventmachine("evma_start_tls"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (binding)); + if (ed) + ed->StartTls(); +} + +/****************** +evma_set_tls_parms +******************/ + +extern "C" void evma_set_tls_parms (const unsigned long binding, const char *privatekey_filename, const char *certchain_filename, int verify_peer) +{ + ensure_eventmachine("evma_set_tls_parms"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (binding)); + if (ed) + ed->SetTlsParms (privatekey_filename, certchain_filename, (verify_peer == 1 ? true : false)); +} + +/****************** +evma_get_peer_cert +******************/ + +#ifdef WITH_SSL +extern "C" X509 *evma_get_peer_cert (const unsigned long binding) +{ + ensure_eventmachine("evma_get_peer_cert"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (binding)); + if (ed) + return ed->GetPeerCert(); + return NULL; +} +#endif + +/******************** +evma_accept_ssl_peer +********************/ + +#ifdef WITH_SSL +extern "C" void evma_accept_ssl_peer (const unsigned long binding) +{ + ensure_eventmachine("evma_accept_ssl_peer"); + ConnectionDescriptor *cd = dynamic_cast (Bindable_t::GetObject (binding)); + if (cd) + cd->AcceptSslPeer(); +} +#endif + +/***************** +evma_get_peername +*****************/ + +extern "C" int evma_get_peername (const unsigned long binding, struct sockaddr *sa, socklen_t *len) +{ + ensure_eventmachine("evma_get_peername"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (binding)); + if (ed) { + return ed->GetPeername (sa, len) ? 1 : 0; + } + else + return 0; +} + +/***************** +evma_get_sockname +*****************/ + +extern "C" int evma_get_sockname (const unsigned long binding, struct sockaddr *sa, socklen_t *len) +{ + ensure_eventmachine("evma_get_sockname"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (binding)); + if (ed) { + return ed->GetSockname (sa, len) ? 1 : 0; + } + else + return 0; +} + +/*********************** +evma_get_subprocess_pid +***********************/ + +extern "C" int evma_get_subprocess_pid (const unsigned long binding, pid_t *pid) +{ + ensure_eventmachine("evma_get_subprocess_pid"); + #ifdef OS_UNIX + PipeDescriptor *pd = dynamic_cast (Bindable_t::GetObject (binding)); + if (pd) { + return pd->GetSubprocessPid (pid) ? 1 : 0; + } + else if (pid && EventMachine->SubprocessPid) { + *pid = EventMachine->SubprocessPid; + return 1; + } + else + return 0; + #else + return 0; + #endif +} + +/************************** +evma_get_subprocess_status +**************************/ + +extern "C" int evma_get_subprocess_status (const unsigned long binding, int *status) +{ + ensure_eventmachine("evma_get_subprocess_status"); + if (status) { + *status = EventMachine->SubprocessExitStatus; + return 1; + } + else + return 0; +} + +/************************* +evma_get_connection_count +*************************/ + +extern "C" int evma_get_connection_count() +{ + ensure_eventmachine("evma_get_connection_count"); + return EventMachine->GetConnectionCount(); +} + +/********************* +evma_signal_loopbreak +*********************/ + +extern "C" void evma_signal_loopbreak() +{ + ensure_eventmachine("evma_signal_loopbreak"); + EventMachine->SignalLoopBreaker(); +} + + + +/******************************** +evma_get_comm_inactivity_timeout +********************************/ + +extern "C" float evma_get_comm_inactivity_timeout (const unsigned long binding) +{ + ensure_eventmachine("evma_get_comm_inactivity_timeout"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (binding)); + if (ed) { + return ((float)ed->GetCommInactivityTimeout() / 1000); + } + else + return 0.0; //Perhaps this should be an exception. Access to an unknown binding. +} + +/******************************** +evma_set_comm_inactivity_timeout +********************************/ + +extern "C" int evma_set_comm_inactivity_timeout (const unsigned long binding, float value) +{ + ensure_eventmachine("evma_set_comm_inactivity_timeout"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (binding)); + if (ed) { + return ed->SetCommInactivityTimeout ((uint64_t)(value * 1000)); + } + else + return 0; //Perhaps this should be an exception. Access to an unknown binding. +} + + +/******************************** +evma_get_pending_connect_timeout +********************************/ + +extern "C" float evma_get_pending_connect_timeout (const unsigned long binding) +{ + ensure_eventmachine("evma_get_pending_connect_timeout"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (binding)); + if (ed) { + return ((float)ed->GetPendingConnectTimeout() / 1000); + } + else + return 0.0; +} + + +/******************************** +evma_set_pending_connect_timeout +********************************/ + +extern "C" int evma_set_pending_connect_timeout (const unsigned long binding, float value) +{ + ensure_eventmachine("evma_set_pending_connect_timeout"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (binding)); + if (ed) { + return ed->SetPendingConnectTimeout ((uint64_t)(value * 1000)); + } + else + return 0; +} + + +/********************** +evma_set_timer_quantum +**********************/ + +extern "C" void evma_set_timer_quantum (int interval) +{ + ensure_eventmachine("evma_set_timer_quantum"); + EventMachine->SetTimerQuantum (interval); +} + + +/************************ +evma_get_max_timer_count +************************/ + +extern "C" int evma_get_max_timer_count() +{ + return EventMachine_t::GetMaxTimerCount(); +} + + +/************************ +evma_set_max_timer_count +************************/ + +extern "C" void evma_set_max_timer_count (int ct) +{ + // This may only be called if the reactor is not running. + + if (EventMachine) + #ifdef BUILD_FOR_RUBY + rb_raise(rb_eRuntimeError, "eventmachine already initialized: evma_set_max_timer_count"); + #else + throw std::runtime_error ("eventmachine already initialized: evma_set_max_timer_count"); + #endif + EventMachine_t::SetMaxTimerCount (ct); +} + +/****************** +evma_setuid_string +******************/ + +extern "C" void evma_setuid_string (const char *username) +{ + // We do NOT need to be running an EM instance because this method is static. + EventMachine_t::SetuidString (username); +} + + +/********** +evma_popen +**********/ + +extern "C" const unsigned long evma_popen (char * const*cmd_strings) +{ + ensure_eventmachine("evma_popen"); + return EventMachine->Socketpair (cmd_strings); +} + + +/*************************** +evma_get_outbound_data_size +***************************/ + +extern "C" int evma_get_outbound_data_size (const unsigned long binding) +{ + ensure_eventmachine("evma_get_outbound_data_size"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (binding)); + return ed ? ed->GetOutboundDataSize() : 0; +} + + +/************** +evma_set_epoll +**************/ + +extern "C" void evma_set_epoll (int use) +{ + bUseEpoll = !!use; +} + +/*************** +evma_set_kqueue +***************/ + +extern "C" void evma_set_kqueue (int use) +{ + bUseKqueue = !!use; +} + + +/********************** +evma_set_rlimit_nofile +**********************/ + +extern "C" int evma_set_rlimit_nofile (int nofiles) +{ + return EventMachine_t::SetRlimitNofile (nofiles); +} + + +/********************************* +evma_send_file_data_to_connection +*********************************/ + +extern "C" int evma_send_file_data_to_connection (const unsigned long binding, const char *filename) +{ + /* This is a sugaring over send_data_to_connection that reads a file into a + * locally-allocated buffer, and sends the file data to the remote peer. + * Return the number of bytes written to the caller. + * TODO, needs to impose a limit on the file size. This is intended only for + * small files. (I don't know, maybe 8K or less.) For larger files, use interleaved + * I/O to avoid slowing the rest of the system down. + * TODO: we should return a code rather than barf, in case of file-not-found. + * TODO, does this compile on Windows? + * TODO, given that we want this to work only with small files, how about allocating + * the buffer on the stack rather than the heap? + * + * Modified 25Jul07. This now returns -1 on file-too-large; 0 for success, and a positive + * errno in case of other errors. + * + * Contributed by Kirk Haines. + */ + + char data[32*1024]; + int r; + + ensure_eventmachine("evma_send_file_data_to_connection"); + + int Fd = open (filename, O_RDONLY); + + if (Fd < 0) + return errno; + // From here on, all early returns MUST close Fd. + + struct stat st; + if (fstat (Fd, &st)) { + int e = errno; + close (Fd); + return e; + } + + off_t filesize = st.st_size; + if (filesize <= 0) { + close (Fd); + return 0; + } + else if (filesize > (off_t) sizeof(data)) { + close (Fd); + return -1; + } + + + r = read (Fd, data, filesize); + if (r != filesize) { + int e = errno; + close (Fd); + return e; + } + evma_send_data_to_connection (binding, data, r); + close (Fd); + + return 0; +} + + +/**************** +evma_start_proxy +*****************/ + +extern "C" void evma_start_proxy (const unsigned long from, const unsigned long to, const unsigned long bufsize, const unsigned long length) +{ + ensure_eventmachine("evma_start_proxy"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (from)); + if (ed) + ed->StartProxy(to, bufsize, length); +} + + +/*************** +evma_stop_proxy +****************/ + +extern "C" void evma_stop_proxy (const unsigned long from) +{ + ensure_eventmachine("evma_stop_proxy"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (from)); + if (ed) + ed->StopProxy(); +} + +/****************** +evma_proxied_bytes +*******************/ + +extern "C" unsigned long evma_proxied_bytes (const unsigned long from) +{ + ensure_eventmachine("evma_proxied_bytes"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (from)); + if (ed) + return ed->GetProxiedBytes(); + else + return 0; +} + + +/*************************** +evma_get_last_activity_time +****************************/ + +extern "C" uint64_t evma_get_last_activity_time(const unsigned long from) +{ + ensure_eventmachine("evma_get_last_activity_time"); + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (from)); + if (ed) + return ed->GetLastActivity(); + else + return 0; +} + + +/*************************** +evma_get_heartbeat_interval +****************************/ + +extern "C" float evma_get_heartbeat_interval() +{ + ensure_eventmachine("evma_get_heartbeat_interval"); + return EventMachine->GetHeartbeatInterval(); +} + + +/*************************** +evma_set_heartbeat_interval +****************************/ + +extern "C" int evma_set_heartbeat_interval(float interval) +{ + ensure_eventmachine("evma_set_heartbeat_interval"); + return EventMachine->SetHeartbeatInterval(interval); +} + + +/************************** +evma_get_current_loop_time +***************************/ + +extern "C" uint64_t evma_get_current_loop_time() +{ + ensure_eventmachine("evma_get_current_loop_time"); + return EventMachine->GetCurrentLoopTime(); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/ed.cpp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/ed.cpp new file mode 100644 index 000000000..3e71db37e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/ed.cpp @@ -0,0 +1,1973 @@ +/***************************************************************************** + +$Id$ + +File: ed.cpp +Date: 06Apr06 + +Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +Gmail: blackhedd + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + +#include "project.h" + + + +/******************** +SetSocketNonblocking +********************/ + +bool SetSocketNonblocking (SOCKET sd) +{ + #ifdef OS_UNIX + int val = fcntl (sd, F_GETFL, 0); + return (fcntl (sd, F_SETFL, val | O_NONBLOCK) != SOCKET_ERROR) ? true : false; + #endif + + #ifdef OS_WIN32 + #ifdef BUILD_FOR_RUBY + // 14Jun09 Ruby provides its own wrappers for ioctlsocket. On 1.8 this is a simple wrapper, + // however, 1.9 keeps its own state about the socket. + // NOTE: F_GETFL is not supported + return (fcntl (sd, F_SETFL, O_NONBLOCK) == 0) ? true : false; + #else + unsigned long one = 1; + return (ioctlsocket (sd, FIONBIO, &one) == 0) ? true : false; + #endif + #endif +} + + +/**************************************** +EventableDescriptor::EventableDescriptor +****************************************/ + +EventableDescriptor::EventableDescriptor (int sd, EventMachine_t *em): + bCloseNow (false), + bCloseAfterWriting (false), + MySocket (sd), + bAttached (false), + bWatchOnly (false), + EventCallback (NULL), + bCallbackUnbind (true), + UnbindReasonCode (0), + ProxyTarget(NULL), + ProxiedFrom(NULL), + ProxiedBytes(0), + MaxOutboundBufSize(0), + MyEventMachine (em), + PendingConnectTimeout(20000000), + InactivityTimeout (0), + bPaused (false) +{ + /* There are three ways to close a socket, all of which should + * automatically signal to the event machine that this object + * should be removed from the polling scheduler. + * First is a hard close, intended for bad errors or possible + * security violations. It immediately closes the connection + * and puts this object into an error state. + * Second is to set bCloseNow, which will cause the event machine + * to delete this object (and thus close the connection in our + * destructor) the next chance it gets. bCloseNow also inhibits + * the writing of new data on the socket (but not necessarily + * the reading of new data). + * The third way is to set bCloseAfterWriting, which inhibits + * the writing of new data and converts to bCloseNow as soon + * as everything in the outbound queue has been written. + * bCloseAfterWriting is really for use only by protocol handlers + * (for example, HTTP writes an HTML page and then closes the + * connection). All of the error states we generate internally + * cause an immediate close to be scheduled, which may have the + * effect of discarding outbound data. + */ + + if (sd == INVALID_SOCKET) + throw std::runtime_error ("bad eventable descriptor"); + if (MyEventMachine == NULL) + throw std::runtime_error ("bad em in eventable descriptor"); + CreatedAt = MyEventMachine->GetCurrentLoopTime(); + + #ifdef HAVE_EPOLL + EpollEvent.events = 0; + EpollEvent.data.ptr = this; + #endif + LastActivity = MyEventMachine->GetCurrentLoopTime(); +} + + +/***************************************** +EventableDescriptor::~EventableDescriptor +*****************************************/ + +EventableDescriptor::~EventableDescriptor() +{ + if (NextHeartbeat) + MyEventMachine->ClearHeartbeat(NextHeartbeat, this); + if (EventCallback && bCallbackUnbind) + (*EventCallback)(GetBinding(), EM_CONNECTION_UNBOUND, NULL, UnbindReasonCode); + if (ProxiedFrom) { + (*EventCallback)(ProxiedFrom->GetBinding(), EM_PROXY_TARGET_UNBOUND, NULL, 0); + ProxiedFrom->StopProxy(); + } + MyEventMachine->NumCloseScheduled--; + StopProxy(); + Close(); +} + + +/************************************* +EventableDescriptor::SetEventCallback +*************************************/ + +void EventableDescriptor::SetEventCallback (EMCallback cb) +{ + EventCallback = cb; +} + + +/************************** +EventableDescriptor::Close +**************************/ + +void EventableDescriptor::Close() +{ + /* EventMachine relies on the fact that when close(fd) + * is called that the fd is removed from any + * epoll event queues. + * + * However, this is not *always* the behavior of close(fd) + * + * See man 4 epoll Q6/A6 and then consider what happens + * when using pipes with eventmachine. + * (As is often done when communicating with a subprocess) + * + * The pipes end up looking like: + * + * ls -l /proc//fd + * ... + * lr-x------ 1 root root 64 2011-08-19 21:31 3 -> pipe:[940970] + * l-wx------ 1 root root 64 2011-08-19 21:31 4 -> pipe:[940970] + * + * This meets the critera from man 4 epoll Q6/A4 for not + * removing fds from epoll event queues until all fds + * that reference the underlying file have been removed. + * + * If the EventableDescriptor associated with fd 3 is deleted, + * its dtor will call EventableDescriptor::Close(), + * which will call ::close(int fd). + * + * However, unless the EventableDescriptor associated with fd 4 is + * also deleted before the next call to epoll_wait, events may fire + * for fd 3 that were registered with an already deleted + * EventableDescriptor. + * + * Therefore, it is necessary to notify EventMachine that + * the fd associated with this EventableDescriptor is + * closing. + * + * EventMachine also never closes fds for STDIN, STDOUT and + * STDERR (0, 1 & 2) + */ + + // Close the socket right now. Intended for emergencies. + if (MySocket != INVALID_SOCKET) { + MyEventMachine->Deregister (this); + + // Do not close STDIN, STDOUT, STDERR + if (MySocket > 2 && !bAttached) { + shutdown (MySocket, 1); + close (MySocket); + } + + MySocket = INVALID_SOCKET; + } +} + + +/********************************* +EventableDescriptor::ShouldDelete +*********************************/ + +bool EventableDescriptor::ShouldDelete() +{ + /* For use by a socket manager, which needs to know if this object + * should be removed from scheduling events and deleted. + * Has an immediate close been scheduled, or are we already closed? + * If either of these are the case, return true. In theory, the manager will + * then delete us, which in turn will make sure the socket is closed. + * Note, if bCloseAfterWriting is true, we check a virtual method to see + * if there is outbound data to write, and only request a close if there is none. + */ + + return ((MySocket == INVALID_SOCKET) || bCloseNow || (bCloseAfterWriting && (GetOutboundDataSize() <= 0))); +} + + +/********************************** +EventableDescriptor::ScheduleClose +**********************************/ + +void EventableDescriptor::ScheduleClose (bool after_writing) +{ + MyEventMachine->NumCloseScheduled++; + // KEEP THIS SYNCHRONIZED WITH ::IsCloseScheduled. + if (after_writing) + bCloseAfterWriting = true; + else + bCloseNow = true; +} + + +/************************************* +EventableDescriptor::IsCloseScheduled +*************************************/ + +bool EventableDescriptor::IsCloseScheduled() +{ + // KEEP THIS SYNCHRONIZED WITH ::ScheduleClose. + return (bCloseNow || bCloseAfterWriting); +} + + +/******************************* +EventableDescriptor::StartProxy +*******************************/ + +void EventableDescriptor::StartProxy(const unsigned long to, const unsigned long bufsize, const unsigned long length) +{ + EventableDescriptor *ed = dynamic_cast (Bindable_t::GetObject (to)); + if (ed) { + StopProxy(); + ProxyTarget = ed; + BytesToProxy = length; + ProxiedBytes = 0; + ed->SetProxiedFrom(this, bufsize); + return; + } + throw std::runtime_error ("Tried to proxy to an invalid descriptor"); +} + + +/****************************** +EventableDescriptor::StopProxy +******************************/ + +void EventableDescriptor::StopProxy() +{ + if (ProxyTarget) { + ProxyTarget->SetProxiedFrom(NULL, 0); + ProxyTarget = NULL; + } +} + + +/*********************************** +EventableDescriptor::SetProxiedFrom +***********************************/ + +void EventableDescriptor::SetProxiedFrom(EventableDescriptor *from, const unsigned long bufsize) +{ + if (from != NULL && ProxiedFrom != NULL) + throw std::runtime_error ("Tried to proxy to a busy target"); + + ProxiedFrom = from; + MaxOutboundBufSize = bufsize; +} + + +/******************************************** +EventableDescriptor::_GenericInboundDispatch +********************************************/ + +void EventableDescriptor::_GenericInboundDispatch(const char *buf, int size) +{ + assert(EventCallback); + + if (ProxyTarget) { + if (BytesToProxy > 0) { + unsigned long proxied = min(BytesToProxy, (unsigned long) size); + ProxyTarget->SendOutboundData(buf, proxied); + ProxiedBytes += (unsigned long) proxied; + BytesToProxy -= proxied; + if (BytesToProxy == 0) { + StopProxy(); + (*EventCallback)(GetBinding(), EM_PROXY_COMPLETED, NULL, 0); + if (proxied < size) { + (*EventCallback)(GetBinding(), EM_CONNECTION_READ, buf + proxied, size - proxied); + } + } + } else { + ProxyTarget->SendOutboundData(buf, size); + ProxiedBytes += (unsigned long) size; + } + } else { + (*EventCallback)(GetBinding(), EM_CONNECTION_READ, buf, size); + } +} + + +/********************************************* +EventableDescriptor::GetPendingConnectTimeout +*********************************************/ + +uint64_t EventableDescriptor::GetPendingConnectTimeout() +{ + return PendingConnectTimeout / 1000; +} + + +/********************************************* +EventableDescriptor::SetPendingConnectTimeout +*********************************************/ + +int EventableDescriptor::SetPendingConnectTimeout (uint64_t value) +{ + if (value > 0) { + PendingConnectTimeout = value * 1000; + MyEventMachine->QueueHeartbeat(this); + return 1; + } + return 0; +} + + +/************************************* +EventableDescriptor::GetNextHeartbeat +*************************************/ + +uint64_t EventableDescriptor::GetNextHeartbeat() +{ + if (NextHeartbeat) + MyEventMachine->ClearHeartbeat(NextHeartbeat, this); + + NextHeartbeat = 0; + + if (!ShouldDelete()) { + uint64_t time_til_next = InactivityTimeout; + if (IsConnectPending()) { + if (time_til_next == 0 || PendingConnectTimeout < time_til_next) + time_til_next = PendingConnectTimeout; + } + if (time_til_next == 0) + return 0; + NextHeartbeat = time_til_next + MyEventMachine->GetRealTime(); + } + + return NextHeartbeat; +} + + +/****************************************** +ConnectionDescriptor::ConnectionDescriptor +******************************************/ + +ConnectionDescriptor::ConnectionDescriptor (int sd, EventMachine_t *em): + EventableDescriptor (sd, em), + bConnectPending (false), + bNotifyReadable (false), + bNotifyWritable (false), + bReadAttemptedAfterClose (false), + bWriteAttemptedAfterClose (false), + OutboundDataSize (0), + #ifdef WITH_SSL + SslBox (NULL), + bHandshakeSignaled (false), + bSslVerifyPeer (false), + bSslPeerAccepted(false), + #endif + #ifdef HAVE_KQUEUE + bGotExtraKqueueEvent(false), + #endif + bIsServer (false) +{ + // 22Jan09: Moved ArmKqueueWriter into SetConnectPending() to fix assertion failure in _WriteOutboundData() + // 5May09: Moved EPOLLOUT into SetConnectPending() so it doesn't happen for attached read pipes +} + + +/******************************************* +ConnectionDescriptor::~ConnectionDescriptor +*******************************************/ + +ConnectionDescriptor::~ConnectionDescriptor() +{ + // Run down any stranded outbound data. + for (size_t i=0; i < OutboundPages.size(); i++) + OutboundPages[i].Free(); + + #ifdef WITH_SSL + if (SslBox) + delete SslBox; + #endif +} + + +/*********************************** +ConnectionDescriptor::_UpdateEvents +************************************/ + +void ConnectionDescriptor::_UpdateEvents() +{ + _UpdateEvents(true, true); +} + +void ConnectionDescriptor::_UpdateEvents(bool read, bool write) +{ + if (MySocket == INVALID_SOCKET) + return; + + #ifdef HAVE_EPOLL + unsigned int old = EpollEvent.events; + + if (read) { + if (SelectForRead()) + EpollEvent.events |= EPOLLIN; + else + EpollEvent.events &= ~EPOLLIN; + } + + if (write) { + if (SelectForWrite()) + EpollEvent.events |= EPOLLOUT; + else + EpollEvent.events &= ~EPOLLOUT; + } + + if (old != EpollEvent.events) + MyEventMachine->Modify (this); + #endif + + #ifdef HAVE_KQUEUE + if (read && SelectForRead()) + MyEventMachine->ArmKqueueReader (this); + if (write && SelectForWrite()) + MyEventMachine->ArmKqueueWriter (this); + #endif +} + +/*************************************** +ConnectionDescriptor::SetConnectPending +****************************************/ + +void ConnectionDescriptor::SetConnectPending(bool f) +{ + bConnectPending = f; + _UpdateEvents(); +} + + +/********************************** +ConnectionDescriptor::SetAttached +***********************************/ + +void ConnectionDescriptor::SetAttached(bool state) +{ + bAttached = state; +} + + +/********************************** +ConnectionDescriptor::SetWatchOnly +***********************************/ + +void ConnectionDescriptor::SetWatchOnly(bool watching) +{ + bWatchOnly = watching; + _UpdateEvents(); +} + + +/********************************* +ConnectionDescriptor::HandleError +*********************************/ + +void ConnectionDescriptor::HandleError() +{ + if (bWatchOnly) { + // An EPOLLHUP | EPOLLIN condition will call Read() before HandleError(), in which case the + // socket is already detached and invalid, so we don't need to do anything. + if (MySocket == INVALID_SOCKET) return; + + // HandleError() is called on WatchOnly descriptors by the epoll reactor + // when it gets a EPOLLERR | EPOLLHUP. Usually this would show up as a readable and + // writable event on other reactors, so we have to fire those events ourselves. + if (bNotifyReadable) Read(); + if (bNotifyWritable) Write(); + } else { + ScheduleClose (false); + } +} + + +/*********************************** +ConnectionDescriptor::ScheduleClose +***********************************/ + +void ConnectionDescriptor::ScheduleClose (bool after_writing) +{ + if (bWatchOnly) + throw std::runtime_error ("cannot close 'watch only' connections"); + + EventableDescriptor::ScheduleClose(after_writing); +} + + +/*************************************** +ConnectionDescriptor::SetNotifyReadable +****************************************/ + +void ConnectionDescriptor::SetNotifyReadable(bool readable) +{ + if (!bWatchOnly) + throw std::runtime_error ("notify_readable must be on 'watch only' connections"); + + bNotifyReadable = readable; + _UpdateEvents(true, false); +} + + +/*************************************** +ConnectionDescriptor::SetNotifyWritable +****************************************/ + +void ConnectionDescriptor::SetNotifyWritable(bool writable) +{ + if (!bWatchOnly) + throw std::runtime_error ("notify_writable must be on 'watch only' connections"); + + bNotifyWritable = writable; + _UpdateEvents(false, true); +} + + +/************************************** +ConnectionDescriptor::SendOutboundData +**************************************/ + +int ConnectionDescriptor::SendOutboundData (const char *data, int length) +{ + if (bWatchOnly) + throw std::runtime_error ("cannot send data on a 'watch only' connection"); + + if (ProxiedFrom && MaxOutboundBufSize && (unsigned int)(GetOutboundDataSize() + length) > MaxOutboundBufSize) + ProxiedFrom->Pause(); + + #ifdef WITH_SSL + if (SslBox) { + if (length > 0) { + int w = SslBox->PutPlaintext (data, length); + if (w < 0) + ScheduleClose (false); + else + _DispatchCiphertext(); + } + // TODO: What's the correct return value? + return 1; // That's a wild guess, almost certainly wrong. + } + else + #endif + return _SendRawOutboundData (data, length); +} + + + +/****************************************** +ConnectionDescriptor::_SendRawOutboundData +******************************************/ + +int ConnectionDescriptor::_SendRawOutboundData (const char *data, int length) +{ + /* This internal method is called to schedule bytes that + * will be sent out to the remote peer. + * It's not directly accessed by the caller, who hits ::SendOutboundData, + * which may or may not filter or encrypt the caller's data before + * sending it here. + */ + + // Highly naive and incomplete implementation. + // There's no throttle for runaways (which should abort only this connection + // and not the whole process), and no coalescing of small pages. + // (Well, not so bad, small pages are coalesced in ::Write) + + if (IsCloseScheduled()) + return 0; + + // 25Mar10: Ignore 0 length packets as they are not meaningful in TCP (as opposed to UDP) + // and can cause the assert(nbytes>0) to fail when OutboundPages has a bunch of 0 length pages. + if (length == 0) + return 0; + + if (!data && (length > 0)) + throw std::runtime_error ("bad outbound data"); + char *buffer = (char *) malloc (length + 1); + if (!buffer) + throw std::runtime_error ("no allocation for outbound data"); + + memcpy (buffer, data, length); + buffer [length] = 0; + OutboundPages.push_back (OutboundPage (buffer, length)); + OutboundDataSize += length; + + _UpdateEvents(false, true); + + return length; +} + + + +/*********************************** +ConnectionDescriptor::SelectForRead +***********************************/ + +bool ConnectionDescriptor::SelectForRead() +{ + /* A connection descriptor is always scheduled for read, + * UNLESS it's in a pending-connect state. + * On Linux, unlike Unix, a nonblocking socket on which + * connect has been called, does NOT necessarily select + * both readable and writable in case of error. + * The socket will select writable when the disposition + * of the connect is known. On the other hand, a socket + * which successfully connects and selects writable may + * indeed have some data available on it, so it will + * select readable in that case, violating expectations! + * So we will not poll for readability until the socket + * is known to be in a connected state. + */ + + if (bPaused) + return false; + else if (bConnectPending) + return false; + else if (bWatchOnly) + return bNotifyReadable ? true : false; + else + return true; +} + + +/************************************ +ConnectionDescriptor::SelectForWrite +************************************/ + +bool ConnectionDescriptor::SelectForWrite() +{ + /* Cf the notes under SelectForRead. + * In a pending-connect state, we ALWAYS select for writable. + * In a normal state, we only select for writable when we + * have outgoing data to send. + */ + + if (bPaused) + return false; + else if (bConnectPending) + return true; + else if (bWatchOnly) + return bNotifyWritable ? true : false; + else + return (GetOutboundDataSize() > 0); +} + +/*************************** +ConnectionDescriptor::Pause +***************************/ + +bool ConnectionDescriptor::Pause() +{ + if (bWatchOnly) + throw std::runtime_error ("cannot pause/resume 'watch only' connections, set notify readable/writable instead"); + + bool old = bPaused; + bPaused = true; + _UpdateEvents(); + return old == false; +} + +/**************************** +ConnectionDescriptor::Resume +****************************/ + +bool ConnectionDescriptor::Resume() +{ + if (bWatchOnly) + throw std::runtime_error ("cannot pause/resume 'watch only' connections, set notify readable/writable instead"); + + bool old = bPaused; + bPaused = false; + _UpdateEvents(); + return old == true; +} + +/************************** +ConnectionDescriptor::Read +**************************/ + +void ConnectionDescriptor::Read() +{ + /* Read and dispatch data on a socket that has selected readable. + * It's theoretically possible to get and dispatch incoming data on + * a socket that has already been scheduled for closing or close-after-writing. + * In those cases, we'll leave it up the to protocol handler to "do the + * right thing" (which probably means to ignore the incoming data). + * + * 22Aug06: Chris Ochs reports that on FreeBSD, it's possible to come + * here with the socket already closed, after the process receives + * a ctrl-C signal (not sure if that's TERM or INT on BSD). The application + * was one in which network connections were doing a lot of interleaved reads + * and writes. + * Since we always write before reading (in order to keep the outbound queues + * as light as possible), I think what happened is that an interrupt caused + * the socket to be closed in ConnectionDescriptor::Write. We'll then + * come here in the same pass through the main event loop, and won't get + * cleaned up until immediately after. + * We originally asserted that the socket was valid when we got here. + * To deal properly with the possibility that we are closed when we get here, + * I removed the assert. HOWEVER, the potential for an infinite loop scares me, + * so even though this is really clunky, I added a flag to assert that we never + * come here more than once after being closed. (FCianfrocca) + */ + + int sd = GetSocket(); + //assert (sd != INVALID_SOCKET); (original, removed 22Aug06) + if (sd == INVALID_SOCKET) { + assert (!bReadAttemptedAfterClose); + bReadAttemptedAfterClose = true; + return; + } + + if (bWatchOnly) { + if (bNotifyReadable && EventCallback) + (*EventCallback)(GetBinding(), EM_CONNECTION_NOTIFY_READABLE, NULL, 0); + return; + } + + LastActivity = MyEventMachine->GetCurrentLoopTime(); + + int total_bytes_read = 0; + char readbuffer [16 * 1024 + 1]; + + for (int i=0; i < 10; i++) { + // Don't read just one buffer and then move on. This is faster + // if there is a lot of incoming. + // But don't read indefinitely. Give other sockets a chance to run. + // NOTICE, we're reading one less than the buffer size. + // That's so we can put a guard byte at the end of what we send + // to user code. + + + int r = read (sd, readbuffer, sizeof(readbuffer) - 1); + int e = errno; + //cerr << ""; + + if (r > 0) { + total_bytes_read += r; + + // Add a null-terminator at the the end of the buffer + // that we will send to the callback. + // DO NOT EVER CHANGE THIS. We want to explicitly allow users + // to be able to depend on this behavior, so they will have + // the option to do some things faster. Additionally it's + // a security guard against buffer overflows. + readbuffer [r] = 0; + _DispatchInboundData (readbuffer, r); + } + else if (r == 0) { + break; + } + else { + #ifdef OS_UNIX + if ((e != EINPROGRESS) && (e != EWOULDBLOCK) && (e != EAGAIN) && (e != EINTR)) { + #endif + #ifdef OS_WIN32 + if ((e != WSAEINPROGRESS) && (e != WSAEWOULDBLOCK)) { + #endif + // 26Mar11: Previously, all read errors were assumed to be EWOULDBLOCK and ignored. + // Now, instead, we call Close() on errors like ECONNRESET and ENOTCONN. + UnbindReasonCode = e; + Close(); + break; + } else { + // Basically a would-block, meaning we've read everything there is to read. + break; + } + } + + } + + + if (total_bytes_read == 0) { + // If we read no data on a socket that selected readable, + // it generally means the other end closed the connection gracefully. + ScheduleClose (false); + //bCloseNow = true; + } + +} + + + +/****************************************** +ConnectionDescriptor::_DispatchInboundData +******************************************/ + +void ConnectionDescriptor::_DispatchInboundData (const char *buffer, int size) +{ + #ifdef WITH_SSL + if (SslBox) { + SslBox->PutCiphertext (buffer, size); + + int s; + char B [2048]; + while ((s = SslBox->GetPlaintext (B, sizeof(B) - 1)) > 0) { + _CheckHandshakeStatus(); + B [s] = 0; + _GenericInboundDispatch(B, s); + } + + // If our SSL handshake had a problem, shut down the connection. + if (s == -2) { + ScheduleClose(false); + return; + } + + _CheckHandshakeStatus(); + _DispatchCiphertext(); + } + else { + _GenericInboundDispatch(buffer, size); + } + #endif + + #ifdef WITHOUT_SSL + _GenericInboundDispatch(buffer, size); + #endif +} + + + +/******************************************* +ConnectionDescriptor::_CheckHandshakeStatus +*******************************************/ + +void ConnectionDescriptor::_CheckHandshakeStatus() +{ + #ifdef WITH_SSL + if (SslBox && (!bHandshakeSignaled) && SslBox->IsHandshakeCompleted()) { + bHandshakeSignaled = true; + if (EventCallback) + (*EventCallback)(GetBinding(), EM_SSL_HANDSHAKE_COMPLETED, NULL, 0); + } + #endif +} + + + +/*************************** +ConnectionDescriptor::Write +***************************/ + +void ConnectionDescriptor::Write() +{ + /* A socket which is in a pending-connect state will select + * writable when the disposition of the connect is known. + * At that point, check to be sure there are no errors, + * and if none, then promote the socket out of the pending + * state. + * TODO: I haven't figured out how Windows signals errors on + * unconnected sockets. Maybe it does the untraditional but + * logical thing and makes the socket selectable for error. + * If so, it's unsupported here for the time being, and connect + * errors will have to be caught by the timeout mechanism. + */ + + if (bConnectPending) { + int error; + socklen_t len; + len = sizeof(error); + #ifdef OS_UNIX + int o = getsockopt (GetSocket(), SOL_SOCKET, SO_ERROR, &error, &len); + #endif + #ifdef OS_WIN32 + int o = getsockopt (GetSocket(), SOL_SOCKET, SO_ERROR, (char*)&error, &len); + #endif + if ((o == 0) && (error == 0)) { + if (EventCallback) + (*EventCallback)(GetBinding(), EM_CONNECTION_COMPLETED, "", 0); + + // 5May09: Moved epoll/kqueue read/write arming into SetConnectPending, so it can be called + // from EventMachine_t::AttachFD as well. + SetConnectPending (false); + } + else { + if (o == 0) + UnbindReasonCode = error; + ScheduleClose (false); + //bCloseNow = true; + } + } + else { + + if (bNotifyWritable) { + if (EventCallback) + (*EventCallback)(GetBinding(), EM_CONNECTION_NOTIFY_WRITABLE, NULL, 0); + + _UpdateEvents(false, true); + return; + } + + assert(!bWatchOnly); + + /* 5May09: Kqueue bugs on OSX cause one extra writable event to fire even though we're using + EV_ONESHOT. We ignore this extra event once, but only the first time. If it happens again, + we should fall through to the assert(nbytes>0) failure to catch any EM bugs which might cause + ::Write to be called in a busy-loop. + */ + #ifdef HAVE_KQUEUE + if (MyEventMachine->UsingKqueue()) { + if (OutboundDataSize == 0 && !bGotExtraKqueueEvent) { + bGotExtraKqueueEvent = true; + return; + } else if (OutboundDataSize > 0) { + bGotExtraKqueueEvent = false; + } + } + #endif + + _WriteOutboundData(); + } +} + + +/**************************************** +ConnectionDescriptor::_WriteOutboundData +****************************************/ + +void ConnectionDescriptor::_WriteOutboundData() +{ + /* This is a helper function called by ::Write. + * It's possible for a socket to select writable and then no longer + * be writable by the time we get around to writing. The kernel might + * have used up its available output buffers between the select call + * and when we get here. So this condition is not an error. + * + * 20Jul07, added the same kind of protection against an invalid socket + * that is at the top of ::Read. Not entirely how this could happen in + * real life (connection-reset from the remote peer, perhaps?), but I'm + * doing it to address some reports of crashing under heavy loads. + */ + + int sd = GetSocket(); + //assert (sd != INVALID_SOCKET); + if (sd == INVALID_SOCKET) { + assert (!bWriteAttemptedAfterClose); + bWriteAttemptedAfterClose = true; + return; + } + + LastActivity = MyEventMachine->GetCurrentLoopTime(); + size_t nbytes = 0; + + #ifdef HAVE_WRITEV + int iovcnt = OutboundPages.size(); + // Max of 16 outbound pages at a time + if (iovcnt > 16) iovcnt = 16; + + #ifdef CC_SUNWspro + struct iovec iov[16]; + #else + struct iovec iov[ iovcnt ]; + #endif + + for(int i = 0; i < iovcnt; i++){ + OutboundPage *op = &(OutboundPages[i]); + #ifdef CC_SUNWspro + iov[i].iov_base = (char *)(op->Buffer + op->Offset); + #else + iov[i].iov_base = (void *)(op->Buffer + op->Offset); + #endif + iov[i].iov_len = op->Length - op->Offset; + + nbytes += iov[i].iov_len; + } + #else + char output_buffer [16 * 1024]; + + while ((OutboundPages.size() > 0) && (nbytes < sizeof(output_buffer))) { + OutboundPage *op = &(OutboundPages[0]); + if ((nbytes + op->Length - op->Offset) < sizeof (output_buffer)) { + memcpy (output_buffer + nbytes, op->Buffer + op->Offset, op->Length - op->Offset); + nbytes += (op->Length - op->Offset); + op->Free(); + OutboundPages.pop_front(); + } + else { + int len = sizeof(output_buffer) - nbytes; + memcpy (output_buffer + nbytes, op->Buffer + op->Offset, len); + op->Offset += len; + nbytes += len; + } + } + #endif + + // We should never have gotten here if there were no data to write, + // so assert that as a sanity check. + // Don't bother to make sure nbytes is less than output_buffer because + // if it were we probably would have crashed already. + assert (nbytes > 0); + + assert (GetSocket() != INVALID_SOCKET); + #ifdef HAVE_WRITEV + int bytes_written = writev (GetSocket(), iov, iovcnt); + #else + int bytes_written = write (GetSocket(), output_buffer, nbytes); + #endif + + bool err = false; + int e = errno; + if (bytes_written < 0) { + err = true; + bytes_written = 0; + } + + assert (bytes_written >= 0); + OutboundDataSize -= bytes_written; + + if (ProxiedFrom && MaxOutboundBufSize && (unsigned int)GetOutboundDataSize() < MaxOutboundBufSize && ProxiedFrom->IsPaused()) + ProxiedFrom->Resume(); + + #ifdef HAVE_WRITEV + if (!err) { + unsigned int sent = bytes_written; + deque::iterator op = OutboundPages.begin(); + + for (int i = 0; i < iovcnt; i++) { + if (iov[i].iov_len <= sent) { + // Sent this page in full, free it. + op->Free(); + OutboundPages.pop_front(); + + sent -= iov[i].iov_len; + } else { + // Sent part (or none) of this page, increment offset to send the remainder + op->Offset += sent; + break; + } + + // Shouldn't be possible run out of pages before the loop ends + assert(op != OutboundPages.end()); + *op++; + } + } + #else + if ((size_t)bytes_written < nbytes) { + int len = nbytes - bytes_written; + char *buffer = (char*) malloc (len + 1); + if (!buffer) + throw std::runtime_error ("bad alloc throwing back data"); + memcpy (buffer, output_buffer + bytes_written, len); + buffer [len] = 0; + OutboundPages.push_front (OutboundPage (buffer, len)); + } + #endif + + _UpdateEvents(false, true); + + if (err) { + #ifdef OS_UNIX + if ((e != EINPROGRESS) && (e != EWOULDBLOCK) && (e != EINTR)) { + #endif + #ifdef OS_WIN32 + if ((e != WSAEINPROGRESS) && (e != WSAEWOULDBLOCK)) { + #endif + UnbindReasonCode = e; + Close(); + } + } +} + + +/*************************************** +ConnectionDescriptor::ReportErrorStatus +***************************************/ + +int ConnectionDescriptor::ReportErrorStatus() +{ + if (MySocket == INVALID_SOCKET) { + return -1; + } + + int error; + socklen_t len; + len = sizeof(error); + #ifdef OS_UNIX + int o = getsockopt (GetSocket(), SOL_SOCKET, SO_ERROR, &error, &len); + #endif + #ifdef OS_WIN32 + int o = getsockopt (GetSocket(), SOL_SOCKET, SO_ERROR, (char*)&error, &len); + #endif + if ((o == 0) && (error == 0)) + return 0; + else if (o == 0) + return error; + else + return -1; +} + + +/****************************** +ConnectionDescriptor::StartTls +******************************/ + +void ConnectionDescriptor::StartTls() +{ + #ifdef WITH_SSL + if (SslBox) + throw std::runtime_error ("SSL/TLS already running on connection"); + + SslBox = new SslBox_t (bIsServer, PrivateKeyFilename, CertChainFilename, bSslVerifyPeer, GetBinding()); + _DispatchCiphertext(); + #endif + + #ifdef WITHOUT_SSL + throw std::runtime_error ("Encryption not available on this event-machine"); + #endif +} + + +/********************************* +ConnectionDescriptor::SetTlsParms +*********************************/ + +void ConnectionDescriptor::SetTlsParms (const char *privkey_filename, const char *certchain_filename, bool verify_peer) +{ + #ifdef WITH_SSL + if (SslBox) + throw std::runtime_error ("call SetTlsParms before calling StartTls"); + if (privkey_filename && *privkey_filename) + PrivateKeyFilename = privkey_filename; + if (certchain_filename && *certchain_filename) + CertChainFilename = certchain_filename; + bSslVerifyPeer = verify_peer; + #endif + + #ifdef WITHOUT_SSL + throw std::runtime_error ("Encryption not available on this event-machine"); + #endif +} + + +/********************************* +ConnectionDescriptor::GetPeerCert +*********************************/ + +#ifdef WITH_SSL +X509 *ConnectionDescriptor::GetPeerCert() +{ + if (!SslBox) + throw std::runtime_error ("SSL/TLS not running on this connection"); + return SslBox->GetPeerCert(); +} +#endif + + +/*********************************** +ConnectionDescriptor::VerifySslPeer +***********************************/ + +#ifdef WITH_SSL +bool ConnectionDescriptor::VerifySslPeer(const char *cert) +{ + bSslPeerAccepted = false; + + if (EventCallback) + (*EventCallback)(GetBinding(), EM_SSL_VERIFY, cert, strlen(cert)); + + return bSslPeerAccepted; +} +#endif + + +/*********************************** +ConnectionDescriptor::AcceptSslPeer +***********************************/ + +#ifdef WITH_SSL +void ConnectionDescriptor::AcceptSslPeer() +{ + bSslPeerAccepted = true; +} +#endif + + +/***************************************** +ConnectionDescriptor::_DispatchCiphertext +*****************************************/ + +#ifdef WITH_SSL +void ConnectionDescriptor::_DispatchCiphertext() +{ + assert (SslBox); + + + char BigBuf [2048]; + bool did_work; + + do { + did_work = false; + + // try to drain ciphertext + while (SslBox->CanGetCiphertext()) { + int r = SslBox->GetCiphertext (BigBuf, sizeof(BigBuf)); + assert (r > 0); + _SendRawOutboundData (BigBuf, r); + did_work = true; + } + + // Pump the SslBox, in case it has queued outgoing plaintext + // This will return >0 if data was written, + // 0 if no data was written, and <0 if there was a fatal error. + bool pump; + do { + pump = false; + int w = SslBox->PutPlaintext (NULL, 0); + if (w > 0) { + did_work = true; + pump = true; + } + else if (w < 0) + ScheduleClose (false); + } while (pump); + + // try to put plaintext. INCOMPLETE, doesn't belong here? + // In SendOutboundData, we're spooling plaintext directly + // into SslBox. That may be wrong, we may need to buffer it + // up here! + /* + const char *ptr; + int ptr_length; + while (OutboundPlaintext.GetPage (&ptr, &ptr_length)) { + assert (ptr && (ptr_length > 0)); + int w = SslMachine.PutPlaintext (ptr, ptr_length); + if (w > 0) { + OutboundPlaintext.DiscardBytes (w); + did_work = true; + } + else + break; + } + */ + + } while (did_work); + +} +#endif + + + +/******************************* +ConnectionDescriptor::Heartbeat +*******************************/ + +void ConnectionDescriptor::Heartbeat() +{ + /* Only allow a certain amount of time to go by while waiting + * for a pending connect. If it expires, then kill the socket. + * For a connected socket, close it if its inactivity timer + * has expired. + */ + + if (bConnectPending) { + if ((MyEventMachine->GetCurrentLoopTime() - CreatedAt) >= PendingConnectTimeout) { + UnbindReasonCode = ETIMEDOUT; + ScheduleClose (false); + //bCloseNow = true; + } + } + else { + if (InactivityTimeout && ((MyEventMachine->GetCurrentLoopTime() - LastActivity) >= InactivityTimeout)) { + UnbindReasonCode = ETIMEDOUT; + ScheduleClose (false); + //bCloseNow = true; + } + } +} + + +/**************************************** +LoopbreakDescriptor::LoopbreakDescriptor +****************************************/ + +LoopbreakDescriptor::LoopbreakDescriptor (int sd, EventMachine_t *parent_em): + EventableDescriptor (sd, parent_em) +{ + /* This is really bad and ugly. Change someday if possible. + * We have to know about an event-machine (probably the one that owns us), + * so we can pass newly-created connections to it. + */ + + bCallbackUnbind = false; + + #ifdef HAVE_EPOLL + EpollEvent.events = EPOLLIN; + #endif + #ifdef HAVE_KQUEUE + MyEventMachine->ArmKqueueReader (this); + #endif +} + + + + +/************************* +LoopbreakDescriptor::Read +*************************/ + +void LoopbreakDescriptor::Read() +{ + // TODO, refactor, this code is probably in the wrong place. + assert (MyEventMachine); + MyEventMachine->_ReadLoopBreaker(); +} + + +/************************** +LoopbreakDescriptor::Write +**************************/ + +void LoopbreakDescriptor::Write() +{ + // Why are we here? + throw std::runtime_error ("bad code path in loopbreak"); +} + +/************************************** +AcceptorDescriptor::AcceptorDescriptor +**************************************/ + +AcceptorDescriptor::AcceptorDescriptor (int sd, EventMachine_t *parent_em): + EventableDescriptor (sd, parent_em) +{ + #ifdef HAVE_EPOLL + EpollEvent.events = EPOLLIN; + #endif + #ifdef HAVE_KQUEUE + MyEventMachine->ArmKqueueReader (this); + #endif +} + + +/*************************************** +AcceptorDescriptor::~AcceptorDescriptor +***************************************/ + +AcceptorDescriptor::~AcceptorDescriptor() +{ +} + +/**************************************** +STATIC: AcceptorDescriptor::StopAcceptor +****************************************/ + +void AcceptorDescriptor::StopAcceptor (const unsigned long binding) +{ + // TODO: This is something of a hack, or at least it's a static method of the wrong class. + AcceptorDescriptor *ad = dynamic_cast (Bindable_t::GetObject (binding)); + if (ad) + ad->ScheduleClose (false); + else + throw std::runtime_error ("failed to close nonexistent acceptor"); +} + + +/************************ +AcceptorDescriptor::Read +************************/ + +void AcceptorDescriptor::Read() +{ + /* Accept up to a certain number of sockets on the listening connection. + * Don't try to accept all that are present, because this would allow a DoS attack + * in which no data were ever read or written. We should accept more than one, + * if available, to keep the partially accepted sockets from backing up in the kernel. + */ + + /* Make sure we use non-blocking i/o on the acceptor socket, since we're selecting it + * for readability. According to Stevens UNP, it's possible for an acceptor to select readable + * and then block when we call accept. For example, the other end resets the connection after + * the socket selects readable and before we call accept. The kernel will remove the dead + * socket from the accept queue. If the accept queue is now empty, accept will block. + */ + + + struct sockaddr_in pin; + socklen_t addrlen = sizeof (pin); + + for (int i=0; i < 10; i++) { + int sd = accept (GetSocket(), (struct sockaddr*)&pin, &addrlen); + if (sd == INVALID_SOCKET) { + // This breaks the loop when we've accepted everything on the kernel queue, + // up to 10 new connections. But what if the *first* accept fails? + // Does that mean anything serious is happening, beyond the situation + // described in the note above? + break; + } + + // Set the newly-accepted socket non-blocking. + // On Windows, this may fail because, weirdly, Windows inherits the non-blocking + // attribute that we applied to the acceptor socket into the accepted one. + if (!SetSocketNonblocking (sd)) { + //int val = fcntl (sd, F_GETFL, 0); + //if (fcntl (sd, F_SETFL, val | O_NONBLOCK) == -1) { + shutdown (sd, 1); + close (sd); + continue; + } + + + // Disable slow-start (Nagle algorithm). Eventually make this configurable. + int one = 1; + setsockopt (sd, IPPROTO_TCP, TCP_NODELAY, (char*) &one, sizeof(one)); + + + ConnectionDescriptor *cd = new ConnectionDescriptor (sd, MyEventMachine); + if (!cd) + throw std::runtime_error ("no newly accepted connection"); + cd->SetServerMode(); + if (EventCallback) { + (*EventCallback) (GetBinding(), EM_CONNECTION_ACCEPTED, NULL, cd->GetBinding()); + } + #ifdef HAVE_EPOLL + cd->GetEpollEvent()->events = EPOLLIN | (cd->SelectForWrite() ? EPOLLOUT : 0); + #endif + assert (MyEventMachine); + MyEventMachine->Add (cd); + #ifdef HAVE_KQUEUE + if (cd->SelectForWrite()) + MyEventMachine->ArmKqueueWriter (cd); + MyEventMachine->ArmKqueueReader (cd); + #endif + } + +} + + +/************************* +AcceptorDescriptor::Write +*************************/ + +void AcceptorDescriptor::Write() +{ + // Why are we here? + throw std::runtime_error ("bad code path in acceptor"); +} + + +/***************************** +AcceptorDescriptor::Heartbeat +*****************************/ + +void AcceptorDescriptor::Heartbeat() +{ + // No-op +} + + +/******************************* +AcceptorDescriptor::GetSockname +*******************************/ + +bool AcceptorDescriptor::GetSockname (struct sockaddr *s, socklen_t *len) +{ + bool ok = false; + if (s) { + int gp = getsockname (GetSocket(), s, len); + if (gp == 0) + ok = true; + } + return ok; +} + + + +/************************************** +DatagramDescriptor::DatagramDescriptor +**************************************/ + +DatagramDescriptor::DatagramDescriptor (int sd, EventMachine_t *parent_em): + EventableDescriptor (sd, parent_em), + OutboundDataSize (0) +{ + memset (&ReturnAddress, 0, sizeof(ReturnAddress)); + + /* Provisionally added 19Oct07. All datagram sockets support broadcasting. + * Until now, sending to a broadcast address would give EACCES (permission denied) + * on systems like Linux and BSD that require the SO_BROADCAST socket-option in order + * to accept a packet to a broadcast address. Solaris doesn't require it. I think + * Windows DOES require it but I'm not sure. + * + * Ruby does NOT do what we're doing here. In Ruby, you have to explicitly set SO_BROADCAST + * on a UDP socket in order to enable broadcasting. The reason for requiring the option + * in the first place is so that applications don't send broadcast datagrams by mistake. + * I imagine that could happen if a user of an application typed in an address that happened + * to be a broadcast address on that particular subnet. + * + * This is provisional because someone may eventually come up with a good reason not to + * do it for all UDP sockets. If that happens, then we'll need to add a usercode-level API + * to set the socket option, just like Ruby does. AND WE'LL ALSO BREAK CODE THAT DOESN'T + * EXPLICITLY SET THE OPTION. + */ + + int oval = 1; + setsockopt (GetSocket(), SOL_SOCKET, SO_BROADCAST, (char*)&oval, sizeof(oval)); + + #ifdef HAVE_EPOLL + EpollEvent.events = EPOLLIN; + #endif + #ifdef HAVE_KQUEUE + MyEventMachine->ArmKqueueReader (this); + #endif +} + + +/*************************************** +DatagramDescriptor::~DatagramDescriptor +***************************************/ + +DatagramDescriptor::~DatagramDescriptor() +{ + // Run down any stranded outbound data. + for (size_t i=0; i < OutboundPages.size(); i++) + OutboundPages[i].Free(); +} + + +/***************************** +DatagramDescriptor::Heartbeat +*****************************/ + +void DatagramDescriptor::Heartbeat() +{ + // Close it if its inactivity timer has expired. + + if (InactivityTimeout && ((MyEventMachine->GetCurrentLoopTime() - LastActivity) >= InactivityTimeout)) + ScheduleClose (false); + //bCloseNow = true; +} + + +/************************ +DatagramDescriptor::Read +************************/ + +void DatagramDescriptor::Read() +{ + int sd = GetSocket(); + assert (sd != INVALID_SOCKET); + LastActivity = MyEventMachine->GetCurrentLoopTime(); + + // This is an extremely large read buffer. + // In many cases you wouldn't expect to get any more than 4K. + char readbuffer [16 * 1024]; + + for (int i=0; i < 10; i++) { + // Don't read just one buffer and then move on. This is faster + // if there is a lot of incoming. + // But don't read indefinitely. Give other sockets a chance to run. + // NOTICE, we're reading one less than the buffer size. + // That's so we can put a guard byte at the end of what we send + // to user code. + + struct sockaddr_in sin; + socklen_t slen = sizeof (sin); + memset (&sin, 0, slen); + + int r = recvfrom (sd, readbuffer, sizeof(readbuffer) - 1, 0, (struct sockaddr*)&sin, &slen); + //cerr << ""; + + // In UDP, a zero-length packet is perfectly legal. + if (r >= 0) { + + // Add a null-terminator at the the end of the buffer + // that we will send to the callback. + // DO NOT EVER CHANGE THIS. We want to explicitly allow users + // to be able to depend on this behavior, so they will have + // the option to do some things faster. Additionally it's + // a security guard against buffer overflows. + readbuffer [r] = 0; + + + // Set up a "temporary" return address so that callers can "reply" to us + // from within the callback we are about to invoke. That means that ordinary + // calls to "send_data_to_connection" (which is of course misnamed in this + // case) will result in packets being sent back to the same place that sent + // us this one. + // There is a different call (evma_send_datagram) for cases where the caller + // actually wants to send a packet somewhere else. + + memset (&ReturnAddress, 0, sizeof(ReturnAddress)); + memcpy (&ReturnAddress, &sin, slen); + + _GenericInboundDispatch(readbuffer, r); + + } + else { + // Basically a would-block, meaning we've read everything there is to read. + break; + } + + } + + +} + + +/************************* +DatagramDescriptor::Write +*************************/ + +void DatagramDescriptor::Write() +{ + /* It's possible for a socket to select writable and then no longer + * be writable by the time we get around to writing. The kernel might + * have used up its available output buffers between the select call + * and when we get here. So this condition is not an error. + * This code is very reminiscent of ConnectionDescriptor::_WriteOutboundData, + * but differs in the that the outbound data pages (received from the + * user) are _message-structured._ That is, we send each of them out + * one message at a time. + * TODO, we are currently suppressing the EMSGSIZE error!!! + */ + + int sd = GetSocket(); + assert (sd != INVALID_SOCKET); + LastActivity = MyEventMachine->GetCurrentLoopTime(); + + assert (OutboundPages.size() > 0); + + // Send out up to 10 packets, then cycle the machine. + for (int i = 0; i < 10; i++) { + if (OutboundPages.size() <= 0) + break; + OutboundPage *op = &(OutboundPages[0]); + + // The nasty cast to (char*) is needed because Windows is brain-dead. + int s = sendto (sd, (char*)op->Buffer, op->Length, 0, (struct sockaddr*)&(op->From), sizeof(op->From)); + int e = errno; + + OutboundDataSize -= op->Length; + op->Free(); + OutboundPages.pop_front(); + + if (s == SOCKET_ERROR) { + #ifdef OS_UNIX + if ((e != EINPROGRESS) && (e != EWOULDBLOCK) && (e != EINTR)) { + #endif + #ifdef OS_WIN32 + if ((e != WSAEINPROGRESS) && (e != WSAEWOULDBLOCK)) { + #endif + UnbindReasonCode = e; + Close(); + break; + } + } + } + + #ifdef HAVE_EPOLL + EpollEvent.events = (EPOLLIN | (SelectForWrite() ? EPOLLOUT : 0)); + assert (MyEventMachine); + MyEventMachine->Modify (this); + #endif + #ifdef HAVE_KQUEUE + if (SelectForWrite()) + MyEventMachine->ArmKqueueWriter (this); + #endif +} + + +/********************************** +DatagramDescriptor::SelectForWrite +**********************************/ + +bool DatagramDescriptor::SelectForWrite() +{ + /* Changed 15Nov07, per bug report by Mark Zvillius. + * The outbound data size will be zero if there are zero-length outbound packets, + * so we now select writable in case the outbound page buffer is not empty. + * Note that the superclass ShouldDelete method still checks for outbound data size, + * which may be wrong. + */ + //return (GetOutboundDataSize() > 0); (Original) + return (OutboundPages.size() > 0); +} + + +/************************************ +DatagramDescriptor::SendOutboundData +************************************/ + +int DatagramDescriptor::SendOutboundData (const char *data, int length) +{ + // This is almost an exact clone of ConnectionDescriptor::_SendRawOutboundData. + // That means most of it could be factored to a common ancestor. Note that + // empty datagrams are meaningful, which isn't the case for TCP streams. + + if (IsCloseScheduled()) + return 0; + + if (!data && (length > 0)) + throw std::runtime_error ("bad outbound data"); + char *buffer = (char *) malloc (length + 1); + if (!buffer) + throw std::runtime_error ("no allocation for outbound data"); + memcpy (buffer, data, length); + buffer [length] = 0; + OutboundPages.push_back (OutboundPage (buffer, length, ReturnAddress)); + OutboundDataSize += length; + + #ifdef HAVE_EPOLL + EpollEvent.events = (EPOLLIN | EPOLLOUT); + assert (MyEventMachine); + MyEventMachine->Modify (this); + #endif + #ifdef HAVE_KQUEUE + MyEventMachine->ArmKqueueWriter (this); + #endif + + return length; +} + + +/**************************************** +DatagramDescriptor::SendOutboundDatagram +****************************************/ + +int DatagramDescriptor::SendOutboundDatagram (const char *data, int length, const char *address, int port) +{ + // This is an exact clone of ConnectionDescriptor::SendOutboundData. + // That means it needs to move to a common ancestor. + // TODO: Refactor this so there's no overlap with SendOutboundData. + + if (IsCloseScheduled()) + //if (bCloseNow || bCloseAfterWriting) + return 0; + + if (!address || !*address || !port) + return 0; + + sockaddr_in pin; + unsigned long HostAddr; + + HostAddr = inet_addr (address); + if (HostAddr == INADDR_NONE) { + // The nasty cast to (char*) is because Windows is brain-dead. + hostent *hp = gethostbyname ((char*)address); + if (!hp) + return 0; + HostAddr = ((in_addr*)(hp->h_addr))->s_addr; + } + + memset (&pin, 0, sizeof(pin)); + pin.sin_family = AF_INET; + pin.sin_addr.s_addr = HostAddr; + pin.sin_port = htons (port); + + + if (!data && (length > 0)) + throw std::runtime_error ("bad outbound data"); + char *buffer = (char *) malloc (length + 1); + if (!buffer) + throw std::runtime_error ("no allocation for outbound data"); + memcpy (buffer, data, length); + buffer [length] = 0; + OutboundPages.push_back (OutboundPage (buffer, length, pin)); + OutboundDataSize += length; + + #ifdef HAVE_EPOLL + EpollEvent.events = (EPOLLIN | EPOLLOUT); + assert (MyEventMachine); + MyEventMachine->Modify (this); + #endif + #ifdef HAVE_KQUEUE + MyEventMachine->ArmKqueueWriter (this); + #endif + + return length; +} + + +/********************************* +ConnectionDescriptor::GetPeername +*********************************/ + +bool ConnectionDescriptor::GetPeername (struct sockaddr *s, socklen_t *len) +{ + bool ok = false; + if (s) { + int gp = getpeername (GetSocket(), s, len); + if (gp == 0) + ok = true; + } + return ok; +} + +/********************************* +ConnectionDescriptor::GetSockname +*********************************/ + +bool ConnectionDescriptor::GetSockname (struct sockaddr *s, socklen_t *len) +{ + bool ok = false; + if (s) { + int gp = getsockname (GetSocket(), s, len); + if (gp == 0) + ok = true; + } + return ok; +} + + +/********************************************** +ConnectionDescriptor::GetCommInactivityTimeout +**********************************************/ + +uint64_t ConnectionDescriptor::GetCommInactivityTimeout() +{ + return InactivityTimeout / 1000; +} + + +/********************************************** +ConnectionDescriptor::SetCommInactivityTimeout +**********************************************/ + +int ConnectionDescriptor::SetCommInactivityTimeout (uint64_t value) +{ + InactivityTimeout = value * 1000; + MyEventMachine->QueueHeartbeat(this); + return 1; +} + +/******************************* +DatagramDescriptor::GetPeername +*******************************/ + +bool DatagramDescriptor::GetPeername (struct sockaddr *s, socklen_t *len) +{ + bool ok = false; + if (s) { + *len = sizeof(struct sockaddr); + memset (s, 0, sizeof(struct sockaddr)); + memcpy (s, &ReturnAddress, sizeof(ReturnAddress)); + ok = true; + } + return ok; +} + +/******************************* +DatagramDescriptor::GetSockname +*******************************/ + +bool DatagramDescriptor::GetSockname (struct sockaddr *s, socklen_t *len) +{ + bool ok = false; + if (s) { + int gp = getsockname (GetSocket(), s, len); + if (gp == 0) + ok = true; + } + return ok; +} + + + +/******************************************** +DatagramDescriptor::GetCommInactivityTimeout +********************************************/ + +uint64_t DatagramDescriptor::GetCommInactivityTimeout() +{ + return InactivityTimeout / 1000; +} + +/******************************************** +DatagramDescriptor::SetCommInactivityTimeout +********************************************/ + +int DatagramDescriptor::SetCommInactivityTimeout (uint64_t value) +{ + if (value > 0) { + InactivityTimeout = value * 1000; + MyEventMachine->QueueHeartbeat(this); + return 1; + } + return 0; +} + + +/************************************ +InotifyDescriptor::InotifyDescriptor +*************************************/ + +InotifyDescriptor::InotifyDescriptor (EventMachine_t *em): + EventableDescriptor(0, em) +{ + bCallbackUnbind = false; + + #ifndef HAVE_INOTIFY + throw std::runtime_error("no inotify support on this system"); + #else + + int fd = inotify_init(); + if (fd == -1) { + char buf[200]; + snprintf (buf, sizeof(buf)-1, "unable to create inotify descriptor: %s", strerror(errno)); + throw std::runtime_error (buf); + } + + MySocket = fd; + SetSocketNonblocking(MySocket); + #ifdef HAVE_EPOLL + EpollEvent.events = EPOLLIN; + #endif + + #endif +} + + +/************************************* +InotifyDescriptor::~InotifyDescriptor +**************************************/ + +InotifyDescriptor::~InotifyDescriptor() +{ + close(MySocket); + MySocket = INVALID_SOCKET; +} + +/*********************** +InotifyDescriptor::Read +************************/ + +void InotifyDescriptor::Read() +{ + assert (MyEventMachine); + MyEventMachine->_ReadInotifyEvents(); +} + + +/************************ +InotifyDescriptor::Write +*************************/ + +void InotifyDescriptor::Write() +{ + throw std::runtime_error("bad code path in inotify"); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/ed.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/ed.h new file mode 100644 index 000000000..d28b53685 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/ed.h @@ -0,0 +1,422 @@ +/***************************************************************************** + +$Id$ + +File: ed.h +Date: 06Apr06 + +Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +Gmail: blackhedd + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + +#ifndef __EventableDescriptor__H_ +#define __EventableDescriptor__H_ + + +class EventMachine_t; // forward reference +#ifdef WITH_SSL +class SslBox_t; // forward reference +#endif + +bool SetSocketNonblocking (SOCKET); + + +/************************* +class EventableDescriptor +*************************/ + +class EventableDescriptor: public Bindable_t +{ + public: + EventableDescriptor (int, EventMachine_t*); + virtual ~EventableDescriptor(); + + int GetSocket() {return MySocket;} + void SetSocketInvalid() { MySocket = INVALID_SOCKET; } + void Close(); + + virtual void Read() = 0; + virtual void Write() = 0; + virtual void Heartbeat() = 0; + + // These methods tell us whether the descriptor + // should be selected or polled for read/write. + virtual bool SelectForRead() = 0; + virtual bool SelectForWrite() = 0; + + // are we scheduled for a close, or in an error state, or already closed? + bool ShouldDelete(); + // Do we have any data to write? This is used by ShouldDelete. + virtual int GetOutboundDataSize() {return 0;} + virtual bool IsWatchOnly(){ return bWatchOnly; } + + virtual void ScheduleClose (bool after_writing); + bool IsCloseScheduled(); + virtual void HandleError(){ ScheduleClose (false); } + + void SetEventCallback (EMCallback); + + virtual bool GetPeername (struct sockaddr*, socklen_t*) {return false;} + virtual bool GetSockname (struct sockaddr*, socklen_t*) {return false;} + virtual bool GetSubprocessPid (pid_t*) {return false;} + + virtual void StartTls() {} + virtual void SetTlsParms (const char *privkey_filename, const char *certchain_filename, bool verify_peer) {} + + #ifdef WITH_SSL + virtual X509 *GetPeerCert() {return NULL;} + #endif + + virtual uint64_t GetCommInactivityTimeout() {return 0;} + virtual int SetCommInactivityTimeout (uint64_t value) {return 0;} + uint64_t GetPendingConnectTimeout(); + int SetPendingConnectTimeout (uint64_t value); + uint64_t GetLastActivity() { return LastActivity; } + + #ifdef HAVE_EPOLL + struct epoll_event *GetEpollEvent() { return &EpollEvent; } + #endif + + virtual void StartProxy(const unsigned long, const unsigned long, const unsigned long); + virtual void StopProxy(); + virtual unsigned long GetProxiedBytes(){ return ProxiedBytes; }; + virtual void SetProxiedFrom(EventableDescriptor*, const unsigned long); + virtual int SendOutboundData(const char*,int){ return -1; } + virtual bool IsPaused(){ return bPaused; } + virtual bool Pause(){ bPaused = true; return bPaused; } + virtual bool Resume(){ bPaused = false; return bPaused; } + + void SetUnbindReasonCode(int code){ UnbindReasonCode = code; } + virtual int ReportErrorStatus(){ return 0; } + virtual bool IsConnectPending(){ return false; } + virtual uint64_t GetNextHeartbeat(); + + private: + bool bCloseNow; + bool bCloseAfterWriting; + + protected: + int MySocket; + bool bAttached; + bool bWatchOnly; + + EMCallback EventCallback; + void _GenericInboundDispatch(const char*, int); + + uint64_t CreatedAt; + bool bCallbackUnbind; + int UnbindReasonCode; + + unsigned long BytesToProxy; + EventableDescriptor *ProxyTarget; + EventableDescriptor *ProxiedFrom; + unsigned long ProxiedBytes; + + unsigned long MaxOutboundBufSize; + + #ifdef HAVE_EPOLL + struct epoll_event EpollEvent; + #endif + + EventMachine_t *MyEventMachine; + uint64_t PendingConnectTimeout; + uint64_t InactivityTimeout; + uint64_t LastActivity; + uint64_t NextHeartbeat; + bool bPaused; +}; + + + +/************************* +class LoopbreakDescriptor +*************************/ + +class LoopbreakDescriptor: public EventableDescriptor +{ + public: + LoopbreakDescriptor (int, EventMachine_t*); + virtual ~LoopbreakDescriptor() {} + + virtual void Read(); + virtual void Write(); + virtual void Heartbeat() {} + + virtual bool SelectForRead() {return true;} + virtual bool SelectForWrite() {return false;} +}; + + +/************************** +class ConnectionDescriptor +**************************/ + +class ConnectionDescriptor: public EventableDescriptor +{ + public: + ConnectionDescriptor (int, EventMachine_t*); + virtual ~ConnectionDescriptor(); + + int SendOutboundData (const char*, int); + + void SetConnectPending (bool f); + virtual void ScheduleClose (bool after_writing); + virtual void HandleError(); + + void SetNotifyReadable (bool); + void SetNotifyWritable (bool); + void SetAttached (bool); + void SetWatchOnly (bool); + + bool Pause(); + bool Resume(); + + bool IsNotifyReadable(){ return bNotifyReadable; } + bool IsNotifyWritable(){ return bNotifyWritable; } + + virtual void Read(); + virtual void Write(); + virtual void Heartbeat(); + + virtual bool SelectForRead(); + virtual bool SelectForWrite(); + + // Do we have any data to write? This is used by ShouldDelete. + virtual int GetOutboundDataSize() {return OutboundDataSize;} + + virtual void StartTls(); + virtual void SetTlsParms (const char *privkey_filename, const char *certchain_filename, bool verify_peer); + + #ifdef WITH_SSL + virtual X509 *GetPeerCert(); + virtual bool VerifySslPeer(const char*); + virtual void AcceptSslPeer(); + #endif + + void SetServerMode() {bIsServer = true;} + + virtual bool GetPeername (struct sockaddr*, socklen_t*); + virtual bool GetSockname (struct sockaddr*, socklen_t*); + + virtual uint64_t GetCommInactivityTimeout(); + virtual int SetCommInactivityTimeout (uint64_t value); + + virtual int ReportErrorStatus(); + virtual bool IsConnectPending(){ return bConnectPending; } + + protected: + struct OutboundPage { + OutboundPage (const char *b, int l, int o=0): Buffer(b), Length(l), Offset(o) {} + void Free() {if (Buffer) free ((char*)Buffer); } + const char *Buffer; + int Length; + int Offset; + }; + + protected: + bool bConnectPending; + + bool bNotifyReadable; + bool bNotifyWritable; + + bool bReadAttemptedAfterClose; + bool bWriteAttemptedAfterClose; + + deque OutboundPages; + int OutboundDataSize; + + #ifdef WITH_SSL + SslBox_t *SslBox; + std::string CertChainFilename; + std::string PrivateKeyFilename; + bool bHandshakeSignaled; + bool bSslVerifyPeer; + bool bSslPeerAccepted; + #endif + + #ifdef HAVE_KQUEUE + bool bGotExtraKqueueEvent; + #endif + + bool bIsServer; + + private: + void _UpdateEvents(); + void _UpdateEvents(bool, bool); + void _WriteOutboundData(); + void _DispatchInboundData (const char *buffer, int size); + void _DispatchCiphertext(); + int _SendRawOutboundData (const char*, int); + void _CheckHandshakeStatus(); + +}; + + +/************************ +class DatagramDescriptor +************************/ + +class DatagramDescriptor: public EventableDescriptor +{ + public: + DatagramDescriptor (int, EventMachine_t*); + virtual ~DatagramDescriptor(); + + virtual void Read(); + virtual void Write(); + virtual void Heartbeat(); + + virtual bool SelectForRead() {return true;} + virtual bool SelectForWrite(); + + int SendOutboundData (const char*, int); + int SendOutboundDatagram (const char*, int, const char*, int); + + // Do we have any data to write? This is used by ShouldDelete. + virtual int GetOutboundDataSize() {return OutboundDataSize;} + + virtual bool GetPeername (struct sockaddr*, socklen_t*); + virtual bool GetSockname (struct sockaddr*, socklen_t*); + + virtual uint64_t GetCommInactivityTimeout(); + virtual int SetCommInactivityTimeout (uint64_t value); + + protected: + struct OutboundPage { + OutboundPage (const char *b, int l, struct sockaddr_in f, int o=0): Buffer(b), Length(l), Offset(o), From(f) {} + void Free() {if (Buffer) free ((char*)Buffer); } + const char *Buffer; + int Length; + int Offset; + struct sockaddr_in From; + }; + + deque OutboundPages; + int OutboundDataSize; + + struct sockaddr_in ReturnAddress; +}; + + +/************************ +class AcceptorDescriptor +************************/ + +class AcceptorDescriptor: public EventableDescriptor +{ + public: + AcceptorDescriptor (int, EventMachine_t*); + virtual ~AcceptorDescriptor(); + + virtual void Read(); + virtual void Write(); + virtual void Heartbeat(); + + virtual bool SelectForRead() {return true;} + virtual bool SelectForWrite() {return false;} + + virtual bool GetSockname (struct sockaddr*, socklen_t*); + + static void StopAcceptor (const unsigned long binding); +}; + +/******************** +class PipeDescriptor +********************/ + +#ifdef OS_UNIX +class PipeDescriptor: public EventableDescriptor +{ + public: + PipeDescriptor (int, pid_t, EventMachine_t*); + virtual ~PipeDescriptor(); + + virtual void Read(); + virtual void Write(); + virtual void Heartbeat(); + + virtual bool SelectForRead(); + virtual bool SelectForWrite(); + + int SendOutboundData (const char*, int); + virtual int GetOutboundDataSize() {return OutboundDataSize;} + + virtual bool GetSubprocessPid (pid_t*); + + protected: + struct OutboundPage { + OutboundPage (const char *b, int l, int o=0): Buffer(b), Length(l), Offset(o) {} + void Free() {if (Buffer) free ((char*)Buffer); } + const char *Buffer; + int Length; + int Offset; + }; + + protected: + bool bReadAttemptedAfterClose; + + deque OutboundPages; + int OutboundDataSize; + + pid_t SubprocessPid; + + private: + void _DispatchInboundData (const char *buffer, int size); +}; +#endif // OS_UNIX + + +/************************ +class KeyboardDescriptor +************************/ + +class KeyboardDescriptor: public EventableDescriptor +{ + public: + KeyboardDescriptor (EventMachine_t*); + virtual ~KeyboardDescriptor(); + + virtual void Read(); + virtual void Write(); + virtual void Heartbeat(); + + virtual bool SelectForRead() {return true;} + virtual bool SelectForWrite() {return false;} + + protected: + bool bReadAttemptedAfterClose; + + private: + void _DispatchInboundData (const char *buffer, int size); +}; + + +/*********************** +class InotifyDescriptor +************************/ + +class InotifyDescriptor: public EventableDescriptor +{ + public: + InotifyDescriptor (EventMachine_t*); + virtual ~InotifyDescriptor(); + + void Read(); + void Write(); + + virtual void Heartbeat() {} + virtual bool SelectForRead() {return true;} + virtual bool SelectForWrite() {return false;} +}; + +#endif // __EventableDescriptor__H_ + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/em.cpp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/em.cpp new file mode 100644 index 000000000..cc1312f0b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/em.cpp @@ -0,0 +1,2353 @@ +/***************************************************************************** + +$Id$ + +File: em.cpp +Date: 06Apr06 + +Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +Gmail: blackhedd + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + +// THIS ENTIRE FILE WILL EVENTUALLY BE FOR UNIX BUILDS ONLY. +//#ifdef OS_UNIX + +#include "project.h" + +/* The numer of max outstanding timers was once a const enum defined in em.h. + * Now we define it here so that users can change its value if necessary. + */ +static unsigned int MaxOutstandingTimers = 100000; + + +/* Internal helper to convert strings to internet addresses. IPv6-aware. + * Not reentrant or threadsafe, optimized for speed. + */ +static struct sockaddr *name2address (const char *server, int port, int *family, int *bind_size); + +/*************************************** +STATIC EventMachine_t::GetMaxTimerCount +***************************************/ + +int EventMachine_t::GetMaxTimerCount() +{ + return MaxOutstandingTimers; +} + + +/*************************************** +STATIC EventMachine_t::SetMaxTimerCount +***************************************/ + +void EventMachine_t::SetMaxTimerCount (int count) +{ + /* Allow a user to increase the maximum number of outstanding timers. + * If this gets "too high" (a metric that is of course platform dependent), + * bad things will happen like performance problems and possible overuse + * of memory. + * The actual timer mechanism is very efficient so it's hard to know what + * the practical max, but 100,000 shouldn't be too problematical. + */ + if (count < 100) + count = 100; + MaxOutstandingTimers = count; +} + + + +/****************************** +EventMachine_t::EventMachine_t +******************************/ + +EventMachine_t::EventMachine_t (EMCallback event_callback): + HeartbeatInterval(2000000), + EventCallback (event_callback), + NextHeartbeatTime (0), + LoopBreakerReader (-1), + LoopBreakerWriter (-1), + NumCloseScheduled (0), + bTerminateSignalReceived (false), + bEpoll (false), + epfd (-1), + bKqueue (false), + kqfd (-1), + inotify (NULL) +{ + // Default time-slice is just smaller than one hundred mills. + Quantum.tv_sec = 0; + Quantum.tv_usec = 90000; + + // Make sure the current loop time is sane, in case we do any initializations of + // objects before we start running. + _UpdateTime(); + + /* We initialize the network library here (only on Windows of course) + * and initialize "loop breakers." Our destructor also does some network-level + * cleanup. There's thus an implicit assumption that any given instance of EventMachine_t + * will only call ::Run once. Is that a good assumption? Should we move some of these + * inits and de-inits into ::Run? + */ + #ifdef OS_WIN32 + WSADATA w; + WSAStartup (MAKEWORD (1, 1), &w); + #endif + + _InitializeLoopBreaker(); +} + + +/******************************* +EventMachine_t::~EventMachine_t +*******************************/ + +EventMachine_t::~EventMachine_t() +{ + // Run down descriptors + size_t i; + for (i = 0; i < NewDescriptors.size(); i++) + delete NewDescriptors[i]; + for (i = 0; i < Descriptors.size(); i++) + delete Descriptors[i]; + + close (LoopBreakerReader); + close (LoopBreakerWriter); + + // Remove any file watch descriptors + while(!Files.empty()) { + map::iterator f = Files.begin(); + UnwatchFile (f->first); + } + + if (epfd != -1) + close (epfd); + if (kqfd != -1) + close (kqfd); +} + + +/************************* +EventMachine_t::_UseEpoll +*************************/ + +void EventMachine_t::_UseEpoll() +{ + /* Temporary. + * Use an internal flag to switch in epoll-based functionality until we determine + * how it should be integrated properly and the extent of the required changes. + * A permanent solution needs to allow the integration of additional technologies, + * like kqueue and Solaris's events. + */ + + #ifdef HAVE_EPOLL + bEpoll = true; + #endif +} + +/************************** +EventMachine_t::_UseKqueue +**************************/ + +void EventMachine_t::_UseKqueue() +{ + /* Temporary. + * See comments under _UseEpoll. + */ + + #ifdef HAVE_KQUEUE + bKqueue = true; + #endif +} + + +/**************************** +EventMachine_t::ScheduleHalt +****************************/ + +void EventMachine_t::ScheduleHalt() +{ + /* This is how we stop the machine. + * This can be called by clients. Signal handlers will probably + * set the global flag. + * For now this means there can only be one EventMachine ever running at a time. + * + * IMPORTANT: keep this light, fast, and async-safe. Don't do anything frisky in here, + * because it may be called from signal handlers invoked from code that we don't + * control. At this writing (20Sep06), EM does NOT install any signal handlers of + * its own. + * + * We need a FAQ. And one of the questions is: how do I stop EM when Ctrl-C happens? + * The answer is to call evma_stop_machine, which calls here, from a SIGINT handler. + */ + bTerminateSignalReceived = true; +} + + + +/******************************* +EventMachine_t::SetTimerQuantum +*******************************/ + +void EventMachine_t::SetTimerQuantum (int interval) +{ + /* We get a timer-quantum expressed in milliseconds. + */ + + if ((interval < 5) || (interval > 5*60*1000)) + throw std::runtime_error ("invalid timer-quantum"); + + Quantum.tv_sec = interval / 1000; + Quantum.tv_usec = (interval % 1000) * 1000; +} + + +/************************************* +(STATIC) EventMachine_t::SetuidString +*************************************/ + +void EventMachine_t::SetuidString (const char *username) +{ + /* This method takes a caller-supplied username and tries to setuid + * to that user. There is no meaningful implementation (and no error) + * on Windows. On Unix, a failure to setuid the caller-supplied string + * causes a fatal abort, because presumably the program is calling here + * in order to fulfill a security requirement. If we fail silently, + * the user may continue to run with too much privilege. + * + * TODO, we need to decide on and document a way of generating C++ level errors + * that can be wrapped in documented Ruby exceptions, so users can catch + * and handle them. And distinguish it from errors that we WON'T let the Ruby + * user catch (like security-violations and resource-overallocation). + * A setuid failure here would be in the latter category. + */ + + #ifdef OS_UNIX + if (!username || !*username) + throw std::runtime_error ("setuid_string failed: no username specified"); + + struct passwd *p = getpwnam (username); + if (!p) + throw std::runtime_error ("setuid_string failed: unknown username"); + + if (setuid (p->pw_uid) != 0) + throw std::runtime_error ("setuid_string failed: no setuid"); + + // Success. + #endif +} + + +/**************************************** +(STATIC) EventMachine_t::SetRlimitNofile +****************************************/ + +int EventMachine_t::SetRlimitNofile (int nofiles) +{ + #ifdef OS_UNIX + struct rlimit rlim; + getrlimit (RLIMIT_NOFILE, &rlim); + if (nofiles >= 0) { + rlim.rlim_cur = nofiles; + if ((unsigned int)nofiles > rlim.rlim_max) + rlim.rlim_max = nofiles; + setrlimit (RLIMIT_NOFILE, &rlim); + // ignore the error return, for now at least. + // TODO, emit an error message someday when we have proper debug levels. + } + getrlimit (RLIMIT_NOFILE, &rlim); + return rlim.rlim_cur; + #endif + + #ifdef OS_WIN32 + // No meaningful implementation on Windows. + return 0; + #endif +} + + +/********************************* +EventMachine_t::SignalLoopBreaker +*********************************/ + +void EventMachine_t::SignalLoopBreaker() +{ + #ifdef OS_UNIX + write (LoopBreakerWriter, "", 1); + #endif + #ifdef OS_WIN32 + sendto (LoopBreakerReader, "", 0, 0, (struct sockaddr*)&(LoopBreakerTarget), sizeof(LoopBreakerTarget)); + #endif +} + + +/************************************** +EventMachine_t::_InitializeLoopBreaker +**************************************/ + +void EventMachine_t::_InitializeLoopBreaker() +{ + /* A "loop-breaker" is a socket-descriptor that we can write to in order + * to break the main select loop. Primarily useful for things running on + * threads other than the main EM thread, so they can trigger processing + * of events that arise exogenously to the EM. + * Keep the loop-breaker pipe out of the main descriptor set, otherwise + * its events will get passed on to user code. + */ + + #ifdef OS_UNIX + int fd[2]; + if (pipe (fd)) + throw std::runtime_error (strerror(errno)); + + LoopBreakerWriter = fd[1]; + LoopBreakerReader = fd[0]; + + /* 16Jan11: Make sure the pipe is non-blocking, so more than 65k loopbreaks + * in one tick do not fill up the pipe and block the process on write() */ + SetSocketNonblocking (LoopBreakerWriter); + #endif + + #ifdef OS_WIN32 + int sd = socket (AF_INET, SOCK_DGRAM, 0); + if (sd == INVALID_SOCKET) + throw std::runtime_error ("no loop breaker socket"); + SetSocketNonblocking (sd); + + memset (&LoopBreakerTarget, 0, sizeof(LoopBreakerTarget)); + LoopBreakerTarget.sin_family = AF_INET; + LoopBreakerTarget.sin_addr.s_addr = inet_addr ("127.0.0.1"); + + srand ((int)time(NULL)); + int i; + for (i=0; i < 100; i++) { + int r = (rand() % 10000) + 20000; + LoopBreakerTarget.sin_port = htons (r); + if (bind (sd, (struct sockaddr*)&LoopBreakerTarget, sizeof(LoopBreakerTarget)) == 0) + break; + } + + if (i == 100) + throw std::runtime_error ("no loop breaker"); + LoopBreakerReader = sd; + #endif +} + +/*************************** +EventMachine_t::_UpdateTime +***************************/ + +void EventMachine_t::_UpdateTime() +{ + MyCurrentLoopTime = GetRealTime(); +} + +/*************************** +EventMachine_t::GetRealTime +***************************/ + +uint64_t EventMachine_t::GetRealTime() +{ + uint64_t current_time; + + #if defined(OS_UNIX) + struct timeval tv; + gettimeofday (&tv, NULL); + current_time = (((uint64_t)(tv.tv_sec)) * 1000000LL) + ((uint64_t)(tv.tv_usec)); + + #elif defined(OS_WIN32) + unsigned tick = GetTickCount(); + if (tick < LastTickCount) + TickCountTickover += 1; + LastTickCount = tick; + current_time = ((uint64_t)TickCountTickover << 32) + (uint64_t)tick; + current_time *= 1000; // convert to microseconds + + #else + current_time = (uint64_t)time(NULL) * 1000000LL; + #endif + + return current_time; +} + +/*********************************** +EventMachine_t::_DispatchHeartbeats +***********************************/ + +void EventMachine_t::_DispatchHeartbeats() +{ + while (true) { + multimap::iterator i = Heartbeats.begin(); + if (i == Heartbeats.end()) + break; + if (i->first > MyCurrentLoopTime) + break; + EventableDescriptor *ed = i->second; + ed->Heartbeat(); + QueueHeartbeat(ed); + } +} + +/****************************** +EventMachine_t::QueueHeartbeat +******************************/ + +void EventMachine_t::QueueHeartbeat(EventableDescriptor *ed) +{ + uint64_t heartbeat = ed->GetNextHeartbeat(); + + if (heartbeat) { + #ifndef HAVE_MAKE_PAIR + Heartbeats.insert (multimap::value_type (heartbeat, ed)); + #else + Heartbeats.insert (make_pair (heartbeat, ed)); + #endif + } +} + +/****************************** +EventMachine_t::ClearHeartbeat +******************************/ + +void EventMachine_t::ClearHeartbeat(uint64_t key, EventableDescriptor* ed) +{ + multimap::iterator it; + pair::iterator,multimap::iterator> ret; + ret = Heartbeats.equal_range (key); + for (it = ret.first; it != ret.second; ++it) { + if (it->second == ed) { + Heartbeats.erase (it); + break; + } + } +} + +/******************* +EventMachine_t::Run +*******************/ + +void EventMachine_t::Run() +{ + #ifdef HAVE_EPOLL + if (bEpoll) { + epfd = epoll_create (MaxEpollDescriptors); + if (epfd == -1) { + char buf[200]; + snprintf (buf, sizeof(buf)-1, "unable to create epoll descriptor: %s", strerror(errno)); + throw std::runtime_error (buf); + } + int cloexec = fcntl (epfd, F_GETFD, 0); + assert (cloexec >= 0); + cloexec |= FD_CLOEXEC; + fcntl (epfd, F_SETFD, cloexec); + + assert (LoopBreakerReader >= 0); + LoopbreakDescriptor *ld = new LoopbreakDescriptor (LoopBreakerReader, this); + assert (ld); + Add (ld); + } + #endif + + #ifdef HAVE_KQUEUE + if (bKqueue) { + kqfd = kqueue(); + if (kqfd == -1) { + char buf[200]; + snprintf (buf, sizeof(buf)-1, "unable to create kqueue descriptor: %s", strerror(errno)); + throw std::runtime_error (buf); + } + // cloexec not needed. By definition, kqueues are not carried across forks. + + assert (LoopBreakerReader >= 0); + LoopbreakDescriptor *ld = new LoopbreakDescriptor (LoopBreakerReader, this); + assert (ld); + Add (ld); + } + #endif + + while (true) { + _UpdateTime(); + _RunTimers(); + + /* _Add must precede _Modify because the same descriptor might + * be on both lists during the same pass through the machine, + * and to modify a descriptor before adding it would fail. + */ + _AddNewDescriptors(); + _ModifyDescriptors(); + + if (!_RunOnce()) + break; + if (bTerminateSignalReceived) + break; + } +} + + +/************************ +EventMachine_t::_RunOnce +************************/ + +bool EventMachine_t::_RunOnce() +{ + bool ret; + if (bEpoll) + ret = _RunEpollOnce(); + else if (bKqueue) + ret = _RunKqueueOnce(); + else + ret = _RunSelectOnce(); + _DispatchHeartbeats(); + _CleanupSockets(); + return ret; +} + + + +/***************************** +EventMachine_t::_RunEpollOnce +*****************************/ + +bool EventMachine_t::_RunEpollOnce() +{ + #ifdef HAVE_EPOLL + assert (epfd != -1); + int s; + + timeval tv = _TimeTilNextEvent(); + + #ifdef BUILD_FOR_RUBY + int ret = 0; + fd_set fdreads; + + FD_ZERO(&fdreads); + FD_SET(epfd, &fdreads); + + if ((ret = rb_thread_select(epfd + 1, &fdreads, NULL, NULL, &tv)) < 1) { + if (ret == -1) { + assert(errno != EINVAL); + assert(errno != EBADF); + } + return true; + } + + TRAP_BEG; + s = epoll_wait (epfd, epoll_events, MaxEvents, 0); + TRAP_END; + #else + int duration = 0; + duration = duration + (tv.tv_sec * 1000); + duration = duration + (tv.tv_usec / 1000); + s = epoll_wait (epfd, epoll_events, MaxEvents, duration); + #endif + + if (s > 0) { + for (int i=0; i < s; i++) { + EventableDescriptor *ed = (EventableDescriptor*) epoll_events[i].data.ptr; + + if (ed->IsWatchOnly() && ed->GetSocket() == INVALID_SOCKET) + continue; + + assert(ed->GetSocket() != INVALID_SOCKET); + + if (epoll_events[i].events & EPOLLIN) + ed->Read(); + if (epoll_events[i].events & EPOLLOUT) + ed->Write(); + if (epoll_events[i].events & (EPOLLERR | EPOLLHUP)) + ed->HandleError(); + } + } + else if (s < 0) { + // epoll_wait can fail on error in a handful of ways. + // If this happens, then wait for a little while to avoid busy-looping. + // If the error was EINTR, we probably caught SIGCHLD or something, + // so keep the wait short. + timeval tv = {0, ((errno == EINTR) ? 5 : 50) * 1000}; + EmSelect (0, NULL, NULL, NULL, &tv); + } + + return true; + #else + throw std::runtime_error ("epoll is not implemented on this platform"); + #endif +} + + +/****************************** +EventMachine_t::_RunKqueueOnce +******************************/ + +bool EventMachine_t::_RunKqueueOnce() +{ + #ifdef HAVE_KQUEUE + assert (kqfd != -1); + int k; + + timeval tv = _TimeTilNextEvent(); + + struct timespec ts; + ts.tv_sec = tv.tv_sec; + ts.tv_nsec = tv.tv_usec * 1000; + + #ifdef BUILD_FOR_RUBY + int ret = 0; + fd_set fdreads; + + FD_ZERO(&fdreads); + FD_SET(kqfd, &fdreads); + + if ((ret = rb_thread_select(kqfd + 1, &fdreads, NULL, NULL, &tv)) < 1) { + if (ret == -1) { + assert(errno != EINVAL); + assert(errno != EBADF); + } + return true; + } + + TRAP_BEG; + ts.tv_sec = ts.tv_nsec = 0; + k = kevent (kqfd, NULL, 0, Karray, MaxEvents, &ts); + TRAP_END; + #else + k = kevent (kqfd, NULL, 0, Karray, MaxEvents, &ts); + #endif + + struct kevent *ke = Karray; + while (k > 0) { + switch (ke->filter) + { + case EVFILT_VNODE: + _HandleKqueueFileEvent (ke); + break; + + case EVFILT_PROC: + _HandleKqueuePidEvent (ke); + break; + + case EVFILT_READ: + case EVFILT_WRITE: + EventableDescriptor *ed = (EventableDescriptor*) (ke->udata); + assert (ed); + + if (ed->IsWatchOnly() && ed->GetSocket() == INVALID_SOCKET) + break; + + if (ke->filter == EVFILT_READ) + ed->Read(); + else if (ke->filter == EVFILT_WRITE) + ed->Write(); + else + cerr << "Discarding unknown kqueue event " << ke->filter << endl; + + break; + } + + --k; + ++ke; + } + + // TODO, replace this with rb_thread_blocking_region for 1.9 builds. + #ifdef BUILD_FOR_RUBY + if (!rb_thread_alone()) { + rb_thread_schedule(); + } + #endif + + return true; + #else + throw std::runtime_error ("kqueue is not implemented on this platform"); + #endif +} + + +/********************************* +EventMachine_t::_TimeTilNextEvent +*********************************/ + +timeval EventMachine_t::_TimeTilNextEvent() +{ + // 29jul11: Changed calculation base from MyCurrentLoopTime to the + // real time. As MyCurrentLoopTime is set at the beginning of an + // iteration and this calculation is done at the end, evenmachine + // will potentially oversleep by the amount of time the iteration + // took to execute. + uint64_t next_event = 0; + uint64_t current_time = GetRealTime(); + + if (!Heartbeats.empty()) { + multimap::iterator heartbeats = Heartbeats.begin(); + next_event = heartbeats->first; + } + + if (!Timers.empty()) { + multimap::iterator timers = Timers.begin(); + if (next_event == 0 || timers->first < next_event) + next_event = timers->first; + } + + if (!NewDescriptors.empty() || !ModifiedDescriptors.empty()) { + next_event = current_time; + } + + timeval tv; + + if (next_event == 0 || NumCloseScheduled > 0) { + tv = Quantum; + } else { + if (next_event > current_time) { + uint64_t duration = next_event - current_time; + tv.tv_sec = duration / 1000000; + tv.tv_usec = duration % 1000000; + } else { + tv.tv_sec = tv.tv_usec = 0; + } + } + + return tv; +} + +/******************************* +EventMachine_t::_CleanupSockets +*******************************/ + +void EventMachine_t::_CleanupSockets() +{ + // TODO, rip this out and only delete the descriptors we know have died, + // rather than traversing the whole list. + // Modified 05Jan08 per suggestions by Chris Heath. It's possible that + // an EventableDescriptor will have a descriptor value of -1. That will + // happen if EventableDescriptor::Close was called on it. In that case, + // don't call epoll_ctl to remove the socket's filters from the epoll set. + // According to the epoll docs, this happens automatically when the + // descriptor is closed anyway. This is different from the case where + // the socket has already been closed but the descriptor in the ED object + // hasn't yet been set to INVALID_SOCKET. + // In kqueue, closing a descriptor automatically removes its event filters. + int i, j; + int nSockets = Descriptors.size(); + for (i=0, j=0; i < nSockets; i++) { + EventableDescriptor *ed = Descriptors[i]; + assert (ed); + if (ed->ShouldDelete()) { + #ifdef HAVE_EPOLL + if (bEpoll) { + assert (epfd != -1); + if (ed->GetSocket() != INVALID_SOCKET) { + int e = epoll_ctl (epfd, EPOLL_CTL_DEL, ed->GetSocket(), ed->GetEpollEvent()); + // ENOENT or EBADF are not errors because the socket may be already closed when we get here. + if (e && (errno != ENOENT) && (errno != EBADF) && (errno != EPERM)) { + char buf [200]; + snprintf (buf, sizeof(buf)-1, "unable to delete epoll event: %s", strerror(errno)); + throw std::runtime_error (buf); + } + } + ModifiedDescriptors.erase(ed); + } + #endif + delete ed; + } + else + Descriptors [j++] = ed; + } + while ((size_t)j < Descriptors.size()) + Descriptors.pop_back(); +} + +/********************************* +EventMachine_t::_ModifyEpollEvent +*********************************/ + +void EventMachine_t::_ModifyEpollEvent (EventableDescriptor *ed) +{ + #ifdef HAVE_EPOLL + if (bEpoll) { + assert (epfd != -1); + assert (ed); + assert (ed->GetSocket() != INVALID_SOCKET); + int e = epoll_ctl (epfd, EPOLL_CTL_MOD, ed->GetSocket(), ed->GetEpollEvent()); + if (e) { + char buf [200]; + snprintf (buf, sizeof(buf)-1, "unable to modify epoll event: %s", strerror(errno)); + throw std::runtime_error (buf); + } + } + #endif +} + + + +/************************** +SelectData_t::SelectData_t +**************************/ + +SelectData_t::SelectData_t() +{ + maxsocket = 0; + FD_ZERO (&fdreads); + FD_ZERO (&fdwrites); + FD_ZERO (&fderrors); +} + + +#ifdef BUILD_FOR_RUBY +/***************** +_SelectDataSelect +*****************/ + +#ifdef HAVE_TBR +static VALUE _SelectDataSelect (void *v) +{ + SelectData_t *sd = (SelectData_t*)v; + sd->nSockets = select (sd->maxsocket+1, &(sd->fdreads), &(sd->fdwrites), &(sd->fderrors), &(sd->tv)); + return Qnil; +} +#endif + +/********************* +SelectData_t::_Select +*********************/ + +int SelectData_t::_Select() +{ + #ifdef HAVE_TBR + rb_thread_blocking_region (_SelectDataSelect, (void*)this, RUBY_UBF_IO, 0); + return nSockets; + #endif + + #ifndef HAVE_TBR + return EmSelect (maxsocket+1, &fdreads, &fdwrites, &fderrors, &tv); + #endif +} +#endif + + + +/****************************** +EventMachine_t::_RunSelectOnce +******************************/ + +bool EventMachine_t::_RunSelectOnce() +{ + // Crank the event machine once. + // If there are no descriptors to process, then sleep + // for a few hundred mills to avoid busy-looping. + // Return T/F to indicate whether we should continue. + // This is based on a select loop. Alternately provide epoll + // if we know we're running on a 2.6 kernel. + // epoll will be effective if we provide it as an alternative, + // however it has the same problem interoperating with Ruby + // threads that select does. + + //cerr << "X"; + + /* This protection is now obsolete, because we will ALWAYS + * have at least one descriptor (the loop-breaker) to read. + */ + /* + if (Descriptors.size() == 0) { + #ifdef OS_UNIX + timeval tv = {0, 200 * 1000}; + EmSelect (0, NULL, NULL, NULL, &tv); + return true; + #endif + #ifdef OS_WIN32 + Sleep (200); + return true; + #endif + } + */ + + SelectData_t SelectData; + /* + fd_set fdreads, fdwrites; + FD_ZERO (&fdreads); + FD_ZERO (&fdwrites); + + int maxsocket = 0; + */ + + // Always read the loop-breaker reader. + // Changed 23Aug06, provisionally implemented for Windows with a UDP socket + // running on localhost with a randomly-chosen port. (*Puke*) + // Windows has a version of the Unix pipe() library function, but it doesn't + // give you back descriptors that are selectable. + FD_SET (LoopBreakerReader, &(SelectData.fdreads)); + if (SelectData.maxsocket < LoopBreakerReader) + SelectData.maxsocket = LoopBreakerReader; + + // prepare the sockets for reading and writing + size_t i; + for (i = 0; i < Descriptors.size(); i++) { + EventableDescriptor *ed = Descriptors[i]; + assert (ed); + int sd = ed->GetSocket(); + if (ed->IsWatchOnly() && sd == INVALID_SOCKET) + continue; + assert (sd != INVALID_SOCKET); + + if (ed->SelectForRead()) + FD_SET (sd, &(SelectData.fdreads)); + if (ed->SelectForWrite()) + FD_SET (sd, &(SelectData.fdwrites)); + + #ifdef OS_WIN32 + /* 21Sep09: on windows, a non-blocking connect() that fails does not come up as writable. + Instead, it is added to the error set. See http://www.mail-archive.com/openssl-users@openssl.org/msg58500.html + */ + FD_SET (sd, &(SelectData.fderrors)); + #endif + + if (SelectData.maxsocket < sd) + SelectData.maxsocket = sd; + } + + + { // read and write the sockets + //timeval tv = {1, 0}; // Solaris fails if the microseconds member is >= 1000000. + //timeval tv = Quantum; + SelectData.tv = _TimeTilNextEvent(); + int s = SelectData._Select(); + //rb_thread_blocking_region(xxx,(void*)&SelectData,RUBY_UBF_IO,0); + //int s = EmSelect (SelectData.maxsocket+1, &(SelectData.fdreads), &(SelectData.fdwrites), NULL, &(SelectData.tv)); + //int s = SelectData.nSockets; + if (s > 0) { + /* Changed 01Jun07. We used to handle the Loop-breaker right here. + * Now we do it AFTER all the regular descriptors. There's an + * incredibly important and subtle reason for this. Code on + * loop breakers is sometimes used to cause the reactor core to + * cycle (for example, to allow outbound network buffers to drain). + * If a loop-breaker handler reschedules itself (say, after determining + * that the write buffers are still too full), then it will execute + * IMMEDIATELY if _ReadLoopBreaker is done here instead of after + * the other descriptors are processed. That defeats the whole purpose. + */ + for (i=0; i < Descriptors.size(); i++) { + EventableDescriptor *ed = Descriptors[i]; + assert (ed); + int sd = ed->GetSocket(); + if (ed->IsWatchOnly() && sd == INVALID_SOCKET) + continue; + assert (sd != INVALID_SOCKET); + + if (FD_ISSET (sd, &(SelectData.fdwrites))) + ed->Write(); + if (FD_ISSET (sd, &(SelectData.fdreads))) + ed->Read(); + if (FD_ISSET (sd, &(SelectData.fderrors))) + ed->HandleError(); + } + + if (FD_ISSET (LoopBreakerReader, &(SelectData.fdreads))) + _ReadLoopBreaker(); + } + else if (s < 0) { + switch (errno) { + case EBADF: + _CleanBadDescriptors(); + break; + case EINVAL: + throw std::runtime_error ("Somehow EM passed an invalid nfds or invalid timeout to select(2), please report this!"); + break; + default: + // select can fail on error in a handful of ways. + // If this happens, then wait for a little while to avoid busy-looping. + // If the error was EINTR, we probably caught SIGCHLD or something, + // so keep the wait short. + timeval tv = {0, ((errno == EINTR) ? 5 : 50) * 1000}; + EmSelect (0, NULL, NULL, NULL, &tv); + } + } + } + + return true; +} + +void EventMachine_t::_CleanBadDescriptors() +{ + size_t i; + + for (i = 0; i < Descriptors.size(); i++) { + EventableDescriptor *ed = Descriptors[i]; + if (ed->ShouldDelete()) + continue; + + int sd = ed->GetSocket(); + + struct timeval tv; + tv.tv_sec = 0; + tv.tv_usec = 0; + + fd_set fds; + FD_ZERO(&fds); + FD_SET(sd, &fds); + + int ret = select(sd + 1, &fds, NULL, NULL, &tv); + + if (ret == -1) { + if (errno == EBADF) + ed->ScheduleClose(false); + } + } +} + +/******************************** +EventMachine_t::_ReadLoopBreaker +********************************/ + +void EventMachine_t::_ReadLoopBreaker() +{ + /* The loop breaker has selected readable. + * Read it ONCE (it may block if we try to read it twice) + * and send a loop-break event back to user code. + */ + char buffer [1024]; + read (LoopBreakerReader, buffer, sizeof(buffer)); + if (EventCallback) + (*EventCallback)(0, EM_LOOPBREAK_SIGNAL, "", 0); +} + + +/************************** +EventMachine_t::_RunTimers +**************************/ + +void EventMachine_t::_RunTimers() +{ + // These are caller-defined timer handlers. + // We rely on the fact that multimaps sort by their keys to avoid + // inspecting the whole list every time we come here. + // Just keep inspecting and processing the list head until we hit + // one that hasn't expired yet. + + while (true) { + multimap::iterator i = Timers.begin(); + if (i == Timers.end()) + break; + if (i->first > MyCurrentLoopTime) + break; + if (EventCallback) + (*EventCallback) (0, EM_TIMER_FIRED, NULL, i->second.GetBinding()); + Timers.erase (i); + } +} + + + +/*********************************** +EventMachine_t::InstallOneshotTimer +***********************************/ + +const unsigned long EventMachine_t::InstallOneshotTimer (int milliseconds) +{ + if (Timers.size() > MaxOutstandingTimers) + return false; + + uint64_t fire_at = GetRealTime(); + fire_at += ((uint64_t)milliseconds) * 1000LL; + + Timer_t t; + #ifndef HAVE_MAKE_PAIR + multimap::iterator i = Timers.insert (multimap::value_type (fire_at, t)); + #else + multimap::iterator i = Timers.insert (make_pair (fire_at, t)); + #endif + return i->second.GetBinding(); +} + + +/******************************* +EventMachine_t::ConnectToServer +*******************************/ + +const unsigned long EventMachine_t::ConnectToServer (const char *bind_addr, int bind_port, const char *server, int port) +{ + /* We want to spend no more than a few seconds waiting for a connection + * to a remote host. So we use a nonblocking connect. + * Linux disobeys the usual rules for nonblocking connects. + * Per Stevens (UNP p.410), you expect a nonblocking connect to select + * both readable and writable on error, and not to return EINPROGRESS + * if the connect can be fulfilled immediately. Linux violates both + * of these expectations. + * Any kind of nonblocking connect on Linux returns EINPROGRESS. + * The socket will then return writable when the disposition of the + * connect is known, but it will not also be readable in case of + * error! Weirdly, it will be readable in case there is data to read!!! + * (Which can happen with protocols like SSH and SMTP.) + * I suppose if you were so inclined you could consider this logical, + * but it's not the way Unix has historically done it. + * So we ignore the readable flag and read getsockopt to see if there + * was an error connecting. A select timeout works as expected. + * In regard to getsockopt: Linux does the Berkeley-style thing, + * not the Solaris-style, and returns zero with the error code in + * the error parameter. + * Return the binding-text of the newly-created pending connection, + * or NULL if there was a problem. + */ + + if (!server || !*server || !port) + throw std::runtime_error ("invalid server or port"); + + int family, bind_size; + struct sockaddr bind_as, *bind_as_ptr = name2address (server, port, &family, &bind_size); + if (!bind_as_ptr) + throw std::runtime_error ("unable to resolve server address"); + bind_as = *bind_as_ptr; // copy because name2address points to a static + + int sd = socket (family, SOCK_STREAM, 0); + if (sd == INVALID_SOCKET) { + char buf [200]; + snprintf (buf, sizeof(buf)-1, "unable to create new socket: %s", strerror(errno)); + throw std::runtime_error (buf); + } + + // From here on, ALL error returns must close the socket. + // Set the new socket nonblocking. + if (!SetSocketNonblocking (sd)) { + close (sd); + throw std::runtime_error ("unable to set socket as non-blocking"); + } + // Disable slow-start (Nagle algorithm). + int one = 1; + setsockopt (sd, IPPROTO_TCP, TCP_NODELAY, (char*) &one, sizeof(one)); + // Set reuseaddr to improve performance on restarts + setsockopt (sd, SOL_SOCKET, SO_REUSEADDR, (char*) &one, sizeof(one)); + + if (bind_addr) { + int bind_to_size, bind_to_family; + struct sockaddr *bind_to = name2address (bind_addr, bind_port, &bind_to_family, &bind_to_size); + if (!bind_to) { + close (sd); + throw std::runtime_error ("invalid bind address"); + } + if (bind (sd, bind_to, bind_to_size) < 0) { + close (sd); + throw std::runtime_error ("couldn't bind to address"); + } + } + + unsigned long out = 0; + int e = 0; + + #ifdef OS_UNIX + //if (connect (sd, (sockaddr*)&pin, sizeof pin) == 0) { + if (connect (sd, &bind_as, bind_size) == 0) { + // This is a connect success, which Linux appears + // never to give when the socket is nonblocking, + // even if the connection is intramachine or to + // localhost. + + /* Changed this branch 08Aug06. Evidently some kernels + * (FreeBSD for example) will actually return success from + * a nonblocking connect. This is a pretty simple case, + * just set up the new connection and clear the pending flag. + * Thanks to Chris Ochs for helping track this down. + * This branch never gets taken on Linux or (oddly) OSX. + * The original behavior was to throw an unimplemented, + * which the user saw as a fatal exception. Very unfriendly. + * + * Tweaked 10Aug06. Even though the connect disposition is + * known, we still set the connect-pending flag. That way + * some needed initialization will happen in the ConnectionDescriptor. + * (To wit, the ConnectionCompleted event gets sent to the client.) + */ + ConnectionDescriptor *cd = new ConnectionDescriptor (sd, this); + if (!cd) + throw std::runtime_error ("no connection allocated"); + cd->SetConnectPending (true); + Add (cd); + out = cd->GetBinding(); + } + else if (errno == EINPROGRESS) { + // Errno will generally always be EINPROGRESS, but on Linux + // we have to look at getsockopt to be sure what really happened. + int error = 0; + socklen_t len; + len = sizeof(error); + int o = getsockopt (sd, SOL_SOCKET, SO_ERROR, &error, &len); + if ((o == 0) && (error == 0)) { + // Here, there's no disposition. + // Put the connection on the stack and wait for it to complete + // or time out. + ConnectionDescriptor *cd = new ConnectionDescriptor (sd, this); + if (!cd) + throw std::runtime_error ("no connection allocated"); + cd->SetConnectPending (true); + Add (cd); + out = cd->GetBinding(); + } else { + // Fall through to the !out case below. + e = error; + } + } + else { + // The error from connect was something other then EINPROGRESS (EHOSTDOWN, etc). + // Fall through to the !out case below + e = errno; + } + + if (!out) { + /* This could be connection refused or some such thing. + * We will come here on Linux if a localhost connection fails. + * Changed 16Jul06: Originally this branch was a no-op, and + * we'd drop down to the end of the method, close the socket, + * and return NULL, which would cause the caller to GET A + * FATAL EXCEPTION. Now we keep the socket around but schedule an + * immediate close on it, so the caller will get a close-event + * scheduled on it. This was only an issue for localhost connections + * to non-listening ports. We may eventually need to revise this + * revised behavior, in case it causes problems like making it hard + * for people to know that a failure occurred. + */ + ConnectionDescriptor *cd = new ConnectionDescriptor (sd, this); + if (!cd) + throw std::runtime_error ("no connection allocated"); + cd->SetUnbindReasonCode(e); + cd->ScheduleClose (false); + Add (cd); + out = cd->GetBinding(); + } + #endif + + #ifdef OS_WIN32 + //if (connect (sd, (sockaddr*)&pin, sizeof pin) == 0) { + if (connect (sd, &bind_as, bind_size) == 0) { + // This is a connect success, which Windows appears + // never to give when the socket is nonblocking, + // even if the connection is intramachine or to + // localhost. + throw std::runtime_error ("unimplemented"); + } + else if (WSAGetLastError() == WSAEWOULDBLOCK) { + // Here, there's no disposition. + // Windows appears not to surface refused connections or + // such stuff at this point. + // Put the connection on the stack and wait for it to complete + // or time out. + ConnectionDescriptor *cd = new ConnectionDescriptor (sd, this); + if (!cd) + throw std::runtime_error ("no connection allocated"); + cd->SetConnectPending (true); + Add (cd); + out = cd->GetBinding(); + } + else { + // The error from connect was something other then WSAEWOULDBLOCK. + } + + #endif + + if (!out) + close (sd); + return out; +} + +/*********************************** +EventMachine_t::ConnectToUnixServer +***********************************/ + +const unsigned long EventMachine_t::ConnectToUnixServer (const char *server) +{ + /* Connect to a Unix-domain server, which by definition is running + * on the same host. + * There is no meaningful implementation on Windows. + * There's no need to do a nonblocking connect, since the connection + * is always local and can always be fulfilled immediately. + */ + + #ifdef OS_WIN32 + throw std::runtime_error ("unix-domain connection unavailable on this platform"); + return 0; + #endif + + // The whole rest of this function is only compiled on Unix systems. + #ifdef OS_UNIX + + unsigned long out = 0; + + if (!server || !*server) + return 0; + + sockaddr_un pun; + memset (&pun, 0, sizeof(pun)); + pun.sun_family = AF_LOCAL; + + // You ordinarily expect the server name field to be at least 1024 bytes long, + // but on Linux it can be MUCH shorter. + if (strlen(server) >= sizeof(pun.sun_path)) + throw std::runtime_error ("unix-domain server name is too long"); + + + strcpy (pun.sun_path, server); + + int fd = socket (AF_LOCAL, SOCK_STREAM, 0); + if (fd == INVALID_SOCKET) + return 0; + + // From here on, ALL error returns must close the socket. + // NOTE: At this point, the socket is still a blocking socket. + if (connect (fd, (struct sockaddr*)&pun, sizeof(pun)) != 0) { + close (fd); + return 0; + } + + // Set the newly-connected socket nonblocking. + if (!SetSocketNonblocking (fd)) { + close (fd); + return 0; + } + + // Set up a connection descriptor and add it to the event-machine. + // Observe, even though we know the connection status is connect-success, + // we still set the "pending" flag, so some needed initializations take + // place. + ConnectionDescriptor *cd = new ConnectionDescriptor (fd, this); + if (!cd) + throw std::runtime_error ("no connection allocated"); + cd->SetConnectPending (true); + Add (cd); + out = cd->GetBinding(); + + if (!out) + close (fd); + + return out; + #endif +} + +/************************ +EventMachine_t::AttachFD +************************/ + +const unsigned long EventMachine_t::AttachFD (int fd, bool watch_mode) +{ + #ifdef OS_UNIX + if (fcntl(fd, F_GETFL, 0) < 0) + throw std::runtime_error ("invalid file descriptor"); + #endif + + #ifdef OS_WIN32 + // TODO: add better check for invalid file descriptors (see ioctlsocket or getsockopt) + if (fd == INVALID_SOCKET) + throw std::runtime_error ("invalid file descriptor"); + #endif + + {// Check for duplicate descriptors + size_t i; + for (i = 0; i < Descriptors.size(); i++) { + EventableDescriptor *ed = Descriptors[i]; + assert (ed); + if (ed->GetSocket() == fd) + throw std::runtime_error ("adding existing descriptor"); + } + + for (i = 0; i < NewDescriptors.size(); i++) { + EventableDescriptor *ed = NewDescriptors[i]; + assert (ed); + if (ed->GetSocket() == fd) + throw std::runtime_error ("adding existing new descriptor"); + } + } + + if (!watch_mode) + SetSocketNonblocking(fd); + + ConnectionDescriptor *cd = new ConnectionDescriptor (fd, this); + if (!cd) + throw std::runtime_error ("no connection allocated"); + + cd->SetAttached(true); + cd->SetWatchOnly(watch_mode); + cd->SetConnectPending (false); + + Add (cd); + + const unsigned long out = cd->GetBinding(); + return out; +} + +/************************ +EventMachine_t::DetachFD +************************/ + +int EventMachine_t::DetachFD (EventableDescriptor *ed) +{ + if (!ed) + throw std::runtime_error ("detaching bad descriptor"); + + int fd = ed->GetSocket(); + + #ifdef HAVE_EPOLL + if (bEpoll) { + if (ed->GetSocket() != INVALID_SOCKET) { + assert (epfd != -1); + int e = epoll_ctl (epfd, EPOLL_CTL_DEL, ed->GetSocket(), ed->GetEpollEvent()); + // ENOENT or EBADF are not errors because the socket may be already closed when we get here. + if (e && (errno != ENOENT) && (errno != EBADF)) { + char buf [200]; + snprintf (buf, sizeof(buf)-1, "unable to delete epoll event: %s", strerror(errno)); + throw std::runtime_error (buf); + } + } + } + #endif + + #ifdef HAVE_KQUEUE + if (bKqueue) { + // remove any read/write events for this fd + struct kevent k; +#ifdef __NetBSD__ + EV_SET (&k, ed->GetSocket(), EVFILT_READ | EVFILT_WRITE, EV_DELETE, 0, 0, (intptr_t)ed); +#else + EV_SET (&k, ed->GetSocket(), EVFILT_READ | EVFILT_WRITE, EV_DELETE, 0, 0, ed); +#endif + int t = kevent (kqfd, &k, 1, NULL, 0, NULL); + if (t < 0 && (errno != ENOENT) && (errno != EBADF)) { + char buf [200]; + snprintf (buf, sizeof(buf)-1, "unable to delete kqueue event: %s", strerror(errno)); + throw std::runtime_error (buf); + } + } + #endif + + // Prevent the descriptor from being modified, in case DetachFD was called from a timer or next_tick + ModifiedDescriptors.erase (ed); + + // Set MySocket = INVALID_SOCKET so ShouldDelete() is true (and the descriptor gets deleted and removed), + // and also to prevent anyone from calling close() on the detached fd + ed->SetSocketInvalid(); + + return fd; +} + +/************ +name2address +************/ + +struct sockaddr *name2address (const char *server, int port, int *family, int *bind_size) +{ + // THIS IS NOT RE-ENTRANT OR THREADSAFE. Optimize for speed. + // Check the more-common cases first. + // Return NULL if no resolution. + + static struct sockaddr_in in4; + #ifndef __CYGWIN__ + static struct sockaddr_in6 in6; + #endif + struct hostent *hp; + + if (!server || !*server) + server = "0.0.0.0"; + + memset (&in4, 0, sizeof(in4)); + if ( (in4.sin_addr.s_addr = inet_addr (server)) != INADDR_NONE) { + if (family) + *family = AF_INET; + if (bind_size) + *bind_size = sizeof(in4); + in4.sin_family = AF_INET; + in4.sin_port = htons (port); + return (struct sockaddr*)&in4; + } + + #if defined(OS_UNIX) && !defined(__CYGWIN__) + memset (&in6, 0, sizeof(in6)); + if (inet_pton (AF_INET6, server, in6.sin6_addr.s6_addr) > 0) { + if (family) + *family = AF_INET6; + if (bind_size) + *bind_size = sizeof(in6); + in6.sin6_family = AF_INET6; + in6.sin6_port = htons (port); + return (struct sockaddr*)&in6; + } + #endif + + #ifdef OS_WIN32 + // TODO, must complete this branch. Windows doesn't have inet_pton. + // A possible approach is to make a getaddrinfo call with the supplied + // server address, constraining the hints to ipv6 and seeing if we + // get any addresses. + // For the time being, Ipv6 addresses aren't supported on Windows. + #endif + + hp = gethostbyname ((char*)server); // Windows requires the cast. + if (hp) { + in4.sin_addr.s_addr = ((in_addr*)(hp->h_addr))->s_addr; + if (family) + *family = AF_INET; + if (bind_size) + *bind_size = sizeof(in4); + in4.sin_family = AF_INET; + in4.sin_port = htons (port); + return (struct sockaddr*)&in4; + } + + return NULL; +} + + +/******************************* +EventMachine_t::CreateTcpServer +*******************************/ + +const unsigned long EventMachine_t::CreateTcpServer (const char *server, int port) +{ + /* Create a TCP-acceptor (server) socket and add it to the event machine. + * Return the binding of the new acceptor to the caller. + * This binding will be referenced when the new acceptor sends events + * to indicate accepted connections. + */ + + + int family, bind_size; + struct sockaddr *bind_here = name2address (server, port, &family, &bind_size); + if (!bind_here) + return 0; + + unsigned long output_binding = 0; + + //struct sockaddr_in sin; + + int sd_accept = socket (family, SOCK_STREAM, 0); + if (sd_accept == INVALID_SOCKET) { + goto fail; + } + + { // set reuseaddr to improve performance on restarts. + int oval = 1; + if (setsockopt (sd_accept, SOL_SOCKET, SO_REUSEADDR, (char*)&oval, sizeof(oval)) < 0) { + //__warning ("setsockopt failed while creating listener",""); + goto fail; + } + } + + { // set CLOEXEC. Only makes sense on Unix + #ifdef OS_UNIX + int cloexec = fcntl (sd_accept, F_GETFD, 0); + assert (cloexec >= 0); + cloexec |= FD_CLOEXEC; + fcntl (sd_accept, F_SETFD, cloexec); + #endif + } + + + //if (bind (sd_accept, (struct sockaddr*)&sin, sizeof(sin))) { + if (bind (sd_accept, bind_here, bind_size)) { + //__warning ("binding failed"); + goto fail; + } + + if (listen (sd_accept, 100)) { + //__warning ("listen failed"); + goto fail; + } + + { + // Set the acceptor non-blocking. + // THIS IS CRUCIALLY IMPORTANT because we read it in a select loop. + if (!SetSocketNonblocking (sd_accept)) { + //int val = fcntl (sd_accept, F_GETFL, 0); + //if (fcntl (sd_accept, F_SETFL, val | O_NONBLOCK) == -1) { + goto fail; + } + } + + { // Looking good. + AcceptorDescriptor *ad = new AcceptorDescriptor (sd_accept, this); + if (!ad) + throw std::runtime_error ("unable to allocate acceptor"); + Add (ad); + output_binding = ad->GetBinding(); + } + + return output_binding; + + fail: + if (sd_accept != INVALID_SOCKET) + close (sd_accept); + return 0; +} + + +/********************************** +EventMachine_t::OpenDatagramSocket +**********************************/ + +const unsigned long EventMachine_t::OpenDatagramSocket (const char *address, int port) +{ + unsigned long output_binding = 0; + + int sd = socket (AF_INET, SOCK_DGRAM, 0); + if (sd == INVALID_SOCKET) + goto fail; + // from here on, early returns must close the socket! + + + struct sockaddr_in sin; + memset (&sin, 0, sizeof(sin)); + sin.sin_family = AF_INET; + sin.sin_port = htons (port); + + + if (address && *address) { + sin.sin_addr.s_addr = inet_addr (address); + if (sin.sin_addr.s_addr == INADDR_NONE) { + hostent *hp = gethostbyname ((char*)address); // Windows requires the cast. + if (hp == NULL) + goto fail; + sin.sin_addr.s_addr = ((in_addr*)(hp->h_addr))->s_addr; + } + } + else + sin.sin_addr.s_addr = htonl (INADDR_ANY); + + + // Set the new socket nonblocking. + { + if (!SetSocketNonblocking (sd)) + //int val = fcntl (sd, F_GETFL, 0); + //if (fcntl (sd, F_SETFL, val | O_NONBLOCK) == -1) + goto fail; + } + + if (bind (sd, (struct sockaddr*)&sin, sizeof(sin)) != 0) + goto fail; + + { // Looking good. + DatagramDescriptor *ds = new DatagramDescriptor (sd, this); + if (!ds) + throw std::runtime_error ("unable to allocate datagram-socket"); + Add (ds); + output_binding = ds->GetBinding(); + } + + return output_binding; + + fail: + if (sd != INVALID_SOCKET) + close (sd); + return 0; +} + + + +/******************* +EventMachine_t::Add +*******************/ + +void EventMachine_t::Add (EventableDescriptor *ed) +{ + if (!ed) + throw std::runtime_error ("added bad descriptor"); + ed->SetEventCallback (EventCallback); + NewDescriptors.push_back (ed); +} + + +/******************************* +EventMachine_t::ArmKqueueWriter +*******************************/ + +void EventMachine_t::ArmKqueueWriter (EventableDescriptor *ed) +{ + #ifdef HAVE_KQUEUE + if (bKqueue) { + if (!ed) + throw std::runtime_error ("added bad descriptor"); + struct kevent k; +#ifdef __NetBSD__ + EV_SET (&k, ed->GetSocket(), EVFILT_WRITE, EV_ADD | EV_ONESHOT, 0, 0, (intptr_t)ed); +#else + EV_SET (&k, ed->GetSocket(), EVFILT_WRITE, EV_ADD | EV_ONESHOT, 0, 0, ed); +#endif + int t = kevent (kqfd, &k, 1, NULL, 0, NULL); + if (t < 0) { + char buf [200]; + snprintf (buf, sizeof(buf)-1, "arm kqueue writer failed on %d: %s", ed->GetSocket(), strerror(errno)); + throw std::runtime_error (buf); + } + } + #endif +} + +/******************************* +EventMachine_t::ArmKqueueReader +*******************************/ + +void EventMachine_t::ArmKqueueReader (EventableDescriptor *ed) +{ + #ifdef HAVE_KQUEUE + if (bKqueue) { + if (!ed) + throw std::runtime_error ("added bad descriptor"); + struct kevent k; +#ifdef __NetBSD__ + EV_SET (&k, ed->GetSocket(), EVFILT_READ, EV_ADD, 0, 0, (intptr_t)ed); +#else + EV_SET (&k, ed->GetSocket(), EVFILT_READ, EV_ADD, 0, 0, ed); +#endif + int t = kevent (kqfd, &k, 1, NULL, 0, NULL); + if (t < 0) { + char buf [200]; + snprintf (buf, sizeof(buf)-1, "arm kqueue reader failed on %d: %s", ed->GetSocket(), strerror(errno)); + throw std::runtime_error (buf); + } + } + #endif +} + +/********************************** +EventMachine_t::_AddNewDescriptors +**********************************/ + +void EventMachine_t::_AddNewDescriptors() +{ + /* Avoid adding descriptors to the main descriptor list + * while we're actually traversing the list. + * Any descriptors that are added as a result of processing timers + * or acceptors should go on a temporary queue and then added + * while we're not traversing the main list. + * Also, it (rarely) happens that a newly-created descriptor + * is immediately scheduled to close. It might be a good + * idea not to bother scheduling these for I/O but if + * we do that, we might bypass some important processing. + */ + + for (size_t i = 0; i < NewDescriptors.size(); i++) { + EventableDescriptor *ed = NewDescriptors[i]; + if (ed == NULL) + throw std::runtime_error ("adding bad descriptor"); + + #if HAVE_EPOLL + if (bEpoll) { + assert (epfd != -1); + int e = epoll_ctl (epfd, EPOLL_CTL_ADD, ed->GetSocket(), ed->GetEpollEvent()); + if (e) { + char buf [200]; + snprintf (buf, sizeof(buf)-1, "unable to add new descriptor: %s", strerror(errno)); + throw std::runtime_error (buf); + } + } + #endif + + #if HAVE_KQUEUE + /* + if (bKqueue) { + // INCOMPLETE. Some descriptors don't want to be readable. + assert (kqfd != -1); + struct kevent k; +#ifdef __NetBSD__ + EV_SET (&k, ed->GetSocket(), EVFILT_READ, EV_ADD, 0, 0, (intptr_t)ed); +#else + EV_SET (&k, ed->GetSocket(), EVFILT_READ, EV_ADD, 0, 0, ed); +#endif + int t = kevent (kqfd, &k, 1, NULL, 0, NULL); + assert (t == 0); + } + */ + #endif + + QueueHeartbeat(ed); + Descriptors.push_back (ed); + } + NewDescriptors.clear(); +} + + +/********************************** +EventMachine_t::_ModifyDescriptors +**********************************/ + +void EventMachine_t::_ModifyDescriptors() +{ + /* For implementations which don't level check every descriptor on + * every pass through the machine, as select does. + * If we're not selecting, then descriptors need a way to signal to the + * machine that their readable or writable status has changed. + * That's what the ::Modify call is for. We do it this way to avoid + * modifying descriptors during the loop traversal, where it can easily + * happen that an object (like a UDP socket) gets data written on it by + * the application during #post_init. That would take place BEFORE the + * descriptor even gets added to the epoll descriptor, so the modify + * operation will crash messily. + * Another really messy possibility is for a descriptor to put itself + * on the Modified list, and then get deleted before we get here. + * Remember, deletes happen after the I/O traversal and before the + * next pass through here. So we have to make sure when we delete a + * descriptor to remove it from the Modified list. + */ + + #ifdef HAVE_EPOLL + if (bEpoll) { + set::iterator i = ModifiedDescriptors.begin(); + while (i != ModifiedDescriptors.end()) { + assert (*i); + _ModifyEpollEvent (*i); + ++i; + } + } + #endif + + ModifiedDescriptors.clear(); +} + + +/********************** +EventMachine_t::Modify +**********************/ + +void EventMachine_t::Modify (EventableDescriptor *ed) +{ + if (!ed) + throw std::runtime_error ("modified bad descriptor"); + ModifiedDescriptors.insert (ed); +} + + +/*********************** +EventMachine_t::Deregister +***********************/ + +void EventMachine_t::Deregister (EventableDescriptor *ed) +{ + if (!ed) + throw std::runtime_error ("modified bad descriptor"); + #ifdef HAVE_EPOLL + // cut/paste from _CleanupSockets(). The error handling could be + // refactored out of there, but it is cut/paste all over the + // file already. + if (bEpoll) { + assert (epfd != -1); + assert (ed->GetSocket() != INVALID_SOCKET); + int e = epoll_ctl (epfd, EPOLL_CTL_DEL, ed->GetSocket(), ed->GetEpollEvent()); + // ENOENT or EBADF are not errors because the socket may be already closed when we get here. + if (e && (errno != ENOENT) && (errno != EBADF) && (errno != EPERM)) { + char buf [200]; + snprintf (buf, sizeof(buf)-1, "unable to delete epoll event: %s", strerror(errno)); + throw std::runtime_error (buf); + } + ModifiedDescriptors.erase(ed); + } + #endif +} + + +/************************************** +EventMachine_t::CreateUnixDomainServer +**************************************/ + +const unsigned long EventMachine_t::CreateUnixDomainServer (const char *filename) +{ + /* Create a UNIX-domain acceptor (server) socket and add it to the event machine. + * Return the binding of the new acceptor to the caller. + * This binding will be referenced when the new acceptor sends events + * to indicate accepted connections. + * THERE IS NO MEANINGFUL IMPLEMENTATION ON WINDOWS. + */ + + #ifdef OS_WIN32 + throw std::runtime_error ("unix-domain server unavailable on this platform"); + #endif + + // The whole rest of this function is only compiled on Unix systems. + #ifdef OS_UNIX + unsigned long output_binding = 0; + + struct sockaddr_un s_sun; + + int sd_accept = socket (AF_LOCAL, SOCK_STREAM, 0); + if (sd_accept == INVALID_SOCKET) { + goto fail; + } + + if (!filename || !*filename) + goto fail; + unlink (filename); + + bzero (&s_sun, sizeof(s_sun)); + s_sun.sun_family = AF_LOCAL; + strncpy (s_sun.sun_path, filename, sizeof(s_sun.sun_path)-1); + + // don't bother with reuseaddr for a local socket. + + { // set CLOEXEC. Only makes sense on Unix + #ifdef OS_UNIX + int cloexec = fcntl (sd_accept, F_GETFD, 0); + assert (cloexec >= 0); + cloexec |= FD_CLOEXEC; + fcntl (sd_accept, F_SETFD, cloexec); + #endif + } + + if (bind (sd_accept, (struct sockaddr*)&s_sun, sizeof(s_sun))) { + //__warning ("binding failed"); + goto fail; + } + + if (listen (sd_accept, 100)) { + //__warning ("listen failed"); + goto fail; + } + + { + // Set the acceptor non-blocking. + // THIS IS CRUCIALLY IMPORTANT because we read it in a select loop. + if (!SetSocketNonblocking (sd_accept)) { + //int val = fcntl (sd_accept, F_GETFL, 0); + //if (fcntl (sd_accept, F_SETFL, val | O_NONBLOCK) == -1) { + goto fail; + } + } + + { // Looking good. + AcceptorDescriptor *ad = new AcceptorDescriptor (sd_accept, this); + if (!ad) + throw std::runtime_error ("unable to allocate acceptor"); + Add (ad); + output_binding = ad->GetBinding(); + } + + return output_binding; + + fail: + if (sd_accept != INVALID_SOCKET) + close (sd_accept); + return 0; + #endif // OS_UNIX +} + + +/********************* +EventMachine_t::Popen +*********************/ +#if OBSOLETE +const char *EventMachine_t::Popen (const char *cmd, const char *mode) +{ + #ifdef OS_WIN32 + throw std::runtime_error ("popen is currently unavailable on this platform"); + #endif + + // The whole rest of this function is only compiled on Unix systems. + // Eventually we need this functionality (or a full-duplex equivalent) on Windows. + #ifdef OS_UNIX + const char *output_binding = NULL; + + FILE *fp = popen (cmd, mode); + if (!fp) + return NULL; + + // From here, all early returns must pclose the stream. + + // According to the pipe(2) manpage, descriptors returned from pipe have both + // CLOEXEC and NONBLOCK clear. Do NOT set CLOEXEC. DO set nonblocking. + if (!SetSocketNonblocking (fileno (fp))) { + pclose (fp); + return NULL; + } + + { // Looking good. + PipeDescriptor *pd = new PipeDescriptor (fp, this); + if (!pd) + throw std::runtime_error ("unable to allocate pipe"); + Add (pd); + output_binding = pd->GetBinding(); + } + + return output_binding; + #endif +} +#endif // OBSOLETE + +/************************** +EventMachine_t::Socketpair +**************************/ + +const unsigned long EventMachine_t::Socketpair (char * const*cmd_strings) +{ + #ifdef OS_WIN32 + throw std::runtime_error ("socketpair is currently unavailable on this platform"); + #endif + + // The whole rest of this function is only compiled on Unix systems. + // Eventually we need this functionality (or a full-duplex equivalent) on Windows. + #ifdef OS_UNIX + // Make sure the incoming array of command strings is sane. + if (!cmd_strings) + return 0; + int j; + for (j=0; j < 2048 && cmd_strings[j]; j++) + ; + if ((j==0) || (j==2048)) + return 0; + + unsigned long output_binding = 0; + + int sv[2]; + if (socketpair (AF_LOCAL, SOCK_STREAM, 0, sv) < 0) + return 0; + // from here, all early returns must close the pair of sockets. + + // Set the parent side of the socketpair nonblocking. + // We don't care about the child side, and most child processes will expect their + // stdout to be blocking. Thanks to Duane Johnson and Bill Kelly for pointing this out. + // Obviously DON'T set CLOEXEC. + if (!SetSocketNonblocking (sv[0])) { + close (sv[0]); + close (sv[1]); + return 0; + } + + pid_t f = fork(); + if (f > 0) { + close (sv[1]); + PipeDescriptor *pd = new PipeDescriptor (sv[0], f, this); + if (!pd) + throw std::runtime_error ("unable to allocate pipe"); + Add (pd); + output_binding = pd->GetBinding(); + } + else if (f == 0) { + close (sv[0]); + dup2 (sv[1], STDIN_FILENO); + close (sv[1]); + dup2 (STDIN_FILENO, STDOUT_FILENO); + execvp (cmd_strings[0], cmd_strings+1); + exit (-1); // end the child process if the exec doesn't work. + } + else + throw std::runtime_error ("no fork"); + + return output_binding; + #endif +} + + +/**************************** +EventMachine_t::OpenKeyboard +****************************/ + +const unsigned long EventMachine_t::OpenKeyboard() +{ + KeyboardDescriptor *kd = new KeyboardDescriptor (this); + if (!kd) + throw std::runtime_error ("no keyboard-object allocated"); + Add (kd); + return kd->GetBinding(); +} + + +/********************************** +EventMachine_t::GetConnectionCount +**********************************/ + +int EventMachine_t::GetConnectionCount () +{ + return Descriptors.size() + NewDescriptors.size(); +} + + +/************************ +EventMachine_t::WatchPid +************************/ + +const unsigned long EventMachine_t::WatchPid (int pid) +{ + #ifdef HAVE_KQUEUE + if (!bKqueue) + throw std::runtime_error("must enable kqueue (EM.kqueue=true) for pid watching support"); + + struct kevent event; + int kqres; + + EV_SET(&event, pid, EVFILT_PROC, EV_ADD, NOTE_EXIT | NOTE_FORK, 0, 0); + + // Attempt to register the event + kqres = kevent(kqfd, &event, 1, NULL, 0, NULL); + if (kqres == -1) { + char errbuf[200]; + sprintf(errbuf, "failed to register file watch descriptor with kqueue: %s", strerror(errno)); + throw std::runtime_error(errbuf); + } + #endif + + #ifdef HAVE_KQUEUE + Bindable_t* b = new Bindable_t(); + Pids.insert(make_pair (pid, b)); + + return b->GetBinding(); + #endif + + throw std::runtime_error("no pid watching support on this system"); +} + +/************************** +EventMachine_t::UnwatchPid +**************************/ + +void EventMachine_t::UnwatchPid (int pid) +{ + Bindable_t *b = Pids[pid]; + assert(b); + Pids.erase(pid); + + #ifdef HAVE_KQUEUE + struct kevent k; + + EV_SET(&k, pid, EVFILT_PROC, EV_DELETE, 0, 0, 0); + /*int t =*/ kevent (kqfd, &k, 1, NULL, 0, NULL); + // t==-1 if the process already exited; ignore this for now + #endif + + if (EventCallback) + (*EventCallback)(b->GetBinding(), EM_CONNECTION_UNBOUND, NULL, 0); + + delete b; +} + +void EventMachine_t::UnwatchPid (const unsigned long sig) +{ + for(map::iterator i=Pids.begin(); i != Pids.end(); i++) + { + if (i->second->GetBinding() == sig) { + UnwatchPid (i->first); + return; + } + } + + throw std::runtime_error("attempted to remove invalid pid signature"); +} + + +/************************* +EventMachine_t::WatchFile +*************************/ + +const unsigned long EventMachine_t::WatchFile (const char *fpath) +{ + struct stat sb; + int sres; + int wd = -1; + + sres = stat(fpath, &sb); + + if (sres == -1) { + char errbuf[300]; + sprintf(errbuf, "error registering file %s for watching: %s", fpath, strerror(errno)); + throw std::runtime_error(errbuf); + } + + #ifdef HAVE_INOTIFY + if (!inotify) { + inotify = new InotifyDescriptor(this); + assert (inotify); + Add(inotify); + } + + wd = inotify_add_watch(inotify->GetSocket(), fpath, + IN_MODIFY | IN_DELETE_SELF | IN_MOVE_SELF | IN_CREATE | IN_DELETE | IN_MOVE) ; + if (wd == -1) { + char errbuf[300]; + sprintf(errbuf, "failed to open file %s for registering with inotify: %s", fpath, strerror(errno)); + throw std::runtime_error(errbuf); + } + #endif + + #ifdef HAVE_KQUEUE + if (!bKqueue) + throw std::runtime_error("must enable kqueue (EM.kqueue=true) for file watching support"); + + // With kqueue we have to open the file first and use the resulting fd to register for events + wd = open(fpath, O_RDONLY); + if (wd == -1) { + char errbuf[300]; + sprintf(errbuf, "failed to open file %s for registering with kqueue: %s", fpath, strerror(errno)); + throw std::runtime_error(errbuf); + } + _RegisterKqueueFileEvent(wd); + #endif + + if (wd != -1) { + Bindable_t* b = new Bindable_t(); + Files.insert(make_pair (wd, b)); + + return b->GetBinding(); + } + + throw std::runtime_error("no file watching support on this system"); // is this the right thing to do? +} + + +/*************************** +EventMachine_t::UnwatchFile +***************************/ + +void EventMachine_t::UnwatchFile (int wd) +{ + Bindable_t *b = Files[wd]; + assert(b); + Files.erase(wd); + + #ifdef HAVE_INOTIFY + inotify_rm_watch(inotify->GetSocket(), wd); + #elif HAVE_KQUEUE + // With kqueue, closing the monitored fd automatically clears all registered events for it + close(wd); + #endif + + if (EventCallback) + (*EventCallback)(b->GetBinding(), EM_CONNECTION_UNBOUND, NULL, 0); + + delete b; +} + +void EventMachine_t::UnwatchFile (const unsigned long sig) +{ + for(map::iterator i=Files.begin(); i != Files.end(); i++) + { + if (i->second->GetBinding() == sig) { + UnwatchFile (i->first); + return; + } + } + throw std::runtime_error("attempted to remove invalid watch signature"); +} + + +/*********************************** +EventMachine_t::_ReadInotify_Events +************************************/ + +void EventMachine_t::_ReadInotifyEvents() +{ + #ifdef HAVE_INOTIFY + char buffer[1024]; + + assert(EventCallback); + + for (;;) { + int returned = read(inotify->GetSocket(), buffer, sizeof(buffer)); + assert(!(returned == 0 || returned == -1 && errno == EINVAL)); + if (returned <= 0) { + break; + } + int current = 0; + while (current < returned) { + struct inotify_event* event = (struct inotify_event*)(buffer+current); + map::const_iterator bindable = Files.find(event->wd); + if (bindable != Files.end()) { + if (event->mask & (IN_MODIFY | IN_CREATE | IN_DELETE | IN_MOVE)){ + (*EventCallback)(bindable->second->GetBinding(), EM_CONNECTION_READ, "modified", 8); + } + if (event->mask & IN_MOVE_SELF){ + (*EventCallback)(bindable->second->GetBinding(), EM_CONNECTION_READ, "moved", 5); + } + if (event->mask & IN_DELETE_SELF) { + (*EventCallback)(bindable->second->GetBinding(), EM_CONNECTION_READ, "deleted", 7); + UnwatchFile ((int)event->wd); + } + } + current += sizeof(struct inotify_event) + event->len; + } + } + #endif +} + + +/************************************* +EventMachine_t::_HandleKqueuePidEvent +*************************************/ + +#ifdef HAVE_KQUEUE +void EventMachine_t::_HandleKqueuePidEvent(struct kevent *event) +{ + assert(EventCallback); + + if (event->fflags & NOTE_FORK) + (*EventCallback)(Pids [(int) event->ident]->GetBinding(), EM_CONNECTION_READ, "fork", 4); + if (event->fflags & NOTE_EXIT) { + (*EventCallback)(Pids [(int) event->ident]->GetBinding(), EM_CONNECTION_READ, "exit", 4); + // stop watching the pid if it died + UnwatchPid ((int)event->ident); + } +} +#endif + + +/************************************** +EventMachine_t::_HandleKqueueFileEvent +***************************************/ + +#ifdef HAVE_KQUEUE +void EventMachine_t::_HandleKqueueFileEvent(struct kevent *event) +{ + assert(EventCallback); + + if (event->fflags & NOTE_WRITE) + (*EventCallback)(Files [(int) event->ident]->GetBinding(), EM_CONNECTION_READ, "modified", 8); + if (event->fflags & NOTE_RENAME) + (*EventCallback)(Files [(int) event->ident]->GetBinding(), EM_CONNECTION_READ, "moved", 5); + if (event->fflags & NOTE_DELETE) { + (*EventCallback)(Files [(int) event->ident]->GetBinding(), EM_CONNECTION_READ, "deleted", 7); + UnwatchFile ((int)event->ident); + } +} +#endif + + +/**************************************** +EventMachine_t::_RegisterKqueueFileEvent +*****************************************/ + +#ifdef HAVE_KQUEUE +void EventMachine_t::_RegisterKqueueFileEvent(int fd) +{ + struct kevent newevent; + int kqres; + + // Setup the event with our fd and proper flags + EV_SET(&newevent, fd, EVFILT_VNODE, EV_ADD | EV_CLEAR, NOTE_DELETE | NOTE_RENAME | NOTE_WRITE, 0, 0); + + // Attempt to register the event + kqres = kevent(kqfd, &newevent, 1, NULL, 0, NULL); + if (kqres == -1) { + char errbuf[200]; + sprintf(errbuf, "failed to register file watch descriptor with kqueue: %s", strerror(errno)); + close(fd); + throw std::runtime_error(errbuf); + } +} +#endif + + +/************************************ +EventMachine_t::GetHeartbeatInterval +*************************************/ + +float EventMachine_t::GetHeartbeatInterval() +{ + return ((float)HeartbeatInterval / 1000000); +} + + +/************************************ +EventMachine_t::SetHeartbeatInterval +*************************************/ + +int EventMachine_t::SetHeartbeatInterval(float interval) +{ + int iv = (int)(interval * 1000000); + if (iv > 0) { + HeartbeatInterval = iv; + return 1; + } + return 0; +} +//#endif // OS_UNIX + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/em.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/em.h new file mode 100644 index 000000000..47d30e2aa --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/em.h @@ -0,0 +1,239 @@ +/***************************************************************************** + +$Id$ + +File: em.h +Date: 06Apr06 + +Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +Gmail: blackhedd + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + +#ifndef __EventMachine__H_ +#define __EventMachine__H_ + +#ifdef BUILD_FOR_RUBY + #include + #define EmSelect rb_thread_select + + #if defined(HAVE_RBTRAP) + #include + #elif defined(HAVE_RB_THREAD_CHECK_INTS) + extern "C" { + void rb_enable_interrupt(void); + void rb_disable_interrupt(void); + } + + #define TRAP_BEG rb_enable_interrupt() + #define TRAP_END do { rb_disable_interrupt(); rb_thread_check_ints(); } while(0) + #else + #define TRAP_BEG + #define TRAP_END + #endif + + // 1.9.0 compat + #ifndef RUBY_UBF_IO + #define RUBY_UBF_IO RB_UBF_DFL + #endif + #ifndef RSTRING_PTR + #define RSTRING_PTR(str) RSTRING(str)->ptr + #endif + #ifndef RSTRING_LEN + #define RSTRING_LEN(str) RSTRING(str)->len + #endif + #ifndef RSTRING_LENINT + #define RSTRING_LENINT(str) RSTRING_LEN(str) + #endif +#else + #define EmSelect select +#endif + +class EventableDescriptor; +class InotifyDescriptor; + + +/******************** +class EventMachine_t +********************/ + +class EventMachine_t +{ + public: + static int GetMaxTimerCount(); + static void SetMaxTimerCount (int); + + public: + EventMachine_t (EMCallback); + virtual ~EventMachine_t(); + + void Run(); + void ScheduleHalt(); + void SignalLoopBreaker(); + const unsigned long InstallOneshotTimer (int); + const unsigned long ConnectToServer (const char *, int, const char *, int); + const unsigned long ConnectToUnixServer (const char *); + + const unsigned long CreateTcpServer (const char *, int); + const unsigned long OpenDatagramSocket (const char *, int); + const unsigned long CreateUnixDomainServer (const char*); + const unsigned long OpenKeyboard(); + //const char *Popen (const char*, const char*); + const unsigned long Socketpair (char* const*); + + void Add (EventableDescriptor*); + void Modify (EventableDescriptor*); + void Deregister (EventableDescriptor*); + + const unsigned long AttachFD (int, bool); + int DetachFD (EventableDescriptor*); + + void ArmKqueueWriter (EventableDescriptor*); + void ArmKqueueReader (EventableDescriptor*); + + void SetTimerQuantum (int); + static void SetuidString (const char*); + static int SetRlimitNofile (int); + + pid_t SubprocessPid; + int SubprocessExitStatus; + + int GetConnectionCount(); + float GetHeartbeatInterval(); + int SetHeartbeatInterval(float); + + const unsigned long WatchFile (const char*); + void UnwatchFile (int); + void UnwatchFile (const unsigned long); + + #ifdef HAVE_KQUEUE + void _HandleKqueueFileEvent (struct kevent*); + void _RegisterKqueueFileEvent(int); + #endif + + const unsigned long WatchPid (int); + void UnwatchPid (int); + void UnwatchPid (const unsigned long); + + #ifdef HAVE_KQUEUE + void _HandleKqueuePidEvent (struct kevent*); + #endif + + uint64_t GetCurrentLoopTime() { return MyCurrentLoopTime; } + + // Temporary: + void _UseEpoll(); + void _UseKqueue(); + + bool UsingKqueue() { return bKqueue; } + bool UsingEpoll() { return bEpoll; } + + void QueueHeartbeat(EventableDescriptor*); + void ClearHeartbeat(uint64_t, EventableDescriptor*); + + uint64_t GetRealTime(); + + private: + bool _RunOnce(); + void _RunTimers(); + void _UpdateTime(); + void _AddNewDescriptors(); + void _ModifyDescriptors(); + void _InitializeLoopBreaker(); + void _CleanupSockets(); + + bool _RunSelectOnce(); + bool _RunEpollOnce(); + bool _RunKqueueOnce(); + + void _ModifyEpollEvent (EventableDescriptor*); + void _DispatchHeartbeats(); + timeval _TimeTilNextEvent(); + void _CleanBadDescriptors(); + + public: + void _ReadLoopBreaker(); + void _ReadInotifyEvents(); + int NumCloseScheduled; + + private: + enum { + MaxEpollDescriptors = 64*1024, + MaxEvents = 4096 + }; + int HeartbeatInterval; + EMCallback EventCallback; + + class Timer_t: public Bindable_t { + }; + + multimap Timers; + multimap Heartbeats; + map Files; + map Pids; + vector Descriptors; + vector NewDescriptors; + set ModifiedDescriptors; + + uint64_t NextHeartbeatTime; + + int LoopBreakerReader; + int LoopBreakerWriter; + #ifdef OS_WIN32 + struct sockaddr_in LoopBreakerTarget; + #endif + + timeval Quantum; + + uint64_t MyCurrentLoopTime; + + #ifdef OS_WIN32 + unsigned TickCountTickover; + unsigned LastTickCount; + #endif + + private: + bool bTerminateSignalReceived; + + bool bEpoll; + int epfd; // Epoll file-descriptor + #ifdef HAVE_EPOLL + struct epoll_event epoll_events [MaxEvents]; + #endif + + bool bKqueue; + int kqfd; // Kqueue file-descriptor + #ifdef HAVE_KQUEUE + struct kevent Karray [MaxEvents]; + #endif + + InotifyDescriptor *inotify; // pollable descriptor for our inotify instance +}; + + +/******************* +struct SelectData_t +*******************/ + +struct SelectData_t +{ + SelectData_t(); + + int _Select(); + + int maxsocket; + fd_set fdreads; + fd_set fdwrites; + fd_set fderrors; + timeval tv; + int nSockets; +}; + +#endif // __EventMachine__H_ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/eventmachine.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/eventmachine.h new file mode 100644 index 000000000..2dd8b1bb1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/eventmachine.h @@ -0,0 +1,127 @@ +/***************************************************************************** + +$Id$ + +File: eventmachine.h +Date: 15Apr06 + +Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +Gmail: blackhedd + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + +#ifndef __EVMA_EventMachine__H_ +#define __EVMA_EventMachine__H_ + +#if __cplusplus +extern "C" { +#endif + + enum { // Event names + EM_TIMER_FIRED = 100, + EM_CONNECTION_READ = 101, + EM_CONNECTION_UNBOUND = 102, + EM_CONNECTION_ACCEPTED = 103, + EM_CONNECTION_COMPLETED = 104, + EM_LOOPBREAK_SIGNAL = 105, + EM_CONNECTION_NOTIFY_READABLE = 106, + EM_CONNECTION_NOTIFY_WRITABLE = 107, + EM_SSL_HANDSHAKE_COMPLETED = 108, + EM_SSL_VERIFY = 109, + EM_PROXY_TARGET_UNBOUND = 110, + EM_PROXY_COMPLETED = 111 + + }; + + void evma_initialize_library (EMCallback); + void evma_run_machine(); + void evma_release_library(); + const unsigned long evma_install_oneshot_timer (int seconds); + const unsigned long evma_connect_to_server (const char *bind_addr, int bind_port, const char *server, int port); + const unsigned long evma_connect_to_unix_server (const char *server); + + const unsigned long evma_attach_fd (int file_descriptor, int watch_mode); + int evma_detach_fd (const unsigned long binding); + int evma_get_file_descriptor (const unsigned long binding); + int evma_is_notify_readable (const unsigned long binding); + void evma_set_notify_readable (const unsigned long binding, int mode); + int evma_is_notify_writable (const unsigned long binding); + void evma_set_notify_writable (const unsigned long binding, int mode); + + int evma_pause(const unsigned long binding); + int evma_is_paused(const unsigned long binding); + int evma_resume(const unsigned long binding); + + int evma_num_close_scheduled(); + + void evma_stop_tcp_server (const unsigned long signature); + const unsigned long evma_create_tcp_server (const char *address, int port); + const unsigned long evma_create_unix_domain_server (const char *filename); + const unsigned long evma_open_datagram_socket (const char *server, int port); + const unsigned long evma_open_keyboard(); + void evma_set_tls_parms (const unsigned long binding, const char *privatekey_filename, const char *certchain_filenane, int verify_peer); + void evma_start_tls (const unsigned long binding); + + #ifdef WITH_SSL + X509 *evma_get_peer_cert (const unsigned long binding); + void evma_accept_ssl_peer (const unsigned long binding); + #endif + + int evma_get_peername (const unsigned long binding, struct sockaddr*, socklen_t*); + int evma_get_sockname (const unsigned long binding, struct sockaddr*, socklen_t*); + int evma_get_subprocess_pid (const unsigned long binding, pid_t*); + int evma_get_subprocess_status (const unsigned long binding, int*); + int evma_get_connection_count(); + int evma_send_data_to_connection (const unsigned long binding, const char *data, int data_length); + int evma_send_datagram (const unsigned long binding, const char *data, int data_length, const char *address, int port); + float evma_get_comm_inactivity_timeout (const unsigned long binding); + int evma_set_comm_inactivity_timeout (const unsigned long binding, float value); + float evma_get_pending_connect_timeout (const unsigned long binding); + int evma_set_pending_connect_timeout (const unsigned long binding, float value); + int evma_get_outbound_data_size (const unsigned long binding); + uint64_t evma_get_last_activity_time (const unsigned long); + int evma_send_file_data_to_connection (const unsigned long binding, const char *filename); + + void evma_close_connection (const unsigned long binding, int after_writing); + int evma_report_connection_error_status (const unsigned long binding); + void evma_signal_loopbreak(); + void evma_set_timer_quantum (int); + int evma_get_max_timer_count(); + void evma_set_max_timer_count (int); + void evma_setuid_string (const char *username); + void evma_stop_machine(); + float evma_get_heartbeat_interval(); + int evma_set_heartbeat_interval(float); + + const unsigned long evma_popen (char * const*cmd_strings); + + const unsigned long evma_watch_filename (const char *fname); + void evma_unwatch_filename (const unsigned long); + + const unsigned long evma_watch_pid (int); + void evma_unwatch_pid (const unsigned long); + + void evma_start_proxy(const unsigned long, const unsigned long, const unsigned long, const unsigned long); + void evma_stop_proxy(const unsigned long); + unsigned long evma_proxied_bytes(const unsigned long); + + int evma_set_rlimit_nofile (int n_files); + + void evma_set_epoll (int use); + void evma_set_kqueue (int use); + + uint64_t evma_get_current_loop_time(); +#if __cplusplus +} +#endif + + +#endif // __EventMachine__H_ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/extconf.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/extconf.rb new file mode 100644 index 000000000..679b809aa --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/extconf.rb @@ -0,0 +1,176 @@ +require 'fileutils' +require 'mkmf' + +def check_libs libs = [], fatal = false + libs.all? { |lib| have_library(lib) || (abort("could not find library: #{lib}") if fatal) } +end + +def check_heads heads = [], fatal = false + heads.all? { |head| have_header(head) || (abort("could not find header: #{head}") if fatal)} +end + +def add_define(name) + $defs.push("-D#{name}") +end + +## +# OpenSSL: + +# override append_library, so it actually appends (instead of prepending) +# this fixes issues with linking ssl, since libcrypto depends on symbols in libssl +def append_library(libs, lib) + libs + " " + format(LIBARG, lib) +end + +def manual_ssl_config + ssl_libs_heads_args = { + :unix => [%w[ssl crypto], %w[openssl/ssl.h openssl/err.h]], + :mswin => [%w[ssleay32 eay32], %w[openssl/ssl.h openssl/err.h]], + } + + dc_flags = ['ssl'] + dc_flags += ["#{ENV['OPENSSL']}/include", ENV['OPENSSL']] if /linux/ =~ RUBY_PLATFORM and ENV['OPENSSL'] + + libs, heads = case RUBY_PLATFORM + when /mswin/ ; ssl_libs_heads_args[:mswin] + else ssl_libs_heads_args[:unix] + end + dir_config(*dc_flags) + check_libs(libs) and check_heads(heads) +end + +if ENV['CROSS_COMPILING'] + openssl_version = ENV.fetch("OPENSSL_VERSION", "1.0.0j") + openssl_dir = File.expand_path("~/.rake-compiler/builds/openssl-#{openssl_version}/") + if File.exists?(openssl_dir) + FileUtils.mkdir_p Dir.pwd+"/openssl/" + FileUtils.cp Dir[openssl_dir+"/include/openssl/*.h"], Dir.pwd+"/openssl/", :verbose => true + FileUtils.cp Dir[openssl_dir+"/lib*.a"], Dir.pwd, :verbose => true + $INCFLAGS << " -I#{Dir.pwd}" # for the openssl headers + else + STDERR.puts + STDERR.puts "**************************************************************************************" + STDERR.puts "**** Cross-compiled OpenSSL not found" + STDERR.puts "**** Run: hg clone http://bitbucket.org/ged/ruby-pg && cd ruby-pg && rake openssl_libs" + STDERR.puts "**************************************************************************************" + STDERR.puts + end +end + +# Try to use pkg_config first, fixes #73 +if (!ENV['CROSS_COMPILING'] and pkg_config('openssl')) || manual_ssl_config + add_define "WITH_SSL" +else + add_define "WITHOUT_SSL" +end + +add_define 'BUILD_FOR_RUBY' +add_define 'HAVE_RBTRAP' if have_var('rb_trap_immediate', ['ruby.h', 'rubysig.h']) +add_define "HAVE_TBR" if have_func('rb_thread_blocking_region')# and have_macro('RUBY_UBF_IO', 'ruby.h') +add_define "HAVE_INOTIFY" if inotify = have_func('inotify_init', 'sys/inotify.h') +add_define "HAVE_OLD_INOTIFY" if !inotify && have_macro('__NR_inotify_init', 'sys/syscall.h') +add_define 'HAVE_WRITEV' if have_func('writev', 'sys/uio.h') + +have_func('rb_thread_check_ints') +have_func('rb_time_new') + +# Minor platform details between *nix and Windows: + +if RUBY_PLATFORM =~ /(mswin|mingw|bccwin)/ + GNU_CHAIN = ENV['CROSS_COMPILING'] or $1 == 'mingw' + OS_WIN32 = true + add_define "OS_WIN32" +else + GNU_CHAIN = true + OS_UNIX = true + add_define 'OS_UNIX' + + add_define "HAVE_KQUEUE" if have_header("sys/event.h") and have_header("sys/queue.h") +end + +# Adjust number of file descriptors (FD) on Windows + +if RbConfig::CONFIG["host_os"] =~ /mingw/ + found = RbConfig::CONFIG.values_at("CFLAGS", "CPPFLAGS"). + any? { |v| v.include?("FD_SETSIZE") } + + add_define "FD_SETSIZE=32767" unless found +end + +# Main platform invariances: + +case RUBY_PLATFORM +when /mswin32/, /mingw32/, /bccwin32/ + check_heads(%w[windows.h winsock.h], true) + check_libs(%w[kernel32 rpcrt4 gdi32], true) + + if GNU_CHAIN + CONFIG['LDSHARED'] = "$(CXX) -shared -lstdc++" + else + $defs.push "-EHs" + $defs.push "-GR" + end + +when /solaris/ + add_define 'OS_SOLARIS8' + check_libs(%w[nsl socket], true) + + if CONFIG['CC'] == 'cc' and `cc -flags 2>&1` =~ /Sun/ # detect SUNWspro compiler + # SUN CHAIN + add_define 'CC_SUNWspro' + $preload = ["\nCXX = CC"] # hack a CXX= line into the makefile + $CFLAGS = CONFIG['CFLAGS'] = "-KPIC" + CONFIG['CCDLFLAGS'] = "-KPIC" + CONFIG['LDSHARED'] = "$(CXX) -G -KPIC -lCstd" + else + # GNU CHAIN + # on Unix we need a g++ link, not gcc. + CONFIG['LDSHARED'] = "$(CXX) -shared" + end + +when /openbsd/ + # OpenBSD branch contributed by Guillaume Sellier. + + # on Unix we need a g++ link, not gcc. On OpenBSD, linking against libstdc++ have to be explicitly done for shared libs + CONFIG['LDSHARED'] = "$(CXX) -shared -lstdc++ -fPIC" + CONFIG['LDSHAREDXX'] = "$(CXX) -shared -lstdc++ -fPIC" + +when /darwin/ + # on Unix we need a g++ link, not gcc. + # Ff line contributed by Daniel Harple. + CONFIG['LDSHARED'] = "$(CXX) " + CONFIG['LDSHARED'].split[1..-1].join(' ') + +when /linux/ + add_define 'HAVE_EPOLL' if have_func('epoll_create', 'sys/epoll.h') + + # on Unix we need a g++ link, not gcc. + CONFIG['LDSHARED'] = "$(CXX) -shared" + +when /aix/ + CONFIG['LDSHARED'] = "$(CXX) -shared -Wl,-G -Wl,-brtl" + +when /cygwin/ + # For rubies built with Cygwin, CXX may be set to CC, which is just + # a wrapper for gcc. + # This will compile, but it will not link to the C++ std library. + # Explicitly set CXX to use g++. + CONFIG['CXX'] = "g++" + # on Unix we need a g++ link, not gcc. + CONFIG['LDSHARED'] = "$(CXX) -shared" + +else + # on Unix we need a g++ link, not gcc. + CONFIG['LDSHARED'] = "$(CXX) -shared" +end + + +# solaris c++ compiler doesn't have make_pair() +TRY_LINK.sub!('$(CC)', '$(CXX)') +add_define 'HAVE_MAKE_PAIR' if try_link(< + using namespace std; + int main(){ pair tuple = make_pair(1,2); } +SRC +TRY_LINK.sub!('$(CXX)', '$(CC)') + +create_makefile "rubyeventmachine" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/fastfilereader/extconf.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/fastfilereader/extconf.rb new file mode 100644 index 000000000..1c1ba9fa3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/fastfilereader/extconf.rb @@ -0,0 +1,103 @@ +require 'mkmf' + +def check_libs libs = [], fatal = false + libs.all? { |lib| have_library(lib) || (abort("could not find library: #{lib}") if fatal) } +end + +def check_heads heads = [], fatal = false + heads.all? { |head| have_header(head) || (abort("could not find header: #{head}") if fatal)} +end + +def add_define(name) + $defs.push("-D#{name}") +end + +add_define 'BUILD_FOR_RUBY' + +# Minor platform details between *nix and Windows: + +if RUBY_PLATFORM =~ /(mswin|mingw|bccwin)/ + GNU_CHAIN = ENV['CROSS_COMPILING'] or $1 == 'mingw' + OS_WIN32 = true + add_define "OS_WIN32" +else + GNU_CHAIN = true + OS_UNIX = true + add_define 'OS_UNIX' +end + +# Adjust number of file descriptors (FD) on Windows + +if RbConfig::CONFIG["host_os"] =~ /mingw/ + found = RbConfig::CONFIG.values_at("CFLAGS", "CPPFLAGS"). + any? { |v| v.include?("FD_SETSIZE") } + + add_define "FD_SETSIZE=32767" unless found +end + +# Main platform invariances: + +case RUBY_PLATFORM +when /mswin32/, /mingw32/, /bccwin32/ + check_heads(%w[windows.h winsock.h], true) + check_libs(%w[kernel32 rpcrt4 gdi32], true) + + if GNU_CHAIN + CONFIG['LDSHARED'] = "$(CXX) -shared -lstdc++" + else + $defs.push "-EHs" + $defs.push "-GR" + end + +when /solaris/ + add_define 'OS_SOLARIS8' + check_libs(%w[nsl socket], true) + + if CONFIG['CC'] == 'cc' and `cc -flags 2>&1` =~ /Sun/ # detect SUNWspro compiler + # SUN CHAIN + add_define 'CC_SUNWspro' + $preload = ["\nCXX = CC"] # hack a CXX= line into the makefile + $CFLAGS = CONFIG['CFLAGS'] = "-KPIC" + CONFIG['CCDLFLAGS'] = "-KPIC" + CONFIG['LDSHARED'] = "$(CXX) -G -KPIC -lCstd" + else + # GNU CHAIN + # on Unix we need a g++ link, not gcc. + CONFIG['LDSHARED'] = "$(CXX) -shared" + end + +when /openbsd/ + # OpenBSD branch contributed by Guillaume Sellier. + + # on Unix we need a g++ link, not gcc. On OpenBSD, linking against libstdc++ have to be explicitly done for shared libs + CONFIG['LDSHARED'] = "$(CXX) -shared -lstdc++ -fPIC" + CONFIG['LDSHAREDXX'] = "$(CXX) -shared -lstdc++ -fPIC" + +when /darwin/ + # on Unix we need a g++ link, not gcc. + # Ff line contributed by Daniel Harple. + CONFIG['LDSHARED'] = "$(CXX) " + CONFIG['LDSHARED'].split[1..-1].join(' ') + +when /linux/ + # on Unix we need a g++ link, not gcc. + CONFIG['LDSHARED'] = "$(CXX) -shared" + +when /aix/ + # on Unix we need a g++ link, not gcc. + CONFIG['LDSHARED'] = "$(CXX) -shared -Wl,-G" + +when /cygwin/ + # For rubies built with Cygwin, CXX may be set to CC, which is just + # a wrapper for gcc. + # This will compile, but it will not link to the C++ std library. + # Explicitly set CXX to use g++. + CONFIG['CXX'] = "g++" + # on Unix we need a g++ link, not gcc. + CONFIG['LDSHARED'] = "$(CXX) -shared" + +else + # on Unix we need a g++ link, not gcc. + CONFIG['LDSHARED'] = "$(CXX) -shared" +end + +create_makefile "fastfilereaderext" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/fastfilereader/mapper.cpp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/fastfilereader/mapper.cpp new file mode 100644 index 000000000..f9a913afd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/fastfilereader/mapper.cpp @@ -0,0 +1,214 @@ +/***************************************************************************** + +$Id: mapper.cpp 4527 2007-07-04 10:21:34Z francis $ + +File: mapper.cpp +Date: 02Jul07 + +Copyright (C) 2007 by Francis Cianfrocca. All Rights Reserved. +Gmail: garbagecat10 + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + + +////////////////////////////////////////////////////////////////////// +// UNIX implementation +////////////////////////////////////////////////////////////////////// + + +#ifdef OS_UNIX + +#include +#include +#include +#include +#include + +#include +#include "unistd.h" +#include +#include +#include +using namespace std; + +#include "mapper.h" + +/****************** +Mapper_t::Mapper_t +******************/ + +Mapper_t::Mapper_t (const string &filename) +{ + /* We ASSUME we can open the file. + * (More precisely, we assume someone else checked before we got here.) + */ + + Fd = open (filename.c_str(), O_RDONLY); + if (Fd < 0) + throw runtime_error (strerror (errno)); + + struct stat st; + if (fstat (Fd, &st)) + throw runtime_error (strerror (errno)); + FileSize = st.st_size; + + #ifdef OS_WIN32 + MapPoint = (char*) mmap (0, FileSize, PROT_READ, MAP_SHARED, Fd, 0); + #else + MapPoint = (const char*) mmap (0, FileSize, PROT_READ, MAP_SHARED, Fd, 0); + #endif + if (MapPoint == MAP_FAILED) + throw runtime_error (strerror (errno)); +} + + +/******************* +Mapper_t::~Mapper_t +*******************/ + +Mapper_t::~Mapper_t() +{ + Close(); +} + + +/*************** +Mapper_t::Close +***************/ + +void Mapper_t::Close() +{ + // Can be called multiple times. + // Calls to GetChunk are invalid after a call to Close. + if (MapPoint) { + #ifdef CC_SUNWspro + munmap ((char*)MapPoint, FileSize); + #else + munmap ((void*)MapPoint, FileSize); + #endif + MapPoint = NULL; + } + if (Fd >= 0) { + close (Fd); + Fd = -1; + } +} + +/****************** +Mapper_t::GetChunk +******************/ + +const char *Mapper_t::GetChunk (unsigned start) +{ + return MapPoint + start; +} + + + +#endif // OS_UNIX + + +////////////////////////////////////////////////////////////////////// +// WINDOWS implementation +////////////////////////////////////////////////////////////////////// + +#ifdef OS_WIN32 + +#include + +#include +#include +#include +using namespace std; + +#include "mapper.h" + +/****************** +Mapper_t::Mapper_t +******************/ + +Mapper_t::Mapper_t (const string &filename) +{ + /* We ASSUME we can open the file. + * (More precisely, we assume someone else checked before we got here.) + */ + + hFile = INVALID_HANDLE_VALUE; + hMapping = NULL; + MapPoint = NULL; + FileSize = 0; + + hFile = CreateFile (filename.c_str(), GENERIC_READ|GENERIC_WRITE, FILE_SHARE_DELETE|FILE_SHARE_READ|FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + + if (hFile == INVALID_HANDLE_VALUE) + throw runtime_error ("File not found"); + + BY_HANDLE_FILE_INFORMATION i; + if (GetFileInformationByHandle (hFile, &i)) + FileSize = i.nFileSizeLow; + + hMapping = CreateFileMapping (hFile, NULL, PAGE_READWRITE, 0, 0, NULL); + if (!hMapping) + throw runtime_error ("File not mapped"); + + #ifdef OS_WIN32 + MapPoint = (char*) MapViewOfFile (hMapping, FILE_MAP_WRITE, 0, 0, 0); + #else + MapPoint = (const char*) MapViewOfFile (hMapping, FILE_MAP_WRITE, 0, 0, 0); + #endif + if (!MapPoint) + throw runtime_error ("Mappoint not read"); +} + + +/******************* +Mapper_t::~Mapper_t +*******************/ + +Mapper_t::~Mapper_t() +{ + Close(); +} + +/*************** +Mapper_t::Close +***************/ + +void Mapper_t::Close() +{ + // Can be called multiple times. + // Calls to GetChunk are invalid after a call to Close. + if (MapPoint) { + UnmapViewOfFile (MapPoint); + MapPoint = NULL; + } + if (hMapping != NULL) { + CloseHandle (hMapping); + hMapping = NULL; + } + if (hFile != INVALID_HANDLE_VALUE) { + CloseHandle (hFile); + hMapping = INVALID_HANDLE_VALUE; + } +} + + +/****************** +Mapper_t::GetChunk +******************/ + +const char *Mapper_t::GetChunk (unsigned start) +{ + return MapPoint + start; +} + + + +#endif // OS_WINDOWS diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/fastfilereader/mapper.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/fastfilereader/mapper.h new file mode 100644 index 000000000..36d16ae40 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/fastfilereader/mapper.h @@ -0,0 +1,59 @@ +/***************************************************************************** + +$Id: mapper.h 4529 2007-07-04 11:32:22Z francis $ + +File: mapper.h +Date: 02Jul07 + +Copyright (C) 2007 by Francis Cianfrocca. All Rights Reserved. +Gmail: garbagecat10 + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + + +#ifndef __Mapper__H_ +#define __Mapper__H_ + + +/************** +class Mapper_t +**************/ + +class Mapper_t +{ + public: + Mapper_t (const string&); + virtual ~Mapper_t(); + + const char *GetChunk (unsigned); + void Close(); + size_t GetFileSize() {return FileSize;} + + private: + size_t FileSize; + + #ifdef OS_UNIX + private: + int Fd; + const char *MapPoint; + #endif // OS_UNIX + + #ifdef OS_WIN32 + private: + HANDLE hFile; + HANDLE hMapping; + char *MapPoint; + #endif // OS_WIN32 + +}; + + +#endif // __Mapper__H_ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/fastfilereader/rubymain.cpp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/fastfilereader/rubymain.cpp new file mode 100644 index 000000000..377b8177d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/fastfilereader/rubymain.cpp @@ -0,0 +1,127 @@ +/***************************************************************************** + +$Id: rubymain.cpp 4529 2007-07-04 11:32:22Z francis $ + +File: rubymain.cpp +Date: 02Jul07 + +Copyright (C) 2007 by Francis Cianfrocca. All Rights Reserved. +Gmail: garbagecat10 + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + + + +#include +#include +using namespace std; + +#include +#include "mapper.h" + +static VALUE EmModule; +static VALUE FastFileReader; +static VALUE Mapper; + + + +/********* +mapper_dt +*********/ + +static void mapper_dt (void *ptr) +{ + if (ptr) + delete (Mapper_t*) ptr; +} + +/********** +mapper_new +**********/ + +static VALUE mapper_new (VALUE self, VALUE filename) +{ + Mapper_t *m = new Mapper_t (StringValuePtr (filename)); + if (!m) + rb_raise (rb_eException, "No Mapper Object"); + VALUE v = Data_Wrap_Struct (Mapper, 0, mapper_dt, (void*)m); + return v; +} + + +/**************** +mapper_get_chunk +****************/ + +static VALUE mapper_get_chunk (VALUE self, VALUE start, VALUE length) +{ + Mapper_t *m = NULL; + Data_Get_Struct (self, Mapper_t, m); + if (!m) + rb_raise (rb_eException, "No Mapper Object"); + + // TODO, what if some moron sends us a negative start value? + unsigned _start = NUM2INT (start); + unsigned _length = NUM2INT (length); + if ((_start + _length) > m->GetFileSize()) + rb_raise (rb_eException, "Mapper Range Error"); + + const char *chunk = m->GetChunk (_start); + if (!chunk) + rb_raise (rb_eException, "No Mapper Chunk"); + return rb_str_new (chunk, _length); +} + +/************ +mapper_close +************/ + +static VALUE mapper_close (VALUE self) +{ + Mapper_t *m = NULL; + Data_Get_Struct (self, Mapper_t, m); + if (!m) + rb_raise (rb_eException, "No Mapper Object"); + m->Close(); + return Qnil; +} + +/*********** +mapper_size +***********/ + +static VALUE mapper_size (VALUE self) +{ + Mapper_t *m = NULL; + Data_Get_Struct (self, Mapper_t, m); + if (!m) + rb_raise (rb_eException, "No Mapper Object"); + return INT2NUM (m->GetFileSize()); +} + + +/********************** +Init_fastfilereaderext +**********************/ + +extern "C" void Init_fastfilereaderext() +{ + EmModule = rb_define_module ("EventMachine"); + FastFileReader = rb_define_class_under (EmModule, "FastFileReader", rb_cObject); + Mapper = rb_define_class_under (FastFileReader, "Mapper", rb_cObject); + + rb_define_module_function (Mapper, "new", (VALUE(*)(...))mapper_new, 1); + rb_define_method (Mapper, "size", (VALUE(*)(...))mapper_size, 0); + rb_define_method (Mapper, "close", (VALUE(*)(...))mapper_close, 0); + rb_define_method (Mapper, "get_chunk", (VALUE(*)(...))mapper_get_chunk, 2); +} + + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/kb.cpp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/kb.cpp new file mode 100644 index 000000000..aabae80da --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/kb.cpp @@ -0,0 +1,79 @@ +/***************************************************************************** + +$Id$ + +File: kb.cpp +Date: 24Aug07 + +Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +Gmail: blackhedd + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + +#include "project.h" + + +/************************************** +KeyboardDescriptor::KeyboardDescriptor +**************************************/ + +KeyboardDescriptor::KeyboardDescriptor (EventMachine_t *parent_em): + EventableDescriptor (0, parent_em), + bReadAttemptedAfterClose (false) +{ + #ifdef HAVE_EPOLL + EpollEvent.events = EPOLLIN; + #endif + #ifdef HAVE_KQUEUE + MyEventMachine->ArmKqueueReader (this); + #endif +} + + +/*************************************** +KeyboardDescriptor::~KeyboardDescriptor +***************************************/ + +KeyboardDescriptor::~KeyboardDescriptor() +{ +} + + +/************************* +KeyboardDescriptor::Write +*************************/ + +void KeyboardDescriptor::Write() +{ + // Why are we here? + throw std::runtime_error ("bad code path in keyboard handler"); +} + + +/***************************** +KeyboardDescriptor::Heartbeat +*****************************/ + +void KeyboardDescriptor::Heartbeat() +{ + // no-op +} + + +/************************ +KeyboardDescriptor::Read +************************/ + +void KeyboardDescriptor::Read() +{ + char c; + read (GetSocket(), &c, 1); + _GenericInboundDispatch(&c, 1); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/page.cpp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/page.cpp new file mode 100644 index 000000000..b3d66dace --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/page.cpp @@ -0,0 +1,107 @@ +/***************************************************************************** + +$Id$ + +File: page.cpp +Date: 30Apr06 + +Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +Gmail: blackhedd + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + + +#include "project.h" + + +/****************** +PageList::PageList +******************/ + +PageList::PageList() +{ +} + + +/******************* +PageList::~PageList +*******************/ + +PageList::~PageList() +{ + while (HasPages()) + PopFront(); +} + + +/*************** +PageList::Front +***************/ + +void PageList::Front (const char **page, int *length) +{ + assert (page && length); + + if (HasPages()) { + Page p = Pages.front(); + *page = p.Buffer; + *length = p.Size; + } + else { + *page = NULL; + *length = 0; + } +} + + +/****************** +PageList::PopFront +******************/ + +void PageList::PopFront() +{ + if (HasPages()) { + Page p = Pages.front(); + Pages.pop_front(); + if (p.Buffer) + free ((void*)p.Buffer); + } +} + + +/****************** +PageList::HasPages +******************/ + +bool PageList::HasPages() +{ + return (Pages.size() > 0) ? true : false; +} + + +/************** +PageList::Push +**************/ + +void PageList::Push (const char *buf, int size) +{ + if (buf && (size > 0)) { + char *copy = (char*) malloc (size); + if (!copy) + throw runtime_error ("no memory in pagelist"); + memcpy (copy, buf, size); + Pages.push_back (Page (copy, size)); + } +} + + + + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/page.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/page.h new file mode 100644 index 000000000..d3f701e41 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/page.h @@ -0,0 +1,51 @@ +/***************************************************************************** + +$Id$ + +File: page.h +Date: 30Apr06 + +Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +Gmail: blackhedd + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + + +#ifndef __PageManager__H_ +#define __PageManager__H_ + + +/************** +class PageList +**************/ + +class PageList +{ + struct Page { + Page (const char *b, size_t s): Buffer(b), Size(s) {} + const char *Buffer; + size_t Size; + }; + + public: + PageList(); + virtual ~PageList(); + + void Push (const char*, int); + bool HasPages(); + void Front (const char**, int*); + void PopFront(); + + private: + deque Pages; +}; + + +#endif // __PageManager__H_ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/pipe.cpp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/pipe.cpp new file mode 100644 index 000000000..92b98de01 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/pipe.cpp @@ -0,0 +1,347 @@ +/***************************************************************************** + +$Id$ + +File: pipe.cpp +Date: 30May07 + +Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +Gmail: blackhedd + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + +#include "project.h" + + +#ifdef OS_UNIX +// THIS ENTIRE FILE IS ONLY COMPILED ON UNIX-LIKE SYSTEMS. + +/****************************** +PipeDescriptor::PipeDescriptor +******************************/ + +PipeDescriptor::PipeDescriptor (int fd, pid_t subpid, EventMachine_t *parent_em): + EventableDescriptor (fd, parent_em), + bReadAttemptedAfterClose (false), + OutboundDataSize (0), + SubprocessPid (subpid) +{ + #ifdef HAVE_EPOLL + EpollEvent.events = EPOLLIN; + #endif + #ifdef HAVE_KQUEUE + MyEventMachine->ArmKqueueReader (this); + #endif +} + + +/******************************* +PipeDescriptor::~PipeDescriptor +*******************************/ + +PipeDescriptor::~PipeDescriptor() +{ + // Run down any stranded outbound data. + for (size_t i=0; i < OutboundPages.size(); i++) + OutboundPages[i].Free(); + + /* As a virtual destructor, we come here before the base-class + * destructor that closes our file-descriptor. + * We have to make sure the subprocess goes down (if it's not + * already down) and we have to reap the zombie. + * + * This implementation is PROVISIONAL and will surely be improved. + * The intention here is that we never block, hence the highly + * undesirable sleeps. But if we can't reap the subprocess even + * after sending it SIGKILL, then something is wrong and we + * throw a fatal exception, which is also not something we should + * be doing. + * + * Eventually the right thing to do will be to have the reactor + * core respond to SIGCHLD by chaining a handler on top of the + * one Ruby may have installed, and dealing with a list of dead + * children that are pending cleanup. + * + * Since we want to have a signal processor integrated into the + * client-visible API, let's wait until that is done before cleaning + * this up. + * + * Added a very ugly hack to support passing the subprocess's exit + * status to the user. It only makes logical sense for user code to access + * the subprocess exit status in the unbind callback. But unbind is called + * back during the EventableDescriptor destructor. So by that time there's + * no way to call back this object through an object binding, because it's + * already been cleaned up. We might have added a parameter to the unbind + * callback, but that would probably break a huge amount of existing code. + * So the hack-solution is to define an instance variable in the EventMachine + * object and stick the exit status in there, where it can easily be accessed + * with an accessor visible to user code. + * User code should ONLY access the exit status from within the unbind callback. + * Otherwise there's no guarantee it'll be valid. + * This hack won't make it impossible to run multiple EventMachines in a single + * process, but it will make it impossible to reliably nest unbind calls + * within other unbind calls. (Not sure if that's even possible.) + */ + + assert (MyEventMachine); + + /* Another hack to make the SubprocessPid available to get_subprocess_status */ + MyEventMachine->SubprocessPid = SubprocessPid; + + /* 01Mar09: Updated to use a small nanosleep in a loop. When nanosleep is interrupted by SIGCHLD, + * it resumes the system call after processing the signal (resulting in unnecessary latency). + * Calling nanosleep in a loop avoids this problem. + */ + struct timespec req = {0, 50000000}; // 0.05s + int n; + + // wait 0.5s for the process to die + for (n=0; n<10; n++) { + if (waitpid (SubprocessPid, &(MyEventMachine->SubprocessExitStatus), WNOHANG) != 0) return; + nanosleep (&req, NULL); + } + + // send SIGTERM and wait another 1s + kill (SubprocessPid, SIGTERM); + for (n=0; n<20; n++) { + nanosleep (&req, NULL); + if (waitpid (SubprocessPid, &(MyEventMachine->SubprocessExitStatus), WNOHANG) != 0) return; + } + + // send SIGKILL and wait another 5s + kill (SubprocessPid, SIGKILL); + for (n=0; n<100; n++) { + nanosleep (&req, NULL); + if (waitpid (SubprocessPid, &(MyEventMachine->SubprocessExitStatus), WNOHANG) != 0) return; + } + + // still not dead, give up! + throw std::runtime_error ("unable to reap subprocess"); +} + + + +/******************** +PipeDescriptor::Read +********************/ + +void PipeDescriptor::Read() +{ + int sd = GetSocket(); + if (sd == INVALID_SOCKET) { + assert (!bReadAttemptedAfterClose); + bReadAttemptedAfterClose = true; + return; + } + + LastActivity = MyEventMachine->GetCurrentLoopTime(); + + int total_bytes_read = 0; + char readbuffer [16 * 1024]; + + for (int i=0; i < 10; i++) { + // Don't read just one buffer and then move on. This is faster + // if there is a lot of incoming. + // But don't read indefinitely. Give other sockets a chance to run. + // NOTICE, we're reading one less than the buffer size. + // That's so we can put a guard byte at the end of what we send + // to user code. + // Use read instead of recv, which on Linux gives a "socket operation + // on nonsocket" error. + + + int r = read (sd, readbuffer, sizeof(readbuffer) - 1); + //cerr << ""; + + if (r > 0) { + total_bytes_read += r; + + // Add a null-terminator at the the end of the buffer + // that we will send to the callback. + // DO NOT EVER CHANGE THIS. We want to explicitly allow users + // to be able to depend on this behavior, so they will have + // the option to do some things faster. Additionally it's + // a security guard against buffer overflows. + readbuffer [r] = 0; + _GenericInboundDispatch(readbuffer, r); + } + else if (r == 0) { + break; + } + else { + // Basically a would-block, meaning we've read everything there is to read. + break; + } + + } + + + if (total_bytes_read == 0) { + // If we read no data on a socket that selected readable, + // it generally means the other end closed the connection gracefully. + ScheduleClose (false); + //bCloseNow = true; + } + +} + +/********************* +PipeDescriptor::Write +*********************/ + +void PipeDescriptor::Write() +{ + int sd = GetSocket(); + assert (sd != INVALID_SOCKET); + + LastActivity = MyEventMachine->GetCurrentLoopTime(); + char output_buffer [16 * 1024]; + size_t nbytes = 0; + + while ((OutboundPages.size() > 0) && (nbytes < sizeof(output_buffer))) { + OutboundPage *op = &(OutboundPages[0]); + if ((nbytes + op->Length - op->Offset) < sizeof (output_buffer)) { + memcpy (output_buffer + nbytes, op->Buffer + op->Offset, op->Length - op->Offset); + nbytes += (op->Length - op->Offset); + op->Free(); + OutboundPages.pop_front(); + } + else { + int len = sizeof(output_buffer) - nbytes; + memcpy (output_buffer + nbytes, op->Buffer + op->Offset, len); + op->Offset += len; + nbytes += len; + } + } + + // We should never have gotten here if there were no data to write, + // so assert that as a sanity check. + // Don't bother to make sure nbytes is less than output_buffer because + // if it were we probably would have crashed already. + assert (nbytes > 0); + + assert (GetSocket() != INVALID_SOCKET); + int bytes_written = write (GetSocket(), output_buffer, nbytes); + + if (bytes_written > 0) { + OutboundDataSize -= bytes_written; + if ((size_t)bytes_written < nbytes) { + int len = nbytes - bytes_written; + char *buffer = (char*) malloc (len + 1); + if (!buffer) + throw std::runtime_error ("bad alloc throwing back data"); + memcpy (buffer, output_buffer + bytes_written, len); + buffer [len] = 0; + OutboundPages.push_front (OutboundPage (buffer, len)); + } + #ifdef HAVE_EPOLL + EpollEvent.events = (EPOLLIN | (SelectForWrite() ? EPOLLOUT : 0)); + assert (MyEventMachine); + MyEventMachine->Modify (this); + #endif + } + else { + #ifdef OS_UNIX + if ((errno != EINPROGRESS) && (errno != EWOULDBLOCK) && (errno != EINTR)) + #endif + #ifdef OS_WIN32 + if ((errno != WSAEINPROGRESS) && (errno != WSAEWOULDBLOCK)) + #endif + Close(); + } +} + + +/************************* +PipeDescriptor::Heartbeat +*************************/ + +void PipeDescriptor::Heartbeat() +{ + // If an inactivity timeout is defined, then check for it. + if (InactivityTimeout && ((MyEventMachine->GetCurrentLoopTime() - LastActivity) >= InactivityTimeout)) + ScheduleClose (false); + //bCloseNow = true; +} + + +/***************************** +PipeDescriptor::SelectForRead +*****************************/ + +bool PipeDescriptor::SelectForRead() +{ + /* Pipe descriptors, being local by definition, don't have + * a pending state, so this is simpler than for the + * ConnectionDescriptor object. + */ + return bPaused ? false : true; +} + +/****************************** +PipeDescriptor::SelectForWrite +******************************/ + +bool PipeDescriptor::SelectForWrite() +{ + /* Pipe descriptors, being local by definition, don't have + * a pending state, so this is simpler than for the + * ConnectionDescriptor object. + */ + return (GetOutboundDataSize() > 0) && !bPaused ? true : false; +} + + + + +/******************************** +PipeDescriptor::SendOutboundData +********************************/ + +int PipeDescriptor::SendOutboundData (const char *data, int length) +{ + //if (bCloseNow || bCloseAfterWriting) + if (IsCloseScheduled()) + return 0; + + if (!data && (length > 0)) + throw std::runtime_error ("bad outbound data"); + char *buffer = (char *) malloc (length + 1); + if (!buffer) + throw std::runtime_error ("no allocation for outbound data"); + memcpy (buffer, data, length); + buffer [length] = 0; + OutboundPages.push_back (OutboundPage (buffer, length)); + OutboundDataSize += length; + #ifdef HAVE_EPOLL + EpollEvent.events = (EPOLLIN | EPOLLOUT); + assert (MyEventMachine); + MyEventMachine->Modify (this); + #endif + return length; +} + +/******************************** +PipeDescriptor::GetSubprocessPid +********************************/ + +bool PipeDescriptor::GetSubprocessPid (pid_t *pid) +{ + bool ok = false; + if (pid && (SubprocessPid > 0)) { + *pid = SubprocessPid; + ok = true; + } + return ok; +} + + +#endif // OS_UNIX + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/project.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/project.h new file mode 100644 index 000000000..2e54bfd65 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/project.h @@ -0,0 +1,156 @@ +/***************************************************************************** + +$Id$ + +File: project.h +Date: 06Apr06 + +Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +Gmail: blackhedd + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + + +#ifndef __Project__H_ +#define __Project__H_ + + +#ifdef OS_WIN32 +#pragma warning(disable:4786) +#endif + +#include +#include +#include +#include +#include +#include +#include +#include + + +#ifdef OS_UNIX +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +typedef int SOCKET; +#define INVALID_SOCKET -1 +#define SOCKET_ERROR -1 +#ifdef OS_SOLARIS8 +#include +#include +#ifndef AF_LOCAL +#define AF_LOCAL AF_UNIX +#endif +// INADDR_NONE is undefined on Solaris < 8. Thanks to Brett Eisenberg and Tim Pease. +#ifndef INADDR_NONE +#define INADDR_NONE ((unsigned long)-1) +#endif +#endif /* OS_SOLARIS8 */ + +#ifdef _AIX +#include +#ifndef AF_LOCAL +#define AF_LOCAL AF_UNIX +#endif +#endif /* _AIX */ + +#endif /* OS_UNIX */ + +#ifdef OS_WIN32 +// 21Sep09: windows limits select() to 64 sockets by default, we increase it to 1024 here (before including winsock2.h) +// 18Jun12: fd_setsize must be changed in the ruby binary (not in this extension). redefining it also causes segvs, see eventmachine/eventmachine#333 +//#define FD_SETSIZE 1024 + +#define WIN32_LEAN_AND_MEAN +#include +#include +#include +#include +#include +#include + +typedef int socklen_t; +typedef int pid_t; +#endif + +#if !defined(_MSC_VER) || _MSC_VER > 1500 +#include +#endif + +using namespace std; + +#ifdef WITH_SSL +#include +#include +#endif + +#ifdef HAVE_EPOLL +#include +#endif + +#ifdef HAVE_KQUEUE +#include +#include +#endif + +#ifdef HAVE_INOTIFY +#include +#endif + +#ifdef HAVE_OLD_INOTIFY +#include +#include +static inline int inotify_init (void) { return syscall (__NR_inotify_init); } +static inline int inotify_add_watch (int fd, const char *name, __u32 mask) { return syscall (__NR_inotify_add_watch, fd, name, mask); } +static inline int inotify_rm_watch (int fd, __u32 wd) { return syscall (__NR_inotify_rm_watch, fd, wd); } +#define HAVE_INOTIFY 1 +#endif + +#ifdef HAVE_INOTIFY +#define INOTIFY_EVENT_SIZE (sizeof(struct inotify_event)) +#endif + +#ifdef HAVE_WRITEV +#include +#endif + +#if __cplusplus +extern "C" { +#endif + typedef void (*EMCallback)(const unsigned long, int, const char*, const unsigned long); +#if __cplusplus +} +#endif + +#include "binder.h" +#include "em.h" +#include "ed.h" +#include "page.h" +#include "ssl.h" +#include "eventmachine.h" + +#endif // __Project__H_ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/rubymain.cpp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/rubymain.cpp new file mode 100644 index 000000000..926f61bbb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/rubymain.cpp @@ -0,0 +1,1297 @@ +/***************************************************************************** + +$Id$ + +File: rubymain.cpp +Date: 06Apr06 + +Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +Gmail: blackhedd + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + +#include "project.h" +#include "eventmachine.h" +#include + +#ifndef RFLOAT_VALUE +#define RFLOAT_VALUE(arg) RFLOAT(arg)->value +#endif + +/******* +Statics +*******/ + +static VALUE EmModule; +static VALUE EmConnection; +static VALUE EmConnsHash; +static VALUE EmTimersHash; + +static VALUE EM_eConnectionError; +static VALUE EM_eUnknownTimerFired; +static VALUE EM_eConnectionNotBound; +static VALUE EM_eUnsupported; + +static VALUE Intern_at_signature; +static VALUE Intern_at_timers; +static VALUE Intern_at_conns; +static VALUE Intern_at_error_handler; +static VALUE Intern_event_callback; +static VALUE Intern_run_deferred_callbacks; +static VALUE Intern_delete; +static VALUE Intern_call; +static VALUE Intern_receive_data; +static VALUE Intern_ssl_handshake_completed; +static VALUE Intern_ssl_verify_peer; +static VALUE Intern_notify_readable; +static VALUE Intern_notify_writable; +static VALUE Intern_proxy_target_unbound; +static VALUE Intern_proxy_completed; +static VALUE Intern_connection_completed; + +static VALUE rb_cProcStatus; + +struct em_event { + unsigned long signature; + int event; + const char *data_str; + unsigned long data_num; +}; + +static inline VALUE ensure_conn(const unsigned long signature) +{ + VALUE conn = rb_hash_aref (EmConnsHash, ULONG2NUM (signature)); + if (conn == Qnil) + rb_raise (EM_eConnectionNotBound, "unknown connection: %lu", signature); + return conn; +} + + +/**************** +t_event_callback +****************/ + +static inline void event_callback (struct em_event* e) +{ + const unsigned long signature = e->signature; + int event = e->event; + const char *data_str = e->data_str; + const unsigned long data_num = e->data_num; + + switch (event) { + case EM_CONNECTION_READ: + { + VALUE conn = rb_hash_aref (EmConnsHash, ULONG2NUM (signature)); + if (conn == Qnil) + rb_raise (EM_eConnectionNotBound, "received %lu bytes of data for unknown signature: %lu", data_num, signature); + rb_funcall (conn, Intern_receive_data, 1, rb_str_new (data_str, data_num)); + return; + } + case EM_CONNECTION_ACCEPTED: + { + rb_funcall (EmModule, Intern_event_callback, 3, ULONG2NUM(signature), INT2FIX(event), ULONG2NUM(data_num)); + return; + } + case EM_CONNECTION_UNBOUND: + { + rb_funcall (EmModule, Intern_event_callback, 3, ULONG2NUM(signature), INT2FIX(event), ULONG2NUM(data_num)); + return; + } + case EM_CONNECTION_COMPLETED: + { + VALUE conn = ensure_conn(signature); + rb_funcall (conn, Intern_connection_completed, 0); + return; + } + case EM_CONNECTION_NOTIFY_READABLE: + { + VALUE conn = ensure_conn(signature); + rb_funcall (conn, Intern_notify_readable, 0); + return; + } + case EM_CONNECTION_NOTIFY_WRITABLE: + { + VALUE conn = ensure_conn(signature); + rb_funcall (conn, Intern_notify_writable, 0); + return; + } + case EM_LOOPBREAK_SIGNAL: + { + rb_funcall (EmModule, Intern_run_deferred_callbacks, 0); + return; + } + case EM_TIMER_FIRED: + { + VALUE timer = rb_funcall (EmTimersHash, Intern_delete, 1, ULONG2NUM (data_num)); + if (timer == Qnil) { + rb_raise (EM_eUnknownTimerFired, "no such timer: %lu", data_num); + } else if (timer == Qfalse) { + /* Timer Canceled */ + } else { + rb_funcall (timer, Intern_call, 0); + } + return; + } + #ifdef WITH_SSL + case EM_SSL_HANDSHAKE_COMPLETED: + { + VALUE conn = ensure_conn(signature); + rb_funcall (conn, Intern_ssl_handshake_completed, 0); + return; + } + case EM_SSL_VERIFY: + { + VALUE conn = ensure_conn(signature); + VALUE should_accept = rb_funcall (conn, Intern_ssl_verify_peer, 1, rb_str_new(data_str, data_num)); + if (RTEST(should_accept)) + evma_accept_ssl_peer (signature); + return; + } + #endif + case EM_PROXY_TARGET_UNBOUND: + { + VALUE conn = ensure_conn(signature); + rb_funcall (conn, Intern_proxy_target_unbound, 0); + return; + } + case EM_PROXY_COMPLETED: + { + VALUE conn = ensure_conn(signature); + rb_funcall (conn, Intern_proxy_completed, 0); + return; + } + } +} + +/******************* +event_error_handler +*******************/ + +static void event_error_handler(VALUE unused, VALUE err) +{ + VALUE error_handler = rb_ivar_get(EmModule, Intern_at_error_handler); + rb_funcall (error_handler, Intern_call, 1, err); +} + +/********************** +event_callback_wrapper +**********************/ + +static void event_callback_wrapper (const unsigned long signature, int event, const char *data_str, const unsigned long data_num) +{ + struct em_event e; + e.signature = signature; + e.event = event; + e.data_str = data_str; + e.data_num = data_num; + + if (!rb_ivar_defined(EmModule, Intern_at_error_handler)) + event_callback(&e); + else + rb_rescue((VALUE (*)(ANYARGS))event_callback, (VALUE)&e, (VALUE (*)(ANYARGS))event_error_handler, Qnil); +} + +/************************** +t_initialize_event_machine +**************************/ + +static VALUE t_initialize_event_machine (VALUE self) +{ + EmConnsHash = rb_ivar_get (EmModule, Intern_at_conns); + EmTimersHash = rb_ivar_get (EmModule, Intern_at_timers); + assert(EmConnsHash != Qnil); + assert(EmTimersHash != Qnil); + evma_initialize_library ((EMCallback)event_callback_wrapper); + return Qnil; +} + + + +/***************************** +t_run_machine_without_threads +*****************************/ + +static VALUE t_run_machine_without_threads (VALUE self) +{ + evma_run_machine(); + return Qnil; +} + + +/******************* +t_add_oneshot_timer +*******************/ + +static VALUE t_add_oneshot_timer (VALUE self, VALUE interval) +{ + const unsigned long f = evma_install_oneshot_timer (FIX2INT (interval)); + if (!f) + rb_raise (rb_eRuntimeError, "ran out of timers; use #set_max_timers to increase limit"); + return ULONG2NUM (f); +} + + +/************** +t_start_server +**************/ + +static VALUE t_start_server (VALUE self, VALUE server, VALUE port) +{ + const unsigned long f = evma_create_tcp_server (StringValuePtr(server), FIX2INT(port)); + if (!f) + rb_raise (rb_eRuntimeError, "no acceptor (port is in use or requires root privileges)"); + return ULONG2NUM (f); +} + +/************* +t_stop_server +*************/ + +static VALUE t_stop_server (VALUE self, VALUE signature) +{ + evma_stop_tcp_server (NUM2ULONG (signature)); + return Qnil; +} + + +/******************* +t_start_unix_server +*******************/ + +static VALUE t_start_unix_server (VALUE self, VALUE filename) +{ + const unsigned long f = evma_create_unix_domain_server (StringValuePtr(filename)); + if (!f) + rb_raise (rb_eRuntimeError, "no unix-domain acceptor"); + return ULONG2NUM (f); +} + + + +/*********** +t_send_data +***********/ + +static VALUE t_send_data (VALUE self, VALUE signature, VALUE data, VALUE data_length) +{ + int b = evma_send_data_to_connection (NUM2ULONG (signature), StringValuePtr (data), FIX2INT (data_length)); + return INT2NUM (b); +} + + +/*********** +t_start_tls +***********/ + +static VALUE t_start_tls (VALUE self, VALUE signature) +{ + evma_start_tls (NUM2ULONG (signature)); + return Qnil; +} + +/*************** +t_set_tls_parms +***************/ + +static VALUE t_set_tls_parms (VALUE self, VALUE signature, VALUE privkeyfile, VALUE certchainfile, VALUE verify_peer) +{ + /* set_tls_parms takes a series of positional arguments for specifying such things + * as private keys and certificate chains. + * It's expected that the parameter list will grow as we add more supported features. + * ALL of these parameters are optional, and can be specified as empty or NULL strings. + */ + evma_set_tls_parms (NUM2ULONG (signature), StringValuePtr (privkeyfile), StringValuePtr (certchainfile), (verify_peer == Qtrue ? 1 : 0)); + return Qnil; +} + +/*************** +t_get_peer_cert +***************/ + +static VALUE t_get_peer_cert (VALUE self, VALUE signature) +{ + VALUE ret = Qnil; + + #ifdef WITH_SSL + X509 *cert = NULL; + BUF_MEM *buf; + BIO *out; + + cert = evma_get_peer_cert (NUM2ULONG (signature)); + + if (cert != NULL) { + out = BIO_new(BIO_s_mem()); + PEM_write_bio_X509(out, cert); + BIO_get_mem_ptr(out, &buf); + ret = rb_str_new(buf->data, buf->length); + X509_free(cert); + BUF_MEM_free(buf); + } + #endif + + return ret; +} + +/************** +t_get_peername +**************/ + +static VALUE t_get_peername (VALUE self, VALUE signature) +{ + char buf[1024]; + socklen_t len = sizeof buf; + if (evma_get_peername (NUM2ULONG (signature), (struct sockaddr*)buf, &len)) { + return rb_str_new (buf, len); + } + + return Qnil; +} + +/************** +t_get_sockname +**************/ + +static VALUE t_get_sockname (VALUE self, VALUE signature) +{ + char buf[1024]; + socklen_t len = sizeof buf; + if (evma_get_sockname (NUM2ULONG (signature), (struct sockaddr*)buf, &len)) { + return rb_str_new (buf, len); + } + + return Qnil; +} + +/******************** +t_get_subprocess_pid +********************/ + +static VALUE t_get_subprocess_pid (VALUE self, VALUE signature) +{ + pid_t pid; + if (evma_get_subprocess_pid (NUM2ULONG (signature), &pid)) { + return INT2NUM (pid); + } + + return Qnil; +} + +/*********************** +t_get_subprocess_status +***********************/ + +static VALUE t_get_subprocess_status (VALUE self, VALUE signature) +{ + VALUE proc_status = Qnil; + + int status; + pid_t pid; + + if (evma_get_subprocess_status (NUM2ULONG (signature), &status)) { + if (evma_get_subprocess_pid (NUM2ULONG (signature), &pid)) { + proc_status = rb_obj_alloc(rb_cProcStatus); + rb_iv_set(proc_status, "status", INT2FIX(status)); + rb_iv_set(proc_status, "pid", INT2FIX(pid)); + } + } + + return proc_status; +} + +/********************** +t_get_connection_count +**********************/ + +static VALUE t_get_connection_count (VALUE self) +{ + return INT2NUM(evma_get_connection_count()); +} + +/***************************** +t_get_comm_inactivity_timeout +*****************************/ + +static VALUE t_get_comm_inactivity_timeout (VALUE self, VALUE signature) +{ + return rb_float_new(evma_get_comm_inactivity_timeout(NUM2ULONG (signature))); +} + +/***************************** +t_set_comm_inactivity_timeout +*****************************/ + +static VALUE t_set_comm_inactivity_timeout (VALUE self, VALUE signature, VALUE timeout) +{ + float ti = RFLOAT_VALUE(timeout); + if (evma_set_comm_inactivity_timeout(NUM2ULONG(signature), ti)) { + return Qtrue; + } + return Qfalse; +} + +/***************************** +t_get_pending_connect_timeout +*****************************/ + +static VALUE t_get_pending_connect_timeout (VALUE self, VALUE signature) +{ + return rb_float_new(evma_get_pending_connect_timeout(NUM2ULONG (signature))); +} + +/***************************** +t_set_pending_connect_timeout +*****************************/ + +static VALUE t_set_pending_connect_timeout (VALUE self, VALUE signature, VALUE timeout) +{ + float ti = RFLOAT_VALUE(timeout); + if (evma_set_pending_connect_timeout(NUM2ULONG(signature), ti)) { + return Qtrue; + } + return Qfalse; +} + +/*************** +t_send_datagram +***************/ + +static VALUE t_send_datagram (VALUE self, VALUE signature, VALUE data, VALUE data_length, VALUE address, VALUE port) +{ + int b = evma_send_datagram (NUM2ULONG (signature), StringValuePtr (data), FIX2INT (data_length), StringValuePtr(address), FIX2INT(port)); + return INT2NUM (b); +} + + +/****************** +t_close_connection +******************/ + +static VALUE t_close_connection (VALUE self, VALUE signature, VALUE after_writing) +{ + evma_close_connection (NUM2ULONG (signature), ((after_writing == Qtrue) ? 1 : 0)); + return Qnil; +} + +/******************************** +t_report_connection_error_status +********************************/ + +static VALUE t_report_connection_error_status (VALUE self, VALUE signature) +{ + int b = evma_report_connection_error_status (NUM2ULONG (signature)); + return INT2NUM (b); +} + + + +/**************** +t_connect_server +****************/ + +static VALUE t_connect_server (VALUE self, VALUE server, VALUE port) +{ + // Avoid FIX2INT in this case, because it doesn't deal with type errors properly. + // Specifically, if the value of port comes in as a string rather than an integer, + // NUM2INT will throw a type error, but FIX2INT will generate garbage. + + try { + const unsigned long f = evma_connect_to_server (NULL, 0, StringValuePtr(server), NUM2INT(port)); + if (!f) + rb_raise (EM_eConnectionError, "no connection"); + return ULONG2NUM (f); + } catch (std::runtime_error e) { + rb_raise (EM_eConnectionError, "%s", e.what()); + } + return Qnil; +} + +/********************* +t_bind_connect_server +*********************/ + +static VALUE t_bind_connect_server (VALUE self, VALUE bind_addr, VALUE bind_port, VALUE server, VALUE port) +{ + // Avoid FIX2INT in this case, because it doesn't deal with type errors properly. + // Specifically, if the value of port comes in as a string rather than an integer, + // NUM2INT will throw a type error, but FIX2INT will generate garbage. + + try { + const unsigned long f = evma_connect_to_server (StringValuePtr(bind_addr), NUM2INT(bind_port), StringValuePtr(server), NUM2INT(port)); + if (!f) + rb_raise (EM_eConnectionError, "no connection"); + return ULONG2NUM (f); + } catch (std::runtime_error e) { + rb_raise (EM_eConnectionError, "%s", e.what()); + } + return Qnil; +} + +/********************* +t_connect_unix_server +*********************/ + +static VALUE t_connect_unix_server (VALUE self, VALUE serversocket) +{ + const unsigned long f = evma_connect_to_unix_server (StringValuePtr(serversocket)); + if (!f) + rb_raise (rb_eRuntimeError, "no connection"); + return ULONG2NUM (f); +} + +/*********** +t_attach_fd +***********/ + +static VALUE t_attach_fd (VALUE self, VALUE file_descriptor, VALUE watch_mode) +{ + const unsigned long f = evma_attach_fd (NUM2INT(file_descriptor), watch_mode == Qtrue); + if (!f) + rb_raise (rb_eRuntimeError, "no connection"); + return ULONG2NUM (f); +} + +/*********** +t_detach_fd +***********/ + +static VALUE t_detach_fd (VALUE self, VALUE signature) +{ + return INT2NUM(evma_detach_fd (NUM2ULONG (signature))); +} + +/************** +t_get_sock_opt +**************/ + +static VALUE t_get_sock_opt (VALUE self, VALUE signature, VALUE lev, VALUE optname) +{ + int fd = evma_get_file_descriptor (NUM2ULONG (signature)); + int level = NUM2INT(lev), option = NUM2INT(optname); + socklen_t len = 128; + char buf[128]; + + if (getsockopt(fd, level, option, buf, &len) < 0) + rb_sys_fail("getsockopt"); + + return rb_str_new(buf, len); +} + +/************** +t_set_sock_opt +**************/ + +static VALUE t_set_sock_opt (VALUE self, VALUE signature, VALUE lev, VALUE optname, VALUE optval) +{ + int fd = evma_get_file_descriptor (NUM2ULONG (signature)); + int level = NUM2INT(lev), option = NUM2INT(optname); + int i; + void *v; + socklen_t len; + + switch (TYPE(optval)) { + case T_FIXNUM: + i = FIX2INT(optval); + goto numval; + case T_FALSE: + i = 0; + goto numval; + case T_TRUE: + i = 1; + numval: + v = (void*)&i; len = sizeof(i); + break; + default: + StringValue(optval); + v = RSTRING_PTR(optval); + len = RSTRING_LENINT(optval); + break; + } + + + if (setsockopt(fd, level, option, (char *)v, len) < 0) + rb_sys_fail("setsockopt"); + + return INT2FIX(0); +} + +/******************** +t_is_notify_readable +********************/ + +static VALUE t_is_notify_readable (VALUE self, VALUE signature) +{ + return evma_is_notify_readable(NUM2ULONG (signature)) ? Qtrue : Qfalse; +} + +/********************* +t_set_notify_readable +*********************/ + +static VALUE t_set_notify_readable (VALUE self, VALUE signature, VALUE mode) +{ + evma_set_notify_readable(NUM2ULONG (signature), mode == Qtrue); + return Qnil; +} + +/******************** +t_is_notify_readable +********************/ + +static VALUE t_is_notify_writable (VALUE self, VALUE signature) +{ + return evma_is_notify_writable(NUM2ULONG (signature)) ? Qtrue : Qfalse; +} + +/********************* +t_set_notify_writable +*********************/ + +static VALUE t_set_notify_writable (VALUE self, VALUE signature, VALUE mode) +{ + evma_set_notify_writable(NUM2ULONG (signature), mode == Qtrue); + return Qnil; +} + +/******* +t_pause +*******/ + +static VALUE t_pause (VALUE self, VALUE signature) +{ + return evma_pause(NUM2ULONG (signature)) ? Qtrue : Qfalse; +} + +/******** +t_resume +********/ + +static VALUE t_resume (VALUE self, VALUE signature) +{ + return evma_resume(NUM2ULONG (signature)) ? Qtrue : Qfalse; +} + +/********** +t_paused_p +**********/ + +static VALUE t_paused_p (VALUE self, VALUE signature) +{ + return evma_is_paused(NUM2ULONG (signature)) ? Qtrue : Qfalse; +} + +/********************* +t_num_close_scheduled +*********************/ + +static VALUE t_num_close_scheduled (VALUE self) +{ + return INT2FIX(evma_num_close_scheduled()); +} + +/***************** +t_open_udp_socket +*****************/ + +static VALUE t_open_udp_socket (VALUE self, VALUE server, VALUE port) +{ + const unsigned long f = evma_open_datagram_socket (StringValuePtr(server), FIX2INT(port)); + if (!f) + rb_raise (rb_eRuntimeError, "no datagram socket"); + return ULONG2NUM (f); +} + + + +/***************** +t_release_machine +*****************/ + +static VALUE t_release_machine (VALUE self) +{ + evma_release_library(); + return Qnil; +} + + +/****** +t_stop +******/ + +static VALUE t_stop (VALUE self) +{ + evma_stop_machine(); + return Qnil; +} + +/****************** +t_signal_loopbreak +******************/ + +static VALUE t_signal_loopbreak (VALUE self) +{ + evma_signal_loopbreak(); + return Qnil; +} + +/************** +t_library_type +**************/ + +static VALUE t_library_type (VALUE self) +{ + return rb_eval_string (":extension"); +} + + + +/******************* +t_set_timer_quantum +*******************/ + +static VALUE t_set_timer_quantum (VALUE self, VALUE interval) +{ + evma_set_timer_quantum (FIX2INT (interval)); + return Qnil; +} + +/******************** +t_get_max_timer_count +********************/ + +static VALUE t_get_max_timer_count (VALUE self) +{ + return INT2FIX (evma_get_max_timer_count()); +} + +/******************** +t_set_max_timer_count +********************/ + +static VALUE t_set_max_timer_count (VALUE self, VALUE ct) +{ + evma_set_max_timer_count (FIX2INT (ct)); + return Qnil; +} + +/*************** +t_setuid_string +***************/ + +static VALUE t_setuid_string (VALUE self, VALUE username) +{ + evma_setuid_string (StringValuePtr (username)); + return Qnil; +} + + + +/************** +t_invoke_popen +**************/ + +static VALUE t_invoke_popen (VALUE self, VALUE cmd) +{ + // 1.8.7+ + #ifdef RARRAY_LEN + int len = RARRAY_LEN(cmd); + #else + int len = RARRAY (cmd)->len; + #endif + if (len >= 2048) + rb_raise (rb_eRuntimeError, "too many arguments to popen"); + char *strings [2048]; + for (int i=0; i < len; i++) { + VALUE ix = INT2FIX (i); + VALUE s = rb_ary_aref (1, &ix, cmd); + strings[i] = StringValuePtr (s); + } + strings[len] = NULL; + + const unsigned long f = evma_popen (strings); + if (!f) { + char *err = strerror (errno); + char buf[100]; + memset (buf, 0, sizeof(buf)); + snprintf (buf, sizeof(buf)-1, "no popen: %s", (err?err:"???")); + rb_raise (rb_eRuntimeError, "%s", buf); + } + return ULONG2NUM (f); +} + + +/*************** +t_read_keyboard +***************/ + +static VALUE t_read_keyboard (VALUE self) +{ + const unsigned long f = evma_open_keyboard(); + if (!f) + rb_raise (rb_eRuntimeError, "no keyboard reader"); + return ULONG2NUM (f); +} + + +/**************** +t_watch_filename +****************/ + +static VALUE t_watch_filename (VALUE self, VALUE fname) +{ + try { + return ULONG2NUM(evma_watch_filename(StringValuePtr(fname))); + } catch (std::runtime_error e) { + rb_raise (EM_eUnsupported, "%s", e.what()); + } + return Qnil; +} + + +/****************** +t_unwatch_filename +******************/ + +static VALUE t_unwatch_filename (VALUE self, VALUE sig) +{ + evma_unwatch_filename(NUM2ULONG (sig)); + return Qnil; +} + + +/*********** +t_watch_pid +***********/ + +static VALUE t_watch_pid (VALUE self, VALUE pid) +{ + try { + return ULONG2NUM(evma_watch_pid(NUM2INT(pid))); + } catch (std::runtime_error e) { + rb_raise (EM_eUnsupported, "%s", e.what()); + } + return Qnil; +} + + +/************* +t_unwatch_pid +*************/ + +static VALUE t_unwatch_pid (VALUE self, VALUE sig) +{ + evma_unwatch_pid(NUM2ULONG (sig)); + return Qnil; +} + + +/********** +t__epoll_p +**********/ + +static VALUE t__epoll_p (VALUE self) +{ + #ifdef HAVE_EPOLL + return Qtrue; + #else + return Qfalse; + #endif +} + +/******** +t__epoll +********/ + +static VALUE t__epoll (VALUE self) +{ + evma_set_epoll (1); + return Qtrue; +} + +/*********** +t__epoll_set +***********/ + +static VALUE t__epoll_set (VALUE self, VALUE val) +{ + if (t__epoll_p(self) == Qfalse) + rb_raise (EM_eUnsupported, "epoll is not supported on this platform"); + + evma_set_epoll (val == Qtrue ? 1 : 0); + return val; +} + + +/*********** +t__kqueue_p +***********/ + +static VALUE t__kqueue_p (VALUE self) +{ + #ifdef HAVE_KQUEUE + return Qtrue; + #else + return Qfalse; + #endif +} + +/********* +t__kqueue +*********/ + +static VALUE t__kqueue (VALUE self) +{ + evma_set_kqueue (1); + return Qtrue; +} + +/************* +t__kqueue_set +*************/ + +static VALUE t__kqueue_set (VALUE self, VALUE val) +{ + if (t__kqueue_p(self) == Qfalse) + rb_raise (EM_eUnsupported, "kqueue is not supported on this platform"); + + evma_set_kqueue (val == Qtrue ? 1 : 0); + return val; +} + + +/******** +t__ssl_p +********/ + +static VALUE t__ssl_p (VALUE self) +{ + #ifdef WITH_SSL + return Qtrue; + #else + return Qfalse; + #endif +} + + +/**************** +t_send_file_data +****************/ + +static VALUE t_send_file_data (VALUE self, VALUE signature, VALUE filename) +{ + + /* The current implementation of evma_send_file_data_to_connection enforces a strict + * upper limit on the file size it will transmit (currently 32K). The function returns + * zero on success, -1 if the requested file exceeds its size limit, and a positive + * number for other errors. + * TODO: Positive return values are actually errno's, which is probably the wrong way to + * do this. For one thing it's ugly. For another, we can't be sure zero is never a real errno. + */ + + int b = evma_send_file_data_to_connection (NUM2ULONG (signature), StringValuePtr(filename)); + if (b == -1) + rb_raise(rb_eRuntimeError, "File too large. send_file_data() supports files under 32k."); + if (b > 0) { + char *err = strerror (b); + char buf[1024]; + memset (buf, 0, sizeof(buf)); + snprintf (buf, sizeof(buf)-1, ": %s %s", StringValuePtr(filename),(err?err:"???")); + + rb_raise (rb_eIOError, "%s", buf); + } + + return INT2NUM (0); +} + + +/******************* +t_set_rlimit_nofile +*******************/ + +static VALUE t_set_rlimit_nofile (VALUE self, VALUE arg) +{ + arg = (NIL_P(arg)) ? -1 : NUM2INT (arg); + return INT2NUM (evma_set_rlimit_nofile (arg)); +} + +/*************************** +conn_get_outbound_data_size +***************************/ + +static VALUE conn_get_outbound_data_size (VALUE self) +{ + VALUE sig = rb_ivar_get (self, Intern_at_signature); + return INT2NUM (evma_get_outbound_data_size (NUM2ULONG (sig))); +} + + +/****************************** +conn_associate_callback_target +******************************/ + +static VALUE conn_associate_callback_target (VALUE self, VALUE sig) +{ + // No-op for the time being. + return Qnil; +} + + +/*************** +t_get_loop_time +****************/ + +static VALUE t_get_loop_time (VALUE self) +{ +#ifndef HAVE_RB_TIME_NEW + static VALUE cTime = rb_path2class("Time"); + static ID at = rb_intern("at"); +#endif + + uint64_t current_time = evma_get_current_loop_time(); + if (current_time != 0) { +#ifndef HAVE_RB_TIME_NEW + return rb_funcall(cTime, at, 2, INT2NUM(current_time / 1000000), INT2NUM(current_time % 1000000)); +#else + return rb_time_new(current_time / 1000000, current_time % 1000000); +#endif + } + return Qnil; +} + + +/************* +t_start_proxy +**************/ + +static VALUE t_start_proxy (VALUE self, VALUE from, VALUE to, VALUE bufsize, VALUE length) +{ + try { + evma_start_proxy(NUM2ULONG (from), NUM2ULONG (to), NUM2ULONG(bufsize), NUM2ULONG(length)); + } catch (std::runtime_error e) { + rb_raise (EM_eConnectionError, "%s", e.what()); + } + return Qnil; +} + + +/************ +t_stop_proxy +*************/ + +static VALUE t_stop_proxy (VALUE self, VALUE from) +{ + try{ + evma_stop_proxy(NUM2ULONG (from)); + } catch (std::runtime_error e) { + rb_raise (EM_eConnectionError, "%s", e.what()); + } + return Qnil; +} + +/*************** +t_proxied_bytes +****************/ + +static VALUE t_proxied_bytes (VALUE self, VALUE from) +{ + try{ + return ULONG2NUM(evma_proxied_bytes(NUM2ULONG (from))); + } catch (std::runtime_error e) { + rb_raise (EM_eConnectionError, "%s", e.what()); + } + return Qnil; +} + +/*************** +t_get_idle_time +****************/ + +static VALUE t_get_idle_time (VALUE self, VALUE from) +{ + try{ + uint64_t current_time = evma_get_current_loop_time(); + uint64_t time = evma_get_last_activity_time(NUM2ULONG (from)); + if (current_time != 0 && time != 0) { + if (time >= current_time) + return ULONG2NUM(0); + else { + uint64_t diff = current_time - time; + float seconds = diff / (1000.0*1000.0); + return rb_float_new(seconds); + } + return Qnil; + } + } catch (std::runtime_error e) { + rb_raise (EM_eConnectionError, "%s", e.what()); + } + return Qnil; +} + +/************************ +t_get_heartbeat_interval +*************************/ + +static VALUE t_get_heartbeat_interval (VALUE self) +{ + return rb_float_new(evma_get_heartbeat_interval()); +} + + +/************************ +t_set_heartbeat_interval +*************************/ + +static VALUE t_set_heartbeat_interval (VALUE self, VALUE interval) +{ + float iv = RFLOAT_VALUE(interval); + if (evma_set_heartbeat_interval(iv)) + return Qtrue; + return Qfalse; +} + + +/********************* +Init_rubyeventmachine +*********************/ + +extern "C" void Init_rubyeventmachine() +{ + // Lookup Process::Status for get_subprocess_status + VALUE rb_mProcess = rb_const_get(rb_cObject, rb_intern("Process")); + rb_cProcStatus = rb_const_get(rb_mProcess, rb_intern("Status")); + + // Tuck away some symbol values so we don't have to look 'em up every time we need 'em. + Intern_at_signature = rb_intern ("@signature"); + Intern_at_timers = rb_intern ("@timers"); + Intern_at_conns = rb_intern ("@conns"); + Intern_at_error_handler = rb_intern("@error_handler"); + + Intern_event_callback = rb_intern ("event_callback"); + Intern_run_deferred_callbacks = rb_intern ("run_deferred_callbacks"); + Intern_delete = rb_intern ("delete"); + Intern_call = rb_intern ("call"); + Intern_receive_data = rb_intern ("receive_data"); + Intern_ssl_handshake_completed = rb_intern ("ssl_handshake_completed"); + Intern_ssl_verify_peer = rb_intern ("ssl_verify_peer"); + Intern_notify_readable = rb_intern ("notify_readable"); + Intern_notify_writable = rb_intern ("notify_writable"); + Intern_proxy_target_unbound = rb_intern ("proxy_target_unbound"); + Intern_proxy_completed = rb_intern ("proxy_completed"); + Intern_connection_completed = rb_intern ("connection_completed"); + + // INCOMPLETE, we need to define class Connections inside module EventMachine + // run_machine and run_machine_without_threads are now identical. + // Must deprecate the without_threads variant. + EmModule = rb_define_module ("EventMachine"); + EmConnection = rb_define_class_under (EmModule, "Connection", rb_cObject); + + rb_define_class_under (EmModule, "NoHandlerForAcceptedConnection", rb_eRuntimeError); + EM_eConnectionError = rb_define_class_under (EmModule, "ConnectionError", rb_eRuntimeError); + EM_eConnectionNotBound = rb_define_class_under (EmModule, "ConnectionNotBound", rb_eRuntimeError); + EM_eUnknownTimerFired = rb_define_class_under (EmModule, "UnknownTimerFired", rb_eRuntimeError); + EM_eUnsupported = rb_define_class_under (EmModule, "Unsupported", rb_eRuntimeError); + + rb_define_module_function (EmModule, "initialize_event_machine", (VALUE(*)(...))t_initialize_event_machine, 0); + rb_define_module_function (EmModule, "run_machine", (VALUE(*)(...))t_run_machine_without_threads, 0); + rb_define_module_function (EmModule, "run_machine_without_threads", (VALUE(*)(...))t_run_machine_without_threads, 0); + rb_define_module_function (EmModule, "add_oneshot_timer", (VALUE(*)(...))t_add_oneshot_timer, 1); + rb_define_module_function (EmModule, "start_tcp_server", (VALUE(*)(...))t_start_server, 2); + rb_define_module_function (EmModule, "stop_tcp_server", (VALUE(*)(...))t_stop_server, 1); + rb_define_module_function (EmModule, "start_unix_server", (VALUE(*)(...))t_start_unix_server, 1); + rb_define_module_function (EmModule, "set_tls_parms", (VALUE(*)(...))t_set_tls_parms, 4); + rb_define_module_function (EmModule, "start_tls", (VALUE(*)(...))t_start_tls, 1); + rb_define_module_function (EmModule, "get_peer_cert", (VALUE(*)(...))t_get_peer_cert, 1); + rb_define_module_function (EmModule, "send_data", (VALUE(*)(...))t_send_data, 3); + rb_define_module_function (EmModule, "send_datagram", (VALUE(*)(...))t_send_datagram, 5); + rb_define_module_function (EmModule, "close_connection", (VALUE(*)(...))t_close_connection, 2); + rb_define_module_function (EmModule, "report_connection_error_status", (VALUE(*)(...))t_report_connection_error_status, 1); + rb_define_module_function (EmModule, "connect_server", (VALUE(*)(...))t_connect_server, 2); + rb_define_module_function (EmModule, "bind_connect_server", (VALUE(*)(...))t_bind_connect_server, 4); + rb_define_module_function (EmModule, "connect_unix_server", (VALUE(*)(...))t_connect_unix_server, 1); + + rb_define_module_function (EmModule, "attach_fd", (VALUE (*)(...))t_attach_fd, 2); + rb_define_module_function (EmModule, "detach_fd", (VALUE (*)(...))t_detach_fd, 1); + rb_define_module_function (EmModule, "get_sock_opt", (VALUE (*)(...))t_get_sock_opt, 3); + rb_define_module_function (EmModule, "set_sock_opt", (VALUE (*)(...))t_set_sock_opt, 4); + rb_define_module_function (EmModule, "set_notify_readable", (VALUE (*)(...))t_set_notify_readable, 2); + rb_define_module_function (EmModule, "set_notify_writable", (VALUE (*)(...))t_set_notify_writable, 2); + rb_define_module_function (EmModule, "is_notify_readable", (VALUE (*)(...))t_is_notify_readable, 1); + rb_define_module_function (EmModule, "is_notify_writable", (VALUE (*)(...))t_is_notify_writable, 1); + + rb_define_module_function (EmModule, "pause_connection", (VALUE (*)(...))t_pause, 1); + rb_define_module_function (EmModule, "resume_connection", (VALUE (*)(...))t_resume, 1); + rb_define_module_function (EmModule, "connection_paused?", (VALUE (*)(...))t_paused_p, 1); + rb_define_module_function (EmModule, "num_close_scheduled", (VALUE (*)(...))t_num_close_scheduled, 0); + + rb_define_module_function (EmModule, "start_proxy", (VALUE (*)(...))t_start_proxy, 4); + rb_define_module_function (EmModule, "stop_proxy", (VALUE (*)(...))t_stop_proxy, 1); + rb_define_module_function (EmModule, "get_proxied_bytes", (VALUE (*)(...))t_proxied_bytes, 1); + + rb_define_module_function (EmModule, "watch_filename", (VALUE (*)(...))t_watch_filename, 1); + rb_define_module_function (EmModule, "unwatch_filename", (VALUE (*)(...))t_unwatch_filename, 1); + + rb_define_module_function (EmModule, "watch_pid", (VALUE (*)(...))t_watch_pid, 1); + rb_define_module_function (EmModule, "unwatch_pid", (VALUE (*)(...))t_unwatch_pid, 1); + + rb_define_module_function (EmModule, "current_time", (VALUE(*)(...))t_get_loop_time, 0); + + rb_define_module_function (EmModule, "open_udp_socket", (VALUE(*)(...))t_open_udp_socket, 2); + rb_define_module_function (EmModule, "read_keyboard", (VALUE(*)(...))t_read_keyboard, 0); + rb_define_module_function (EmModule, "release_machine", (VALUE(*)(...))t_release_machine, 0); + rb_define_module_function (EmModule, "stop", (VALUE(*)(...))t_stop, 0); + rb_define_module_function (EmModule, "signal_loopbreak", (VALUE(*)(...))t_signal_loopbreak, 0); + rb_define_module_function (EmModule, "library_type", (VALUE(*)(...))t_library_type, 0); + rb_define_module_function (EmModule, "set_timer_quantum", (VALUE(*)(...))t_set_timer_quantum, 1); + rb_define_module_function (EmModule, "get_max_timer_count", (VALUE(*)(...))t_get_max_timer_count, 0); + rb_define_module_function (EmModule, "set_max_timer_count", (VALUE(*)(...))t_set_max_timer_count, 1); + rb_define_module_function (EmModule, "setuid_string", (VALUE(*)(...))t_setuid_string, 1); + rb_define_module_function (EmModule, "invoke_popen", (VALUE(*)(...))t_invoke_popen, 1); + rb_define_module_function (EmModule, "send_file_data", (VALUE(*)(...))t_send_file_data, 2); + rb_define_module_function (EmModule, "get_heartbeat_interval", (VALUE(*)(...))t_get_heartbeat_interval, 0); + rb_define_module_function (EmModule, "set_heartbeat_interval", (VALUE(*)(...))t_set_heartbeat_interval, 1); + rb_define_module_function (EmModule, "get_idle_time", (VALUE(*)(...))t_get_idle_time, 1); + + rb_define_module_function (EmModule, "get_peername", (VALUE(*)(...))t_get_peername, 1); + rb_define_module_function (EmModule, "get_sockname", (VALUE(*)(...))t_get_sockname, 1); + rb_define_module_function (EmModule, "get_subprocess_pid", (VALUE(*)(...))t_get_subprocess_pid, 1); + rb_define_module_function (EmModule, "get_subprocess_status", (VALUE(*)(...))t_get_subprocess_status, 1); + rb_define_module_function (EmModule, "get_comm_inactivity_timeout", (VALUE(*)(...))t_get_comm_inactivity_timeout, 1); + rb_define_module_function (EmModule, "set_comm_inactivity_timeout", (VALUE(*)(...))t_set_comm_inactivity_timeout, 2); + rb_define_module_function (EmModule, "get_pending_connect_timeout", (VALUE(*)(...))t_get_pending_connect_timeout, 1); + rb_define_module_function (EmModule, "set_pending_connect_timeout", (VALUE(*)(...))t_set_pending_connect_timeout, 2); + rb_define_module_function (EmModule, "set_rlimit_nofile", (VALUE(*)(...))t_set_rlimit_nofile, 1); + rb_define_module_function (EmModule, "get_connection_count", (VALUE(*)(...))t_get_connection_count, 0); + + rb_define_module_function (EmModule, "epoll", (VALUE(*)(...))t__epoll, 0); + rb_define_module_function (EmModule, "epoll=", (VALUE(*)(...))t__epoll_set, 1); + rb_define_module_function (EmModule, "epoll?", (VALUE(*)(...))t__epoll_p, 0); + + rb_define_module_function (EmModule, "kqueue", (VALUE(*)(...))t__kqueue, 0); + rb_define_module_function (EmModule, "kqueue=", (VALUE(*)(...))t__kqueue_set, 1); + rb_define_module_function (EmModule, "kqueue?", (VALUE(*)(...))t__kqueue_p, 0); + + rb_define_module_function (EmModule, "ssl?", (VALUE(*)(...))t__ssl_p, 0); + + rb_define_method (EmConnection, "get_outbound_data_size", (VALUE(*)(...))conn_get_outbound_data_size, 0); + rb_define_method (EmConnection, "associate_callback_target", (VALUE(*)(...))conn_associate_callback_target, 1); + + rb_define_const (EmModule, "TimerFired", INT2NUM(100)); + rb_define_const (EmModule, "ConnectionData", INT2NUM(101)); + rb_define_const (EmModule, "ConnectionUnbound", INT2NUM(102)); + rb_define_const (EmModule, "ConnectionAccepted", INT2NUM(103)); + rb_define_const (EmModule, "ConnectionCompleted", INT2NUM(104)); + rb_define_const (EmModule, "LoopbreakSignalled", INT2NUM(105)); + + rb_define_const (EmModule, "ConnectionNotifyReadable", INT2NUM(106)); + rb_define_const (EmModule, "ConnectionNotifyWritable", INT2NUM(107)); + + rb_define_const (EmModule, "SslHandshakeCompleted", INT2NUM(108)); + +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/ssl.cpp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/ssl.cpp new file mode 100644 index 000000000..eaf54ea26 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/ssl.cpp @@ -0,0 +1,468 @@ +/***************************************************************************** + +$Id$ + +File: ssl.cpp +Date: 30Apr06 + +Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +Gmail: blackhedd + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + + +#ifdef WITH_SSL + +#include "project.h" + + +bool SslContext_t::bLibraryInitialized = false; + + + +static void InitializeDefaultCredentials(); +static EVP_PKEY *DefaultPrivateKey = NULL; +static X509 *DefaultCertificate = NULL; + +static char PrivateMaterials[] = { +"-----BEGIN RSA PRIVATE KEY-----\n" +"MIICXAIBAAKBgQDCYYhcw6cGRbhBVShKmbWm7UVsEoBnUf0cCh8AX+MKhMxwVDWV\n" +"Igdskntn3cSJjRtmgVJHIK0lpb/FYHQB93Ohpd9/Z18pDmovfFF9nDbFF0t39hJ/\n" +"AqSzFB3GiVPoFFZJEE1vJqh+3jzsSF5K56bZ6azz38VlZgXeSozNW5bXkQIDAQAB\n" +"AoGALA89gIFcr6BIBo8N5fL3aNHpZXjAICtGav+kTUpuxSiaym9cAeTHuAVv8Xgk\n" +"H2Wbq11uz+6JMLpkQJH/WZ7EV59DPOicXrp0Imr73F3EXBfR7t2EQDYHPMthOA1D\n" +"I9EtCzvV608Ze90hiJ7E3guGrGppZfJ+eUWCPgy8CZH1vRECQQDv67rwV/oU1aDo\n" +"6/+d5nqjeW6mWkGqTnUU96jXap8EIw6B+0cUKskwx6mHJv+tEMM2748ZY7b0yBlg\n" +"w4KDghbFAkEAz2h8PjSJG55LwqmXih1RONSgdN9hjB12LwXL1CaDh7/lkEhq0PlK\n" +"PCAUwQSdM17Sl0Xxm2CZiekTSlwmHrtqXQJAF3+8QJwtV2sRJp8u2zVe37IeH1cJ\n" +"xXeHyjTzqZ2803fnjN2iuZvzNr7noOA1/Kp+pFvUZUU5/0G2Ep8zolPUjQJAFA7k\n" +"xRdLkzIx3XeNQjwnmLlncyYPRv+qaE3FMpUu7zftuZBnVCJnvXzUxP3vPgKTlzGa\n" +"dg5XivDRfsV+okY5uQJBAMV4FesUuLQVEKb6lMs7rzZwpeGQhFDRfywJzfom2TLn\n" +"2RdJQQ3dcgnhdVDgt5o1qkmsqQh8uJrJ9SdyLIaZQIc=\n" +"-----END RSA PRIVATE KEY-----\n" +"-----BEGIN CERTIFICATE-----\n" +"MIID6TCCA1KgAwIBAgIJANm4W/Tzs+s+MA0GCSqGSIb3DQEBBQUAMIGqMQswCQYD\n" +"VQQGEwJVUzERMA8GA1UECBMITmV3IFlvcmsxETAPBgNVBAcTCE5ldyBZb3JrMRYw\n" +"FAYDVQQKEw1TdGVhbWhlYXQubmV0MRQwEgYDVQQLEwtFbmdpbmVlcmluZzEdMBsG\n" +"A1UEAxMUb3BlbmNhLnN0ZWFtaGVhdC5uZXQxKDAmBgkqhkiG9w0BCQEWGWVuZ2lu\n" +"ZWVyaW5nQHN0ZWFtaGVhdC5uZXQwHhcNMDYwNTA1MTcwNjAzWhcNMjQwMjIwMTcw\n" +"NjAzWjCBqjELMAkGA1UEBhMCVVMxETAPBgNVBAgTCE5ldyBZb3JrMREwDwYDVQQH\n" +"EwhOZXcgWW9yazEWMBQGA1UEChMNU3RlYW1oZWF0Lm5ldDEUMBIGA1UECxMLRW5n\n" +"aW5lZXJpbmcxHTAbBgNVBAMTFG9wZW5jYS5zdGVhbWhlYXQubmV0MSgwJgYJKoZI\n" +"hvcNAQkBFhllbmdpbmVlcmluZ0BzdGVhbWhlYXQubmV0MIGfMA0GCSqGSIb3DQEB\n" +"AQUAA4GNADCBiQKBgQDCYYhcw6cGRbhBVShKmbWm7UVsEoBnUf0cCh8AX+MKhMxw\n" +"VDWVIgdskntn3cSJjRtmgVJHIK0lpb/FYHQB93Ohpd9/Z18pDmovfFF9nDbFF0t3\n" +"9hJ/AqSzFB3GiVPoFFZJEE1vJqh+3jzsSF5K56bZ6azz38VlZgXeSozNW5bXkQID\n" +"AQABo4IBEzCCAQ8wHQYDVR0OBBYEFPJvPd1Fcmd8o/Tm88r+NjYPICCkMIHfBgNV\n" +"HSMEgdcwgdSAFPJvPd1Fcmd8o/Tm88r+NjYPICCkoYGwpIGtMIGqMQswCQYDVQQG\n" +"EwJVUzERMA8GA1UECBMITmV3IFlvcmsxETAPBgNVBAcTCE5ldyBZb3JrMRYwFAYD\n" +"VQQKEw1TdGVhbWhlYXQubmV0MRQwEgYDVQQLEwtFbmdpbmVlcmluZzEdMBsGA1UE\n" +"AxMUb3BlbmNhLnN0ZWFtaGVhdC5uZXQxKDAmBgkqhkiG9w0BCQEWGWVuZ2luZWVy\n" +"aW5nQHN0ZWFtaGVhdC5uZXSCCQDZuFv087PrPjAMBgNVHRMEBTADAQH/MA0GCSqG\n" +"SIb3DQEBBQUAA4GBAC1CXey/4UoLgJiwcEMDxOvW74plks23090iziFIlGgcIhk0\n" +"Df6hTAs7H3MWww62ddvR8l07AWfSzSP5L6mDsbvq7EmQsmPODwb6C+i2aF3EDL8j\n" +"uw73m4YIGI0Zw2XdBpiOGkx2H56Kya6mJJe/5XORZedh1wpI7zki01tHYbcy\n" +"-----END CERTIFICATE-----\n"}; + +/* These private materials were made with: + * openssl req -new -x509 -keyout cakey.pem -out cacert.pem -nodes -days 6500 + * TODO: We need a full-blown capability to work with user-supplied + * keypairs and properly-signed certificates. + */ + + +/***************** +builtin_passwd_cb +*****************/ + +extern "C" int builtin_passwd_cb (char *buf, int bufsize, int rwflag, void *userdata) +{ + strcpy (buf, "kittycat"); + return 8; +} + +/**************************** +InitializeDefaultCredentials +****************************/ + +static void InitializeDefaultCredentials() +{ + BIO *bio = BIO_new_mem_buf (PrivateMaterials, -1); + assert (bio); + + if (DefaultPrivateKey) { + // we may come here in a restart. + EVP_PKEY_free (DefaultPrivateKey); + DefaultPrivateKey = NULL; + } + PEM_read_bio_PrivateKey (bio, &DefaultPrivateKey, builtin_passwd_cb, 0); + + if (DefaultCertificate) { + // we may come here in a restart. + X509_free (DefaultCertificate); + DefaultCertificate = NULL; + } + PEM_read_bio_X509 (bio, &DefaultCertificate, NULL, 0); + + BIO_free (bio); +} + + + +/************************** +SslContext_t::SslContext_t +**************************/ + +SslContext_t::SslContext_t (bool is_server, const string &privkeyfile, const string &certchainfile): + pCtx (NULL), + PrivateKey (NULL), + Certificate (NULL) +{ + /* TODO: the usage of the specified private-key and cert-chain filenames only applies to + * client-side connections at this point. Server connections currently use the default materials. + * That needs to be fixed asap. + * Also, in this implementation, server-side connections use statically defined X-509 defaults. + * One thing I'm really not clear on is whether or not you have to explicitly free X509 and EVP_PKEY + * objects when we call our destructor, or whether just calling SSL_CTX_free is enough. + */ + + if (!bLibraryInitialized) { + bLibraryInitialized = true; + SSL_library_init(); + OpenSSL_add_ssl_algorithms(); + OpenSSL_add_all_algorithms(); + SSL_load_error_strings(); + ERR_load_crypto_strings(); + + InitializeDefaultCredentials(); + } + + bIsServer = is_server; + pCtx = SSL_CTX_new (is_server ? SSLv23_server_method() : SSLv23_client_method()); + if (!pCtx) + throw std::runtime_error ("no SSL context"); + + SSL_CTX_set_options (pCtx, SSL_OP_ALL); + //SSL_CTX_set_options (pCtx, (SSL_OP_NO_SSLv2 | SSL_OP_NO_SSLv3)); +#ifdef SSL_MODE_RELEASE_BUFFERS + SSL_CTX_set_mode (pCtx, SSL_MODE_RELEASE_BUFFERS); +#endif + + if (is_server) { + // The SSL_CTX calls here do NOT allocate memory. + int e; + if (privkeyfile.length() > 0) + e = SSL_CTX_use_PrivateKey_file (pCtx, privkeyfile.c_str(), SSL_FILETYPE_PEM); + else + e = SSL_CTX_use_PrivateKey (pCtx, DefaultPrivateKey); + if (e <= 0) ERR_print_errors_fp(stderr); + assert (e > 0); + + if (certchainfile.length() > 0) + e = SSL_CTX_use_certificate_chain_file (pCtx, certchainfile.c_str()); + else + e = SSL_CTX_use_certificate (pCtx, DefaultCertificate); + if (e <= 0) ERR_print_errors_fp(stderr); + assert (e > 0); + } + + SSL_CTX_set_cipher_list (pCtx, "ALL:!ADH:!LOW:!EXP:!DES-CBC3-SHA:@STRENGTH"); + + if (is_server) { + SSL_CTX_sess_set_cache_size (pCtx, 128); + SSL_CTX_set_session_id_context (pCtx, (unsigned char*)"eventmachine", 12); + } + else { + int e; + if (privkeyfile.length() > 0) { + e = SSL_CTX_use_PrivateKey_file (pCtx, privkeyfile.c_str(), SSL_FILETYPE_PEM); + if (e <= 0) ERR_print_errors_fp(stderr); + assert (e > 0); + } + if (certchainfile.length() > 0) { + e = SSL_CTX_use_certificate_chain_file (pCtx, certchainfile.c_str()); + if (e <= 0) ERR_print_errors_fp(stderr); + assert (e > 0); + } + } +} + + + +/*************************** +SslContext_t::~SslContext_t +***************************/ + +SslContext_t::~SslContext_t() +{ + if (pCtx) + SSL_CTX_free (pCtx); + if (PrivateKey) + EVP_PKEY_free (PrivateKey); + if (Certificate) + X509_free (Certificate); +} + + + +/****************** +SslBox_t::SslBox_t +******************/ + +SslBox_t::SslBox_t (bool is_server, const string &privkeyfile, const string &certchainfile, bool verify_peer, const unsigned long binding): + bIsServer (is_server), + bHandshakeCompleted (false), + bVerifyPeer (verify_peer), + pSSL (NULL), + pbioRead (NULL), + pbioWrite (NULL) +{ + /* TODO someday: make it possible to re-use SSL contexts so we don't have to create + * a new one every time we come here. + */ + + Context = new SslContext_t (bIsServer, privkeyfile, certchainfile); + assert (Context); + + pbioRead = BIO_new (BIO_s_mem()); + assert (pbioRead); + + pbioWrite = BIO_new (BIO_s_mem()); + assert (pbioWrite); + + pSSL = SSL_new (Context->pCtx); + assert (pSSL); + SSL_set_bio (pSSL, pbioRead, pbioWrite); + + // Store a pointer to the binding signature in the SSL object so we can retrieve it later + SSL_set_ex_data(pSSL, 0, (void*) binding); + + if (bVerifyPeer) + SSL_set_verify(pSSL, SSL_VERIFY_PEER | SSL_VERIFY_CLIENT_ONCE, ssl_verify_wrapper); + + if (!bIsServer) + SSL_connect (pSSL); +} + + + +/******************* +SslBox_t::~SslBox_t +*******************/ + +SslBox_t::~SslBox_t() +{ + // Freeing pSSL will also free the associated BIOs, so DON'T free them separately. + if (pSSL) { + if (SSL_get_shutdown (pSSL) & SSL_RECEIVED_SHUTDOWN) + SSL_shutdown (pSSL); + else + SSL_clear (pSSL); + SSL_free (pSSL); + } + + delete Context; +} + + + +/*********************** +SslBox_t::PutCiphertext +***********************/ + +bool SslBox_t::PutCiphertext (const char *buf, int bufsize) +{ + assert (buf && (bufsize > 0)); + + assert (pbioRead); + int n = BIO_write (pbioRead, buf, bufsize); + + return (n == bufsize) ? true : false; +} + + +/********************** +SslBox_t::GetPlaintext +**********************/ + +int SslBox_t::GetPlaintext (char *buf, int bufsize) +{ + if (!SSL_is_init_finished (pSSL)) { + int e = bIsServer ? SSL_accept (pSSL) : SSL_connect (pSSL); + if (e < 0) { + int er = SSL_get_error (pSSL, e); + if (er != SSL_ERROR_WANT_READ) { + // Return -1 for a nonfatal error, -2 for an error that should force the connection down. + return (er == SSL_ERROR_SSL) ? (-2) : (-1); + } + else + return 0; + } + bHandshakeCompleted = true; + // If handshake finished, FALL THROUGH and return the available plaintext. + } + + if (!SSL_is_init_finished (pSSL)) { + // We can get here if a browser abandons a handshake. + // The user can see a warning dialog and abort the connection. + cerr << ""; + return 0; + } + + //cerr << "CIPH: " << SSL_get_cipher (pSSL) << endl; + + int n = SSL_read (pSSL, buf, bufsize); + if (n >= 0) { + return n; + } + else { + if (SSL_get_error (pSSL, n) == SSL_ERROR_WANT_READ) { + return 0; + } + else { + return -1; + } + } + + return 0; +} + + + +/************************** +SslBox_t::CanGetCiphertext +**************************/ + +bool SslBox_t::CanGetCiphertext() +{ + assert (pbioWrite); + return BIO_pending (pbioWrite) ? true : false; +} + + + +/*********************** +SslBox_t::GetCiphertext +***********************/ + +int SslBox_t::GetCiphertext (char *buf, int bufsize) +{ + assert (pbioWrite); + assert (buf && (bufsize > 0)); + + return BIO_read (pbioWrite, buf, bufsize); +} + + + +/********************** +SslBox_t::PutPlaintext +**********************/ + +int SslBox_t::PutPlaintext (const char *buf, int bufsize) +{ + // The caller will interpret the return value as the number of bytes written. + // WARNING WARNING WARNING, are there any situations in which a 0 or -1 return + // from SSL_write means we should immediately retry? The socket-machine loop + // will probably wait for a time-out cycle (perhaps a second) before re-trying. + // THIS WOULD CAUSE A PERCEPTIBLE DELAY! + + /* We internally queue any outbound plaintext that can't be dispatched + * because we're in the middle of a handshake or something. + * When we get called, try to send any queued data first, and then + * send the caller's data (or queue it). We may get called with no outbound + * data, which means we try to send the outbound queue and that's all. + * + * Return >0 if we wrote any data, 0 if we didn't, and <0 for a fatal error. + * Note that if we return 0, the connection is still considered live + * and we are signalling that we have accepted the outbound data (if any). + */ + + OutboundQ.Push (buf, bufsize); + + if (!SSL_is_init_finished (pSSL)) + return 0; + + bool fatal = false; + bool did_work = false; + + while (OutboundQ.HasPages()) { + const char *page; + int length; + OutboundQ.Front (&page, &length); + assert (page && (length > 0)); + int n = SSL_write (pSSL, page, length); + if (n > 0) { + did_work = true; + OutboundQ.PopFront(); + } + else { + int er = SSL_get_error (pSSL, n); + if ((er != SSL_ERROR_WANT_READ) && (er != SSL_ERROR_WANT_WRITE)) + fatal = true; + break; + } + } + + + if (did_work) + return 1; + else if (fatal) + return -1; + else + return 0; +} + +/********************** +SslBox_t::GetPeerCert +**********************/ + +X509 *SslBox_t::GetPeerCert() +{ + X509 *cert = NULL; + + if (pSSL) + cert = SSL_get_peer_certificate(pSSL); + + return cert; +} + + +/****************** +ssl_verify_wrapper +*******************/ + +extern "C" int ssl_verify_wrapper(int preverify_ok, X509_STORE_CTX *ctx) +{ + unsigned long binding; + X509 *cert; + SSL *ssl; + BUF_MEM *buf; + BIO *out; + int result; + + cert = X509_STORE_CTX_get_current_cert(ctx); + ssl = (SSL*) X509_STORE_CTX_get_ex_data(ctx, SSL_get_ex_data_X509_STORE_CTX_idx()); + binding = (unsigned long) SSL_get_ex_data(ssl, 0); + + out = BIO_new(BIO_s_mem()); + PEM_write_bio_X509(out, cert); + BIO_write(out, "\0", 1); + BIO_get_mem_ptr(out, &buf); + + ConnectionDescriptor *cd = dynamic_cast (Bindable_t::GetObject(binding)); + result = (cd->VerifySslPeer(buf->data) == true ? 1 : 0); + BUF_MEM_free(buf); + + return result; +} + +#endif // WITH_SSL + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/ssl.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/ssl.h new file mode 100644 index 000000000..8378394ff --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/ext/ssl.h @@ -0,0 +1,94 @@ +/***************************************************************************** + +$Id$ + +File: ssl.h +Date: 30Apr06 + +Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +Gmail: blackhedd + +This program is free software; you can redistribute it and/or modify +it under the terms of either: 1) the GNU General Public License +as published by the Free Software Foundation; either version 2 of the +License, or (at your option) any later version; or 2) Ruby's License. + +See the file COPYING for complete licensing information. + +*****************************************************************************/ + + +#ifndef __SslBox__H_ +#define __SslBox__H_ + + + + +#ifdef WITH_SSL + +/****************** +class SslContext_t +******************/ + +class SslContext_t +{ + public: + SslContext_t (bool is_server, const string &privkeyfile, const string &certchainfile); + virtual ~SslContext_t(); + + private: + static bool bLibraryInitialized; + + private: + bool bIsServer; + SSL_CTX *pCtx; + + EVP_PKEY *PrivateKey; + X509 *Certificate; + + friend class SslBox_t; +}; + + +/************** +class SslBox_t +**************/ + +class SslBox_t +{ + public: + SslBox_t (bool is_server, const string &privkeyfile, const string &certchainfile, bool verify_peer, const unsigned long binding); + virtual ~SslBox_t(); + + int PutPlaintext (const char*, int); + int GetPlaintext (char*, int); + + bool PutCiphertext (const char*, int); + bool CanGetCiphertext(); + int GetCiphertext (char*, int); + bool IsHandshakeCompleted() {return bHandshakeCompleted;} + + X509 *GetPeerCert(); + + void Shutdown(); + + protected: + SslContext_t *Context; + + bool bIsServer; + bool bHandshakeCompleted; + bool bVerifyPeer; + SSL *pSSL; + BIO *pbioRead; + BIO *pbioWrite; + + PageList OutboundQ; +}; + +extern "C" int ssl_verify_wrapper(int, X509_STORE_CTX*); + +#endif // WITH_SSL + + +#endif // __SslBox__H_ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/.classpath b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/.classpath new file mode 100644 index 000000000..11672dddb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/.classpath @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/.project b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/.project new file mode 100644 index 000000000..c7766db5a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/.project @@ -0,0 +1,17 @@ + + + em_reactor + + + + + + org.eclipse.jdt.core.javabuilder + + + + + + org.eclipse.jdt.core.javanature + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/src/com/rubyeventmachine/EmReactor.java b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/src/com/rubyeventmachine/EmReactor.java new file mode 100644 index 000000000..186902b9b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/src/com/rubyeventmachine/EmReactor.java @@ -0,0 +1,575 @@ +/** + * $Id$ + * + * Author:: Francis Cianfrocca (gmail: blackhedd) + * Homepage:: http://rubyeventmachine.com + * Date:: 15 Jul 2007 + * + * See EventMachine and EventMachine::Connection for documentation and + * usage examples. + * + * + *---------------------------------------------------------------------------- + * + * Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. + * Gmail: blackhedd + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of either: 1) the GNU General Public License + * as published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version; or 2) Ruby's License. + * + * See the file COPYING for complete licensing information. + * + *--------------------------------------------------------------------------- + * + * + */ + +package com.rubyeventmachine; + +import java.io.*; +import java.nio.channels.*; +import java.util.*; +import java.nio.*; +import java.net.*; +import java.util.concurrent.atomic.*; +import java.security.*; + +public class EmReactor { + public final int EM_TIMER_FIRED = 100; + public final int EM_CONNECTION_READ = 101; + public final int EM_CONNECTION_UNBOUND = 102; + public final int EM_CONNECTION_ACCEPTED = 103; + public final int EM_CONNECTION_COMPLETED = 104; + public final int EM_LOOPBREAK_SIGNAL = 105; + public final int EM_CONNECTION_NOTIFY_READABLE = 106; + public final int EM_CONNECTION_NOTIFY_WRITABLE = 107; + public final int EM_SSL_HANDSHAKE_COMPLETED = 108; + public final int EM_SSL_VERIFY = 109; + public final int EM_PROXY_TARGET_UNBOUND = 110; + public final int EM_PROXY_COMPLETED = 111; + + private Selector mySelector; + private TreeMap> Timers; + private HashMap Connections; + private HashMap Acceptors; + private ArrayList NewConnections; + private ArrayList UnboundConnections; + private ArrayList DetachedConnections; + + private boolean bRunReactor; + private long BindingIndex; + private AtomicBoolean loopBreaker; + private ByteBuffer myReadBuffer; + private int timerQuantum; + + public EmReactor() { + Timers = new TreeMap>(); + Connections = new HashMap(); + Acceptors = new HashMap(); + NewConnections = new ArrayList(); + UnboundConnections = new ArrayList(); + DetachedConnections = new ArrayList(); + + BindingIndex = 0; + loopBreaker = new AtomicBoolean(); + loopBreaker.set(false); + myReadBuffer = ByteBuffer.allocate(32*1024); // don't use a direct buffer. Ruby doesn't seem to like them. + timerQuantum = 98; + } + + /** + * This is a no-op stub, intended to be overridden in user code. + */ + public void eventCallback (long sig, int eventType, ByteBuffer data, long data2) { + System.out.println ("Default callback: "+sig+" "+eventType+" "+data+" "+data2); + } + public void eventCallback (long sig, int eventType, ByteBuffer data) { + eventCallback (sig, eventType, data, 0); + } + + + public void run() { + try { + mySelector = Selector.open(); + bRunReactor = true; + } catch (IOException e) { + throw new RuntimeException ("Could not open selector", e); + } + + while (bRunReactor) { + runLoopbreaks(); + if (!bRunReactor) break; + + runTimers(); + if (!bRunReactor) break; + + removeUnboundConnections(); + checkIO(); + addNewConnections(); + processIO(); + } + + close(); + } + + void addNewConnections() { + ListIterator iter = DetachedConnections.listIterator(0); + while (iter.hasNext()) { + EventableSocketChannel ec = iter.next(); + ec.cleanup(); + } + DetachedConnections.clear(); + + ListIterator iter2 = NewConnections.listIterator(0); + while (iter2.hasNext()) { + long b = iter2.next(); + + EventableChannel ec = Connections.get(b); + if (ec != null) { + try { + ec.register(); + } catch (ClosedChannelException e) { + UnboundConnections.add (ec.getBinding()); + } + } + } + NewConnections.clear(); + } + + void removeUnboundConnections() { + ListIterator iter = UnboundConnections.listIterator(0); + while (iter.hasNext()) { + long b = iter.next(); + + EventableChannel ec = Connections.remove(b); + if (ec != null) { + eventCallback (b, EM_CONNECTION_UNBOUND, null); + ec.close(); + + EventableSocketChannel sc = (EventableSocketChannel) ec; + if (sc != null && sc.isAttached()) + DetachedConnections.add (sc); + } + } + UnboundConnections.clear(); + } + + void checkIO() { + long timeout; + + if (NewConnections.size() > 0) { + timeout = -1; + } else if (!Timers.isEmpty()) { + long now = new Date().getTime(); + long k = Timers.firstKey(); + long diff = k-now; + + if (diff <= 0) + timeout = -1; // don't wait, just poll once + else + timeout = diff; + } else { + timeout = 0; // wait indefinitely + } + + try { + if (timeout == -1) + mySelector.selectNow(); + else + mySelector.select(timeout); + } catch (IOException e) { + e.printStackTrace(); + } + } + + void processIO() { + Iterator it = mySelector.selectedKeys().iterator(); + while (it.hasNext()) { + SelectionKey k = it.next(); + it.remove(); + + if (k.isConnectable()) + isConnectable(k); + + else if (k.isAcceptable()) + isAcceptable(k); + + else { + if (k.isWritable()) + isWritable(k); + + if (k.isReadable()) + isReadable(k); + } + } + } + + void isAcceptable (SelectionKey k) { + ServerSocketChannel ss = (ServerSocketChannel) k.channel(); + SocketChannel sn; + long b; + + for (int n = 0; n < 10; n++) { + try { + sn = ss.accept(); + if (sn == null) + break; + } catch (IOException e) { + e.printStackTrace(); + k.cancel(); + + ServerSocketChannel server = Acceptors.remove(k.attachment()); + if (server != null) + try{ server.close(); } catch (IOException ex) {}; + break; + } + + try { + sn.configureBlocking(false); + } catch (IOException e) { + e.printStackTrace(); + continue; + } + + b = createBinding(); + EventableSocketChannel ec = new EventableSocketChannel (sn, b, mySelector); + Connections.put (b, ec); + NewConnections.add (b); + + eventCallback (((Long)k.attachment()).longValue(), EM_CONNECTION_ACCEPTED, null, b); + } + } + + void isReadable (SelectionKey k) { + EventableChannel ec = (EventableChannel) k.attachment(); + long b = ec.getBinding(); + + if (ec.isWatchOnly()) { + if (ec.isNotifyReadable()) + eventCallback (b, EM_CONNECTION_NOTIFY_READABLE, null); + } else { + myReadBuffer.clear(); + + try { + ec.readInboundData (myReadBuffer); + myReadBuffer.flip(); + if (myReadBuffer.limit() > 0) + eventCallback (b, EM_CONNECTION_READ, myReadBuffer); + } catch (IOException e) { + UnboundConnections.add (b); + } + } + } + + void isWritable (SelectionKey k) { + EventableChannel ec = (EventableChannel) k.attachment(); + long b = ec.getBinding(); + + if (ec.isWatchOnly()) { + if (ec.isNotifyWritable()) + eventCallback (b, EM_CONNECTION_NOTIFY_WRITABLE, null); + } + else { + try { + if (!ec.writeOutboundData()) + UnboundConnections.add (b); + } catch (IOException e) { + UnboundConnections.add (b); + } + } + } + + void isConnectable (SelectionKey k) { + EventableSocketChannel ec = (EventableSocketChannel) k.attachment(); + long b = ec.getBinding(); + + try { + if (ec.finishConnecting()) + eventCallback (b, EM_CONNECTION_COMPLETED, null); + else + UnboundConnections.add (b); + } catch (IOException e) { + UnboundConnections.add (b); + } + } + + void close() { + try { + if (mySelector != null) + mySelector.close(); + } catch (IOException e) {} + mySelector = null; + + // run down open connections and sockets. + Iterator i = Acceptors.values().iterator(); + while (i.hasNext()) { + try { + i.next().close(); + } catch (IOException e) {} + } + + // 29Sep09: We create an ArrayList of the existing connections, then iterate over + // that to call unbind on them. This is because an unbind can trigger a reconnect, + // which will add to the Connections HashMap, causing a ConcurrentModificationException. + // XXX: The correct behavior here would be to latch the various reactor methods to return + // immediately if the reactor is shutting down. + ArrayList conns = new ArrayList(); + Iterator i2 = Connections.values().iterator(); + while (i2.hasNext()) { + EventableChannel ec = i2.next(); + if (ec != null) { + conns.add (ec); + } + } + Connections.clear(); + + ListIterator i3 = conns.listIterator(0); + while (i3.hasNext()) { + EventableChannel ec = i3.next(); + eventCallback (ec.getBinding(), EM_CONNECTION_UNBOUND, null); + ec.close(); + + EventableSocketChannel sc = (EventableSocketChannel) ec; + if (sc != null && sc.isAttached()) + DetachedConnections.add (sc); + } + + ListIterator i4 = DetachedConnections.listIterator(0); + while (i4.hasNext()) { + EventableSocketChannel ec = i4.next(); + ec.cleanup(); + } + DetachedConnections.clear(); + } + + void runLoopbreaks() { + if (loopBreaker.getAndSet(false)) { + eventCallback (0, EM_LOOPBREAK_SIGNAL, null); + } + } + + public void stop() { + bRunReactor = false; + signalLoopbreak(); + } + + void runTimers() { + long now = new Date().getTime(); + while (!Timers.isEmpty()) { + long k = Timers.firstKey(); + if (k > now) + break; + + ArrayList callbacks = Timers.get(k); + Timers.remove(k); + + // Fire all timers at this timestamp + ListIterator iter = callbacks.listIterator(0); + while (iter.hasNext()) { + eventCallback (0, EM_TIMER_FIRED, null, iter.next().longValue()); + } + } + } + + public long installOneshotTimer (int milliseconds) { + long s = createBinding(); + long deadline = new Date().getTime() + milliseconds; + + if (Timers.containsKey(deadline)) { + Timers.get(deadline).add(s); + } else { + ArrayList callbacks = new ArrayList(); + callbacks.add(s); + Timers.put(deadline, callbacks); + } + + return s; + } + + public long startTcpServer (SocketAddress sa) throws EmReactorException { + try { + ServerSocketChannel server = ServerSocketChannel.open(); + server.configureBlocking(false); + server.socket().bind (sa); + long s = createBinding(); + Acceptors.put(s, server); + server.register(mySelector, SelectionKey.OP_ACCEPT, s); + return s; + } catch (IOException e) { + throw new EmReactorException ("unable to open socket acceptor: " + e.toString()); + } + } + + public long startTcpServer (String address, int port) throws EmReactorException { + return startTcpServer (new InetSocketAddress (address, port)); + } + + public void stopTcpServer (long signature) throws IOException { + ServerSocketChannel server = Acceptors.remove(signature); + if (server != null) + server.close(); + else + throw new RuntimeException ("failed to close unknown acceptor"); + } + + public long openUdpSocket (InetSocketAddress address) throws IOException { + // TODO, don't throw an exception out of here. + DatagramChannel dg = DatagramChannel.open(); + dg.configureBlocking(false); + dg.socket().bind(address); + long b = createBinding(); + EventableChannel ec = new EventableDatagramChannel (dg, b, mySelector); + dg.register(mySelector, SelectionKey.OP_READ, ec); + Connections.put(b, ec); + return b; + } + + public long openUdpSocket (String address, int port) throws IOException { + return openUdpSocket (new InetSocketAddress (address, port)); + } + + public void sendData (long sig, ByteBuffer bb) throws IOException { + Connections.get(sig).scheduleOutboundData( bb ); + } + + public void sendData (long sig, byte[] data) throws IOException { + sendData (sig, ByteBuffer.wrap(data)); + } + + public void setCommInactivityTimeout (long sig, long mills) { + Connections.get(sig).setCommInactivityTimeout (mills); + } + + public void sendDatagram (long sig, byte[] data, int length, String recipAddress, int recipPort) { + sendDatagram (sig, ByteBuffer.wrap(data), recipAddress, recipPort); + } + + public void sendDatagram (long sig, ByteBuffer bb, String recipAddress, int recipPort) { + (Connections.get(sig)).scheduleOutboundDatagram( bb, recipAddress, recipPort); + } + + public long connectTcpServer (String address, int port) { + return connectTcpServer(null, 0, address, port); + } + + public long connectTcpServer (String bindAddr, int bindPort, String address, int port) { + long b = createBinding(); + + try { + SocketChannel sc = SocketChannel.open(); + sc.configureBlocking(false); + if (bindAddr != null) + sc.socket().bind(new InetSocketAddress (bindAddr, bindPort)); + + EventableSocketChannel ec = new EventableSocketChannel (sc, b, mySelector); + + if (sc.connect (new InetSocketAddress (address, port))) { + // Connection returned immediately. Can happen with localhost connections. + // WARNING, this code is untested due to lack of available test conditions. + // Ought to be be able to come here from a localhost connection, but that + // doesn't happen on Linux. (Maybe on FreeBSD?) + // The reason for not handling this until we can test it is that we + // really need to return from this function WITHOUT triggering any EM events. + // That's because until the user code has seen the signature we generated here, + // it won't be able to properly dispatch them. The C++ EM deals with this + // by setting pending mode as a flag in ALL eventable descriptors and making + // the descriptor select for writable. Then, it can send UNBOUND and + // CONNECTION_COMPLETED on the next pass through the loop, because writable will + // fire. + throw new RuntimeException ("immediate-connect unimplemented"); + } + else { + ec.setConnectPending(); + Connections.put (b, ec); + NewConnections.add (b); + } + } catch (IOException e) { + // Can theoretically come here if a connect failure can be determined immediately. + // I don't know how to make that happen for testing purposes. + throw new RuntimeException ("immediate-connect unimplemented: " + e.toString()); + } + return b; + } + + public void closeConnection (long sig, boolean afterWriting) { + EventableChannel ec = Connections.get(sig); + if (ec != null) + if (ec.scheduleClose (afterWriting)) + UnboundConnections.add (sig); + } + + long createBinding() { + return ++BindingIndex; + } + + public void signalLoopbreak() { + loopBreaker.set(true); + if (mySelector != null) + mySelector.wakeup(); + } + + public void startTls (long sig) throws NoSuchAlgorithmException, KeyManagementException { + Connections.get(sig).startTls(); + } + + public void setTimerQuantum (int mills) { + if (mills < 5 || mills > 2500) + throw new RuntimeException ("attempt to set invalid timer-quantum value: "+mills); + timerQuantum = mills; + } + + public Object[] getPeerName (long sig) { + return Connections.get(sig).getPeerName(); + } + + public Object[] getSockName (long sig) { + return Connections.get(sig).getSockName(); + } + + public long attachChannel (SocketChannel sc, boolean watch_mode) { + long b = createBinding(); + + EventableSocketChannel ec = new EventableSocketChannel (sc, b, mySelector); + + ec.setAttached(); + if (watch_mode) + ec.setWatchOnly(); + + Connections.put (b, ec); + NewConnections.add (b); + + return b; + } + + public SocketChannel detachChannel (long sig) { + EventableSocketChannel ec = (EventableSocketChannel) Connections.get (sig); + if (ec != null) { + UnboundConnections.add (sig); + return ec.getChannel(); + } else { + return null; + } + } + + public void setNotifyReadable (long sig, boolean mode) { + ((EventableSocketChannel) Connections.get(sig)).setNotifyReadable(mode); + } + + public void setNotifyWritable (long sig, boolean mode) { + ((EventableSocketChannel) Connections.get(sig)).setNotifyWritable(mode); + } + + public boolean isNotifyReadable (long sig) { + return Connections.get(sig).isNotifyReadable(); + } + + public boolean isNotifyWritable (long sig) { + return Connections.get(sig).isNotifyWritable(); + } + + public int getConnectionCount() { + return Connections.size() + Acceptors.size(); + } +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/src/com/rubyeventmachine/EmReactorException.java b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/src/com/rubyeventmachine/EmReactorException.java new file mode 100644 index 000000000..69efaa3ac --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/src/com/rubyeventmachine/EmReactorException.java @@ -0,0 +1,40 @@ +/** + * $Id$ + * + * Author:: Francis Cianfrocca (gmail: blackhedd) + * Homepage:: http://rubyeventmachine.com + * Date:: 15 Jul 2007 + * + * See EventMachine and EventMachine::Connection for documentation and + * usage examples. + * + * + *---------------------------------------------------------------------------- + * + * Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. + * Gmail: blackhedd + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of either: 1) the GNU General Public License + * as published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version; or 2) Ruby's License. + * + * See the file COPYING for complete licensing information. + * + *--------------------------------------------------------------------------- + * + * + */ + +package com.rubyeventmachine; + +/** + * @author francis + * + */ +public class EmReactorException extends Exception { + static final long serialVersionUID = 0; + public EmReactorException (String msg) { + super (msg); + } +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/src/com/rubyeventmachine/EventableChannel.java b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/src/com/rubyeventmachine/EventableChannel.java new file mode 100644 index 000000000..2ccd171d2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/src/com/rubyeventmachine/EventableChannel.java @@ -0,0 +1,70 @@ +/** + * $Id$ + * + * Author:: Francis Cianfrocca (gmail: blackhedd) + * Homepage:: http://rubyeventmachine.com + * Date:: 15 Jul 2007 + * + * See EventMachine and EventMachine::Connection for documentation and + * usage examples. + * + * + *---------------------------------------------------------------------------- + * + * Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. + * Gmail: blackhedd + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of either: 1) the GNU General Public License + * as published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version; or 2) Ruby's License. + * + * See the file COPYING for complete licensing information. + * + *--------------------------------------------------------------------------- + * + * + */ + + +package com.rubyeventmachine; + +import java.nio.ByteBuffer; +import java.io.IOException; +import java.nio.channels.ClosedChannelException; + +public interface EventableChannel { + + public void scheduleOutboundData (ByteBuffer bb); + + public void scheduleOutboundDatagram (ByteBuffer bb, String recipAddress, int recipPort); + + public boolean scheduleClose (boolean afterWriting); + + public void startTls(); + + public long getBinding(); + + public void readInboundData (ByteBuffer dst) throws IOException; + + public void register() throws ClosedChannelException; + + /** + * This is called by the reactor after it finishes running. + * The idea is to free network resources. + */ + public void close(); + + public boolean writeOutboundData() throws IOException; + + public void setCommInactivityTimeout (long seconds); + + public Object[] getPeerName(); + public Object[] getSockName(); + + public boolean isWatchOnly(); + + public boolean isNotifyReadable(); + public boolean isNotifyWritable(); + +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/src/com/rubyeventmachine/EventableDatagramChannel.java b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/src/com/rubyeventmachine/EventableDatagramChannel.java new file mode 100644 index 000000000..a85d22395 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/src/com/rubyeventmachine/EventableDatagramChannel.java @@ -0,0 +1,195 @@ +/** + * $Id$ + * + * Author:: Francis Cianfrocca (gmail: blackhedd) + * Homepage:: http://rubyeventmachine.com + * Date:: 15 Jul 2007 + * + * See EventMachine and EventMachine::Connection for documentation and + * usage examples. + * + * + *---------------------------------------------------------------------------- + * + * Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. + * Gmail: blackhedd + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of either: 1) the GNU General Public License + * as published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version; or 2) Ruby's License. + * + * See the file COPYING for complete licensing information. + * + *--------------------------------------------------------------------------- + * + * + */ + + +package com.rubyeventmachine; + +import java.nio.ByteBuffer; +import java.nio.channels.ClosedChannelException; +import java.nio.channels.SelectionKey; +import java.nio.channels.Selector; +import java.nio.channels.DatagramChannel; +import java.util.LinkedList; +import java.io.*; +import java.net.*; + +public class EventableDatagramChannel implements EventableChannel { + + class Packet { + public ByteBuffer bb; + public SocketAddress recipient; + public Packet (ByteBuffer _bb, SocketAddress _recipient) { + bb = _bb; + recipient = _recipient; + } + } + + DatagramChannel channel; + long binding; + Selector selector; + boolean bCloseScheduled; + LinkedList outboundQ; + SocketAddress returnAddress; + + + public EventableDatagramChannel (DatagramChannel dc, long _binding, Selector sel) throws ClosedChannelException { + channel = dc; + binding = _binding; + selector = sel; + bCloseScheduled = false; + outboundQ = new LinkedList(); + + dc.register(selector, SelectionKey.OP_READ, this); + } + + public void scheduleOutboundData (ByteBuffer bb) { + try { + if ((!bCloseScheduled) && (bb.remaining() > 0)) { + outboundQ.addLast(new Packet(bb, returnAddress)); + channel.register(selector, SelectionKey.OP_WRITE | SelectionKey.OP_READ, this); + } + } catch (ClosedChannelException e) { + throw new RuntimeException ("no outbound data"); + } + } + + public void scheduleOutboundDatagram (ByteBuffer bb, String recipAddress, int recipPort) { + try { + if ((!bCloseScheduled) && (bb.remaining() > 0)) { + outboundQ.addLast(new Packet (bb, new InetSocketAddress (recipAddress, recipPort))); + channel.register(selector, SelectionKey.OP_WRITE | SelectionKey.OP_READ, this); + } + } catch (ClosedChannelException e) { + throw new RuntimeException ("no outbound data"); + } + } + + public boolean scheduleClose (boolean afterWriting) { + System.out.println ("NOT SCHEDULING CLOSE ON DATAGRAM"); + return false; + } + + public void startTls() { + throw new RuntimeException ("TLS is unimplemented on this Channel"); + } + + public long getBinding() { + return binding; + } + + public void register() throws ClosedChannelException { + // TODO + } + + /** + * Terminate with extreme prejudice. Don't assume there will be another pass through + * the reactor core. + */ + public void close() { + try { + channel.close(); + } catch (IOException e) { + } + } + + public void readInboundData (ByteBuffer dst) { + returnAddress = null; + try { + // If there is no datagram available (we're nonblocking after all), + // then channel.receive returns null. + returnAddress = channel.receive(dst); + } catch (IOException e) { + // probably a no-op. The caller will see the empty (or even partial) buffer + // and presumably do the right thing. + } + } + + public boolean writeOutboundData() { + while (!outboundQ.isEmpty()) { + Packet p = outboundQ.getFirst(); + int written = 0; + try { + // With a datagram socket, it's ok to send an empty buffer. + written = channel.send(p.bb, p.recipient); + } + catch (IOException e) { + return false; + } + + /* Did we consume the whole outbound buffer? If yes, pop it off and + * keep looping. If no, the outbound network buffers are full, so break + * out of here. There's a flaw that affects outbound buffers that are intentionally + * empty. We can tell whether they got sent or not. So we assume they were. + * TODO: As implemented, this ALWAYS discards packets if they were at least + * partially written. This matches the behavior of the C++ EM. My judgment + * is that this is less surprising than fragmenting the data and sending multiple + * packets would be. I could be wrong, so this is subject to change. + */ + + if ((written > 0) || (p.bb.remaining() == 0)) + outboundQ.removeFirst(); + else + break; + } + + if (outboundQ.isEmpty()) { + try { + channel.register(selector, SelectionKey.OP_READ, this); + } catch (ClosedChannelException e) {} + } + + // ALWAYS drain the outbound queue before triggering a connection close. + // If anyone wants to close immediately, they're responsible for clearing + // the outbound queue. + return (bCloseScheduled && outboundQ.isEmpty()) ? false : true; + } + + public void setCommInactivityTimeout (long seconds) { + // TODO + System.out.println ("DATAGRAM: SET COMM INACTIVITY UNIMPLEMENTED " + seconds); + } + + public Object[] getPeerName () { + if (returnAddress != null) { + InetSocketAddress inetAddr = (InetSocketAddress) returnAddress; + return new Object[]{ inetAddr.getPort(), inetAddr.getHostName() }; + } else { + return null; + } + } + + public Object[] getSockName () { + DatagramSocket socket = channel.socket(); + return new Object[]{ socket.getLocalPort(), + socket.getLocalAddress().getHostAddress() }; + } + + public boolean isWatchOnly() { return false; } + public boolean isNotifyReadable() { return false; } + public boolean isNotifyWritable() { return false; } +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/src/com/rubyeventmachine/EventableSocketChannel.java b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/src/com/rubyeventmachine/EventableSocketChannel.java new file mode 100644 index 000000000..cdffda756 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/java/src/com/rubyeventmachine/EventableSocketChannel.java @@ -0,0 +1,370 @@ +/** + * $Id$ + * + * Author:: Francis Cianfrocca (gmail: blackhedd) + * Homepage:: http://rubyeventmachine.com + * Date:: 15 Jul 2007 + * + * See EventMachine and EventMachine::Connection for documentation and + * usage examples. + * + * + *---------------------------------------------------------------------------- + * + * Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. + * Gmail: blackhedd + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of either: 1) the GNU General Public License + * as published by the Free Software Foundation; either version 2 of the + * License, or (at your option) any later version; or 2) Ruby's License. + * + * See the file COPYING for complete licensing information. + * + *--------------------------------------------------------------------------- + * + * + */ + +/** + * + */ +package com.rubyeventmachine; + +/** + * @author francis + * + */ + +import java.nio.channels.*; +import java.nio.*; +import java.util.*; +import java.io.*; +import java.net.Socket; +import javax.net.ssl.*; +import javax.net.ssl.SSLEngineResult.*; +import java.lang.reflect.Field; + +import java.security.*; + +public class EventableSocketChannel implements EventableChannel { + Selector selector; + SelectionKey channelKey; + SocketChannel channel; + + long binding; + LinkedList outboundQ; + + boolean bCloseScheduled; + boolean bConnectPending; + boolean bWatchOnly; + boolean bAttached; + boolean bNotifyReadable; + boolean bNotifyWritable; + + SSLEngine sslEngine; + SSLContext sslContext; + + public EventableSocketChannel (SocketChannel sc, long _binding, Selector sel) { + channel = sc; + binding = _binding; + selector = sel; + bCloseScheduled = false; + bConnectPending = false; + bWatchOnly = false; + bAttached = false; + bNotifyReadable = false; + bNotifyWritable = false; + outboundQ = new LinkedList(); + } + + public long getBinding() { + return binding; + } + + public SocketChannel getChannel() { + return channel; + } + + public void register() throws ClosedChannelException { + if (channelKey == null) { + int events = currentEvents(); + channelKey = channel.register(selector, events, this); + } + } + + /** + * Terminate with extreme prejudice. Don't assume there will be another pass through + * the reactor core. + */ + public void close() { + if (channelKey != null) { + channelKey.cancel(); + channelKey = null; + } + + if (bAttached) { + // attached channels are copies, so reset the file descriptor to prevent java from close()ing it + Field f; + FileDescriptor fd; + + try { + /* do _NOT_ clobber fdVal here, it will break epoll/kqueue on jdk6! + * channelKey.cancel() above does not occur until the next call to select + * and if fdVal is gone, we will continue to get events for this fd. + * + * instead, remove fdVal in cleanup(), which is processed via DetachedConnections, + * after UnboundConnections but before NewConnections. + */ + + f = channel.getClass().getDeclaredField("fd"); + f.setAccessible(true); + fd = (FileDescriptor) f.get(channel); + + f = fd.getClass().getDeclaredField("fd"); + f.setAccessible(true); + f.set(fd, -1); + } catch (java.lang.NoSuchFieldException e) { + e.printStackTrace(); + } catch (java.lang.IllegalAccessException e) { + e.printStackTrace(); + } + + return; + } + + try { + channel.close(); + } catch (IOException e) { + } + } + + public void cleanup() { + if (bAttached) { + Field f; + try { + f = channel.getClass().getDeclaredField("fdVal"); + f.setAccessible(true); + f.set(channel, -1); + } catch (java.lang.NoSuchFieldException e) { + e.printStackTrace(); + } catch (java.lang.IllegalAccessException e) { + e.printStackTrace(); + } + } + + channel = null; + } + + public void scheduleOutboundData (ByteBuffer bb) { + if (!bCloseScheduled && bb.remaining() > 0) { + if (sslEngine != null) { + try { + ByteBuffer b = ByteBuffer.allocate(32*1024); // TODO, preallocate this buffer. + sslEngine.wrap(bb, b); + b.flip(); + outboundQ.addLast(b); + } catch (SSLException e) { + throw new RuntimeException ("ssl error"); + } + } + else { + outboundQ.addLast(bb); + } + + updateEvents(); + } + } + + public void scheduleOutboundDatagram (ByteBuffer bb, String recipAddress, int recipPort) { + throw new RuntimeException ("datagram sends not supported on this channel"); + } + + /** + * Called by the reactor when we have selected readable. + */ + public void readInboundData (ByteBuffer bb) throws IOException { + if (channel.read(bb) == -1) + throw new IOException ("eof"); + } + + /** + * Called by the reactor when we have selected writable. + * Return false to indicate an error that should cause the connection to close. + * TODO, VERY IMPORTANT: we're here because we selected writable, but it's always + * possible to become unwritable between the poll and when we get here. The way + * this code is written, we're depending on a nonblocking write NOT TO CONSUME + * the whole outbound buffer in this case, rather than firing an exception. + * We should somehow verify that this is indeed Java's defined behavior. + * Also TODO, see if we can use gather I/O rather than one write at a time. + * Ought to be a big performance enhancer. + * @return + */ + public boolean writeOutboundData() throws IOException { + while (!outboundQ.isEmpty()) { + ByteBuffer b = outboundQ.getFirst(); + if (b.remaining() > 0) + channel.write(b); + + // Did we consume the whole outbound buffer? If yes, + // pop it off and keep looping. If no, the outbound network + // buffers are full, so break out of here. + if (b.remaining() == 0) + outboundQ.removeFirst(); + else + break; + } + + if (outboundQ.isEmpty() && !bCloseScheduled) { + updateEvents(); + } + + // ALWAYS drain the outbound queue before triggering a connection close. + // If anyone wants to close immediately, they're responsible for clearing + // the outbound queue. + return (bCloseScheduled && outboundQ.isEmpty()) ? false : true; + } + + public void setConnectPending() { + bConnectPending = true; + updateEvents(); + } + + /** + * Called by the reactor when we have selected connectable. + * Return false to indicate an error that should cause the connection to close. + */ + public boolean finishConnecting() throws IOException { + channel.finishConnect(); + + bConnectPending = false; + updateEvents(); + return true; + } + + public boolean scheduleClose (boolean afterWriting) { + // TODO: What the hell happens here if bConnectPending is set? + if (!afterWriting) + outboundQ.clear(); + + if (outboundQ.isEmpty()) + return true; + else { + updateEvents(); + bCloseScheduled = true; + return false; + } + } + + public void startTls() { + if (sslEngine == null) { + try { + sslContext = SSLContext.getInstance("TLS"); + sslContext.init(null, null, null); // TODO, fill in the parameters. + sslEngine = sslContext.createSSLEngine(); // TODO, should use the parameterized version, to get Kerb stuff and session re-use. + sslEngine.setUseClientMode(false); + } catch (NoSuchAlgorithmException e) { + throw new RuntimeException ("unable to start TLS"); // TODO, get rid of this. + } catch (KeyManagementException e) { + throw new RuntimeException ("unable to start TLS"); // TODO, get rid of this. + } + } + System.out.println ("Starting TLS"); + } + + public ByteBuffer dispatchInboundData (ByteBuffer bb) throws SSLException { + if (sslEngine != null) { + if (true) throw new RuntimeException ("TLS currently unimplemented"); + System.setProperty("javax.net.debug", "all"); + ByteBuffer w = ByteBuffer.allocate(32*1024); // TODO, WRONG, preallocate this buffer. + SSLEngineResult res = sslEngine.unwrap(bb, w); + if (res.getHandshakeStatus() == HandshakeStatus.NEED_TASK) { + Runnable r; + while ((r = sslEngine.getDelegatedTask()) != null) { + r.run(); + } + } + System.out.println (bb); + w.flip(); + return w; + } + else + return bb; + } + + public void setCommInactivityTimeout (long seconds) { + // TODO + System.out.println ("SOCKET: SET COMM INACTIVITY UNIMPLEMENTED " + seconds); + } + + public Object[] getPeerName () { + Socket sock = channel.socket(); + return new Object[]{ sock.getPort(), sock.getInetAddress().getHostAddress() }; + } + + public Object[] getSockName () { + Socket sock = channel.socket(); + return new Object[]{ sock.getLocalPort(), + sock.getLocalAddress().getHostAddress() }; + } + + public void setWatchOnly() { + bWatchOnly = true; + updateEvents(); + } + public boolean isWatchOnly() { return bWatchOnly; } + + public void setAttached() { + bAttached = true; + } + public boolean isAttached() { return bAttached; } + + public void setNotifyReadable (boolean mode) { + bNotifyReadable = mode; + updateEvents(); + } + public boolean isNotifyReadable() { return bNotifyReadable; } + + public void setNotifyWritable (boolean mode) { + bNotifyWritable = mode; + updateEvents(); + } + public boolean isNotifyWritable() { return bNotifyWritable; } + + private void updateEvents() { + if (channelKey == null) + return; + + int events = currentEvents(); + + if (channelKey.interestOps() != events) { + channelKey.interestOps(events); + } + } + + private int currentEvents() { + int events = 0; + + if (bWatchOnly) + { + if (bNotifyReadable) + events |= SelectionKey.OP_READ; + + if (bNotifyWritable) + events |= SelectionKey.OP_WRITE; + } + else + { + if (bConnectPending) + events |= SelectionKey.OP_CONNECT; + else { + events |= SelectionKey.OP_READ; + + if (!outboundQ.isEmpty()) + events |= SelectionKey.OP_WRITE; + } + } + + return events; + } +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/buftok.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/buftok.rb new file mode 100644 index 000000000..2f2225b1a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/buftok.rb @@ -0,0 +1,110 @@ +# BufferedTokenizer takes a delimiter upon instantiation, or acts line-based +# by default. It allows input to be spoon-fed from some outside source which +# receives arbitrary length datagrams which may-or-may-not contain the token +# by which entities are delimited. +# +# By default, new BufferedTokenizers will operate on lines delimited by "\n" by default +# or allow you to specify any delimiter token you so choose, which will then +# be used by String#split to tokenize the input data +# +# @example Using BufferedTokernizer to parse lines out of incoming data +# +# module LineBufferedConnection +# def receive_data(data) +# (@buffer ||= BufferedTokenizer.new).extract(data).each do |line| +# receive_line(line) +# end +# end +# end +# +# @author Tony Arcieri +# @author Martin Emde +class BufferedTokenizer + # @param [String] delimiter + # @param [Integer] size_limit + def initialize(delimiter = "\n", size_limit = nil) + @delimiter = delimiter + @size_limit = size_limit + + # The input buffer is stored as an array. This is by far the most efficient + # approach given language constraints (in C a linked list would be a more + # appropriate data structure). Segments of input data are stored in a list + # which is only joined when a token is reached, substantially reducing the + # number of objects required for the operation. + @input = [] + + # Size of the input buffer + @input_size = 0 + end + + # Extract takes an arbitrary string of input data and returns an array of + # tokenized entities, provided there were any available to extract. + # + # @example + # + # tokenizer.extract(data). + # map { |entity| Decode(entity) }.each { ... } + # + # @param [String] data + def extract(data) + # Extract token-delimited entities from the input string with the split command. + # There's a bit of craftiness here with the -1 parameter. Normally split would + # behave no differently regardless of if the token lies at the very end of the + # input buffer or not (i.e. a literal edge case) Specifying -1 forces split to + # return "" in this case, meaning that the last entry in the list represents a + # new segment of data where the token has not been encountered + entities = data.split @delimiter, -1 + + # Check to see if the buffer has exceeded capacity, if we're imposing a limit + if @size_limit + raise 'input buffer full' if @input_size + entities.first.size > @size_limit + @input_size += entities.first.size + end + + # Move the first entry in the resulting array into the input buffer. It represents + # the last segment of a token-delimited entity unless it's the only entry in the list. + @input << entities.shift + + # If the resulting array from the split is empty, the token was not encountered + # (not even at the end of the buffer). Since we've encountered no token-delimited + # entities this go-around, return an empty array. + return [] if entities.empty? + + # At this point, we've hit a token, or potentially multiple tokens. Now we can bring + # together all the data we've buffered from earlier calls without hitting a token, + # and add it to our list of discovered entities. + entities.unshift @input.join + + # Now that we've hit a token, joined the input buffer and added it to the entities + # list, we can go ahead and clear the input buffer. All of the segments that were + # stored before the join can now be garbage collected. + @input.clear + + # The last entity in the list is not token delimited, however, thanks to the -1 + # passed to split. It represents the beginning of a new list of as-yet-untokenized + # data, so we add it to the start of the list. + @input << entities.pop + + # Set the new input buffer size, provided we're keeping track + @input_size = @input.first.size if @size_limit + + # Now we're left with the list of extracted token-delimited entities we wanted + # in the first place. Hooray! + entities + end + + # Flush the contents of the input buffer, i.e. return the input buffer even though + # a token has not yet been encountered. + # + # @return [String] + def flush + buffer = @input.join + @input.clear + buffer + end + + # @return [Boolean] + def empty? + @input.empty? + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/callback.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/callback.rb new file mode 100644 index 000000000..4928febc8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/callback.rb @@ -0,0 +1,58 @@ +module EventMachine + # Utility method for coercing arguments to an object that responds to :call. + # Accepts an object and a method name to send to, or a block, or an object + # that responds to :call. + # + # @example EventMachine.Callback used with a block. Returns that block. + # + # cb = EventMachine.Callback do |msg| + # puts(msg) + # end + # # returned object is a callable + # cb.call('hello world') + # + # + # @example EventMachine.Callback used with an object (to be more specific, class object) and a method name, returns an object that responds to #call + # + # cb = EventMachine.Callback(Object, :puts) + # # returned object is a callable that delegates to Kernel#puts (in this case Object.puts) + # cb.call('hello world') + # + # + # @example EventMachine.Callback used with an object that responds to #call. Returns the argument. + # + # cb = EventMachine.Callback(proc{ |msg| puts(msg) }) + # # returned object is a callable + # cb.call('hello world') + # + # + # @overload Callback(object, method) + # Wraps `method` invocation on `object` into an object that responds to #call that proxies all the arguments to that method + # @param [Object] Object to invoke method on + # @param [Symbol] Method name + # @return [<#call>] An object that responds to #call that takes any number of arguments and invokes method on object with those arguments + # + # @overload Callback(object) + # Returns callable object as is, without any coercion + # @param [<#call>] An object that responds to #call + # @return [<#call>] Its argument + # + # @overload Callback(&block) + # Returns block passed to it without any coercion + # @return [<#call>] Block passed to this method + # + # @raise [ArgumentError] When argument doesn't respond to #call, method name is missing or when invoked without arguments and block isn't given + # + # @return [<#call>] + def self.Callback(object = nil, method = nil, &blk) + if object && method + lambda { |*args| object.__send__ method, *args } + else + if object.respond_to? :call + object + else + blk || raise(ArgumentError) + end # if + end # if + end # self.Callback +end # EventMachine diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/channel.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/channel.rb new file mode 100644 index 000000000..dd94aa21d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/channel.rb @@ -0,0 +1,64 @@ +module EventMachine + # Provides a simple thread-safe way to transfer data between (typically) long running + # tasks in {EventMachine.defer} and event loop thread. + # + # @example + # + # channel = EventMachine::Channel.new + # sid = channel.subscribe { |msg| p [:got, msg] } + # + # channel.push('hello world') + # channel.unsubscribe(sid) + # + # + class Channel + def initialize + @subs = {} + @uid = 0 + end + + # Takes any arguments suitable for EM::Callback() and returns a subscriber + # id for use when unsubscribing. + # + # @return [Integer] Subscribe identifier + # @see #unsubscribe + def subscribe(*a, &b) + name = gen_id + EM.schedule { @subs[name] = EM::Callback(*a, &b) } + + name + end + + # Removes subscriber from the list. + # + # @param [Integer] Subscriber identifier + # @see #subscribe + def unsubscribe(name) + EM.schedule { @subs.delete name } + end + + # Add items to the channel, which are pushed out to all subscribers. + def push(*items) + items = items.dup + EM.schedule { items.each { |i| @subs.values.each { |s| s.call i } } } + end + alias << push + + # Fetches one message from the channel. + def pop(*a, &b) + EM.schedule { + name = subscribe do |*args| + unsubscribe(name) + EM::Callback(*a, &b).call(*args) + end + } + end + + private + + # @private + def gen_id + @uid += 1 + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/completion.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/completion.rb new file mode 100644 index 000000000..59cee39ca --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/completion.rb @@ -0,0 +1,304 @@ +# = EM::Completion +# +# A completion is a callback container for various states of completion. In +# it's most basic form it has a start state and a finish state. +# +# This implementation includes some hold-back from the EM::Deferrable +# interface in order to be compatible - but it has a much cleaner +# implementation. +# +# In general it is preferred that this implementation be used as a state +# callback container than EM::DefaultDeferrable or other classes including +# EM::Deferrable. This is because it is generally more sane to keep this level +# of state in a dedicated state-back container. This generally leads to more +# malleable interfaces and software designs, as well as eradicating nasty bugs +# that result from abstraction leakage. +# +# == Basic Usage +# +# As already mentioned, the basic usage of a Completion is simply for its two +# final states, :succeeded and :failed. +# +# An asynchronous operation will complete at some future point in time, and +# users often want to react to this event. API authors will want to expose +# some common interface to react to these events. +# +# In the following example, the user wants to know when a short lived +# connection has completed its exchange with the remote server. The simple +# protocol just waits for an ack to its message. +# +# class Protocol < EM::Connection +# include EM::P::LineText2 +# +# def initialize(message, completion) +# @message, @completion = message, completion +# @completion.completion { close_connection } +# @completion.timeout(1, :timeout) +# end +# +# def post_init +# send_data(@message) +# end +# +# def receive_line(line) +# case line +# when /ACK/i +# @completion.succeed line +# when /ERR/i +# @completion.fail :error, line +# else +# @completion.fail :unknown, line +# end +# end +# +# def unbind +# @completion.fail :disconnected unless @completion.completed? +# end +# end +# +# class API +# attr_reader :host, :port +# +# def initialize(host = 'example.org', port = 8000) +# @host, @port = host, port +# end +# +# def request(message) +# completion = EM::Deferrable::Completion.new +# EM.connect(host, port, Protocol, message, completion) +# completion +# end +# end +# +# api = API.new +# completion = api.request('stuff') +# completion.callback do |line| +# puts "API responded with: #{line}" +# end +# completion.errback do |type, line| +# case type +# when :error +# puts "API error: #{line}" +# when :unknown +# puts "API returned unknown response: #{line}" +# when :disconnected +# puts "API server disconnected prematurely" +# when :timeout +# puts "API server did not respond in a timely fashion" +# end +# end +# +# == Advanced Usage +# +# This completion implementation also supports more state callbacks and +# arbitrary states (unlike the original Deferrable API). This allows for basic +# stateful process encapsulation. One might use this to setup state callbacks +# for various states in an exchange like in the basic usage example, except +# where the applicaiton could be made to react to "connected" and +# "disconnected" states additionally. +# +# class Protocol < EM::Connection +# def initialize(completion) +# @response = [] +# @completion = completion +# @completion.stateback(:disconnected) do +# @completion.succeed @response.join +# end +# end +# +# def connection_completed +# @host, @port = Socket.unpack_sockaddr_in get_peername +# @completion.change_state(:connected, @host, @port) +# send_data("GET http://example.org/ HTTP/1.0\r\n\r\n") +# end +# +# def receive_data(data) +# @response << data +# end +# +# def unbind +# @completion.change_state(:disconnected, @host, @port) +# end +# end +# +# completion = EM::Deferrable::Completion.new +# completion.stateback(:connected) do |host, port| +# puts "Connected to #{host}:#{port}" +# end +# completion.stateback(:disconnected) do |host, port| +# puts "Disconnected from #{host}:#{port}" +# end +# completion.callback do |response| +# puts response +# end +# +# EM.connect('example.org', 80, Protocol, completion) +# +# == Timeout +# +# The Completion also has a timeout. The timeout is global and is not aware of +# states apart from completion states. The timeout is only engaged if #timeout +# is called, and it will call fail if it is reached. +# +# == Completion states +# +# By default there are two completion states, :succeeded and :failed. These +# states can be modified by subclassing and overrding the #completion_states +# method. Completion states are special, in that callbacks for all completion +# states are explcitly cleared when a completion state is entered. This +# prevents errors that could arise from accidental unterminated timeouts, and +# other such user errors. +# +# == Other notes +# +# Several APIs have been carried over from EM::Deferrable for compatibility +# reasons during a transitionary period. Specifically cancel_errback and +# cancel_callback are implemented, but their usage is to be strongly +# discouraged. Due to the already complex nature of reaction systems, dynamic +# callback deletion only makes the problem much worse. It is always better to +# add correct conditionals to the callback code, or use more states, than to +# address such implementaiton issues with conditional callbacks. + +module EventMachine + + class Completion + # This is totally not used (re-implemented), it's here in case people check + # for kind_of? + include EventMachine::Deferrable + + attr_reader :state, :value + + def initialize + @state = :unknown + @callbacks = Hash.new { |h,k| h[k] = [] } + @value = [] + @timeout_timer = nil + end + + # Enter the :succeeded state, setting the result value if given. + def succeed(*args) + change_state(:succeeded, *args) + end + # The old EM method: + alias set_deferred_success succeed + + # Enter the :failed state, setting the result value if given. + def fail(*args) + change_state(:failed, *args) + end + # The old EM method: + alias set_deferred_failure fail + + # Statebacks are called when you enter (or are in) the named state. + def stateback(state, *a, &b) + # The following is quite unfortunate special casing for :completed + # statebacks, but it's a necessary evil for latent completion + # definitions. + + if :completed == state || !completed? || @state == state + @callbacks[state] << EM::Callback(*a, &b) + end + execute_callbacks + self + end + + # Callbacks are called when you enter (or are in) a :succeeded state. + def callback(*a, &b) + stateback(:succeeded, *a, &b) + end + + # Errbacks are called when you enter (or are in) a :failed state. + def errback(*a, &b) + stateback(:failed, *a, &b) + end + + # Completions are called when you enter (or are in) either a :failed or a + # :succeeded state. They are stored as a special (reserved) state called + # :completed. + def completion(*a, &b) + stateback(:completed, *a, &b) + end + + # Enter a new state, setting the result value if given. If the state is one + # of :succeeded or :failed, then :completed callbacks will also be called. + def change_state(state, *args) + @value = args + @state = state + + EM.schedule { execute_callbacks } + end + + # The old EM method: + alias set_deferred_status change_state + + # Indicates that we've reached some kind of completion state, by default + # this is :succeeded or :failed. Due to these semantics, the :completed + # state is reserved for internal use. + def completed? + completion_states.any? { |s| state == s } + end + + # Completion states simply returns a list of completion states, by default + # this is :succeeded and :failed. + def completion_states + [:succeeded, :failed] + end + + # Schedule a time which if passes before we enter a completion state, this + # deferrable will be failed with the given arguments. + def timeout(time, *args) + cancel_timeout + @timeout_timer = EM::Timer.new(time) do + fail(*args) unless completed? + end + end + + # Disable the timeout + def cancel_timeout + if @timeout_timer + @timeout_timer.cancel + @timeout_timer = nil + end + end + + # Remove an errback. N.B. Some errbacks cannot be deleted. Usage is NOT + # recommended, this is an anti-pattern. + def cancel_errback(*a, &b) + @callbacks[:failed].delete(EM::Callback(*a, &b)) + end + + # Remove a callback. N.B. Some callbacks cannot be deleted. Usage is NOT + # recommended, this is an anti-pattern. + def cancel_callback(*a, &b) + @callbacks[:succeeded].delete(EM::Callback(*a, &b)) + end + + private + # Execute all callbacks for the current state. If in a completed state, then + # call any statebacks associated with the completed state. + def execute_callbacks + execute_state_callbacks(state) + if completed? + execute_state_callbacks(:completed) + clear_dead_callbacks + cancel_timeout + end + end + + # Iterate all callbacks for a given state, and remove then call them. + def execute_state_callbacks(state) + while callback = @callbacks[state].shift + callback.call(*value) + end + end + + # If we enter a completion state, clear other completion states after all + # callback chains are completed. This means that operation specific + # callbacks can't be dual-called, which is most common user error. + def clear_dead_callbacks + completion_states.each do |state| + @callbacks[state].clear + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/connection.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/connection.rb new file mode 100644 index 000000000..e22e2040f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/connection.rb @@ -0,0 +1,712 @@ +module EventMachine + class FileNotFoundException < Exception + end + + # EventMachine::Connection is a class that is instantiated + # by EventMachine's processing loop whenever a new connection + # is created. (New connections can be either initiated locally + # to a remote server or accepted locally from a remote client.) + # When a Connection object is instantiated, it mixes in + # the functionality contained in the user-defined module + # specified in calls to {EventMachine.connect} or {EventMachine.start_server}. + # User-defined handler modules may redefine any or all of the standard + # methods defined here, as well as add arbitrary additional code + # that will also be mixed in. + # + # EventMachine manages one object inherited from EventMachine::Connection + # (and containing the mixed-in user code) for every network connection + # that is active at any given time. + # The event loop will automatically call methods on EventMachine::Connection + # objects whenever specific events occur on the corresponding connections, + # as described below. + # + # This class is never instantiated by user code, and does not publish an + # initialize method. The instance methods of EventMachine::Connection + # which may be called by the event loop are: + # + # * {#post_init} + # * {#connection_completed} + # * {#receive_data} + # * {#unbind} + # * {#ssl_verify_peer} (if TLS is used) + # * {#ssl_handshake_completed} + # + # All of the other instance methods defined here are called only by user code. + # + # @see file:docs/GettingStarted.md EventMachine tutorial + class Connection + # @private + attr_accessor :signature + + # @private + alias original_method method + + # Override .new so subclasses don't have to call super and can ignore + # connection-specific arguments + # + # @private + def self.new(sig, *args) + allocate.instance_eval do + # Store signature + @signature = sig + # associate_callback_target sig + + # Call a superclass's #initialize if it has one + initialize(*args) + + # post initialize callback + post_init + + self + end + end + + # Stubbed initialize so legacy superclasses can safely call super + # + # @private + def initialize(*args) + end + + # Called by the event loop immediately after the network connection has been established, + # and before resumption of the network loop. + # This method is generally not called by user code, but is called automatically + # by the event loop. The base-class implementation is a no-op. + # This is a very good place to initialize instance variables that will + # be used throughout the lifetime of the network connection. + # + # @see #connection_completed + # @see #unbind + # @see #send_data + # @see #receive_data + def post_init + end + + # Called by the event loop whenever data has been received by the network connection. + # It is never called by user code. {#receive_data} is called with a single parameter, a String containing + # the network protocol data, which may of course be binary. You will + # generally redefine this method to perform your own processing of the incoming data. + # + # Here's a key point which is essential to understanding the event-driven + # programming model: EventMachine knows absolutely nothing about the protocol + # which your code implements. You must not make any assumptions about + # the size of the incoming data packets, or about their alignment on any + # particular intra-message or PDU boundaries (such as line breaks). + # receive_data can and will send you arbitrary chunks of data, with the + # only guarantee being that the data is presented to your code in the order + # it was collected from the network. Don't even assume that the chunks of + # data will correspond to network packets, as EventMachine can and will coalesce + # several incoming packets into one, to improve performance. The implication for your + # code is that you generally will need to implement some kind of a state machine + # in your redefined implementation of receive_data. For a better understanding + # of this, read through the examples of specific protocol handlers in EventMachine::Protocols + # + # The base-class implementation (which will be invoked only if you didn't override it in your protocol handler) + # simply prints incoming data packet size to stdout. + # + # @param [String] data Opaque incoming data. + # @note Depending on the protocol, buffer sizes and OS networking stack configuration, incoming data may or may not be "a complete message". + # It is up to this handler to detect content boundaries to determine whether all the content (for example, full HTTP request) + # has been received and can be processed. + # + # @see #post_init + # @see #connection_completed + # @see #unbind + # @see #send_data + # @see file:docs/GettingStarted.md EventMachine tutorial + def receive_data data + puts "............>>>#{data.length}" + end + + # Called by EventMachine when the SSL/TLS handshake has + # been completed, as a result of calling #start_tls to initiate SSL/TLS on the connection. + # + # This callback exists because {#post_init} and {#connection_completed} are **not** reliable + # for indicating when an SSL/TLS connection is ready to have its certificate queried for. + # + # @see #get_peer_cert + def ssl_handshake_completed + end + + # Called by EventMachine when :verify_peer => true has been passed to {#start_tls}. + # It will be called with each certificate in the certificate chain provided by the remote peer. + # + # The cert will be passed as a String in PEM format, the same as in {#get_peer_cert}. It is up to user defined + # code to perform a check on the certificates. The return value from this callback is used to accept or deny the peer. + # A return value that is not nil or false triggers acceptance. If the peer is not accepted, the connection + # will be subsequently closed. + # + # @example This server always accepts all peers + # + # module AcceptServer + # def post_init + # start_tls(:verify_peer => true) + # end + # + # def ssl_verify_peer(cert) + # true + # end + # + # def ssl_handshake_completed + # $server_handshake_completed = true + # end + # end + # + # + # @example This server never accepts any peers + # + # module DenyServer + # def post_init + # start_tls(:verify_peer => true) + # end + # + # def ssl_verify_peer(cert) + # # Do not accept the peer. This should now cause the connection to shut down + # # without the SSL handshake being completed. + # false + # end + # + # def ssl_handshake_completed + # $server_handshake_completed = true + # end + # end + # + # @see #start_tls + def ssl_verify_peer(cert) + end + + # called by the framework whenever a connection (either a server or client connection) is closed. + # The close can occur because your code intentionally closes it (using {#close_connection} and {#close_connection_after_writing}), + # because the remote peer closed the connection, or because of a network error. + # You may not assume that the network connection is still open and able to send or + # receive data when the callback to unbind is made. This is intended only to give + # you a chance to clean up associations your code may have made to the connection + # object while it was open. + # + # If you want to detect which peer has closed the connection, you can override {#close_connection} in your protocol handler + # and set an @ivar. + # + # @example Overriding Connection#close_connection to distinguish connections closed on our side + # + # class MyProtocolHandler < EventMachine::Connection + # + # # ... + # + # def close_connection(*args) + # @intentionally_closed_connection = true + # super(*args) + # end + # + # def unbind + # if @intentionally_closed_connection + # # ... + # end + # end + # + # # ... + # + # end + # + # @see #post_init + # @see #connection_completed + # @see file:docs/GettingStarted.md EventMachine tutorial + def unbind + end + + # Called by the reactor after attempting to relay incoming data to a descriptor (set as a proxy target descriptor with + # {EventMachine.enable_proxy}) that has already been closed. + # + # @see EventMachine.enable_proxy + def proxy_target_unbound + end + + # called when the reactor finished proxying all + # of the requested bytes. + def proxy_completed + end + + # EventMachine::Connection#proxy_incoming_to is called only by user code. It sets up + # a low-level proxy relay for all data inbound for this connection, to the connection given + # as the argument. This is essentially just a helper method for enable_proxy. + # + # @see EventMachine.enable_proxy + def proxy_incoming_to(conn,bufsize=0) + EventMachine::enable_proxy(self, conn, bufsize) + end + + # A helper method for {EventMachine.disable_proxy} + def stop_proxying + EventMachine::disable_proxy(self) + end + + # The number of bytes proxied to another connection. Reset to zero when + # EventMachine::Connection#proxy_incoming_to is called, and incremented whenever data is proxied. + def get_proxied_bytes + EventMachine::get_proxied_bytes(@signature) + end + + # EventMachine::Connection#close_connection is called only by user code, and never + # by the event loop. You may call this method against a connection object in any + # callback handler, whether or not the callback was made against the connection + # you want to close. close_connection schedules the connection to be closed + # at the next available opportunity within the event loop. You may not assume that + # the connection is closed when close_connection returns. In particular, the framework + # will callback the unbind method for the particular connection at a point shortly + # after you call close_connection. You may assume that the unbind callback will + # take place sometime after your call to close_connection completes. In other words, + # the unbind callback will not re-enter your code "inside" of your call to close_connection. + # However, it's not guaranteed that a future version of EventMachine will not change + # this behavior. + # + # {#close_connection} will *silently discard* any outbound data which you have + # sent to the connection using {EventMachine::Connection#send_data} but which has not + # yet been sent across the network. If you want to avoid this behavior, use + # {EventMachine::Connection#close_connection_after_writing}. + # + def close_connection after_writing = false + EventMachine::close_connection @signature, after_writing + end + + # Removes given connection from the event loop. + # The connection's socket remains open and its file descriptor number is returned. + def detach + EventMachine::detach_fd @signature + end + + def get_sock_opt level, option + EventMachine::get_sock_opt @signature, level, option + end + + def set_sock_opt level, optname, optval + EventMachine::set_sock_opt @signature, level, optname, optval + end + + # A variant of {#close_connection}. + # All of the descriptive comments given for close_connection also apply to + # close_connection_after_writing, *with one exception*: if the connection has + # outbound data sent using send_dat but which has not yet been sent across the network, + # close_connection_after_writing will schedule the connection to be closed *after* + # all of the outbound data has been safely written to the remote peer. + # + # Depending on the amount of outgoing data and the speed of the network, + # considerable time may elapse between your call to close_connection_after_writing + # and the actual closing of the socket (at which time the unbind callback will be called + # by the event loop). During this time, you *may not* call send_data to transmit + # additional data (that is, the connection is closed for further writes). In very + # rare cases, you may experience a receive_data callback after your call to {#close_connection_after_writing}, + # depending on whether incoming data was in the process of being received on the connection + # at the moment when you called {#close_connection_after_writing}. Your protocol handler must + # be prepared to properly deal with such data (probably by ignoring it). + # + # @see #close_connection + # @see #send_data + def close_connection_after_writing + close_connection true + end + + # Call this method to send data to the remote end of the network connection. It takes a single String argument, + # which may contain binary data. Data is buffered to be sent at the end of this event loop tick (cycle). + # + # When used in a method that is event handler (for example, {#post_init} or {#connection_completed}, it will send + # data to the other end of the connection that generated the event. + # You can also call {#send_data} to write to other connections. For more information see The Chat Server Example in the + # {file:docs/GettingStarted.md EventMachine tutorial}. + # + # If you want to send some data and then immediately close the connection, make sure to use {#close_connection_after_writing} + # instead of {#close_connection}. + # + # + # @param [String] data Data to send asynchronously + # + # @see file:docs/GettingStarted.md EventMachine tutorial + # @see Connection#receive_data + # @see Connection#post_init + # @see Connection#unbind + def send_data data + data = data.to_s + size = data.bytesize if data.respond_to?(:bytesize) + size ||= data.size + EventMachine::send_data @signature, data, size + end + + # Returns true if the connection is in an error state, false otherwise. + # + # In general, you can detect the occurrence of communication errors or unexpected + # disconnection by the remote peer by handing the {#unbind} method. In some cases, however, + # it's useful to check the status of the connection using {#error?} before attempting to send data. + # This function is synchronous but it will return immediately without blocking. + # + # @return [Boolean] true if the connection is in an error state, false otherwise + def error? + errno = EventMachine::report_connection_error_status(@signature) + case errno + when 0 + false + when -1 + true + else + EventMachine::ERRNOS[errno] + end + end + + # Called by the event loop when a remote TCP connection attempt completes successfully. + # You can expect to get this notification after calls to {EventMachine.connect}. Remember that EventMachine makes remote connections + # asynchronously, just as with any other kind of network event. This method + # is intended primarily to assist with network diagnostics. For normal protocol + # handling, use #post_init to perform initial work on a new connection (such as sending initial set of data). + # {Connection#post_init} will always be called. This method will only be called in case of a successful completion. + # A connection attempt which fails will result a call to {Connection#unbind} after the failure. + # + # @see Connection#post_init + # @see Connection#unbind + # @see file:docs/GettingStarted.md EventMachine tutorial + def connection_completed + end + + # Call {#start_tls} at any point to initiate TLS encryption on connected streams. + # The method is smart enough to know whether it should perform a server-side + # or a client-side handshake. An appropriate place to call {#start_tls} is in + # your redefined {#post_init} method, or in the {#connection_completed} handler for + # an outbound connection. + # + # + # @option args [String] :cert_chain_file (nil) local path of a readable file that contants a chain of X509 certificates in + # the [PEM format](http://en.wikipedia.org/wiki/Privacy_Enhanced_Mail), + # with the most-resolved certificate at the top of the file, successive intermediate + # certs in the middle, and the root (or CA) cert at the bottom. + # + # @option args [String] :private_key_file (nil) local path of a readable file that must contain a private key in the [PEM format](http://en.wikipedia.org/wiki/Privacy_Enhanced_Mail). + # + # @option args [String] :verify_peer (false) indicates whether a server should request a certificate from a peer, to be verified by user code. + # If true, the {#ssl_verify_peer} callback on the {EventMachine::Connection} object is called with each certificate + # in the certificate chain provided by the peer. See documentation on {#ssl_verify_peer} for how to use this. + # + # @example Using TLS with EventMachine + # + # require 'rubygems' + # require 'eventmachine' + # + # module Handler + # def post_init + # start_tls(:private_key_file => '/tmp/server.key', :cert_chain_file => '/tmp/server.crt', :verify_peer => false) + # end + # end + # + # EventMachine.run do + # EventMachine.start_server("127.0.0.1", 9999, Handler) + # end + # + # @param [Hash] args + # + # @todo support passing an encryption parameter, which can be string or Proc, to get a passphrase + # for encrypted private keys. + # @todo support passing key material via raw strings or Procs that return strings instead of + # just filenames. + # + # @see #ssl_verify_peer + def start_tls args={} + priv_key, cert_chain, verify_peer = args.values_at(:private_key_file, :cert_chain_file, :verify_peer) + + [priv_key, cert_chain].each do |file| + next if file.nil? or file.empty? + raise FileNotFoundException, + "Could not find #{file} for start_tls" unless File.exists? file + end + + EventMachine::set_tls_parms(@signature, priv_key || '', cert_chain || '', verify_peer) + EventMachine::start_tls @signature + end + + # If [TLS](http://en.wikipedia.org/wiki/Transport_Layer_Security) is active on the connection, returns the remote [X509 certificate](http://en.wikipedia.org/wiki/X.509) + # as a string, in the popular [PEM format](http://en.wikipedia.org/wiki/Privacy_Enhanced_Mail). This can then be used for arbitrary validation + # of a peer's certificate in your code. + # + # This should be called in/after the {#ssl_handshake_completed} callback, which indicates + # that SSL/TLS is active. Using this callback is important, because the certificate may not + # be available until the time it is executed. Using #post_init or #connection_completed is + # not adequate, because the SSL handshake may still be taking place. + # + # This method will return `nil` if: + # + # * EventMachine is not built with [OpenSSL](http://www.openssl.org) support + # * [TLS](http://en.wikipedia.org/wiki/Transport_Layer_Security) is not active on the connection + # * TLS handshake is not yet complete + # * Remote peer for any other reason has not presented a certificate + # + # + # @example Getting peer TLS certificate information in EventMachine + # + # module Handler + # def post_init + # puts "Starting TLS" + # start_tls + # end + # + # def ssl_handshake_completed + # puts get_peer_cert + # close_connection + # end + # + # def unbind + # EventMachine::stop_event_loop + # end + # end + # + # EventMachine.run do + # EventMachine.connect "mail.google.com", 443, Handler + # end + # + # # Will output: + # # -----BEGIN CERTIFICATE----- + # # MIIDIjCCAougAwIBAgIQbldpChBPqv+BdPg4iwgN8TANBgkqhkiG9w0BAQUFADBM + # # MQswCQYDVQQGEwJaQTElMCMGA1UEChMcVGhhd3RlIENvbnN1bHRpbmcgKFB0eSkg + # # THRkLjEWMBQGA1UEAxMNVGhhd3RlIFNHQyBDQTAeFw0wODA1MDIxNjMyNTRaFw0w + # # OTA1MDIxNjMyNTRaMGkxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlh + # # MRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRMwEQYDVQQKEwpHb29nbGUgSW5jMRgw + # # FgYDVQQDEw9tYWlsLmdvb2dsZS5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJ + # # AoGBALlkxdh2QXegdElukCSOV2+8PKiONIS+8Tu9K7MQsYpqtLNC860zwOPQ2NLI + # # 3Zp4jwuXVTrtzGuiqf5Jioh35Ig3CqDXtLyZoypjZUQcq4mlLzHlhIQ4EhSjDmA7 + # # Ffw9y3ckSOQgdBQWNLbquHh9AbEUjmhkrYxIqKXeCnRKhv6nAgMBAAGjgecwgeQw + # # KAYDVR0lBCEwHwYIKwYBBQUHAwEGCCsGAQUFBwMCBglghkgBhvhCBAEwNgYDVR0f + # # BC8wLTAroCmgJ4YlaHR0cDovL2NybC50aGF3dGUuY29tL1RoYXd0ZVNHQ0NBLmNy + # # bDByBggrBgEFBQcBAQRmMGQwIgYIKwYBBQUHMAGGFmh0dHA6Ly9vY3NwLnRoYXd0 + # # ZS5jb20wPgYIKwYBBQUHMAKGMmh0dHA6Ly93d3cudGhhd3RlLmNvbS9yZXBvc2l0 + # # b3J5L1RoYXd0ZV9TR0NfQ0EuY3J0MAwGA1UdEwEB/wQCMAAwDQYJKoZIhvcNAQEF + # # BQADgYEAsRwpLg1dgCR1gYDK185MFGukXMeQFUvhGqF8eT/CjpdvezyKVuz84gSu + # # 6ccMXgcPQZGQN/F4Xug+Q01eccJjRSVfdvR5qwpqCj+6BFl5oiKDBsveSkrmL5dz + # # s2bn7TdTSYKcLeBkjXxDLHGBqLJ6TNCJ3c4/cbbG5JhGvoema94= + # # -----END CERTIFICATE----- + # + # You can do whatever you want with the certificate String, such as load it + # as a certificate object using the OpenSSL library, and check its fields. + # + # @return [String] the remote [X509 certificate](http://en.wikipedia.org/wiki/X.509), in the popular [PEM format](http://en.wikipedia.org/wiki/Privacy_Enhanced_Mail), + # if TLS is active on the connection + # + # @see Connection#start_tls + # @see Connection#ssl_handshake_completed + def get_peer_cert + EventMachine::get_peer_cert @signature + end + + + # Sends UDP messages. + # + # This method may be called from any Connection object that refers + # to an open datagram socket (see EventMachine#open_datagram_socket). + # The method sends a UDP (datagram) packet containing the data you specify, + # to a remote peer specified by the IP address and port that you give + # as parameters to the method. + # Observe that you may send a zero-length packet (empty string). + # However, you may not send an arbitrarily-large data packet because + # your operating system will enforce a platform-specific limit on + # the size of the outbound packet. (Your kernel + # will respond in a platform-specific way if you send an overlarge + # packet: some will send a truncated packet, some will complain, and + # some will silently drop your request). + # On LANs, it's usually OK to send datagrams up to about 4000 bytes in length, + # but to be really safe, send messages smaller than the Ethernet-packet + # size (typically about 1400 bytes). Some very restrictive WANs + # will either drop or truncate packets larger than about 500 bytes. + # + # @param [String] data Data to send asynchronously + # @param [String] recipient_address IP address of the recipient + # @param [String] recipient_port Port of the recipient + def send_datagram data, recipient_address, recipient_port + data = data.to_s + size = data.bytesize if data.respond_to?(:bytesize) + size ||= data.size + EventMachine::send_datagram @signature, data, size, recipient_address, Integer(recipient_port) + end + + + # This method is used with stream-connections to obtain the identity + # of the remotely-connected peer. If a peername is available, this method + # returns a sockaddr structure. The method returns nil if no peername is available. + # You can use Socket.unpack_sockaddr_in and its variants to obtain the + # values contained in the peername structure returned from #get_peername. + # + # @example How to get peer IP address and port with EventMachine + # + # require 'socket' + # + # module Handler + # def receive_data data + # port, ip = Socket.unpack_sockaddr_in(get_peername) + # puts "got #{data.inspect} from #{ip}:#{port}" + # end + # end + def get_peername + EventMachine::get_peername @signature + end + + # Used with stream-connections to obtain the identity + # of the local side of the connection. If a local name is available, this method + # returns a sockaddr structure. The method returns nil if no local name is available. + # You can use {Socket.unpack_sockaddr_in} and its variants to obtain the + # values contained in the local-name structure returned from this method. + # + # @example + # + # require 'socket' + # + # module Handler + # def receive_data data + # port, ip = Socket.unpack_sockaddr_in(get_sockname) + # puts "got #{data.inspect}" + # end + # end + def get_sockname + EventMachine::get_sockname @signature + end + + # Returns the PID (kernel process identifier) of a subprocess + # associated with this Connection object. For use with {EventMachine.popen} + # and similar methods. Returns nil when there is no meaningful subprocess. + # + # @return [Integer] + def get_pid + EventMachine::get_subprocess_pid @signature + end + + # Returns a subprocess exit status. Only useful for {EventMachine.popen}. Call it in your + # {#unbind} handler. + # + # @return [Integer] + def get_status + EventMachine::get_subprocess_status @signature + end + + # The number of seconds since the last send/receive activity on this connection. + def get_idle_time + EventMachine::get_idle_time @signature + end + + # comm_inactivity_timeout returns the current value (float in seconds) of the inactivity-timeout + # property of network-connection and datagram-socket objects. A nonzero value + # indicates that the connection or socket will automatically be closed if no read or write + # activity takes place for at least that number of seconds. + # A zero value (the default) specifies that no automatic timeout will take place. + def comm_inactivity_timeout + EventMachine::get_comm_inactivity_timeout @signature + end + + # Allows you to set the inactivity-timeout property for + # a network connection or datagram socket. Specify a non-negative float value in seconds. + # If the value is greater than zero, the connection or socket will automatically be closed + # if no read or write activity takes place for at least that number of seconds. + # Specify a value of zero to indicate that no automatic timeout should take place. + # Zero is the default value. + def comm_inactivity_timeout= value + EventMachine::set_comm_inactivity_timeout @signature, value.to_f + end + alias set_comm_inactivity_timeout comm_inactivity_timeout= + + # The duration after which a TCP connection in the connecting state will fail. + # It is important to distinguish this value from {EventMachine::Connection#comm_inactivity_timeout}, + # which looks at how long since data was passed on an already established connection. + # The value is a float in seconds. + # + # @return [Float] The duration after which a TCP connection in the connecting state will fail, in seconds. + def pending_connect_timeout + EventMachine::get_pending_connect_timeout @signature + end + + # Sets the duration after which a TCP connection in a + # connecting state will fail. + # + # @param [Float, #to_f] value Connection timeout in seconds + def pending_connect_timeout= value + EventMachine::set_pending_connect_timeout @signature, value.to_f + end + alias set_pending_connect_timeout pending_connect_timeout= + + # Reconnect to a given host/port with the current instance + # + # @param [String] server Hostname or IP address + # @param [Integer] port Port to reconnect to + def reconnect server, port + EventMachine::reconnect server, port, self + end + + + # Like {EventMachine::Connection#send_data}, this sends data to the remote end of + # the network connection. {EventMachine::Connection#send_file_data} takes a + # filename as an argument, though, and sends the contents of the file, in one + # chunk. + # + # @param [String] filename Local path of the file to send + # + # @see #send_data + # @author Kirk Haines + def send_file_data filename + EventMachine::send_file_data @signature, filename + end + + # Open a file on the filesystem and send it to the remote peer. This returns an + # object of type {EventMachine::Deferrable}. The object's callbacks will be executed + # on the reactor main thread when the file has been completely scheduled for + # transmission to the remote peer. Its errbacks will be called in case of an error (such as file-not-found). + # This method employs various strategies to achieve the fastest possible performance, + # balanced against minimum consumption of memory. + # + # Warning: this feature has an implicit dependency on an outboard extension, + # evma_fastfilereader. You must install this extension in order to use {#stream_file_data} + # with files larger than a certain size (currently 8192 bytes). + # + # @option args [Boolean] :http_chunks (false) If true, this method will stream the file data in a format + # compatible with the HTTP chunked-transfer encoding + # + # @param [String] filename Local path of the file to stream + # @param [Hash] args Options + # + # @return [EventMachine::Deferrable] + def stream_file_data filename, args={} + EventMachine::FileStreamer.new( self, filename, args ) + end + + # Watches connection for readability. Only possible if the connection was created + # using {EventMachine.attach} and had {EventMachine.notify_readable}/{EventMachine.notify_writable} defined on the handler. + # + # @see #notify_readable? + def notify_readable= mode + EventMachine::set_notify_readable @signature, mode + end + + # @return [Boolean] true if the connection is being watched for readability. + def notify_readable? + EventMachine::is_notify_readable @signature + end + + # Watches connection for writeability. Only possible if the connection was created + # using {EventMachine.attach} and had {EventMachine.notify_readable}/{EventMachine.notify_writable} defined on the handler. + # + # @see #notify_writable? + def notify_writable= mode + EventMachine::set_notify_writable @signature, mode + end + + # Returns true if the connection is being watched for writability. + def notify_writable? + EventMachine::is_notify_writable @signature + end + + # Pause a connection so that {#send_data} and {#receive_data} events are not fired until {#resume} is called. + # @see #resume + def pause + EventMachine::pause_connection @signature + end + + # Resume a connection's {#send_data} and {#receive_data} events. + # @see #pause + def resume + EventMachine::resume_connection @signature + end + + # @return [Boolean] true if the connect was paused using {EventMachine::Connection#pause}. + # @see #pause + # @see #resume + def paused? + EventMachine::connection_paused? @signature + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/deferrable.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/deferrable.rb new file mode 100644 index 000000000..18a6d316b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/deferrable.rb @@ -0,0 +1,210 @@ +#-- +# +# Author:: Francis Cianfrocca (gmail: blackhedd) +# Homepage:: http://rubyeventmachine.com +# Date:: 16 Jul 2006 +# +# See EventMachine and EventMachine::Connection for documentation and +# usage examples. +# +#---------------------------------------------------------------------------- +# +# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +# Gmail: blackhedd +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of either: 1) the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version; or 2) Ruby's License. +# +# See the file COPYING for complete licensing information. +# +#--------------------------------------------------------------------------- +# +# + +module EventMachine + module Deferrable + autoload :Pool, 'em/deferrable/pool' + + # Specify a block to be executed if and when the Deferrable object receives + # a status of :succeeded. See #set_deferred_status for more information. + # + # Calling this method on a Deferrable object whose status is not yet known + # will cause the callback block to be stored on an internal list. + # If you call this method on a Deferrable whose status is :succeeded, the + # block will be executed immediately, receiving the parameters given to the + # prior #set_deferred_status call. + # + #-- + # If there is no status, add a callback to an internal list. + # If status is succeeded, execute the callback immediately. + # If status is failed, do nothing. + # + def callback &block + return unless block + @deferred_status ||= :unknown + if @deferred_status == :succeeded + block.call(*@deferred_args) + elsif @deferred_status != :failed + @callbacks ||= [] + @callbacks.unshift block # << block + end + self + end + + # Cancels an outstanding callback to &block if any. Undoes the action of #callback. + # + def cancel_callback block + @callbacks ||= [] + @callbacks.delete block + end + + # Specify a block to be executed if and when the Deferrable object receives + # a status of :failed. See #set_deferred_status for more information. + #-- + # If there is no status, add an errback to an internal list. + # If status is failed, execute the errback immediately. + # If status is succeeded, do nothing. + # + def errback &block + return unless block + @deferred_status ||= :unknown + if @deferred_status == :failed + block.call(*@deferred_args) + elsif @deferred_status != :succeeded + @errbacks ||= [] + @errbacks.unshift block # << block + end + self + end + + # Cancels an outstanding errback to &block if any. Undoes the action of #errback. + # + def cancel_errback block + @errbacks ||= [] + @errbacks.delete block + end + + # Sets the "disposition" (status) of the Deferrable object. See also the large set of + # sugarings for this method. + # Note that if you call this method without arguments, + # no arguments will be passed to the callback/errback. + # If the user has coded these with arguments, then the + # user code will throw an argument exception. + # Implementors of deferrable classes must + # document the arguments they will supply to user callbacks. + # + # OBSERVE SOMETHING VERY SPECIAL here: you may call this method even + # on the INSIDE of a callback. This is very useful when a previously-registered + # callback wants to change the parameters that will be passed to subsequently-registered + # ones. + # + # You may give either :succeeded or :failed as the status argument. + # + # If you pass :succeeded, then all of the blocks passed to the object using the #callback + # method (if any) will be executed BEFORE the #set_deferred_status method returns. All of the blocks + # passed to the object using #errback will be discarded. + # + # If you pass :failed, then all of the blocks passed to the object using the #errback + # method (if any) will be executed BEFORE the #set_deferred_status method returns. All of the blocks + # passed to the object using # callback will be discarded. + # + # If you pass any arguments to #set_deferred_status in addition to the status argument, + # they will be passed as arguments to any callbacks or errbacks that are executed. + # It's your responsibility to ensure that the argument lists specified in your callbacks and + # errbacks match the arguments given in calls to #set_deferred_status, otherwise Ruby will raise + # an ArgumentError. + # + #-- + # We're shifting callbacks off and discarding them as we execute them. + # This is valid because by definition callbacks are executed no more than + # once. It also has the magic effect of permitting recursive calls, which + # means that a callback can call #set_deferred_status and change the parameters + # that will be sent to subsequent callbacks down the chain. + # + # Changed @callbacks and @errbacks from push/shift to unshift/pop, per suggestion + # by Kirk Haines, to work around the memory leak bug that still exists in many Ruby + # versions. + # + # Changed 15Sep07: after processing callbacks or errbacks, CLEAR the other set of + # handlers. This gets us a little closer to the behavior of Twisted's "deferred," + # which only allows status to be set once. Prior to making this change, it was possible + # to "succeed" a Deferrable (triggering its callbacks), and then immediately "fail" it, + # triggering its errbacks! That is clearly undesirable, but it's just as undesirable + # to raise an exception is status is set more than once on a Deferrable. The latter + # behavior would invalidate the idiom of resetting arguments by setting status from + # within a callback or errback, but more seriously it would cause spurious errors + # if a Deferrable was timed out and then an attempt was made to succeed it. See the + # comments under the new method #timeout. + # + def set_deferred_status status, *args + cancel_timeout + @errbacks ||= nil + @callbacks ||= nil + @deferred_status = status + @deferred_args = args + case @deferred_status + when :succeeded + if @callbacks + while cb = @callbacks.pop + cb.call(*@deferred_args) + end + end + @errbacks.clear if @errbacks + when :failed + if @errbacks + while eb = @errbacks.pop + eb.call(*@deferred_args) + end + end + @callbacks.clear if @callbacks + end + end + + + # Setting a timeout on a Deferrable causes it to go into the failed state after + # the Timeout expires (passing no arguments to the object's errbacks). + # Setting the status at any time prior to a call to the expiration of the timeout + # will cause the timer to be cancelled. + def timeout seconds, *args + cancel_timeout + me = self + @deferred_timeout = EventMachine::Timer.new(seconds) {me.fail(*args)} + self + end + + # Cancels an outstanding timeout if any. Undoes the action of #timeout. + # + def cancel_timeout + @deferred_timeout ||= nil + if @deferred_timeout + @deferred_timeout.cancel + @deferred_timeout = nil + end + end + + + # Sugar for set_deferred_status(:succeeded, ...) + # + def succeed *args + set_deferred_status :succeeded, *args + end + alias set_deferred_success succeed + + # Sugar for set_deferred_status(:failed, ...) + # + def fail *args + set_deferred_status :failed, *args + end + alias set_deferred_failure fail + end + + + # DefaultDeferrable is an otherwise empty class that includes Deferrable. + # This is very useful when you just need to return a Deferrable object + # as a way of communicating deferred status to some other part of a program. + class DefaultDeferrable + include Deferrable + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/deferrable/pool.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/deferrable/pool.rb new file mode 100644 index 000000000..3c278eeb9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/deferrable/pool.rb @@ -0,0 +1,2 @@ +warn "EM::Deferrable::Pool is deprecated, please use EM::Pool" +EM::Deferrable::Pool = EM::Pool \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/file_watch.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/file_watch.rb new file mode 100644 index 000000000..074ffedc0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/file_watch.rb @@ -0,0 +1,73 @@ +module EventMachine + # Utility class that is useful for file monitoring. Supported events are + # + # * File is modified + # * File is deleted + # * File is moved + # + # @note On Mac OS X, file watching only works when kqueue is enabled + # + # @see EventMachine.watch_file + class FileWatch < Connection + # @private + Cmodified = 'modified'.freeze + # @private + Cdeleted = 'deleted'.freeze + # @private + Cmoved = 'moved'.freeze + + + # @private + def receive_data(data) + case data + when Cmodified + file_modified + when Cdeleted + file_deleted + when Cmoved + file_moved + end + end + + # Returns the path that is being monitored. + # + # @note Current implementation does not pick up on the new filename after a rename occurs. + # + # @return [String] + # @see EventMachine.watch_file + def path + @path + end + + # Will be called when the file is modified. Supposed to be redefined by subclasses. + # + # @abstract + def file_modified + end + + # Will be called when the file is deleted. Supposed to be redefined by subclasses. + # When the file is deleted, stop_watching will be called after this to make sure everything is + # cleaned up correctly. + # + # @note On Linux (with {http://en.wikipedia.org/wiki/Inotify inotify}), this method will not be called until *all* open file descriptors to + # the file have been closed. + # + # @abstract + def file_deleted + end + + # Will be called when the file is moved or renamed. Supposed to be redefined by subclasses. + # + # @abstract + def file_moved + end + + # Discontinue monitoring of the file. + # + # This involves cleaning up the underlying monitoring details with kqueue/inotify, and in turn firing {EventMachine::Connection#unbind}. + # This will be called automatically when a file is deleted. User code may call it as well. + def stop_watching + EventMachine::unwatch_filename(@signature) + end # stop_watching + end # FileWatch +end # EventMachine diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/future.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/future.rb new file mode 100644 index 000000000..4affbf518 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/future.rb @@ -0,0 +1,61 @@ +#-- +# +# Author:: Francis Cianfrocca (gmail: blackhedd) +# Homepage:: http://rubyeventmachine.com +# Date:: 16 Jul 2006 +# +# See EventMachine and EventMachine::Connection for documentation and +# usage examples. +# +#---------------------------------------------------------------------------- +# +# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +# Gmail: blackhedd +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of either: 1) the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version; or 2) Ruby's License. +# +# See the file COPYING for complete licensing information. +# +#--------------------------------------------------------------------------- +# +# + +#-- +# This defines EventMachine::Deferrable#future, which requires +# that the rest of EventMachine::Deferrable has already been seen. +# (It's in deferrable.rb.) + +module EventMachine + module Deferrable + + # A future is a sugaring of a typical deferrable usage. + #-- + # Evaluate arg (which may be an expression or a block). + # What's the class of arg? + # If arg is an ordinary expression, then return it. + # If arg is deferrable (responds to :set_deferred_status), + # then look at the arguments. If either callback or errback + # are defined, then use them. If neither are defined, then + # use the supplied block (if any) as the callback. + # Then return arg. + def self.future arg, cb=nil, eb=nil, &blk + arg = arg.call if arg.respond_to?(:call) + + if arg.respond_to?(:set_deferred_status) + if cb || eb + arg.callback(&cb) if cb + arg.errback(&eb) if eb + else + arg.callback(&blk) if blk + end + end + + arg + end + + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/iterator.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/iterator.rb new file mode 100644 index 000000000..3bebf2c72 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/iterator.rb @@ -0,0 +1,270 @@ +module EventMachine + # A simple iterator for concurrent asynchronous work. + # + # Unlike ruby's built-in iterators, the end of the current iteration cycle is signaled manually, + # instead of happening automatically after the yielded block finishes executing. For example: + # + # (0..10).each{ |num| } + # + # becomes: + # + # EM::Iterator.new(0..10).each{ |num,iter| iter.next } + # + # This is especially useful when doing asynchronous work via reactor libraries and + # functions. For example, given a sync and async http api: + # + # response = sync_http_get(url); ... + # async_http_get(url){ |response| ... } + # + # a synchronous iterator such as: + # + # responses = urls.map{ |url| sync_http_get(url) } + # ... + # puts 'all done!' + # + # could be written as: + # + # EM::Iterator.new(urls).map(proc{ |url,iter| + # async_http_get(url){ |res| + # iter.return(res) + # } + # }, proc{ |responses| + # ... + # puts 'all done!' + # }) + # + # Now, you can take advantage of the asynchronous api to issue requests in parallel. For example, + # to fetch 10 urls at a time, simply pass in a concurrency of 10: + # + # EM::Iterator.new(urls, 10).each do |url,iter| + # async_http_get(url){ iter.next } + # end + # + class Iterator + # Create a new parallel async iterator with specified concurrency. + # + # i = EM::Iterator.new(1..100, 10) + # + # will create an iterator over the range that processes 10 items at a time. Iteration + # is started via #each, #map or #inject + # + def initialize(list, concurrency = 1) + raise ArgumentError, 'argument must be an array' unless list.respond_to?(:to_a) + @list = list.to_a.dup + @concurrency = concurrency + + @started = false + @ended = false + end + + # Change the concurrency of this iterator. Workers will automatically be spawned or destroyed + # to accomodate the new concurrency level. + # + def concurrency=(val) + old = @concurrency + @concurrency = val + + spawn_workers if val > old and @started and !@ended + end + attr_reader :concurrency + + # Iterate over a set of items using the specified block or proc. + # + # EM::Iterator.new(1..100).each do |num, iter| + # puts num + # iter.next + # end + # + # An optional second proc is invoked after the iteration is complete. + # + # EM::Iterator.new(1..100).each( + # proc{ |num,iter| iter.next }, + # proc{ puts 'all done' } + # ) + # + def each(foreach=nil, after=nil, &blk) + raise ArgumentError, 'proc or block required for iteration' unless foreach ||= blk + raise RuntimeError, 'cannot iterate over an iterator more than once' if @started or @ended + + @started = true + @pending = 0 + @workers = 0 + + all_done = proc{ + after.call if after and @ended and @pending == 0 + } + + @process_next = proc{ + # p [:process_next, :pending=, @pending, :workers=, @workers, :ended=, @ended, :concurrency=, @concurrency, :list=, @list] + unless @ended or @workers > @concurrency + if @list.empty? + @ended = true + @workers -= 1 + all_done.call + else + item = @list.shift + @pending += 1 + + is_done = false + on_done = proc{ + raise RuntimeError, 'already completed this iteration' if is_done + is_done = true + + @pending -= 1 + + if @ended + all_done.call + else + EM.next_tick(@process_next) + end + } + class << on_done + alias :next :call + end + + foreach.call(item, on_done) + end + else + @workers -= 1 + end + } + + spawn_workers + + self + end + + # Collect the results of an asynchronous iteration into an array. + # + # EM::Iterator.new(%w[ pwd uptime uname date ], 2).map(proc{ |cmd,iter| + # EM.system(cmd){ |output,status| + # iter.return(output) + # } + # }, proc{ |results| + # p results + # }) + # + def map(foreach, after) + index = 0 + + inject([], proc{ |results,item,iter| + i = index + index += 1 + + is_done = false + on_done = proc{ |res| + raise RuntimeError, 'already returned a value for this iteration' if is_done + is_done = true + + results[i] = res + iter.return(results) + } + class << on_done + alias :return :call + def next + raise NoMethodError, 'must call #return on a map iterator' + end + end + + foreach.call(item, on_done) + }, proc{ |results| + after.call(results) + }) + end + + # Inject the results of an asynchronous iteration onto a given object. + # + # EM::Iterator.new(%w[ pwd uptime uname date ], 2).inject({}, proc{ |hash,cmd,iter| + # EM.system(cmd){ |output,status| + # hash[cmd] = status.exitstatus == 0 ? output.strip : nil + # iter.return(hash) + # } + # }, proc{ |results| + # p results + # }) + # + def inject(obj, foreach, after) + each(proc{ |item,iter| + is_done = false + on_done = proc{ |res| + raise RuntimeError, 'already returned a value for this iteration' if is_done + is_done = true + + obj = res + iter.next + } + class << on_done + alias :return :call + def next + raise NoMethodError, 'must call #return on an inject iterator' + end + end + + foreach.call(obj, item, on_done) + }, proc{ + after.call(obj) + }) + end + + private + + # Spawn workers to consume items from the iterator's enumerator based on the current concurrency level. + # + def spawn_workers + EM.next_tick(start_worker = proc{ + if @workers < @concurrency and !@ended + # p [:spawning_worker, :workers=, @workers, :concurrency=, @concurrency, :ended=, @ended] + @workers += 1 + @process_next.call + EM.next_tick(start_worker) + end + }) + nil + end + end +end + +if __FILE__ == $0 + $:.unshift File.join(File.dirname(__FILE__), '..') + require 'eventmachine' + + # TODO: real tests + # TODO: pass in one object instead of two? .each{ |iter| puts iter.current; iter.next } + # TODO: support iter.pause/resume/stop/break/continue? + # TODO: create some exceptions instead of using RuntimeError + # TODO: support proc instead of enumerable? EM::Iterator.new(proc{ return queue.pop }) + + EM.run{ + EM::Iterator.new(1..50).each{ |num,iter| p num; iter.next } + EM::Iterator.new([1,2,3], 10).each{ |num,iter| p num; iter.next } + + i = EM::Iterator.new(1..100, 5) + i.each(proc{|num,iter| + p num.to_s + iter.next + }, proc{ + p :done + }) + EM.add_timer(0.03){ + i.concurrency = 1 + } + EM.add_timer(0.04){ + i.concurrency = 3 + } + + EM::Iterator.new(100..150).map(proc{ |num,iter| + EM.add_timer(0.01){ iter.return(num) } + }, proc{ |results| + p results + }) + + EM::Iterator.new(%w[ pwd uptime uname date ], 2).inject({}, proc{ |hash,cmd,iter| + EM.system(cmd){ |output,status| + hash[cmd] = status.exitstatus == 0 ? output.strip : nil + iter.return(hash) + } + }, proc{ |results| + p results + }) + } +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/messages.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/messages.rb new file mode 100644 index 000000000..9a51c390f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/messages.rb @@ -0,0 +1,66 @@ +#-- +# +# Author:: Francis Cianfrocca (gmail: blackhedd) +# Homepage:: http://rubyeventmachine.com +# Date:: 16 Jul 2006 +# +# See EventMachine and EventMachine::Connection for documentation and +# usage examples. +# +#---------------------------------------------------------------------------- +# +# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +# Gmail: blackhedd +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of either: 1) the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version; or 2) Ruby's License. +# +# See the file COPYING for complete licensing information. +# +#--------------------------------------------------------------------------- +# +# + +=begin + +Message Routing in EventMachine. + +The goal here is to enable "routing points," objects that can send and receive +"messages," which are delimited streams of bytes. The boundaries of a message +are preserved as it passes through the reactor system. + +There will be several module methods defined in EventMachine to create route-point +objects (which will probably have a base class of EventMachine::MessageRouter +until someone suggests a better name). + +As with I/O objects, routing objects will receive events by having the router +core call methods on them. And of course user code can and will define handlers +to deal with events of interest. + +The message router base class only really needs a receive_message method. There will +be an EM module-method to send messages, in addition to the module methods to create +the various kinds of message receivers. + +The simplest kind of message receiver object can receive messages by being named +explicitly in a parameter to EM#send_message. More sophisticated receivers can define +pub-sub selectors and message-queue names. And they can also define channels for +route-points in other processes or even on other machines. + +A message is NOT a marshallable entity. Rather, it's a chunk of flat content more like +an Erlang message. Initially, all content submitted for transmission as a message will +have the to_s method called on it. Eventually, we'll be able to transmit certain structured +data types (XML and YAML documents, Structs within limits) and have them reconstructed +on the other end. + +A fundamental goal of the message-routing capability is to interoperate seamlessly with +external systems, including non-Ruby systems like ActiveMQ. We will define various protocol +handlers for things like Stomp and possibly AMQP, but these will be wrapped up and hidden +from the users of the basic routing capability. + +As with Erlang, a critical goal is for programs that are built to use message-passing to work +WITHOUT CHANGE when the code is re-based on a multi-process system. + +=end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/pool.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/pool.rb new file mode 100644 index 000000000..3c7fdde09 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/pool.rb @@ -0,0 +1,151 @@ +module EventMachine + # = EventMachine::Pool + # + # A simple async resource pool based on a resource and work queue. Resources + # are enqueued and work waits for resources to become available. + # + # Example: + # + # EM.run do + # pool = EM::Pool.new + # spawn = lambda { pool.add EM::HttpRequest.new('http://example.org') } + # 10.times { spawn[] } + # done, scheduled = 0, 0 + # + # check = lambda do + # done += 1 + # if done >= scheduled + # EM.stop + # end + # end + # + # pool.on_error { |conn| spawn[] } + # + # 100.times do + # pool.perform do |conn| + # req = conn.get :path => '/', :keepalive => true + # + # req.callback do + # p [:success, conn.object_id, i, req.response.size] + # check[] + # end + # + # req.errback { check[] } + # + # req + # end + # end + # end + # + # Resources are expected to be controlled by an object responding to a + # deferrable/completion style API with callback and errback blocks. + # + class Pool + + def initialize + @resources = EM::Queue.new + @removed = [] + @contents = [] + @on_error = nil + end + + def add resource + @contents << resource + requeue resource + end + + def remove resource + @contents.delete resource + @removed << resource + end + + # Returns a list for introspection purposes only. You should *NEVER* call + # modification or work oriented methods on objects in this list. A good + # example use case is periodic statistics collection against a set of + # connection resources. + # + # For example: + # pool.contents.inject(0) { |sum, connection| connection.num_bytes } + def contents + @contents.dup + end + + # Define a default catch-all for when the deferrables returned by work + # blocks enter a failed state. By default all that happens is that the + # resource is returned to the pool. If on_error is defined, this block is + # responsible for re-adding the resource to the pool if it is still usable. + # In other words, it is generally assumed that on_error blocks explicitly + # handle the rest of the lifetime of the resource. + def on_error *a, &b + @on_error = EM::Callback(*a, &b) + end + + # Perform a given #call-able object or block. The callable object will be + # called with a resource from the pool as soon as one is available, and is + # expected to return a deferrable. + # + # The deferrable will have callback and errback added such that when the + # deferrable enters a finished state, the object is returned to the pool. + # + # If on_error is defined, then objects are not automatically returned to the + # pool. + def perform(*a, &b) + work = EM::Callback(*a, &b) + + @resources.pop do |resource| + if removed? resource + @removed.delete resource + reschedule work + else + process work, resource + end + end + end + alias reschedule perform + + # A peek at the number of enqueued jobs waiting for resources + def num_waiting + @resources.num_waiting + end + + # Removed will show resources in a partial pruned state. Resources in the + # removed list may not appear in the contents list if they are currently in + # use. + def removed? resource + @removed.include? resource + end + + protected + def requeue resource + @resources.push resource + end + + def failure resource + if @on_error + @contents.delete resource + @on_error.call resource + # Prevent users from calling a leak. + @removed.delete resource + else + requeue resource + end + end + + def completion deferrable, resource + deferrable.callback { requeue resource } + deferrable.errback { failure resource } + end + + def process work, resource + deferrable = work.call resource + if deferrable.kind_of?(EM::Deferrable) + completion deferrable, resource + else + raise ArgumentError, "deferrable expected from work" + end + rescue Exception + failure resource + raise + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/process_watch.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/process_watch.rb new file mode 100644 index 000000000..66e894383 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/process_watch.rb @@ -0,0 +1,45 @@ +module EventMachine + + # This is subclassed from EventMachine::Connection for use with the process monitoring API. Read the + # documentation on the instance methods of this class, and for a full explanation see EventMachine.watch_process. + class ProcessWatch < Connection + # @private + Cfork = 'fork'.freeze + # @private + Cexit = 'exit'.freeze + + # @private + def receive_data(data) + case data + when Cfork + process_forked + when Cexit + process_exited + end + end + + # Returns the pid that EventMachine::watch_process was originally called with. + def pid + @pid + end + + # Should be redefined with the user's custom callback that will be fired when the prcess is forked. + # + # There is currently not an easy way to get the pid of the forked child. + def process_forked + end + + # Should be redefined with the user's custom callback that will be fired when the process exits. + # + # stop_watching is called automatically after this callback + def process_exited + end + + # Discontinue monitoring of the process. + # This will be called automatically when a process dies. User code may call it as well. + def stop_watching + EventMachine::unwatch_pid(@signature) + end + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/processes.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/processes.rb new file mode 100644 index 000000000..7afeb27ec --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/processes.rb @@ -0,0 +1,123 @@ +#-- +# +# Author:: Francis Cianfrocca (gmail: blackhedd) +# Homepage:: http://rubyeventmachine.com +# Date:: 13 Dec 07 +# +# See EventMachine and EventMachine::Connection for documentation and +# usage examples. +# +#---------------------------------------------------------------------------- +# +# Copyright (C) 2006-08 by Francis Cianfrocca. All Rights Reserved. +# Gmail: blackhedd +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of either: 1) the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version; or 2) Ruby's License. +# +# See the file COPYING for complete licensing information. +# +#--------------------------------------------------------------------------- +# +# + + +module EventMachine + + # EM::DeferrableChildProcess is a sugaring of a common use-case + # involving EM::popen. + # Call the #open method on EM::DeferrableChildProcess, passing + # a command-string. #open immediately returns an EM::Deferrable + # object. It also schedules the forking of a child process, which + # will execute the command passed to #open. + # When the forked child terminates, the Deferrable will be signalled + # and execute its callbacks, passing the data that the child process + # wrote to stdout. + # + class DeferrableChildProcess < EventMachine::Connection + include EventMachine::Deferrable + + # @private + def initialize + super + @data = [] + end + + # Sugars a common use-case involving forked child processes. + # #open takes a String argument containing an shell command + # string (including arguments if desired). #open immediately + # returns an EventMachine::Deferrable object, without blocking. + # + # It also invokes EventMachine#popen to run the passed-in + # command in a forked child process. + # + # When the forked child terminates, the Deferrable that + # #open calls its callbacks, passing the data returned + # from the child process. + # + def self.open cmd + EventMachine.popen( cmd, DeferrableChildProcess ) + end + + # @private + def receive_data data + @data << data + end + + # @private + def unbind + succeed( @data.join ) + end + end + + # @private + class SystemCmd < EventMachine::Connection + def initialize cb + @cb = cb + @output = [] + end + def receive_data data + @output << data + end + def unbind + @cb.call @output.join(''), get_status if @cb + end + end + + # EM::system is a simple wrapper for EM::popen. It is similar to Kernel::system, but requires a + # single string argument for the command and performs no shell expansion. + # + # The block or proc passed to EM::system is called with two arguments: the output generated by the command, + # and a Process::Status that contains information about the command's execution. + # + # EM.run{ + # EM.system('ls'){ |output,status| puts output if status.exitstatus == 0 } + # } + # + # You can also supply an additional proc to send some data to the process: + # + # EM.run{ + # EM.system('sh', proc{ |process| + # process.send_data("echo hello\n") + # process.send_data("exit\n") + # }, proc{ |out,status| + # puts(out) + # }) + # } + # + # Like EventMachine.popen, EventMachine.system currently does not work on windows. + # It returns the pid of the spawned process. + def EventMachine::system cmd, *args, &cb + cb ||= args.pop if args.last.is_a? Proc + init = args.pop if args.last.is_a? Proc + + # merge remaining arguments into the command + cmd = ([cmd] + args.map{|a|a.to_s.dump}).join(' ') + + EM.get_subprocess_pid(EM.popen(cmd, SystemCmd, cb) do |c| + init[c] if init + end.signature) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols.rb new file mode 100644 index 000000000..acaf23236 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols.rb @@ -0,0 +1,36 @@ +module EventMachine + # This module contains various protocol implementations, including: + # - HttpClient and HttpClient2 + # - Stomp + # - Memcache + # - SmtpClient and SmtpServer + # - SASLauth and SASLauthclient + # - LineProtocol, LineAndTextProtocol and LineText2 + # - HeaderAndContentProtocol + # - Postgres3 + # - ObjectProtocol + # + # The protocol implementations live in separate files in the protocols/ subdirectory, + # but are auto-loaded when they are first referenced in your application. + # + # EventMachine::Protocols is also aliased to EM::P for easier usage. + # + module Protocols + # TODO : various autotools are completely useless with the lack of naming + # convention, we need to correct that! + autoload :TcpConnectTester, 'em/protocols/tcptest' + autoload :HttpClient, 'em/protocols/httpclient' + autoload :HttpClient2, 'em/protocols/httpclient2' + autoload :LineAndTextProtocol, 'em/protocols/line_and_text' + autoload :HeaderAndContentProtocol, 'em/protocols/header_and_content' + autoload :LineText2, 'em/protocols/linetext2' + autoload :Stomp, 'em/protocols/stomp' + autoload :SmtpClient, 'em/protocols/smtpclient' + autoload :SmtpServer, 'em/protocols/smtpserver' + autoload :SASLauth, 'em/protocols/saslauth' + autoload :Memcache, 'em/protocols/memcache' + autoload :Postgres3, 'em/protocols/postgres3' + autoload :ObjectProtocol, 'em/protocols/object_protocol' + autoload :Socks4, 'em/protocols/socks4' + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/header_and_content.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/header_and_content.rb new file mode 100644 index 000000000..b5a465aaf --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/header_and_content.rb @@ -0,0 +1,138 @@ +#-- +# +# Author:: Francis Cianfrocca (gmail: blackhedd) +# Homepage:: http://rubyeventmachine.com +# Date:: 15 Nov 2006 +# +# See EventMachine and EventMachine::Connection for documentation and +# usage examples. +# +#---------------------------------------------------------------------------- +# +# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +# Gmail: blackhedd +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of either: 1) the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version; or 2) Ruby's License. +# +# See the file COPYING for complete licensing information. +# +#--------------------------------------------------------------------------- +# +# + +module EventMachine + module Protocols + + # === Usage + # + # class RequestHandler < EM::P::HeaderAndContentProtocol + # def receive_request headers, content + # p [:request, headers, content] + # end + # end + # + # EM.run{ + # EM.start_server 'localhost', 80, RequestHandler + # } + # + #-- + # Originally, this subclassed LineAndTextProtocol, which in + # turn relies on BufferedTokenizer, which doesn't gracefully + # handle the transitions between lines and binary text. + # Changed 13Sep08 by FCianfrocca. + class HeaderAndContentProtocol < Connection + include LineText2 + + ContentLengthPattern = /Content-length:\s*(\d+)/i + + def initialize *args + super + init_for_request + end + + def receive_line line + case @hc_mode + when :discard_blanks + unless line == "" + @hc_mode = :headers + receive_line line + end + when :headers + if line == "" + raise "unrecognized state" unless @hc_headers.length > 0 + if respond_to?(:receive_headers) + receive_headers @hc_headers + end + # @hc_content_length will be nil, not 0, if there was no content-length header. + if @hc_content_length.to_i > 0 + set_binary_mode @hc_content_length + else + dispatch_request + end + else + @hc_headers << line + if ContentLengthPattern =~ line + # There are some attacks that rely on sending multiple content-length + # headers. This is a crude protection, but needs to become tunable. + raise "extraneous content-length header" if @hc_content_length + @hc_content_length = $1.to_i + end + if @hc_headers.length == 1 and respond_to?(:receive_first_header_line) + receive_first_header_line line + end + end + else + raise "internal error, unsupported mode" + end + end + + def receive_binary_data text + @hc_content = text + dispatch_request + end + + def dispatch_request + if respond_to?(:receive_request) + receive_request @hc_headers, @hc_content + end + init_for_request + end + private :dispatch_request + + def init_for_request + @hc_mode = :discard_blanks + @hc_headers = [] + # originally was @hc_headers ||= []; @hc_headers.clear to get a performance + # boost, but it's counterproductive because a subclassed handler will have to + # call dup to use the header array we pass in receive_headers. + + @hc_content_length = nil + @hc_content = "" + end + private :init_for_request + + # Basically a convenience method. We might create a subclass that does this + # automatically. But it's such a performance killer. + def headers_2_hash hdrs + self.class.headers_2_hash hdrs + end + + class << self + def headers_2_hash hdrs + hash = {} + hdrs.each {|h| + if /\A([^\s:]+)\s*:\s*/ =~ h + tail = $'.dup + hash[ $1.downcase.gsub(/-/,"_").intern ] = tail + end + } + hash + end + end + + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/httpclient.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/httpclient.rb new file mode 100644 index 000000000..b12cfdbd0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/httpclient.rb @@ -0,0 +1,279 @@ +#-- +# +# Author:: Francis Cianfrocca (gmail: blackhedd) +# Homepage:: http://rubyeventmachine.com +# Date:: 16 July 2006 +# +# See EventMachine and EventMachine::Connection for documentation and +# usage examples. +# +#---------------------------------------------------------------------------- +# +# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +# Gmail: blackhedd +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of either: 1) the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version; or 2) Ruby's License. +# +# See the file COPYING for complete licensing information. +# +#--------------------------------------------------------------------------- +# +# + + + +module EventMachine + module Protocols + + # Note: This class is deprecated and will be removed. Please use EM-HTTP-Request instead. + # + # @example + # EventMachine.run { + # http = EventMachine::Protocols::HttpClient.request( + # :host => server, + # :port => 80, + # :request => "/index.html", + # :query_string => "parm1=value1&parm2=value2" + # ) + # http.callback {|response| + # puts response[:status] + # puts response[:headers] + # puts response[:content] + # } + # } + #-- + # TODO: + # Add streaming so we can support enormous POSTs. Current max is 20meg. + # Timeout for connections that run too long or hang somewhere in the middle. + # Persistent connections (HTTP/1.1), may need a associated delegate object. + # DNS: Some way to cache DNS lookups for hostnames we connect to. Ruby's + # DNS lookups are unbelievably slow. + # HEAD requests. + # Chunked transfer encoding. + # Convenience methods for requests. get, post, url, etc. + # SSL. + # Handle status codes like 304, 100, etc. + # Refactor this code so that protocol errors all get handled one way (an exception?), + # instead of sprinkling set_deferred_status :failed calls everywhere. + class HttpClient < Connection + include EventMachine::Deferrable + + MaxPostContentLength = 20 * 1024 * 1024 + + def initialize + warn "HttpClient is deprecated and will be removed. EM-Http-Request should be used instead." + end + + # @param args [Hash] The request arguments + # @option args [String] :host The host IP/DNS name + # @option args [Integer] :port The port to connect too + # @option args [String] :verb The request type [GET | POST | DELETE | PUT] + # @option args [String] :request The request path + # @option args [Hash] :basic_auth The basic auth credentials (:username and :password) + # @option args [String] :content The request content + # @option args [String] :contenttype The content type (e.g. text/plain) + # @option args [String] :query_string The query string + # @option args [String] :host_header The host header to set + # @option args [String] :cookie Cookies to set + def self.request( args = {} ) + args[:port] ||= 80 + EventMachine.connect( args[:host], args[:port], self ) {|c| + # According to the docs, we will get here AFTER post_init is called. + c.instance_eval {@args = args} + } + end + + def post_init + @start_time = Time.now + @data = "" + @read_state = :base + end + + # We send the request when we get a connection. + # AND, we set an instance variable to indicate we passed through here. + # That allows #unbind to know whether there was a successful connection. + # NB: This naive technique won't work when we have to support multiple + # requests on a single connection. + def connection_completed + @connected = true + send_request @args + end + + def send_request args + args[:verb] ||= args[:method] # Support :method as an alternative to :verb. + args[:verb] ||= :get # IS THIS A GOOD IDEA, to default to GET if nothing was specified? + + verb = args[:verb].to_s.upcase + unless ["GET", "POST", "PUT", "DELETE", "HEAD"].include?(verb) + set_deferred_status :failed, {:status => 0} # TODO, not signalling the error type + return # NOTE THE EARLY RETURN, we're not sending any data. + end + + request = args[:request] || "/" + unless request[0,1] == "/" + request = "/" + request + end + + qs = args[:query_string] || "" + if qs.length > 0 and qs[0,1] != '?' + qs = "?" + qs + end + + version = args[:version] || "1.1" + + # Allow an override for the host header if it's not the connect-string. + host = args[:host_header] || args[:host] || "_" + # For now, ALWAYS tuck in the port string, although we may want to omit it if it's the default. + port = args[:port] + + # POST items. + postcontenttype = args[:contenttype] || "application/octet-stream" + postcontent = args[:content] || "" + raise "oversized content in HTTP POST" if postcontent.length > MaxPostContentLength + + # ESSENTIAL for the request's line-endings to be CRLF, not LF. Some servers misbehave otherwise. + # TODO: We ASSUME the caller wants to send a 1.1 request. May not be a good assumption. + req = [ + "#{verb} #{request}#{qs} HTTP/#{version}", + "Host: #{host}:#{port}", + "User-agent: Ruby EventMachine", + ] + + if verb == "POST" || verb == "PUT" + req << "Content-type: #{postcontenttype}" + req << "Content-length: #{postcontent.length}" + end + + # TODO, this cookie handler assumes it's getting a single, semicolon-delimited string. + # Eventually we will want to deal intelligently with arrays and hashes. + if args[:cookie] + req << "Cookie: #{args[:cookie]}" + end + + # Allow custom HTTP headers, e.g. SOAPAction + args[:custom_headers].each do |k,v| + req << "#{k}: #{v}" + end if args[:custom_headers] + + # Basic-auth stanza contributed by Matt Murphy. + if args[:basic_auth] + basic_auth_string = ["#{args[:basic_auth][:username]}:#{args[:basic_auth][:password]}"].pack('m').strip.gsub(/\n/,'') + req << "Authorization: Basic #{basic_auth_string}" + end + + req << "" + reqstring = req.map {|l| "#{l}\r\n"}.join + send_data reqstring + + if verb == "POST" || verb == "PUT" + send_data postcontent + end + end + + + def receive_data data + while data and data.length > 0 + case @read_state + when :base + # Perform any per-request initialization here and don't consume any data. + @data = "" + @headers = [] + @content_length = nil # not zero + @content = "" + @status = nil + @read_state = :header + @connection_close = nil + when :header + ary = data.split( /\r?\n/m, 2 ) + if ary.length == 2 + data = ary.last + if ary.first == "" + if (@content_length and @content_length > 0) || @connection_close + @read_state = :content + else + dispatch_response + @read_state = :base + end + else + @headers << ary.first + if @headers.length == 1 + parse_response_line + elsif ary.first =~ /\Acontent-length:\s*/i + # Only take the FIRST content-length header that appears, + # which we can distinguish because @content_length is nil. + # TODO, it's actually a fatal error if there is more than one + # content-length header, because the caller is presumptively + # a bad guy. (There is an exploit that depends on multiple + # content-length headers.) + @content_length ||= $'.to_i + elsif ary.first =~ /\Aconnection:\s*close/i + @connection_close = true + end + end + else + @data << data + data = "" + end + when :content + # If there was no content-length header, we have to wait until the connection + # closes. Everything we get until that point is content. + # TODO: Must impose a content-size limit, and also must implement chunking. + # Also, must support either temporary files for large content, or calling + # a content-consumer block supplied by the user. + if @content_length + bytes_needed = @content_length - @content.length + @content += data[0, bytes_needed] + data = data[bytes_needed..-1] || "" + if @content_length == @content.length + dispatch_response + @read_state = :base + end + else + @content << data + data = "" + end + end + end + end + + + # We get called here when we have received an HTTP response line. + # It's an opportunity to throw an exception or trigger other exceptional + # handling. + def parse_response_line + if @headers.first =~ /\AHTTP\/1\.[01] ([\d]{3})/ + @status = $1.to_i + else + set_deferred_status :failed, { + :status => 0 # crappy way of signifying an unrecognized response. TODO, find a better way to do this. + } + close_connection + end + end + private :parse_response_line + + def dispatch_response + @read_state = :base + set_deferred_status :succeeded, { + :content => @content, + :headers => @headers, + :status => @status + } + # TODO, we close the connection for now, but this is wrong for persistent clients. + close_connection + end + + def unbind + if !@connected + set_deferred_status :failed, {:status => 0} # YECCCCH. Find a better way to signal no-connect/network error. + elsif (@read_state == :content and @content_length == nil) + dispatch_response + end + end + end + + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/httpclient2.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/httpclient2.rb new file mode 100644 index 000000000..0fb64e804 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/httpclient2.rb @@ -0,0 +1,600 @@ +#-- +# +# Author:: Francis Cianfrocca (gmail: blackhedd) +# Homepage:: http://rubyeventmachine.com +# Date:: 16 July 2006 +# +# See EventMachine and EventMachine::Connection for documentation and +# usage examples. +# +#---------------------------------------------------------------------------- +# +# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +# Gmail: blackhedd +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of either: 1) the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version; or 2) Ruby's License. +# +# See the file COPYING for complete licensing information. +# +#--------------------------------------------------------------------------- +# +# + +module EventMachine + module Protocols + + # Note: This class is deprecated and will be removed. Please use EM-HTTP-Request instead. + # + # === Usage + # + # EM.run{ + # conn = EM::Protocols::HttpClient2.connect 'google.com', 80 + # + # req = conn.get('/') + # req.callback{ |response| + # p(response.status) + # p(response.headers) + # p(response.content) + # } + # } + class HttpClient2 < Connection + include LineText2 + + def initialize + warn "HttpClient2 is deprecated and will be removed. EM-Http-Request should be used instead." + + @authorization = nil + @closed = nil + @requests = nil + end + + # @private + class Request + include Deferrable + + attr_reader :version + attr_reader :status + attr_reader :header_lines + attr_reader :headers + attr_reader :content + attr_reader :internal_error + + def initialize conn, args + @conn = conn + @args = args + @header_lines = [] + @headers = {} + @blanks = 0 + @chunk_trailer = nil + @chunking = nil + end + + def send_request + az = @args[:authorization] and az = "Authorization: #{az}\r\n" + + r = [ + "#{@args[:verb]} #{@args[:uri]} HTTP/#{@args[:version] || "1.1"}\r\n", + "Host: #{@args[:host_header] || "_"}\r\n", + az || "", + "\r\n" + ] + @conn.send_data r.join + end + + + #-- + # + def receive_line ln + if @chunk_trailer + receive_chunk_trailer(ln) + elsif @chunking + receive_chunk_header(ln) + else + receive_header_line(ln) + end + end + + #-- + # + def receive_chunk_trailer ln + if ln.length == 0 + @conn.pop_request + succeed(self) + else + p "Received chunk trailer line" + end + end + + #-- + # Allow up to ten blank lines before we get a real response line. + # Allow no more than 100 lines in the header. + # + def receive_header_line ln + if ln.length == 0 + if @header_lines.length > 0 + process_header + else + @blanks += 1 + if @blanks > 10 + @conn.close_connection + end + end + else + @header_lines << ln + if @header_lines.length > 100 + @internal_error = :bad_header + @conn.close_connection + end + end + end + + #-- + # Cf RFC 2616 pgh 3.6.1 for the format of HTTP chunks. + # + def receive_chunk_header ln + if ln.length > 0 + chunksize = ln.to_i(16) + if chunksize > 0 + @conn.set_text_mode(ln.to_i(16)) + else + @content = @content ? @content.join : '' + @chunk_trailer = true + end + else + # We correctly come here after each chunk gets read. + # p "Got A BLANK chunk line" + end + + end + + + #-- + # We get a single chunk. Append it to the incoming content and switch back to line mode. + # + def receive_chunked_text text + # p "RECEIVED #{text.length} CHUNK" + (@content ||= []) << text + end + + + #-- + # TODO, inefficient how we're handling this. Part of it is done so as to + # make sure we don't have problems in detecting chunked-encoding, content-length, + # etc. + # + HttpResponseRE = /\AHTTP\/(1.[01]) ([\d]{3})/i + ClenRE = /\AContent-length:\s*(\d+)/i + ChunkedRE = /\ATransfer-encoding:\s*chunked/i + ColonRE = /\:\s*/ + + def process_header + unless @header_lines.first =~ HttpResponseRE + @conn.close_connection + @internal_error = :bad_request + end + @version = $1.dup + @status = $2.dup.to_i + + clen = nil + chunks = nil + @header_lines.each_with_index do |e,ix| + if ix > 0 + hdr,val = e.split(ColonRE,2) + (@headers[hdr.downcase] ||= []) << val + end + + if clen == nil and e =~ ClenRE + clen = $1.dup.to_i + end + if e =~ ChunkedRE + chunks = true + end + end + + if clen + # If the content length is zero we should not call set_text_mode, + # because a value of zero will make it wait forever, hanging the + # connection. Just return success instead, with empty content. + if clen == 0 then + @content = "" + @conn.pop_request + succeed(self) + else + @conn.set_text_mode clen + end + elsif chunks + @chunking = true + else + # Chunked transfer, multipart, or end-of-connection. + # For end-of-connection, we need to go the unbind + # method and suppress its desire to fail us. + p "NO CLEN" + p @args[:uri] + p @header_lines + @internal_error = :unsupported_clen + @conn.close_connection + end + end + private :process_header + + + def receive_text text + @chunking ? receive_chunked_text(text) : receive_sized_text(text) + end + + #-- + # At the present time, we only handle contents that have a length + # specified by the content-length header. + # + def receive_sized_text text + @content = text + @conn.pop_request + succeed(self) + end + end + + # Make a connection to a remote HTTP server. + # Can take either a pair of arguments (which will be interpreted as + # a hostname/ip-address and a port), or a hash. + # If the arguments are a hash, then supported values include: + # :host => a hostname or ip-address + # :port => a port number + # :ssl => true to enable ssl + def self.connect *args + if args.length == 2 + args = {:host=>args[0], :port=>args[1]} + else + args = args.first + end + + h,prt,ssl = args[:host], Integer(args[:port]), (args[:tls] || args[:ssl]) + conn = EM.connect( h, prt, self ) + conn.start_tls if ssl + conn.set_default_host_header( h, prt, ssl ) + conn + end + + # Get a url + # + # req = conn.get(:uri => '/') + # req.callback{|response| puts response.content } + # + def get args + if args.is_a?(String) + args = {:uri=>args} + end + args[:verb] = "GET" + request args + end + + # Post to a url + # + # req = conn.post('/data') + # req.callback{|response| puts response.content } + #-- + # XXX there's no way to supply a POST body.. wtf? + def post args + if args.is_a?(String) + args = {:uri=>args} + end + args[:verb] = "POST" + request args + end + + + #-- + # Compute and remember a string to be used as the host header in HTTP requests + # unless the user overrides it with an argument to #request. + # + # @private + def set_default_host_header host, port, ssl + if (ssl and port != 443) or (!ssl and port != 80) + @host_header = "#{host}:#{port}" + else + @host_header = host + end + end + + + # @private + def post_init + super + @connected = EM::DefaultDeferrable.new + end + + # @private + def connection_completed + super + @connected.succeed + end + + #-- + # All pending requests, if any, must fail. + # We might come here without ever passing through connection_completed + # in case we can't connect to the server. We'll also get here when the + # connection closes (either because the server closes it, or we close it + # due to detecting an internal error or security violation). + # In either case, run down all pending requests, if any, and signal failure + # on them. + # + # Set and remember a flag (@closed) so we can immediately fail any + # subsequent requests. + # + # @private + def unbind + super + @closed = true + (@requests || []).each {|r| r.fail} + end + + # @private + def request args + args[:host_header] = @host_header unless args.has_key?(:host_header) + args[:authorization] = @authorization unless args.has_key?(:authorization) + r = Request.new self, args + if @closed + r.fail + else + (@requests ||= []).unshift r + @connected.callback {r.send_request} + end + r + end + + # @private + def receive_line ln + if req = @requests.last + req.receive_line ln + else + p "??????????" + p ln + end + end + + # @private + def receive_binary_data text + @requests.last.receive_text text + end + + #-- + # Called by a Request object when it completes. + # + # @private + def pop_request + @requests.pop + end + end + + +=begin + class HttpClient2x < Connection + include LineText2 + + # TODO: Make this behave appropriate in case a #connect fails. + # Currently, this produces no errors. + + # Make a connection to a remote HTTP server. + # Can take either a pair of arguments (which will be interpreted as + # a hostname/ip-address and a port), or a hash. + # If the arguments are a hash, then supported values include: + # :host => a hostname or ip-address; + # :port => a port number + #-- + # TODO, support optional encryption arguments like :ssl + def self.connect *args + if args.length == 2 + args = {:host=>args[0], :port=>args[1]} + else + args = args.first + end + + h,prt = args[:host],Integer(args[:port]) + EM.connect( h, prt, self, h, prt ) + end + + + #-- + # Sugars a connection that makes a single request and then + # closes the connection. Matches the behavior and the arguments + # of the original implementation of class HttpClient. + # + # Intended primarily for back compatibility, but the idiom + # is probably useful so it's not deprecated. + # We return a Deferrable, as did the original implementation. + # + # Because we're improving the way we deal with errors and exceptions + # (specifically, HTTP response codes other than 2xx will trigger the + # errback rather than the callback), this may break some existing code. + # + def self.request args + c = connect args + end + + #-- + # Requests can be pipelined. When we get a request, add it to the + # front of a queue as an array. The last element of the @requests + # array is always the oldest request received. Each element of the + # @requests array is a two-element array consisting of a hash with + # the original caller's arguments, and an initially-empty Ostruct + # containing the data we retrieve from the server's response. + # Maintain the instance variable @current_response, which is the response + # of the oldest pending request. That's just to make other code a little + # easier. If the variable doesn't exist when we come here, we're + # obviously the first request being made on the connection. + # + # The reason for keeping this method private (and requiring use of the + # convenience methods #get, #post, #head, etc) is to avoid the small + # performance penalty of canonicalizing the verb. + # + def request args + d = EventMachine::DefaultDeferrable.new + + if @closed + d.fail + return d + end + + o = OpenStruct.new + o.deferrable = d + (@requests ||= []).unshift [args, o] + @current_response ||= @requests.last.last + @connected.callback { + az = args[:authorization] and az = "Authorization: #{az}\r\n" + + r = [ + "#{args[:verb]} #{args[:uri]} HTTP/#{args[:version] || "1.1"}\r\n", + "Host: #{args[:host_header] || @host_header}\r\n", + az || "", + "\r\n" + ] + p r + send_data r.join + } + o.deferrable + end + private :request + + def get args + if args.is_a?(String) + args = {:uri=>args} + end + args[:verb] = "GET" + request args + end + + def initialize host, port + super + @host_header = "#{host}:#{port}" + end + def post_init + super + @connected = EM::DefaultDeferrable.new + end + + + def connection_completed + super + @connected.succeed + end + + #-- + # Make sure to throw away any leftover incoming data if we've + # been closed due to recognizing an error. + # + # Generate an internal error if we get an unreasonable number of + # header lines. It could be malicious. + # + def receive_line ln + p ln + return if @closed + + if ln.length > 0 + (@current_response.headers ||= []).push ln + abort_connection if @current_response.headers.length > 100 + else + process_received_headers + end + end + + #-- + # We come here when we've seen all the headers for a particular request. + # What we do next depends on the response line (which should be the + # first line in the header set), and whether there is content to read. + # We may transition into a text-reading state to read content, or + # we may abort the connection, or we may go right back into parsing + # responses for the next response in the chain. + # + # We make an ASSUMPTION that the first line is an HTTP response. + # Anything else produces an error that aborts the connection. + # This may not be enough, because it may be that responses to pipelined + # requests will come with a blank-line delimiter. + # + # Any non-2xx response will be treated as a fatal error, and abort the + # connection. We will set up the status and other response parameters. + # TODO: we will want to properly support 1xx responses, which some versions + # of IIS copiously generate. + # TODO: We need to give the option of not aborting the connection with certain + # non-200 responses, in order to work with NTLM and other authentication + # schemes that work at the level of individual connections. + # + # Some error responses will get sugarings. For example, we'll return the + # Location header in the response in case of a 301/302 response. + # + # Possible dispositions here: + # 1) No content to read (either content-length is zero or it's a HEAD request); + # 2) Switch to text mode to read a specific number of bytes; + # 3) Read a chunked or multipart response; + # 4) Read till the server closes the connection. + # + # Our reponse to the client can be either to wait till all the content + # has been read and then to signal caller's deferrable, or else to signal + # it when we finish the processing the headers and then expect the caller + # to have given us a block to call as the content comes in. And of course + # the latter gets stickier with chunks and multiparts. + # + HttpResponseRE = /\AHTTP\/(1.[01]) ([\d]{3})/i + ClenRE = /\AContent-length:\s*(\d+)/i + def process_received_headers + abort_connection unless @current_response.headers.first =~ HttpResponseRE + @current_response.version = $1.dup + st = $2.dup + @current_response.status = st.to_i + abort_connection unless st[0,1] == "2" + + clen = nil + @current_response.headers.each do |e| + if clen == nil and e =~ ClenRE + clen = $1.dup.to_i + end + end + + if clen + set_text_mode clen + end + end + private :process_received_headers + + + def receive_binary_data text + @current_response.content = text + @current_response.deferrable.succeed @current_response + @requests.pop + @current_response = (@requests.last || []).last + set_line_mode + end + + + + # We've received either a server error or an internal error. + # Close the connection and abort any pending requests. + #-- + # When should we call close_connection? It will cause #unbind + # to be fired. Should the user expect to see #unbind before + # we call #receive_http_error, or the other way around? + # + # Set instance variable @closed. That's used to inhibit further + # processing of any inbound data after an error has been recognized. + # + # We shouldn't have to worry about any leftover outbound data, + # because we call close_connection (not close_connection_after_writing). + # That ensures that any pipelined requests received after an error + # DO NOT get streamed out to the server on this connection. + # Very important. TODO, write a unit-test to establish that behavior. + # + def abort_connection + close_connection + @closed = true + @current_response.deferrable.fail( @current_response ) + end + + + #------------------------ + # Below here are user-overridable methods. + + end +=end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/line_and_text.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/line_and_text.rb new file mode 100644 index 000000000..741727879 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/line_and_text.rb @@ -0,0 +1,125 @@ +#-- +# +# Author:: Francis Cianfrocca (gmail: blackhedd) +# Homepage:: http://rubyeventmachine.com +# Date:: 15 November 2006 +# +# See EventMachine and EventMachine::Connection for documentation and +# usage examples. +# +#---------------------------------------------------------------------------- +# +# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +# Gmail: blackhedd +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of either: 1) the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version; or 2) Ruby's License. +# +# See the file COPYING for complete licensing information. +# +#--------------------------------------------------------------------------- +# +# +# + +module EventMachine + module Protocols + # A protocol that handles line-oriented data with interspersed binary text. + # + # This version is optimized for performance. See EventMachine::Protocols::LineText2 + # for a version which is optimized for correctness with regard to binary text blocks + # that can switch back to line mode. + class LineAndTextProtocol < Connection + MaxLineLength = 16*1024 + MaxBinaryLength = 32*1024*1024 + + def initialize *args + super + lbp_init_line_state + end + def receive_data data + if @lbp_mode == :lines + begin + @lpb_buffer.extract(data).each do |line| + receive_line(line.chomp) if respond_to?(:receive_line) + end + rescue Exception + receive_error('overlength line') if respond_to?(:receive_error) + close_connection + return + end + else + if @lbp_binary_limit > 0 + wanted = @lbp_binary_limit - @lbp_binary_bytes_received + chunk = nil + if data.length > wanted + chunk = data.slice!(0...wanted) + else + chunk = data + data = "" + end + @lbp_binary_buffer[@lbp_binary_bytes_received...(@lbp_binary_bytes_received+chunk.length)] = chunk + @lbp_binary_bytes_received += chunk.length + if @lbp_binary_bytes_received == @lbp_binary_limit + receive_binary_data(@lbp_binary_buffer) if respond_to?(:receive_binary_data) + lbp_init_line_state + end + receive_data(data) if data.length > 0 + else + receive_binary_data(data) if respond_to?(:receive_binary_data) + data = "" + end + end + end + + def unbind + if @lbp_mode == :binary and @lbp_binary_limit > 0 + if respond_to?(:receive_binary_data) + receive_binary_data( @lbp_binary_buffer[0...@lbp_binary_bytes_received] ) + end + end + end + + # Set up to read the supplied number of binary bytes. + # This recycles all the data currently waiting in the line buffer, if any. + # If the limit is nil, then ALL subsequent data will be treated as binary + # data and passed to the upstream protocol handler as we receive it. + # If a limit is given, we'll hold the incoming binary data and not + # pass it upstream until we've seen it all, or until there is an unbind + # (in which case we'll pass up a partial). + # Specifying nil for the limit (the default) means there is no limit. + # Specifiyng zero for the limit will cause an immediate transition back to line mode. + # + def set_binary_mode size = nil + if @lbp_mode == :lines + if size == 0 + receive_binary_data("") if respond_to?(:receive_binary_data) + # Do no more work here. Stay in line mode and keep consuming data. + else + @lbp_binary_limit = size.to_i # (nil will be stored as zero) + if @lbp_binary_limit > 0 + raise "Overlength" if @lbp_binary_limit > MaxBinaryLength # arbitrary sanity check + @lbp_binary_buffer = "\0" * @lbp_binary_limit + @lbp_binary_bytes_received = 0 + end + + @lbp_mode = :binary + receive_data @lpb_buffer.flush + end + else + raise "invalid operation" + end + end + + #-- + # For internal use, establish protocol baseline for handling lines. + def lbp_init_line_state + @lpb_buffer = BufferedTokenizer.new("\n", MaxLineLength) + @lbp_mode = :lines + end + private :lbp_init_line_state + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/line_protocol.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/line_protocol.rb new file mode 100644 index 000000000..ed0f622ee --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/line_protocol.rb @@ -0,0 +1,29 @@ +module EventMachine + module Protocols + # LineProtocol will parse out newline terminated strings from a receive_data stream + # + # module Server + # include EM::P::LineProtocol + # + # def receive_line(line) + # send_data("you said: #{line}") + # end + # end + # + module LineProtocol + # @private + def receive_data data + (@buf ||= '') << data + + while line = @buf.slice!(/(.*)\r?\n/) + receive_line(line) + end + end + + # Invoked with lines received over the network + def receive_line(line) + # stub + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/linetext2.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/linetext2.rb new file mode 100644 index 000000000..6d4a47fd7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/linetext2.rb @@ -0,0 +1,161 @@ +#-- +# +# Author:: Francis Cianfrocca (gmail: blackhedd) +# Homepage:: http://rubyeventmachine.com +# Date:: 15 November 2006 +# +# See EventMachine and EventMachine::Connection for documentation and +# usage examples. +# +#---------------------------------------------------------------------------- +# +# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +# Gmail: blackhedd +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of either: 1) the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version; or 2) Ruby's License. +# +# See the file COPYING for complete licensing information. +# +#--------------------------------------------------------------------------- +# +# + +module EventMachine + module Protocols + # In the grand, time-honored tradition of re-inventing the wheel, we offer + # here YET ANOTHER protocol that handles line-oriented data with interspersed + # binary text. This one trades away some of the performance optimizations of + # EventMachine::Protocols::LineAndTextProtocol in order to get better correctness + # with regard to binary text blocks that can switch back to line mode. It also + # permits the line-delimiter to change in midstream. + # This was originally written to support Stomp. + module LineText2 + # TODO! We're not enforcing the limits on header lengths and text-lengths. + # When we get around to that, call #receive_error if the user defined it, otherwise + # throw exceptions. + + MaxLineLength = 16*1024 + MaxBinaryLength = 32*1024*1024 + + #-- + # Will be called recursively until there's no data to read. + # That way the user-defined handlers we call can modify the + # handling characteristics on a per-token basis. + # + def receive_data data + return unless (data and data.length > 0) + + # Do this stuff in lieu of a constructor. + @lt2_mode ||= :lines + @lt2_delimiter ||= "\n" + @lt2_linebuffer ||= [] + + if @lt2_mode == :lines + if ix = data.index( @lt2_delimiter ) + @lt2_linebuffer << data[0...ix] + ln = @lt2_linebuffer.join + @lt2_linebuffer.clear + if @lt2_delimiter == "\n" + ln.chomp! + end + receive_line ln + receive_data data[(ix+@lt2_delimiter.length)..-1] + else + @lt2_linebuffer << data + end + elsif @lt2_mode == :text + if @lt2_textsize + needed = @lt2_textsize - @lt2_textpos + will_take = if data.length > needed + needed + else + data.length + end + + @lt2_textbuffer << data[0...will_take] + tail = data[will_take..-1] + + @lt2_textpos += will_take + if @lt2_textpos >= @lt2_textsize + # Reset line mode (the default behavior) BEFORE calling the + # receive_binary_data. This makes it possible for user code + # to call set_text_mode, enabling chains of text blocks + # (which can possibly be of different sizes). + set_line_mode + receive_binary_data @lt2_textbuffer.join + receive_end_of_binary_data + end + + receive_data tail + else + receive_binary_data data + end + end + end + + + def set_delimiter delim + @lt2_delimiter = delim.to_s + end + + # Called internally but also exposed to user code, for the case in which + # processing of binary data creates a need to transition back to line mode. + # We support an optional parameter to "throw back" some data, which might + # be an umprocessed chunk of the transmitted binary data, or something else + # entirely. + def set_line_mode data="" + @lt2_mode = :lines + (@lt2_linebuffer ||= []).clear + receive_data data.to_s + end + + def set_text_mode size=nil + if size == 0 + set_line_mode + else + @lt2_mode = :text + (@lt2_textbuffer ||= []).clear + @lt2_textsize = size # which can be nil, signifying no limit + @lt2_textpos = 0 + end + end + + # Alias for #set_text_mode, added for back-compatibility with LineAndTextProtocol. + def set_binary_mode size=nil + set_text_mode size + end + + # In case of a dropped connection, we'll send a partial buffer to user code + # when in sized text mode. User overrides of #receive_binary_data need to + # be aware that they may get a short buffer. + def unbind + @lt2_mode ||= nil + if @lt2_mode == :text and @lt2_textpos > 0 + receive_binary_data @lt2_textbuffer.join + end + end + + # Stub. Should be subclassed by user code. + def receive_line ln + # no-op + end + + # Stub. Should be subclassed by user code. + def receive_binary_data data + # no-op + end + + # Stub. Should be subclassed by user code. + # This is called when transitioning internally from text mode + # back to line mode. Useful when client code doesn't want + # to keep track of how much data it's received. + def receive_end_of_binary_data + # no-op + end + end + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/memcache.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/memcache.rb new file mode 100644 index 000000000..1f81aaf9d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/memcache.rb @@ -0,0 +1,331 @@ +module EventMachine + module Protocols + # Implements the Memcache protocol (http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt). + # Requires memcached >= 1.2.4 w/ noreply support + # + # == Usage example + # + # EM.run{ + # cache = EM::P::Memcache.connect 'localhost', 11211 + # + # cache.set :a, 'hello' + # cache.set :b, 'hi' + # cache.set :c, 'how are you?' + # cache.set :d, '' + # + # cache.get(:a){ |v| p v } + # cache.get_hash(:a, :b, :c, :d){ |v| p v } + # cache.get(:a,:b,:c,:d){ |a,b,c,d| p [a,b,c,d] } + # + # cache.get(:a,:z,:b,:y,:d){ |a,z,b,y,d| p [a,z,b,y,d] } + # + # cache.get(:missing){ |m| p [:missing=, m] } + # cache.set(:missing, 'abc'){ p :stored } + # cache.get(:missing){ |m| p [:missing=, m] } + # cache.del(:missing){ p :deleted } + # cache.get(:missing){ |m| p [:missing=, m] } + # } + # + module Memcache + include EM::Deferrable + + ## + # constants + + unless defined? Cempty + # @private + Cstored = 'STORED'.freeze + # @private + Cend = 'END'.freeze + # @private + Cdeleted = 'DELETED'.freeze + # @private + Cunknown = 'NOT_FOUND'.freeze + # @private + Cerror = 'ERROR'.freeze + + # @private + Cempty = ''.freeze + # @private + Cdelimiter = "\r\n".freeze + end + + ## + # commands + + # Get the value associated with one or multiple keys + # + # cache.get(:a){ |v| p v } + # cache.get(:a,:b,:c,:d){ |a,b,c,d| p [a,b,c,d] } + # + def get *keys + raise ArgumentError unless block_given? + + callback{ + keys = keys.map{|k| k.to_s.gsub(/\s/,'_') } + send_data "get #{keys.join(' ')}\r\n" + @get_cbs << [keys, proc{ |values| + yield *keys.map{ |k| values[k] } + }] + } + end + + # Set the value for a given key + # + # cache.set :a, 'hello' + # cache.set(:missing, 'abc'){ puts "stored the value!" } + # + def set key, val, exptime = 0, &cb + callback{ + val = val.to_s + send_cmd :set, key, 0, exptime, val.respond_to?(:bytesize) ? val.bytesize : val.size, !block_given? + send_data val + send_data Cdelimiter + @set_cbs << cb if cb + } + end + + # Gets multiple values as a hash + # + # cache.get_hash(:a, :b, :c, :d){ |h| puts h[:a] } + # + def get_hash *keys + raise ArgumentError unless block_given? + + get *keys do |*values| + yield keys.inject({}){ |hash, k| hash.update k => values[keys.index(k)] } + end + end + + # Delete the value associated with a key + # + # cache.del :a + # cache.del(:b){ puts "deleted the value!" } + # + def delete key, expires = 0, &cb + callback{ + send_data "delete #{key} #{expires}#{cb ? '' : ' noreply'}\r\n" + @del_cbs << cb if cb + } + end + alias del delete + + # Connect to a memcached server (must support NOREPLY, memcached >= 1.2.4) + def self.connect host = 'localhost', port = 11211 + EM.connect host, port, self, host, port + end + + def send_cmd cmd, key, flags = 0, exptime = 0, bytes = 0, noreply = false + send_data "#{cmd} #{key} #{flags} #{exptime} #{bytes}#{noreply ? ' noreply' : ''}\r\n" + end + private :send_cmd + + ## + # errors + + # @private + class ParserError < StandardError + end + + ## + # em hooks + + # @private + def initialize host, port = 11211 + @host, @port = host, port + end + + # @private + def connection_completed + @get_cbs = [] + @set_cbs = [] + @del_cbs = [] + + @values = {} + + @reconnecting = false + @connected = true + succeed + # set_delimiter "\r\n" + # set_line_mode + end + + #-- + # 19Feb09 Switched to a custom parser, LineText2 is recursive and can cause + # stack overflows when there is too much data. + # include EM::P::LineText2 + # @private + def receive_data data + (@buffer||='') << data + + while index = @buffer.index(Cdelimiter) + begin + line = @buffer.slice!(0,index+2) + process_cmd line + rescue ParserError + @buffer[0...0] = line + break + end + end + end + + #-- + # def receive_line line + # @private + def process_cmd line + case line.strip + when /^VALUE\s+(.+?)\s+(\d+)\s+(\d+)/ # VALUE + bytes = Integer($3) + # set_binary_mode bytes+2 + # @cur_key = $1 + if @buffer.size >= bytes + 2 + @values[$1] = @buffer.slice!(0,bytes) + @buffer.slice!(0,2) # \r\n + else + raise ParserError + end + + when Cend # END + if entry = @get_cbs.shift + keys, cb = entry + cb.call(@values) + end + @values = {} + + when Cstored # STORED + if cb = @set_cbs.shift + cb.call(true) + end + + when Cdeleted # DELETED + if cb = @del_cbs.shift + cb.call(true) + end + + when Cunknown # NOT_FOUND + if cb = @del_cbs.shift + cb.call(false) + end + + else + p [:MEMCACHE_UNKNOWN, line] + end + end + + #-- + # def receive_binary_data data + # @values[@cur_key] = data[0..-3] + # end + + # @private + def unbind + if @connected or @reconnecting + EM.add_timer(1){ reconnect @host, @port } + @connected = false + @reconnecting = true + @deferred_status = nil + else + raise 'Unable to connect to memcached server' + end + end + end + end +end + +if __FILE__ == $0 + # ruby -I ext:lib -r eventmachine -rubygems lib/protocols/memcache.rb + require 'em/spec' + + # @private + class TestConnection + include EM::P::Memcache + def send_data data + sent_data << data + end + def sent_data + @sent_data ||= '' + end + + def initialize + connection_completed + end + end + + EM.describe EM::Protocols::Memcache do + + before{ + @c = TestConnection.new + } + + should 'send get requests' do + @c.get('a'){} + @c.sent_data.should == "get a\r\n" + done + end + + should 'send set requests' do + @c.set('a', 1){} + @c.sent_data.should == "set a 0 0 1\r\n1\r\n" + done + end + + should 'use noreply on set without block' do + @c.set('a', 1) + @c.sent_data.should == "set a 0 0 1 noreply\r\n1\r\n" + done + end + + should 'send delete requests' do + @c.del('a') + @c.sent_data.should == "delete a 0 noreply\r\n" + done + end + + should 'work when get returns no values' do + @c.get('a'){ |a| + a.should.be.nil + done + } + + @c.receive_data "END\r\n" + end + + should 'invoke block on set' do + @c.set('a', 1){ + done + } + + @c.receive_data "STORED\r\n" + end + + should 'invoke block on delete' do + @c.delete('a'){ |found| + found.should.be.false + } + @c.delete('b'){ |found| + found.should.be.true + done + } + + @c.receive_data "NOT_FOUND\r\n" + @c.receive_data "DELETED\r\n" + end + + should 'parse split responses' do + @c.get('a'){ |a| + a.should == 'abc' + done + } + + @c.receive_data "VAL" + @c.receive_data "UE a 0 " + @c.receive_data "3\r\n" + @c.receive_data "ab" + @c.receive_data "c" + @c.receive_data "\r\n" + @c.receive_data "EN" + @c.receive_data "D\r\n" + end + + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/object_protocol.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/object_protocol.rb new file mode 100644 index 000000000..ec79cb4a6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/object_protocol.rb @@ -0,0 +1,46 @@ +module EventMachine + module Protocols + # ObjectProtocol allows for easy communication using marshaled ruby objects + # + # module RubyServer + # include EM::P::ObjectProtocol + # + # def receive_object obj + # send_object({'you said' => obj}) + # end + # end + # + module ObjectProtocol + # By default returns Marshal, override to return JSON or YAML, or any + # other serializer/deserializer responding to #dump and #load. + def serializer + Marshal + end + + # @private + def receive_data data + (@buf ||= '') << data + + while @buf.size >= 4 + if @buf.size >= 4+(size=@buf.unpack('N').first) + @buf.slice!(0,4) + receive_object serializer.load(@buf.slice!(0,size)) + else + break + end + end + end + + # Invoked with ruby objects received over the network + def receive_object obj + # stub + end + + # Sends a ruby object over the network + def send_object obj + data = serializer.dump(obj) + send_data [data.respond_to?(:bytesize) ? data.bytesize : data.size, data].pack('Na*') + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/postgres3.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/postgres3.rb new file mode 100644 index 000000000..7d87505c6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/postgres3.rb @@ -0,0 +1,246 @@ +#-- +# +# Author:: Francis Cianfrocca (gmail: blackhedd) +# Homepage:: http://rubyeventmachine.com +# Date:: 15 November 2006 +# +# See EventMachine and EventMachine::Connection for documentation and +# usage examples. +# +#---------------------------------------------------------------------------- +# +# Copyright (C) 2006-08 by Francis Cianfrocca. All Rights Reserved. +# Gmail: blackhedd +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of either: 1) the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version; or 2) Ruby's License. +# +# See the file COPYING for complete licensing information. +# +#--------------------------------------------------------------------------- +# +# +# + +require 'postgres-pr/message' +require 'postgres-pr/connection' +require 'stringio' + +# @private +class StringIO + # Reads exactly +n+ bytes. + # + # If the data read is nil an EOFError is raised. + # + # If the data read is too short an IOError is raised + def readbytes(n) + str = read(n) + if str == nil + raise EOFError, "End of file reached" + end + if str.size < n + raise IOError, "data truncated" + end + str + end + alias read_exactly_n_bytes readbytes +end + + +module EventMachine + module Protocols + # PROVISIONAL IMPLEMENTATION of an evented Postgres client. + # This implements version 3 of the Postgres wire protocol, which will work + # with any Postgres version from roughly 7.4 onward. + # + # Objective: we want to access Postgres databases without requiring threads. + # Until now this has been a problem because the Postgres client implementations + # have all made use of blocking I/O calls, which is incompatible with a + # thread-free evented model. + # + # But rather than re-implement the Postgres Wire3 protocol, we're taking advantage + # of the existing postgres-pr library, which was originally written by Michael + # Neumann but (at this writing) appears to be no longer maintained. Still, it's + # in basically a production-ready state, and the wire protocol isn't that complicated + # anyway. + # + # We're tucking in a bunch of require statements that may not be present in garden-variety + # EM installations. Until we find a good way to only require these if a program + # requires postgres, this file will need to be required explicitly. + # + # We need to monkeypatch StringIO because it lacks the #readbytes method needed + # by postgres-pr. + # The StringIO monkeypatch is lifted from the standard library readbytes.rb, + # which adds method #readbytes directly to class IO. But StringIO is not a subclass of IO. + # It is modified to raise an IOError instead of TruncatedDataException since the exception is unused. + # + # We cloned the handling of postgres messages from lib/postgres-pr/connection.rb + # in the postgres-pr library, and modified it for event-handling. + # + # TODO: The password handling in dispatch_conn_message is totally incomplete. + # + # + # We return Deferrables from the user-level operations surfaced by this interface. + # Experimentally, we're using the pattern of always returning a boolean value as the + # first argument of a deferrable callback to indicate success or failure. This is + # instead of the traditional pattern of calling Deferrable#succeed or #fail, and + # requiring the user to define both a callback and an errback function. + # + # === Usage + # EM.run { + # db = EM.connect_unix_domain( "/tmp/.s.PGSQL.5432", EM::P::Postgres3 ) + # db.connect( dbname, username, psw ).callback do |status| + # if status + # db.query( "select * from some_table" ).callback do |status, result, errors| + # if status + # result.rows.each do |row| + # p row + # end + # end + # end + # end + # end + # } + class Postgres3 < EventMachine::Connection + include PostgresPR + + def initialize + @data = "" + @params = {} + end + + def connect db, user, psw=nil + d = EM::DefaultDeferrable.new + d.timeout 15 + + if @pending_query || @pending_conn + d.succeed false, "Operation already in progress" + else + @pending_conn = d + prms = {"user"=>user, "database"=>db} + @user = user + if psw + @password = psw + #prms["password"] = psw + end + send_data PostgresPR::StartupMessage.new( 3 << 16, prms ).dump + end + + d + end + + def query sql + d = EM::DefaultDeferrable.new + d.timeout 15 + + if @pending_query || @pending_conn + d.succeed false, "Operation already in progress" + else + @r = PostgresPR::Connection::Result.new + @e = [] + @pending_query = d + send_data PostgresPR::Query.dump(sql) + end + + d + end + + + def receive_data data + @data << data + while @data.length >= 5 + pktlen = @data[1...5].unpack("N").first + if @data.length >= (1 + pktlen) + pkt = @data.slice!(0...(1+pktlen)) + m = StringIO.open( pkt, "r" ) {|io| PostgresPR::Message.read( io ) } + if @pending_conn + dispatch_conn_message m + elsif @pending_query + dispatch_query_message m + else + raise "Unexpected message from database" + end + else + break # very important, break out of the while + end + end + end + + + def unbind + if o = (@pending_query || @pending_conn) + o.succeed false, "lost connection" + end + end + + # Cloned and modified from the postgres-pr. + def dispatch_conn_message msg + case msg + when AuthentificationClearTextPassword + raise ArgumentError, "no password specified" if @password.nil? + send_data PasswordMessage.new(@password).dump + + when AuthentificationCryptPassword + raise ArgumentError, "no password specified" if @password.nil? + send_data PasswordMessage.new(@password.crypt(msg.salt)).dump + + when AuthentificationMD5Password + raise ArgumentError, "no password specified" if @password.nil? + require 'digest/md5' + + m = Digest::MD5.hexdigest(@password + @user) + m = Digest::MD5.hexdigest(m + msg.salt) + m = 'md5' + m + send_data PasswordMessage.new(m).dump + + when AuthentificationKerberosV4, AuthentificationKerberosV5, AuthentificationSCMCredential + raise "unsupported authentification" + + when AuthentificationOk + when ErrorResponse + raise msg.field_values.join("\t") + when NoticeResponse + @notice_processor.call(msg) if @notice_processor + when ParameterStatus + @params[msg.key] = msg.value + when BackendKeyData + # TODO + #p msg + when ReadyForQuery + # TODO: use transaction status + pc,@pending_conn = @pending_conn,nil + pc.succeed true + else + raise "unhandled message type" + end + end + + # Cloned and modified from the postgres-pr. + def dispatch_query_message msg + case msg + when DataRow + @r.rows << msg.columns + when CommandComplete + @r.cmd_tag = msg.cmd_tag + when ReadyForQuery + pq,@pending_query = @pending_query,nil + pq.succeed true, @r, @e + when RowDescription + @r.fields = msg.fields + when CopyInResponse + when CopyOutResponse + when EmptyQueryResponse + when ErrorResponse + # TODO + @e << msg + when NoticeResponse + @notice_processor.call(msg) if @notice_processor + else + # TODO + end + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/saslauth.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/saslauth.rb new file mode 100644 index 000000000..9cabc518e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/saslauth.rb @@ -0,0 +1,175 @@ +#-- +# +# Author:: Francis Cianfrocca (gmail: blackhedd) +# Homepage:: http://rubyeventmachine.com +# Date:: 15 November 2006 +# +# See EventMachine and EventMachine::Connection for documentation and +# usage examples. +# +#---------------------------------------------------------------------------- +# +# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +# Gmail: blackhedd +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of either: 1) the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version; or 2) Ruby's License. +# +# See the file COPYING for complete licensing information. +# +#--------------------------------------------------------------------------- +# +# +# + +module EventMachine + module Protocols + + # Implements SASL authd. + # This is a very, very simple protocol that mimics the one used + # by saslauthd and pwcheck, two outboard daemons included in the + # standard SASL library distro. + # The only thing this is really suitable for is SASL PLAIN + # (user+password) authentication, but the SASL libs that are + # linked into standard servers (like imapd and sendmail) implement + # the other ones. + # + # SASL-auth is intended for reasonably fast operation inside a + # single machine, so it has no transport-security (although there + # have been multi-machine extensions incorporating transport-layer + # encryption). + # + # The standard saslauthd module generally runs privileged and does + # its work by referring to the system-account files. + # + # This feature was added to EventMachine to enable the development + # of custom authentication/authorization engines for standard servers. + # + # To use SASLauth, include it in a class that subclasses EM::Connection, + # and reimplement the validate method. + # + # The typical way to incorporate this module into an authentication + # daemon would be to set it as the handler for a UNIX-domain socket. + # The code might look like this: + # + # EM.start_unix_domain_server( "/var/run/saslauthd/mux", MyHandler ) + # File.chmod( 0777, "/var/run/saslauthd/mux") + # + # The chmod is probably needed to ensure that unprivileged clients can + # access the UNIX-domain socket. + # + # It's also a very good idea to drop superuser privileges (if any), after + # the UNIX-domain socket has been opened. + #-- + # Implementation details: assume the client can send us pipelined requests, + # and that the client will close the connection. + # + # The client sends us four values, each encoded as a two-byte length field in + # network order followed by the specified number of octets. + # The fields specify the username, password, service name (such as imap), + # and the "realm" name. We send back the barest minimum reply, a single + # field also encoded as a two-octet length in network order, followed by + # either "NO" or "OK" - simplicity itself. + # + # We enforce a maximum field size just as a sanity check. + # We do NOT automatically time out the connection. + # + # The code we use to parse out the values is ugly and probably slow. + # Improvements welcome. + # + module SASLauth + + MaxFieldSize = 128*1024 + def post_init + super + @sasl_data = "" + @sasl_values = [] + end + + def receive_data data + @sasl_data << data + while @sasl_data.length >= 2 + len = (@sasl_data[0,2].unpack("n")).first + raise "SASL Max Field Length exceeded" if len > MaxFieldSize + if @sasl_data.length >= (len + 2) + @sasl_values << @sasl_data[2,len] + @sasl_data.slice!(0...(2+len)) + if @sasl_values.length == 4 + send_data( validate(*@sasl_values) ? "\0\002OK" : "\0\002NO" ) + @sasl_values.clear + end + else + break + end + end + end + + def validate username, psw, sysname, realm + p username + p psw + p sysname + p realm + true + end + end + + # Implements the SASL authd client protocol. + # This is a very, very simple protocol that mimics the one used + # by saslauthd and pwcheck, two outboard daemons included in the + # standard SASL library distro. + # The only thing this is really suitable for is SASL PLAIN + # (user+password) authentication, but the SASL libs that are + # linked into standard servers (like imapd and sendmail) implement + # the other ones. + # + # You can use this module directly as a handler for EM Connections, + # or include it in a module or handler class of your own. + # + # First connect to a SASL server (it's probably a TCP server, or more + # likely a Unix-domain socket). Then call the #validate? method, + # passing at least a username and a password. #validate? returns + # a Deferrable which will either succeed or fail, depending + # on the status of the authentication operation. + # + module SASLauthclient + MaxFieldSize = 128*1024 + + def validate? username, psw, sysname=nil, realm=nil + + str = [username, psw, sysname, realm].map {|m| + [(m || "").length, (m || "")] + }.flatten.pack( "nA*" * 4 ) + send_data str + + d = EM::DefaultDeferrable.new + @queries.unshift d + d + end + + def post_init + @sasl_data = "" + @queries = [] + end + + def receive_data data + @sasl_data << data + + while @sasl_data.length > 2 + len = (@sasl_data[0,2].unpack("n")).first + raise "SASL Max Field Length exceeded" if len > MaxFieldSize + if @sasl_data.length >= (len + 2) + val = @sasl_data[2,len] + @sasl_data.slice!(0...(2+len)) + q = @queries.pop + (val == "NO") ? q.fail : q.succeed + else + break + end + end + end + end + + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/smtpclient.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/smtpclient.rb new file mode 100644 index 000000000..8d6612be5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/smtpclient.rb @@ -0,0 +1,365 @@ +#-- +# +# Author:: Francis Cianfrocca (gmail: blackhedd) +# Homepage:: http://rubyeventmachine.com +# Date:: 16 July 2006 +# +# See EventMachine and EventMachine::Connection for documentation and +# usage examples. +# +#---------------------------------------------------------------------------- +# +# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +# Gmail: blackhedd +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of either: 1) the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version; or 2) Ruby's License. +# +# See the file COPYING for complete licensing information. +# +#--------------------------------------------------------------------------- +# +# + +require 'ostruct' + +module EventMachine + module Protocols + + # Simple SMTP client + # + # @example + # email = EM::Protocols::SmtpClient.send( + # :domain=>"example.com", + # :host=>'localhost', + # :port=>25, # optional, defaults 25 + # :starttls=>true, # use ssl + # :from=>"sender@example.com", + # :to=> ["to_1@example.com", "to_2@example.com"], + # :header=> {"Subject" => "This is a subject line"}, + # :body=> "This is the body of the email" + # ) + # email.callback{ + # puts 'Email sent!' + # } + # email.errback{ |e| + # puts 'Email failed!' + # } + # + # Sending generated emails (using mailfactory) + # + # mail = MailFactory.new + # mail.to = 'someone@site.co' + # mail.from = 'me@site.com' + # mail.subject = 'hi!' + # mail.text = 'hello world' + # mail.html = '

hello world

' + # + # email = EM::P::SmtpClient.send( + # :domain=>'site.com', + # :from=>mail.from, + # :to=>mail.to, + # :content=>"#{mail.to_s}\r\n.\r\n" + # ) + # + class SmtpClient < Connection + include EventMachine::Deferrable + include EventMachine::Protocols::LineText2 + + def initialize + @succeeded = nil + @responder = nil + @code = nil + @msg = nil + end + + # :host => required String + # a string containing the IP address or host name of the SMTP server to connect to. + # :port => optional + # defaults to 25. + # :domain => required String + # This is passed as the argument to the EHLO command. + # :starttls => optional Boolean + # If it evaluates true, then the client will initiate STARTTLS with + # the server, and abort the connection if the negotiation doesn't succeed. + # TODO, need to be able to pass certificate parameters with this option. + # :auth => optional Hash of auth parameters + # If not given, then no auth will be attempted. + # (In that case, the connection will be aborted if the server requires auth.) + # Specify the hash value :type to determine the auth type, along with additional parameters + # depending on the type. + # Currently only :type => :plain is supported. Pass additional parameters :username (String), + # and :password (either a String or a Proc that will be called at auth-time). + # + # @example + # :auth => {:type=>:plain, :username=>"mickey@disney.com", :password=>"mouse"} + # + # :from => required String + # Specifies the sender of the message. Will be passed as the argument + # to the MAIL FROM. Do NOT enclose the argument in angle-bracket (<>) characters. + # The connection will abort if the server rejects the value. + # :to => required String or Array of Strings + # The recipient(s) of the message. Do NOT enclose + # any of the values in angle-brackets (<>) characters. It's NOT a fatal error if one or more + # recipients are rejected by the server. (Of course, if ALL of them are, the server will most + # likely trigger an error when we try to send data.) An array of codes containing the status + # of each requested recipient is available after the call completes. TODO, we should define + # an overridable stub that will be called on rejection of a recipient or a sender, giving + # user code the chance to try again or abort the connection. + # :header => Required hash of values to be transmitted in the header of the message. + # The hash keys are the names of the headers (do NOT append a trailing colon), and the values are strings + # containing the header values. TODO, support Arrays of header values, which would cause us to + # send that specific header line more than once. + # + # @example + # :header => {"Subject" => "Bogus", "CC" => "myboss@example.com"} + # + # :body => Optional string, defaults blank. + # This will be passed as the body of the email message. + # TODO, this needs to be significantly beefed up. As currently written, this requires the caller + # to properly format the input into CRLF-delimited lines of 7-bit characters in the standard + # SMTP transmission format. We need to be able to automatically convert binary data, and add + # correct line-breaks to text data. I think the :body parameter should remain as it is, and we + # should add a :content parameter that contains autoconversions and/or conversion parameters. + # Then we can check if either :body or :content is present and do the right thing. + # :content => Optional array or string + # Alternative to providing header and body, an array or string of raw data which MUST be in + # correct SMTP body format, including a trailing dot line + # :verbose => Optional. + # If true, will cause a lot of information (including the server-side of the + # conversation) to be dumped to $>. + # + def self.send args={} + args[:port] ||= 25 + args[:body] ||= "" + +=begin + (I don't think it's possible for EM#connect to throw an exception under normal + circumstances, so this original code is stubbed out. A connect-failure will result + in the #unbind method being called without calling #connection_completed.) + begin + EventMachine.connect( args[:host], args[:port], self) {|c| + # According to the EM docs, we will get here AFTER post_init is called. + c.args = args + c.set_comm_inactivity_timeout 60 + } + rescue + # We'll get here on a connect error. This code mimics the effect + # of a call to invoke_internal_error. Would be great to DRY this up. + # (Actually, it may be that we never get here, if EM#connect catches + # its errors internally.) + d = EM::DefaultDeferrable.new + d.set_deferred_status(:failed, {:error=>[:connect, 500, "unable to connect to server"]}) + d + end +=end + EventMachine.connect( args[:host], args[:port], self) {|c| + # According to the EM docs, we will get here AFTER post_init is called. + c.args = args + c.set_comm_inactivity_timeout 60 + } + end + + attr_writer :args + + # @private + def post_init + @return_values = OpenStruct.new + @return_values.start_time = Time.now + end + + # @private + def connection_completed + @responder = :receive_signon + @msg = [] + end + + # We can get here in a variety of ways, all of them being failures unless + # the @succeeded flag is set. If a protocol success was recorded, then don't + # set a deferred success because the caller will already have done it + # (no need to wait until the connection closes to invoke the callbacks). + # + # @private + def unbind + unless @succeeded + @return_values.elapsed_time = Time.now - @return_values.start_time + @return_values.responder = @responder + @return_values.code = @code + @return_values.message = @msg + set_deferred_status(:failed, @return_values) + end + end + + # @private + def receive_line ln + $>.puts ln if @args[:verbose] + @range = ln[0...1].to_i + @code = ln[0...3].to_i + @msg << ln[4..-1] + unless ln[3...4] == '-' + $>.puts @responder if @args[:verbose] + send @responder + @msg.clear + end + end + + private + + # We encountered an error from the server and will close the connection. + # Use the error and message the server returned. + # + def invoke_error + @return_values.elapsed_time = Time.now - @return_values.start_time + @return_values.responder = @responder + @return_values.code = @code + @return_values.message = @msg + set_deferred_status :failed, @return_values + send_data "QUIT\r\n" + close_connection_after_writing + end + + # We encountered an error on our side of the protocol and will close the connection. + # Use an extra-protocol error code (900) and use the message from the caller. + # + def invoke_internal_error msg = "???" + @return_values.elapsed_time = Time.now - @return_values.start_time + @return_values.responder = @responder + @return_values.code = 900 + @return_values.message = msg + set_deferred_status :failed, @return_values + send_data "QUIT\r\n" + close_connection_after_writing + end + + def receive_signon + return invoke_error unless @range == 2 + send_data "EHLO #{@args[:domain]}\r\n" + @responder = :receive_ehlo_response + end + + def receive_ehlo_response + return invoke_error unless @range == 2 + @server_caps = @msg + invoke_starttls + end + + def invoke_starttls + if @args[:starttls] + # It would be more sociable to first ask if @server_caps contains + # the string "STARTTLS" before we invoke it, but hey, life's too short. + send_data "STARTTLS\r\n" + @responder = :receive_starttls_response + else + invoke_auth + end + end + def receive_starttls_response + return invoke_error unless @range == 2 + start_tls + invoke_auth + end + + # Perform an authentication. If the caller didn't request one, then fall through + # to the mail-from state. + def invoke_auth + if @args[:auth] + if @args[:auth][:type] == :plain + psw = @args[:auth][:password] + if psw.respond_to?(:call) + psw = psw.call + end + #str = Base64::encode64("\0#{@args[:auth][:username]}\0#{psw}").chomp + str = ["\0#{@args[:auth][:username]}\0#{psw}"].pack("m").chomp + send_data "AUTH PLAIN #{str}\r\n" + @responder = :receive_auth_response + else + return invoke_internal_error("unsupported auth type") + end + else + invoke_mail_from + end + end + def receive_auth_response + return invoke_error unless @range == 2 + invoke_mail_from + end + + def invoke_mail_from + send_data "MAIL FROM: <#{@args[:from]}>\r\n" + @responder = :receive_mail_from_response + end + def receive_mail_from_response + return invoke_error unless @range == 2 + invoke_rcpt_to + end + + def invoke_rcpt_to + @rcpt_responses ||= [] + l = @rcpt_responses.length + to = @args[:to].is_a?(Array) ? @args[:to] : [@args[:to].to_s] + if l < to.length + send_data "RCPT TO: <#{to[l]}>\r\n" + @responder = :receive_rcpt_to_response + else + e = @rcpt_responses.select {|rr| rr.last == 2} + if e and e.length > 0 + invoke_data + else + invoke_error + end + end + end + def receive_rcpt_to_response + @rcpt_responses << [@code, @msg, @range] + invoke_rcpt_to + end + + def invoke_data + send_data "DATA\r\n" + @responder = :receive_data_response + end + def receive_data_response + return invoke_error unless @range == 3 + + # The data to send can be given either in @args[:content] (an array or string of raw data + # which MUST be in correct SMTP body format, including a trailing dot line), or a header and + # body given in @args[:header] and @args[:body]. + # + if @args[:content] + send_data @args[:content].to_s + else + # The header can be a hash or an array. + if @args[:header].is_a?(Hash) + (@args[:header] || {}).each {|k,v| send_data "#{k}: #{v}\r\n" } + else + send_data @args[:header].to_s + end + send_data "\r\n" + + if @args[:body].is_a?(Array) + @args[:body].each {|e| send_data e} + else + send_data @args[:body].to_s + end + + send_data "\r\n.\r\n" + end + + @responder = :receive_message_response + end + def receive_message_response + return invoke_error unless @range == 2 + send_data "QUIT\r\n" + close_connection_after_writing + @succeeded = true + @return_values.elapsed_time = Time.now - @return_values.start_time + @return_values.responder = @responder + @return_values.code = @code + @return_values.message = @msg + set_deferred_status :succeeded, @return_values + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/smtpserver.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/smtpserver.rb new file mode 100644 index 000000000..a26740ffd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/smtpserver.rb @@ -0,0 +1,640 @@ +#-- +# +# Author:: Francis Cianfrocca (gmail: blackhedd) +# Homepage:: http://rubyeventmachine.com +# Date:: 16 July 2006 +# +# See EventMachine and EventMachine::Connection for documentation and +# usage examples. +# +#---------------------------------------------------------------------------- +# +# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +# Gmail: blackhedd +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of either: 1) the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version; or 2) Ruby's License. +# +# See the file COPYING for complete licensing information. +# +#--------------------------------------------------------------------------- +# +# + +module EventMachine + module Protocols + + # This is a protocol handler for the server side of SMTP. + # It's NOT a complete SMTP server obeying all the semantics of servers conforming to + # RFC2821. Rather, it uses overridable method stubs to communicate protocol states + # and data to user code. User code is responsible for doing the right things with the + # data in order to get complete and correct SMTP server behavior. + # + # Simple SMTP server example: + # + # class EmailServer < EM::P::SmtpServer + # def receive_plain_auth(user, pass) + # true + # end + # + # def get_server_domain + # "mock.smtp.server.local" + # end + # + # def get_server_greeting + # "mock smtp server greets you with impunity" + # end + # + # def receive_sender(sender) + # current.sender = sender + # true + # end + # + # def receive_recipient(recipient) + # current.recipient = recipient + # true + # end + # + # def receive_message + # current.received = true + # current.completed_at = Time.now + # + # p [:received_email, current] + # @current = OpenStruct.new + # true + # end + # + # def receive_ehlo_domain(domain) + # @ehlo_domain = domain + # true + # end + # + # def receive_data_command + # current.data = "" + # true + # end + # + # def receive_data_chunk(data) + # current.data << data.join("\n") + # true + # end + # + # def receive_transaction + # if @ehlo_domain + # current.ehlo_domain = @ehlo_domain + # @ehlo_domain = nil + # end + # true + # end + # + # def current + # @current ||= OpenStruct.new + # end + # + # def self.start(host = 'localhost', port = 1025) + # require 'ostruct' + # @server = EM.start_server host, port, self + # end + # + # def self.stop + # if @server + # EM.stop_server @server + # @server = nil + # end + # end + # + # def self.running? + # !!@server + # end + # end + # + # EM.run{ EmailServer.start } + # + #-- + # Useful paragraphs in RFC-2821: + # 4.3.2: Concise list of command-reply sequences, in essence a text representation + # of the command state-machine. + # + # STARTTLS is defined in RFC2487. + # Observe that there are important rules governing whether a publicly-referenced server + # (meaning one whose Internet address appears in public MX records) may require the + # non-optional use of TLS. + # Non-optional TLS does not apply to EHLO, NOOP, QUIT or STARTTLS. + class SmtpServer < EventMachine::Connection + include Protocols::LineText2 + + HeloRegex = /\AHELO\s*/i + EhloRegex = /\AEHLO\s*/i + QuitRegex = /\AQUIT/i + MailFromRegex = /\AMAIL FROM:\s*/i + RcptToRegex = /\ARCPT TO:\s*/i + DataRegex = /\ADATA/i + NoopRegex = /\ANOOP/i + RsetRegex = /\ARSET/i + VrfyRegex = /\AVRFY\s+/i + ExpnRegex = /\AEXPN\s+/i + HelpRegex = /\AHELP/i + StarttlsRegex = /\ASTARTTLS/i + AuthRegex = /\AAUTH\s+/i + + + # Class variable containing default parameters that can be overridden + # in application code. + # Individual objects of this class will make an instance-local copy of + # the class variable, so that they can be reconfigured on a per-instance + # basis. + # + # Chunksize is the number of data lines we'll buffer before + # sending them to the application. TODO, make this user-configurable. + # + @@parms = { + :chunksize => 4000, + :verbose => false + } + def self.parms= parms={} + @@parms.merge!(parms) + end + + + + def initialize *args + super + @parms = @@parms + init_protocol_state + end + + def parms= parms={} + @parms.merge!(parms) + end + + # In SMTP, the server talks first. But by a (perhaps flawed) axiom in EM, + # #post_init will execute BEFORE the block passed to #start_server, for any + # given accepted connection. Since in this class we'll probably be getting + # a lot of initialization parameters, we want the guts of post_init to + # run AFTER the application has initialized the connection object. So we + # use a spawn to schedule the post_init to run later. + # It's a little weird, I admit. A reasonable alternative would be to set + # parameters as a class variable and to do that before accepting any connections. + # + # OBSOLETE, now we have @@parms. But the spawn is nice to keep as an illustration. + # + def post_init + #send_data "220 #{get_server_greeting}\r\n" (ORIGINAL) + #(EM.spawn {|x| x.send_data "220 #{x.get_server_greeting}\r\n"}).notify(self) + (EM.spawn {|x| x.send_server_greeting}).notify(self) + end + + def send_server_greeting + send_data "220 #{get_server_greeting}\r\n" + end + + def receive_line ln + @@parms[:verbose] and $>.puts ">>> #{ln}" + + return process_data_line(ln) if @state.include?(:data) + return process_auth_line(ln) if @state.include?(:auth_incomplete) + + case ln + when EhloRegex + process_ehlo $'.dup + when HeloRegex + process_helo $'.dup + when MailFromRegex + process_mail_from $'.dup + when RcptToRegex + process_rcpt_to $'.dup + when DataRegex + process_data + when RsetRegex + process_rset + when VrfyRegex + process_vrfy + when ExpnRegex + process_expn + when HelpRegex + process_help + when NoopRegex + process_noop + when QuitRegex + process_quit + when StarttlsRegex + process_starttls + when AuthRegex + process_auth $'.dup + else + process_unknown + end + end + + # TODO - implement this properly, the implementation is a stub! + def process_vrfy + send_data "250 Ok, but unimplemented\r\n" + end + # TODO - implement this properly, the implementation is a stub! + def process_help + send_data "250 Ok, but unimplemented\r\n" + end + # TODO - implement this properly, the implementation is a stub! + def process_expn + send_data "250 Ok, but unimplemented\r\n" + end + + #-- + # This is called at several points to restore the protocol state + # to a pre-transaction state. In essence, we "forget" having seen + # any valid command except EHLO and STARTTLS. + # We also have to callback user code, in case they're keeping track + # of senders, recipients, and whatnot. + # + # We try to follow the convention of avoiding the verb "receive" for + # internal method names except receive_line (which we inherit), and + # using only receive_xxx for user-overridable stubs. + # + # init_protocol_state is called when we initialize the connection as + # well as during reset_protocol_state. It does NOT call the user + # override method. This enables us to promise the users that they + # won't see the overridable fire except after EHLO and RSET, and + # after a message has been received. Although the latter may be wrong. + # The standard may allow multiple DATA segments with the same set of + # senders and recipients. + # + def reset_protocol_state + init_protocol_state + s,@state = @state,[] + @state << :starttls if s.include?(:starttls) + @state << :ehlo if s.include?(:ehlo) + receive_transaction + end + def init_protocol_state + @state ||= [] + end + + + #-- + # EHLO/HELO is always legal, per the standard. On success + # it always clears buffers and initiates a mail "transaction." + # Which means that a MAIL FROM must follow. + # + # Per the standard, an EHLO/HELO or a RSET "initiates" an email + # transaction. Thereafter, MAIL FROM must be received before + # RCPT TO, before DATA. Not sure what this specific ordering + # achieves semantically, but it does make it easier to + # implement. We also support user-specified requirements for + # STARTTLS and AUTH. We make it impossible to proceed to MAIL FROM + # without fulfilling tls and/or auth, if the user specified either + # or both as required. We need to check the extension standard + # for auth to see if a credential is discarded after a RSET along + # with all the rest of the state. We'll behave as if it is. + # Now clearly, we can't discard tls after its been negotiated + # without dropping the connection, so that flag doesn't get cleared. + # + def process_ehlo domain + if receive_ehlo_domain domain + send_data "250-#{get_server_domain}\r\n" + if @@parms[:starttls] + send_data "250-STARTTLS\r\n" + end + if @@parms[:auth] + send_data "250-AUTH PLAIN\r\n" + end + send_data "250-NO-SOLICITING\r\n" + # TODO, size needs to be configurable. + send_data "250 SIZE 20000000\r\n" + reset_protocol_state + @state << :ehlo + else + send_data "550 Requested action not taken\r\n" + end + end + + def process_helo domain + if receive_ehlo_domain domain.dup + send_data "250 #{get_server_domain}\r\n" + reset_protocol_state + @state << :ehlo + else + send_data "550 Requested action not taken\r\n" + end + end + + def process_quit + send_data "221 Ok\r\n" + close_connection_after_writing + end + + def process_noop + send_data "250 Ok\r\n" + end + + def process_unknown + send_data "500 Unknown command\r\n" + end + + #-- + # So far, only AUTH PLAIN is supported but we should do at least LOGIN as well. + # TODO, support clients that send AUTH PLAIN with no parameter, expecting a 3xx + # response and a continuation of the auth conversation. + # + def process_auth str + if @state.include?(:auth) + send_data "503 auth already issued\r\n" + elsif str =~ /\APLAIN\s?/i + if $'.length == 0 + # we got a partial response, so let the client know to send the rest + @state << :auth_incomplete + send_data("334 \r\n") + else + # we got the initial response, so go ahead & process it + process_auth_line($') + end + #elsif str =~ /\ALOGIN\s+/i + else + send_data "504 auth mechanism not available\r\n" + end + end + + def process_auth_line(line) + plain = line.unpack("m").first + _,user,psw = plain.split("\000") + if receive_plain_auth user,psw + send_data "235 authentication ok\r\n" + @state << :auth + else + send_data "535 invalid authentication\r\n" + end + @state.delete :auth_incomplete + end + + #-- + # Unusually, we can deal with a Deferrable returned from the user application. + # This was added to deal with a special case in a particular application, but + # it would be a nice idea to add it to the other user-code callbacks. + # + def process_data + unless @state.include?(:rcpt) + send_data "503 Operation sequence error\r\n" + else + succeeded = proc { + send_data "354 Send it\r\n" + @state << :data + @databuffer = [] + } + failed = proc { + send_data "550 Operation failed\r\n" + } + + d = receive_data_command + + if d.respond_to?(:callback) + d.callback(&succeeded) + d.errback(&failed) + else + (d ? succeeded : failed).call + end + end + end + + def process_rset + reset_protocol_state + receive_reset + send_data "250 Ok\r\n" + end + + def unbind + connection_ended + end + + #-- + # STARTTLS may not be issued before EHLO, or unless the user has chosen + # to support it. + # TODO, must support user-supplied certificates. + # + def process_starttls + if @@parms[:starttls] + if @state.include?(:starttls) + send_data "503 TLS Already negotiated\r\n" + elsif ! @state.include?(:ehlo) + send_data "503 EHLO required before STARTTLS\r\n" + else + send_data "220 Start TLS negotiation\r\n" + start_tls + @state << :starttls + end + else + process_unknown + end + end + + + #-- + # Requiring TLS is touchy, cf RFC2784. + # Requiring AUTH seems to be much more reasonable. + # We don't currently support any notion of deriving an authentication from the TLS + # negotiation, although that would certainly be reasonable. + # We DON'T allow MAIL FROM to be given twice. + # We DON'T enforce all the various rules for validating the sender or + # the reverse-path (like whether it should be null), and notifying the reverse + # path in case of delivery problems. All of that is left to the calling application. + # + def process_mail_from sender + if (@@parms[:starttls]==:required and !@state.include?(:starttls)) + send_data "550 This server requires STARTTLS before MAIL FROM\r\n" + elsif (@@parms[:auth]==:required and !@state.include?(:auth)) + send_data "550 This server requires authentication before MAIL FROM\r\n" + elsif @state.include?(:mail_from) + send_data "503 MAIL already given\r\n" + else + unless receive_sender sender + send_data "550 sender is unacceptable\r\n" + else + send_data "250 Ok\r\n" + @state << :mail_from + end + end + end + + #-- + # Since we require :mail_from to have been seen before we process RCPT TO, + # we don't need to repeat the tests for TLS and AUTH. + # Note that we don't remember or do anything else with the recipients. + # All of that is on the user code. + # TODO: we should enforce user-definable limits on the total number of + # recipients per transaction. + # We might want to make sure that a given recipient is only seen once, but + # for now we'll let that be the user's problem. + # + # User-written code can return a deferrable from receive_recipient. + # + def process_rcpt_to rcpt + unless @state.include?(:mail_from) + send_data "503 MAIL is required before RCPT\r\n" + else + succeeded = proc { + send_data "250 Ok\r\n" + @state << :rcpt unless @state.include?(:rcpt) + } + failed = proc { + send_data "550 recipient is unacceptable\r\n" + } + + d = receive_recipient rcpt + + if d.respond_to?(:set_deferred_status) + d.callback(&succeeded) + d.errback(&failed) + else + (d ? succeeded : failed).call + end + +=begin + unless receive_recipient rcpt + send_data "550 recipient is unacceptable\r\n" + else + send_data "250 Ok\r\n" + @state << :rcpt unless @state.include?(:rcpt) + end +=end + end + end + + + # Send the incoming data to the application one chunk at a time, rather than + # one line at a time. That lets the application be a little more flexible about + # storing to disk, etc. + # Since we clear the chunk array every time we submit it, the caller needs to be + # aware to do things like dup it if he wants to keep it around across calls. + # + # DON'T reset the transaction upon disposition of the incoming message. + # This means another DATA command can be accepted with the same sender and recipients. + # If the client wants to reset, he can call RSET. + # Not sure whether the standard requires a transaction-reset at this point, but it + # appears not to. + # + # User-written code can return a Deferrable as a response from receive_message. + # + def process_data_line ln + if ln == "." + if @databuffer.length > 0 + receive_data_chunk @databuffer + @databuffer.clear + end + + + succeeded = proc { + send_data "250 Message accepted\r\n" + } + failed = proc { + send_data "550 Message rejected\r\n" + } + + d = receive_message + + if d.respond_to?(:set_deferred_status) + d.callback(&succeeded) + d.errback(&failed) + else + (d ? succeeded : failed).call + end + + @state.delete :data + else + # slice off leading . if any + ln.slice!(0...1) if ln[0] == 46 + @databuffer << ln + if @databuffer.length > @@parms[:chunksize] + receive_data_chunk @databuffer + @databuffer.clear + end + end + end + + + #------------------------------------------ + # Everything from here on can be overridden in user code. + + # The greeting returned in the initial connection message to the client. + def get_server_greeting + "EventMachine SMTP Server" + end + # The domain name returned in the first line of the response to a + # successful EHLO or HELO command. + def get_server_domain + "Ok EventMachine SMTP Server" + end + + # A false response from this user-overridable method will cause a + # 550 error to be returned to the remote client. + # + def receive_ehlo_domain domain + true + end + + # Return true or false to indicate that the authentication is acceptable. + def receive_plain_auth user, password + true + end + + # Receives the argument of the MAIL FROM command. Return false to + # indicate to the remote client that the sender is not accepted. + # This can only be successfully called once per transaction. + # + def receive_sender sender + true + end + + # Receives the argument of a RCPT TO command. Can be given multiple + # times per transaction. Return false to reject the recipient. + # + def receive_recipient rcpt + true + end + + # Sent when the remote peer issues the RSET command. + # Since RSET is not allowed to fail (according to the protocol), + # we ignore any return value from user overrides of this method. + # + def receive_reset + end + + # Sent when the remote peer has ended the connection. + # + def connection_ended + end + + # Called when the remote peer sends the DATA command. + # Returning false will cause us to send a 550 error to the peer. + # This can be useful for dealing with problems that arise from processing + # the whole set of sender and recipients. + # + def receive_data_command + true + end + + # Sent when data from the remote peer is available. The size can be controlled + # by setting the :chunksize parameter. This call can be made multiple times. + # The goal is to strike a balance between sending the data to the application one + # line at a time, and holding all of a very large message in memory. + # + def receive_data_chunk data + @smtps_msg_size ||= 0 + @smtps_msg_size += data.join.length + STDERR.write "<#{@smtps_msg_size}>" + end + + # Sent after a message has been completely received. User code + # must return true or false to indicate whether the message has + # been accepted for delivery. + def receive_message + @@parms[:verbose] and $>.puts "Received complete message" + true + end + + # This is called when the protocol state is reset. It happens + # when the remote client calls EHLO/HELO or RSET. + def receive_transaction + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/socks4.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/socks4.rb new file mode 100644 index 000000000..132f32099 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/socks4.rb @@ -0,0 +1,66 @@ +module EventMachine + module Protocols + # Basic SOCKS v4 client implementation + # + # Use as you would any regular connection: + # + # class MyConn < EM::P::Socks4 + # def post_init + # send_data("sup") + # end + # + # def receive_data(data) + # send_data("you said: #{data}") + # end + # end + # + # EM.connect socks_host, socks_port, MyConn, host, port + # + class Socks4 < Connection + def initialize(host, port) + @host = Socket.gethostbyname(host).last + @port = port + @socks_error_code = nil + @buffer = '' + setup_methods + end + + def setup_methods + class << self + def post_init; socks_post_init; end + def receive_data(*a); socks_receive_data(*a); end + end + end + + def restore_methods + class << self + remove_method :post_init + remove_method :receive_data + end + end + + def socks_post_init + header = [4, 1, @port, @host, 0].flatten.pack("CCnA4C") + send_data(header) + end + + def socks_receive_data(data) + @buffer << data + return if @buffer.size < 8 + + header_resp = @buffer.slice! 0, 8 + _, r = header_resp.unpack("cc") + if r != 90 + @socks_error_code = r + close_connection + return + end + + restore_methods + + post_init + receive_data(@buffer) unless @buffer.empty? + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/stomp.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/stomp.rb new file mode 100644 index 000000000..3fa140614 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/stomp.rb @@ -0,0 +1,202 @@ +#-- +# +# Author:: Francis Cianfrocca (gmail: blackhedd) +# Homepage:: http://rubyeventmachine.com +# Date:: 15 November 2006 +# +# See EventMachine and EventMachine::Connection for documentation and +# usage examples. +# +#---------------------------------------------------------------------------- +# +# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +# Gmail: blackhedd +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of either: 1) the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version; or 2) Ruby's License. +# +# See the file COPYING for complete licensing information. +# +#--------------------------------------------------------------------------- +# +# +# + +module EventMachine + module Protocols + + # Implements Stomp (http://docs.codehaus.org/display/STOMP/Protocol). + # + # == Usage example + # + # module StompClient + # include EM::Protocols::Stomp + # + # def connection_completed + # connect :login => 'guest', :passcode => 'guest' + # end + # + # def receive_msg msg + # if msg.command == "CONNECTED" + # subscribe '/some/topic' + # else + # p ['got a message', msg] + # puts msg.body + # end + # end + # end + # + # EM.run{ + # EM.connect 'localhost', 61613, StompClient + # } + # + module Stomp + include LineText2 + + class Message + # The command associated with the message, usually 'CONNECTED' or 'MESSAGE' + attr_accessor :command + # Hash containing headers such as destination and message-id + attr_accessor :header + alias :headers :header + # Body of the message + attr_accessor :body + + # @private + def initialize + @header = {} + @state = :precommand + @content_length = nil + end + # @private + def consume_line line + if @state == :precommand + unless line =~ /\A\s*\Z/ + @command = line + @state = :headers + end + elsif @state == :headers + if line == "" + if @content_length + yield( [:sized_text, @content_length+1] ) + else + @state = :body + yield( [:unsized_text] ) + end + elsif line =~ /\A([^:]+):(.+)\Z/ + k = $1.dup.strip + v = $2.dup.strip + @header[k] = v + if k == "content-length" + @content_length = v.to_i + end + else + # This is a protocol error. How to signal it? + end + elsif @state == :body + @body = line + yield( [:dispatch] ) + end + end + end + + # @private + def send_frame verb, headers={}, body="" + ary = [verb, "\n"] + headers.each {|k,v| ary << "#{k}:#{v}\n" } + ary << "content-length: #{body.to_s.length}\n" + ary << "content-type: text/plain; charset=UTF-8\n" unless headers.has_key? 'content-type' + ary << "\n" + ary << body.to_s + ary << "\0" + send_data ary.join + end + + # @private + def receive_line line + @stomp_initialized || init_message_reader + @stomp_message.consume_line(line) {|outcome| + if outcome.first == :sized_text + set_text_mode outcome[1] + elsif outcome.first == :unsized_text + set_delimiter "\0" + elsif outcome.first == :dispatch + receive_msg(@stomp_message) if respond_to?(:receive_msg) + init_message_reader + end + } + end + + # @private + def receive_binary_data data + @stomp_message.body = data[0..-2] + receive_msg(@stomp_message) if respond_to?(:receive_msg) + init_message_reader + end + + # @private + def init_message_reader + @stomp_initialized = true + set_delimiter "\n" + set_line_mode + @stomp_message = Message.new + end + + # Invoked with an incoming Stomp::Message received from the STOMP server + def receive_msg msg + # stub, overwrite this in your handler + end + + # CONNECT command, for authentication + # + # connect :login => 'guest', :passcode => 'guest' + # + def connect parms={} + send_frame "CONNECT", parms + end + + # SEND command, for publishing messages to a topic + # + # send '/topic/name', 'some message here' + # + def send destination, body, parms={} + send_frame "SEND", parms.merge( :destination=>destination ), body.to_s + end + + # SUBSCRIBE command, for subscribing to topics + # + # subscribe '/topic/name', false + # + def subscribe dest, ack=false + send_frame "SUBSCRIBE", {:destination=>dest, :ack=>(ack ? "client" : "auto")} + end + + # ACK command, for acknowledging receipt of messages + # + # module StompClient + # include EM::P::Stomp + # + # def connection_completed + # connect :login => 'guest', :passcode => 'guest' + # # subscribe with ack mode + # subscribe '/some/topic', true + # end + # + # def receive_msg msg + # if msg.command == "MESSAGE" + # ack msg.headers['message-id'] + # puts msg.body + # end + # end + # end + # + def ack msgid + send_frame "ACK", 'message-id'=> msgid + end + + end + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/tcptest.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/tcptest.rb new file mode 100644 index 000000000..318789303 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/protocols/tcptest.rb @@ -0,0 +1,54 @@ +#-- +# +# Author:: Francis Cianfrocca (gmail: blackhedd) +# Homepage:: http://rubyeventmachine.com +# Date:: 16 July 2006 +# +# See EventMachine and EventMachine::Connection for documentation and +# usage examples. +# +#---------------------------------------------------------------------------- +# +# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +# Gmail: blackhedd +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of either: 1) the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version; or 2) Ruby's License. +# +# See the file COPYING for complete licensing information. +# +#--------------------------------------------------------------------------- +# +# +# + +module EventMachine + module Protocols + + # @private + class TcpConnectTester < Connection + include EventMachine::Deferrable + + def self.test( host, port ) + EventMachine.connect( host, port, self ) + end + + def post_init + @start_time = Time.now + end + + def connection_completed + @completed = true + set_deferred_status :succeeded, (Time.now - @start_time) + close_connection + end + + def unbind + set_deferred_status :failed, (Time.now - @start_time) unless @completed + end + end + + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/pure_ruby.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/pure_ruby.rb new file mode 100644 index 000000000..b81afb633 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/pure_ruby.rb @@ -0,0 +1,1017 @@ +#-- +# +# Author:: Francis Cianfrocca (gmail: blackhedd) +# Homepage:: http://rubyeventmachine.com +# Date:: 8 Apr 2006 +# +# See EventMachine and EventMachine::Connection for documentation and +# usage examples. +# +#---------------------------------------------------------------------------- +# +# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +# Gmail: blackhedd +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of either: 1) the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version; or 2) Ruby's License. +# +# See the file COPYING for complete licensing information. +# +#------------------------------------------------------------------- +# +# + +# TODO List: +# TCP-connects currently assume non-blocking connect is available- need to +# degrade automatically on versions of Ruby prior to June 2006. +# + +require 'singleton' +require 'forwardable' +require 'socket' +require 'fcntl' +require 'set' + +# @private +module EventMachine + class << self + # This is mostly useful for automated tests. + # Return a distinctive symbol so the caller knows whether he's dealing + # with an extension or with a pure-Ruby library. + # @private + def library_type + :pure_ruby + end + + # @private + def initialize_event_machine + Reactor.instance.initialize_for_run + end + + # Changed 04Oct06: intervals from the caller are now in milliseconds, but our native-ruby + # processor still wants them in seconds. + # @private + def add_oneshot_timer interval + Reactor.instance.install_oneshot_timer(interval / 1000) + end + + # @private + def run_machine + Reactor.instance.run + end + + # @private + def release_machine + end + + # @private + def stop + Reactor.instance.stop + end + + # @private + def connect_server host, port + bind_connect_server nil, nil, host, port + end + + # @private + def bind_connect_server bind_addr, bind_port, host, port + EvmaTCPClient.connect(bind_addr, bind_port, host, port).uuid + end + + # @private + def send_data target, data, datalength + selectable = Reactor.instance.get_selectable( target ) or raise "unknown send_data target" + selectable.send_data data + end + + + # The extension version does NOT raise any kind of an error if an attempt is made + # to close a non-existent connection. Not sure whether we should. For now, we'll + # raise an error here in that case. + # @private + def close_connection target, after_writing + selectable = Reactor.instance.get_selectable( target ) or raise "unknown close_connection target" + selectable.schedule_close after_writing + end + + # @private + def start_tcp_server host, port + (s = EvmaTCPServer.start_server host, port) or raise "no acceptor" + s.uuid + end + + # @private + def stop_tcp_server sig + s = Reactor.instance.get_selectable(sig) + s.schedule_close + end + + # @private + def start_unix_server chain + (s = EvmaUNIXServer.start_server chain) or raise "no acceptor" + s.uuid + end + + # @private + def connect_unix_server chain + EvmaUNIXClient.connect(chain).uuid + end + + # @private + def signal_loopbreak + Reactor.instance.signal_loopbreak + end + + # @private + def get_peername sig + selectable = Reactor.instance.get_selectable( sig ) or raise "unknown get_peername target" + selectable.get_peername + end + + # @private + def open_udp_socket host, port + EvmaUDPSocket.create(host, port).uuid + end + + # This is currently only for UDP! + # We need to make it work with unix-domain sockets as well. + # @private + def send_datagram target, data, datalength, host, port + selectable = Reactor.instance.get_selectable( target ) or raise "unknown send_data target" + selectable.send_datagram data, Socket::pack_sockaddr_in(port, host) + end + + + # Sets reactor quantum in milliseconds. The underlying Reactor function wants a (possibly + # fractional) number of seconds. + # @private + def set_timer_quantum interval + Reactor.instance.set_timer_quantum(( 1.0 * interval) / 1000.0) + end + + # This method is a harmless no-op in the pure-Ruby implementation. This is intended to ensure + # that user code behaves properly across different EM implementations. + # @private + def epoll + end + + # This method is not implemented for pure-Ruby implementation + # @private + def ssl? + false + end + + # This method is a no-op in the pure-Ruby implementation. We simply return Ruby's built-in + # per-process file-descriptor limit. + # @private + def set_rlimit_nofile n + 1024 + end + + # This method is a harmless no-op in pure Ruby, which doesn't have a built-in limit + # on the number of available timers. + # @private + def set_max_timer_count n + end + + # @private + def get_sock_opt signature, level, optname + selectable = Reactor.instance.get_selectable( signature ) or raise "unknown get_peername target" + selectable.getsockopt level, optname + end + + # @private + def set_sock_opt signature, level, optname, optval + selectable = Reactor.instance.get_selectable( signature ) or raise "unknown get_peername target" + selectable.setsockopt level, optname, optval + end + + # @private + def send_file_data sig, filename + sz = File.size(filename) + raise "file too large" if sz > 32*1024 + data = + begin + File.read filename + rescue + "" + end + send_data sig, data, data.length + end + + # @private + def get_outbound_data_size sig + r = Reactor.instance.get_selectable( sig ) or raise "unknown get_outbound_data_size target" + r.get_outbound_data_size + end + + # @private + def read_keyboard + EvmaKeyboard.open.uuid + end + + # @private + def set_comm_inactivity_timeout sig, tm + r = Reactor.instance.get_selectable( sig ) or raise "unknown set_comm_inactivity_timeout target" + r.set_inactivity_timeout tm + end + end +end + + +module EventMachine + # @private + class Error < Exception; end +end + +module EventMachine + # @private + class Connection + # @private + def get_outbound_data_size + EventMachine::get_outbound_data_size @signature + end + end +end + +module EventMachine + + # Factored out so we can substitute other implementations + # here if desired, such as the one in ActiveRBAC. + # @private + module UuidGenerator + def self.generate + @ix ||= 0 + @ix += 1 + end + end +end + + +module EventMachine + # @private + TimerFired = 100 + # @private + ConnectionData = 101 + # @private + ConnectionUnbound = 102 + # @private + ConnectionAccepted = 103 + # @private + ConnectionCompleted = 104 + # @private + LoopbreakSignalled = 105 +end + +module EventMachine + # @private + class Reactor + include Singleton + + HeartbeatInterval = 2 + + attr_reader :current_loop_time + + def initialize + initialize_for_run + end + + def install_oneshot_timer interval + uuid = UuidGenerator::generate + #@timers << [Time.now + interval, uuid] + #@timers.sort! {|a,b| a.first <=> b.first} + @timers.add([Time.now + interval, uuid]) + uuid + end + + # Called before run, this is a good place to clear out arrays + # with cruft that may be left over from a previous run. + # @private + def initialize_for_run + @running = false + @stop_scheduled = false + @selectables ||= {}; @selectables.clear + @timers = SortedSet.new # [] + set_timer_quantum(0.1) + @current_loop_time = Time.now + @next_heartbeat = @current_loop_time + HeartbeatInterval + end + + def add_selectable io + @selectables[io.uuid] = io + end + + def get_selectable uuid + @selectables[uuid] + end + + def run + raise Error.new( "already running" ) if @running + @running = true + + begin + open_loopbreaker + + loop { + @current_loop_time = Time.now + + break if @stop_scheduled + run_timers + break if @stop_scheduled + crank_selectables + break if @stop_scheduled + run_heartbeats + } + ensure + close_loopbreaker + @selectables.each {|k, io| io.close} + @selectables.clear + + @running = false + end + + end + + def run_timers + @timers.each {|t| + if t.first <= @current_loop_time + @timers.delete t + EventMachine::event_callback "", TimerFired, t.last + else + break + end + } + #while @timers.length > 0 and @timers.first.first <= now + # t = @timers.shift + # EventMachine::event_callback "", TimerFired, t.last + #end + end + + def run_heartbeats + if @next_heartbeat <= @current_loop_time + @next_heartbeat = @current_loop_time + HeartbeatInterval + @selectables.each {|k,io| io.heartbeat} + end + end + + def crank_selectables + #$stderr.write 'R' + + readers = @selectables.values.select {|io| io.select_for_reading?} + writers = @selectables.values.select {|io| io.select_for_writing?} + + s = select( readers, writers, nil, @timer_quantum) + + s and s[1] and s[1].each {|w| w.eventable_write } + s and s[0] and s[0].each {|r| r.eventable_read } + + @selectables.delete_if {|k,io| + if io.close_scheduled? + io.close + true + end + } + end + + # #stop + def stop + raise Error.new( "not running") unless @running + @stop_scheduled = true + end + + def open_loopbreaker + # Can't use an IO.pipe because they can't be set nonselectable in Windows. + # Pick a random localhost UDP port. + #@loopbreak_writer.close if @loopbreak_writer + #rd,@loopbreak_writer = IO.pipe + @loopbreak_reader = UDPSocket.new + @loopbreak_writer = UDPSocket.new + bound = false + 100.times { + @loopbreak_port = rand(10000) + 40000 + begin + @loopbreak_reader.bind "localhost", @loopbreak_port + bound = true + break + rescue + end + } + raise "Unable to bind Loopbreaker" unless bound + LoopbreakReader.new(@loopbreak_reader) + end + + def close_loopbreaker + @loopbreak_writer.close + @loopbreak_writer = nil + end + + def signal_loopbreak + #@loopbreak_writer.write '+' if @loopbreak_writer + @loopbreak_writer.send('+',0,"localhost",@loopbreak_port) if @loopbreak_writer + end + + def set_timer_quantum interval_in_seconds + @timer_quantum = interval_in_seconds + end + + end + +end + +# @private +class IO + extend Forwardable + def_delegator :@my_selectable, :close_scheduled? + def_delegator :@my_selectable, :select_for_reading? + def_delegator :@my_selectable, :select_for_writing? + def_delegator :@my_selectable, :eventable_read + def_delegator :@my_selectable, :eventable_write + def_delegator :@my_selectable, :uuid + def_delegator :@my_selectable, :send_data + def_delegator :@my_selectable, :schedule_close + def_delegator :@my_selectable, :get_peername + def_delegator :@my_selectable, :send_datagram + def_delegator :@my_selectable, :get_outbound_data_size + def_delegator :@my_selectable, :set_inactivity_timeout + def_delegator :@my_selectable, :heartbeat +end + +module EventMachine + # @private + class Selectable + + attr_reader :io, :uuid + + def initialize io + @uuid = UuidGenerator.generate + @io = io + @last_activity = Reactor.instance.current_loop_time + + if defined?(Fcntl::F_GETFL) + m = @io.fcntl(Fcntl::F_GETFL, 0) + @io.fcntl(Fcntl::F_SETFL, Fcntl::O_NONBLOCK | m) + else + # Windows doesn't define F_GETFL. + # It's not very reliable about setting descriptors nonblocking either. + begin + s = Socket.for_fd(@io.fileno) + s.fcntl( Fcntl::F_SETFL, Fcntl::O_NONBLOCK ) + rescue Errno::EINVAL, Errno::EBADF + warn "Serious error: unable to set descriptor non-blocking" + end + end + # TODO, should set CLOEXEC on Unix? + + @close_scheduled = false + @close_requested = false + + se = self; @io.instance_eval { @my_selectable = se } + Reactor.instance.add_selectable @io + end + + def close_scheduled? + @close_scheduled + end + + def select_for_reading? + false + end + + def select_for_writing? + false + end + + def get_peername + nil + end + + def set_inactivity_timeout tm + @inactivity_timeout = tm + end + + def heartbeat + end + end + +end + +module EventMachine + # @private + class StreamObject < Selectable + def initialize io + super io + @outbound_q = [] + end + + # If we have to close, or a close-after-writing has been requested, + # then don't read any more data. + def select_for_reading? + true unless (@close_scheduled || @close_requested) + end + + # If we have to close, don't select for writing. + # Otherwise, see if the protocol is ready to close. + # If not, see if he has data to send. + # If a close-after-writing has been requested and the outbound queue + # is empty, convert the status to close_scheduled. + def select_for_writing? + unless @close_scheduled + if @outbound_q.empty? + @close_scheduled = true if @close_requested + false + else + true + end + end + end + + # Proper nonblocking I/O was added to Ruby 1.8.4 in May 2006. + # If we have it, then we can read multiple times safely to improve + # performance. + # The last-activity clock ASSUMES that we only come here when we + # have selected readable. + # TODO, coalesce multiple reads into a single event. + # TODO, do the function check somewhere else and cache it. + def eventable_read + @last_activity = Reactor.instance.current_loop_time + begin + if io.respond_to?(:read_nonblock) + 10.times { + data = io.read_nonblock(4096) + EventMachine::event_callback uuid, ConnectionData, data + } + else + data = io.sysread(4096) + EventMachine::event_callback uuid, ConnectionData, data + end + rescue Errno::EAGAIN, Errno::EWOULDBLOCK + # no-op + rescue Errno::ECONNRESET, Errno::ECONNREFUSED, EOFError + @close_scheduled = true + EventMachine::event_callback uuid, ConnectionUnbound, nil + end + + end + + # Provisional implementation. Will be re-implemented in subclasses. + # TODO: Complete this implementation. As it stands, this only writes + # a single packet per cycle. Highly inefficient, but required unless + # we're running on a Ruby with proper nonblocking I/O (Ruby 1.8.4 + # built from sources from May 25, 2006 or newer). + # We need to improve the loop so it writes multiple times, however + # not more than a certain number of bytes per cycle, otherwise + # one busy connection could hog output buffers and slow down other + # connections. Also we should coalesce small writes. + # URGENT TODO: Coalesce small writes. They are a performance killer. + # The last-activity recorder ASSUMES we'll only come here if we've + # selected writable. + def eventable_write + # coalesce the outbound array here, perhaps + @last_activity = Reactor.instance.current_loop_time + while data = @outbound_q.shift do + begin + data = data.to_s + w = if io.respond_to?(:write_nonblock) + io.write_nonblock data + else + io.syswrite data + end + + if w < data.length + @outbound_q.unshift data[w..-1] + break + end + rescue Errno::EAGAIN + @outbound_q.unshift data + rescue EOFError, Errno::ECONNRESET, Errno::ECONNREFUSED + @close_scheduled = true + @outbound_q.clear + end + end + + end + + # #send_data + def send_data data + # TODO, coalesce here perhaps by being smarter about appending to @outbound_q.last? + unless @close_scheduled or @close_requested or !data or data.length <= 0 + @outbound_q << data.to_s + end + end + + # #schedule_close + # The application wants to close the connection. + def schedule_close after_writing + if after_writing + @close_requested = true + else + @close_scheduled = true + end + end + + # #get_peername + # This is defined in the normal way on connected stream objects. + # Return an object that is suitable for passing to Socket#unpack_sockaddr_in or variants. + # We could also use a convenience method that did the unpacking automatically. + def get_peername + io.getpeername + end + + # #get_outbound_data_size + def get_outbound_data_size + @outbound_q.inject(0) {|memo,obj| memo += (obj || "").length} + end + + def heartbeat + if @inactivity_timeout and @inactivity_timeout > 0 and (@last_activity + @inactivity_timeout) < Reactor.instance.current_loop_time + schedule_close true + end + end + end + + +end + + +#-------------------------------------------------------------- + + + +module EventMachine + # @private + class EvmaTCPClient < StreamObject + + def self.connect bind_addr, bind_port, host, port + sd = Socket.new( Socket::AF_INET, Socket::SOCK_STREAM, 0 ) + sd.bind( Socket.pack_sockaddr_in( bind_port, bind_addr )) if bind_addr + + begin + # TODO, this assumes a current Ruby snapshot. + # We need to degrade to a nonblocking connect otherwise. + sd.connect_nonblock( Socket.pack_sockaddr_in( port, host )) + rescue Errno::EINPROGRESS + end + EvmaTCPClient.new sd + end + + + def initialize io + super + @pending = true + end + + + def select_for_writing? + @pending ? true : super + end + + def select_for_reading? + @pending ? false : super + end + + def eventable_write + if @pending + @pending = false + if 0 == io.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR).unpack("i").first + EventMachine::event_callback uuid, ConnectionCompleted, "" + end + else + super + end + end + + + + end +end + + + +module EventMachine + # @private + class EvmaKeyboard < StreamObject + + def self.open + EvmaKeyboard.new STDIN + end + + + def initialize io + super + end + + + def select_for_writing? + false + end + + def select_for_reading? + true + end + + + end +end + + + +module EventMachine + # @private + class EvmaUNIXClient < StreamObject + + def self.connect chain + sd = Socket.new( Socket::AF_LOCAL, Socket::SOCK_STREAM, 0 ) + begin + # TODO, this assumes a current Ruby snapshot. + # We need to degrade to a nonblocking connect otherwise. + sd.connect_nonblock( Socket.pack_sockaddr_un( chain )) + rescue Errno::EINPROGRESS + end + EvmaUNIXClient.new sd + end + + + def initialize io + super + @pending = true + end + + + def select_for_writing? + @pending ? true : super + end + + def select_for_reading? + @pending ? false : super + end + + def eventable_write + if @pending + @pending = false + if 0 == io.getsockopt(Socket::SOL_SOCKET, Socket::SO_ERROR).unpack("i").first + EventMachine::event_callback uuid, ConnectionCompleted, "" + end + else + super + end + end + + + + end +end + + +#-------------------------------------------------------------- + +module EventMachine + # @private + class EvmaTCPServer < Selectable + + # TODO, refactor and unify with EvmaUNIXServer. + + class << self + # Versions of ruby 1.8.4 later than May 26 2006 will work properly + # with an object of type TCPServer. Prior versions won't so we + # play it safe and just build a socket. + # + def start_server host, port + sd = Socket.new( Socket::AF_INET, Socket::SOCK_STREAM, 0 ) + sd.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true ) + sd.bind( Socket.pack_sockaddr_in( port, host )) + sd.listen( 50 ) # 5 is what you see in all the books. Ain't enough. + EvmaTCPServer.new sd + end + end + + def initialize io + super io + end + + + def select_for_reading? + true + end + + #-- + # accept_nonblock returns an array consisting of the accepted + # socket and a sockaddr_in which names the peer. + # Don't accept more than 10 at a time. + def eventable_read + begin + 10.times { + descriptor,peername = io.accept_nonblock + sd = StreamObject.new descriptor + EventMachine::event_callback uuid, ConnectionAccepted, sd.uuid + } + rescue Errno::EWOULDBLOCK, Errno::EAGAIN + end + end + + #-- + # + def schedule_close + @close_scheduled = true + end + + end +end + + +#-------------------------------------------------------------- + +module EventMachine + # @private + class EvmaUNIXServer < Selectable + + # TODO, refactor and unify with EvmaTCPServer. + + class << self + # Versions of ruby 1.8.4 later than May 26 2006 will work properly + # with an object of type TCPServer. Prior versions won't so we + # play it safe and just build a socket. + # + def start_server chain + sd = Socket.new( Socket::AF_LOCAL, Socket::SOCK_STREAM, 0 ) + sd.setsockopt( Socket::SOL_SOCKET, Socket::SO_REUSEADDR, true ) + sd.bind( Socket.pack_sockaddr_un( chain )) + sd.listen( 50 ) # 5 is what you see in all the books. Ain't enough. + EvmaUNIXServer.new sd + end + end + + def initialize io + super io + end + + + def select_for_reading? + true + end + + #-- + # accept_nonblock returns an array consisting of the accepted + # socket and a sockaddr_in which names the peer. + # Don't accept more than 10 at a time. + def eventable_read + begin + 10.times { + descriptor,peername = io.accept_nonblock + sd = StreamObject.new descriptor + EventMachine::event_callback uuid, ConnectionAccepted, sd.uuid + } + rescue Errno::EWOULDBLOCK, Errno::EAGAIN + end + end + + #-- + # + def schedule_close + @close_scheduled = true + end + + end +end + + + +#-------------------------------------------------------------- + +module EventMachine + # @private + class LoopbreakReader < Selectable + + def select_for_reading? + true + end + + def eventable_read + io.sysread(128) + EventMachine::event_callback "", LoopbreakSignalled, "" + end + + end +end + + + +# @private +module EventMachine + # @private + class DatagramObject < Selectable + def initialize io + super io + @outbound_q = [] + end + + # #send_datagram + def send_datagram data, target + # TODO, coalesce here perhaps by being smarter about appending to @outbound_q.last? + unless @close_scheduled or @close_requested + @outbound_q << [data.to_s, target] + end + end + + # #select_for_writing? + def select_for_writing? + unless @close_scheduled + if @outbound_q.empty? + @close_scheduled = true if @close_requested + false + else + true + end + end + end + + # #select_for_reading? + def select_for_reading? + true + end + + # #get_outbound_data_size + def get_outbound_data_size + @outbound_q.inject(0) {|memo,obj| memo += (obj || "").length} + end + + + end + + +end + + +module EventMachine + # @private + class EvmaUDPSocket < DatagramObject + + class << self + def create host, port + sd = Socket.new( Socket::AF_INET, Socket::SOCK_DGRAM, 0 ) + sd.bind Socket::pack_sockaddr_in( port, host ) + EvmaUDPSocket.new sd + end + end + + # #eventable_write + # This really belongs in DatagramObject, but there is some UDP-specific stuff. + def eventable_write + 40.times { + break if @outbound_q.empty? + begin + data,target = @outbound_q.first + + # This damn better be nonblocking. + io.send data.to_s, 0, target + + @outbound_q.shift + rescue Errno::EAGAIN + # It's not been observed in testing that we ever get here. + # True to the definition, packets will be accepted and quietly dropped + # if the system is under pressure. + break + rescue EOFError, Errno::ECONNRESET + @close_scheduled = true + @outbound_q.clear + end + } + end + + # Proper nonblocking I/O was added to Ruby 1.8.4 in May 2006. + # If we have it, then we can read multiple times safely to improve + # performance. + def eventable_read + begin + if io.respond_to?(:recvfrom_nonblock) + 40.times { + data,@return_address = io.recvfrom_nonblock(16384) + EventMachine::event_callback uuid, ConnectionData, data + @return_address = nil + } + else + raise "unimplemented datagram-read operation on this Ruby" + end + rescue Errno::EAGAIN + # no-op + rescue Errno::ECONNRESET, EOFError + @close_scheduled = true + EventMachine::event_callback uuid, ConnectionUnbound, nil + end + + end + + + def send_data data + send_datagram data, @return_address + end + + end +end + +# load base EM api on top, now that we have the underlying pure ruby +# implementation defined +require 'eventmachine' + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/queue.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/queue.rb new file mode 100644 index 000000000..3d9a4d2a2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/queue.rb @@ -0,0 +1,71 @@ +module EventMachine + # A cross thread, reactor scheduled, linear queue. + # + # This class provides a simple queue abstraction on top of the reactor + # scheduler. It services two primary purposes: + # + # * API sugar for stateful protocols + # * Pushing processing onto the reactor thread + # + # @example + # + # q = EM::Queue.new + # q.push('one', 'two', 'three') + # 3.times do + # q.pop { |msg| puts(msg) } + # end + # + class Queue + def initialize + @items = [] + @popq = [] + end + + # Pop items off the queue, running the block on the reactor thread. The pop + # will not happen immediately, but at some point in the future, either in + # the next tick, if the queue has data, or when the queue is populated. + # + # @return [NilClass] nil + def pop(*a, &b) + cb = EM::Callback(*a, &b) + EM.schedule do + if @items.empty? + @popq << cb + else + cb.call @items.shift + end + end + nil # Always returns nil + end + + # Push items onto the queue in the reactor thread. The items will not appear + # in the queue immediately, but will be scheduled for addition during the + # next reactor tick. + def push(*items) + EM.schedule do + @items.push(*items) + @popq.shift.call @items.shift until @items.empty? || @popq.empty? + end + end + alias :<< :push + + # @return [Boolean] + # @note This is a peek, it's not thread safe, and may only tend toward accuracy. + def empty? + @items.empty? + end + + # @return [Integer] Queue size + # @note This is a peek, it's not thread safe, and may only tend toward accuracy. + def size + @items.size + end + + # @return [Integer] Waiting size + # @note This is a peek at the number of jobs that are currently waiting on the Queue + def num_waiting + @popq.size + end + + end # Queue +end # EventMachine diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/resolver.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/resolver.rb new file mode 100644 index 000000000..fa74e3477 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/resolver.rb @@ -0,0 +1,192 @@ +module EventMachine + module DNS + class Resolver + + def self.resolve(hostname) + Request.new(socket, hostname) + end + + @socket = @nameservers = nil + + def self.socket + if !@socket || (@socket && @socket.error?) + @socket = Socket.open + + @hosts = {} + IO.readlines('/etc/hosts').each do |line| + next if line =~ /^#/ + addr, host = line.split(/\s+/) + + if @hosts[host] + @hosts[host] << addr + else + @hosts[host] = [addr] + end + end + end + + @socket + end + + def self.nameservers=(ns) + @nameservers = ns + end + + def self.nameservers + if !@nameservers + @nameservers = [] + IO.readlines('/etc/resolv.conf').each do |line| + if line =~ /^nameserver (.+)$/ + @nameservers << $1.split(/\s+/).first + end + end + end + @nameservers + end + + def self.nameserver + nameservers.shuffle.first + end + + def self.hosts + @hosts + end + end + + class RequestIdAlreadyUsed < RuntimeError; end + + class Socket < EventMachine::Connection + def self.open + EventMachine::open_datagram_socket('0.0.0.0', 0, self) + end + + def initialize + @nameserver = nil + end + + def post_init + @requests = {} + EM.add_periodic_timer(0.1, &method(:tick)) + end + + def unbind + end + + def tick + @requests.each do |id,req| + req.tick + end + end + + def register_request(id, req) + if @requests.has_key?(id) + raise RequestIdAlreadyUsed + else + @requests[id] = req + end + end + + def send_packet(pkt) + send_datagram(pkt, nameserver, 53) + end + + def nameserver=(ns) + @nameserver = ns + end + + def nameserver + @nameserver || Resolver.nameserver + end + + # Decodes the packet, looks for the request and passes the + # response over to the requester + def receive_data(data) + msg = nil + begin + msg = Resolv::DNS::Message.decode data + rescue + else + req = @requests[msg.id] + if req + @requests.delete(msg.id) + req.receive_answer(msg) + end + end + end + end + + class Request + include Deferrable + attr_accessor :retry_interval, :max_tries + + def initialize(socket, hostname) + @socket = socket + @hostname = hostname + @tries = 0 + @last_send = Time.at(0) + @retry_interval = 3 + @max_tries = 5 + + if addrs = Resolver.hosts[hostname] + succeed addrs + else + EM.next_tick { tick } + end + end + + def tick + # Break early if nothing to do + return if @last_send + @retry_interval > Time.now + if @tries < @max_tries + send + else + fail 'retries exceeded' + end + end + + def receive_answer(msg) + addrs = [] + msg.each_answer do |name,ttl,data| + if data.kind_of?(Resolv::DNS::Resource::IN::A) || + data.kind_of?(Resolv::DNS::Resource::IN::AAAA) + addrs << data.address.to_s + end + end + + if addrs.empty? + fail "rcode=#{msg.rcode}" + else + succeed addrs + end + end + + private + + def send + @tries += 1 + @last_send = Time.now + @socket.send_packet(packet.encode) + end + + def id + begin + @id = rand(65535) + @socket.register_request(@id, self) + rescue RequestIdAlreadyUsed + retry + end unless defined?(@id) + + @id + end + + def packet + msg = Resolv::DNS::Message.new + msg.id = id + msg.rd = 1 + msg.add_question @hostname, Resolv::DNS::Resource::IN::A + msg + end + + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/spawnable.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/spawnable.rb new file mode 100644 index 000000000..35c087d06 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/spawnable.rb @@ -0,0 +1,84 @@ +#-- +# +# Author:: Francis Cianfrocca (gmail: blackhedd) +# Homepage:: http://rubyeventmachine.com +# Date:: 25 Aug 2007 +# +# See EventMachine and EventMachine::Connection for documentation and +# usage examples. +# +#---------------------------------------------------------------------------- +# +# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +# Gmail: blackhedd +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of either: 1) the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version; or 2) Ruby's License. +# +# See the file COPYING for complete licensing information. +# +#--------------------------------------------------------------------------- +# +# + +module EventMachine + # Support for Erlang-style processes. + # + class SpawnedProcess + # Send a message to the spawned process + def notify *x + me = self + EM.next_tick { + # A notification executes in the context of this + # SpawnedProcess object. That makes self and notify + # work as one would expect. + # + y = me.call(*x) + if y and y.respond_to?(:pull_out_yield_block) + a,b = y.pull_out_yield_block + set_receiver a + self.notify if b + end + } + end + alias_method :resume, :notify + alias_method :run, :notify # for formulations like (EM.spawn {xxx}).run + + def set_receiver blk + (class << self ; self ; end).class_eval do + remove_method :call if method_defined? :call + define_method :call, blk + end + end + + end + + # @private + class YieldBlockFromSpawnedProcess + def initialize block, notify + @block = [block,notify] + end + def pull_out_yield_block + @block + end + end + + # Spawn an erlang-style process + def self.spawn &block + s = SpawnedProcess.new + s.set_receiver block + s + end + + # @private + def self.yield &block + return YieldBlockFromSpawnedProcess.new( block, false ) + end + + # @private + def self.yield_and_notify &block + return YieldBlockFromSpawnedProcess.new( block, true ) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/streamer.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/streamer.rb new file mode 100644 index 000000000..cf49c8836 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/streamer.rb @@ -0,0 +1,118 @@ +module EventMachine + # Streams a file over a given connection. Streaming begins once the object is + # instantiated. Typically FileStreamer instances are not reused. + # + # Streaming uses buffering for files larger than 16K and uses so-called fast file reader (a C++ extension) + # if available (it is part of eventmachine gem itself). + # + # @example + # + # module FileSender + # def post_init + # streamer = EventMachine::FileStreamer.new(self, '/tmp/bigfile.tar') + # streamer.callback{ + # # file was sent successfully + # close_connection_after_writing + # } + # end + # end + # + # + # @author Francis Cianfrocca + class FileStreamer + include Deferrable + + # Use mapped streamer for files bigger than 16k + MappingThreshold = 16384 + # Wait until next tick to send more data when 50k is still in the outgoing buffer + BackpressureLevel = 50000 + # Send 16k chunks at a time + ChunkSize = 16384 + + # @param [EventMachine::Connection] connection + # @param [String] filename File path + # + # @option args [Boolean] :http_chunks (false) Use HTTP 1.1 style chunked-encoding semantics. + def initialize connection, filename, args = {} + @connection = connection + @http_chunks = args[:http_chunks] + + if File.exist?(filename) + @size = File.size(filename) + if @size <= MappingThreshold + stream_without_mapping filename + else + stream_with_mapping filename + end + else + fail "file not found" + end + end + + # @private + def stream_without_mapping filename + if @http_chunks + @connection.send_data "#{@size.to_s(16)}\r\n" + @connection.send_file_data filename + @connection.send_data "\r\n0\r\n\r\n" + else + @connection.send_file_data filename + end + succeed + end + private :stream_without_mapping + + # @private + def stream_with_mapping filename + ensure_mapping_extension_is_present + + @position = 0 + @mapping = EventMachine::FastFileReader::Mapper.new filename + stream_one_chunk + end + private :stream_with_mapping + + # Used internally to stream one chunk at a time over multiple reactor ticks + # @private + def stream_one_chunk + loop { + if @position < @size + if @connection.get_outbound_data_size > BackpressureLevel + EventMachine::next_tick {stream_one_chunk} + break + else + len = @size - @position + len = ChunkSize if (len > ChunkSize) + + @connection.send_data( "#{len.to_s(16)}\r\n" ) if @http_chunks + @connection.send_data( @mapping.get_chunk( @position, len )) + @connection.send_data("\r\n") if @http_chunks + + @position += len + end + else + @connection.send_data "0\r\n\r\n" if @http_chunks + @mapping.close + succeed + break + end + } + end + + # + # We use an outboard extension class to get memory-mapped files. + # It's outboard to avoid polluting the core distro, but that means + # there's a "hidden" dependency on it. The first time we get here in + # any run, try to load up the dependency extension. User code will see + # a LoadError if it's not available, but code that doesn't require + # mapped files will work fine without it. This is a somewhat difficult + # compromise between usability and proper modularization. + # + # @private + def ensure_mapping_extension_is_present + @@fastfilereader ||= (require 'fastfilereaderext') + end + private :ensure_mapping_extension_is_present + + end # FileStreamer +end # EventMachine diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/threaded_resource.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/threaded_resource.rb new file mode 100644 index 000000000..11bb5745a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/threaded_resource.rb @@ -0,0 +1,90 @@ +module EventMachine + # = EventMachine::ThreadedResource + # + # A threaded resource is a "quick and dirty" wrapper around the concept of + # wiring up synchronous code into a standard EM::Pool. This is useful to keep + # interfaces coherent and provide a simple approach at "making an interface + # async-ish". + # + # General usage is to wrap libraries that do not support EventMachine, or to + # have a specific number of dedicated high-cpu worker resources. + # + # == Basic Usage example + # + # This example requires the cassandra gem. The cassandra gem contains an + # EventMachine interface, but it's sadly Fiber based and thus only works on + # 1.9. It also requires (potentially) complex stack switching logic to reach + # completion of nested operations. By contrast this approach provides a block + # in which normal synchronous code can occur, but makes no attempt to wire the + # IO into EventMachines C++ IO implementations, instead relying on the reactor + # pattern in rb_thread_select. + # + # cassandra_dispatcher = ThreadedResource.new do + # Cassandra.new('allthethings', '127.0.0.1:9160') + # end + # + # pool = EM::Pool.new + # + # pool.add cassandra_dispatcher + # + # # If we don't care about the result: + # pool.perform do |dispatcher| + # # The following block executes inside a dedicated thread, and should not + # # access EventMachine things: + # dispatcher.dispatch do |cassandra| + # cassandra.insert(:Things, '10', 'stuff' => 'things') + # end + # end + # + # # Example where we care about the result: + # pool.perform do |dispatcher| + # # The dispatch block is executed in the resources thread. + # completion = dispatcher.dispatch do |cassandra| + # cassandra.get(:Things, '10', 'stuff') + # end + # + # # This block will be yielded on the EM thread: + # completion.callback do |result| + # EM.do_something_with(result) + # end + # + # completion + # end + class ThreadedResource + + # The block should return the resource that will be yielded in a dispatch. + def initialize + @resource = yield + + @running = true + @queue = ::Queue.new + @thread = Thread.new do + @queue.pop.call while @running + end + end + + # Called on the EM thread, generally in a perform block to return a + # completion for the work. + def dispatch + completion = EM::Completion.new + @queue << lambda do + begin + result = yield @resource + completion.succeed result + rescue Exception => e + completion.fail e + end + end + completion + end + + # Kill the internal thread. should only be used to cleanup - generally + # only required for tests. + def shutdown + @running = false + @queue << lambda {} + @thread.join + end + + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/tick_loop.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/tick_loop.rb new file mode 100644 index 000000000..d8f648d9a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/tick_loop.rb @@ -0,0 +1,85 @@ +module EventMachine + # Creates and immediately starts an EventMachine::TickLoop + def self.tick_loop(*a, &b) + TickLoop.new(*a, &b).start + end + + # A TickLoop is useful when one needs to distribute amounts of work + # throughout ticks in order to maintain response times. It is also useful for + # simple repeated checks and metrics. + # + # # Here we run through an array one item per tick until it is empty, + # # printing each element. + # # When the array is empty, we return :stop from the callback, and the + # # loop will terminate. + # # When the loop terminates, the on_stop callbacks will be called. + # EM.run do + # array = (1..100).to_a + # + # tickloop = EM.tick_loop do + # if array.empty? + # :stop + # else + # puts array.shift + # end + # end + # + # tickloop.on_stop { EM.stop } + # end + # + class TickLoop + + # Arguments: A callback (EM::Callback) to call each tick. If the call + # returns +:stop+ then the loop will be stopped. Any other value is + # ignored. + def initialize(*a, &b) + @work = EM::Callback(*a, &b) + @stops = [] + @stopped = true + end + + # Arguments: A callback (EM::Callback) to call once on the next stop (or + # immediately if already stopped). + def on_stop(*a, &b) + if @stopped + EM::Callback(*a, &b).call + else + @stops << EM::Callback(*a, &b) + end + end + + # Stop the tick loop immediately, and call it's on_stop callbacks. + def stop + @stopped = true + until @stops.empty? + @stops.shift.call + end + end + + # Query if the loop is stopped. + def stopped? + @stopped + end + + # Start the tick loop, will raise argument error if the loop is already + # running. + def start + raise ArgumentError, "double start" unless @stopped + @stopped = false + schedule + end + + private + def schedule + EM.next_tick do + next if @stopped + if @work.call == :stop + stop + else + schedule + end + end + self + end + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/timers.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/timers.rb new file mode 100644 index 000000000..41cd9595b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/timers.rb @@ -0,0 +1,61 @@ +module EventMachine + # Creates a one-time timer + # + # timer = EventMachine::Timer.new(5) do + # # this will never fire because we cancel it + # end + # timer.cancel + # + class Timer + # Create a new timer that fires after a given number of seconds + def initialize interval, callback=nil, &block + @signature = EventMachine::add_timer(interval, callback || block) + end + + # Cancel the timer + def cancel + EventMachine.send :cancel_timer, @signature + end + end + + # Creates a periodic timer + # + # @example + # n = 0 + # timer = EventMachine::PeriodicTimer.new(5) do + # puts "the time is #{Time.now}" + # timer.cancel if (n+=1) > 5 + # end + # + class PeriodicTimer + # Create a new periodic timer that executes every interval seconds + def initialize interval, callback=nil, &block + @interval = interval + @code = callback || block + @cancelled = false + @work = method(:fire) + schedule + end + + # Cancel the periodic timer + def cancel + @cancelled = true + end + + # Fire the timer every interval seconds + attr_accessor :interval + + # @private + def schedule + EventMachine::add_timer @interval, @work + end + + # @private + def fire + unless @cancelled + @code.call + schedule + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/version.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/version.rb new file mode 100644 index 000000000..f4b94cf00 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/em/version.rb @@ -0,0 +1,3 @@ +module EventMachine + VERSION = "1.0.0.rc.4" +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/eventmachine.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/eventmachine.rb new file mode 100644 index 000000000..4e02bea11 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/eventmachine.rb @@ -0,0 +1,1532 @@ +if RUBY_PLATFORM =~ /java/ + require 'java' + require 'jeventmachine' +elsif defined?(EventMachine.library_type) and EventMachine.library_type == :pure_ruby + # assume 'em/pure_ruby' was loaded already +else + begin + require 'rubyeventmachine' + rescue LoadError + warn "Unable to load the EventMachine C extension; To use the pure-ruby reactor, require 'em/pure_ruby'" + raise + end +end + +require 'em/version' +require 'em/pool' +require 'em/deferrable' +require 'em/future' +require 'em/streamer' +require 'em/spawnable' +require 'em/processes' +require 'em/iterator' +require 'em/buftok' +require 'em/timers' +require 'em/protocols' +require 'em/connection' +require 'em/callback' +require 'em/queue' +require 'em/channel' +require 'em/file_watch' +require 'em/process_watch' +require 'em/tick_loop' +require 'em/resolver' +require 'em/completion' +require 'em/threaded_resource' + +require 'shellwords' +require 'thread' +require 'resolv' + +# Top-level EventMachine namespace. If you are looking for EventMachine examples, see {file:docs/GettingStarted.md EventMachine tutorial}. +# +# ## Key methods ## +# ### Starting and stopping the event loop ### +# +# * {EventMachine.run} +# * {EventMachine.stop_event_loop} +# +# ### Implementing clients ### +# +# * {EventMachine.connect} +# +# ### Implementing servers ### +# +# * {EventMachine.start_server} +# +# ### Working with timers ### +# +# * {EventMachine.add_timer} +# * {EventMachine.add_periodic_timer} +# * {EventMachine.cancel_timer} +# +# ### Working with blocking tasks ### +# +# * {EventMachine.defer} +# * {EventMachine.next_tick} +# +# ### Efficient proxying ### +# +# * {EventMachine.enable_proxy} +# * {EventMachine.disable_proxy} +module EventMachine + class << self + # Exposed to allow joining on the thread, when run in a multithreaded + # environment. Performing other actions on the thread has undefined + # semantics (read: a dangerous endevor). + # + # @return [Thread] + attr_reader :reactor_thread + end + @next_tick_mutex = Mutex.new + @reactor_running = false + @next_tick_queue = [] + @tails = [] + @threadpool = @threadqueue = @resultqueue = nil + @all_threads_spawned = false + + # System errnos + # @private + ERRNOS = Errno::constants.grep(/^E/).inject(Hash.new(:unknown)) { |hash, name| + errno = Errno.__send__(:const_get, name) + hash[errno::Errno] = errno + hash + } + + # Initializes and runs an event loop. This method only returns if code inside the block passed to this method + # calls {EventMachine.stop_event_loop}. The block is executed after initializing its internal event loop but *before* running the loop, + # therefore this block is the right place to call any code that needs event loop to run, for example, {EventMachine.start_server}, + # {EventMachine.connect} or similar methods of libraries that use EventMachine under the hood + # (like `EventMachine::HttpRequest.new` or `AMQP.start`). + # + # Programs that are run for long periods of time (e.g. servers) usually start event loop by calling {EventMachine.run}, and let it + # run "forever". It's also possible to use {EventMachine.run} to make a single client-connection to a remote server, + # process the data flow from that single connection, and then call {EventMachine.stop_event_loop} to stop, in other words, + # to run event loop for a short period of time (necessary to complete some operation) and then shut it down. + # + # Once event loop is running, it is perfectly possible to start multiple servers and clients simultaneously: content-aware + # proxies like [Proxymachine](https://github.com/mojombo/proxymachine) do just that. + # + # ## Using EventMachine with Ruby on Rails and other Web application frameworks ## + # + # Standalone applications often run event loop on the main thread, thus blocking for their entire lifespan. In case of Web applications, + # if you are running an EventMachine-based app server such as [Thin](http://code.macournoyer.com/thin/) or [Goliath](https://github.com/postrank-labs/goliath/), + # they start event loop for you. Servers like Unicorn, Apache Passenger or Mongrel occupy main Ruby thread to serve HTTP(S) requests. This means + # that calling {EventMachine.run} on the same thread is not an option (it will result in Web server never binding to the socket). + # In that case, start event loop in a separate thread as demonstrated below. + # + # + # @example Starting EventMachine event loop in the current thread to run the "Hello, world"-like Echo server example + # + # #!/usr/bin/env ruby + # + # require 'rubygems' # or use Bundler.setup + # require 'eventmachine' + # + # class EchoServer < EM::Connection + # def receive_data(data) + # send_data(data) + # end + # end + # + # EventMachine.run do + # EventMachine.start_server("0.0.0.0", 10000, EchoServer) + # end + # + # + # @example Starting EventMachine event loop in a separate thread + # + # # doesn't block current thread, can be used with Ruby on Rails, Sinatra, Merb, Rack + # # and any other application server that occupies main Ruby thread. + # Thread.new { EventMachine.run } + # + # + # @note This method blocks calling thread. If you need to start EventMachine event loop from a Web app + # running on a non event-driven server (Unicorn, Apache Passenger, Mongrel), do it in a separate thread like demonstrated + # in one of the examples. + # @see file:docs/GettingStarted.md Getting started with EventMachine + # @see EventMachine.stop_event_loop + def self.run blk=nil, tail=nil, &block + # Obsoleted the use_threads mechanism. + # 25Nov06: Added the begin/ensure block. We need to be sure that release_machine + # gets called even if an exception gets thrown within any of the user code + # that the event loop runs. The best way to see this is to run a unit + # test with two functions, each of which calls {EventMachine.run} and each of + # which throws something inside of #run. Without the ensure, the second test + # will start without release_machine being called and will immediately throw + + # + if reactor_running? and @reactor_pid != Process.pid + # Reactor was started in a different parent, meaning we have forked. + # Clean up reactor state so a new reactor boots up in this child. + stop_event_loop + release_machine + @reactor_running = false + end + + tail and @tails.unshift(tail) + + if reactor_running? + (b = blk || block) and b.call # next_tick(b) + else + @conns = {} + @acceptors = {} + @timers = {} + @wrapped_exception = nil + @next_tick_queue ||= [] + @tails ||= [] + begin + @reactor_pid = Process.pid + @reactor_running = true + initialize_event_machine + (b = blk || block) and add_timer(0, b) + if @next_tick_queue && !@next_tick_queue.empty? + add_timer(0) { signal_loopbreak } + end + @reactor_thread = Thread.current + run_machine + ensure + until @tails.empty? + @tails.pop.call + end + + begin + release_machine + ensure + if @threadpool + @threadpool.each { |t| t.exit } + @threadpool.each do |t| + next unless t.alive? + begin + # Thread#kill! does not exist on 1.9 or rbx, and raises + # NotImplemented on jruby + t.kill! + rescue NoMethodError, NotImplementedError + t.kill + # XXX t.join here? + end + end + @threadqueue = nil + @resultqueue = nil + @threadpool = nil + @all_threads_spawned = false + end + + @next_tick_queue = [] + end + @reactor_running = false + @reactor_thread = nil + end + + raise @wrapped_exception if @wrapped_exception + end + end + + # Sugars a common use case. Will pass the given block to #run, but will terminate + # the reactor loop and exit the function as soon as the code in the block completes. + # (Normally, {EventMachine.run} keeps running indefinitely, even after the block supplied to it + # finishes running, until user code calls {EventMachine.stop}) + # + def self.run_block &block + pr = proc { + block.call + EventMachine::stop + } + run(&pr) + end + + # @return [Boolean] true if the calling thread is the same thread as the reactor. + def self.reactor_thread? + Thread.current == @reactor_thread + end + + # Runs the given callback on the reactor thread, or immediately if called + # from the reactor thread. Accepts the same arguments as {EventMachine::Callback} + def self.schedule(*a, &b) + cb = Callback(*a, &b) + if reactor_running? && reactor_thread? + cb.call + else + next_tick { cb.call } + end + end + + # Forks a new process, properly stops the reactor and then calls {EventMachine.run} inside of it again, passing your block. + def self.fork_reactor &block + # This implementation is subject to change, especially if we clean up the relationship + # of EM#run to @reactor_running. + # Original patch by Aman Gupta. + # + Kernel.fork do + if self.reactor_running? + self.stop_event_loop + self.release_machine + @reactor_running = false + end + self.run block + end + end + + # Adds a block to call as the reactor is shutting down. + # + # These callbacks are called in the _reverse_ order to which they are added. + # + # @example Scheduling operations to be run when EventMachine event loop is stopped + # + # EventMachine.run do + # EventMachine.add_shutdown_hook { puts "b" } + # EventMachine.add_shutdown_hook { puts "a" } + # EventMachine.stop + # end + # + # # Outputs: + # # a + # # b + # + def self.add_shutdown_hook &block + @tails << block + end + + # Adds a one-shot timer to the event loop. + # Call it with one or two parameters. The first parameters is a delay-time + # expressed in *seconds* (not milliseconds). The second parameter, if + # present, must be an object that responds to :call. If 2nd parameter is not given, then you + # can also simply pass a block to the method call. + # + # This method may be called from the block passed to {EventMachine.run} + # or from any callback method. It schedules execution of the proc or block + # passed to it, after the passage of an interval of time equal to + # *at least* the number of seconds specified in the first parameter to + # the call. + # + # {EventMachine.add_timer} is a non-blocking method. Callbacks can and will + # be called during the interval of time that the timer is in effect. + # There is no built-in limit to the number of timers that can be outstanding at + # any given time. + # + # @example Setting a one-shot timer with EventMachine + # + # EventMachine.run { + # puts "Starting the run now: #{Time.now}" + # EventMachine.add_timer 5, proc { puts "Executing timer event: #{Time.now}" } + # EventMachine.add_timer(10) { puts "Executing timer event: #{Time.now}" } + # } + # + # @param [Integer] delay Delay in seconds + # @see EventMachine::Timer + # @see EventMachine.add_periodic_timer + def self.add_timer *args, &block + interval = args.shift + code = args.shift || block + if code + # check too many timers! + s = add_oneshot_timer((interval.to_f * 1000).to_i) + @timers[s] = code + s + end + end + + # Adds a periodic timer to the event loop. + # It takes the same parameters as the one-shot timer method, {EventMachine.add_timer}. + # This method schedules execution of the given block repeatedly, at intervals + # of time *at least* as great as the number of seconds given in the first + # parameter to the call. + # + # @example Write a dollar-sign to stderr every five seconds, without blocking + # + # EventMachine.run { + # EventMachine.add_periodic_timer( 5 ) { $stderr.write "$" } + # } + # + # @param [Integer] delay Delay in seconds + # + # @see EventMachine::PeriodicTimer + # @see EventMachine.add_timer + # + def self.add_periodic_timer *args, &block + interval = args.shift + code = args.shift || block + + EventMachine::PeriodicTimer.new(interval, code) + end + + + # Cancel a timer (can be a callback or an {EventMachine::Timer} instance). + # + # @param [#cancel, #call] timer_or_sig A timer to cancel + # @see EventMachine::Timer#cancel + def self.cancel_timer timer_or_sig + if timer_or_sig.respond_to? :cancel + timer_or_sig.cancel + else + @timers[timer_or_sig] = false if @timers.has_key?(timer_or_sig) + end + end + + + # Causes the processing loop to stop executing, which will cause all open connections and accepting servers + # to be run down and closed. Connection termination callbacks added using {EventMachine.add_shutdown_hook} + # will be called as part of running this method. + # + # When all of this processing is complete, the call to {EventMachine.run} which started the processing loop + # will return and program flow will resume from the statement following {EventMachine.run} call. + # + # @example Stopping a running EventMachine event loop + # + # require 'rubygems' + # require 'eventmachine' + # + # module Redmond + # def post_init + # puts "We're sending a dumb HTTP request to the remote peer." + # send_data "GET / HTTP/1.1\r\nHost: www.microsoft.com\r\n\r\n" + # end + # + # def receive_data data + # puts "We received #{data.length} bytes from the remote peer." + # puts "We're going to stop the event loop now." + # EventMachine::stop_event_loop + # end + # + # def unbind + # puts "A connection has terminated." + # end + # end + # + # puts "We're starting the event loop now." + # EventMachine.run { + # EventMachine.connect "www.microsoft.com", 80, Redmond + # } + # puts "The event loop has stopped." + # + # # This program will produce approximately the following output: + # # + # # We're starting the event loop now. + # # We're sending a dumb HTTP request to the remote peer. + # # We received 1440 bytes from the remote peer. + # # We're going to stop the event loop now. + # # A connection has terminated. + # # The event loop has stopped. + # + # + def self.stop_event_loop + EventMachine::stop + end + + # Initiates a TCP server (socket acceptor) on the specified IP address and port. + # + # The IP address must be valid on the machine where the program + # runs, and the process must be privileged enough to listen + # on the specified port (on Unix-like systems, superuser privileges + # are usually required to listen on any port lower than 1024). + # Only one listener may be running on any given address/port + # combination. start_server will fail if the given address and port + # are already listening on the machine, either because of a prior call + # to {.start_server} or some unrelated process running on the machine. + # If {.start_server} succeeds, the new network listener becomes active + # immediately and starts accepting connections from remote peers, + # and these connections generate callback events that are processed + # by the code specified in the handler parameter to {.start_server}. + # + # The optional handler which is passed to this method is the key + # to EventMachine's ability to handle particular network protocols. + # The handler parameter passed to start_server must be a Ruby Module + # that you must define. When the network server that is started by + # start_server accepts a new connection, it instantiates a new + # object of an anonymous class that is inherited from {EventMachine::Connection}, + # *into which your handler module have been included*. Arguments passed into start_server + # after the class name are passed into the constructor during the instantiation. + # + # Your handler module may override any of the methods in {EventMachine::Connection}, + # such as {EventMachine::Connection#receive_data}, in order to implement the specific behavior + # of the network protocol. + # + # Callbacks invoked in response to network events *always* take place + # within the execution context of the object derived from {EventMachine::Connection} + # extended by your handler module. There is one object per connection, and + # all of the callbacks invoked for a particular connection take the form + # of instance methods called against the corresponding {EventMachine::Connection} + # object. Therefore, you are free to define whatever instance variables you + # wish, in order to contain the per-connection state required by the network protocol you are + # implementing. + # + # {EventMachine.start_server} is usually called inside the block passed to {EventMachine.run}, + # but it can be called from any EventMachine callback. {EventMachine.start_server} will fail + # unless the EventMachine event loop is currently running (which is why + # it's often called in the block suppled to {EventMachine.run}). + # + # You may call start_server any number of times to start up network + # listeners on different address/port combinations. The servers will + # all run simultaneously. More interestingly, each individual call to start_server + # can specify a different handler module and thus implement a different + # network protocol from all the others. + # + # @example + # + # require 'rubygems' + # require 'eventmachine' + # + # # Here is an example of a server that counts lines of input from the remote + # # peer and sends back the total number of lines received, after each line. + # # Try the example with more than one client connection opened via telnet, + # # and you will see that the line count increments independently on each + # # of the client connections. Also very important to note, is that the + # # handler for the receive_data function, which our handler redefines, may + # # not assume that the data it receives observes any kind of message boundaries. + # # Also, to use this example, be sure to change the server and port parameters + # # to the start_server call to values appropriate for your environment. + # module LineCounter + # MaxLinesPerConnection = 10 + # + # def post_init + # puts "Received a new connection" + # @data_received = "" + # @line_count = 0 + # end + # + # def receive_data data + # @data_received << data + # while @data_received.slice!( /^[^\n]*[\n]/m ) + # @line_count += 1 + # send_data "received #{@line_count} lines so far\r\n" + # @line_count == MaxLinesPerConnection and close_connection_after_writing + # end + # end + # end + # + # EventMachine.run { + # host, port = "192.168.0.100", 8090 + # EventMachine.start_server host, port, LineCounter + # puts "Now accepting connections on address #{host}, port #{port}..." + # EventMachine.add_periodic_timer(10) { $stderr.write "*" } + # } + # + # @param [String] server Host to bind to. + # @param [Integer] port Port to bind to. + # @param [Module, Class] handler A module or class that implements connection callbacks + # + # @note Don't forget that in order to bind to ports < 1024 on Linux, *BSD and Mac OS X your process must have superuser privileges. + # + # @see file:docs/GettingStarted.md EventMachine tutorial + # @see EventMachine.stop_server + def self.start_server server, port=nil, handler=nil, *args, &block + begin + port = Integer(port) + rescue ArgumentError, TypeError + # there was no port, so server must be a unix domain socket + # the port argument is actually the handler, and the handler is one of the args + args.unshift handler if handler + handler = port + port = nil + end if port + + klass = klass_from_handler(Connection, handler, *args) + + s = if port + start_tcp_server server, port + else + start_unix_server server + end + @acceptors[s] = [klass,args,block] + s + end + + + # Stop a TCP server socket that was started with {EventMachine.start_server}. + # @see EventMachine.start_server + def self.stop_server signature + EventMachine::stop_tcp_server signature + end + + # Start a Unix-domain server. + # + # Note that this is an alias for {EventMachine.start_server}, which can be used to start both + # TCP and Unix-domain servers. + # + # @see EventMachine.start_server + def self.start_unix_domain_server filename, *args, &block + start_server filename, *args, &block + end + + # Initiates a TCP connection to a remote server and sets up event handling for the connection. + # {EventMachine.connect} requires event loop to be running (see {EventMachine.run}). + # + # {EventMachine.connect} takes the IP address (or hostname) and + # port of the remote server you want to connect to. + # It also takes an optional handler (a module or a subclass of {EventMachine::Connection}) which you must define, that + # contains the callbacks that will be invoked by the event loop on behalf of the connection. + # + # Learn more about connection lifecycle callbacks in the {file:docs/GettingStarted.md EventMachine tutorial} and + # {file:docs/ConnectionLifecycleCallbacks.md Connection lifecycle guide}. + # + # + # @example + # + # # Here's a program which connects to a web server, sends a naive + # # request, parses the HTTP header of the response, and then + # # (antisocially) ends the event loop, which automatically drops the connection + # # (and incidentally calls the connection's unbind method). + # module DumbHttpClient + # def post_init + # send_data "GET / HTTP/1.1\r\nHost: _\r\n\r\n" + # @data = "" + # @parsed = false + # end + # + # def receive_data data + # @data << data + # if !@parsed and @data =~ /[\n][\r]*[\n]/m + # @parsed = true + # puts "RECEIVED HTTP HEADER:" + # $`.each {|line| puts ">>> #{line}" } + # + # puts "Now we'll terminate the loop, which will also close the connection" + # EventMachine::stop_event_loop + # end + # end + # + # def unbind + # puts "A connection has terminated" + # end + # end + # + # EventMachine.run { + # EventMachine.connect "www.bayshorenetworks.com", 80, DumbHttpClient + # } + # puts "The event loop has ended" + # + # + # @example Defining protocol handler as a class + # + # class MyProtocolHandler < EventMachine::Connection + # def initialize *args + # super + # # whatever else you want to do here + # end + # + # # ... + # end + # + # + # @param [String] server Host to connect to + # @param [Integer] port Port to connect to + # @param [Module, Class] handler A module or class that implements connection lifecycle callbacks + # + # @see EventMachine.start_server + # @see file:docs/GettingStarted.md EventMachine tutorial + def self.connect server, port=nil, handler=nil, *args, &blk + # EventMachine::connect initiates a TCP connection to a remote + # server and sets up event-handling for the connection. + # It internally creates an object that should not be handled + # by the caller. HOWEVER, it's often convenient to get the + # object to set up interfacing to other objects in the system. + # We return the newly-created anonymous-class object to the caller. + # It's expected that a considerable amount of code will depend + # on this behavior, so don't change it. + # + # Ok, added support for a user-defined block, 13Apr06. + # This leads us to an interesting choice because of the + # presence of the post_init call, which happens in the + # initialize method of the new object. We call the user's + # block and pass the new object to it. This is a great + # way to do protocol-specific initiation. It happens + # AFTER post_init has been called on the object, which I + # certainly hope is the right choice. + # Don't change this lightly, because accepted connections + # are different from connected ones and we don't want + # to have them behave differently with respect to post_init + # if at all possible. + + bind_connect nil, nil, server, port, handler, *args, &blk + end + + # This method is like {EventMachine.connect}, but allows for a local address/port + # to bind the connection to. + # + # @see EventMachine.connect + def self.bind_connect bind_addr, bind_port, server, port=nil, handler=nil, *args + begin + port = Integer(port) + rescue ArgumentError, TypeError + # there was no port, so server must be a unix domain socket + # the port argument is actually the handler, and the handler is one of the args + args.unshift handler if handler + handler = port + port = nil + end if port + + klass = klass_from_handler(Connection, handler, *args) + + s = if port + if bind_addr + bind_connect_server bind_addr, bind_port.to_i, server, port + else + connect_server server, port + end + else + connect_unix_server server + end + + c = klass.new s, *args + @conns[s] = c + block_given? and yield c + c + end + + # {EventMachine.watch} registers a given file descriptor or IO object with the eventloop. The + # file descriptor will not be modified (it will remain blocking or non-blocking). + # + # The eventloop can be used to process readable and writable events on the file descriptor, using + # {EventMachine::Connection#notify_readable=} and {EventMachine::Connection#notify_writable=} + # + # {EventMachine::Connection#notify_readable?} and {EventMachine::Connection#notify_writable?} can be used + # to check what events are enabled on the connection. + # + # To detach the file descriptor, use {EventMachine::Connection#detach} + # + # @example + # + # module SimpleHttpClient + # def notify_readable + # header = @io.readline + # + # if header == "\r\n" + # # detach returns the file descriptor number (fd == @io.fileno) + # fd = detach + # end + # rescue EOFError + # detach + # end + # + # def unbind + # EM.next_tick do + # # socket is detached from the eventloop, but still open + # data = @io.read + # end + # end + # end + # + # EventMachine.run { + # sock = TCPSocket.new('site.com', 80) + # sock.write("GET / HTTP/1.0\r\n\r\n") + # conn = EventMachine.watch(sock, SimpleHttpClient) + # conn.notify_readable = true + # } + # + # @author Riham Aldakkak (eSpace Technologies) + def EventMachine::watch io, handler=nil, *args, &blk + attach_io io, true, handler, *args, &blk + end + + # Attaches an IO object or file descriptor to the eventloop as a regular connection. + # The file descriptor will be set as non-blocking, and EventMachine will process + # receive_data and send_data events on it as it would for any other connection. + # + # To watch a fd instead, use {EventMachine.watch}, which will not alter the state of the socket + # and fire notify_readable and notify_writable events instead. + def EventMachine::attach io, handler=nil, *args, &blk + attach_io io, false, handler, *args, &blk + end + + # @private + def EventMachine::attach_io io, watch_mode, handler=nil, *args + klass = klass_from_handler(Connection, handler, *args) + + if !watch_mode and klass.public_instance_methods.any?{|m| [:notify_readable, :notify_writable].include? m.to_sym } + raise ArgumentError, "notify_readable/writable with EM.attach is not supported. Use EM.watch(io){ |c| c.notify_readable = true }" + end + + if io.respond_to?(:fileno) + fd = defined?(JRuby) ? JRuby.runtime.getDescriptorByFileno(io.fileno).getChannel : io.fileno + else + fd = io + end + + s = attach_fd fd, watch_mode + c = klass.new s, *args + + c.instance_variable_set(:@io, io) + c.instance_variable_set(:@watch_mode, watch_mode) + c.instance_variable_set(:@fd, fd) + + @conns[s] = c + block_given? and yield c + c + end + + + # Connect to a given host/port and re-use the provided {EventMachine::Connection} instance. + # Consider also {EventMachine::Connection#reconnect}. + # + # @see EventMachine::Connection#reconnect + def self.reconnect server, port, handler + # Observe, the test for already-connected FAILS if we call a reconnect inside post_init, + # because we haven't set up the connection in @conns by that point. + # RESIST THE TEMPTATION to "fix" this problem by redefining the behavior of post_init. + # + # Changed 22Nov06: if called on an already-connected handler, just return the + # handler and do nothing more. Originally this condition raised an exception. + # We may want to change it yet again and call the block, if any. + + raise "invalid handler" unless handler.respond_to?(:connection_completed) + #raise "still connected" if @conns.has_key?(handler.signature) + return handler if @conns.has_key?(handler.signature) + + s = if port + connect_server server, port + else + connect_unix_server server + end + handler.signature = s + @conns[s] = handler + block_given? and yield handler + handler + end + + + # Make a connection to a Unix-domain socket. This method is simply an alias for {.connect}, + # which can connect to both TCP and Unix-domain sockets. Make sure that your process has sufficient + # permissions to open the socket it is given. + # + # @param [String] socketname Unix domain socket (local fully-qualified path) you want to connect to. + # + # @note UNIX sockets, as the name suggests, are not available on Microsoft Windows. + def self.connect_unix_domain socketname, *args, &blk + connect socketname, *args, &blk + end + + + # Used for UDP-based protocols. Its usage is similar to that of {EventMachine.start_server}. + # + # This method will create a new UDP (datagram) socket and + # bind it to the address and port that you specify. + # The normal callbacks (see {EventMachine.start_server}) will + # be called as events of interest occur on the newly-created + # socket, but there are some differences in how they behave. + # + # {Connection#receive_data} will be called when a datagram packet + # is received on the socket, but unlike TCP sockets, the message + # boundaries of the received data will be respected. In other words, + # if the remote peer sent you a datagram of a particular size, + # you may rely on {Connection#receive_data} to give you the + # exact data in the packet, with the original data length. + # Also observe that Connection#receive_data may be called with a + # *zero-length* data payload, since empty datagrams are permitted in UDP. + # + # {Connection#send_data} is available with UDP packets as with TCP, + # but there is an important difference. Because UDP communications + # are *connectionless*, there is no implicit recipient for the packets you + # send. Ordinarily you must specify the recipient for each packet you send. + # However, EventMachine provides for the typical pattern of receiving a UDP datagram + # from a remote peer, performing some operation, and then sending + # one or more packets in response to the same remote peer. + # To support this model easily, just use {Connection#send_data} + # in the code that you supply for {Connection#receive_data}. + # + # EventMachine will provide an implicit return address for any messages sent to + # {Connection#send_data} within the context of a {Connection#receive_data} callback, + # and your response will automatically go to the correct remote peer. + # + # Observe that the port number that you supply to {EventMachine.open_datagram_socket} + # may be zero. In this case, EventMachine will create a UDP socket + # that is bound to an [ephemeral port](http://en.wikipedia.org/wiki/Ephemeral_port). + # This is not appropriate for servers that must publish a well-known + # port to which remote peers may send datagrams. But it can be useful + # for clients that send datagrams to other servers. + # If you do this, you will receive any responses from the remote + # servers through the normal {Connection#receive_data} callback. + # Observe that you will probably have issues with firewalls blocking + # the ephemeral port numbers, so this technique is most appropriate for LANs. + # + # If you wish to send datagrams to arbitrary remote peers (not + # necessarily ones that have sent data to which you are responding), + # then see {Connection#send_datagram}. + # + # DO NOT call send_data from a datagram socket outside of a {Connection#receive_data} method. Use {Connection#send_datagram}. + # If you do use {Connection#send_data} outside of a {Connection#receive_data} method, you'll get a confusing error + # because there is no "peer," as #send_data requires (inside of {EventMachine::Connection#receive_data}, + # {EventMachine::Connection#send_data} "fakes" the peer as described above). + # + # @param [String] address IP address + # @param [String] port Port + # @param [Class, Module] handler A class or a module that implements connection lifecycle callbacks. + def self.open_datagram_socket address, port, handler=nil, *args + # Replaced the implementation on 01Oct06. Thanks to Tobias Gustafsson for pointing + # out that this originally did not take a class but only a module. + + + klass = klass_from_handler(Connection, handler, *args) + s = open_udp_socket address, port.to_i + c = klass.new s, *args + @conns[s] = c + block_given? and yield c + c + end + + + # For advanced users. This function sets the default timer granularity, which by default is + # slightly smaller than 100 milliseconds. Call this function to set a higher or lower granularity. + # The function affects the behavior of {EventMachine.add_timer} and {EventMachine.add_periodic_timer}. + # Most applications will not need to call this function. + # + # Avoid setting the quantum to very low values because that may reduce performance under some extreme conditions. + # We recommend that you not use values lower than 10. + # + # This method only can be used if event loop is running. + # + # @param [Integer] mills New timer granularity, in milliseconds + # + # @see EventMachine.add_timer + # @see EventMachine.add_periodic_timer + # @see EventMachine::Timer + # @see EventMachine.run + def self.set_quantum mills + set_timer_quantum mills.to_i + end + + # Sets the maximum number of timers and periodic timers that may be outstanding at any + # given time. You only need to call {.set_max_timers} if you need more than the default + # number of timers, which on most platforms is 1000. + # + # @note This method has to be used *before* event loop is started. + # + # @param [Integer] ct Maximum number of timers that may be outstanding at any given time + # + # @see EventMachine.add_timer + # @see EventMachine.add_periodic_timer + # @see EventMachine::Timer + def self.set_max_timers ct + set_max_timer_count ct + end + + # Gets the current maximum number of allowed timers + # + # @return [Integer] Maximum number of timers that may be outstanding at any given time + def self.get_max_timers + get_max_timer_count + end + + # Returns the total number of connections (file descriptors) currently held by the reactor. + # Note that a tick must pass after the 'initiation' of a connection for this number to increment. + # It's usually accurate, but don't rely on the exact precision of this number unless you really know EM internals. + # + # @example + # + # EventMachine.run { + # EventMachine.connect("rubyeventmachine.com", 80) + # # count will be 0 in this case, because connection is not + # # established yet + # count = EventMachine.connection_count + # } + # + # + # @example + # + # EventMachine.run { + # EventMachine.connect("rubyeventmachine.com", 80) + # + # EventMachine.next_tick { + # # In this example, count will be 1 since the connection has been established in + # # the next loop of the reactor. + # count = EventMachine.connection_count + # } + # } + # + # @return [Integer] Number of connections currently held by the reactor. + def self.connection_count + self.get_connection_count + end + + # The is the responder for the loopback-signalled event. + # It can be fired either by code running on a separate thread ({EventMachine.defer}) or on + # the main thread ({EventMachine.next_tick}). + # It will often happen that a next_tick handler will reschedule itself. We + # consume a copy of the tick queue so that tick events scheduled by tick events + # have to wait for the next pass through the reactor core. + # + # @private + def self.run_deferred_callbacks + until (@resultqueue ||= []).empty? + result,cback = @resultqueue.pop + cback.call result if cback + end + + # Capture the size at the start of this tick... + size = @next_tick_mutex.synchronize { @next_tick_queue.size } + size.times do |i| + callback = @next_tick_mutex.synchronize { @next_tick_queue.shift } + begin + callback.call + ensure + # This is a little nasty. The problem is, if an exception occurs during + # the callback, then we need to send a signal to the reactor to actually + # do some work during the next_tick. The only mechanism we have from the + # ruby side is next_tick itself, although ideally, we'd just drop a byte + # on the loopback descriptor. + EM.next_tick {} if $! + end + end + end + + + # EventMachine.defer is used for integrating blocking operations into EventMachine's control flow. + # The action of {.defer} is to take the block specified in the first parameter (the "operation") + # and schedule it for asynchronous execution on an internal thread pool maintained by EventMachine. + # When the operation completes, it will pass the result computed by the block (if any) + # back to the EventMachine reactor. Then, EventMachine calls the block specified in the + # second parameter to {.defer} (the "callback"), as part of its normal event handling loop. + # The result computed by the operation block is passed as a parameter to the callback. + # You may omit the callback parameter if you don't need to execute any code after the operation completes. + # + # ## Caveats ## + # + # Note carefully that the code in your deferred operation will be executed on a separate + # thread from the main EventMachine processing and all other Ruby threads that may exist in + # your program. Also, multiple deferred operations may be running at once! Therefore, you + # are responsible for ensuring that your operation code is threadsafe. + # + # Don't write a deferred operation that will block forever. If so, the current implementation will + # not detect the problem, and the thread will never be returned to the pool. EventMachine limits + # the number of threads in its pool, so if you do this enough times, your subsequent deferred + # operations won't get a chance to run. + # + # @example + # + # operation = proc { + # # perform a long-running operation here, such as a database query. + # "result" # as usual, the last expression evaluated in the block will be the return value. + # } + # callback = proc {|result| + # # do something with result here, such as send it back to a network client. + # } + # + # EventMachine.defer(operation, callback) + # + # @param [#call] op An operation you want to offload to EventMachine thread pool + # @param [#call] callback A callback that will be run on the event loop thread after `operation` finishes. + # + # @see EventMachine.threadpool_size + def self.defer op = nil, callback = nil, &blk + # OBSERVE that #next_tick hacks into this mechanism, so don't make any changes here + # without syncing there. + # + # Running with $VERBOSE set to true gives a warning unless all ivars are defined when + # they appear in rvalues. But we DON'T ever want to initialize @threadqueue unless we + # need it, because the Ruby threads are so heavyweight. We end up with this bizarre + # way of initializing @threadqueue because EventMachine is a Module, not a Class, and + # has no constructor. + + unless @threadpool + @threadpool = [] + @threadqueue = ::Queue.new + @resultqueue = ::Queue.new + spawn_threadpool + end + + @threadqueue << [op||blk,callback] + end + + + # @private + def self.spawn_threadpool + until @threadpool.size == @threadpool_size.to_i + thread = Thread.new do + Thread.current.abort_on_exception = true + while true + op, cback = *@threadqueue.pop + result = op.call + @resultqueue << [result, cback] + EventMachine.signal_loopbreak + end + end + @threadpool << thread + end + @all_threads_spawned = true + end + + ## + # Returns +true+ if all deferred actions are done executing and their + # callbacks have been fired. + # + def self.defers_finished? + return false if @threadpool and !@all_threads_spawned + return false if @threadqueue and not @threadqueue.empty? + return false if @resultqueue and not @resultqueue.empty? + return false if @threadpool and @threadqueue.num_waiting != @threadpool.size + return true + end + + class << self + # @private + attr_reader :threadpool + + # Size of the EventMachine.defer threadpool (defaults to 20) + # @return [Number] + attr_accessor :threadpool_size + EventMachine.threadpool_size = 20 + end + + # Schedules a proc for execution immediately after the next "turn" through the reactor + # core. An advanced technique, this can be useful for improving memory management and/or + # application responsiveness, especially when scheduling large amounts of data for + # writing to a network connection. + # + # This method takes either a single argument (which must be a callable object) or a block. + # + # @param [#call] pr A callable object to run + def self.next_tick pr=nil, &block + # This works by adding to the @resultqueue that's used for #defer. + # The general idea is that next_tick is used when we want to give the reactor a chance + # to let other operations run, either to balance the load out more evenly, or to let + # outbound network buffers drain, or both. So we probably do NOT want to block, and + # we probably do NOT want to be spinning any threads. A program that uses next_tick + # but not #defer shouldn't suffer the penalty of having Ruby threads running. They're + # extremely expensive even if they're just sleeping. + + raise ArgumentError, "no proc or block given" unless ((pr && pr.respond_to?(:call)) or block) + @next_tick_mutex.synchronize do + @next_tick_queue << ( pr || block ) + end + signal_loopbreak if reactor_running? + end + + # A wrapper over the setuid system call. Particularly useful when opening a network + # server on a privileged port because you can use this call to drop privileges + # after opening the port. Also very useful after a call to {.set_descriptor_table_size}, + # which generally requires that you start your process with root privileges. + # + # This method is intended for use in enforcing security requirements, consequently + # it will throw a fatal error and end your program if it fails. + # + # @param [String] username The effective name of the user whose privilege-level your process should attain. + # + # @note This method has no effective implementation on Windows or in the pure-Ruby + # implementation of EventMachine + def self.set_effective_user username + EventMachine::setuid_string username + end + + + # Sets the maximum number of file or socket descriptors that your process may open. + # If you call this method with no arguments, it will simply return + # the current size of the descriptor table without attempting to change it. + # + # The new limit on open descriptors **only** applies to sockets and other descriptors + # that belong to EventMachine. It has **no effect** on the number of descriptors + # you can create in ordinary Ruby code. + # + # Not available on all platforms. Increasing the number of descriptors beyond its + # default limit usually requires superuser privileges. (See {.set_effective_user} + # for a way to drop superuser privileges while your program is running.) + # + # @param [Integer] n_descriptors The maximum number of file or socket descriptors that your process may open + # @return [Integer] The new descriptor table size. + def self.set_descriptor_table_size n_descriptors=nil + EventMachine::set_rlimit_nofile n_descriptors + end + + + + # Runs an external process. + # + # @example + # + # module RubyCounter + # def post_init + # # count up to 5 + # send_data "5\n" + # end + # def receive_data data + # puts "ruby sent me: #{data}" + # end + # def unbind + # puts "ruby died with exit status: #{get_status.exitstatus}" + # end + # end + # + # EventMachine.run { + # EventMachine.popen("ruby -e' $stdout.sync = true; gets.to_i.times{ |i| puts i+1; sleep 1 } '", RubyCounter) + # } + # + # @note This method is not supported on Microsoft Windows + # @see EventMachine::DeferrableChildProcess + # @see EventMachine.system + def self.popen cmd, handler=nil, *args + # At this moment, it's only available on Unix. + # Perhaps misnamed since the underlying function uses socketpair and is full-duplex. + + klass = klass_from_handler(Connection, handler, *args) + w = Shellwords::shellwords( cmd ) + w.unshift( w.first ) if w.first + s = invoke_popen( w ) + c = klass.new s, *args + @conns[s] = c + yield(c) if block_given? + c + end + + + # Tells you whether the EventMachine reactor loop is currently running. + # + # Useful when writing libraries that want to run event-driven code, but may + # be running in programs that are already event-driven. In such cases, if {EventMachine.reactor_running?} + # returns false, your code can invoke {EventMachine.run} and run your application code inside + # the block passed to that method. If this method returns true, just + # execute your event-aware code. + # + # @return [Boolean] true if the EventMachine reactor loop is currently running + def self.reactor_running? + (@reactor_running || false) + end + + + # (Experimental) + # + # @private + def self.open_keyboard handler=nil, *args + klass = klass_from_handler(Connection, handler, *args) + + s = read_keyboard + c = klass.new s, *args + @conns[s] = c + block_given? and yield c + c + end + + # EventMachine's file monitoring API. Currently supported are the following events + # on individual files, using inotify on Linux systems, and kqueue for *BSD and Mac OS X: + # + # * File modified (written to) + # * File moved/renamed + # * File deleted + # + # EventMachine::watch_file takes a filename and a handler Module containing your custom callback methods. + # This will setup the low level monitoring on the specified file, and create a new EventMachine::FileWatch + # object with your Module mixed in. FileWatch is a subclass of {EventMachine::Connection}, so callbacks on this object + # work in the familiar way. The callbacks that will be fired by EventMachine are: + # + # * file_modified + # * file_moved + # * file_deleted + # + # You can access the filename being monitored from within this object using {FileWatch#path}. + # + # When a file is deleted, {FileWatch#stop_watching} will be called after your file_deleted callback, + # to clean up the underlying monitoring and remove EventMachine's reference to the now-useless {FileWatch} instance. + # This will in turn call unbind, if you wish to use it. + # + # The corresponding system-level Errno will be raised when attempting to monitor non-existent files, + # files with wrong permissions, or if an error occurs dealing with inotify/kqueue. + # + # @example + # + # # Before running this example, make sure we have a file to monitor: + # # $ echo "bar" > /tmp/foo + # + # module Handler + # def file_modified + # puts "#{path} modified" + # end + # + # def file_moved + # puts "#{path} moved" + # end + # + # def file_deleted + # puts "#{path} deleted" + # end + # + # def unbind + # puts "#{path} monitoring ceased" + # end + # end + # + # # for efficient file watching, use kqueue on Mac OS X + # EventMachine.kqueue = true if EventMachine.kqueue? + # + # EventMachine.run { + # EventMachine.watch_file("/tmp/foo", Handler) + # } + # + # # $ echo "baz" >> /tmp/foo => "/tmp/foo modified" + # # $ mv /tmp/foo /tmp/oof => "/tmp/foo moved" + # # $ rm /tmp/oof => "/tmp/foo deleted" + # + # @note The ability to pick up on the new filename after a rename is not yet supported. + # Calling #path will always return the filename you originally used. + # + # @param [String] filename Local path to the file to watch. + # @param [Class, Module] handler A class or module that implements event handlers associated with the file. + def self.watch_file(filename, handler=nil, *args) + klass = klass_from_handler(FileWatch, handler, *args) + + s = EM::watch_filename(filename) + c = klass.new s, *args + # we have to set the path like this because of how Connection.new works + c.instance_variable_set("@path", filename) + @conns[s] = c + block_given? and yield c + c + end + + # EventMachine's process monitoring API. On Mac OS X and *BSD this method is implemented using kqueue. + # + # @example + # + # module ProcessWatcher + # def process_exited + # put 'the forked child died!' + # end + # end + # + # pid = fork{ sleep } + # + # EventMachine.run { + # EventMachine.watch_process(pid, ProcessWatcher) + # EventMachine.add_timer(1){ Process.kill('TERM', pid) } + # } + # + # @param [Integer] pid PID of the process to watch. + # @param [Class, Module] handler A class or module that implements event handlers associated with the file. + def self.watch_process(pid, handler=nil, *args) + pid = pid.to_i + + klass = klass_from_handler(ProcessWatch, handler, *args) + + s = EM::watch_pid(pid) + c = klass.new s, *args + # we have to set the path like this because of how Connection.new works + c.instance_variable_set("@pid", pid) + @conns[s] = c + block_given? and yield c + c + end + + # Catch-all for errors raised during event loop callbacks. + # + # @example + # + # EventMachine.error_handler{ |e| + # puts "Error raised during event loop: #{e.message}" + # } + # + # @param [#call] cb Global catch-all errback + def self.error_handler cb = nil, &blk + if cb or blk + @error_handler = cb || blk + elsif instance_variable_defined? :@error_handler + remove_instance_variable :@error_handler + end + end + + # This method allows for direct writing of incoming data back out to another descriptor, at the C++ level in the reactor. + # This is very efficient and especially useful for proxies where high performance is required. Propogating data from a server response + # all the way up to Ruby, and then back down to the reactor to be sent back to the client, is often unnecessary and + # incurs a significant performance decrease. + # + # The two arguments are instance of {EventMachine::Connection} subclasses, 'from' and 'to'. 'from' is the connection whose inbound data you want + # relayed back out. 'to' is the connection to write it to. + # + # Once you call this method, the 'from' connection will no longer get receive_data callbacks from the reactor, + # except in the case that 'to' connection has already closed when attempting to write to it. You can see + # in the example, that proxy_target_unbound will be called when this occurs. After that, further incoming + # data will be passed into receive_data as normal. + # + # Note also that this feature supports different types of descriptors: TCP, UDP, and pipes. You can relay + # data from one kind to another, for example, feed a pipe from a UDP stream. + # + # @example + # + # module ProxyConnection + # def initialize(client, request) + # @client, @request = client, request + # end + # + # def post_init + # EM::enable_proxy(self, @client) + # end + # + # def connection_completed + # send_data @request + # end + # + # def proxy_target_unbound + # close_connection + # end + # + # def unbind + # @client.close_connection_after_writing + # end + # end + # + # module ProxyServer + # def receive_data(data) + # (@buf ||= "") << data + # if @buf =~ /\r\n\r\n/ # all http headers received + # EventMachine.connect("10.0.0.15", 80, ProxyConnection, self, data) + # end + # end + # end + # + # EventMachine.run { + # EventMachine.start_server("127.0.0.1", 8080, ProxyServer) + # } + # + # @param [EventMachine::Connection] from Source of data to be proxies/streamed. + # @param [EventMachine::Connection] to Destination of data to be proxies/streamed. + # @param [Integer] bufsize Buffer size to use + # @param [Integer] length Maximum number of bytes to proxy. + # + # @see EventMachine.disable_proxy + def self.enable_proxy(from, to, bufsize=0, length=0) + EM::start_proxy(from.signature, to.signature, bufsize, length) + end + + # Takes just one argument, a {Connection} that has proxying enabled via {EventMachine.enable_proxy}. + # Calling this method will remove that functionality and your connection will begin receiving + # data via {Connection#receive_data} again. + # + # @param [EventMachine::Connection] from Source of data that is being proxied + # @see EventMachine.enable_proxy + def self.disable_proxy(from) + EM::stop_proxy(from.signature) + end + + # Retrieve the heartbeat interval. This is how often EventMachine will check for dead connections + # that have had an inactivity timeout set via {Connection#set_comm_inactivity_timeout}. + # Default is 2 seconds. + # + # @return [Integer] Heartbeat interval, in seconds + def self.heartbeat_interval + EM::get_heartbeat_interval + end + + # Set the heartbeat interval. This is how often EventMachine will check for dead connections + # that have had an inactivity timeout set via {Connection#set_comm_inactivity_timeout}. + # Takes a Numeric number of seconds. Default is 2. + # + # @param [Integer] time Heartbeat interval, in seconds + def self.heartbeat_interval=(time) + EM::set_heartbeat_interval time.to_f + end + + # @private + def self.event_callback conn_binding, opcode, data + # + # Changed 27Dec07: Eliminated the hookable error handling. + # No one was using it, and it degraded performance significantly. + # It's in original_event_callback, which is dead code. + # + # Changed 25Jul08: Added a partial solution to the problem of exceptions + # raised in user-written event-handlers. If such exceptions are not caught, + # we must cause the reactor to stop, and then re-raise the exception. + # Otherwise, the reactor doesn't stop and it's left on the call stack. + # This is partial because we only added it to #unbind, where it's critical + # (to keep unbind handlers from being re-entered when a stopping reactor + # runs down open connections). It should go on the other calls to user + # code, but the performance impact may be too large. + # + if opcode == ConnectionUnbound + if c = @conns.delete( conn_binding ) + begin + if c.original_method(:unbind).arity != 0 + c.unbind(data == 0 ? nil : EventMachine::ERRNOS[data]) + else + c.unbind + end + # If this is an attached (but not watched) connection, close the underlying io object. + if c.instance_variable_defined?(:@io) and !c.instance_variable_get(:@watch_mode) + io = c.instance_variable_get(:@io) + begin + io.close + rescue Errno::EBADF, IOError + end + end + rescue + @wrapped_exception = $! + stop + end + elsif c = @acceptors.delete( conn_binding ) + # no-op + else + if $! # Bubble user generated errors. + @wrapped_exception = $! + EM.stop + else + raise ConnectionNotBound, "received ConnectionUnbound for an unknown signature: #{conn_binding}" + end + end + elsif opcode == ConnectionAccepted + accep,args,blk = @acceptors[conn_binding] + raise NoHandlerForAcceptedConnection unless accep + c = accep.new data, *args + @conns[data] = c + blk and blk.call(c) + c # (needed?) + ## + # The remaining code is a fallback for the pure ruby and java reactors. + # In the C++ reactor, these events are handled in the C event_callback() in rubymain.cpp + elsif opcode == ConnectionCompleted + c = @conns[conn_binding] or raise ConnectionNotBound, "received ConnectionCompleted for unknown signature: #{conn_binding}" + c.connection_completed + elsif opcode == TimerFired + t = @timers.delete( data ) + return if t == false # timer cancelled + t or raise UnknownTimerFired, "timer data: #{data}" + t.call + elsif opcode == ConnectionData + c = @conns[conn_binding] or raise ConnectionNotBound, "received data #{data} for unknown signature: #{conn_binding}" + c.receive_data data + elsif opcode == LoopbreakSignalled + run_deferred_callbacks + elsif opcode == ConnectionNotifyReadable + c = @conns[conn_binding] or raise ConnectionNotBound + c.notify_readable + elsif opcode == ConnectionNotifyWritable + c = @conns[conn_binding] or raise ConnectionNotBound + c.notify_writable + end + end + + # + # + # @private + def self._open_file_for_writing filename, handler=nil + klass = klass_from_handler(Connection, handler) + + s = _write_file filename + c = klass.new s + @conns[s] = c + block_given? and yield c + c + end + + # @private + def self.klass_from_handler(klass = Connection, handler = nil, *args) + klass = if handler and handler.is_a?(Class) + raise ArgumentError, "must provide module or subclass of #{klass.name}" unless klass >= handler + handler + elsif handler + begin + handler::EM_CONNECTION_CLASS + rescue NameError + handler::const_set(:EM_CONNECTION_CLASS, Class.new(klass) {include handler}) + end + else + klass + end + + arity = klass.instance_method(:initialize).arity + expected = arity >= 0 ? arity : -(arity + 1) + if (arity >= 0 and args.size != expected) or (arity < 0 and args.size < expected) + raise ArgumentError, "wrong number of arguments for #{klass}#initialize (#{args.size} for #{expected})" + end + + klass + end +end # module EventMachine + +# Alias for {EventMachine} +EM = EventMachine +# Alias for {EventMachine::Protocols} +EM::P = EventMachine::Protocols diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/jeventmachine.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/jeventmachine.rb new file mode 100644 index 000000000..5ac647f51 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/jeventmachine.rb @@ -0,0 +1,284 @@ +#-- +# +# Author:: Francis Cianfrocca (gmail: blackhedd) +# Homepage:: http://rubyeventmachine.com +# Date:: 8 Apr 2006 +# +# See EventMachine and EventMachine::Connection for documentation and +# usage examples. +# +#---------------------------------------------------------------------------- +# +# Copyright (C) 2006-07 by Francis Cianfrocca. All Rights Reserved. +# Gmail: blackhedd +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of either: 1) the GNU General Public License +# as published by the Free Software Foundation; either version 2 of the +# License, or (at your option) any later version; or 2) Ruby's License. +# +# See the file COPYING for complete licensing information. +# +#--------------------------------------------------------------------------- +# +# + +# This module provides "glue" for the Java version of the EventMachine reactor core. +# For C++ EventMachines, the analogous functionality is found in ext/rubymain.cpp, +# which is a garden-variety Ruby-extension glue module. + +require 'java' +require 'rubyeventmachine' +require 'socket' + +java_import java.io.FileDescriptor +java_import java.nio.channels.SocketChannel +java_import java.lang.reflect.Field + +module JavaFields + def set_field(key, value) + field = getClass.getDeclaredField(key) + field.setAccessible(true) + if field.getType.toString == 'int' + field.setInt(self, value) + else + field.set(self, value) + end + end + + def get_field(key) + field = getClass.getDeclaredField(key) + field.setAccessible(true) + field.get(self) + end +end + +FileDescriptor.send :include, JavaFields +SocketChannel.send :include, JavaFields + +module EventMachine + # TODO: These event numbers are defined in way too many places. + # DRY them up. + # @private + TimerFired = 100 + # @private + ConnectionData = 101 + # @private + ConnectionUnbound = 102 + # @private + ConnectionAccepted = 103 + # @private + ConnectionCompleted = 104 + # @private + LoopbreakSignalled = 105 + # @private + ConnectionNotifyReadable = 106 + # @private + ConnectionNotifyWritable = 107 + # @private + SslHandshakeCompleted = 108 + + # Exceptions that are defined in rubymain.cpp + class ConnectionError < RuntimeError; end + class ConnectionNotBound < RuntimeError; end + class UnknownTimerFired < RuntimeError; end + class Unsupported < RuntimeError; end + + # This thunk class used to be called EM, but that caused conflicts with + # the alias "EM" for module EventMachine. (FC, 20Jun08) + class JEM < com.rubyeventmachine.EmReactor + def eventCallback a1, a2, a3, a4 + s = String.from_java_bytes(a3.array[a3.position...a3.limit]) if a3 + EventMachine::event_callback a1, a2, s || a4 + nil + end + end + # class Connection < com.rubyeventmachine.Connection + # def associate_callback_target sig + # # No-op for the time being. + # end + # end + def self.initialize_event_machine + @em = JEM.new + end + def self.release_machine + @em = nil + end + def self.add_oneshot_timer interval + @em.installOneshotTimer interval + end + def self.run_machine + @em.run + end + def self.stop + @em.stop + end + def self.start_tcp_server server, port + @em.startTcpServer server, port + end + def self.stop_tcp_server sig + @em.stopTcpServer sig + end + def self.start_unix_server filename + # TEMPORARILY unsupported until someone figures out how to do it. + raise "unsupported on this platform" + end + def self.send_data sig, data, length + @em.sendData sig, data.to_java_bytes + end + def self.send_datagram sig, data, length, address, port + @em.sendDatagram sig, data.to_java_bytes, length, address, port + end + def self.connect_server server, port + bind_connect_server nil, nil, server, port + end + def self.bind_connect_server bind_addr, bind_port, server, port + @em.connectTcpServer bind_addr, bind_port.to_i, server, port + end + def self.close_connection sig, after_writing + @em.closeConnection sig, after_writing + end + def self.set_comm_inactivity_timeout sig, interval + @em.setCommInactivityTimeout sig, interval + end + def self.set_pending_connect_timeout sig, val + end + def self.set_heartbeat_interval val + end + def self.start_tls sig + @em.startTls sig + end + def self.ssl? + false + end + def self.signal_loopbreak + @em.signalLoopbreak + end + def self.set_timer_quantum q + @em.setTimerQuantum q + end + def self.epoll + # Epoll is a no-op for Java. + # The latest Java versions run epoll when possible in NIO. + end + def self.epoll= val + end + def self.kqueue + end + def self.kqueue= val + end + def self.epoll? + false + end + def self.kqueue? + false + end + def self.set_rlimit_nofile n_descriptors + # Currently a no-op for Java. + end + def self.open_udp_socket server, port + @em.openUdpSocket server, port + end + def self.invoke_popen cmd + # TEMPORARILY unsupported until someone figures out how to do it. + raise "unsupported on this platform" + end + def self.read_keyboard + # TEMPORARILY unsupported until someone figures out how to do it. + raise "temporarily unsupported on this platform" + end + def self.set_max_timer_count num + # harmless no-op in Java. There's no built-in timer limit. + @max_timer_count = num + end + def self.get_max_timer_count + # harmless no-op in Java. There's no built-in timer limit. + @max_timer_count || 100_000 + end + def self.library_type + :java + end + def self.get_peername sig + if peer = @em.getPeerName(sig) + Socket.pack_sockaddr_in(*peer) + end + end + def self.get_sockname sig + if sockName = @em.getSockName(sig) + Socket.pack_sockaddr_in(*sockName) + end + end + # @private + def self.attach_fd fileno, watch_mode + # 3Aug09: We could pass in the actual SocketChannel, but then it would be modified (set as non-blocking), and + # we would need some logic to make sure detach_fd below didn't clobber it. For now, we just always make a new + # SocketChannel for the underlying file descriptor + # if fileno.java_kind_of? SocketChannel + # ch = fileno + # ch.configureBlocking(false) + # fileno = nil + # elsif fileno.java_kind_of? java.nio.channels.Channel + + if fileno.java_kind_of? java.nio.channels.Channel + field = fileno.getClass.getDeclaredField('fdVal') + field.setAccessible(true) + fileno = field.get(fileno) + else + raise ArgumentError, 'attach_fd requires Java Channel or POSIX fileno' unless fileno.is_a? Fixnum + end + + if fileno == 0 + raise "can't open STDIN as selectable in Java =(" + elsif fileno.is_a? Fixnum + # 8Aug09: The following code is specific to the sun jvm's SocketChannelImpl. Is there a cross-platform + # way of implementing this? If so, also remember to update EventableSocketChannel#close and #cleanup + fd = FileDescriptor.new + fd.set_field 'fd', fileno + + ch = SocketChannel.open + ch.configureBlocking(false) + ch.kill + ch.set_field 'fd', fd + ch.set_field 'fdVal', fileno + ch.set_field 'state', ch.get_field('ST_CONNECTED') + end + + @em.attachChannel(ch,watch_mode) + end + def self.detach_fd sig + if ch = @em.detachChannel(sig) + ch.get_field 'fdVal' + end + end + + def self.set_notify_readable sig, mode + @em.setNotifyReadable(sig, mode) + end + def self.set_notify_writable sig, mode + @em.setNotifyWritable(sig, mode) + end + + def self.is_notify_readable sig + @em.isNotifyReadable(sig) + end + def self.is_notify_writable sig + @em.isNotifyWritable(sig) + end + def self.get_connection_count + @em.getConnectionCount + end + + def self.set_tls_parms(sig, params) + end + def self.start_tls(sig) + end + def self.send_file_data(sig, filename) + end + + class Connection + def associate_callback_target sig + # No-op for the time being + end + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/rakelib/cpp.rake_example b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/rakelib/cpp.rake_example new file mode 100644 index 000000000..c1a895a68 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/rakelib/cpp.rake_example @@ -0,0 +1,77 @@ +# EventMachine C++ Rakefile Stab Case +# TODO : track header files as a build dependency... +# TODO : cross platform support +# TODO : configure style functionality +namespace :cpp do + + require 'rake/clean' + + # *nix only atm... + module Cpp + class < [proc { |targ| + targ.sub(%r{^#{EmConfig::Path}/(.*)\.o$}, "#{EmConfig::Path}/\\1.cpp") + }] do |t| + Cpp.compile t.source, t.name, EmConfig::Includes, EmConfig::Flags + end + + file "#{EmConfig::Path}/libeventmachine.a" => EmConfig::Compiled do |t| + Cpp.static t.name, EmConfig::Compiled + end + CLEAN.include("#{EmConfig::Path}/libeventmachine.a") + + module AppConfig + Appname = 'echo_em' + Sources = FileList['*.cpp'] + Compiled = Sources.sub(%r{^(.*)\.cpp}, '\\1.o') + + Flags = ["", EmConfig::Flags].join(' ') + Includes = ["-I. -I#{EmConfig::Path}", EmConfig::Includes].join(' ') + Libs = ["-L#{EmConfig::Path} -leventmachine", EmConfig::Libs].join(' ') + end + CLEAN.include(AppConfig::Compiled) + CLEAN.include(AppConfig::Appname) + + rule %r{^.*\.o$} => [proc { |targ| + targ.sub(%r{^(.*)\.o$}, '\\1.cpp') + }] do |t| + Cpp.compile t.source, t.name, AppConfig::Includes, AppConfig::Flags + end + + file AppConfig::Appname => ["#{EmConfig::Path}/libeventmachine.a", AppConfig::Compiled] do |t| + Cpp.link AppConfig::Compiled, t.name, AppConfig::Libs, AppConfig::Flags + end + + task :build => AppConfig::Appname + + task :run => AppConfig::Appname do + sh "./#{AppConfig::Appname}" + end + +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/rakelib/package.rake b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/rakelib/package.rake new file mode 100644 index 000000000..491fd4ef5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/rakelib/package.rake @@ -0,0 +1,98 @@ +require 'rake/gempackagetask' +begin + require 'rake/extensiontask' + require 'rake/javaextensiontask' +rescue LoadError => e + puts <<-MSG +rake-compiler gem seems to be missing. Please install it with + + gem install rake-compiler + +(add sudo if necessary). + MSG +end + +Rake::GemPackageTask.new(GEMSPEC) do |pkg| +end + +if RUBY_PLATFORM =~ /java/ + Rake::JavaExtensionTask.new("rubyeventmachine", GEMSPEC) do |ext| + ext.ext_dir = 'java/src' + end +else + def setup_cross_compilation(ext) + unless RUBY_PLATFORM =~ /mswin|mingw/ + ext.cross_compile = true + ext.cross_platform = ['x86-mingw32', 'x86-mswin32-60'] + + # inject 1.8/1.9 pure-ruby entry point + ext.cross_compiling do |spec| + spec.files += ["lib/#{ext.name}.rb"] + end + end + end + + Rake::ExtensionTask.new("rubyeventmachine", GEMSPEC) do |ext| + ext.ext_dir = 'ext' + ext.source_pattern = '*.{h,c,cpp}' + setup_cross_compilation(ext) + end + Rake::ExtensionTask.new("fastfilereaderext", GEMSPEC) do |ext| + ext.ext_dir = 'ext/fastfilereader' + ext.source_pattern = '*.{h,c,cpp}' + setup_cross_compilation(ext) + end +end + +# Setup shim files that require 1.8 vs 1.9 extensions in win32 bin gems +%w[ rubyeventmachine fastfilereaderext ].each do |filename| + file("lib/#{filename}.rb") do |t| + File.open(t.name, 'wb') do |f| + f.write <<-eoruby + RUBY_VERSION =~ /(\\d+.\\d+)/ + require "\#{$1}/#{File.basename(t.name, '.rb')}" + eoruby + end + at_exit{ FileUtils.rm t.name if File.exists?(t.name) } + end +end + +task :cross_cxx do + ENV['CROSS_COMPILING'] = 'yes' + require 'rake/extensioncompiler' + ENV['CXX'] = "#{Rake::ExtensionCompiler.mingw_host}-g++" +end + +if Rake::Task.task_defined?(:cross) + task :cross => 'lib/rubyeventmachine.rb' + task :cross => 'lib/fastfilereaderext.rb' + task :cross => :cross_cxx +end + +def windows?; RUBY_PLATFORM =~ /mswin|mingw/; end +def sudo(cmd) + if windows? || (require 'etc'; Etc.getpwuid.uid == 0) + sh cmd + else + sh "sudo #{cmd}" + end +end +def gem_cmd(action, name, *args) + rb = Gem.ruby rescue nil + rb ||= (require 'rbconfig'; File.join(Config::CONFIG['bindir'], Config::CONFIG['ruby_install_name'])) + sudo "#{rb} -r rubygems -e 'require %{rubygems/gem_runner}; Gem::GemRunner.new.run(%w{#{action} #{name} #{args.join(' ')}})'" +end + +Rake::Task[:clean].enhance [:clobber_package] + +namespace :gem do + desc 'Install gem (and sudo if required)' + task :install => :package do + gem_cmd(:install, "pkg/#{GEMSPEC.name}-#{GEMSPEC.version}.gem") + end + + desc 'Uninstall gem (and sudo if required)' + task :uninstall do + gem_cmd(:uninstall, "#{GEMSPEC.name}", "-v=#{GEMSPEC.version}") + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/rakelib/test.rake b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/rakelib/test.rake new file mode 100644 index 000000000..1185ac70c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/rakelib/test.rake @@ -0,0 +1,8 @@ +require 'rake/testtask' + +Rake::TestTask.new(:test) do |t| + t.libs << "tests" + t.libs << "lib" + t.pattern = 'tests/**/test_*.rb' + t.warning = true +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/client.crt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/client.crt new file mode 100644 index 000000000..1919d976c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/client.crt @@ -0,0 +1,31 @@ +-----BEGIN CERTIFICATE----- +MIIFRDCCAywCAQEwDQYJKoZIhvcNAQEFBQAwaDELMAkGA1UEBhMCRU0xFTATBgNV +BAgTDEV2ZW50TWFjaGluZTEVMBMGA1UEChMMRXZlbnRNYWNoaW5lMRQwEgYDVQQL +EwtEZXZlbG9wbWVudDEVMBMGA1UEAxMMRXZlbnRNYWNoaW5lMB4XDTA5MDMyOTAy +MzE0NloXDTEwMDMyOTAyMzE0NlowaDELMAkGA1UEBhMCRU0xFTATBgNVBAgTDEV2 +ZW50TWFjaGluZTEVMBMGA1UEChMMRXZlbnRNYWNoaW5lMRQwEgYDVQQLEwtEZXZl +bG9wbWVudDEVMBMGA1UEAxMMRXZlbnRNYWNoaW5lMIICIjANBgkqhkiG9w0BAQEF +AAOCAg8AMIICCgKCAgEAv1FSOIX1z7CQtVBFlrB0A3/V29T+22STKKmiRWYkKL5b ++hkrp9IZ5J4phZHgUVM2VDPOO2Oc2PU6dlGGZISg+UPERunTogxQKezCV0vcE9cK +OwzxCFDRvv5rK8aKMscfBLbNKocAXywuRRQmdxPiVRzbyPrl+qCr/EDLXAX3D77l +S8n2AwDg19VyI+IgFUE+Dy5e1eLoY6nV+Mq+vNXdn3ttF3t+ngac5pj5Q9h+pD5p +67baDHSnf/7cy2fa/LKrLolVHQR9G2K6cEfeM99NtcsMbkoPs4iI3FA05OVTQHXg +C8C8cRxrb9APl95I/ep65OIaCJgcdYxJ3QD3qOtQo6/NQsGnjbyiUxaEpjfqyT1N +uzWD81Q8uXGNS8yD6dDynt/lseBjyp2nfC3uQ5fY18VdIcu0MJ9pezBUKrNuhlsy +XXEZ2DXj4sY8QOvIcBqSB/zmS1nGEK55xrtkaiaNrY8fe8wRVpcPLxy+P225NFw+ +B69FJRA0Lj6Jt9BM4hV/3MSIEWwTVhuw4E02ywDYTzz1wq3ITf0tsbIPn0hXQMxD +ohhAoKioM6u+yHtqsxD0eYaAWmHTVn5oDvOSGpvCpBfWHyA7FP5UQak0fKABEAgK +iQYEnb294AXwXymJttfGTIV/Ne4tLN5dIpNma8UO8rlThlcr6xnTQDbR3gkTDRsC +AwEAATANBgkqhkiG9w0BAQUFAAOCAgEAj7J8fy1LUWoVWnrXDAC9jwJ1nI/YjoSU +6ywke3o04+nZC5S+dPnuVy+HAwsU940CoNvP6RStI/bH6JL+NIqEFmwM3M8xIEWV +MYVPkfvQUxxGvDnaY7vv93u+6Q77HV3qlhAQBHChyuXyO7TG3+WzsiT9AnBNtAP0 +4jClt5kCAQXLO/p0SFEZQ8Ru9SM8d1i73Z0VDVzs8jYWlBhiherSgbw1xK4wBOpJ +43XmjZsBSrDpiAXd07Ak3UL2GjfT7eStgebL3UIe39ThE/s/+l43bh0M6WbOBvyQ +i/rZ50kd1GvN0xnZhtv07hIJWO85FGWi7Oet8AzdUZJ17v1Md/f2vdhPVTFN9q+w +mQ6LxjackqCvaJaQfBEbqsn2Tklxk4tZuDioiQbOElT2e6vljQVJWIfNx38Ny2LM +aiXQPQu+4CI7meAh5gXM5nyJGbZvRPsxj89CqYzyHCYs5HBP3AsviBvn26ziOF+c +544VmHd9HkIv8UTC29hh+R64RlgMQQQdaXFaUrFPTs/do0k8n/c2bPc0iTdfi5Q2 +gq6Vi8q6Ay5wGgTtRRbn/mWKuCFjEh94z6pF9Xr06NX0PuEOdf+Ls9vI5vz6G0w6 +0Li7devEN7EKBY+7Mcjg918yq9i5tEiMkUgT68788t3fTC+4iUQ5fDtdrHsaOlIR +8bs/XQVNE/s= +-----END CERTIFICATE----- diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/client.key b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/client.key new file mode 100644 index 000000000..87a25311c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/client.key @@ -0,0 +1,51 @@ +-----BEGIN RSA PRIVATE KEY----- +MIIJKAIBAAKCAgEAv1FSOIX1z7CQtVBFlrB0A3/V29T+22STKKmiRWYkKL5b+hkr +p9IZ5J4phZHgUVM2VDPOO2Oc2PU6dlGGZISg+UPERunTogxQKezCV0vcE9cKOwzx +CFDRvv5rK8aKMscfBLbNKocAXywuRRQmdxPiVRzbyPrl+qCr/EDLXAX3D77lS8n2 +AwDg19VyI+IgFUE+Dy5e1eLoY6nV+Mq+vNXdn3ttF3t+ngac5pj5Q9h+pD5p67ba +DHSnf/7cy2fa/LKrLolVHQR9G2K6cEfeM99NtcsMbkoPs4iI3FA05OVTQHXgC8C8 +cRxrb9APl95I/ep65OIaCJgcdYxJ3QD3qOtQo6/NQsGnjbyiUxaEpjfqyT1NuzWD +81Q8uXGNS8yD6dDynt/lseBjyp2nfC3uQ5fY18VdIcu0MJ9pezBUKrNuhlsyXXEZ +2DXj4sY8QOvIcBqSB/zmS1nGEK55xrtkaiaNrY8fe8wRVpcPLxy+P225NFw+B69F +JRA0Lj6Jt9BM4hV/3MSIEWwTVhuw4E02ywDYTzz1wq3ITf0tsbIPn0hXQMxDohhA +oKioM6u+yHtqsxD0eYaAWmHTVn5oDvOSGpvCpBfWHyA7FP5UQak0fKABEAgKiQYE +nb294AXwXymJttfGTIV/Ne4tLN5dIpNma8UO8rlThlcr6xnTQDbR3gkTDRsCAwEA +AQKCAgB495RDRQB9x6hX3F+DviI8rDGug+h5FAiwJ0IBG2o1kNdbNVsTC5dvpEmg +uPHaugCaEP+PMZbU34mNklKlb+7QbPbH18UGqz5so9TlmYOXz9oaKD6nAWL9nqRo +02pCXQDR3DuxbhbgFnFTIECJ/jqXkl2toGaVp83W+6kZkHP8srkMyLASihWgosc+ +xRWAGvaAZtNz7br+eT5fxuH/SEKPOl1qAZ23kXrXm1XQfizk8MnMTptkUMYv+hfl +TM98BASUsiTs6g+opy43HFn09naOQcqkWZO/8s6Gbvhi2lVfZqi5Ba6g3lVYJ3gU +kGoako4N9qB7WqJz+LYjVR9C4TbkkJ9OD6ArwGAx5IIzC3XKSxCyY/pUn4YumPhY +fjvY/km54TBtx/isS1TAgjSgDUxbzrfbkh7afOXSOniy9bWJMgNqHF61dqxWxmUg +F5Tch9zH3qFFVkXpYzDU/R8ZV+CRouCvhn0eZYDh8IqIAwjH0VjkxjPyQtrdrMd3 +gDKMVKoY31EOMLZzv8a0prjpr15A+uw30tT336qb3fofks4pZKUJw8ru9jJVir2p ++RML6iUHCmIeceF7/N1meooSMLPJe0xgKeMb9M4Wtd/et2UNVtP8nCDG622rf2a0 +F/EudXuFgc3FB8nXRw9TCkw9xKQff38edG5xPFUEgqObbVl5YQKCAQEA5DDKGOmp +EO5Zuf/kZfG6/AMMYwAuv1HrYTV2w/HnI3tyQ34Xkeqo+I/OqmRk68Ztxw4Kx1So +SRavkotrlWhhDpl2+Yn1BjkHktSoOdf9gJ9z9llkLmbOkBjmupig1NUB7fq/4y2k +MdqJXDy3uVKHJ97gxdIheMTyHiKuMJPnuT5lZtlT210Ig82P7sLQb/sgCfKVFTr0 +Z3haQ5/tBNKjq+igT4nMBWupOTD1q2GeZLIZACnmnUIhvu+3/bm0l+wiCB0DqF0T +Wy9tlL3fqQSCqzevL7/k5Lg6tJTaP/XYePB73TsOtAXgIaoltXgRBsBUeE1eaODx +kMT6E1PPtn7EqQKCAQEA1qImmTWGqhKICrwje40awPufFtZ/qXKVCN/V+zYsrJV1 +EnZpUDM+zfitlQCugnrQVHSpgfekI6mmVkmogO3fkNjUFTq+neg7IHOUHnqotx+3 +NMqIsyFInGstu9mfPd26fzZjUtx5wKF38LDTIJJAEJ83U3UpPBfpwKmiOGDXOa54 +2i4em/bb/hrQR6JySruZYLi0fXnGI5ZOfpkHgC/KOFkKNKAg2oh4B9qo7ACyiSNk +yojb2mmn6g1OLPxi7wGUSrkS1HQq4an6RZ+eUO0HXVWag0QStdQ91M9IrIHgSBBG +0e86Ar6jtD579gqsbz4ySpI/FqEI9obTC+E1/b0aIwKCAQAGz334qGCnZLXA22ZR +tJlEFEM2YTcD9snzqMjWqE2hvXl3kjfZ3wsUABbG9yAb+VwlaMHhmSE8rTSoRwj6 ++JaM/P+UCw4JFYKoWzh6IXwrbpbjb1+SEvdvTY71WsDSGVlpZOZ9PUt9QWyAGD/T +hCcMhZZn0RG2rQoc5CQWxxNPcBFOtIXQMkKizGvTUHUwImqeYWMZsxzASdNH2WoV +jsPbyaGfPhmcv83ZKyDp8IvtrXMZkiaT4vlm3Xi8VeKR9jY9z7/gMob1XcEDg3c9 +cCkGOy87WZrXSLhX02mAJzJCycqom66gqNw7pPxjIiY/8VWUEZsTvkL3cymTkhjM +9ZOhAoIBAGUaNqJe01NTrV+ZJgGyAxM6s8LXQYV5IvjuL2bJKxwUvvP2cT9FFGWD +qYiRrKJr5ayS07IUC+58oIzu33/0DSa27JgfduD9HrT3nKMK1mSEfRFSAjiXChQc +bIubRGapBoub/AdxMazqoovvT1R9b84kobQfcVAMV6DYh0CVZWyXYfgsV2DSVOiK +iufjfoDzg5lLCEI+1XW3/LunrB/W4yPN1X/amf8234ublYyt+2ucD4NUGnP05xLa +N6P7M0MwdEEKkvMe0YBBSFH5kWK/dIOjqkgBDes20fVnuuz/tL1dZW7IiIP4dzaV +ZGEOwBEatCfqYetv6b/u3IUxDfS7Wg8CggEBALoOwkn5LGdQg+bpdZAKJspGnJWL +Kyr9Al2tvgc69rxfpZqS5eDLkYYCzWPpspSt0Axm1O7xOUDQDt42luaLNGJzHZ2Q +Hn0ZNMhyHpe8d8mIQngRjD+nuLI/uFUglPzabDOCOln2aycjg1mA6ecXP1XMEVbu +0RB/0IE36XTMfZ+u9+TRjkBLpmUaX1FdIQQWfwUou/LfaXotoQlhSGAcprLrncuJ +T44UATYEgO/q9pMM33bdE3eBYZHoT9mSvqoLCN4s0LuwOYItIxLKUj0GulL0VQOI +SZi+0A1c8cVDXgApkBrWPDQIR9JS4de0gW4hnDoUvHtUc2TYPRnz6N9MtFY= +-----END RSA PRIVATE KEY----- diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/em_test_helper.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/em_test_helper.rb new file mode 100644 index 000000000..357f6bc1a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/em_test_helper.rb @@ -0,0 +1,64 @@ +require 'eventmachine' +require 'test/unit' +require 'rbconfig' +require 'socket' + +class Test::Unit::TestCase + class EMTestTimeout < StandardError ; end + + def setup_timeout(timeout = TIMEOUT_INTERVAL) + EM.schedule { + EM.add_timer(timeout) { + raise EMTestTimeout, "Test was cancelled after #{timeout} seconds." + } + } + end + + def port_in_use?(port, host="127.0.0.1") + s = TCPSocket.new(host, port) + s.close + s + rescue Errno::ECONNREFUSED + false + end + + def next_port + @@port ||= 9000 + begin + @@port += 1 + end while port_in_use?(@@port) + + @@port + end + + def exception_class + jruby? ? NativeException : RuntimeError + end + + module PlatformHelper + # http://blog.emptyway.com/2009/11/03/proper-way-to-detect-windows-platform-in-ruby/ + def windows? + RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ + end + + # http://stackoverflow.com/questions/1342535/how-can-i-tell-if-im-running-from-jruby-vs-ruby/1685970#1685970 + def jruby? + defined? JRUBY_VERSION + end + end + + include PlatformHelper + extend PlatformHelper + + # Tests run significantly slower on windows. YMMV + TIMEOUT_INTERVAL = windows? ? 1 : 0.25 + + def silent + backup, $VERBOSE = $VERBOSE, nil + begin + yield + ensure + $VERBOSE = backup + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_attach.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_attach.rb new file mode 100644 index 000000000..12c9fdf56 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_attach.rb @@ -0,0 +1,126 @@ +require 'em_test_helper' +require 'socket' + +class TestAttach < Test::Unit::TestCase + class EchoServer < EM::Connection + def receive_data data + send_data data + end + end + + class EchoClient < EM::Connection + def initialize socket + self.notify_readable = true + @socket = socket + @socket.write("abc\n") + end + + def notify_readable + $read = @socket.readline + $fd = detach + end + + def unbind + EM.next_tick do + @socket.write("def\n") + EM.add_timer(0.1) { EM.stop } + end + end + end + + def setup + @port = next_port + $read, $r, $w, $fd = nil + end + + def teardown + [$r, $w].each do |io| + io.close rescue nil + end + end + + def test_attach + socket = nil + + EM.run { + EM.start_server "127.0.0.1", @port, EchoServer + socket = TCPSocket.new "127.0.0.1", @port + EM.watch socket, EchoClient, socket + } + + assert_equal $read, "abc\n" + unless jruby? # jruby filenos are not real + assert_equal $fd, socket.fileno + end + assert_equal false, socket.closed? + assert_equal socket.readline, "def\n" + end + + module PipeWatch + def notify_readable + $read = $r.readline + EM.stop + end + end + + def test_attach_pipe + EM.run{ + $r, $w = IO.pipe + EM.watch $r, PipeWatch do |c| + c.notify_readable = true + end + $w.write("ghi\n") + } + + assert_equal $read, "ghi\n" + end + + def test_set_readable + before, after = nil + + EM.run{ + $r, $w = IO.pipe + c = EM.watch $r, PipeWatch do |con| + con.notify_readable = false + end + + EM.next_tick{ + before = c.notify_readable? + c.notify_readable = true + after = c.notify_readable? + } + + $w.write("jkl\n") + } + + assert !before + assert after + assert_equal $read, "jkl\n" + end + + def test_read_write_pipe + result = nil + + pipe_reader = Module.new do + define_method :receive_data do |data| + result = data + EM.stop + end + end + + r,w = IO.pipe + + EM.run { + EM.attach r, pipe_reader + writer = EM.attach(w) + writer.send_data 'ghi' + + # XXX: Process will hang in Windows without this line + writer.close_connection_after_writing + } + + assert_equal "ghi", result + ensure + [r,w].each {|io| io.close rescue nil } + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_basic.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_basic.rb new file mode 100644 index 000000000..d52d4d05a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_basic.rb @@ -0,0 +1,294 @@ +require 'em_test_helper' +require 'socket' + +class TestBasic < Test::Unit::TestCase + def setup + @port = next_port + end + + def test_connection_class_cache + mod = Module.new + a, b = nil, nil + EM.run { + EM.start_server '127.0.0.1', @port, mod + a = EM.connect '127.0.0.1', @port, mod + b = EM.connect '127.0.0.1', @port, mod + EM.stop + } + assert_equal a.class, b.class + assert_kind_of EM::Connection, a + end + + #------------------------------------- + + + def test_em + assert_nothing_raised do + EM.run { + setup_timeout + EM.add_timer 0 do + EM.stop + end + } + end + end + + #------------------------------------- + + def test_timer + assert_nothing_raised do + EM.run { + setup_timeout + n = 0 + EM.add_periodic_timer(0.1) { + n += 1 + EM.stop if n == 2 + } + } + end + end + + #------------------------------------- + + # This test once threw an already-running exception. + module Trivial + def post_init + EM.stop + end + end + + def test_server + assert_nothing_raised do + EM.run { + setup_timeout + EM.start_server "127.0.0.1", @port, Trivial + EM.connect "127.0.0.1", @port + } + end + end + + #-------------------------------------- + + # EM#run_block starts the reactor loop, runs the supplied block, and then STOPS + # the loop automatically. Contrast with EM#run, which keeps running the reactor + # even after the supplied block completes. + def test_run_block + assert !EM.reactor_running? + a = nil + EM.run_block { a = "Worked" } + assert a + assert !EM.reactor_running? + end + + class UnbindError < EM::Connection + ERR = Class.new(StandardError) + def initialize *args + super + end + def connection_completed + close_connection_after_writing + end + def unbind + raise ERR + end + end + + def test_unbind_error + assert_raises( UnbindError::ERR ) { + EM.run { + EM.start_server "127.0.0.1", @port + EM.connect "127.0.0.1", @port, UnbindError + } + } + end + + module BrsTestSrv + def receive_data data + $received << data + end + def unbind + EM.stop + end + end + module BrsTestCli + def post_init + send_data $sent + close_connection_after_writing + end + end + + # From ticket #50 + def test_byte_range_send + $received = '' + $sent = (0..255).to_a.pack('C*') + EM::run { + EM::start_server "127.0.0.1", @port, BrsTestSrv + EM::connect "127.0.0.1", @port, BrsTestCli + + setup_timeout + } + assert_equal($sent, $received) + end + + def test_bind_connect + local_ip = UDPSocket.open {|s| s.connect('google.com', 80); s.addr.last } + + bind_port = next_port + + port, ip = nil + bound_server = Module.new do + define_method :post_init do + begin + port, ip = Socket.unpack_sockaddr_in(get_peername) + ensure + EM.stop + end + end + end + + EM.run do + setup_timeout + EM.start_server "127.0.0.1", @port, bound_server + EM.bind_connect local_ip, bind_port, "127.0.0.1", @port + end + + assert_equal bind_port, port + assert_equal local_ip, ip + end + + def test_reactor_thread? + assert !EM.reactor_thread? + EM.run { assert EM.reactor_thread?; EM.stop } + assert !EM.reactor_thread? + end + + def test_schedule_on_reactor_thread + x = false + EM.run do + EM.schedule { x = true } + EM.stop + end + assert x + end + + def test_schedule_from_thread + x = false + EM.run do + Thread.new { EM.schedule { x = true; EM.stop } }.join + end + assert x + end + + if EM.respond_to? :set_heartbeat_interval + def test_set_heartbeat_interval + interval = 0.5 + EM.run { + EM.set_heartbeat_interval interval + $interval = EM.get_heartbeat_interval + EM.stop + } + assert_equal(interval, $interval) + end + else + warn "EM.set_heartbeat_interval not implemented, skipping a test in #{__FILE__}" + end + + module PostInitRaiser + ERR = Class.new(StandardError) + def post_init + raise ERR + end + end + + def test_bubble_errors_from_post_init + assert_raises(PostInitRaiser::ERR) do + EM.run do + EM.start_server "127.0.0.1", @port + EM.connect "127.0.0.1", @port, PostInitRaiser + end + end + end + + module InitializeRaiser + ERR = Class.new(StandardError) + def initialize + raise ERR + end + end + + def test_bubble_errors_from_initialize + assert_raises(InitializeRaiser::ERR) do + EM.run do + EM.start_server "127.0.0.1", @port + EM.connect "127.0.0.1", @port, InitializeRaiser + end + end + end + + def test_schedule_close + localhost, port = '127.0.0.1', 9000 + timer_ran = false + num_close_scheduled = nil + EM.run do + assert_equal 0, EM.num_close_scheduled + EM.add_timer(1) { timer_ran = true; EM.stop } + EM.start_server localhost, port do |s| + s.close_connection + num_close_scheduled = EM.num_close_scheduled + end + EM.connect localhost, port do |c| + def c.unbind + EM.stop + end + end + end + assert !timer_ran + assert_equal 1, num_close_scheduled + end + + def test_fork_safe + return unless cpid = fork { exit! } rescue false + + read, write = IO.pipe + EM.run do + cpid = fork do + write.puts "forked" + EM.run do + EM.next_tick do + write.puts "EM ran" + exit! + end + end + end + EM.stop + end + Process.waitall + assert_equal "forked\n", read.readline + assert_equal "EM ran\n", read.readline + ensure + read.close rescue nil + write.close rescue nil + end + + def test_error_handler_idempotent # issue 185 + errors = [] + ticks = [] + EM.error_handler do |e| + errors << e + end + + EM.run do + EM.next_tick do + ticks << :first + raise + end + EM.next_tick do + ticks << :second + end + EM.add_timer(0.001) { EM.stop } + end + + assert_equal 1, errors.size + assert_equal [:first, :second], ticks + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_channel.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_channel.rb new file mode 100644 index 000000000..bd4604af8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_channel.rb @@ -0,0 +1,62 @@ +require 'em_test_helper' + +class TestEMChannel < Test::Unit::TestCase + def test_channel_subscribe + s = 0 + EM.run do + c = EM::Channel.new + c.subscribe { |v| s = v; EM.stop } + c << 1 + end + assert_equal 1, s + end + + def test_channel_unsubscribe + s = 0 + EM.run do + c = EM::Channel.new + subscription = c.subscribe { |v| s = v } + c.unsubscribe(subscription) + c << 1 + EM.next_tick { EM.stop } + end + assert_not_equal 1, s + end + + def test_channel_pop + s = 0 + EM.run do + c = EM::Channel.new + c.pop{ |v| s = v } + c.push(1,2,3) + c << 4 + c << 5 + EM.next_tick { EM.stop } + end + assert_equal 1, s + end + + def test_channel_reactor_thread_push + out = [] + c = EM::Channel.new + c.subscribe { |v| out << v } + Thread.new { c.push(1,2,3) }.join + assert out.empty? + + EM.run { EM.next_tick { EM.stop } } + + assert_equal [1,2,3], out + end + + def test_channel_reactor_thread_callback + out = [] + c = EM::Channel.new + Thread.new { c.subscribe { |v| out << v } }.join + c.push(1,2,3) + assert out.empty? + + EM.run { EM.next_tick { EM.stop } } + + assert_equal [1,2,3], out + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_completion.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_completion.rb new file mode 100644 index 000000000..a2577c7cd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_completion.rb @@ -0,0 +1,177 @@ +require 'em/completion' + +class TestCompletion < Test::Unit::TestCase + def completion + @completion ||= EM::Completion.new + end + + def crank + # This is a slow solution, but this just executes the next tick queue + # once. It's the easiest way for now. + EM.run { EM.stop } + end + + def results + @results ||= [] + end + + def test_state + assert_equal :unknown, completion.state + end + + def test_succeed + completion.callback { |val| results << val } + completion.succeed :object + crank + assert_equal :succeeded, completion.state + assert_equal [:object], results + end + + def test_fail + completion.errback { |val| results << val } + completion.fail :object + crank + assert_equal :failed, completion.state + assert_equal [:object], results + end + + def test_callback + completion.callback { results << :callback } + completion.errback { results << :errback } + completion.succeed + crank + assert_equal [:callback], results + end + + def test_errback + completion.callback { results << :callback } + completion.errback { results << :errback } + completion.fail + crank + assert_equal [:errback], results + end + + def test_stateback + completion.stateback(:magic) { results << :stateback } + completion.change_state(:magic) + crank + assert_equal [:stateback], results + end + + def test_does_not_enqueue_when_completed + completion.callback { results << :callback } + completion.succeed + completion.errback { results << :errback } + completion.fail + crank + assert_equal [:callback], results + end + + def test_completed + assert_equal false, completion.completed? + completion.succeed + assert_equal true, completion.completed? + completion.fail + assert_equal true, completion.completed? + completion.change_state :magic + assert_equal false, completion.completed? + end + + def test_recursive_callbacks + completion.callback do |val| + results << val + completion.succeed :two + end + completion.callback do |val| + results << val + completion.succeed :three + end + completion.callback do |val| + results << val + end + completion.succeed :one + crank + assert_equal [:one, :two, :three], results + end + + def test_late_defined_callbacks + completion.callback { results << :one } + completion.succeed + crank + assert_equal [:one], results + completion.callback { results << :two } + crank + assert_equal [:one, :two], results + end + + def test_cleared_completions + completion.callback { results << :callback } + completion.errback { results << :errback } + + completion.succeed + crank + completion.fail + crank + completion.succeed + crank + + assert_equal [:callback], results + end + + def test_skip_completed_callbacks + completion.callback { results << :callback } + completion.succeed + crank + + completion.errback { results << :errback } + completion.fail + crank + + assert_equal [:callback], results + end + + def test_completions + completion.completion { results << :completion } + completion.succeed + crank + assert_equal [:completion], results + + completion.change_state(:unknown) + results.clear + + completion.completion { results << :completion } + completion.fail + crank + assert_equal [:completion], results + end + + def test_latent_completion + completion.completion { results << :completion } + completion.succeed + crank + completion.completion { results << :completion } + crank + assert_equal [:completion, :completion], results + end + + def test_timeout + args = [1, 2, 3] + EM.run do + completion.timeout(0.0001, *args) + completion.errback { |*errargs| results << errargs } + completion.completion { EM.stop } + EM.add_timer(0.1) { flunk 'test timed out' } + end + assert_equal [[1,2,3]], results + end + + def test_timeout_gets_cancelled + EM.run do + completion.timeout(0.0001, :timeout) + completion.errback { results << :errback } + completion.succeed + EM.add_timer(0.0002) { EM.stop } + end + assert_equal [], results + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_connection_count.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_connection_count.rb new file mode 100644 index 000000000..91611f0a3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_connection_count.rb @@ -0,0 +1,33 @@ +require 'em_test_helper' + +class TestConnectionCount < Test::Unit::TestCase + def test_idle_connection_count + EM.run { + $count = EM.connection_count + EM.stop_event_loop + } + + assert_equal(0, $count) + end + + module Client + def connection_completed + $client_conns += 1 + EM.stop if $client_conns == 3 + end + end + + def test_with_some_connections + EM.run { + $client_conns = 0 + $initial_conns = EM.connection_count + EM.start_server("127.0.0.1", 9999) + $server_conns = EM.connection_count + 3.times { EM.connect("127.0.0.1", 9999, Client) } + } + + assert_equal(0, $initial_conns) + assert_equal(1, $server_conns) + assert_equal(4, $client_conns + $server_conns) + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_defer.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_defer.rb new file mode 100644 index 000000000..c59c1fa3d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_defer.rb @@ -0,0 +1,18 @@ +require 'em_test_helper' + +class TestDefer < Test::Unit::TestCase + + def test_defers + n = 0 + n_times = 20 + EM.run { + n_times.times { + work_proc = proc { n += 1 } + callback = proc { EM.stop if n == n_times } + EM.defer work_proc, callback + } + } + assert_equal( n, n_times ) + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_deferrable.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_deferrable.rb new file mode 100644 index 000000000..5f286a77e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_deferrable.rb @@ -0,0 +1,35 @@ +require 'em_test_helper' + +class TestDeferrable < Test::Unit::TestCase + class Later + include EM::Deferrable + end + + def test_timeout_without_args + assert_nothing_raised do + EM.run { + df = Later.new + df.timeout(0) + df.errback { EM.stop } + EM.add_timer(0.01) { flunk "Deferrable was not timed out." } + } + end + end + + def test_timeout_with_args + args = nil + + EM.run { + df = Later.new + df.timeout(0, :timeout, :foo) + df.errback do |type, name| + args = [type, name] + EM.stop + end + + EM.add_timer(0.01) { flunk "Deferrable was not timed out." } + } + + assert_equal [:timeout, :foo], args + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_epoll.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_epoll.rb new file mode 100644 index 000000000..e02cac1b2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_epoll.rb @@ -0,0 +1,130 @@ +require 'em_test_helper' + + +class TestEpoll < Test::Unit::TestCase + + module TestEchoServer + def receive_data data + send_data data + close_connection_after_writing + end + end + + module TestEchoClient + def connection_completed + send_data "ABCDE" + $max += 1 + end + def receive_data data + raise "bad response" unless data == "ABCDE" + end + def unbind + $n -= 1 + EM.stop if $n == 0 + end + end + + + if windows? || jruby? + warn "EM.set_descriptor_table_size not implemented, skipping test in #{__FILE__}" + else + # We can set the rlimit/nofile of a process but we can only set it + # higher if we're running as root. + # On most systems, the default value is 1024. + def test_rlimit + unless EM.set_descriptor_table_size >= 1024 + a = EM.set_descriptor_table_size + assert( a <= 1024 ) + a = EM.set_descriptor_table_size( 1024 ) + assert( a == 1024 ) + end + end + end + + # Run a high-volume version of this test by kicking the number of connections + # up past 512. (Each connection uses two sockets, a client and a server.) + # (Will require running the test as root) + # This test exercises TCP clients and servers. + # + # XXX this test causes all sort of weird issues on OSX (when run as part of the suite) + def _test_descriptors + EM.epoll + EM.set_descriptor_table_size 60000 + EM.run { + EM.start_server "127.0.0.1", 9800, TestEchoServer + $n = 0 + $max = 0 + 100.times { + EM.connect("127.0.0.1", 9800, TestEchoClient) {$n += 1} + } + } + assert_equal(0, $n) + assert_equal(100, $max) + end + + def setup + @port = next_port + end + + module TestDatagramServer + def receive_data dgm + $in = dgm + send_data "abcdefghij" + end + end + module TestDatagramClient + def initialize port + @port = port + end + + def post_init + send_datagram "1234567890", "127.0.0.1", @port + end + + def receive_data dgm + $out = dgm + EM.stop + end + end + + def test_datagrams + $in = $out = "" + EM.run { + EM.open_datagram_socket "127.0.0.1", @port, TestDatagramServer + EM.open_datagram_socket "127.0.0.1", 0, TestDatagramClient, @port + } + assert_equal( "1234567890", $in ) + assert_equal( "abcdefghij", $out ) + end + + # XXX this test fails randomly.. + def _test_unix_domain + fn = "/tmp/xxx.chain" + EM.epoll + EM.set_descriptor_table_size 60000 + EM.run { + # The pure-Ruby version won't let us open the socket if the node already exists. + # Not sure, that actually may be correct and the compiled version is wrong. + # Pure Ruby also oddly won't let us make that many connections. This test used + # to run 100 times. Not sure where that lower connection-limit is coming from in + # pure Ruby. + # Let's not sweat the Unix-ness of the filename, since this test can't possibly + # work on Windows anyway. + # + File.unlink(fn) if File.exist?(fn) + EM.start_unix_domain_server fn, TestEchoServer + $n = 0 + $max = 0 + 50.times { + EM.connect_unix_domain(fn, TestEchoClient) {$n += 1} + } + EM::add_timer(1) { $stderr.puts("test_unix_domain timed out!"); EM::stop } + } + assert_equal(0, $n) + assert_equal(50, $max) + ensure + File.unlink(fn) if File.exist?(fn) + end + +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_error_handler.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_error_handler.rb new file mode 100644 index 000000000..23c23f74b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_error_handler.rb @@ -0,0 +1,38 @@ +require 'em_test_helper' + +class TestErrorHandler < Test::Unit::TestCase + def setup + @exception = Class.new(StandardError) + end + + def test_error_handler + error = nil + + EM.error_handler{ |e| + error = e + EM.error_handler(nil) + EM.stop + } + + assert_nothing_raised do + EM.run{ + EM.add_timer(0){ + raise @exception, 'test' + } + } + end + + assert_equal error.class, @exception + assert_equal error.message, 'test' + end + + def test_without_error_handler + assert_raise @exception do + EM.run{ + EM.add_timer(0){ + raise @exception, 'test' + } + } + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_exc.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_exc.rb new file mode 100644 index 000000000..f8384b57e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_exc.rb @@ -0,0 +1,28 @@ +require 'em_test_helper' + +class TestSomeExceptions < Test::Unit::TestCase + + # Read the commentary in EM#run. + # This test exercises the ensure block in #run that makes sure + # EM#release_machine gets called even if an exception is + # thrown within the user code. Without the ensured call to release_machine, + # the second call to EM#run will fail with a C++ exception + # because the machine wasn't cleaned up properly. + + def test_a + assert_raises(RuntimeError) { + EM.run { + raise "some exception" + } + } + end + + def test_b + assert_raises(RuntimeError) { + EM.run { + raise "some exception" + } + } + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_file_watch.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_file_watch.rb new file mode 100644 index 000000000..d50b80e23 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_file_watch.rb @@ -0,0 +1,65 @@ +require 'em_test_helper' +require 'tempfile' + +class TestFileWatch < Test::Unit::TestCase + if windows? + def test_watch_file_raises_unsupported_error + assert_raises(EM::Unsupported) do + EM.run do + file = Tempfile.new("fake_file") + EM.watch_file(file.path) + end + end + end + elsif EM.respond_to? :watch_filename + module FileWatcher + def file_modified + $modified = true + end + def file_deleted + $deleted = true + end + def unbind + $unbind = true + EM.stop + end + end + + def setup + EM.kqueue = true if EM.kqueue? + end + + def teardown + EM.kqueue = false if EM.kqueue? + end + + def test_events + EM.run{ + file = Tempfile.new('em-watch') + $tmp_path = file.path + + # watch it + watch = EM.watch_file(file.path, FileWatcher) + $path = watch.path + + # modify it + File.open(file.path, 'w'){ |f| f.puts 'hi' } + + # delete it + EM.add_timer(0.01){ file.close; file.delete } + } + + assert_equal($path, $tmp_path) + assert($modified) + assert($deleted) + assert($unbind) + end + else + warn "EM.watch_file not implemented, skipping tests in #{__FILE__}" + + # Because some rubies will complain if a TestCase class has no tests + def test_em_watch_file_unsupported + assert true + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_futures.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_futures.rb new file mode 100644 index 000000000..b4948567d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_futures.rb @@ -0,0 +1,170 @@ +require 'em_test_helper' + +class TestFutures < Test::Unit::TestCase + + def setup + end + + def teardown + end + + def test_future + assert_equal(100, EM::Deferrable.future(100) ) + + p1 = proc { 100 + 1 } + assert_equal(101, EM::Deferrable.future(p1) ) + end + + class MyFuture + include EM::Deferrable + def initialize *args + super + set_deferred_status :succeeded, 40 + end + end + + class MyErrorFuture + include EM::Deferrable + def initialize *args + super + set_deferred_status :failed, 41 + end + end + + + def test_future_1 + # Call future with one additional argument and it will be treated as a callback. + def my_future + MyFuture.new + end + + value = nil + EM::Deferrable.future my_future, proc {|v| value=v} + assert_equal( 40, value ) + end + + + def test_future_2 + # Call future with two additional arguments and they will be treated as a callback + # and an errback. + value = nil + EM::Deferrable.future MyErrorFuture.new, nil, proc {|v| value=v} + assert_equal( 41, value ) + end + + + def test_future_3 + # Call future with no additional arguments but with a block, and the block will be + # treated as a callback. + value = nil + EM::Deferrable.future MyFuture.new do |v| + value=v + end + assert_equal( 40, value ) + end + + + class RecursiveCallback + include EM::Deferrable + end + + # A Deferrable callback can call #set_deferred_status to change the values + # passed to subsequent callbacks. + # + def test_recursive_callbacks + n = 0 # counter assures that all the tests actually run. + rc = RecursiveCallback.new + rc.callback {|a| + assert_equal(100, a) + n += 1 + rc.set_deferred_status :succeeded, 101, 101 + } + rc.callback {|a,b| + assert_equal(101, a) + assert_equal(101, b) + n += 1 + rc.set_deferred_status :succeeded, 102, 102, 102 + } + rc.callback {|a,b,c| + assert_equal(102, a) + assert_equal(102, b) + assert_equal(102, c) + n += 1 + } + rc.set_deferred_status :succeeded, 100 + assert_equal(3, n) + end + + def test_syntactic_sugar + rc = RecursiveCallback.new + rc.set_deferred_success 100 + rc.set_deferred_failure 200 + end + + # It doesn't raise an error to set deferred status more than once. + # In fact, this is a desired and useful idiom when it happens INSIDE + # a callback or errback. + # However, it's less useful otherwise, and in fact would generally be + # indicative of a programming error. However, we would like to be resistant + # to such errors. So whenever we set deferred status, we also clear BOTH + # stacks of handlers. + # + def test_double_calls + s = 0 + e = 0 + + d = EM::DefaultDeferrable.new + d.callback {s += 1} + d.errback {e += 1} + + d.succeed # We expect the callback to be called, and the errback to be DISCARDED. + d.fail # Presumably an error. We expect the errback NOT to be called. + d.succeed # We expect the callback to have been discarded and NOT to be called again. + + assert_equal(1, s) + assert_equal(0, e) + end + + # Adding a callback to a Deferrable that is already in a success state executes the callback + # immediately. The same applies to a an errback added to an already-failed Deferrable. + # HOWEVER, we expect NOT to be able to add errbacks to succeeded Deferrables, or callbacks + # to failed ones. + # + # We illustrate this with a rather contrived test. The test calls #fail after #succeed, + # which ordinarily would not happen in a real program. + # + # What we're NOT attempting to specify is what happens if a Deferrable is succeeded and then + # failed (or vice-versa). Should we then be able to add callbacks/errbacks of the appropriate + # type for immediate execution? For now at least, the official answer is "don't do that." + # + def test_delayed_callbacks + s1 = 0 + s2 = 0 + e = 0 + + d = EM::DefaultDeferrable.new + d.callback {s1 += 1} + + d.succeed # Triggers and discards the callback. + + d.callback {s2 += 1} # This callback is executed immediately and discarded. + + d.errback {e += 1} # This errback should be DISCARDED and never execute. + d.fail # To prove it, fail and assert e is 0 + + assert_equal( [1,1], [s1,s2] ) + assert_equal( 0, e ) + end + + def test_timeout + n = 0 + EM.run { + d = EM::DefaultDeferrable.new + d.callback {n = 1; EM.stop} + d.errback {n = 2; EM.stop} + d.timeout(0.01) + } + assert_equal( 2, n ) + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_get_sock_opt.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_get_sock_opt.rb new file mode 100644 index 000000000..9ef7e45e9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_get_sock_opt.rb @@ -0,0 +1,37 @@ +require 'em_test_helper' +require 'socket' + +class TestGetSockOpt < Test::Unit::TestCase + + if EM.respond_to? :get_sock_opt + def setup + assert(!EM.reactor_running?) + end + + def teardown + assert(!EM.reactor_running?) + end + + #------------------------------------- + + def test_get_sock_opt + test = self + EM.run do + EM.connect 'google.com', 80, Module.new { + define_method :connection_completed do + val = get_sock_opt Socket::SOL_SOCKET, Socket::SO_ERROR + test.assert_equal "\0\0\0\0", val + EM.stop + end + } + end + end + else + warn "EM.get_sock_opt not implemented, skipping tests in #{__FILE__}" + + # Because some rubies will complain if a TestCase class has no tests + def test_em_get_sock_opt_unsupported + assert true + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_handler_check.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_handler_check.rb new file mode 100644 index 000000000..c4176941b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_handler_check.rb @@ -0,0 +1,35 @@ +require 'em_test_helper' + +class TestHandlerCheck < Test::Unit::TestCase + + class Foo < EM::Connection; end; + module TestModule; end; + + def test_with_correct_class + assert_nothing_raised do + EM.run { + EM.connect("127.0.0.1", 80, Foo) + EM.stop_event_loop + } + end + end + + def test_with_incorrect_class + assert_raise(ArgumentError) do + EM.run { + EM.connect("127.0.0.1", 80, String) + EM.stop_event_loop + } + end + end + + def test_with_module + assert_nothing_raised do + EM.run { + EM.connect("127.0.0.1", 80, TestModule) + EM.stop_event_loop + } + end + end + +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_hc.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_hc.rb new file mode 100644 index 000000000..28e32c9ce --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_hc.rb @@ -0,0 +1,155 @@ +require 'em_test_helper' + +class TestHeaderAndContentProtocol < Test::Unit::TestCase + + class SimpleTest < EM::P::HeaderAndContentProtocol + attr_reader :first_header, :my_headers, :request + + def receive_first_header_line hdr + @first_header ||= [] + @first_header << hdr + end + def receive_headers hdrs + @my_headers ||= [] + @my_headers << hdrs + end + def receive_request hdrs, content + @request ||= [] + @request << [hdrs, content] + end + end + + class StopOnUnbind < EM::Connection + def unbind + EM.add_timer(0.01) { EM.stop } + end + end + + def setup + @port = next_port + end + + def test_no_content + the_connection = nil + EM.run { + EM.start_server( "127.0.0.1", @port, SimpleTest ) do |conn| + the_connection = conn + end + setup_timeout + + EM.connect "127.0.0.1", @port, StopOnUnbind do |c| + c.send_data [ "aaa\n", "bbb\r\n", "ccc\n", "\n" ].join + c.close_connection_after_writing + end + } + assert_equal( ["aaa"], the_connection.first_header ) + assert_equal( [%w(aaa bbb ccc)], the_connection.my_headers ) + assert_equal( [[%w(aaa bbb ccc), ""]], the_connection.request ) + end + + def test_content + the_connection = nil + content = "A" * 50 + headers = ["aaa", "bbb", "Content-length: #{content.length}", "ccc"] + EM.run { + EM.start_server( "127.0.0.1", @port, SimpleTest ) do |conn| + the_connection = conn + end + setup_timeout + + EM.connect "127.0.0.1", @port, StopOnUnbind do |c| + headers.each { |h| c.send_data "#{h}\r\n" } + c.send_data "\n" + c.send_data content + c.close_connection_after_writing + end + } + assert_equal( ["aaa"], the_connection.first_header ) + assert_equal( [headers], the_connection.my_headers ) + assert_equal( [[headers, content]], the_connection.request ) + end + + def test_several_requests + the_connection = nil + content = "A" * 50 + headers = ["aaa", "bbb", "Content-length: #{content.length}", "ccc"] + EM.run { + EM.start_server( "127.0.0.1", @port, SimpleTest ) do |conn| + the_connection = conn + end + setup_timeout + + EM.connect( "127.0.0.1", @port, StopOnUnbind ) do |c| + 5.times do + headers.each { |h| c.send_data "#{h}\r\n" } + c.send_data "\n" + c.send_data content + end + c.close_connection_after_writing + end + } + assert_equal( ["aaa"] * 5, the_connection.first_header ) + assert_equal( [headers] * 5, the_connection.my_headers ) + assert_equal( [[headers, content]] * 5, the_connection.request ) + end + + + # def x_test_multiple_content_length_headers + # # This is supposed to throw a RuntimeError but it throws a C++ exception instead. + # the_connection = nil + # content = "A" * 50 + # headers = ["aaa", "bbb", ["Content-length: #{content.length}"]*2, "ccc"].flatten + # EM.run { + # EM.start_server( "127.0.0.1", @port, SimpleTest ) do |conn| + # the_connection = conn + # end + # EM.add_timer(4) {raise "test timed out"} + # test_proc = proc { + # t = TCPSocket.new "127.0.0.1", @port + # headers.each {|h| t.write "#{h}\r\n" } + # t.write "\n" + # t.write content + # t.close + # } + # EM.defer test_proc, proc { + # EM.stop + # } + # } + # end + + def test_interpret_headers + the_connection = nil + content = "A" * 50 + headers = [ + "GET / HTTP/1.0", + "Accept: aaa", + "User-Agent: bbb", + "Host: ccc", + "x-tempest-header:ddd" + ] + + EM.run { + EM.start_server( "127.0.0.1", @port, SimpleTest ) do |conn| + the_connection = conn + end + setup_timeout + + EM.connect( "127.0.0.1", @port, StopOnUnbind ) do |c| + headers.each { |h| c.send_data "#{h}\r\n" } + c.send_data "\n" + c.send_data content + c.close_connection_after_writing + end + } + + hsh = the_connection.headers_2_hash( the_connection.my_headers.shift ) + expect = { + :accept => "aaa", + :user_agent => "bbb", + :host => "ccc", + :x_tempest_header => "ddd" + } + assert_equal(expect, hsh) + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_httpclient.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_httpclient.rb new file mode 100644 index 000000000..06ad7689c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_httpclient.rb @@ -0,0 +1,190 @@ +require 'em_test_helper' + +class TestHttpClient < Test::Unit::TestCase + + Localhost = "127.0.0.1" + Localport = 9801 + + def setup + end + + def teardown + end + + #------------------------------------- + + def test_http_client + ok = false + EM.run { + c = silent { EM::P::HttpClient.send :request, :host => "www.google.com", :port => 80 } + c.callback { + ok = true + EM.stop + } + c.errback {EM.stop} # necessary, otherwise a failure blocks the test suite forever. + } + assert ok + end + + #------------------------------------- + + def test_http_client_1 + ok = false + EM.run { + c = silent { EM::P::HttpClient.send :request, :host => "www.google.com", :port => 80 } + c.callback {ok = true; EM.stop} + c.errback {EM.stop} + } + assert ok + end + + #------------------------------------- + + def test_http_client_2 + ok = false + EM.run { + c = silent { EM::P::HttpClient.send :request, :host => "www.google.com", :port => 80 } + c.callback {|result| + ok = true; + EM.stop + } + c.errback {EM.stop} + } + assert ok + end + + + #----------------------------------------- + + # Test a server that returns a page with a zero content-length. + # This caused an early version of the HTTP client not to generate a response, + # causing this test to hang. Observe, there was no problem with responses + # lacking a content-length, just when the content-length was zero. + # + class EmptyContent < EM::Connection + def initialize *args + super + end + def receive_data data + send_data "HTTP/1.0 404 ...\r\nContent-length: 0\r\n\r\n" + close_connection_after_writing + end + end + + def test_http_empty_content + ok = false + EM.run { + EM.start_server "127.0.0.1", 9701, EmptyContent + c = silent { EM::P::HttpClient.send :request, :host => "127.0.0.1", :port => 9701 } + c.callback {|result| + ok = true + EM.stop + } + } + assert ok + end + + + #--------------------------------------- + + class PostContent < EM::P::LineAndTextProtocol + def initialize *args + super + @lines = [] + end + def receive_line line + if line.length > 0 + @lines << line + else + process_headers + end + end + def receive_binary_data data + @post_content = data + send_response + end + def process_headers + if @lines.first =~ /\APOST ([^\s]+) HTTP\/1.1\Z/ + @uri = $1.dup + else + raise "bad request" + end + + @lines.each {|line| + if line =~ /\AContent-length:\s*(\d+)\Z/i + @content_length = $1.dup.to_i + elsif line =~ /\AContent-type:\s*(\d+)\Z/i + @content_type = $1.dup + end + } + + raise "invalid content length" unless @content_length + set_binary_mode @content_length + end + def send_response + send_data "HTTP/1.1 200 ...\r\nConnection: close\r\nContent-length: 10\r\nContent-type: text/html\r\n\r\n0123456789" + close_connection_after_writing + end + end + + # TODO, this is WRONG. The handler is asserting an HTTP 1.1 request, but the client + # is sending a 1.0 request. Gotta fix the client + def test_post + response = nil + EM.run { + EM.start_server Localhost, Localport, PostContent + setup_timeout(2) + c = silent { EM::P::HttpClient.request( + :host=>Localhost, + :port=>Localport, + :method=>:post, + :request=>"/aaa", + :content=>"XYZ", + :content_type=>"text/plain" + )} + c.callback {|r| + response = r + EM.stop + } + } + + assert_equal( 200, response[:status] ) + assert_equal( "0123456789", response[:content] ) + end + + + # TODO, need a more intelligent cookie tester. + # In fact, this whole test-harness needs a beefier server implementation. + def test_cookie + ok = false + EM.run { + c = silent { EM::Protocols::HttpClient.send :request, :host => "www.google.com", :port => 80, :cookie=>"aaa=bbb" } + c.callback {|result| + ok = true; + EM.stop + } + c.errback {EM.stop} + } + assert ok + end + + # We can tell the client to send an HTTP/1.0 request (default is 1.1). + # This is useful for suppressing chunked responses until those are working. + def test_version_1_0 + ok = false + EM.run { + c = silent { EM::P::HttpClient.request( + :host => "www.google.com", + :port => 80, + :version => "1.0" + )} + c.callback {|result| + ok = true; + EM.stop + } + c.errback {EM.stop} + } + assert ok + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_httpclient2.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_httpclient2.rb new file mode 100644 index 000000000..634c7a372 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_httpclient2.rb @@ -0,0 +1,128 @@ +require 'em_test_helper' + +class TestHttpClient2 < Test::Unit::TestCase + Localhost = "127.0.0.1" + Localport = 9801 + + def setup + end + + def teardown + end + + + class TestServer < EM::Connection + end + + # #connect returns an object which has made a connection to an HTTP server + # and exposes methods for making HTTP requests on that connection. + # #connect can take either a pair of parameters (a host and a port), + # or a single parameter which is a Hash. + # + def test_connect + EM.run { + EM.start_server Localhost, Localport, TestServer + silent do + EM::P::HttpClient2.connect Localhost, Localport + EM::P::HttpClient2.connect( :host=>Localhost, :port=>Localport ) + end + EM.stop + } + end + + + def test_bad_port + EM.run { + EM.start_server Localhost, Localport, TestServer + assert_raises( ArgumentError ) { + silent { EM::P::HttpClient2.connect Localhost, "xxx" } + } + EM.stop + } + end + + def test_bad_server + err = nil + EM.run { + http = silent { EM::P::HttpClient2.connect Localhost, 9999 } + d = http.get "/" + d.errback { err = true; d.internal_error; EM.stop } + } + assert(err) + end + + def test_get + content = nil + EM.run { + http = silent { EM::P::HttpClient2.connect "google.com", 80 } + d = http.get "/" + d.callback { + content = d.content + EM.stop + } + } + assert(content) + end + + # Not a pipelined request because we wait for one response before we request the next. + # XXX this test is broken because it sends the second request to the first connection + # XXX right before the connection closes + def _test_get_multiple + content = nil + EM.run { + http = silent { EM::P::HttpClient2.connect "google.com", 80 } + d = http.get "/" + d.callback { + e = http.get "/" + e.callback { + content = e.content + EM.stop + } + } + } + assert(content) + end + + def test_get_pipeline + headers, headers2 = nil, nil + EM.run { + http = silent { EM::P::HttpClient2.connect "google.com", 80 } + d = http.get("/") + d.callback { + headers = d.headers + } + e = http.get("/") + e.callback { + headers2 = e.headers + } + EM.tick_loop { EM.stop if headers && headers2 } + EM.add_timer(1) { EM.stop } + } + assert(headers) + assert(headers2) + end + + + def test_authheader + EM.run { + EM.start_server Localhost, Localport, TestServer + http = silent { EM::P::HttpClient2.connect Localhost, 18842 } + d = http.get :url=>"/", :authorization=>"Basic xxx" + d.callback {EM.stop} + d.errback {EM.stop} + } + end + + def test_https_get + d = nil + EM.run { + http = silent { EM::P::HttpClient2.connect :host => 'www.apple.com', :port => 443, :ssl => true } + d = http.get "/" + d.callback { + EM.stop + } + } + assert_equal(200, d.status) + end if EM.ssl? + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_idle_connection.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_idle_connection.rb new file mode 100644 index 000000000..d7790927b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_idle_connection.rb @@ -0,0 +1,23 @@ +require 'em_test_helper' + +class TestIdleConnection < Test::Unit::TestCase + if EM.respond_to?(:get_idle_time) + def test_idle_time + EM.run{ + conn = EM.connect 'www.google.com', 80 + EM.add_timer(3){ + $idle_time = conn.get_idle_time + conn.send_data "GET / HTTP/1.0\r\n\r\n" + EM.next_tick{ + $idle_time_after_send = conn.get_idle_time + conn.close_connection + EM.stop + } + } + } + + assert_in_delta 3, $idle_time, 0.2 + assert_equal 0, $idle_time_after_send + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_inactivity_timeout.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_inactivity_timeout.rb new file mode 100644 index 000000000..15e39a2f7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_inactivity_timeout.rb @@ -0,0 +1,54 @@ +require 'em_test_helper' + +class TestInactivityTimeout < Test::Unit::TestCase + + if EM.respond_to? :get_comm_inactivity_timeout + def test_default + EM.run { + c = EM.connect("127.0.0.1", 54321) + assert_equal 0.0, c.comm_inactivity_timeout + EM.stop + } + end + + def test_set_and_get + EM.run { + c = EM.connect("127.0.0.1", 54321) + c.comm_inactivity_timeout = 2.5 + assert_equal 2.5, c.comm_inactivity_timeout + EM.stop + } + end + + def test_for_real + start, finish = nil + + timeout_handler = Module.new do + define_method :unbind do + finish = Time.now + EM.stop + end + end + + EM.run { + setup_timeout + EM.heartbeat_interval = 0.01 + EM.start_server("127.0.0.1", 12345) + EM.add_timer(0.01) { + start = Time.now + c = EM.connect("127.0.0.1", 12345, timeout_handler) + c.comm_inactivity_timeout = 0.02 + } + } + + assert_in_delta(0.02, (finish - start), 0.02) + end + else + warn "EM.comm_inactivity_timeout not implemented, skipping tests in #{__FILE__}" + + # Because some rubies will complain if a TestCase class has no tests + def test_em_comm_inactivity_timeout_not_implemented + assert true + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_kb.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_kb.rb new file mode 100644 index 000000000..8e52408ff --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_kb.rb @@ -0,0 +1,34 @@ +require 'em_test_helper' + +class TestKeyboardEvents < Test::Unit::TestCase + + if !jruby? + module KbHandler + include EM::Protocols::LineText2 + def receive_line d + EM::stop if d == "STOP" + end + end + + # This test doesn't actually do anything useful but is here to + # illustrate the usage. If you removed the timer and ran this test + # by itself on a console, and then typed into the console, it would + # work. + # I don't know how to get the test harness to simulate actual keystrokes. + # When someone figures that out, then we can make this a real test. + # + def test_kb + EM.run { + EM.open_keyboard KbHandler + EM::Timer.new(1) { EM.stop } + } if $stdout.tty? # don't run the test unless it stands a chance of validity. + end + else + warn "EM.open_keyboard not implemented, skipping tests in #{__FILE__}" + + # Because some rubies will complain if a TestCase class has no tests + def test_em_open_keyboard_unsupported + assert true + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_ltp.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_ltp.rb new file mode 100644 index 000000000..6449829d7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_ltp.rb @@ -0,0 +1,138 @@ +require 'em_test_helper' + +class TestLineAndTextProtocol < Test::Unit::TestCase + + class SimpleLineTest < EM::P::LineAndTextProtocol + def receive_line line + @line_buffer << line + end + end + + module StopClient + def set_receive_data(&blk) + @rdb = blk + end + + def receive_data data + @rdb.call(data) if @rdb + end + + def unbind + EM.add_timer(0.1) { EM.stop } + end + end + + def setup + @port = next_port + end + + def test_simple_lines + lines_received = [] + EM.run { + EM.start_server( "127.0.0.1", @port, SimpleLineTest ) do |conn| + conn.instance_eval "@line_buffer = lines_received" + end + setup_timeout + + EM.connect "127.0.0.1", @port, StopClient do |c| + c.send_data "aaa\nbbb\r\nccc\n" + c.close_connection_after_writing + end + } + assert_equal( %w(aaa bbb ccc), lines_received ) + end + + #-------------------------------------------------------------------- + + class SimpleLineTest < EM::P::LineAndTextProtocol + def receive_error text + @error_message << text + end + end + + def test_overlength_lines + lines_received = [] + EM.run { + EM.start_server( "127.0.0.1", @port, SimpleLineTest ) do |conn| + conn.instance_eval "@error_message = lines_received" + end + setup_timeout + + EM.connect "127.0.0.1", @port, StopClient do |c| + c.send_data "a" * (16*1024 + 1) + c.send_data "\n" + c.close_connection_after_writing + end + + } + assert_equal( ["overlength line"], lines_received ) + end + + + #-------------------------------------------------------------------- + + class LineAndTextTest < EM::P::LineAndTextProtocol + def receive_line line + if line =~ /content-length:\s*(\d+)/i + @content_length = $1.to_i + elsif line.length == 0 + set_binary_mode @content_length + end + end + def receive_binary_data text + send_data "received #{text.length} bytes" + close_connection_after_writing + end + end + + def test_lines_and_text + output = '' + EM.run { + EM.start_server( "127.0.0.1", @port, LineAndTextTest ) + setup_timeout + + EM.connect "127.0.0.1", @port, StopClient do |c| + c.set_receive_data { |data| output << data } + c.send_data "Content-length: 400\n" + c.send_data "\n" + c.send_data "A" * 400 + EM.add_timer(0.1) { c.close_connection_after_writing } + end + } + assert_equal( "received 400 bytes", output ) + end + + #-------------------------------------------------------------------- + + + class BinaryTextTest < EM::P::LineAndTextProtocol + def receive_line line + if line =~ /content-length:\s*(\d+)/i + set_binary_mode $1.to_i + else + raise "protocol error" + end + end + def receive_binary_data text + send_data "received #{text.length} bytes" + close_connection_after_writing + end + end + + def test_binary_text + output = '' + EM.run { + EM.start_server( "127.0.0.1", @port, BinaryTextTest ) + setup_timeout + + EM.connect "127.0.0.1", @port, StopClient do |c| + c.set_receive_data { |data| output << data } + c.send_data "Content-length: 10000\n" + c.send_data "A" * 10000 + EM.add_timer(0.1) { c.close_connection_after_writing } + end + } + assert_equal( "received 10000 bytes", output ) + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_ltp2.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_ltp2.rb new file mode 100644 index 000000000..0709f9e15 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_ltp2.rb @@ -0,0 +1,288 @@ +require 'em_test_helper' + +# TODO!!! Need tests for overlength headers and text bodies. + +class TestLineText2 < Test::Unit::TestCase + + # Run each of these tests two ways: passing in the whole test-dataset in one chunk, + # and passing it in one character at a time. + + class Basic + include EM::Protocols::LineText2 + attr_reader :lines + def receive_line line + (@lines ||= []) << line + end + end + def test_basic + testdata = "Line 1\nLine 2\r\nLine 3\n" + + a = Basic.new + a.receive_data testdata + assert_equal( ["Line 1", "Line 2", "Line 3"], a.lines ) + + a = Basic.new + testdata.length.times {|i| a.receive_data( testdata[i...i+1] ) } + assert_equal( ["Line 1", "Line 2", "Line 3"], a.lines ) + end + + class ChangeDelimiter + include EM::Protocols::LineText2 + attr_reader :lines + def initialize *args + super + @delim = "A" + set_delimiter @delim + end + def receive_line line + (@lines ||= []) << line + set_delimiter( @delim.succ! ) + end + end + + def test_change_delimiter + testdata = %Q(LineaALinebBLinecCLinedD) + + a = ChangeDelimiter.new + a.receive_data testdata + assert_equal( ["Linea", "Lineb", "Linec", "Lined"], a.lines ) + + a = ChangeDelimiter.new + testdata.length.times {|i| a.receive_data( testdata[i...i+1] ) } + assert_equal( ["Linea", "Lineb", "Linec", "Lined"], a.lines ) + end + + + #-- + # Test two lines followed by an empty line, ten bytes of binary data, then + # two more lines. + + class Binary + include EM::Protocols::LineText2 + attr_reader :lines, :body + def initialize *args + super + @lines = [] + @body = nil + end + def receive_line ln + if ln == "" + set_text_mode 10 + else + @lines << ln + end + end + def receive_binary_data data + @body = data + end + end + + def test_binary + testdata = %Q(Line 1 +Line 2 + +0000000000Line 3 +Line 4 +) + + a = Binary.new + a.receive_data testdata + assert_equal( ["Line 1", "Line 2", "Line 3", "Line 4"], a.lines) + assert_equal( "0000000000", a.body ) + + a = Binary.new + testdata.length.times {|i| a.receive_data( testdata[i...i+1] ) } + assert_equal( ["Line 1", "Line 2", "Line 3", "Line 4"], a.lines) + assert_equal( "0000000000", a.body ) + end + + + # Test unsized binary data. The expectation is that each chunk of it + # will be passed to us as it it received. + class UnsizedBinary + include EM::Protocols::LineText2 + attr_reader :n_calls, :body + def initialize *args + super + set_text_mode + end + def receive_binary_data data + @n_calls ||= 0 + @n_calls += 1 + (@body ||= "") << data + end + end + + def test_unsized_binary + testdata = "X\0" * 1000 + + a = UnsizedBinary.new + a.receive_data testdata + assert_equal( 1, a.n_calls ) + assert_equal( testdata, a.body ) + + a = UnsizedBinary.new + testdata.length.times {|i| a.receive_data( testdata[i...i+1] ) } + assert_equal( 2000, a.n_calls ) + assert_equal( testdata, a.body ) + end + + + # Test binary data with a "throw back" into line-mode. + class ThrowBack + include EM::Protocols::LineText2 + attr_reader :headers + def initialize *args + super + @headers = [] + @n_bytes = 0 + set_text_mode + end + def receive_binary_data data + wanted = 25 - @n_bytes + will_take = if data.length > wanted + data.length - wanted + else + data.length + end + @n_bytes += will_take + + if @n_bytes == 25 + set_line_mode( data[will_take..-1] ) + end + end + def receive_line ln + @headers << ln + end + end + def test_throw_back + testdata = "Line\n" * 10 + + a = ThrowBack.new + a.receive_data testdata + assert_equal( ["Line"] * 5, a.headers ) + + a = ThrowBack.new + testdata.length.times {|i| a.receive_data( testdata[i...i+1] ) } + assert_equal( ["Line"] * 5, a.headers ) + end + + # Test multi-character line delimiters. + # Also note that the test data has a "tail" with no delimiter, that will be + # discarded, but cf. the BinaryTail test. + # TODO!!! This test doesn't work in the byte-by-byte case. + class Multichar + include EM::Protocols::LineText2 + attr_reader :lines + def initialize *args + super + @lines = [] + set_delimiter "012" + end + def receive_line ln + @lines << ln + end + end + def test_multichar + testdata = "Line012Line012Line012Line" + + a = Multichar.new + a.receive_data testdata + assert_equal( ["Line"]*3, a.lines ) + + a = Multichar.new + testdata.length.times {|i| a.receive_data( testdata[i...i+1] ) } + # DOESN'T WORK in this case. Multi-character delimiters are broken. + #assert_equal( ["Line"]*3, a.lines ) + end + + # Test a binary "tail," when a sized binary transfer doesn't complete because + # of an unbind. We get a partial result. + class BinaryTail + include EM::Protocols::LineText2 + attr_reader :data + def initialize *args + super + @data = "" + set_text_mode 1000 + end + def receive_binary_data data + # we expect to get all the data in one chunk, even in the byte-by-byte case, + # because sized transfers by definition give us exactly one call to + # #receive_binary_data. + @data = data + end + end + def test_binary_tail + testdata = "0" * 500 + + a = BinaryTail.new + a.receive_data testdata + a.unbind + assert_equal( "0" * 500, a.data ) + + a = BinaryTail.new + testdata.length.times {|i| a.receive_data( testdata[i...i+1] ) } + a.unbind + assert_equal( "0" * 500, a.data ) + end + + + # Test an end-of-binary call. Arrange to receive binary data but don't bother counting it + # as it comes. Rely on getting receive_end_of_binary_data to signal the transition back to + # line mode. + # At the present time, this isn't strictly necessary with sized binary chunks because by + # definition we accumulate them and make exactly one call to receive_binary_data, but + # we may want to support a mode in the future that would break up large chunks into multiple + # calls. + class LazyBinary + include EM::Protocols::LineText2 + attr_reader :data, :end + def initialize *args + super + @data = "" + set_text_mode 1000 + end + def receive_binary_data data + # we expect to get all the data in one chunk, even in the byte-by-byte case, + # because sized transfers by definition give us exactly one call to + # #receive_binary_data. + @data = data + end + def receive_end_of_binary_data + @end = true + end + end + def test_receive_end_of_binary_data + testdata = "_" * 1000 + a = LazyBinary.new + testdata.length.times {|i| a.receive_data( testdata[i...i+1] ) } + assert_equal( "_" * 1000, a.data ) + assert( a.end ) + end + + + # This tests a bug fix in which calling set_text_mode failed when called + # inside receive_binary_data. + # + class BinaryPair + include EM::Protocols::LineText2 + attr_reader :sizes + def initialize *args + super + set_text_mode 1 + @sizes = [] + end + def receive_binary_data dt + @sizes << dt.length + set_text_mode( (dt.length == 1) ? 2 : 1 ) + end + end + def test_binary_pairs + test_data = "123" * 5 + a = BinaryPair.new + a.receive_data test_data + assert_equal( [1,2,1,2,1,2,1,2,1,2], a.sizes ) + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_next_tick.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_next_tick.rb new file mode 100644 index 000000000..9b60359c3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_next_tick.rb @@ -0,0 +1,104 @@ +require 'em_test_helper' + +class TestNextTick < Test::Unit::TestCase + + def test_tick_arg + pr = proc {EM.stop} + EM.run { + EM.next_tick pr + } + assert true + end + + def test_tick_block + EM.run { + EM.next_tick {EM.stop} + } + assert true + end + + # This illustrates the solution to a long-standing problem. + # It's now possible to correctly nest calls to EM#run. + # See the source code commentary for EM#run for more info. + # + def test_run_run + EM.run { + EM.run { + EM.next_tick {EM.stop} + } + } + end + + def test_pre_run_queue + x = false + EM.next_tick { EM.stop; x = true } + EM.run { EM.add_timer(0.01) { EM.stop } } + assert x + end + + def test_cleanup_after_stop + x = true + EM.run{ + EM.next_tick{ + EM.stop + EM.next_tick{ x=false } + } + } + EM.run{ + EM.next_tick{ EM.stop } + } + assert x + end + + # We now support an additional parameter for EM#run. + # You can pass two procs to EM#run now. The first is executed as the normal + # run block. The second (if given) is scheduled for execution after the + # reactor loop completes. + # The reason for supporting this is subtle. There has always been an expectation + # that EM#run doesn't return until after the reactor loop ends. But now it's + # possible to nest calls to EM#run, which means that a nested call WILL + # RETURN. In order to write code that will run correctly either way, it's + # recommended to put any code which must execute after the reactor completes + # in the second parameter. + # + def test_run_run_2 + a = proc {EM.stop} + b = proc {assert true} + EM.run a, b + end + + + # This illustrates that EM#run returns when it's called nested. + # This isn't a feature, rather it's something to be wary of when writing code + # that must run correctly even if EM#run is called while a reactor is already + # running. + def test_run_run_3 + a = [] + EM.run { + EM.run proc {EM.stop}, proc {a << 2} + a << 1 + } + assert_equal( [1,2], a ) + end + + + def test_schedule_on_reactor_thread + x = false + EM.run do + EM.schedule { x = true } + EM.stop + end + assert x + end + + def test_schedule_from_thread + x = false + EM.run do + Thread.new { EM.schedule { x = true } }.join + assert !x + EM.next_tick { EM.stop } + end + assert x + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_object_protocol.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_object_protocol.rb new file mode 100644 index 000000000..b1287ea81 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_object_protocol.rb @@ -0,0 +1,36 @@ +require 'em_test_helper' + +class TestObjectProtocol < Test::Unit::TestCase + module Server + include EM::P::ObjectProtocol + def post_init + send_object :hello=>'world' + end + def receive_object obj + $server = obj + EM.stop + end + end + + module Client + include EM::P::ObjectProtocol + def receive_object obj + $client = obj + send_object 'you_said'=>obj + end + end + + def setup + @port = next_port + end + + def test_send_receive + EM.run{ + EM.start_server "127.0.0.1", @port, Server + EM.connect "127.0.0.1", @port, Client + } + + assert($client == {:hello=>'world'}) + assert($server == {'you_said'=>{:hello=>'world'}}) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_pause.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_pause.rb new file mode 100644 index 000000000..3ace94871 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_pause.rb @@ -0,0 +1,78 @@ +require 'em_test_helper' + +class TestPause < Test::Unit::TestCase + if EM.respond_to? :pause_connection + def setup + @port = next_port + end + + def teardown + assert(!EM.reactor_running?) + end + + def test_pause_resume + server = nil + + s_rx = c_rx = 0 + + test_server = Module.new do + define_method :post_init do + server = self + end + + define_method :receive_data do |data| + s_rx += 1 + + EM.add_periodic_timer(0.01) { send_data 'hi' } + send_data 'hi' + + # pause server, now no outgoing data will actually + # be sent and no more incoming data will be received + pause + end + end + + test_client = Module.new do + def post_init + EM.add_periodic_timer(0.01) do + send_data 'hello' + end + end + + define_method :receive_data do |data| + c_rx += 1 + end + end + + EM.run do + EM.start_server "127.0.0.1", @port, test_server + EM.connect "127.0.0.1", @port, test_client + + EM.add_timer(0.05) do + assert_equal 1, s_rx + assert_equal 0, c_rx + assert server.paused? + + # resume server, queued outgoing and incoming data will be flushed + server.resume + + assert !server.paused? + + EM.add_timer(0.05) do + assert server.paused? + assert s_rx > 1 + assert c_rx > 0 + EM.stop + end + end + end + end + else + warn "EM.pause_connection not implemented, skipping tests in #{__FILE__}" + + # Because some rubies will complain if a TestCase class has no tests + def test_em_pause_connection_not_implemented + assert true + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_pending_connect_timeout.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_pending_connect_timeout.rb new file mode 100644 index 000000000..9c8203b20 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_pending_connect_timeout.rb @@ -0,0 +1,52 @@ +require 'em_test_helper' + +class TestPendingConnectTimeout < Test::Unit::TestCase + + if EM.respond_to? :get_pending_connect_timeout + def test_default + EM.run { + c = EM.connect("127.0.0.1", 54321) + assert_equal 20.0, c.pending_connect_timeout + EM.stop + } + end + + def test_set_and_get + EM.run { + c = EM.connect("127.0.0.1", 54321) + c.pending_connect_timeout = 2.5 + assert_equal 2.5, c.pending_connect_timeout + EM.stop + } + end + + def test_for_real + start, finish = nil + + timeout_handler = Module.new do + define_method :unbind do + finish = Time.now + EM.stop + end + end + + EM.run { + setup_timeout + EM.heartbeat_interval = 0.1 + start = Time.now + c = EM.connect("1.2.3.4", 54321, timeout_handler) + c.pending_connect_timeout = 0.2 + } + + assert_in_delta(0.2, (finish - start), 0.1) + end + else + warn "EM.pending_connect_timeout not implemented, skipping tests in #{__FILE__}" + + # Because some rubies will complain if a TestCase class has no tests + def test_em_pending_connect_timeout_not_implemented + assert true + end + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_pool.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_pool.rb new file mode 100644 index 000000000..e45c26ee5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_pool.rb @@ -0,0 +1,194 @@ +class TestPool < Test::Unit::TestCase + def pool + @pool ||= EM::Pool.new + end + + def go + EM.run { yield } + end + + def stop + EM.stop + end + + def deferrable + @deferrable ||= EM::DefaultDeferrable.new + end + + def test_supports_more_work_than_resources + ran = false + go do + pool.perform do + ran = true + deferrable + end + stop + end + assert_equal false, ran + go do + pool.add :resource + stop + end + assert_equal true, ran + end + + def test_reques_resources_on_error + pooled_res, pooled_res2 = nil + pool.add :res + go do + pool.perform do |res| + pooled_res = res + deferrable + end + stop + end + deferrable.fail + go do + pool.perform do |res| + pooled_res2 = res + deferrable + end + stop + end + assert_equal :res, pooled_res + assert_equal pooled_res, pooled_res2 + end + + def test_supports_custom_error_handler + eres = nil + pool.on_error do |res| + eres = res + end + performs = [] + pool.add :res + go do + pool.perform do |res| + performs << res + deferrable + end + pool.perform do |res| + performs << res + deferrable + end + deferrable.fail + stop + end + assert_equal :res, eres + # manual requeues required when error handler is installed: + assert_equal 1, performs.size + assert_equal :res, performs.first + end + + def test_catches_successful_deferrables + performs = [] + pool.add :res + go do + pool.perform { |res| performs << res; deferrable } + pool.perform { |res| performs << res; deferrable } + stop + end + assert_equal [:res], performs + deferrable.succeed + go { stop } + assert_equal [:res, :res], performs + end + + def test_prunes_locked_and_removed_resources + performs = [] + pool.add :res + deferrable.succeed + go do + pool.perform { |res| performs << res; pool.remove res; deferrable } + pool.perform { |res| performs << res; pool.remove res; deferrable } + stop + end + assert_equal [:res], performs + end + + # Contents is only to be used for inspection of the pool! + def test_contents + pool.add :res + assert_equal [:res], pool.contents + # Assert that modifying the contents list does not affect the pools + # contents. + pool.contents.delete(:res) + assert_equal [:res], pool.contents + end + + def test_contents_when_perform_errors_and_on_error_is_not_set + pool.add :res + assert_equal [:res], pool.contents + + pool.perform do |r| + d = EM::DefaultDeferrable.new + d.fail + d + end + + EM.run { EM.next_tick { EM.stop } } + + assert_equal [:res], pool.contents + end + + def test_contents_when_perform_errors_and_on_error_is_set + pool.add :res + res = nil + pool.on_error do |r| + res = r + end + assert_equal [:res], pool.contents + + pool.perform do |r| + d = EM::DefaultDeferrable.new + d.fail 'foo' + d + end + + EM.run { EM.next_tick { EM.stop } } + + assert_equal :res, res + assert_equal [], pool.contents + end + + def test_num_waiting + pool.add :res + assert_equal 0, pool.num_waiting + pool.perform { |r| EM::DefaultDeferrable.new } + assert_equal 0, pool.num_waiting + 10.times { pool.perform { |r| EM::DefaultDeferrable.new } } + EM.run { EM.next_tick { EM.stop } } + assert_equal 10, pool.num_waiting + end + + def test_exceptions_in_the_work_block_bubble_up_raise_and_fail_the_resource + pool.add :res + + res = nil + pool.on_error { |r| res = r } + pool.perform { raise 'boom' } + + assert_raises(RuntimeError) do + EM.run { EM.next_tick { EM.stop } } + end + + assert_equal [], pool.contents + assert_equal :res, res + end + + def test_removed_list_does_not_leak_on_errors + pool.add :res + + pool.on_error do |r| + # This is actually the wrong thing to do, and not required, but some users + # might do it. When they do, they would find that @removed would cause a + # slow leak. + pool.remove r + end + + pool.perform { d = EM::DefaultDeferrable.new; d.fail; d } + + EM.run { EM.next_tick { EM.stop } } + assert_equal [], pool.instance_variable_get(:@removed) + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_process_watch.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_process_watch.rb new file mode 100644 index 000000000..a0ecbd4ba --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_process_watch.rb @@ -0,0 +1,48 @@ +require 'em_test_helper' + +if EM.kqueue? + class TestProcessWatch < Test::Unit::TestCase + module ParentProcessWatcher + def process_forked + $forked = true + end + end + + module ChildProcessWatcher + def process_exited + $exited = true + end + def unbind + $unbind = true + EM.stop + end + end + + def setup + EM.kqueue = true + end + + def teardown + EM.kqueue = false + end + + def test_events + EM.run{ + # watch ourselves for a fork notification + EM.watch_process(Process.pid, ParentProcessWatcher) + $fork_pid = fork{ sleep } + child = EM.watch_process($fork_pid, ChildProcessWatcher) + $pid = child.pid + + EM.add_timer(0.2){ + Process.kill('TERM', $fork_pid) + } + } + + assert_equal($pid, $fork_pid) + assert($forked) + assert($exited) + assert($unbind) + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_processes.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_processes.rb new file mode 100644 index 000000000..b3ba9f73f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_processes.rb @@ -0,0 +1,128 @@ +require 'em_test_helper' + +class TestProcesses < Test::Unit::TestCase + + if !windows? && !jruby? + + # EM::DeferrableChildProcess is a sugaring of a common use-case + # involving EM::popen. + # Call the #open method on EM::DeferrableChildProcess, passing + # a command-string. #open immediately returns an EM::Deferrable + # object. It also schedules the forking of a child process, which + # will execute the command passed to #open. + # When the forked child terminates, the Deferrable will be signalled + # and execute its callbacks, passing the data that the child process + # wrote to stdout. + # + def test_deferrable_child_process + ls = "" + EM.run { + d = EM::DeferrableChildProcess.open( "ls -ltr" ) + d.callback {|data_from_child| + ls = data_from_child + EM.stop + } + } + assert( ls.length > 0) + end + + def setup + $out = nil + $status = nil + end + + def test_em_system + EM.run{ + EM.system('ls'){ |out,status| $out, $status = out, status; EM.stop } + } + + assert( $out.length > 0 ) + assert_equal($status.exitstatus, 0) + assert_equal($status.class, Process::Status) + end + + def test_em_system_pid + $pids = [] + + EM.run{ + $pids << EM.system('echo hi', proc{ |out,status|$pids << status.pid; EM.stop }) + } + + assert_equal $pids[0], $pids[1] + end + + def test_em_system_with_proc + EM.run{ + EM.system('ls', proc{ |out,status| $out, $status = out, status; EM.stop }) + } + + assert( $out.length > 0 ) + assert_equal($status.exitstatus, 0) + assert_equal($status.class, Process::Status) + end + + def test_em_system_with_two_procs + EM.run{ + EM.system('sh', proc{ |process| + process.send_data("echo hello\n") + process.send_data("exit\n") + }, proc{ |out,status| + $out = out + $status = status + EM.stop + }) + } + + assert_equal("hello\n", $out) + end + + def test_em_system_cmd_arguments + EM.run{ + EM.system('echo', '1', '2', 'version', proc{ |process| + }, proc{ |out,status| + $out = out + $status = status + EM.stop + }) + } + + assert_match(/1 2 version/i, $out) + end + + def test_em_system_spaced_arguments + EM.run{ + EM.system('ruby', '-e', 'puts "hello"', proc{ |out,status| + $out = out + EM.stop + }) + } + + assert_equal("hello\n", $out) + end + + def test_em_popen_pause_resume + c_rx = 0 + + test_client = Module.new do + define_method :receive_data do |data| + c_rx += 1 + pause + EM.add_timer(0.5) { EM.stop } + end + end + + EM.run{ + EM.popen('cat /dev/random', test_client) + } + + assert_equal 1, c_rx + end + else + warn "EM.popen not implemented, skipping tests in #{__FILE__}" + + # Because some rubies will complain if a TestCase class has no tests + def test_em_popen_unsupported + assert true + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_proxy_connection.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_proxy_connection.rb new file mode 100644 index 000000000..11c0fb410 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_proxy_connection.rb @@ -0,0 +1,180 @@ +require 'em_test_helper' + +class TestProxyConnection < Test::Unit::TestCase + + if EM.respond_to?(:start_proxy) + module ProxyConnection + def initialize(client, request) + @client, @request = client, request + end + + def post_init + EM::enable_proxy(self, @client) + end + + def connection_completed + EM.next_tick { + send_data @request + } + end + + def proxy_target_unbound + $unbound_early = true + EM.stop + end + + def unbind + $proxied_bytes = self.get_proxied_bytes + @client.close_connection_after_writing + end + end + + module PartialProxyConnection + def initialize(client, request, length) + @client, @request, @length = client, request, length + end + + def post_init + EM::enable_proxy(self, @client, 0, @length) + end + + def receive_data(data) + $unproxied_data = data + @client.send_data(data) + end + + def connection_completed + EM.next_tick { + send_data @request + } + end + + def proxy_target_unbound + $unbound_early = true + EM.stop + end + + def proxy_completed + $proxy_completed = true + end + + def unbind + @client.close_connection_after_writing + end + end + + module Client + def connection_completed + send_data "EM rocks!" + end + + def receive_data(data) + $client_data = data + end + + def unbind + EM.stop + end + end + + module Client2 + include Client + def unbind; end + end + + module Server + def receive_data(data) + send_data "I know!" if data == "EM rocks!" + close_connection_after_writing + end + end + + module ProxyServer + def initialize port + @port = port + end + + def receive_data(data) + @proxy = EM.connect("127.0.0.1", @port, ProxyConnection, self, data) + end + end + + module PartialProxyServer + def initialize port + @port = port + end + + def receive_data(data) + EM.connect("127.0.0.1", @port, PartialProxyConnection, self, data, 1) + end + end + + module EarlyClosingProxy + def initialize port + @port = port + end + + def receive_data(data) + EM.connect("127.0.0.1", @port, ProxyConnection, self, data) + close_connection + end + end + + def setup + @port = next_port + @proxy_port = next_port + end + + def test_proxy_connection + EM.run { + EM.start_server("127.0.0.1", @port, Server) + EM.start_server("127.0.0.1", @proxy_port, ProxyServer, @port) + EM.connect("127.0.0.1", @proxy_port, Client) + } + + assert_equal("I know!", $client_data) + end + + def test_proxied_bytes + EM.run { + EM.start_server("127.0.0.1", @port, Server) + EM.start_server("127.0.0.1", @proxy_port, ProxyServer, @port) + EM.connect("127.0.0.1", @proxy_port, Client) + } + + assert_equal("I know!", $client_data) + assert_equal("I know!".bytesize, $proxied_bytes) + end + + def test_partial_proxy_connection + EM.run { + EM.start_server("127.0.0.1", @port, Server) + EM.start_server("127.0.0.1", @proxy_port, PartialProxyServer, @port) + EM.connect("127.0.0.1", @proxy_port, Client) + } + + assert_equal("I know!", $client_data) + assert_equal(" know!", $unproxied_data) + assert($proxy_completed) + end + + def test_early_close + $client_data = nil + EM.run { + EM.start_server("127.0.0.1", @port, Server) + EM.start_server("127.0.0.1", @proxy_port, EarlyClosingProxy, @port) + EM.connect("127.0.0.1", @proxy_port, Client2) + } + + assert($unbound_early) + end + else + warn "EM.start_proxy not implemented, skipping tests in #{__FILE__}" + + # Because some rubies will complain if a TestCase class has no tests + def test_em_start_proxy_not_implemented + assert !EM.respond_to?(:start_proxy) + end + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_pure.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_pure.rb new file mode 100644 index 000000000..a870df40c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_pure.rb @@ -0,0 +1,88 @@ +require 'em_test_helper' + +class TestPure < Test::Unit::TestCase + + def setup + @port = next_port + end + + # These tests are intended to exercise problems that come up in the + # pure-Ruby implementation. However, we DON'T constrain them such that + # they only run in pure-Ruby. These tests need to work identically in + # any implementation. + + #------------------------------------- + + # The EM reactor needs to run down open connections and release other resources + # when it stops running. Make sure this happens even if user code throws a Ruby + # exception. + # If exception handling is incorrect, the second test will fail with a no-bind error + # because the TCP server opened in the first test will not have been closed. + + def test_exception_handling_releases_resources + exception = Class.new(StandardError) + + 2.times do + assert_raises(exception) do + EM.run do + EM.start_server "127.0.0.1", @port + raise exception + end + end + end + end + + # Under some circumstances, the pure Ruby library would emit an Errno::ECONNREFUSED + # exception on certain kinds of TCP connect-errors. + # It's always been something of an open question whether EM should throw an exception + # in these cases but the defined answer has always been to catch it the unbind method. + # With a connect failure, the latter will always fire, but connection_completed will + # never fire. So even though the point is arguable, it's incorrect for the pure Ruby + # version to throw an exception. + module TestConnrefused + def unbind + EM.stop + end + def connection_completed + raise "should never get here" + end + end + + def test_connrefused + assert_nothing_raised do + EM.run { + setup_timeout(2) + EM.connect "127.0.0.1", @port, TestConnrefused + } + end + end + + # Make sure connection_completed gets called as expected with TCP clients. This is the + # opposite of test_connrefused. + # If the test fails, it will hang because EM.stop never gets called. + # + module TestConnaccepted + def connection_completed + EM.stop + end + end + def test_connaccepted + assert_nothing_raised do + EM.run { + EM.start_server "127.0.0.1", @port + EM.connect "127.0.0.1", @port, TestConnaccepted + setup_timeout(1) + } + end + end + + def test_reactor_running + a = false + EM.run { + a = EM.reactor_running? + EM.next_tick {EM.stop} + } + assert a + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_queue.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_queue.rb new file mode 100644 index 000000000..0acc58a41 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_queue.rb @@ -0,0 +1,50 @@ +require 'em_test_helper' + +class TestEMQueue < Test::Unit::TestCase + def test_queue_push + s = 0 + EM.run do + q = EM::Queue.new + q.push(1) + EM.next_tick { s = q.size; EM.stop } + end + assert_equal 1, s + end + + def test_queue_pop + x,y,z = nil + EM.run do + q = EM::Queue.new + q.push(1,2,3) + q.pop { |v| x = v } + q.pop { |v| y = v } + q.pop { |v| z = v; EM.stop } + end + assert_equal 1, x + assert_equal 2, y + assert_equal 3, z + end + + def test_queue_reactor_thread + q = EM::Queue.new + + Thread.new { q.push(1,2,3) }.join + assert q.empty? + EM.run { EM.next_tick { EM.stop } } + assert_equal 3, q.size + + x = nil + Thread.new { q.pop { |v| x = v } }.join + assert_equal nil, x + EM.run { EM.next_tick { EM.stop } } + assert_equal 1, x + end + + def test_num_waiting + q = EM::Queue.new + many = 3 + many.times { q.pop {} } + EM.run { EM.next_tick { EM.stop } } + assert_equal many, q.num_waiting + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_resolver.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_resolver.rb new file mode 100644 index 000000000..9172428df --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_resolver.rb @@ -0,0 +1,55 @@ +require 'em_test_helper' + +class TestResolver < Test::Unit::TestCase + def test_a + EM.run { + d = EM::DNS::Resolver.resolve "google.com" + d.errback { assert false } + d.callback { |r| + assert r + EM.stop + } + } + end + + def test_bad_host + EM.run { + d = EM::DNS::Resolver.resolve "asdfasasdf" + d.callback { assert false } + d.errback { assert true; EM.stop } + } + end + + def test_garbage + assert_raises( ArgumentError ) { + EM.run { + EM::DNS::Resolver.resolve 123 + } + } + end + + def test_a_pair + EM.run { + d = EM::DNS::Resolver.resolve "google.com" + d.errback { assert false } + d.callback { |r| + assert_equal(Array, r.class) + assert r.size > 1 + EM.stop + } + } + end + + def test_localhost + EM.run { + d = EM::DNS::Resolver.resolve "localhost" + d.errback { assert false } + d.callback { |r| + assert_equal("127.0.0.1", r.first) + assert_equal(Array, r.class) + + EM.stop + } + } + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_running.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_running.rb new file mode 100644 index 000000000..693b3901a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_running.rb @@ -0,0 +1,14 @@ +require 'em_test_helper' + +class TestRunning < Test::Unit::TestCase + def test_running + assert_equal( false, EM::reactor_running? ) + r = false + EM.run { + r = EM::reactor_running? + EM.stop + } + assert_equal( true, r ) + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_sasl.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_sasl.rb new file mode 100644 index 000000000..e80f6571a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_sasl.rb @@ -0,0 +1,47 @@ +require 'em_test_helper' + + +class TestSASL < Test::Unit::TestCase + + # SASL authentication is usually done with UNIX-domain sockets, but + # we'll use TCP so this test will work on Windows. As far as the + # protocol handlers are concerned, there's no difference. + + TestUser,TestPsw = "someone", "password" + + class SaslServer < EM::Connection + include EM::Protocols::SASLauth + def validate usr, psw, sys, realm + usr == TestUser and psw == TestPsw + end + end + + class SaslClient < EM::Connection + include EM::Protocols::SASLauthclient + end + + def setup + @port = next_port + end + + def test_sasl + resp = nil + EM.run { + EM.start_server( "127.0.0.1", @port, SaslServer ) + + c = EM.connect( "127.0.0.1", @port, SaslClient ) + d = c.validate?( TestUser, TestPsw ) + d.timeout 1 + d.callback { + resp = true + EM.stop + } + d.errback { + resp = false + EM.stop + } + } + assert_equal( true, resp ) + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_send_file.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_send_file.rb new file mode 100644 index 000000000..a784b505d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_send_file.rb @@ -0,0 +1,217 @@ +require 'em_test_helper' +require 'tempfile' + +class TestSendFile < Test::Unit::TestCase + + if EM.respond_to?(:send_file_data) + module TestModule + def initialize filename + @filename = filename + end + + def post_init + send_file_data @filename + close_connection_after_writing + end + end + + module TestClient + def data_to(&blk) + @data_to = blk + end + + def receive_data(data) + @data_to.call(data) if @data_to + end + + def unbind + EM.stop + end + end + + def setup + @file = Tempfile.new("em_test_file") + @filename = @file.path + @port = next_port + end + + def test_send_file + File.open( @filename, "w" ) {|f| + f << ("A" * 5000) + } + + data = '' + + EM.run { + EM.start_server "127.0.0.1", @port, TestModule, @filename + setup_timeout + + EM.connect "127.0.0.1", @port, TestClient do |c| + c.data_to { |d| data << d } + end + } + + assert_equal( "A" * 5000, data ) + end + + # EM::Connection#send_file_data has a strict upper limit on the filesize it will work with. + def test_send_large_file + File.open( @filename, "w" ) {|f| + f << ("A" * 1000000) + } + + data = '' + + assert_raises(RuntimeError) { + EM.run { + EM.start_server "127.0.0.1", @port, TestModule, @filename + setup_timeout + EM.connect "127.0.0.1", @port, TestClient do |c| + c.data_to { |d| data << d } + end + } + } + end + + module StreamTestModule + def initialize filename + @filename = filename + end + + def post_init + EM::Deferrable.future( stream_file_data(@filename)) { + close_connection_after_writing + } + end + end + + module ChunkStreamTestModule + def initialize filename + @filename = filename + end + + def post_init + EM::Deferrable.future( stream_file_data(@filename, :http_chunks=>true)) { + close_connection_after_writing + } + end + end + + def test_stream_file_data + File.open( @filename, "w" ) {|f| + f << ("A" * 1000) + } + + data = '' + + EM.run { + EM.start_server "127.0.0.1", @port, StreamTestModule, @filename + setup_timeout + EM.connect "127.0.0.1", @port, TestClient do |c| + c.data_to { |d| data << d } + end + } + + assert_equal( "A" * 1000, data ) + end + + def test_stream_chunked_file_data + File.open( @filename, "w" ) {|f| + f << ("A" * 1000) + } + + data = '' + + EM.run { + EM.start_server "127.0.0.1", @port, ChunkStreamTestModule, @filename + setup_timeout + EM.connect "127.0.0.1", @port, TestClient do |c| + c.data_to { |d| data << d } + end + } + + assert_equal( "3e8\r\n#{"A" * 1000}\r\n0\r\n\r\n", data ) + end + + module BadFileTestModule + def initialize filename + @filename = filename + end + + def post_init + de = stream_file_data( @filename+".wrong" ) + de.errback {|msg| + send_data msg + close_connection_after_writing + } + end + end + def test_stream_bad_file + data = '' + EM.run { + EM.start_server "127.0.0.1", @port, BadFileTestModule, @filename + setup_timeout(5) + EM.connect "127.0.0.1", @port, TestClient do |c| + c.data_to { |d| data << d } + end + } + + assert_equal( "file not found", data ) + end + else + warn "EM.send_file_data not implemented, skipping tests in #{__FILE__}" + + # Because some rubies will complain if a TestCase class has no tests + def test_em_send_file_data_not_implemented + assert !EM.respond_to?(:send_file_data) + end + end + + begin + require 'fastfilereaderext' + + def test_stream_large_file_data + File.open( @filename, "w" ) {|f| + f << ("A" * 10000) + } + + data = '' + + EM.run { + EM.start_server "127.0.0.1", @port, StreamTestModule, @filename + setup_timeout + EM.connect "127.0.0.1", @port, TestClient do |c| + c.data_to { |d| data << d } + end + } + + assert_equal( "A" * 10000, data ) + end + + def test_stream_large_chunked_file_data + File.open( @filename, "w" ) {|f| + f << ("A" * 100000) + } + + data = '' + + EM.run { + EM.start_server "127.0.0.1", @port, ChunkStreamTestModule, @filename + setup_timeout + EM.connect "127.0.0.1", @port, TestClient do |c| + c.data_to { |d| data << d } + end + } + + expected = [ + "4000\r\n#{"A" * 16384}\r\n" * 6, + "6a0\r\n#{"A" * 0x6a0}\r\n", + "0\r\n\r\n" + ].join + assert_equal( expected, data ) + end + rescue LoadError + warn "require 'fastfilereaderext' failed, skipping tests in #{__FILE__}" + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_servers.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_servers.rb new file mode 100644 index 000000000..2a170504d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_servers.rb @@ -0,0 +1,33 @@ +require 'em_test_helper' +require 'socket' + +class TestServers < Test::Unit::TestCase + + def setup + @port = next_port + end + + def server_alive? + port_in_use?(@port) + end + + def run_test_stop_server + EM.run { + sig = EM.start_server("127.0.0.1", @port) + assert server_alive?, "Server didn't start" + EM.stop_server sig + # Give the server some time to shutdown. + EM.add_timer(0.1) { + assert !server_alive?, "Server didn't stop" + EM.stop + } + } + end + + def test_stop_server + assert !server_alive?, "Port already in use" + 2.times { run_test_stop_server } + assert !server_alive?, "Servers didn't stop" + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_set_sock_opt.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_set_sock_opt.rb new file mode 100644 index 000000000..3d3020a94 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_set_sock_opt.rb @@ -0,0 +1,37 @@ +require 'em_test_helper' +require 'socket' + +class TestSetSockOpt < Test::Unit::TestCase + + if EM.respond_to? :set_sock_opt + def setup + assert(!EM.reactor_running?) + end + + def teardown + assert(!EM.reactor_running?) + end + + #------------------------------------- + + def test_set_sock_opt + test = self + EM.run do + EM.connect 'google.com', 80, Module.new { + define_method :post_init do + val = set_sock_opt Socket::SOL_SOCKET, Socket::SO_DEBUG, true + test.assert_equal 0, val + EM.stop + end + } + end + end + else + warn "EM.set_sock_opt not implemented, skipping tests in #{__FILE__}" + + # Because some rubies will complain if a TestCase class has no tests + def test_em_set_sock_opt_unsupported + assert true + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_shutdown_hooks.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_shutdown_hooks.rb new file mode 100644 index 000000000..b0e0c5cc5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_shutdown_hooks.rb @@ -0,0 +1,23 @@ +require 'em_test_helper' + +class TestShutdownHooks < Test::Unit::TestCase + def test_shutdown_hooks + r = false + EM.run { + EM.add_shutdown_hook { r = true } + EM.stop + } + assert_equal( true, r ) + end + + def test_hook_order + r = [] + EM.run { + EM.add_shutdown_hook { r << 2 } + EM.add_shutdown_hook { r << 1 } + EM.stop + } + assert_equal( [1, 2], r ) + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_smtpclient.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_smtpclient.rb new file mode 100644 index 000000000..7cdb268fd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_smtpclient.rb @@ -0,0 +1,55 @@ +require 'em_test_helper' + +class TestSmtpClient < Test::Unit::TestCase + + Localhost = "127.0.0.1" + Localport = 9801 + + def setup + end + + def teardown + end + + def test_a + # No real tests until we have a server implementation to test against. + # This is what the call looks like, though: + err = nil + EM.run { + d = EM::Protocols::SmtpClient.send :domain=>"example.com", + :host=>Localhost, + :port=>Localport, # optional, defaults 25 + :starttls=>true, + :from=>"sender@example.com", + :to=> ["to_1@example.com", "to_2@example.com"], + :header=> {"Subject" => "This is a subject line"}, + :body=> "This is the body of the email", + :verbose=>true + d.errback {|e| + err = e + EM.stop + } + } + assert(err) + end + + def test_content + err = nil + EM.run { + d = EM::Protocols::SmtpClient.send :domain=>"example.com", + :host=>Localhost, + :port=>Localport, # optional, defaults 25 + :starttls=>true, + :from=>"sender@example.com", + :to=> ["to_1@example.com", "to_2@example.com"], + :content => ["Subject: xxx\r\n\r\ndata\r\n.\r\n"], + :verbose=>true + d.errback {|e| + err = e + EM.stop + } + } + assert(err) + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_smtpserver.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_smtpserver.rb new file mode 100644 index 000000000..18c50febd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_smtpserver.rb @@ -0,0 +1,57 @@ +require 'em_test_helper' + +class TestSmtpServer < Test::Unit::TestCase + + # Don't test on port 25. It requires superuser and there's probably + # a mail server already running there anyway. + Localhost = "127.0.0.1" + Localport = 25001 + + # This class is an example of what you need to write in order + # to implement a mail server. You override the methods you are + # interested in. Some, but not all, of these are illustrated here. + # + class Mailserver < EM::Protocols::SmtpServer + + attr_reader :my_msg_body, :my_sender, :my_recipients + + def initialize *args + super + end + def receive_sender sender + @my_sender = sender + #p sender + true + end + def receive_recipient rcpt + @my_recipients ||= [] + @my_recipients << rcpt + true + end + def receive_data_chunk c + @my_msg_body = c.last + end + def connection_ended + EM.stop + end + end + + def test_mail + c = nil + EM.run { + EM.start_server( Localhost, Localport, Mailserver ) {|conn| c = conn} + EM::Timer.new(2) {EM.stop} # prevent hanging the test suite in case of error + EM::Protocols::SmtpClient.send :host=>Localhost, + :port=>Localport, + :domain=>"bogus", + :from=>"me@example.com", + :to=>"you@example.com", + :header=> {"Subject"=>"Email subject line", "Reply-to"=>"me@example.com"}, + :body=>"Not much of interest here." + + } + assert_equal( "Not much of interest here.", c.my_msg_body ) + assert_equal( "", c.my_sender ) + assert_equal( [""], c.my_recipients ) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_spawn.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_spawn.rb new file mode 100644 index 000000000..ab0a92f77 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_spawn.rb @@ -0,0 +1,293 @@ + +require 'em_test_helper' + + + +class TestSpawn < Test::Unit::TestCase + + # Spawn a process that simply stops the reactor. + # Assert that the notification runs after the block that calls it. + # + def test_stop + x = nil + EM.run { + s = EM.spawn {EM.stop} + s.notify + x = true + } + assert x + end + + + # Pass a parameter to a spawned process. + # + def test_parms + val = 5 + EM.run { + s = EM.spawn {|v| val *= v; EM.stop} + s.notify 3 + } + assert_equal( 15, val ) + end + + # Pass multiple parameters to a spawned process. + # + def test_multiparms + val = 5 + EM.run { + s = EM.spawn {|v1,v2| val *= (v1 + v2); EM.stop} + s.notify 3,4 + } + assert_equal( 35, val ) + end + + + # This test demonstrates that a notification does not happen immediately, + # but rather is scheduled sometime after the current code path completes. + # + def test_race + x = 0 + EM.run { + s = EM.spawn {x *= 2; EM.stop} + s.notify + x = 2 + } + assert_equal( 4, x) + end + + + # Spawn a process and notify it 25 times to run fibonacci + # on a pair of global variables. + # + def test_fibonacci + x = 1 + y = 1 + EM.run { + s = EM.spawn {x,y = y,x+y} + 25.times {s.notify} + + t = EM.spawn {EM.stop} + t.notify + } + assert_equal( 121393, x) + assert_equal( 196418, y) + end + + # This one spawns 25 distinct processes, and notifies each one once, + # rather than notifying a single process 25 times. + # + def test_another_fibonacci + x = 1 + y = 1 + EM.run { + 25.times { + s = EM.spawn {x,y = y,x+y} + s.notify + } + + t = EM.spawn {EM.stop} + t.notify + } + assert_equal( 121393, x) + assert_equal( 196418, y) + end + + + # Make a chain of processes that notify each other in turn + # with intermediate fibonacci results. The final process in + # the chain stops the loop and returns the result. + # + def test_fibonacci_chain + a,b = nil + + EM.run { + nextpid = EM.spawn {|x,y| + a,b = x,y + EM.stop + } + + 25.times { + n = nextpid + nextpid = EM.spawn {|x,y| n.notify( y, x+y )} + } + + nextpid.notify( 1, 1 ) + } + + assert_equal( 121393, a) + assert_equal( 196418, b) + end + + + # EM#yield gives a spawed process to yield control to other processes + # (in other words, to stop running), and to specify a different code block + # that will run on its next notification. + # + def test_yield + a = 0 + EM.run { + n = EM.spawn { + a += 10 + EM.yield { + a += 20 + EM.yield { + a += 30 + EM.stop + } + } + } + n.notify + n.notify + n.notify + } + assert_equal( 60, a ) + end + + # EM#yield_and_notify behaves like EM#yield, except that it also notifies the + # yielding process. This may sound trivial, since the yield block will run very + # shortly after with no action by the program, but this actually can be very useful, + # because it causes the reactor core to execute once before the yielding process + # gets control back. So it can be used to allow heavily-used network connections + # to clear buffers, or allow other processes to process their notifications. + # + # Notice in this test code that only a simple notify is needed at the bottom + # of the initial block. Even so, all of the yielded blocks will execute. + # + def test_yield_and_notify + a = 0 + EM.run { + n = EM.spawn { + a += 10 + EM.yield_and_notify { + a += 20 + EM.yield_and_notify { + a += 30 + EM.stop + } + } + } + n.notify + } + assert_equal( 60, a ) + end + + # resume is an alias for notify. + # + def test_resume + EM.run { + n = EM.spawn {EM.stop} + n.resume + } + assert true + end + + # run is an idiomatic alias for notify. + # + def test_run + EM.run { + (EM.spawn {EM.stop}).run + } + assert true + end + + + # Clones the ping-pong example from the Erlang tutorial, in much less code. + # Illustrates that a spawned block executes in the context of a SpawnableObject. + # (Meaning, we can pass self as a parameter to another process that can then + # notify us.) + # + def test_ping_pong + n_pongs = 0 + EM.run { + pong = EM.spawn {|x, ping| + n_pongs += 1 + ping.notify( x-1 ) + } + ping = EM.spawn {|x| + if x > 0 + pong.notify x, self + else + EM.stop + end + } + ping.notify 3 + } + assert_equal( 3, n_pongs ) + end + + # Illustrates that you can call notify inside a notification, and it will cause + # the currently-executing process to be re-notified. Of course, the new notification + # won't run until sometime after the current one completes. + # + def test_self_notify + n = 0 + EM.run { + pid = EM.spawn {|x| + if x > 0 + n += x + notify( x-1 ) + else + EM.stop + end + } + pid.notify 3 + } + assert_equal( 6, n ) + end + + + # Illustrates that the block passed to #spawn executes in the context of a + # SpawnedProcess object, NOT in the local context. This can often be deceptive. + # + class BlockScopeTest + attr_reader :var + def run + # The following line correctly raises a NameError. + # The problem is that the programmer expected the spawned block to + # execute in the local context, but it doesn't. + # + # (EM.spawn { do_something }).notify ### NO! BAD! + + + + # The following line correctly passes self as a parameter to the + # notified process. + # + (EM.spawn {|obj| obj.do_something }).notify(self) + + + + # Here's another way to do it. This works because "myself" is bound + # in the local scope, unlike "self," so the spawned block sees it. + # + myself = self + (EM.spawn { myself.do_something }).notify + + + + # And we end the loop. + # This is a tangential point, but observe that #notify never blocks. + # It merely appends a message to the internal queue of a spawned process + # and returns. As it turns out, the reactor processes notifications for ALL + # spawned processes in the order that #notify is called. So there is a + # reasonable expectation that the process which stops the reactor will + # execute after the previous ones in this method. HOWEVER, this is NOT + # a documented behavior and is subject to change. + # + (EM.spawn {EM.stop}).notify + end + def do_something + @var ||= 0 + @var += 100 + end + end + + def test_block_scope + bs = BlockScopeTest.new + EM.run { + bs.run + } + assert_equal( 200, bs.var ) + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_ssl_args.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_ssl_args.rb new file mode 100644 index 000000000..2d6a0540b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_ssl_args.rb @@ -0,0 +1,78 @@ +require "test/unit" +require 'tempfile' + +require 'em_test_helper' + +module EM + def self._set_mocks + class < priv_file) + end + assert_raises(EM::FileNotFoundException) do + conn.start_tls(:cert_chain_file => cert_file) + end + assert_raises(EM::FileNotFoundException) do + conn.start_tls(:private_key_file => priv_file, :cert_chain_file => cert_file) + end + end + + def test_tls_params_file_does_exist + priv_file = Tempfile.new('em_test') + cert_file = Tempfile.new('em_test') + priv_file_path = priv_file.path + cert_file_path = cert_file.path + conn = EM::Connection.new('foo') + params = {:private_key_file => priv_file_path, :cert_chain_file => cert_file_path} + begin + conn.start_tls params + rescue Object + assert(false, 'should not have raised an exception') + end + end +end if EM.ssl? \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_ssl_methods.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_ssl_methods.rb new file mode 100644 index 000000000..dade240c3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_ssl_methods.rb @@ -0,0 +1,48 @@ +require 'em_test_helper' + +class TestSSLMethods < Test::Unit::TestCase + + module ServerHandler + + def post_init + start_tls + end + + def ssl_handshake_completed + $server_called_back = true + $server_cert_value = get_peer_cert + end + + end + + module ClientHandler + + def post_init + start_tls + end + + def ssl_handshake_completed + $client_called_back = true + $client_cert_value = get_peer_cert + EM.stop_event_loop + end + + end + + def test_ssl_methods + $server_called_back, $client_called_back = false, false + $server_cert_value, $client_cert_value = nil, nil + + EM.run { + EM.start_server("127.0.0.1", 9999, ServerHandler) + EM.connect("127.0.0.1", 9999, ClientHandler) + } + + assert($server_called_back) + assert($client_called_back) + + assert($server_cert_value.is_a?(NilClass)) + assert($client_cert_value.is_a?(String)) + end + +end if EM.ssl? \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_ssl_verify.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_ssl_verify.rb new file mode 100644 index 000000000..cdaf5fbaa --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_ssl_verify.rb @@ -0,0 +1,82 @@ +require 'em_test_helper' + +if EM.ssl? + class TestSslVerify < Test::Unit::TestCase + def setup + $dir = File.dirname(File.expand_path(__FILE__)) + '/' + $cert_from_file = File.read($dir+'client.crt') + end + + module Client + def connection_completed + start_tls(:private_key_file => $dir+'client.key', :cert_chain_file => $dir+'client.crt') + end + + def ssl_handshake_completed + $client_handshake_completed = true + close_connection + end + + def unbind + EM.stop_event_loop + end + end + + module AcceptServer + def post_init + start_tls(:verify_peer => true) + end + + def ssl_verify_peer(cert) + $cert_from_server = cert + true + end + + def ssl_handshake_completed + $server_handshake_completed = true + end + end + + module DenyServer + def post_init + start_tls(:verify_peer => true) + end + + def ssl_verify_peer(cert) + $cert_from_server = cert + # Do not accept the peer. This should now cause the connection to shut down without the SSL handshake being completed. + false + end + + def ssl_handshake_completed + $server_handshake_completed = true + end + end + + def test_accept_server + $client_handshake_completed, $server_handshake_completed = false, false + EM.run { + EM.start_server("127.0.0.1", 16784, AcceptServer) + EM.connect("127.0.0.1", 16784, Client).instance_variable_get("@signature") + } + + assert_equal($cert_from_file, $cert_from_server) + assert($client_handshake_completed) + assert($server_handshake_completed) + end + + def test_deny_server + $client_handshake_completed, $server_handshake_completed = false, false + EM.run { + EM.start_server("127.0.0.1", 16784, DenyServer) + EM.connect("127.0.0.1", 16784, Client) + } + + assert_equal($cert_from_file, $cert_from_server) + assert(!$client_handshake_completed) + assert(!$server_handshake_completed) + end + end +else + warn "EM built without SSL support, skipping tests in #{__FILE__}" +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_threaded_resource.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_threaded_resource.rb new file mode 100644 index 000000000..10be5a565 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_threaded_resource.rb @@ -0,0 +1,53 @@ +class TestThreadedResource < Test::Unit::TestCase + def object + @object ||= {} + end + + def resource + @resource = EM::ThreadedResource.new do + object + end + end + + def teardown + resource.shutdown + end + + def test_dispatch_completion + EM.run do + completion = resource.dispatch do |o| + o[:foo] = :bar + :foo + end + completion.callback do |result| + assert_equal :foo, result + EM.stop + end + end + assert_equal :bar, object[:foo] + end + + def test_dispatch_failure + completion = resource.dispatch do |o| + raise 'boom' + end + completion.errback do |error| + assert_kind_of RuntimeError, error + assert_equal 'boom', error.message + end + end + + def test_dispatch_threading + main = Thread.current + resource.dispatch do |o| + o[:dispatch_thread] = Thread.current + end + assert_not_equal main, object[:dispatch_thread] + end + + def test_shutdown + # This test should get improved sometime. The method returning thread is + # NOT an api that will be maintained. + assert !resource.shutdown.alive? + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_tick_loop.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_tick_loop.rb new file mode 100644 index 000000000..39d86b54d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_tick_loop.rb @@ -0,0 +1,59 @@ +require "test/unit" +require 'em_test_helper' + +class TestEmTickLoop < Test::Unit::TestCase + def test_em_tick_loop + i = 0 + EM.tick_loop { i += 1; EM.stop if i == 10 } + EM.run { EM.add_timer(1) { EM.stop } } + assert_equal i, 10 + end + + def test_tick_loop_on_stop + t = nil + tick_loop = EM.tick_loop { :stop } + tick_loop.on_stop { t = true } + EM.run { EM.next_tick { EM.stop } } + assert t + end + + def test_start_twice + i = 0 + s = 0 + tick_loop = EM.tick_loop { i += 1; :stop } + tick_loop.on_stop { s += 1; EM.stop } + EM.run { EM.next_tick { EM.stop } } + assert_equal 1, i + assert_equal 1, s + tick_loop.start + EM.run { EM.next_tick { EM.stop } } + assert_equal 2, i + assert_equal 1, s # stop callbacks are only called once + end + + def test_stop + i, s = 0, 0 + tick_loop = EM.tick_loop { i += 1 } + tick_loop.on_stop { s += 1 } + EM.run { EM.next_tick { tick_loop.stop; EM.next_tick { EM.stop } } } + assert tick_loop.stopped? + assert_equal 1, i + assert_equal 1, s + end + + def test_immediate_stops + s = 0 + tick_loop = EM::TickLoop.new { } + tick_loop.on_stop { s += 1 } + tick_loop.on_stop { s += 1 } + assert_equal 2, s + end + + def test_stopped + tick_loop = EM::TickLoop.new { } + assert tick_loop.stopped? + tick_loop.start + assert !tick_loop.stopped? + end + +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_timers.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_timers.rb new file mode 100644 index 000000000..d774d178b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_timers.rb @@ -0,0 +1,123 @@ +require 'em_test_helper' + +class TestTimers < Test::Unit::TestCase + + def test_timer_with_block + x = false + EM.run { + EM::Timer.new(0) { + x = true + EM.stop + } + } + assert x + end + + def test_timer_with_proc + x = false + EM.run { + EM::Timer.new(0, proc { + x = true + EM.stop + }) + } + assert x + end + + def test_timer_cancel + assert_nothing_raised do + EM.run { + timer = EM::Timer.new(0.01) { flunk "Timer was not cancelled." } + timer.cancel + + EM.add_timer(0.02) { EM.stop } + } + end + end + + def test_periodic_timer + x = 0 + EM.run { + EM::PeriodicTimer.new(0.01) do + x += 1 + EM.stop if x == 4 + end + } + + assert_equal 4, x + end + + def test_add_periodic_timer + x = 0 + EM.run { + t = EM.add_periodic_timer(0.01) do + x += 1 + EM.stop if x == 4 + end + assert t.respond_to?(:cancel) + } + assert_equal 4, x + end + + def test_periodic_timer_cancel + x = 0 + EM.run { + pt = EM::PeriodicTimer.new(0.01) { x += 1 } + pt.cancel + EM::Timer.new(0.02) { EM.stop } + } + assert_equal 0, x + end + + def test_add_periodic_timer_cancel + x = 0 + EM.run { + pt = EM.add_periodic_timer(0.01) { x += 1 } + EM.cancel_timer(pt) + EM.add_timer(0.02) { EM.stop } + } + assert_equal 0, x + end + + def test_periodic_timer_self_cancel + x = 0 + EM.run { + pt = EM::PeriodicTimer.new(0) { + x += 1 + if x == 4 + pt.cancel + EM.stop + end + } + } + assert_equal 4, x + end + + + # This test is only applicable to compiled versions of the reactor. + # Pure ruby and java versions have no built-in limit on the number of outstanding timers. + unless [:pure_ruby, :java].include? EM.library_type + def test_timer_change_max_outstanding + defaults = EM.get_max_timers + EM.set_max_timers(100) + + one_hundred_one_timers = lambda do + 101.times { EM.add_timer(0.01) {} } + EM.stop + end + + assert_raises(RuntimeError) do + EM.run( &one_hundred_one_timers ) + end + + EM.set_max_timers( 101 ) + + assert_nothing_raised do + EM.run( &one_hundred_one_timers ) + end + ensure + EM.set_max_timers(defaults) + end + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_ud.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_ud.rb new file mode 100644 index 000000000..3559756e2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_ud.rb @@ -0,0 +1,8 @@ +require 'em_test_helper' + +class TestUserDefinedEvents < Test::Unit::TestCase + + def test_a + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_unbind_reason.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_unbind_reason.rb new file mode 100644 index 000000000..72a99f55f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/eventmachine-1.0.0.rc.4/tests/test_unbind_reason.rb @@ -0,0 +1,48 @@ +require 'em_test_helper' +require 'socket' + +class TestUnbindReason < Test::Unit::TestCase + + class StubConnection < EM::Connection + attr_reader :error + def unbind(reason = nil) + @error = reason + EM.stop + end + end + + def test_connect_timeout + error = nil + EM.run { + conn = EM.connect 'google.com', 81, Module.new{ |m| + m.send(:define_method, :unbind) do |reason| + error = reason + EM.stop + end + } + conn.pending_connect_timeout = 0.1 + } + assert_equal Errno::ETIMEDOUT, error + end + + def test_connect_refused + error = nil + EM.run { + EM.connect '127.0.0.1', 12388, Module.new{ |m| + m.send(:define_method, :unbind) do |reason| + error = reason + EM.stop + end + } + } + assert_equal Errno::ECONNREFUSED, error + end + + def test_optional_argument + conn = nil + EM.run { + conn = EM.connect '127.0.0.1', 12388, StubConnection + } + assert_equal Errno::ECONNREFUSED, conn.error + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/COPYING b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/COPYING new file mode 100644 index 000000000..76223189f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/COPYING @@ -0,0 +1,49 @@ +Copyright (c) 2008-2013, Ruby FFI project contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Ruby FFI project nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +libffi, used by this project, is licensed under the MIT license: + +libffi - Copyright (c) 1996-2011 Anthony Green, Red Hat, Inc and others. +See source files for details. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/LICENSE b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/LICENSE new file mode 100644 index 000000000..ef147e6e5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/LICENSE @@ -0,0 +1,24 @@ +Copyright (c) 2008-2013, Ruby FFI project contributors +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above copyright + notice, this list of conditions and the following disclaimer in the + documentation and/or other materials provided with the distribution. + * Neither the name of the Ruby FFI project nor the + names of its contributors may be used to endorse or promote products + derived from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND +ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED +WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY +DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES +(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; +LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND +ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/README.md b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/README.md new file mode 100644 index 000000000..ec4a57f0f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/README.md @@ -0,0 +1,109 @@ +# ruby-ffi https://wiki.github.com/ffi/ffi [![Build Status](https://travis-ci.org/ffi/ffi.png?branch=master)](https://travis-ci.org/ffi/ffi) + +## Description + +Ruby-FFI is a ruby extension for programmatically loading dynamic +libraries, binding functions within them, and calling those functions +from Ruby code. Moreover, a Ruby-FFI extension works without changes +on Ruby and JRuby. [Discover why you should write your next extension +using Ruby-FFI](https://wiki.github.com/ffi/ffi/why-use-ffi). + +## Features/problems + +* Intuitive DSL +* Supports all C native types +* C structs (also nested), enums and global variables +* Callbacks from C to ruby +* Automatic garbage collection of native memory + +## Synopsis + +```ruby +require 'ffi' + +module MyLib + extend FFI::Library + ffi_lib 'c' + attach_function :puts, [ :string ], :int +end + +MyLib.puts 'Hello, World using libc!' +``` + +For less minimalistic and more sane examples you may look at: + +* the samples/ folder +* the examples on the [wiki](https://wiki.github.com/ffi/ffi) +* the projects using FFI listed on this page (https://wiki.github.com/ffi/ffi/projects-using-ffi) + +## Requirements + +You need a sane building environment in order to compile the extension. +At a minimum, you will need: +* A C compiler (e.g. Xcode on OSX, gcc on everything else) +* libffi development library - this is commonly in the libffi-dev or libffi-devel + +## Installation + +From rubygems: + + [sudo] gem install ffi + +or from the git repository on github: + + git clone git://github.com/ffi/ffi.git + cd ffi + rake gem:install + +## License + +The ffi library is covered by the BSD license, also see the LICENSE file. +The specs are shared with Rubyspec and are licensed by the same license +as Rubyspec, see the LICENSE.SPECS file. + +## Credits + +The following people have submitted code, bug reports, or otherwise contributed to the success of this project: + +* Alban Peignier +* Aman Gupta +* Andrea Fazzi +* Andreas Niederl +* Andrew Cholakian +* Antonio Terceiro +* Brian Candler +* Brian D. Burns +* Bryan Kearney +* Charlie Savage +* Chikanaga Tomoyuki +* Hongli Lai +* Ian MacLeod +* Jake Douglas +* Jean-Dominique Morani +* Jeremy Hinegardner +* Jesús García Sáez +* Joe Khoobyar +* Jurij Smakov +* KISHIMOTO, Makoto +* Kim Burgestrand +* Lars Kanis +* Luc Heinrich +* Luis Lavena +* Matijs van Zuijlen +* Matthew King +* Mike Dalessio +* NARUSE, Yui +* Park Heesob +* Shin Yee +* Stephen Bannasch +* Suraj N. Kurapati +* Sylvain Daubert +* Victor Costan +* beoran@gmail.com +* ctide +* emboss +* hobophobe +* meh +* postmodern +* wycats@gmail.com +* Wayne Meissner diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/Rakefile new file mode 100644 index 000000000..d0639e4df --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/Rakefile @@ -0,0 +1,210 @@ +require 'rubygems/tasks' +require 'rbconfig' +require 'rake/clean' +require File.expand_path("./lib/ffi/version") + +USE_RAKE_COMPILER = (RUBY_PLATFORM =~ /java/) ? false : true +if USE_RAKE_COMPILER + require 'rake/extensiontask' +end + +require 'date' +require 'fileutils' +require 'rbconfig' +require 'rspec/core/rake_task' +require 'rubygems/package_task' + +LIBEXT = case RbConfig::CONFIG['host_os'].downcase + when /darwin/ + "dylib" + when /mswin|mingw/ + "dll" + else + RbConfig::CONFIG['DLEXT'] + end + +CPU = case RbConfig::CONFIG['host_cpu'].downcase + when /i[3456]86/ + # Darwin always reports i686, even when running in 64bit mode + if RbConfig::CONFIG['host_os'] =~ /darwin/ && 0xfee1deadbeef.is_a?(Fixnum) + "x86_64" + else + "i386" + end + + when /amd64|x86_64/ + "x86_64" + + when /ppc64|powerpc64/ + "powerpc64" + + when /ppc|powerpc/ + "powerpc" + + when /^arm/ + "arm" + + else + RbConfig::CONFIG['host_cpu'] + end + +OS = case RbConfig::CONFIG['host_os'].downcase + when /linux/ + "linux" + when /darwin/ + "darwin" + when /freebsd/ + "freebsd" + when /openbsd/ + "openbsd" + when /sunos|solaris/ + "solaris" + when /mswin|mingw/ + "win32" + else + RbConfig::CONFIG['host_os'].downcase + end + +GMAKE = system('which gmake >/dev/null') && 'gmake' || 'make' + +LIBTEST = "build/libtest.#{LIBEXT}" +BUILD_DIR = "build" +BUILD_EXT_DIR = File.join(BUILD_DIR, "#{RbConfig::CONFIG['arch']}", 'ffi_c', RUBY_VERSION) + +def gem_spec + @gem_spec ||= Gem::Specification.load('ffi.gemspec') +end + +TEST_DEPS = [ LIBTEST ] +if RUBY_PLATFORM == "java" + RSpec::Core::RakeTask.new(:spec) do |config| + config.rspec_opts = YAML.load_file 'spec/spec.opts' + end +else + RSpec::Core::RakeTask.new(:spec => :compile) do |config| + config.rspec_opts = YAML.load_file 'spec/spec.opts' + end + + TEST_DEPS.unshift :compile +end + +desc "Build all packages" +task :package => 'gem:package' + +CLOBBER.include 'lib/ffi/types.conf' +CLOBBER.include 'pkg' + +CLEAN.include 'build' +CLEAN.include 'conftest.dSYM' +CLEAN.include 'spec/ffi/fixtures/libtest.{dylib,so,dll}' +CLEAN.include 'spec/ffi/fixtures/*.o' +CLEAN.include "pkg/ffi-#{FFI::VERSION}-*-mingw32" +CLEAN.include "pkg/ffi-#{FFI::VERSION}-java" +CLEAN.include 'lib/1.*' +CLEAN.include 'lib/2.*' +CLEAN.include 'bin' + +task :distclean => :clobber + +desc "Build the native test lib" +file "build/libtest.#{LIBEXT}" => FileList['libtest/**/*.[ch]'] do + sh %{#{GMAKE} -f libtest/GNUmakefile CPU=#{CPU} OS=#{OS} } +end + + +desc "Build test helper lib" +task :libtest => "build/libtest.#{LIBEXT}" + +desc "Test the extension" +task :test => [ :spec ] + + +namespace :bench do + ITER = ENV['ITER'] ? ENV['ITER'].to_i : 100000 + bench_libs = "-Ilib -I#{BUILD_DIR}" unless RUBY_PLATFORM == "java" + bench_files = Dir["bench/bench_*.rb"].reject { |f| f == "bench_helper.rb" } + bench_files.each do |bench| + task File.basename(bench, ".rb")[6..-1] => TEST_DEPS do + sh %{#{Gem.ruby} #{bench_libs} #{bench} #{ITER}} + end + end + task :all => TEST_DEPS do + bench_files.each do |bench| + sh %{#{Gem.ruby} #{bench_libs} #{bench}} + end + end +end + +task 'spec:run' => TEST_DEPS +task 'spec:specdoc' => TEST_DEPS + +task :default => :specs + +namespace 'java' do + + java_gem_spec = Gem::Specification.new do |s| + s.name = gem_spec.name + s.version = gem_spec.version + s.author = gem_spec.author + s.email = gem_spec.email + s.homepage = gem_spec.homepage + s.summary = gem_spec.summary + s.description = gem_spec.description + s.files = %w(LICENSE COPYING README.md Rakefile) + s.has_rdoc = false + s.license = gem_spec.license + s.platform = 'java' + end + + Gem::PackageTask.new(java_gem_spec) do |pkg| + pkg.need_zip = true + pkg.need_tar = true + pkg.package_dir = 'pkg' + end +end + +task 'gem:java' => 'java:gem' + + +if USE_RAKE_COMPILER + Rake::ExtensionTask.new('ffi_c', gem_spec) do |ext| + ext.name = 'ffi_c' # indicate the name of the extension. + # ext.lib_dir = BUILD_DIR # put binaries into this folder. + ext.tmp_dir = BUILD_DIR # temporary folder used during compilation. + ext.cross_compile = true # enable cross compilation (requires cross compile toolchain) + ext.cross_platform = %w[i386-mingw32 x64-mingw32] # forces the Windows platform instead of the default one + end + + ENV['RUBY_CC_VERSION'] ||= '1.8.7:1.9.3:2.0.0:2.1.5:2.2.1' + + ENV['RUBY_CC_VERSION'].to_s.split(':').each do |ruby_version| + task "copy:ffi_c:i386-mingw32:#{ruby_version}" do |t| + sh "i686-w64-mingw32-strip -S #{BUILD_DIR}/i386-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so" + end + + task "copy:ffi_c:x64-mingw32:#{ruby_version}" do |t| + sh "x86_64-w64-mingw32-strip -S #{BUILD_DIR}/x64-mingw32/stage/lib/#{ruby_version[/^\d+\.\d+/]}/ffi_c.so" + end + end + + desc "build a windows gem without all the ceremony." + task "gem:windows" do + require "rake_compiler_dock" + RakeCompilerDock.sh "bundle && rake cross native gem MAKE='nice make -j`nproc`'" + end +end + +Gem::Tasks.new do |t| + t.scm.tag.format = '%s' +end + +begin + require 'yard' + + namespace :doc do + YARD::Rake::YardocTask.new do |yard| + end + end +rescue LoadError + warn "[warn] YARD unavailable" +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/AbstractMemory.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/AbstractMemory.c new file mode 100644 index 000000000..156d7cfa2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/AbstractMemory.c @@ -0,0 +1,1032 @@ +/* + * Copyright (c) 2008, 2009, Wayne Meissner + * Copyright (C) 2009 Jake Douglas + * Copyright (C) 2008 Luc Heinrich + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#ifndef _MSC_VER +# include +# include +# include +#else +# include "win32/stdbool.h" +# include "win32/stdint.h" +#endif + +#include +#include + +#include "rbffi.h" +#include "compat.h" +#include "AbstractMemory.h" +#include "Pointer.h" +#include "Function.h" +#include "LongDouble.h" + + +static inline char* memory_address(VALUE self); +VALUE rbffi_AbstractMemoryClass = Qnil; +static VALUE NullPointerErrorClass = Qnil; +static ID id_to_ptr = 0, id_plus = 0, id_call = 0; + +static VALUE +memory_allocate(VALUE klass) +{ + AbstractMemory* memory; + VALUE obj; + obj = Data_Make_Struct(klass, AbstractMemory, NULL, -1, memory); + memory->flags = MEM_RD | MEM_WR; + + return obj; +} +#define VAL(x, swap) (unlikely(((memory->flags & MEM_SWAP) != 0)) ? swap((x)) : (x)) + +#define NUM_OP(name, type, toNative, fromNative, swap) \ +static void memory_op_put_##name(AbstractMemory* memory, long off, VALUE value); \ +static void \ +memory_op_put_##name(AbstractMemory* memory, long off, VALUE value) \ +{ \ + type tmp = (type) VAL(toNative(value), swap); \ + checkWrite(memory); \ + checkBounds(memory, off, sizeof(type)); \ + memcpy(memory->address + off, &tmp, sizeof(tmp)); \ +} \ +static VALUE memory_put_##name(VALUE self, VALUE offset, VALUE value); \ +static VALUE \ +memory_put_##name(VALUE self, VALUE offset, VALUE value) \ +{ \ + AbstractMemory* memory; \ + Data_Get_Struct(self, AbstractMemory, memory); \ + memory_op_put_##name(memory, NUM2LONG(offset), value); \ + return self; \ +} \ +static VALUE memory_write_##name(VALUE self, VALUE value); \ +static VALUE \ +memory_write_##name(VALUE self, VALUE value) \ +{ \ + AbstractMemory* memory; \ + Data_Get_Struct(self, AbstractMemory, memory); \ + memory_op_put_##name(memory, 0, value); \ + return self; \ +} \ +static VALUE memory_op_get_##name(AbstractMemory* memory, long off); \ +static VALUE \ +memory_op_get_##name(AbstractMemory* memory, long off) \ +{ \ + type tmp; \ + checkRead(memory); \ + checkBounds(memory, off, sizeof(type)); \ + memcpy(&tmp, memory->address + off, sizeof(tmp)); \ + return fromNative(VAL(tmp, swap)); \ +} \ +static VALUE memory_get_##name(VALUE self, VALUE offset); \ +static VALUE \ +memory_get_##name(VALUE self, VALUE offset) \ +{ \ + AbstractMemory* memory; \ + Data_Get_Struct(self, AbstractMemory, memory); \ + return memory_op_get_##name(memory, NUM2LONG(offset)); \ +} \ +static VALUE memory_read_##name(VALUE self); \ +static VALUE \ +memory_read_##name(VALUE self) \ +{ \ + AbstractMemory* memory; \ + Data_Get_Struct(self, AbstractMemory, memory); \ + return memory_op_get_##name(memory, 0); \ +} \ +static MemoryOp memory_op_##name = { memory_op_get_##name, memory_op_put_##name }; \ +\ +static VALUE memory_put_array_of_##name(VALUE self, VALUE offset, VALUE ary); \ +static VALUE \ +memory_put_array_of_##name(VALUE self, VALUE offset, VALUE ary) \ +{ \ + long count = RARRAY_LEN(ary); \ + long off = NUM2LONG(offset); \ + AbstractMemory* memory = MEMORY(self); \ + long i; \ + checkWrite(memory); \ + checkBounds(memory, off, count * sizeof(type)); \ + for (i = 0; i < count; i++) { \ + type tmp = (type) VAL(toNative(RARRAY_PTR(ary)[i]), swap); \ + memcpy(memory->address + off + (i * sizeof(type)), &tmp, sizeof(tmp)); \ + } \ + return self; \ +} \ +static VALUE memory_write_array_of_##name(VALUE self, VALUE ary); \ +static VALUE \ +memory_write_array_of_##name(VALUE self, VALUE ary) \ +{ \ + return memory_put_array_of_##name(self, INT2FIX(0), ary); \ +} \ +static VALUE memory_get_array_of_##name(VALUE self, VALUE offset, VALUE length); \ +static VALUE \ +memory_get_array_of_##name(VALUE self, VALUE offset, VALUE length) \ +{ \ + long count = NUM2LONG(length); \ + long off = NUM2LONG(offset); \ + AbstractMemory* memory = MEMORY(self); \ + VALUE retVal = rb_ary_new2(count); \ + long i; \ + checkRead(memory); \ + checkBounds(memory, off, count * sizeof(type)); \ + for (i = 0; i < count; ++i) { \ + type tmp; \ + memcpy(&tmp, memory->address + off + (i * sizeof(type)), sizeof(tmp)); \ + rb_ary_push(retVal, fromNative(VAL(tmp, swap))); \ + } \ + return retVal; \ +} \ +static VALUE memory_read_array_of_##name(VALUE self, VALUE length); \ +static VALUE \ +memory_read_array_of_##name(VALUE self, VALUE length) \ +{ \ + return memory_get_array_of_##name(self, INT2FIX(0), length); \ +} + +#define NOSWAP(x) (x) +#define bswap16(x) (((x) >> 8) & 0xff) | (((x) << 8) & 0xff00); +static inline int16_t +SWAPS16(int16_t x) +{ + return bswap16(x); +} + +static inline uint16_t +SWAPU16(uint16_t x) +{ + return bswap16(x); +} + +#if !defined(__GNUC__) || (__GNUC__ < 4) || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) +#define bswap32(x) \ + (((x << 24) & 0xff000000) | \ + ((x << 8) & 0x00ff0000) | \ + ((x >> 8) & 0x0000ff00) | \ + ((x >> 24) & 0x000000ff)) + +#define bswap64(x) \ + (((x << 56) & 0xff00000000000000ULL) | \ + ((x << 40) & 0x00ff000000000000ULL) | \ + ((x << 24) & 0x0000ff0000000000ULL) | \ + ((x << 8) & 0x000000ff00000000ULL) | \ + ((x >> 8) & 0x00000000ff000000ULL) | \ + ((x >> 24) & 0x0000000000ff0000ULL) | \ + ((x >> 40) & 0x000000000000ff00ULL) | \ + ((x >> 56) & 0x00000000000000ffULL)) + +static inline int32_t +SWAPS32(int32_t x) +{ + return bswap32(x); +} + +static inline uint32_t +SWAPU32(uint32_t x) +{ + return bswap32(x); +} + +static inline int64_t +SWAPS64(int64_t x) +{ + return bswap64(x); +} + +static inline uint64_t +SWAPU64(uint64_t x) +{ + return bswap64(x); +} + +#else +# define SWAPS32(x) ((int32_t) __builtin_bswap32(x)) +# define SWAPU32(x) ((uint32_t) __builtin_bswap32(x)) +# define SWAPS64(x) ((int64_t) __builtin_bswap64(x)) +# define SWAPU64(x) ((uint64_t) __builtin_bswap64(x)) +#endif + +#if LONG_MAX > INT_MAX +# define SWAPSLONG SWAPS64 +# define SWAPULONG SWAPU64 +#else +# define SWAPSLONG SWAPS32 +# define SWAPULONG SWAPU32 +#endif + +NUM_OP(int8, int8_t, NUM2INT, INT2NUM, NOSWAP); +NUM_OP(uint8, uint8_t, NUM2UINT, UINT2NUM, NOSWAP); +NUM_OP(int16, int16_t, NUM2INT, INT2NUM, SWAPS16); +NUM_OP(uint16, uint16_t, NUM2UINT, UINT2NUM, SWAPU16); +NUM_OP(int32, int32_t, NUM2INT, INT2NUM, SWAPS32); +NUM_OP(uint32, uint32_t, NUM2UINT, UINT2NUM, SWAPU32); +NUM_OP(int64, int64_t, NUM2LL, LL2NUM, SWAPS64); +NUM_OP(uint64, uint64_t, NUM2ULL, ULL2NUM, SWAPU64); +NUM_OP(long, long, NUM2LONG, LONG2NUM, SWAPSLONG); +NUM_OP(ulong, unsigned long, NUM2ULONG, ULONG2NUM, SWAPULONG); +NUM_OP(float32, float, NUM2DBL, rb_float_new, NOSWAP); +NUM_OP(float64, double, NUM2DBL, rb_float_new, NOSWAP); +NUM_OP(longdouble, long double, rbffi_num2longdouble, rbffi_longdouble_new, NOSWAP); + +static inline void* +get_pointer_value(VALUE value) +{ + const int type = TYPE(value); + if (type == T_DATA && rb_obj_is_kind_of(value, rbffi_PointerClass)) { + return memory_address(value); + } else if (type == T_NIL) { + return NULL; + } else if (type == T_FIXNUM) { + return (void *) (uintptr_t) FIX2ULONG(value); + } else if (type == T_BIGNUM) { + return (void *) (uintptr_t) NUM2ULL(value); + } else if (rb_respond_to(value, id_to_ptr)) { + return MEMORY_PTR(rb_funcall2(value, id_to_ptr, 0, NULL)); + } else { + rb_raise(rb_eArgError, "value is not a pointer"); + return NULL; + } +} + +NUM_OP(pointer, void *, get_pointer_value, rbffi_Pointer_NewInstance, NOSWAP); + +static inline uint8_t +rbffi_bool_value(VALUE value) +{ + return RTEST(value); +} + +static inline VALUE +rbffi_bool_new(uint8_t value) +{ + return (value & 1) != 0 ? Qtrue : Qfalse; +} + +NUM_OP(bool, unsigned char, rbffi_bool_value, rbffi_bool_new, NOSWAP); + + +/* + * call-seq: memory.clear + * Set the memory to all-zero. + * @return [self] + */ +static VALUE +memory_clear(VALUE self) +{ + AbstractMemory* ptr = MEMORY(self); + memset(ptr->address, 0, ptr->size); + return self; +} + +/* + * call-seq: memory.size + * Return memory size in bytes (alias: #total) + * @return [Numeric] + */ +static VALUE +memory_size(VALUE self) +{ + AbstractMemory* ptr; + + Data_Get_Struct(self, AbstractMemory, ptr); + + return LONG2NUM(ptr->size); +} + +/* + * call-seq: memory.get_string(offset, length=nil) + * Return string contained in memory. + * @param [Numeric] offset point in buffer to start from + * @param [Numeric] length string's length in bytes. If nil, a (memory size - offset) length string is returned). + * @return [String] + * @raise {IndexError} if +length+ is too great + * @raise {NullPointerError} if memory not initialized + */ +static VALUE +memory_get_string(int argc, VALUE* argv, VALUE self) +{ + VALUE length = Qnil, offset = Qnil; + AbstractMemory* ptr = MEMORY(self); + long off, len; + char* end; + int nargs = rb_scan_args(argc, argv, "11", &offset, &length); + + off = NUM2LONG(offset); + len = nargs > 1 && length != Qnil ? NUM2LONG(length) : (ptr->size - off); + checkRead(ptr); + checkBounds(ptr, off, len); + + end = memchr(ptr->address + off, 0, len); + return rb_tainted_str_new((char *) ptr->address + off, + (end != NULL ? end - ptr->address - off : len)); +} + +/* + * call-seq: memory.get_array_of_string(offset, count=nil) + * Return an array of strings contained in memory. + * @param [Numeric] offset point in memory to start from + * @param [Numeric] count number of strings to get. If nil, return all strings + * @return [Array] + * @raise {IndexError} if +offset+ is too great + * @raise {NullPointerError} if memory not initialized + */ +static VALUE +memory_get_array_of_string(int argc, VALUE* argv, VALUE self) +{ + VALUE offset = Qnil, countnum = Qnil, retVal = Qnil; + AbstractMemory* ptr; + long off; + int count; + + rb_scan_args(argc, argv, "11", &offset, &countnum); + off = NUM2LONG(offset); + count = (countnum == Qnil ? 0 : NUM2INT(countnum)); + retVal = rb_ary_new2(count); + + Data_Get_Struct(self, AbstractMemory, ptr); + checkRead(ptr); + + if (countnum != Qnil) { + int i; + + checkBounds(ptr, off, count * sizeof (char*)); + + for (i = 0; i < count; ++i) { + const char* strptr = *((const char**) (ptr->address + off) + i); + rb_ary_push(retVal, (strptr == NULL ? Qnil : rb_tainted_str_new2(strptr))); + } + + } else { + checkBounds(ptr, off, sizeof (char*)); + for ( ; off < ptr->size - (long) sizeof (void *); off += (long) sizeof (void *)) { + const char* strptr = *(const char**) (ptr->address + off); + if (strptr == NULL) { + break; + } + rb_ary_push(retVal, rb_tainted_str_new2(strptr)); + } + } + + return retVal; +} + +/* + * call-seq: memory.read_array_of_string(count=nil) + * Return an array of strings contained in memory. Same as: + * memory.get_array_of_string(0, count) + * @param [Numeric] count number of strings to get. If nil, return all strings + * @return [Array] + */ +static VALUE +memory_read_array_of_string(int argc, VALUE* argv, VALUE self) +{ + VALUE* rargv = ALLOCA_N(VALUE, argc + 1); + int i; + + rargv[0] = INT2FIX(0); + for (i = 0; i < argc; i++) { + rargv[i + 1] = argv[i]; + } + + return memory_get_array_of_string(argc + 1, rargv, self); +} + + +/* + * call-seq: memory.put_string(offset, str) + * @param [Numeric] offset + * @param [String] str + * @return [self] + * @raise {SecurityError} when writing unsafe string to memory + * @raise {IndexError} if +offset+ is too great + * @raise {NullPointerError} if memory not initialized + * Put a string in memory. + */ +static VALUE +memory_put_string(VALUE self, VALUE offset, VALUE str) +{ + AbstractMemory* ptr = MEMORY(self); + long off, len; + + Check_Type(str, T_STRING); + off = NUM2LONG(offset); + len = RSTRING_LEN(str); + + checkWrite(ptr); + checkBounds(ptr, off, len + 1); + + memcpy(ptr->address + off, RSTRING_PTR(str), len); + *((char *) ptr->address + off + len) = '\0'; + + return self; +} + +/* + * call-seq: memory.get_bytes(offset, length) + * Return string contained in memory. + * @param [Numeric] offset point in buffer to start from + * @param [Numeric] length string's length in bytes. + * @return [String] + * @raise {IndexError} if +length+ is too great + * @raise {NullPointerError} if memory not initialized + */ +static VALUE +memory_get_bytes(VALUE self, VALUE offset, VALUE length) +{ + AbstractMemory* ptr = MEMORY(self); + long off, len; + + off = NUM2LONG(offset); + len = NUM2LONG(length); + + checkRead(ptr); + checkBounds(ptr, off, len); + + return rb_tainted_str_new((char *) ptr->address + off, len); +} + +/* + * call-seq: memory.put_bytes(offset, str, index=0, length=nil) + * Put a string in memory. + * @param [Numeric] offset point in buffer to start from + * @param [String] str string to put to memory + * @param [Numeric] index + * @param [Numeric] length string's length in bytes. If nil, a (memory size - offset) length string is returned). + * @return [self] + * @raise {IndexError} if +length+ is too great + * @raise {NullPointerError} if memory not initialized + * @raise {RangeError} if +index+ is negative, or if index+length is greater than size of string + * @raise {SecurityError} when writing unsafe string to memory + */ +static VALUE +memory_put_bytes(int argc, VALUE* argv, VALUE self) +{ + AbstractMemory* ptr = MEMORY(self); + VALUE offset = Qnil, str = Qnil, rbIndex = Qnil, rbLength = Qnil; + long off, len, idx; + int nargs = rb_scan_args(argc, argv, "22", &offset, &str, &rbIndex, &rbLength); + + Check_Type(str, T_STRING); + + off = NUM2LONG(offset); + idx = nargs > 2 ? NUM2LONG(rbIndex) : 0; + if (idx < 0) { + rb_raise(rb_eRangeError, "index canot be less than zero"); + return Qnil; + } + len = nargs > 3 ? NUM2LONG(rbLength) : (RSTRING_LEN(str) - idx); + if ((idx + len) > RSTRING_LEN(str)) { + rb_raise(rb_eRangeError, "index+length is greater than size of string"); + return Qnil; + } + + checkWrite(ptr); + checkBounds(ptr, off, len); + + if (rb_safe_level() >= 1 && OBJ_TAINTED(str)) { + rb_raise(rb_eSecurityError, "Writing unsafe string to memory"); + return Qnil; + } + memcpy(ptr->address + off, RSTRING_PTR(str) + idx, len); + + return self; +} + +/* + * call-seq: memory.read_bytes(length) + * @param [Numeric] length of string to return + * @return [String] + * equivalent to : + * memory.get_bytes(0, length) + */ +static VALUE +memory_read_bytes(VALUE self, VALUE length) +{ + return memory_get_bytes(self, INT2FIX(0), length); +} + +/* + * call-seq: memory.write_bytes(str, index=0, length=nil) + * @param [String] str string to put to memory + * @param [Numeric] index + * @param [Numeric] length string's length in bytes. If nil, a (memory size - offset) length string is returned). + * @return [self] + * equivalent to : + * memory.put_bytes(0, str, index, length) + */ +static VALUE +memory_write_bytes(int argc, VALUE* argv, VALUE self) +{ + VALUE* wargv = ALLOCA_N(VALUE, argc + 1); + int i; + + wargv[0] = INT2FIX(0); + for (i = 0; i < argc; i++) { + wargv[i + 1] = argv[i]; + } + + return memory_put_bytes(argc + 1, wargv, self); +} + +/* + * call-seq: memory.type_size + * @return [Numeric] type size in bytes + * Get the memory's type size. + */ +static VALUE +memory_type_size(VALUE self) +{ + AbstractMemory* ptr; + + Data_Get_Struct(self, AbstractMemory, ptr); + + return INT2NUM(ptr->typeSize); +} + +/* + * Document-method: [] + * call-seq: memory[idx] + * @param [Numeric] idx index to access in memory + * @return + * Memory read accessor. + */ +static VALUE +memory_aref(VALUE self, VALUE idx) +{ + AbstractMemory* ptr; + VALUE rbOffset = Qnil; + + Data_Get_Struct(self, AbstractMemory, ptr); + + rbOffset = ULONG2NUM(NUM2ULONG(idx) * ptr->typeSize); + + return rb_funcall2(self, id_plus, 1, &rbOffset); +} + +static inline char* +memory_address(VALUE obj) +{ + return ((AbstractMemory *) DATA_PTR(obj))->address; +} + +static VALUE +memory_copy_from(VALUE self, VALUE rbsrc, VALUE rblen) +{ + AbstractMemory* dst; + + Data_Get_Struct(self, AbstractMemory, dst); + + memcpy(dst->address, rbffi_AbstractMemory_Cast(rbsrc, rbffi_AbstractMemoryClass)->address, NUM2INT(rblen)); + + return self; +} + +AbstractMemory* +rbffi_AbstractMemory_Cast(VALUE obj, VALUE klass) +{ + if (rb_obj_is_kind_of(obj, klass)) { + AbstractMemory* memory; + Data_Get_Struct(obj, AbstractMemory, memory); + return memory; + } + + rb_raise(rb_eArgError, "Invalid Memory object"); + return NULL; +} + +void +rbffi_AbstractMemory_Error(AbstractMemory *mem, int op) +{ + VALUE rbErrorClass = mem->address == NULL ? NullPointerErrorClass : rb_eRuntimeError; + if (op == MEM_RD) { + rb_raise(rbErrorClass, "invalid memory read at address=%p", mem->address); + } else if (op == MEM_WR) { + rb_raise(rbErrorClass, "invalid memory write at address=%p", mem->address); + } else { + rb_raise(rbErrorClass, "invalid memory access at address=%p", mem->address); + } +} + +static VALUE +memory_op_get_strptr(AbstractMemory* ptr, long offset) +{ + void* tmp = NULL; + + if (ptr != NULL && ptr->address != NULL) { + checkRead(ptr); + checkBounds(ptr, offset, sizeof(tmp)); + memcpy(&tmp, ptr->address + offset, sizeof(tmp)); + } + + return tmp != NULL ? rb_tainted_str_new2(tmp) : Qnil; +} + +static void +memory_op_put_strptr(AbstractMemory* ptr, long offset, VALUE value) +{ + rb_raise(rb_eArgError, "Cannot set :string fields"); +} + +static MemoryOp memory_op_strptr = { memory_op_get_strptr, memory_op_put_strptr }; + + +MemoryOps rbffi_AbstractMemoryOps = { + &memory_op_int8, /*.int8 */ + &memory_op_uint8, /* .uint8 */ + &memory_op_int16, /* .int16 */ + &memory_op_uint16, /* .uint16 */ + &memory_op_int32, /* .int32 */ + &memory_op_uint32, /* .uint32 */ + &memory_op_int64, /* .int64 */ + &memory_op_uint64, /* .uint64 */ + &memory_op_long, /* .slong */ + &memory_op_ulong, /* .uslong */ + &memory_op_float32, /* .float32 */ + &memory_op_float64, /* .float64 */ + &memory_op_longdouble, /* .longdouble */ + &memory_op_pointer, /* .pointer */ + &memory_op_strptr, /* .strptr */ + &memory_op_bool /* .boolOp */ +}; + +void +rbffi_AbstractMemory_Init(VALUE moduleFFI) +{ + /* + * Document-class: FFI::AbstractMemory + * + * {AbstractMemory} is the base class for many memory management classes such as {Buffer}. + * + * This class has a lot of methods to work with integers : + * * put_intsize(offset, value) + * * get_intsize(offset) + * * put_uintsize(offset, value) + * * get_uintsize(offset) + * * writeuintsize(value) + * * read_intsize + * * write_uintsize(value) + * * read_uintsize + * * put_array_of_intsize(offset, ary) + * * get_array_of_intsize(offset, length) + * * put_array_of_uintsize(offset, ary) + * * get_array_of_uintsize(offset, length) + * * write_array_of_intsize(ary) + * * read_array_of_intsize(length) + * * write_array_of_uintsize(ary) + * * read_array_of_uintsize(length) + * where _size_ is 8, 16, 32 or 64. Same methods exist for long type. + * + * Aliases exist : _char_ for _int8_, _short_ for _int16_, _int_ for _int32_ and long_long for _int64_. + * + * Others methods are listed below. + */ + VALUE classMemory = rb_define_class_under(moduleFFI, "AbstractMemory", rb_cObject); + rbffi_AbstractMemoryClass = classMemory; + /* + * Document-variable: FFI::AbstractMemory + */ + rb_global_variable(&rbffi_AbstractMemoryClass); + rb_define_alloc_func(classMemory, memory_allocate); + + NullPointerErrorClass = rb_define_class_under(moduleFFI, "NullPointerError", rb_eRuntimeError); + /* Document-variable: NullPointerError */ + rb_global_variable(&NullPointerErrorClass); + + +#undef INT +#define INT(type) \ + rb_define_method(classMemory, "put_" #type, memory_put_##type, 2); \ + rb_define_method(classMemory, "get_" #type, memory_get_##type, 1); \ + rb_define_method(classMemory, "put_u" #type, memory_put_u##type, 2); \ + rb_define_method(classMemory, "get_u" #type, memory_get_u##type, 1); \ + rb_define_method(classMemory, "write_" #type, memory_write_##type, 1); \ + rb_define_method(classMemory, "read_" #type, memory_read_##type, 0); \ + rb_define_method(classMemory, "write_u" #type, memory_write_u##type, 1); \ + rb_define_method(classMemory, "read_u" #type, memory_read_u##type, 0); \ + rb_define_method(classMemory, "put_array_of_" #type, memory_put_array_of_##type, 2); \ + rb_define_method(classMemory, "get_array_of_" #type, memory_get_array_of_##type, 2); \ + rb_define_method(classMemory, "put_array_of_u" #type, memory_put_array_of_u##type, 2); \ + rb_define_method(classMemory, "get_array_of_u" #type, memory_get_array_of_u##type, 2); \ + rb_define_method(classMemory, "write_array_of_" #type, memory_write_array_of_##type, 1); \ + rb_define_method(classMemory, "read_array_of_" #type, memory_read_array_of_##type, 1); \ + rb_define_method(classMemory, "write_array_of_u" #type, memory_write_array_of_u##type, 1); \ + rb_define_method(classMemory, "read_array_of_u" #type, memory_read_array_of_u##type, 1); + + INT(int8); + INT(int16); + INT(int32); + INT(int64); + INT(long); + +#define ALIAS(name, old) \ + rb_define_alias(classMemory, "put_" #name, "put_" #old); \ + rb_define_alias(classMemory, "get_" #name, "get_" #old); \ + rb_define_alias(classMemory, "put_u" #name, "put_u" #old); \ + rb_define_alias(classMemory, "get_u" #name, "get_u" #old); \ + rb_define_alias(classMemory, "write_" #name, "write_" #old); \ + rb_define_alias(classMemory, "read_" #name, "read_" #old); \ + rb_define_alias(classMemory, "write_u" #name, "write_u" #old); \ + rb_define_alias(classMemory, "read_u" #name, "read_u" #old); \ + rb_define_alias(classMemory, "put_array_of_" #name, "put_array_of_" #old); \ + rb_define_alias(classMemory, "get_array_of_" #name, "get_array_of_" #old); \ + rb_define_alias(classMemory, "put_array_of_u" #name, "put_array_of_u" #old); \ + rb_define_alias(classMemory, "get_array_of_u" #name, "get_array_of_u" #old); \ + rb_define_alias(classMemory, "write_array_of_" #name, "write_array_of_" #old); \ + rb_define_alias(classMemory, "read_array_of_" #name, "read_array_of_" #old); \ + rb_define_alias(classMemory, "write_array_of_u" #name, "write_array_of_u" #old); \ + rb_define_alias(classMemory, "read_array_of_u" #name, "read_array_of_u" #old); + + ALIAS(char, int8); + ALIAS(short, int16); + ALIAS(int, int32); + ALIAS(long_long, int64); + + /* + * Document-method: put_float32 + * call-seq: memory.put_float32offset, value) + * @param [Numeric] offset + * @param [Numeric] value + * @return [self] + * Put +value+ as a 32-bit float in memory at offset +offset+ (alias: #put_float). + */ + rb_define_method(classMemory, "put_float32", memory_put_float32, 2); + /* + * Document-method: get_float32 + * call-seq: memory.get_float32(offset) + * @param [Numeric] offset + * @return [Float] + * Get a 32-bit float from memory at offset +offset+ (alias: #get_float). + */ + rb_define_method(classMemory, "get_float32", memory_get_float32, 1); + rb_define_alias(classMemory, "put_float", "put_float32"); + rb_define_alias(classMemory, "get_float", "get_float32"); + /* + * Document-method: write_float + * call-seq: memory.write_float(value) + * @param [Numeric] value + * @return [self] + * Write +value+ as a 32-bit float in memory. + * + * Same as: + * memory.put_float(0, value) + */ + rb_define_method(classMemory, "write_float", memory_write_float32, 1); + /* + * Document-method: read_float + * call-seq: memory.read_float + * @return [Float] + * Read a 32-bit float from memory. + * + * Same as: + * memory.get_float(0) + */ + rb_define_method(classMemory, "read_float", memory_read_float32, 0); + /* + * Document-method: put_array_of_float32 + * call-seq: memory.put_array_of_float32(offset, ary) + * @param [Numeric] offset + * @param [Array] ary + * @return [self] + * Put values from +ary+ as 32-bit floats in memory from offset +offset+ (alias: #put_array_of_float). + */ + rb_define_method(classMemory, "put_array_of_float32", memory_put_array_of_float32, 2); + /* + * Document-method: get_array_of_float32 + * call-seq: memory.get_array_of_float32(offset, length) + * @param [Numeric] offset + * @param [Numeric] length number of Float to get + * @return [Array] + * Get 32-bit floats in memory from offset +offset+ (alias: #get_array_of_float). + */ + rb_define_method(classMemory, "get_array_of_float32", memory_get_array_of_float32, 2); + /* + * Document-method: write_array_of_float + * call-seq: memory.write_array_of_float(ary) + * @param [Array] ary + * @return [self] + * Write values from +ary+ as 32-bit floats in memory. + * + * Same as: + * memory.put_array_of_float(0, ary) + */ + rb_define_method(classMemory, "write_array_of_float", memory_write_array_of_float32, 1); + /* + * Document-method: read_array_of_float + * call-seq: memory.read_array_of_float(length) + * @param [Numeric] length number of Float to read + * @return [Array] + * Read 32-bit floats from memory. + * + * Same as: + * memory.get_array_of_float(0, ary) + */ + rb_define_method(classMemory, "read_array_of_float", memory_read_array_of_float32, 1); + rb_define_alias(classMemory, "put_array_of_float", "put_array_of_float32"); + rb_define_alias(classMemory, "get_array_of_float", "get_array_of_float32"); + /* + * Document-method: put_float64 + * call-seq: memory.put_float64(offset, value) + * @param [Numeric] offset + * @param [Numeric] value + * @return [self] + * Put +value+ as a 64-bit float (double) in memory at offset +offset+ (alias: #put_double). + */ + rb_define_method(classMemory, "put_float64", memory_put_float64, 2); + /* + * Document-method: get_float64 + * call-seq: memory.get_float64(offset) + * @param [Numeric] offset + * @return [Float] + * Get a 64-bit float (double) from memory at offset +offset+ (alias: #get_double). + */ + rb_define_method(classMemory, "get_float64", memory_get_float64, 1); + rb_define_alias(classMemory, "put_double", "put_float64"); + rb_define_alias(classMemory, "get_double", "get_float64"); + /* + * Document-method: write_double + * call-seq: memory.write_double(value) + * @param [Numeric] value + * @return [self] + * Write +value+ as a 64-bit float (double) in memory. + * + * Same as: + * memory.put_double(0, value) + */ + rb_define_method(classMemory, "write_double", memory_write_float64, 1); + /* + * Document-method: read_double + * call-seq: memory.read_double + * @return [Float] + * Read a 64-bit float (double) from memory. + * + * Same as: + * memory.get_double(0) + */ + rb_define_method(classMemory, "read_double", memory_read_float64, 0); + /* + * Document-method: put_array_of_float64 + * call-seq: memory.put_array_of_float64(offset, ary) + * @param [Numeric] offset + * @param [Array] ary + * @return [self] + * Put values from +ary+ as 64-bit floats (doubles) in memory from offset +offset+ (alias: #put_array_of_double). + */ + rb_define_method(classMemory, "put_array_of_float64", memory_put_array_of_float64, 2); + /* + * Document-method: get_array_of_float64 + * call-seq: memory.get_array_of_float64(offset, length) + * @param [Numeric] offset + * @param [Numeric] length number of Float to get + * @return [Array] + * Get 64-bit floats (doubles) in memory from offset +offset+ (alias: #get_array_of_double). + */ + rb_define_method(classMemory, "get_array_of_float64", memory_get_array_of_float64, 2); + /* + * Document-method: write_array_of_double + * call-seq: memory.write_array_of_double(ary) + * @param [Array] ary + * @return [self] + * Write values from +ary+ as 64-bit floats (doubles) in memory. + * + * Same as: + * memory.put_array_of_double(0, ary) + */ + rb_define_method(classMemory, "write_array_of_double", memory_write_array_of_float64, 1); + /* + * Document-method: read_array_of_double + * call-seq: memory.read_array_of_double(length) + * @param [Numeric] length number of Float to read + * @return [Array] + * Read 64-bit floats (doubles) from memory. + * + * Same as: + * memory.get_array_of_double(0, ary) + */ + rb_define_method(classMemory, "read_array_of_double", memory_read_array_of_float64, 1); + rb_define_alias(classMemory, "put_array_of_double", "put_array_of_float64"); + rb_define_alias(classMemory, "get_array_of_double", "get_array_of_float64"); + /* + * Document-method: put_pointer + * call-seq: memory.put_pointer(offset, value) + * @param [Numeric] offset + * @param [nil,Pointer, Integer, #to_ptr] value + * @return [self] + * Put +value+ in memory from +offset+.. + */ + rb_define_method(classMemory, "put_pointer", memory_put_pointer, 2); + /* + * Document-method: get_pointer + * call-seq: memory.get_pointer(offset) + * @param [Numeric] offset + * @return [Pointer] + * Get a {Pointer} to the memory from +offset+. + */ + rb_define_method(classMemory, "get_pointer", memory_get_pointer, 1); + /* + * Document-method: write_pointer + * call-seq: memory.write_pointer(value) + * @param [nil,Pointer, Integer, #to_ptr] value + * @return [self] + * Write +value+ in memory. + * + * Equivalent to: + * memory.put_pointer(0, value) + */ + rb_define_method(classMemory, "write_pointer", memory_write_pointer, 1); + /* + * Document-method: read_pointer + * call-seq: memory.read_pointer + * @return [Pointer] + * Get a {Pointer} to the memory from base address. + * + * Equivalent to: + * memory.get_pointer(0) + */ + rb_define_method(classMemory, "read_pointer", memory_read_pointer, 0); + /* + * Document-method: put_array_of_pointer + * call-seq: memory.put_array_of_pointer(offset, ary) + * @param [Numeric] offset + * @param [Array<#to_ptr>] ary + * @return [self] + * Put an array of {Pointer} into memory from +offset+. + */ + rb_define_method(classMemory, "put_array_of_pointer", memory_put_array_of_pointer, 2); + /* + * Document-method: get_array_of_pointer + * call-seq: memory.get_array_of_pointer(offset, length) + * @param [Numeric] offset + * @param [Numeric] length + * @return [Array] + * Get an array of {Pointer} of length +length+ from +offset+. + */ + rb_define_method(classMemory, "get_array_of_pointer", memory_get_array_of_pointer, 2); + /* + * Document-method: write_array_of_pointer + * call-seq: memory.write_array_of_pointer(ary) + * @param [Array<#to_ptr>] ary + * @return [self] + * Write an array of {Pointer} into memory from +offset+. + * + * Same as : + * memory.put_array_of_pointer(0, ary) + */ + rb_define_method(classMemory, "write_array_of_pointer", memory_write_array_of_pointer, 1); + /* + * Document-method: read_array_of_pointer + * call-seq: memory.read_array_of_pointer(length) + * @param [Numeric] length + * @return [Array] + * Read an array of {Pointer} of length +length+. + * + * Same as: + * memory.get_array_of_pointer(0, length) + */ + rb_define_method(classMemory, "read_array_of_pointer", memory_read_array_of_pointer, 1); + + rb_define_method(classMemory, "get_string", memory_get_string, -1); + rb_define_method(classMemory, "put_string", memory_put_string, 2); + rb_define_method(classMemory, "get_bytes", memory_get_bytes, 2); + rb_define_method(classMemory, "put_bytes", memory_put_bytes, -1); + rb_define_method(classMemory, "read_bytes", memory_read_bytes, 1); + rb_define_method(classMemory, "write_bytes", memory_write_bytes, -1); + rb_define_method(classMemory, "get_array_of_string", memory_get_array_of_string, -1); + + rb_define_method(classMemory, "clear", memory_clear, 0); + rb_define_method(classMemory, "total", memory_size, 0); + rb_define_alias(classMemory, "size", "total"); + rb_define_method(classMemory, "type_size", memory_type_size, 0); + rb_define_method(classMemory, "[]", memory_aref, 1); + rb_define_method(classMemory, "__copy_from__", memory_copy_from, 2); + + id_to_ptr = rb_intern("to_ptr"); + id_call = rb_intern("call"); + id_plus = rb_intern("+"); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/AbstractMemory.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/AbstractMemory.h new file mode 100644 index 000000000..11192885a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/AbstractMemory.h @@ -0,0 +1,175 @@ +/* + * Copyright (c) 2008, 2009, Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RBFFI_ABSTRACTMEMORY_H +#define RBFFI_ABSTRACTMEMORY_H + +#ifndef _MSC_VER +#include +#endif +#include +#ifndef _MSC_VER +#include +#endif + +#include "compat.h" +#include "Types.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#define MEM_RD 0x01 +#define MEM_WR 0x02 +#define MEM_CODE 0x04 +#define MEM_SWAP 0x08 +#define MEM_EMBED 0x10 + +typedef struct AbstractMemory_ AbstractMemory; + +typedef struct { + VALUE (*get)(AbstractMemory* ptr, long offset); + void (*put)(AbstractMemory* ptr, long offset, VALUE value); +} MemoryOp; + +typedef struct { + MemoryOp* int8; + MemoryOp* uint8; + MemoryOp* int16; + MemoryOp* uint16; + MemoryOp* int32; + MemoryOp* uint32; + MemoryOp* int64; + MemoryOp* uint64; + MemoryOp* slong; + MemoryOp* uslong; + MemoryOp* float32; + MemoryOp* float64; + MemoryOp* longdouble; + MemoryOp* pointer; + MemoryOp* strptr; + MemoryOp* boolOp; +} MemoryOps; + +struct AbstractMemory_ { + char* address; /* Use char* instead of void* to ensure adding to it works correctly */ + long size; + int flags; + int typeSize; +}; + + +extern VALUE rbffi_AbstractMemoryClass; +extern MemoryOps rbffi_AbstractMemoryOps; + +extern void rbffi_AbstractMemory_Init(VALUE ffiModule); + +extern AbstractMemory* rbffi_AbstractMemory_Cast(VALUE obj, VALUE klass); + +extern void rbffi_AbstractMemory_Error(AbstractMemory *, int op); + +static inline void +checkBounds(AbstractMemory* mem, long off, long len) +{ + if (unlikely((off | len | (off + len) | (mem->size - (off + len))) < 0)) { + rb_raise(rb_eIndexError, "Memory access offset=%ld size=%ld is out of bounds", + off, len); + } +} + +static inline void +checkRead(AbstractMemory* mem) +{ + if (unlikely((mem->flags & MEM_RD) == 0)) { + rbffi_AbstractMemory_Error(mem, MEM_RD); + } +} + +static inline void +checkWrite(AbstractMemory* mem) +{ + if (unlikely((mem->flags & MEM_WR) == 0)) { + rbffi_AbstractMemory_Error(mem, MEM_WR); + } +} + +static inline MemoryOp* +get_memory_op(Type* type) +{ + switch (type->nativeType) { + case NATIVE_INT8: + return rbffi_AbstractMemoryOps.int8; + case NATIVE_UINT8: + return rbffi_AbstractMemoryOps.uint8; + case NATIVE_INT16: + return rbffi_AbstractMemoryOps.int16; + case NATIVE_UINT16: + return rbffi_AbstractMemoryOps.uint16; + case NATIVE_INT32: + return rbffi_AbstractMemoryOps.int32; + case NATIVE_UINT32: + return rbffi_AbstractMemoryOps.uint32; + case NATIVE_INT64: + return rbffi_AbstractMemoryOps.int64; + case NATIVE_UINT64: + return rbffi_AbstractMemoryOps.uint64; + case NATIVE_LONG: + return rbffi_AbstractMemoryOps.slong; + case NATIVE_ULONG: + return rbffi_AbstractMemoryOps.uslong; + case NATIVE_FLOAT32: + return rbffi_AbstractMemoryOps.float32; + case NATIVE_FLOAT64: + return rbffi_AbstractMemoryOps.float64; + case NATIVE_LONGDOUBLE: + return rbffi_AbstractMemoryOps.longdouble; + case NATIVE_POINTER: + return rbffi_AbstractMemoryOps.pointer; + case NATIVE_STRING: + return rbffi_AbstractMemoryOps.strptr; + case NATIVE_BOOL: + return rbffi_AbstractMemoryOps.boolOp; + default: + return NULL; + } +} + +#define MEMORY(obj) rbffi_AbstractMemory_Cast((obj), rbffi_AbstractMemoryClass) +#define MEMORY_PTR(obj) MEMORY((obj))->address +#define MEMORY_LEN(obj) MEMORY((obj))->size + + + +#ifdef __cplusplus +} +#endif + +#endif /* RBFFI_ABSTRACTMEMORY_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/AbstractMemory.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/AbstractMemory.o new file mode 100644 index 000000000..6e32e9952 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/AbstractMemory.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ArrayType.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ArrayType.c new file mode 100644 index 000000000..bfd666a7e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ArrayType.c @@ -0,0 +1,162 @@ +/* + * Copyright (c) 2009, Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include "ArrayType.h" + +static VALUE array_type_s_allocate(VALUE klass); +static VALUE array_type_initialize(VALUE self, VALUE rbComponentType, VALUE rbLength); +static void array_type_mark(ArrayType *); +static void array_type_free(ArrayType *); + +VALUE rbffi_ArrayTypeClass = Qnil; + +static VALUE +array_type_s_allocate(VALUE klass) +{ + ArrayType* array; + VALUE obj; + + obj = Data_Make_Struct(klass, ArrayType, array_type_mark, array_type_free, array); + + array->base.nativeType = NATIVE_ARRAY; + array->base.ffiType = xcalloc(1, sizeof(*array->base.ffiType)); + array->base.ffiType->type = FFI_TYPE_STRUCT; + array->base.ffiType->size = 0; + array->base.ffiType->alignment = 0; + array->rbComponentType = Qnil; + + return obj; +} + +static void +array_type_mark(ArrayType *array) +{ + rb_gc_mark(array->rbComponentType); +} + +static void +array_type_free(ArrayType *array) +{ + xfree(array->base.ffiType); + xfree(array->ffiTypes); + xfree(array); +} + + +/* + * call-seq: initialize(component_type, length) + * @param [Type] component_type + * @param [Numeric] length + * @return [self] + * A new instance of ArrayType. + */ +static VALUE +array_type_initialize(VALUE self, VALUE rbComponentType, VALUE rbLength) +{ + ArrayType* array; + int i; + + Data_Get_Struct(self, ArrayType, array); + + array->length = NUM2UINT(rbLength); + array->rbComponentType = rbComponentType; + Data_Get_Struct(rbComponentType, Type, array->componentType); + + array->ffiTypes = xcalloc(array->length + 1, sizeof(*array->ffiTypes)); + array->base.ffiType->elements = array->ffiTypes; + array->base.ffiType->size = array->componentType->ffiType->size * array->length; + array->base.ffiType->alignment = array->componentType->ffiType->alignment; + + for (i = 0; i < array->length; ++i) { + array->ffiTypes[i] = array->componentType->ffiType; + } + + return self; +} + +/* + * call-seq: length + * @return [Numeric] + * Get array's length + */ +static VALUE +array_type_length(VALUE self) +{ + ArrayType* array; + + Data_Get_Struct(self, ArrayType, array); + + return UINT2NUM(array->length); +} + +/* + * call-seq: element_type + * @return [Type] + * Get element type. + */ +static VALUE +array_type_element_type(VALUE self) +{ + ArrayType* array; + + Data_Get_Struct(self, ArrayType, array); + + return array->rbComponentType; +} + +void +rbffi_ArrayType_Init(VALUE moduleFFI) +{ + VALUE ffi_Type; + + ffi_Type = rbffi_TypeClass; + + /* + * Document-class: FFI::ArrayType < FFI::Type + * + * This is a typed array. The type is a {NativeType native type}. + */ + rbffi_ArrayTypeClass = rb_define_class_under(moduleFFI, "ArrayType", ffi_Type); + /* + * Document-variable: FFI::ArrayType + */ + rb_global_variable(&rbffi_ArrayTypeClass); + /* + * Document-constant: FFI::Type::Array + */ + rb_define_const(ffi_Type, "Array", rbffi_ArrayTypeClass); + + rb_define_alloc_func(rbffi_ArrayTypeClass, array_type_s_allocate); + rb_define_method(rbffi_ArrayTypeClass, "initialize", array_type_initialize, 2); + rb_define_method(rbffi_ArrayTypeClass, "length", array_type_length, 0); + rb_define_method(rbffi_ArrayTypeClass, "elem_type", array_type_element_type, 0); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ArrayType.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ArrayType.h new file mode 100644 index 000000000..356ffb1c2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ArrayType.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2009, Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RBFFI_ARRAYTYPE_H +#define RBFFI_ARRAYTYPE_H + +#include +#include +#include "Type.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct ArrayType_ { + Type base; + int length; + ffi_type** ffiTypes; + Type* componentType; + VALUE rbComponentType; +} ArrayType; + +extern void rbffi_ArrayType_Init(VALUE moduleFFI); +extern VALUE rbffi_ArrayTypeClass; + + +#ifdef __cplusplus +} +#endif + +#endif /* RBFFI_ARRAYTYPE_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ArrayType.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ArrayType.o new file mode 100644 index 000000000..5f7f349b7 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ArrayType.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Buffer.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Buffer.c new file mode 100644 index 000000000..8ae3a59f1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Buffer.c @@ -0,0 +1,365 @@ +/* + * Copyright (c) 2008-2010 Wayne Meissner + * Copyright (C) 2009 Aman Gupta + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MSC_VER +# include +# include +#else +# include "win32/stdbool.h" +# include "win32/stdint.h" +#endif +#include +#include +#include "rbffi.h" +#include "rbffi_endian.h" +#include "AbstractMemory.h" + +#define BUFFER_EMBED_MAXLEN (8) +typedef struct Buffer { + AbstractMemory memory; + + union { + VALUE rbParent; /* link to parent buffer */ + char* storage; /* start of malloc area */ + long embed[BUFFER_EMBED_MAXLEN / sizeof(long)]; /* storage for tiny allocations */ + } data; +} Buffer; + +static VALUE buffer_allocate(VALUE klass); +static VALUE buffer_initialize(int argc, VALUE* argv, VALUE self); +static void buffer_release(Buffer* ptr); +static void buffer_mark(Buffer* ptr); +static VALUE buffer_free(VALUE self); + +static VALUE BufferClass = Qnil; + +static VALUE +buffer_allocate(VALUE klass) +{ + Buffer* buffer; + VALUE obj; + + obj = Data_Make_Struct(klass, Buffer, NULL, buffer_release, buffer); + buffer->data.rbParent = Qnil; + buffer->memory.flags = MEM_RD | MEM_WR; + + return obj; +} + +static void +buffer_release(Buffer* ptr) +{ + if ((ptr->memory.flags & MEM_EMBED) == 0 && ptr->data.storage != NULL) { + xfree(ptr->data.storage); + ptr->data.storage = NULL; + } + + xfree(ptr); +} + +/* + * call-seq: initialize(size, count=1, clear=false) + * @param [Integer, Symbol, #size] Type or size in bytes of a buffer cell + * @param [Fixnum] count number of cell in the Buffer + * @param [Boolean] clear if true, set the buffer to all-zero + * @return [self] + * @raise {NoMemoryError} if failed to allocate memory for Buffer + * A new instance of Buffer. + */ +static VALUE +buffer_initialize(int argc, VALUE* argv, VALUE self) +{ + VALUE rbSize = Qnil, rbCount = Qnil, rbClear = Qnil; + Buffer* p; + int nargs; + + Data_Get_Struct(self, Buffer, p); + + nargs = rb_scan_args(argc, argv, "12", &rbSize, &rbCount, &rbClear); + p->memory.typeSize = rbffi_type_size(rbSize); + p->memory.size = p->memory.typeSize * (nargs > 1 ? NUM2LONG(rbCount) : 1); + + if (p->memory.size > BUFFER_EMBED_MAXLEN) { + p->data.storage = xmalloc(p->memory.size + 7); + if (p->data.storage == NULL) { + rb_raise(rb_eNoMemError, "Failed to allocate memory size=%lu bytes", p->memory.size); + return Qnil; + } + + /* ensure the memory is aligned on at least a 8 byte boundary */ + p->memory.address = (void *) (((uintptr_t) p->data.storage + 0x7) & (uintptr_t) ~0x7UL); + + if (p->memory.size > 0 && (nargs < 3 || RTEST(rbClear))) { + memset(p->memory.address, 0, p->memory.size); + } + + } else { + p->memory.flags |= MEM_EMBED; + p->memory.address = (void *) &p->data.embed[0]; + } + + if (rb_block_given_p()) { + return rb_ensure(rb_yield, self, buffer_free, self); + } + + return self; +} + +/* + * call-seq: initialize_copy(other) + * @return [self] + * DO NOT CALL THIS METHOD. + */ +static VALUE +buffer_initialize_copy(VALUE self, VALUE other) +{ + AbstractMemory* src; + Buffer* dst; + + Data_Get_Struct(self, Buffer, dst); + src = rbffi_AbstractMemory_Cast(other, BufferClass); + if ((dst->memory.flags & MEM_EMBED) == 0 && dst->data.storage != NULL) { + xfree(dst->data.storage); + } + dst->data.storage = xmalloc(src->size + 7); + if (dst->data.storage == NULL) { + rb_raise(rb_eNoMemError, "failed to allocate memory size=%lu bytes", src->size); + return Qnil; + } + + dst->memory.address = (void *) (((uintptr_t) dst->data.storage + 0x7) & (uintptr_t) ~0x7UL); + dst->memory.size = src->size; + dst->memory.typeSize = src->typeSize; + + /* finally, copy the actual buffer contents */ + memcpy(dst->memory.address, src->address, src->size); + + return self; +} + +static VALUE +buffer_alloc_inout(int argc, VALUE* argv, VALUE klass) +{ + return buffer_initialize(argc, argv, buffer_allocate(klass)); +} + +static VALUE +slice(VALUE self, long offset, long len) +{ + Buffer* ptr; + Buffer* result; + VALUE obj = Qnil; + + Data_Get_Struct(self, Buffer, ptr); + checkBounds(&ptr->memory, offset, len); + + obj = Data_Make_Struct(BufferClass, Buffer, buffer_mark, -1, result); + result->memory.address = ptr->memory.address + offset; + result->memory.size = len; + result->memory.flags = ptr->memory.flags; + result->memory.typeSize = ptr->memory.typeSize; + result->data.rbParent = self; + + return obj; +} + +/* + * call-seq: + offset + * @param [Numeric] offset + * @return [Buffer] a new instance of Buffer pointing from offset until end of previous buffer. + * Add a Buffer with an offset + */ +static VALUE +buffer_plus(VALUE self, VALUE rbOffset) +{ + Buffer* ptr; + long offset = NUM2LONG(rbOffset); + + Data_Get_Struct(self, Buffer, ptr); + + return slice(self, offset, ptr->memory.size - offset); +} + +/* + * call-seq: slice(offset, length) + * @param [Numeric] offset + * @param [Numeric] length + * @return [Buffer] a new instance of Buffer + * Slice an existing Buffer. + */ +static VALUE +buffer_slice(VALUE self, VALUE rbOffset, VALUE rbLength) +{ + return slice(self, NUM2LONG(rbOffset), NUM2LONG(rbLength)); +} + +/* + * call-seq: inspect + * @return [String] + * Inspect a Buffer. + */ +static VALUE +buffer_inspect(VALUE self) +{ + char tmp[100]; + Buffer* ptr; + + Data_Get_Struct(self, Buffer, ptr); + + snprintf(tmp, sizeof(tmp), "#", ptr, ptr->memory.address, ptr->memory.size); + + return rb_str_new2(tmp); +} + + +#if BYTE_ORDER == LITTLE_ENDIAN +# define SWAPPED_ORDER BIG_ENDIAN +#else +# define SWAPPED_ORDER LITTLE_ENDIAN +#endif + +/* + * Set or get endianness of Buffer. + * @overload order + * @return [:big, :little] + * Get endianness of Buffer. + * @overload order(order) + * @param [:big, :little, :network] order + * @return [self] + * Set endinaness of Buffer (+:network+ is an alias for +:big+). + */ +static VALUE +buffer_order(int argc, VALUE* argv, VALUE self) +{ + Buffer* ptr; + + Data_Get_Struct(self, Buffer, ptr); + if (argc == 0) { + int order = (ptr->memory.flags & MEM_SWAP) == 0 ? BYTE_ORDER : SWAPPED_ORDER; + return order == BIG_ENDIAN ? ID2SYM(rb_intern("big")) : ID2SYM(rb_intern("little")); + } else { + VALUE rbOrder = Qnil; + int order = BYTE_ORDER; + + if (rb_scan_args(argc, argv, "1", &rbOrder) < 1) { + rb_raise(rb_eArgError, "need byte order"); + } + if (SYMBOL_P(rbOrder)) { + ID id = SYM2ID(rbOrder); + if (id == rb_intern("little")) { + order = LITTLE_ENDIAN; + + } else if (id == rb_intern("big") || id == rb_intern("network")) { + order = BIG_ENDIAN; + } + } + if (order != BYTE_ORDER) { + Buffer* p2; + VALUE retval = slice(self, 0, ptr->memory.size); + + Data_Get_Struct(retval, Buffer, p2); + p2->memory.flags |= MEM_SWAP; + return retval; + } + + return self; + } +} + +/* Only used to free the buffer if the yield in the initializer throws an exception */ +static VALUE +buffer_free(VALUE self) +{ + Buffer* ptr; + + Data_Get_Struct(self, Buffer, ptr); + if ((ptr->memory.flags & MEM_EMBED) == 0 && ptr->data.storage != NULL) { + xfree(ptr->data.storage); + ptr->data.storage = NULL; + } + + return self; +} + +static void +buffer_mark(Buffer* ptr) +{ + rb_gc_mark(ptr->data.rbParent); +} + +void +rbffi_Buffer_Init(VALUE moduleFFI) +{ + VALUE ffi_AbstractMemory = rbffi_AbstractMemoryClass; + + /* + * Document-class: FFI::Buffer < FFI::AbstractMemory + * + * A Buffer is a function argument type. It should be use with functions playing with C arrays. + */ + BufferClass = rb_define_class_under(moduleFFI, "Buffer", ffi_AbstractMemory); + + /* + * Document-variable: FFI::Buffer + */ + rb_global_variable(&BufferClass); + rb_define_alloc_func(BufferClass, buffer_allocate); + + /* + * Document-method: alloc_inout + * call-seq: alloc_inout(*args) + * Create a new Buffer for in and out arguments (alias : new_inout). + */ + rb_define_singleton_method(BufferClass, "alloc_inout", buffer_alloc_inout, -1); + /* + * Document-method: alloc_out + * call-seq: alloc_out(*args) + * Create a new Buffer for out arguments (alias : new_out). + */ + rb_define_singleton_method(BufferClass, "alloc_out", buffer_alloc_inout, -1); + /* + * Document-method: alloc_in + * call-seq: alloc_in(*args) + * Create a new Buffer for in arguments (alias : new_in). + */ + rb_define_singleton_method(BufferClass, "alloc_in", buffer_alloc_inout, -1); + rb_define_alias(rb_singleton_class(BufferClass), "new_in", "alloc_in"); + rb_define_alias(rb_singleton_class(BufferClass), "new_out", "alloc_out"); + rb_define_alias(rb_singleton_class(BufferClass), "new_inout", "alloc_inout"); + + rb_define_method(BufferClass, "initialize", buffer_initialize, -1); + rb_define_method(BufferClass, "initialize_copy", buffer_initialize_copy, 1); + rb_define_method(BufferClass, "order", buffer_order, -1); + rb_define_method(BufferClass, "inspect", buffer_inspect, 0); + rb_define_alias(BufferClass, "length", "total"); + rb_define_method(BufferClass, "+", buffer_plus, 1); + rb_define_method(BufferClass, "slice", buffer_slice, 2); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Buffer.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Buffer.o new file mode 100644 index 000000000..441bca972 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Buffer.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Call.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Call.c new file mode 100644 index 000000000..b02881129 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Call.c @@ -0,0 +1,530 @@ +/* + * Copyright (c) 2009, Wayne Meissner + * Copyright (c) 2009, Luc Heinrich + * Copyright (c) 2009, Mike Dalessio + * Copyright (c) 2009, Aman Gupta. + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MSC_VER +#include +#endif +#include +#include +#ifndef _MSC_VER +# include +# include +#else +# include "win32/stdbool.h" +# include "win32/stdint.h" +#endif +#include +#include +#if defined(HAVE_NATIVETHREAD) && (defined(HAVE_RB_THREAD_BLOCKING_REGION) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)) && !defined(_WIN32) +# include +# include +#endif +#include +#include "extconf.h" +#include "rbffi.h" +#include "compat.h" +#include "AbstractMemory.h" +#include "Pointer.h" +#include "Struct.h" +#include "Function.h" +#include "Type.h" +#include "LastError.h" +#include "Call.h" +#include "MappedType.h" +#include "Thread.h" +#include "LongDouble.h" + +#ifdef USE_RAW +# ifndef __i386__ +# error "RAW argument packing only supported on i386" +# endif + +#define INT8_ADJ (4) +#define INT16_ADJ (4) +#define INT32_ADJ (4) +#define INT64_ADJ (8) +#define LONG_ADJ (sizeof(long)) +#define FLOAT32_ADJ (4) +#define FLOAT64_ADJ (8) +#define ADDRESS_ADJ (sizeof(void *)) +#define LONGDOUBLE_ADJ (ffi_type_longdouble.alignment) + +#endif /* USE_RAW */ + +#ifdef USE_RAW +# define ADJ(p, a) ((p) = (FFIStorage*) (((char *) p) + a##_ADJ)) +#else +# define ADJ(p, a) (++(p)) +#endif + +static void* callback_param(VALUE proc, VALUE cbinfo); +static inline void* getPointer(VALUE value, int type); + +static ID id_to_ptr, id_map_symbol, id_to_native; + +void +rbffi_SetupCallParams(int argc, VALUE* argv, int paramCount, Type** paramTypes, + FFIStorage* paramStorage, void** ffiValues, + VALUE* callbackParameters, int callbackCount, VALUE enums) +{ + VALUE callbackProc = Qnil; + FFIStorage* param = ¶mStorage[0]; + int i, argidx, cbidx, argCount; + + if (unlikely(paramCount != -1 && paramCount != argc)) { + if (argc == (paramCount - 1) && callbackCount == 1 && rb_block_given_p()) { + callbackProc = rb_block_proc(); + } else { + rb_raise(rb_eArgError, "wrong number of arguments (%d for %d)", argc, paramCount); + } + } + + argCount = paramCount != -1 ? paramCount : argc; + + for (i = 0, argidx = 0, cbidx = 0; i < argCount; ++i) { + Type* paramType = paramTypes[i]; + int type; + + + if (unlikely(paramType->nativeType == NATIVE_MAPPED)) { + VALUE values[] = { argv[argidx], Qnil }; + argv[argidx] = rb_funcall2(((MappedType *) paramType)->rbConverter, id_to_native, 2, values); + paramType = ((MappedType *) paramType)->type; + } + + type = argidx < argc ? TYPE(argv[argidx]) : T_NONE; + ffiValues[i] = param; + + switch (paramType->nativeType) { + + case NATIVE_INT8: + if (unlikely(type == T_SYMBOL && enums != Qnil)) { + VALUE value = rb_funcall(enums, id_map_symbol, 1, argv[argidx]); + param->s8 = NUM2INT(value); + } else { + param->s8 = NUM2INT(argv[argidx]); + } + + ++argidx; + ADJ(param, INT8); + break; + + case NATIVE_INT16: + if (unlikely(type == T_SYMBOL && enums != Qnil)) { + VALUE value = rb_funcall(enums, id_map_symbol, 1, argv[argidx]); + param->s16 = NUM2INT(value); + + } else { + param->s16 = NUM2INT(argv[argidx]); + } + + ++argidx; + ADJ(param, INT16); + break; + + case NATIVE_INT32: + if (unlikely(type == T_SYMBOL && enums != Qnil)) { + VALUE value = rb_funcall(enums, id_map_symbol, 1, argv[argidx]); + param->s32 = NUM2INT(value); + + } else { + param->s32 = NUM2INT(argv[argidx]); + } + + ++argidx; + ADJ(param, INT32); + break; + + case NATIVE_BOOL: + if (type != T_TRUE && type != T_FALSE) { + rb_raise(rb_eTypeError, "wrong argument type (expected a boolean parameter)"); + } + param->s8 = argv[argidx++] == Qtrue; + ADJ(param, INT8); + break; + + case NATIVE_UINT8: + if (unlikely(type == T_SYMBOL && enums != Qnil)) { + VALUE value = rb_funcall(enums, id_map_symbol, 1, argv[argidx]); + param->u8 = NUM2UINT(value); + } else { + param->u8 = NUM2UINT(argv[argidx]); + } + + ADJ(param, INT8); + ++argidx; + break; + + case NATIVE_UINT16: + if (unlikely(type == T_SYMBOL && enums != Qnil)) { + VALUE value = rb_funcall(enums, id_map_symbol, 1, argv[argidx]); + param->u16 = NUM2UINT(value); + } else { + param->u16 = NUM2UINT(argv[argidx]); + } + + ADJ(param, INT16); + ++argidx; + break; + + case NATIVE_UINT32: + if (unlikely(type == T_SYMBOL && enums != Qnil)) { + VALUE value = rb_funcall(enums, id_map_symbol, 1, argv[argidx]); + param->u32 = NUM2UINT(value); + } else { + param->u32 = NUM2UINT(argv[argidx]); + } + + ADJ(param, INT32); + ++argidx; + break; + + case NATIVE_INT64: + if (unlikely(type == T_SYMBOL && enums != Qnil)) { + VALUE value = rb_funcall(enums, id_map_symbol, 1, argv[argidx]); + param->i64 = NUM2LL(value); + } else { + param->i64 = NUM2LL(argv[argidx]); + } + + ADJ(param, INT64); + ++argidx; + break; + + case NATIVE_UINT64: + if (unlikely(type == T_SYMBOL && enums != Qnil)) { + VALUE value = rb_funcall(enums, id_map_symbol, 1, argv[argidx]); + param->u64 = NUM2ULL(value); + } else { + param->u64 = NUM2ULL(argv[argidx]); + } + + ADJ(param, INT64); + ++argidx; + break; + + case NATIVE_LONG: + if (unlikely(type == T_SYMBOL && enums != Qnil)) { + VALUE value = rb_funcall(enums, id_map_symbol, 1, argv[argidx]); + *(ffi_sarg *) param = NUM2LONG(value); + } else { + *(ffi_sarg *) param = NUM2LONG(argv[argidx]); + } + + ADJ(param, LONG); + ++argidx; + break; + + case NATIVE_ULONG: + if (unlikely(type == T_SYMBOL && enums != Qnil)) { + VALUE value = rb_funcall(enums, id_map_symbol, 1, argv[argidx]); + *(ffi_arg *) param = NUM2ULONG(value); + } else { + *(ffi_arg *) param = NUM2ULONG(argv[argidx]); + } + + ADJ(param, LONG); + ++argidx; + break; + + case NATIVE_FLOAT32: + if (unlikely(type == T_SYMBOL && enums != Qnil)) { + VALUE value = rb_funcall(enums, id_map_symbol, 1, argv[argidx]); + param->f32 = (float) NUM2DBL(value); + } else { + param->f32 = (float) NUM2DBL(argv[argidx]); + } + + ADJ(param, FLOAT32); + ++argidx; + break; + + case NATIVE_FLOAT64: + if (unlikely(type == T_SYMBOL && enums != Qnil)) { + VALUE value = rb_funcall(enums, id_map_symbol, 1, argv[argidx]); + param->f64 = NUM2DBL(value); + } else { + param->f64 = NUM2DBL(argv[argidx]); + } + + ADJ(param, FLOAT64); + ++argidx; + break; + + case NATIVE_LONGDOUBLE: + if (unlikely(type == T_SYMBOL && enums != Qnil)) { + VALUE value = rb_funcall(enums, id_map_symbol, 1, argv[argidx]); + param->ld = rbffi_num2longdouble(value); + } else { + param->ld = rbffi_num2longdouble(argv[argidx]); + } + + ADJ(param, LONGDOUBLE); + ++argidx; + break; + + + case NATIVE_STRING: + if (type == T_NIL) { + param->ptr = NULL; + + } else { + if (rb_safe_level() >= 1 && OBJ_TAINTED(argv[argidx])) { + rb_raise(rb_eSecurityError, "Unsafe string parameter"); + } + + param->ptr = StringValueCStr(argv[argidx]); + } + + ADJ(param, ADDRESS); + ++argidx; + break; + + case NATIVE_POINTER: + case NATIVE_BUFFER_IN: + case NATIVE_BUFFER_OUT: + case NATIVE_BUFFER_INOUT: + param->ptr = getPointer(argv[argidx++], type); + ADJ(param, ADDRESS); + break; + + + case NATIVE_FUNCTION: + case NATIVE_CALLBACK: + if (callbackProc != Qnil) { + param->ptr = callback_param(callbackProc, callbackParameters[cbidx++]); + } else { + param->ptr = callback_param(argv[argidx], callbackParameters[cbidx++]); + ++argidx; + } + ADJ(param, ADDRESS); + break; + + case NATIVE_STRUCT: + ffiValues[i] = getPointer(argv[argidx++], type); + break; + + default: + rb_raise(rb_eArgError, "Invalid parameter type: %d", paramType->nativeType); + } + } +} + + +typedef struct BlockingCall_ { + rbffi_frame_t* frame; + void* function; + FunctionType* info; + void **ffiValues; + void* retval; + void* params; +#if !(defined(HAVE_RB_THREAD_BLOCKING_REGION) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)) + void* stkretval; +#endif +} BlockingCall; + +static VALUE +call_blocking_function(void* data) +{ + BlockingCall* b = (BlockingCall *) data; + b->frame->has_gvl = false; + ffi_call(&b->info->ffi_cif, FFI_FN(b->function), b->retval, b->ffiValues); + b->frame->has_gvl = true; + + return Qnil; +} + +static VALUE +do_blocking_call(void *data) +{ + rbffi_thread_blocking_region(call_blocking_function, data, (void *) -1, NULL); + + return Qnil; +} + +static VALUE +save_frame_exception(void *data, VALUE exc) +{ + rbffi_frame_t* frame = (rbffi_frame_t *) data; + frame->exc = exc; + return Qnil; +} + +VALUE +rbffi_CallFunction(int argc, VALUE* argv, void* function, FunctionType* fnInfo) +{ + void* retval; + void** ffiValues; + FFIStorage* params; + VALUE rbReturnValue; + rbffi_frame_t frame = { 0 }; + + retval = alloca(MAX(fnInfo->ffi_cif.rtype->size, FFI_SIZEOF_ARG)); + + if (unlikely(fnInfo->blocking)) { + BlockingCall* bc; + + /* + * due to the way thread switching works on older ruby variants, we + * cannot allocate anything passed to the blocking function on the stack + */ +#if defined(HAVE_RB_THREAD_BLOCKING_REGION) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) + ffiValues = ALLOCA_N(void *, fnInfo->parameterCount); + params = ALLOCA_N(FFIStorage, fnInfo->parameterCount); + bc = ALLOCA_N(BlockingCall, 1); + bc->retval = retval; +#else + ffiValues = ALLOC_N(void *, fnInfo->parameterCount); + params = ALLOC_N(FFIStorage, fnInfo->parameterCount); + bc = ALLOC_N(BlockingCall, 1); + bc->retval = xmalloc(MAX(fnInfo->ffi_cif.rtype->size, FFI_SIZEOF_ARG)); + bc->stkretval = retval; +#endif + bc->info = fnInfo; + bc->function = function; + bc->ffiValues = ffiValues; + bc->params = params; + bc->frame = &frame; + + rbffi_SetupCallParams(argc, argv, + fnInfo->parameterCount, fnInfo->parameterTypes, params, ffiValues, + fnInfo->callbackParameters, fnInfo->callbackCount, fnInfo->rbEnums); + + rbffi_frame_push(&frame); + rb_rescue2(do_blocking_call, (VALUE) bc, save_frame_exception, (VALUE) &frame, rb_eException, (VALUE) 0); + rbffi_frame_pop(&frame); + +#if !(defined(HAVE_RB_THREAD_BLOCKING_REGION) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)) + memcpy(bc->stkretval, bc->retval, MAX(bc->info->ffi_cif.rtype->size, FFI_SIZEOF_ARG)); + xfree(bc->params); + xfree(bc->ffiValues); + xfree(bc->retval); + xfree(bc); +#endif + + } else { + + ffiValues = ALLOCA_N(void *, fnInfo->parameterCount); + params = ALLOCA_N(FFIStorage, fnInfo->parameterCount); + + rbffi_SetupCallParams(argc, argv, + fnInfo->parameterCount, fnInfo->parameterTypes, params, ffiValues, + fnInfo->callbackParameters, fnInfo->callbackCount, fnInfo->rbEnums); + + rbffi_frame_push(&frame); + ffi_call(&fnInfo->ffi_cif, FFI_FN(function), retval, ffiValues); + rbffi_frame_pop(&frame); + } + + if (unlikely(!fnInfo->ignoreErrno)) { + rbffi_save_errno(); + } + + if (RTEST(frame.exc) && frame.exc != Qnil) { + rb_exc_raise(frame.exc); + } + + RB_GC_GUARD(rbReturnValue) = rbffi_NativeValue_ToRuby(fnInfo->returnType, fnInfo->rbReturnType, retval); + RB_GC_GUARD(fnInfo->rbReturnType); + + return rbReturnValue; +} + +static inline void* +getPointer(VALUE value, int type) +{ + if (likely(type == T_DATA && rb_obj_is_kind_of(value, rbffi_AbstractMemoryClass))) { + + return ((AbstractMemory *) DATA_PTR(value))->address; + + } else if (type == T_DATA && rb_obj_is_kind_of(value, rbffi_StructClass)) { + + AbstractMemory* memory = ((Struct *) DATA_PTR(value))->pointer; + return memory != NULL ? memory->address : NULL; + + } else if (type == T_STRING) { + + return StringValuePtr(value); + + } else if (type == T_NIL) { + + return NULL; + + } else if (rb_respond_to(value, id_to_ptr)) { + + VALUE ptr = rb_funcall2(value, id_to_ptr, 0, NULL); + if (rb_obj_is_kind_of(ptr, rbffi_AbstractMemoryClass) && TYPE(ptr) == T_DATA) { + return ((AbstractMemory *) DATA_PTR(ptr))->address; + } + rb_raise(rb_eArgError, "to_ptr returned an invalid pointer"); + } + + rb_raise(rb_eArgError, ":pointer argument is not a valid pointer"); + return NULL; +} + +Invoker +rbffi_GetInvoker(FunctionType *fnInfo) +{ + return rbffi_CallFunction; +} + + +static void* +callback_param(VALUE proc, VALUE cbInfo) +{ + VALUE callback ; + if (unlikely(proc == Qnil)) { + return NULL ; + } + + /* Handle Function pointers here */ + if (rb_obj_is_kind_of(proc, rbffi_FunctionClass)) { + AbstractMemory* ptr; + Data_Get_Struct(proc, AbstractMemory, ptr); + return ptr->address; + } + + callback = rbffi_Function_ForProc(cbInfo, proc); + RB_GC_GUARD(callback); + + return ((AbstractMemory *) DATA_PTR(callback))->address; +} + + +void +rbffi_Call_Init(VALUE moduleFFI) +{ + id_to_ptr = rb_intern("to_ptr"); + id_to_native = rb_intern("to_native"); + id_map_symbol = rb_intern("__map_symbol"); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Call.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Call.h new file mode 100644 index 000000000..0b971f2d8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Call.h @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2009, Wayne Meissner + * Copyright (c) 2009, Luc Heinrich + * Copyright (c) 2009, Mike Dalessio + * Copyright (c) 2009, Aman Gupta. + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RBFFI_CALL_H +#define RBFFI_CALL_H + +#ifdef __cplusplus +extern "C" { +#endif + +#if defined(__i386__) && \ + (defined(HAVE_RAW_API) || defined(USE_INTERNAL_LIBFFI)) && \ + !defined(_WIN32) && !defined(__WIN32__) +# define USE_RAW +#endif + +#if (defined(__i386__) || defined(__x86_64__)) && !(defined(_WIN32) || defined(__WIN32__)) +# define BYPASS_FFI 1 +#endif + +typedef union { +#ifdef USE_RAW + signed int s8, s16, s32; + unsigned int u8, u16, u32; +#else + signed char s8; + unsigned char u8; + signed short s16; + unsigned short u16; + signed int s32; + unsigned int u32; +#endif + signed long long i64; + unsigned long long u64; + signed long sl; + unsigned long ul; + void* ptr; + float f32; + double f64; + long double ld; +} FFIStorage; + +extern void rbffi_Call_Init(VALUE moduleFFI); + +extern void rbffi_SetupCallParams(int argc, VALUE* argv, int paramCount, Type** paramTypes, + FFIStorage* paramStorage, void** ffiValues, + VALUE* callbackParameters, int callbackCount, VALUE enums); + +struct FunctionType_; +extern VALUE rbffi_CallFunction(int argc, VALUE* argv, void* function, struct FunctionType_* fnInfo); + +typedef VALUE (*Invoker)(int argc, VALUE* argv, void* function, struct FunctionType_* fnInfo); + +Invoker rbffi_GetInvoker(struct FunctionType_* fnInfo); + +extern VALUE rbffi_GetEnumValue(VALUE enums, VALUE value); +extern int rbffi_GetSignedIntValue(VALUE value, int type, int minValue, int maxValue, const char* typeName, VALUE enums); + +#ifdef __cplusplus +} +#endif + +#endif /* RBFFI_CALL_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Call.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Call.o new file mode 100644 index 000000000..8b0b00c51 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Call.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ClosurePool.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ClosurePool.c new file mode 100644 index 000000000..5499b40d4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ClosurePool.c @@ -0,0 +1,283 @@ +/* + * Copyright (c) 2009, 2010 Wayne Meissner + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MSC_VER +#include +#endif +#include +#if defined(__CYGWIN__) || !defined(_WIN32) +# include +#endif +#include +#ifndef _MSC_VER +# include +# include +#else +# include "win32/stdbool.h" +# include "win32/stdint.h" +#endif +#if defined(__CYGWIN__) || !defined(_WIN32) +# include +#else +# include +# define _WINSOCKAPI_ +# include +#endif +#include +#include + +#if defined(_MSC_VER) && !defined(INT8_MIN) +# include "win32/stdint.h" +#endif +#include +#include "rbffi.h" +#include "compat.h" + +#include "Function.h" +#include "Types.h" +#include "Type.h" +#include "LastError.h" +#include "Call.h" + +#include "ClosurePool.h" + + +#ifndef roundup +# define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) +#endif +#ifdef _WIN32 + typedef char* caddr_t; +#endif + +typedef struct Memory { + void* code; + void* data; + struct Memory* next; +} Memory; + +struct ClosurePool_ { + void* ctx; + int closureSize; + bool (*prep)(void* ctx, void *code, Closure* closure, char* errbuf, size_t errbufsize); + struct Memory* blocks; /* Keeps track of all the allocated memory for this pool */ + Closure* list; + long refcnt; +}; + +static long pageSize; + +static void* allocatePage(void); +static bool freePage(void *); +static bool protectPage(void *); + +ClosurePool* +rbffi_ClosurePool_New(int closureSize, + bool (*prep)(void* ctx, void *code, Closure* closure, char* errbuf, size_t errbufsize), + void* ctx) +{ + ClosurePool* pool; + + pool = xcalloc(1, sizeof(*pool)); + pool->closureSize = closureSize; + pool->ctx = ctx; + pool->prep = prep; + pool->refcnt = 1; + + return pool; +} + +void +cleanup_closure_pool(ClosurePool* pool) +{ + Memory* memory; + + for (memory = pool->blocks; memory != NULL; ) { + Memory* next = memory->next; + freePage(memory->code); + free(memory->data); + free(memory); + memory = next; + } + xfree(pool); +} + +void +rbffi_ClosurePool_Free(ClosurePool* pool) +{ + if (pool != NULL) { + long refcnt = --(pool->refcnt); + if (refcnt == 0) { + cleanup_closure_pool(pool); + } + } +} + +Closure* +rbffi_Closure_Alloc(ClosurePool* pool) +{ + Closure *list = NULL; + Memory* block = NULL; + caddr_t code = NULL; + char errmsg[256]; + int nclosures; + long trampolineSize; + int i; + + if (pool->list != NULL) { + Closure* closure = pool->list; + pool->list = pool->list->next; + pool->refcnt++; + + return closure; + } + + trampolineSize = roundup(pool->closureSize, 8); + nclosures = (int) (pageSize / trampolineSize); + block = calloc(1, sizeof(*block)); + list = calloc(nclosures, sizeof(*list)); + code = allocatePage(); + + if (block == NULL || list == NULL || code == NULL) { + snprintf(errmsg, sizeof(errmsg), "failed to allocate a page. errno=%d (%s)", errno, strerror(errno)); + goto error; + } + + for (i = 0; i < nclosures; ++i) { + Closure* closure = &list[i]; + closure->next = &list[i + 1]; + closure->pool = pool; + closure->code = (code + (i * trampolineSize)); + + if (!(*pool->prep)(pool->ctx, closure->code, closure, errmsg, sizeof(errmsg))) { + goto error; + } + } + + if (!protectPage(code)) { + goto error; + } + + /* Track the allocated page + Closure memory area */ + block->data = list; + block->code = code; + block->next = pool->blocks; + pool->blocks = block; + + /* Thread the new block onto the free list, apart from the first one. */ + list[nclosures - 1].next = pool->list; + pool->list = list->next; + pool->refcnt++; + + /* Use the first one as the new handle */ + return list; + +error: + free(block); + free(list); + if (code != NULL) { + freePage(code); + } + + + rb_raise(rb_eRuntimeError, "%s", errmsg); + return NULL; +} + +void +rbffi_Closure_Free(Closure* closure) +{ + if (closure != NULL) { + ClosurePool* pool = closure->pool; + long refcnt; + /* Just push it on the front of the free list */ + closure->next = pool->list; + pool->list = closure; + refcnt = --(pool->refcnt); + if (refcnt == 0) { + cleanup_closure_pool(pool); + } + } +} + +void* +rbffi_Closure_CodeAddress(Closure* handle) +{ + return handle->code; +} + + +static long +getPageSize() +{ +#if !defined(__CYGWIN__) && (defined(_WIN32) || defined(__WIN32__)) + SYSTEM_INFO si; + GetSystemInfo(&si); + return si.dwPageSize; +#else + return sysconf(_SC_PAGESIZE); +#endif +} + +static void* +allocatePage(void) +{ +#if !defined(__CYGWIN__) && (defined(_WIN32) || defined(__WIN32__)) + return VirtualAlloc(NULL, pageSize, MEM_COMMIT | MEM_RESERVE, PAGE_READWRITE); +#else + caddr_t page = mmap(NULL, pageSize, PROT_READ | PROT_WRITE, MAP_ANON | MAP_PRIVATE, -1, 0); + return (page != (caddr_t) -1) ? page : NULL; +#endif +} + +static bool +freePage(void *addr) +{ +#if !defined(__CYGWIN__) && (defined(_WIN32) || defined(__WIN32__)) + return VirtualFree(addr, 0, MEM_RELEASE); +#else + return munmap(addr, pageSize) == 0; +#endif +} + +static bool +protectPage(void* page) +{ +#if !defined(__CYGWIN__) && (defined(_WIN32) || defined(__WIN32__)) + DWORD oldProtect; + return VirtualProtect(page, pageSize, PAGE_EXECUTE_READ, &oldProtect); +#else + return mprotect(page, pageSize, PROT_READ | PROT_EXEC) == 0; +#endif +} + +void +rbffi_ClosurePool_Init(VALUE module) +{ + pageSize = getPageSize(); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ClosurePool.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ClosurePool.h new file mode 100644 index 000000000..b842375ae --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ClosurePool.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2009, 2010 Wayne Meissner + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RUBYFFI_CLOSUREPOOL_H +#define RUBYFFI_CLOSUREPOOL_H + +typedef struct ClosurePool_ ClosurePool; +typedef struct Closure_ Closure; + +struct Closure_ { + void* info; /* opaque handle for storing closure-instance specific data */ + void* function; /* closure-instance specific function, called by custom trampoline */ + void* code; /* The native trampoline code location */ + struct ClosurePool_* pool; + Closure* next; +}; + +void rbffi_ClosurePool_Init(VALUE module); + +ClosurePool* rbffi_ClosurePool_New(int closureSize, + bool (*prep)(void* ctx, void *code, Closure* closure, char* errbuf, size_t errbufsize), + void* ctx); + +void rbffi_ClosurePool_Free(ClosurePool *); + +Closure* rbffi_Closure_Alloc(ClosurePool *); +void rbffi_Closure_Free(Closure *); + +void* rbffi_Closure_GetCodeAddress(Closure *); + +#endif /* RUBYFFI_CLOSUREPOOL_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ClosurePool.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ClosurePool.o new file mode 100644 index 000000000..c41acba25 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ClosurePool.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/DataConverter.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/DataConverter.c new file mode 100644 index 000000000..2d5b82743 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/DataConverter.c @@ -0,0 +1,91 @@ + +#include + +#include +#include "rbffi.h" + +#include "Type.h" +#include "MappedType.h" + + +VALUE rbffi_DataConverterClass = Qnil; +static ID id_native_type_ivar; + +/* + * Get native type. + * @overload native_type(type) + * @param [String, Symbol, Type] type + * @return [Type] + * Get native type from +type+. + * @overload native_type + * @raise {NotImplementedError} This method must be overriden. + */ +static VALUE +conv_native_type(int argc, VALUE* argv, VALUE self) +{ + if (argc == 0) { + if (!rb_ivar_defined(self, id_native_type_ivar)) { + rb_raise(rb_eNotImpError, "native_type method not overridden and no native_type set"); + } + + return rb_ivar_get(self, id_native_type_ivar); + + } else if (argc == 1) { + VALUE type = rbffi_Type_Find(argv[0]); + + rb_ivar_set(self, id_native_type_ivar, type); + + return type; + + } else { + rb_raise(rb_eArgError, "incorrect arguments"); + } +} + +/* + * call-seq: to_native(value, ctx) + * @param value + * @param ctx + * @return [value] + * Convert to a native type. + */ +static VALUE +conv_to_native(VALUE self, VALUE value, VALUE ctx) +{ + return value; +} + +/* + * call-seq: from_native(value, ctx) + * @param value + * @param ctx + * @return [value] + * Convert from a native type. + */ +static VALUE +conv_from_native(VALUE self, VALUE value, VALUE ctx) +{ + return value; +} + + + +void +rbffi_DataConverter_Init(VALUE moduleFFI) +{ + /* + * Document-module: FFI::DataConverter + * This module is used to extend somes classes and give then a common API. + * + * Most of methods defined here must be overriden. + */ + rbffi_DataConverterClass = rb_define_module_under(moduleFFI, "DataConverter"); + + rb_define_method(rbffi_DataConverterClass, "native_type", conv_native_type, -1); + rb_define_method(rbffi_DataConverterClass, "to_native", conv_to_native, 2); + rb_define_method(rbffi_DataConverterClass, "from_native", conv_from_native, 2); + + id_native_type_ivar = rb_intern("@native_type"); +} + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/DataConverter.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/DataConverter.o new file mode 100644 index 000000000..f9e2474b8 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/DataConverter.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/DynamicLibrary.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/DynamicLibrary.c new file mode 100644 index 000000000..905d02059 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/DynamicLibrary.c @@ -0,0 +1,337 @@ +/* + * Copyright (c) 2008-2010 Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#ifndef _MSC_VER +# include +#endif +#if (defined(_WIN32) || defined(__WIN32__)) && !defined(__CYGWIN__) +# include +# define _WINSOCKAPI_ +# include +#else +# include +#endif +#include +#if defined(_MSC_VER) && !defined(INT8_MIN) +# include "win32/stdint.h" +#endif + +#include + +#include "rbffi.h" +#include "compat.h" +#include "AbstractMemory.h" +#include "Pointer.h" +#include "DynamicLibrary.h" + +typedef struct LibrarySymbol_ { + Pointer base; + VALUE library; + VALUE name; +} LibrarySymbol; + +static VALUE library_initialize(VALUE self, VALUE libname, VALUE libflags); +static void library_free(Library* lib); + + +static VALUE symbol_allocate(VALUE klass); +static VALUE symbol_new(VALUE library, void* address, VALUE name); +static void symbol_mark(LibrarySymbol* sym); + +static VALUE LibraryClass = Qnil, SymbolClass = Qnil; + +#if (defined(_WIN32) || defined(__WIN32__)) && !defined(__CYGWIN__) +static void* dl_open(const char* name, int flags); +static void dl_error(char* buf, int size); +#define dl_sym(handle, name) GetProcAddress(handle, name) +#define dl_close(handle) FreeLibrary(handle) +#else +# define dl_open(name, flags) dlopen(name, flags != 0 ? flags : RTLD_LAZY) +# define dl_error(buf, size) do { snprintf(buf, size, "%s", dlerror()); } while(0) +# define dl_sym(handle, name) dlsym(handle, name) +# define dl_close(handle) dlclose(handle) +#endif + +static VALUE +library_allocate(VALUE klass) +{ + Library* library; + return Data_Make_Struct(klass, Library, NULL, library_free, library); +} + +/* + * call-seq: DynamicLibrary.open(libname, libflags) + * @param libname (see #initialize) + * @param libflags (see #initialize) + * @return [FFI::DynamicLibrary] + * @raise {LoadError} if +libname+ cannot be opened + * Open a library. + */ +static VALUE +library_open(VALUE klass, VALUE libname, VALUE libflags) +{ + return library_initialize(library_allocate(klass), libname, libflags); +} + +/* + * call-seq: initialize(libname, libflags) + * @param [String] libname name of library to open + * @param [Fixnum] libflags flags for library to open + * @return [FFI::DynamicLibrary] + * @raise {LoadError} if +libname+ cannot be opened + * A new DynamicLibrary instance. + */ +static VALUE +library_initialize(VALUE self, VALUE libname, VALUE libflags) +{ + Library* library; + int flags; + + Check_Type(libflags, T_FIXNUM); + + Data_Get_Struct(self, Library, library); + flags = libflags != Qnil ? NUM2UINT(libflags) : 0; + + library->handle = dl_open(libname != Qnil ? StringValueCStr(libname) : NULL, flags); + if (library->handle == NULL) { + char errmsg[1024]; + dl_error(errmsg, sizeof(errmsg)); + rb_raise(rb_eLoadError, "Could not open library '%s': %s", + libname != Qnil ? StringValueCStr(libname) : "[current process]", + errmsg); + } +#ifdef __CYGWIN__ + // On Cygwin 1.7.17 "dlsym(dlopen(0,0), 'getpid')" fails. (dlerror: "No such process") + // As a workaround we can use "dlsym(RTLD_DEFAULT, 'getpid')" instead. + // Since 0 == RTLD_DEFAULT we won't call dl_close later. + if (libname == Qnil) { + dl_close(library->handle); + library->handle = RTLD_DEFAULT; + } +#endif + rb_iv_set(self, "@name", libname != Qnil ? libname : rb_str_new2("[current process]")); + return self; +} + +static VALUE +library_dlsym(VALUE self, VALUE name) +{ + Library* library; + void* address = NULL; + Check_Type(name, T_STRING); + + Data_Get_Struct(self, Library, library); + address = dl_sym(library->handle, StringValueCStr(name)); + + return address != NULL ? symbol_new(self, address, name) : Qnil; +} + +/* + * call-seq: last_error + * @return [String] library's last error string + */ +static VALUE +library_dlerror(VALUE self) +{ + char errmsg[1024]; + dl_error(errmsg, sizeof(errmsg)); + return rb_tainted_str_new2(errmsg); +} + +static void +library_free(Library* library) +{ + /* dlclose() on MacOS tends to segfault - avoid it */ +#ifndef __APPLE__ + if (library->handle != NULL) { + dl_close(library->handle); + } +#endif + xfree(library); +} + +#if (defined(_WIN32) || defined(__WIN32__)) && !defined(__CYGWIN__) +static void* +dl_open(const char* name, int flags) +{ + if (name == NULL) { + return GetModuleHandle(NULL); + } else { + return LoadLibraryExA(name, NULL, LOAD_WITH_ALTERED_SEARCH_PATH); + } +} + +static void +dl_error(char* buf, int size) +{ + FormatMessageA(FORMAT_MESSAGE_FROM_SYSTEM, NULL, GetLastError(), + 0, buf, size, NULL); +} +#endif + +static VALUE +symbol_allocate(VALUE klass) +{ + LibrarySymbol* sym; + VALUE obj = Data_Make_Struct(klass, LibrarySymbol, NULL, -1, sym); + sym->name = Qnil; + sym->library = Qnil; + sym->base.rbParent = Qnil; + + return obj; +} + + +/* + * call-seq: initialize_copy(other) + * @param [Object] other + * @return [nil] + * DO NOT CALL THIS METHOD + */ +static VALUE +symbol_initialize_copy(VALUE self, VALUE other) +{ + rb_raise(rb_eRuntimeError, "cannot duplicate symbol"); + return Qnil; +} + +static VALUE +symbol_new(VALUE library, void* address, VALUE name) +{ + LibrarySymbol* sym; + VALUE obj = Data_Make_Struct(SymbolClass, LibrarySymbol, symbol_mark, -1, sym); + + sym->base.memory.address = address; + sym->base.memory.size = LONG_MAX; + sym->base.memory.typeSize = 1; + sym->base.memory.flags = MEM_RD | MEM_WR; + sym->library = library; + sym->name = name; + + return obj; +} + +static void +symbol_mark(LibrarySymbol* sym) +{ + rb_gc_mark(sym->library); + rb_gc_mark(sym->name); +} + +/* + * call-seq: inspect + * @return [String] + * Inspect. + */ +static VALUE +symbol_inspect(VALUE self) +{ + LibrarySymbol* sym; + char buf[256]; + + Data_Get_Struct(self, LibrarySymbol, sym); + snprintf(buf, sizeof(buf), "#", + StringValueCStr(sym->name), sym->base.memory.address); + return rb_str_new2(buf); +} + +void +rbffi_DynamicLibrary_Init(VALUE moduleFFI) +{ + /* + * Document-class: FFI::DynamicLibrary + */ + LibraryClass = rb_define_class_under(moduleFFI, "DynamicLibrary", rb_cObject); + rb_global_variable(&LibraryClass); + /* + * Document-class: FFI::DynamicLibrary::Symbol < FFI::Pointer + * + * An instance of this class represents a library symbol. It may be a {Pointer pointer} to + * a function or to a variable. + */ + SymbolClass = rb_define_class_under(LibraryClass, "Symbol", rbffi_PointerClass); + rb_global_variable(&SymbolClass); + + /* + * Document-const: FFI::NativeLibrary + * Backward compatibility for FFI::DynamicLibrary + */ + rb_define_const(moduleFFI, "NativeLibrary", LibraryClass); /* backwards compat library */ + rb_define_alloc_func(LibraryClass, library_allocate); + rb_define_singleton_method(LibraryClass, "open", library_open, 2); + rb_define_singleton_method(LibraryClass, "last_error", library_dlerror, 0); + rb_define_method(LibraryClass, "initialize", library_initialize, 2); + /* + * Document-method: find_symbol + * call-seq: find_symbol(name) + * @param [String] name library symbol's name + * @return [FFI::DynamicLibrary::Symbol] library symbol + */ + rb_define_method(LibraryClass, "find_symbol", library_dlsym, 1); + /* + * Document-method: find_function + * call-seq: find_function(name) + * @param [String] name library function's name + * @return [FFI::DynamicLibrary::Symbol] library function symbol + */ + rb_define_method(LibraryClass, "find_function", library_dlsym, 1); + /* + * Document-method: find_variable + * call-seq: find_variable(name) + * @param [String] name library variable's name + * @return [FFI::DynamicLibrary::Symbol] library variable symbol + */ + rb_define_method(LibraryClass, "find_variable", library_dlsym, 1); + rb_define_method(LibraryClass, "last_error", library_dlerror, 0); + rb_define_attr(LibraryClass, "name", 1, 0); + + rb_define_alloc_func(SymbolClass, symbol_allocate); + rb_undef_method(SymbolClass, "new"); + rb_define_method(SymbolClass, "inspect", symbol_inspect, 0); + rb_define_method(SymbolClass, "initialize_copy", symbol_initialize_copy, 1); + +#define DEF(x) rb_define_const(LibraryClass, "RTLD_" #x, UINT2NUM(RTLD_##x)) + DEF(LAZY); + DEF(NOW); + DEF(GLOBAL); + DEF(LOCAL); + DEF(NOLOAD); + DEF(NODELETE); + DEF(FIRST); + DEF(DEEPBIND); + DEF(MEMBER); + DEF(BINDING_MASK); + DEF(LOCATION_MASK); + DEF(ALL_MASK); +#undef DEF + +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/DynamicLibrary.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/DynamicLibrary.h new file mode 100644 index 000000000..97bf7bce6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/DynamicLibrary.h @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2008-2010 Wayne Meissner + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _LIBRARY_H +#define _LIBRARY_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* if these aren't defined (eg. windows), we need sensible defaults */ +#ifndef RTLD_LAZY +#define RTLD_LAZY 1 +#endif + +#ifndef RTLD_NOW +#define RTLD_NOW 2 +#endif + +#ifndef RTLD_LOCAL +#define RTLD_LOCAL 4 +#endif + +#ifndef RTLD_GLOBAL +#define RTLD_GLOBAL 8 +#endif + +/* If these aren't defined, they're not supported so define as 0 */ +#ifndef RTLD_NOLOAD +#define RTLD_NOLOAD 0 +#endif + +#ifndef RTLD_NODELETE +#define RTLD_NODELETE 0 +#endif + +#ifndef RTLD_FIRST +#define RTLD_FIRST 0 +#endif + +#ifndef RTLD_DEEPBIND +#define RTLD_DEEPBIND 0 +#endif + +#ifndef RTLD_MEMBER +#define RTLD_MEMBER 0 +#endif + +/* convenience */ +#ifndef RTLD_BINDING_MASK +#define RTLD_BINDING_MASK (RTLD_LAZY | RTLD_NOW) +#endif + +#ifndef RTLD_LOCATION_MASK +#define RTLD_LOCATION_MASK (RTLD_LOCAL | RTLD_GLOBAL) +#endif + +#ifndef RTLD_ALL_MASK +#define RTLD_ALL_MASK (RTLD_BINDING_MASK | RTLD_LOCATION_MASK | RTLD_NOLOAD | RTLD_NODELETE | RTLD_FIRST | RTLD_DEEPBIND | RTLD_MEMBER) +#endif + +typedef struct Library { + void* handle; +} Library; + +extern void rbffi_DynamicLibrary_Init(VALUE ffiModule); + +#ifdef __cplusplus +} +#endif + +#endif /* _LIBRARY_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/DynamicLibrary.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/DynamicLibrary.o new file mode 100644 index 000000000..312c5c909 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/DynamicLibrary.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Function.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Function.c new file mode 100644 index 000000000..a18b1b381 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Function.c @@ -0,0 +1,1000 @@ +/* + * Copyright (c) 2009-2011 Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MSC_VER +#include +#endif +#include +#ifndef _WIN32 +# include +# include +#endif + +#include +#ifndef _MSC_VER +# include +# include +#else +# include "win32/stdbool.h" +# if !defined(INT8_MIN) +# include "win32/stdint.h" +# endif +#endif +#include + +#include +#if defined(HAVE_NATIVETHREAD) && !defined(_WIN32) +#include +#endif +#include + +#include "rbffi.h" +#include "compat.h" + +#include "AbstractMemory.h" +#include "Pointer.h" +#include "Struct.h" +#include "Platform.h" +#include "Type.h" +#include "LastError.h" +#include "Call.h" +#include "ClosurePool.h" +#include "MappedType.h" +#include "Thread.h" +#include "LongDouble.h" +#include "MethodHandle.h" +#include "Function.h" + +typedef struct Function_ { + Pointer base; + FunctionType* info; + MethodHandle* methodHandle; + bool autorelease; + Closure* closure; + VALUE rbProc; + VALUE rbFunctionInfo; +} Function; + +static void function_mark(Function *); +static void function_free(Function *); +static VALUE function_init(VALUE self, VALUE rbFunctionInfo, VALUE rbProc); +static void callback_invoke(ffi_cif* cif, void* retval, void** parameters, void* user_data); +static bool callback_prep(void* ctx, void* code, Closure* closure, char* errmsg, size_t errmsgsize); +static void* callback_with_gvl(void* data); +static VALUE invoke_callback(void* data); +static VALUE save_callback_exception(void* data, VALUE exc); + +#define DEFER_ASYNC_CALLBACK 1 + + +#if defined(DEFER_ASYNC_CALLBACK) +static VALUE async_cb_event(void *); +static VALUE async_cb_call(void *); +#endif + +#ifdef HAVE_RB_THREAD_CALL_WITH_GVL +extern void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1); +#endif + +VALUE rbffi_FunctionClass = Qnil; + +#if defined(DEFER_ASYNC_CALLBACK) +static VALUE async_cb_thread = Qnil; +#endif + +static ID id_call = 0, id_to_native = 0, id_from_native = 0, id_cbtable = 0, id_cb_ref = 0; + +struct gvl_callback { + Closure* closure; + void* retval; + void** parameters; + bool done; + rbffi_frame_t *frame; +#if defined(DEFER_ASYNC_CALLBACK) + struct gvl_callback* next; +# ifndef _WIN32 + pthread_cond_t async_cond; + pthread_mutex_t async_mutex; +# else + HANDLE async_event; +# endif +#endif +}; + + +#if defined(DEFER_ASYNC_CALLBACK) +static struct gvl_callback* async_cb_list = NULL; +# ifndef _WIN32 + static pthread_mutex_t async_cb_mutex = PTHREAD_MUTEX_INITIALIZER; + static pthread_cond_t async_cb_cond = PTHREAD_COND_INITIALIZER; +# if !(defined(HAVE_RB_THREAD_BLOCKING_REGION) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)) + static int async_cb_pipe[2]; +# endif +# else + static HANDLE async_cb_cond; + static CRITICAL_SECTION async_cb_lock; +# if !(defined(HAVE_RB_THREAD_BLOCKING_REGION) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)) + static int async_cb_pipe[2]; +# endif +# endif +#endif + + +static VALUE +function_allocate(VALUE klass) +{ + Function *fn; + VALUE obj; + + obj = Data_Make_Struct(klass, Function, function_mark, function_free, fn); + + fn->base.memory.flags = MEM_RD; + fn->base.rbParent = Qnil; + fn->rbProc = Qnil; + fn->rbFunctionInfo = Qnil; + fn->autorelease = true; + + return obj; +} + +static void +function_mark(Function *fn) +{ + rb_gc_mark(fn->base.rbParent); + rb_gc_mark(fn->rbProc); + rb_gc_mark(fn->rbFunctionInfo); +} + +static void +function_free(Function *fn) +{ + if (fn->methodHandle != NULL) { + rbffi_MethodHandle_Free(fn->methodHandle); + } + + if (fn->closure != NULL && fn->autorelease) { + rbffi_Closure_Free(fn->closure); + } + + xfree(fn); +} + +/* + * @param [Type, Symbol] return_type return type for the function + * @param [Array] param_types array of parameters types + * @param [Hash] options see {FFI::FunctionType} for available options + * @return [self] + * A new Function instance. + * + * Define a function from a Proc or a block. + * + * @overload initialize(return_type, param_types, options = {}) { |i| ... } + * @yieldparam i parameters for the function + * @overload initialize(return_type, param_types, proc, options = {}) + * @param [Proc] proc + */ +static VALUE +function_initialize(int argc, VALUE* argv, VALUE self) +{ + + VALUE rbReturnType = Qnil, rbParamTypes = Qnil, rbProc = Qnil, rbOptions = Qnil; + VALUE rbFunctionInfo = Qnil; + VALUE infoArgv[3]; + int nargs; + + nargs = rb_scan_args(argc, argv, "22", &rbReturnType, &rbParamTypes, &rbProc, &rbOptions); + + /* + * Callback with block, + * e.g. Function.new(:int, [ :int ]) { |i| blah } + * or Function.new(:int, [ :int ], { :convention => :stdcall }) { |i| blah } + */ + if (rb_block_given_p()) { + if (nargs > 3) { + rb_raise(rb_eArgError, "cannot create function with both proc/address and block"); + } + rbOptions = rbProc; + rbProc = rb_block_proc(); + } else { + /* Callback with proc, or Function with address + * e.g. Function.new(:int, [ :int ], Proc.new { |i| }) + * Function.new(:int, [ :int ], Proc.new { |i| }, { :convention => :stdcall }) + * Function.new(:int, [ :int ], addr) + * Function.new(:int, [ :int ], addr, { :convention => :stdcall }) + */ + } + + infoArgv[0] = rbReturnType; + infoArgv[1] = rbParamTypes; + infoArgv[2] = rbOptions; + rbFunctionInfo = rb_class_new_instance(rbOptions != Qnil ? 3 : 2, infoArgv, rbffi_FunctionTypeClass); + + function_init(self, rbFunctionInfo, rbProc); + + return self; +} + +/* + * call-seq: initialize_copy(other) + * @return [nil] + * DO NOT CALL THIS METHOD + */ +static VALUE +function_initialize_copy(VALUE self, VALUE other) +{ + rb_raise(rb_eRuntimeError, "cannot duplicate function instances"); + return Qnil; +} + +VALUE +rbffi_Function_NewInstance(VALUE rbFunctionInfo, VALUE rbProc) +{ + return function_init(function_allocate(rbffi_FunctionClass), rbFunctionInfo, rbProc); +} + +VALUE +rbffi_Function_ForProc(VALUE rbFunctionInfo, VALUE proc) +{ + VALUE callback, cbref, cbTable; + Function* fp; + + cbref = RTEST(rb_ivar_defined(proc, id_cb_ref)) ? rb_ivar_get(proc, id_cb_ref) : Qnil; + /* If the first callback reference has the same function function signature, use it */ + if (cbref != Qnil && CLASS_OF(cbref) == rbffi_FunctionClass) { + Data_Get_Struct(cbref, Function, fp); + if (fp->rbFunctionInfo == rbFunctionInfo) { + return cbref; + } + } + + cbTable = RTEST(rb_ivar_defined(proc, id_cbtable)) ? rb_ivar_get(proc, id_cbtable) : Qnil; + if (cbTable != Qnil && (callback = rb_hash_aref(cbTable, rbFunctionInfo)) != Qnil) { + return callback; + } + + /* No existing function for the proc with that signature, create a new one and cache it */ + callback = rbffi_Function_NewInstance(rbFunctionInfo, proc); + if (cbref == Qnil) { + /* If there is no other cb already cached for this proc, we can use the ivar slot */ + rb_ivar_set(proc, id_cb_ref, callback); + } else { + /* The proc instance has been used as more than one type of callback, store extras in a hash */ + cbTable = rb_hash_new(); + rb_ivar_set(proc, id_cbtable, cbTable); + rb_hash_aset(cbTable, rbFunctionInfo, callback); + } + + return callback; +} + +static VALUE +function_init(VALUE self, VALUE rbFunctionInfo, VALUE rbProc) +{ + Function* fn = NULL; + + Data_Get_Struct(self, Function, fn); + + fn->rbFunctionInfo = rbFunctionInfo; + + Data_Get_Struct(fn->rbFunctionInfo, FunctionType, fn->info); + + if (rb_obj_is_kind_of(rbProc, rbffi_PointerClass)) { + Pointer* orig; + Data_Get_Struct(rbProc, Pointer, orig); + fn->base.memory = orig->memory; + fn->base.rbParent = rbProc; + + } else if (rb_obj_is_kind_of(rbProc, rb_cProc) || rb_respond_to(rbProc, id_call)) { + if (fn->info->closurePool == NULL) { + fn->info->closurePool = rbffi_ClosurePool_New(sizeof(ffi_closure), callback_prep, fn->info); + if (fn->info->closurePool == NULL) { + rb_raise(rb_eNoMemError, "failed to create closure pool"); + } + } + +#if defined(DEFER_ASYNC_CALLBACK) + if (async_cb_thread == Qnil) { +#if !(defined(HAVE_RB_THREAD_BLOCKING_REGION) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)) && defined(_WIN32) + _pipe(async_cb_pipe, 1024, O_BINARY); +#elif !(defined(HAVE_RB_THREAD_BLOCKING_REGION) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)) + pipe(async_cb_pipe); + fcntl(async_cb_pipe[0], F_SETFL, fcntl(async_cb_pipe[0], F_GETFL) | O_NONBLOCK); + fcntl(async_cb_pipe[1], F_SETFL, fcntl(async_cb_pipe[1], F_GETFL) | O_NONBLOCK); +#endif + async_cb_thread = rb_thread_create(async_cb_event, NULL); + } + +#endif + + fn->closure = rbffi_Closure_Alloc(fn->info->closurePool); + fn->closure->info = fn; + fn->base.memory.address = fn->closure->code; + fn->base.memory.size = sizeof(*fn->closure); + fn->autorelease = true; + + } else { + rb_raise(rb_eTypeError, "wrong argument type %s, expected pointer or proc", + rb_obj_classname(rbProc)); + } + + fn->rbProc = rbProc; + + return self; +} + +/* + * call-seq: call(*args) + * @param [Array] args function arguments + * @return [FFI::Type] + * Call the function + */ +static VALUE +function_call(int argc, VALUE* argv, VALUE self) +{ + Function* fn; + + Data_Get_Struct(self, Function, fn); + + return (*fn->info->invoke)(argc, argv, fn->base.memory.address, fn->info); +} + +/* + * call-seq: attach(m, name) + * @param [Module] m + * @param [String] name + * @return [self] + * Attach a Function to the Module +m+ as +name+. + */ +static VALUE +function_attach(VALUE self, VALUE module, VALUE name) +{ + Function* fn; + char var[1024]; + + Data_Get_Struct(self, Function, fn); + + if (fn->info->parameterCount == -1) { + rb_raise(rb_eRuntimeError, "cannot attach variadic functions"); + return Qnil; + } + + if (!rb_obj_is_kind_of(module, rb_cModule)) { + rb_raise(rb_eRuntimeError, "trying to attach function to non-module"); + return Qnil; + } + + if (fn->methodHandle == NULL) { + fn->methodHandle = rbffi_MethodHandle_Alloc(fn->info, fn->base.memory.address); + } + + /* + * Stash the Function in a module variable so it does not get garbage collected + */ + snprintf(var, sizeof(var), "@@%s", StringValueCStr(name)); + rb_cv_set(module, var, self); + + rb_define_singleton_method(module, StringValueCStr(name), + rbffi_MethodHandle_CodeAddress(fn->methodHandle), -1); + + + rb_define_method(module, StringValueCStr(name), + rbffi_MethodHandle_CodeAddress(fn->methodHandle), -1); + + return self; +} + +/* + * call-seq: autorelease = autorelease + * @param [Boolean] autorelease + * @return [self] + * Set +autorelease+ attribute (See {Pointer}). + */ +static VALUE +function_set_autorelease(VALUE self, VALUE autorelease) +{ + Function* fn; + + Data_Get_Struct(self, Function, fn); + + fn->autorelease = RTEST(autorelease); + + return self; +} + +static VALUE +function_autorelease_p(VALUE self) +{ + Function* fn; + + Data_Get_Struct(self, Function, fn); + + return fn->autorelease ? Qtrue : Qfalse; +} + +/* + * call-seq: free + * @return [self] + * Free memory allocated by Function. + */ +static VALUE +function_release(VALUE self) +{ + Function* fn; + + Data_Get_Struct(self, Function, fn); + + if (fn->closure == NULL) { + rb_raise(rb_eRuntimeError, "cannot free function which was not allocated"); + } + + rbffi_Closure_Free(fn->closure); + fn->closure = NULL; + + return self; +} + +static void +callback_invoke(ffi_cif* cif, void* retval, void** parameters, void* user_data) +{ + struct gvl_callback cb = { 0 }; + + cb.closure = (Closure *) user_data; + cb.retval = retval; + cb.parameters = parameters; + cb.done = false; + cb.frame = rbffi_frame_current(); + + if (cb.frame != NULL) cb.frame->exc = Qnil; + if (cb.frame != NULL && cb.frame->has_gvl) { + callback_with_gvl(&cb); + +#if defined(HAVE_RB_THREAD_CALL_WITH_GVL) + } else if (cb.frame != NULL) { + rb_thread_call_with_gvl(callback_with_gvl, &cb); +#endif +#if defined(DEFER_ASYNC_CALLBACK) && !defined(_WIN32) + } else { + bool empty = false; + + pthread_mutex_init(&cb.async_mutex, NULL); + pthread_cond_init(&cb.async_cond, NULL); + + /* Now signal the async callback thread */ + pthread_mutex_lock(&async_cb_mutex); + empty = async_cb_list == NULL; + cb.next = async_cb_list; + async_cb_list = &cb; + +#if !(defined(HAVE_RB_THREAD_BLOCKING_REGION) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)) + pthread_mutex_unlock(&async_cb_mutex); + /* Only signal if the list was empty */ + if (empty) { + char c; + write(async_cb_pipe[1], &c, 1); + } +#else + pthread_cond_signal(&async_cb_cond); + pthread_mutex_unlock(&async_cb_mutex); +#endif + + /* Wait for the thread executing the ruby callback to signal it is done */ + pthread_mutex_lock(&cb.async_mutex); + while (!cb.done) { + pthread_cond_wait(&cb.async_cond, &cb.async_mutex); + } + pthread_mutex_unlock(&cb.async_mutex); + pthread_cond_destroy(&cb.async_cond); + pthread_mutex_destroy(&cb.async_mutex); + +#elif defined(DEFER_ASYNC_CALLBACK) && defined(_WIN32) + } else { + bool empty = false; + + cb.async_event = CreateEvent(NULL, FALSE, FALSE, NULL); + + /* Now signal the async callback thread */ + EnterCriticalSection(&async_cb_lock); + empty = async_cb_list == NULL; + cb.next = async_cb_list; + async_cb_list = &cb; + LeaveCriticalSection(&async_cb_lock); + +#if !(defined(HAVE_RB_THREAD_BLOCKING_REGION) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)) + /* Only signal if the list was empty */ + if (empty) { + char c; + write(async_cb_pipe[1], &c, 1); + } +#else + SetEvent(async_cb_cond); +#endif + + /* Wait for the thread executing the ruby callback to signal it is done */ + WaitForSingleObject(cb.async_event, INFINITE); + CloseHandle(cb.async_event); +#endif + } +} + +#if defined(DEFER_ASYNC_CALLBACK) +struct async_wait { + void* cb; + bool stop; +}; + +static VALUE async_cb_wait(void *); +static void async_cb_stop(void *); + +#if defined(HAVE_RB_THREAD_BLOCKING_REGION) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) +static VALUE +async_cb_event(void* unused) +{ + struct async_wait w = { 0 }; + + w.stop = false; + while (!w.stop) { +#if defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL) + rb_thread_call_without_gvl(async_cb_wait, &w, async_cb_stop, &w); +#else + rb_thread_blocking_region(async_cb_wait, &w, async_cb_stop, &w); +#endif + if (w.cb != NULL) { + /* Start up a new ruby thread to run the ruby callback */ + rb_thread_create(async_cb_call, w.cb); + } + } + + return Qnil; +} + +#elif defined(_WIN32) +static VALUE +async_cb_event(void* unused) +{ + while (true) { + struct gvl_callback* cb; + char buf[64]; + fd_set rfds; + + FD_ZERO(&rfds); + FD_SET(async_cb_pipe[0], &rfds); + rb_thread_select(async_cb_pipe[0] + 1, &rfds, NULL, NULL, NULL); + read(async_cb_pipe[0], buf, sizeof(buf)); + + EnterCriticalSection(&async_cb_lock); + cb = async_cb_list; + async_cb_list = NULL; + LeaveCriticalSection(&async_cb_lock); + + while (cb != NULL) { + struct gvl_callback* next = cb->next; + /* Start up a new ruby thread to run the ruby callback */ + rb_thread_create(async_cb_call, cb); + cb = next; + } + } + + return Qnil; +} +#else +static VALUE +async_cb_event(void* unused) +{ + while (true) { + struct gvl_callback* cb; + char buf[64]; + + if (read(async_cb_pipe[0], buf, sizeof(buf)) < 0) { + rb_thread_wait_fd(async_cb_pipe[0]); + while (read(async_cb_pipe[0], buf, sizeof (buf)) < 0) { + if (rb_io_wait_readable(async_cb_pipe[0]) != Qtrue) { + return Qfalse; + } + } + } + + pthread_mutex_lock(&async_cb_mutex); + cb = async_cb_list; + async_cb_list = NULL; + pthread_mutex_unlock(&async_cb_mutex); + + while (cb != NULL) { + struct gvl_callback* next = cb->next; + /* Start up a new ruby thread to run the ruby callback */ + rb_thread_create(async_cb_call, cb); + cb = next; + } + } + + return Qnil; +} +#endif + +#ifdef _WIN32 +static VALUE +async_cb_wait(void *data) +{ + struct async_wait* w = (struct async_wait *) data; + + w->cb = NULL; + + EnterCriticalSection(&async_cb_lock); + + while (!w->stop && async_cb_list == NULL) { + LeaveCriticalSection(&async_cb_lock); + WaitForSingleObject(async_cb_cond, INFINITE); + EnterCriticalSection(&async_cb_lock); + } + + if (async_cb_list != NULL) { + w->cb = async_cb_list; + async_cb_list = async_cb_list->next; + } + + LeaveCriticalSection(&async_cb_lock); + + return Qnil; +} + +static void +async_cb_stop(void *data) +{ + struct async_wait* w = (struct async_wait *) data; + + EnterCriticalSection(&async_cb_lock); + w->stop = true; + LeaveCriticalSection(&async_cb_lock); + SetEvent(async_cb_cond); +} + +#else +static VALUE +async_cb_wait(void *data) +{ + struct async_wait* w = (struct async_wait *) data; + + w->cb = NULL; + + pthread_mutex_lock(&async_cb_mutex); + + while (!w->stop && async_cb_list == NULL) { + pthread_cond_wait(&async_cb_cond, &async_cb_mutex); + } + + if (async_cb_list != NULL) { + w->cb = async_cb_list; + async_cb_list = async_cb_list->next; + } + + pthread_mutex_unlock(&async_cb_mutex); + + return Qnil; +} + +static void +async_cb_stop(void *data) +{ + struct async_wait* w = (struct async_wait *) data; + + pthread_mutex_lock(&async_cb_mutex); + w->stop = true; + pthread_cond_signal(&async_cb_cond); + pthread_mutex_unlock(&async_cb_mutex); +} +#endif + +static VALUE +async_cb_call(void *data) +{ + struct gvl_callback* cb = (struct gvl_callback *) data; + + callback_with_gvl(data); + + /* Signal the original native thread that the ruby code has completed */ +#ifdef _WIN32 + SetEvent(cb->async_event); +#else + pthread_mutex_lock(&cb->async_mutex); + cb->done = true; + pthread_cond_signal(&cb->async_cond); + pthread_mutex_unlock(&cb->async_mutex); +#endif + + return Qnil; +} + +#endif + +static void * +callback_with_gvl(void* data) +{ + rb_rescue2(invoke_callback, (VALUE) data, save_callback_exception, (VALUE) data, rb_eException, (VALUE) 0); + return NULL; +} + +static VALUE +invoke_callback(void* data) +{ + struct gvl_callback* cb = (struct gvl_callback *) data; + + Function* fn = (Function *) cb->closure->info; + FunctionType *cbInfo = fn->info; + Type* returnType = cbInfo->returnType; + void* retval = cb->retval; + void** parameters = cb->parameters; + VALUE* rbParams; + VALUE rbReturnType = cbInfo->rbReturnType; + VALUE rbReturnValue; + int i; + + rbParams = ALLOCA_N(VALUE, cbInfo->parameterCount); + for (i = 0; i < cbInfo->parameterCount; ++i) { + VALUE param; + Type* paramType = cbInfo->parameterTypes[i]; + VALUE rbParamType = rb_ary_entry(cbInfo->rbParameterTypes, i); + + if (unlikely(paramType->nativeType == NATIVE_MAPPED)) { + rbParamType = ((MappedType *) paramType)->rbType; + paramType = ((MappedType *) paramType)->type; + } + + switch (paramType->nativeType) { + case NATIVE_INT8: + param = INT2NUM(*(int8_t *) parameters[i]); + break; + case NATIVE_UINT8: + param = UINT2NUM(*(uint8_t *) parameters[i]); + break; + case NATIVE_INT16: + param = INT2NUM(*(int16_t *) parameters[i]); + break; + case NATIVE_UINT16: + param = UINT2NUM(*(uint16_t *) parameters[i]); + break; + case NATIVE_INT32: + param = INT2NUM(*(int32_t *) parameters[i]); + break; + case NATIVE_UINT32: + param = UINT2NUM(*(uint32_t *) parameters[i]); + break; + case NATIVE_INT64: + param = LL2NUM(*(int64_t *) parameters[i]); + break; + case NATIVE_UINT64: + param = ULL2NUM(*(uint64_t *) parameters[i]); + break; + case NATIVE_LONG: + param = LONG2NUM(*(long *) parameters[i]); + break; + case NATIVE_ULONG: + param = ULONG2NUM(*(unsigned long *) parameters[i]); + break; + case NATIVE_FLOAT32: + param = rb_float_new(*(float *) parameters[i]); + break; + case NATIVE_FLOAT64: + param = rb_float_new(*(double *) parameters[i]); + break; + case NATIVE_LONGDOUBLE: + param = rbffi_longdouble_new(*(long double *) parameters[i]); + break; + case NATIVE_STRING: + param = (*(void **) parameters[i] != NULL) ? rb_tainted_str_new2(*(char **) parameters[i]) : Qnil; + break; + case NATIVE_POINTER: + param = rbffi_Pointer_NewInstance(*(void **) parameters[i]); + break; + case NATIVE_BOOL: + param = (*(uint8_t *) parameters[i]) ? Qtrue : Qfalse; + break; + + case NATIVE_FUNCTION: + case NATIVE_CALLBACK: + case NATIVE_STRUCT: + param = rbffi_NativeValue_ToRuby(paramType, rbParamType, parameters[i]); + break; + + default: + param = Qnil; + break; + } + + /* Convert the native value into a custom ruby value */ + if (unlikely(cbInfo->parameterTypes[i]->nativeType == NATIVE_MAPPED)) { + VALUE values[] = { param, Qnil }; + param = rb_funcall2(((MappedType *) cbInfo->parameterTypes[i])->rbConverter, id_from_native, 2, values); + } + + rbParams[i] = param; + } + + rbReturnValue = rb_funcall2(fn->rbProc, id_call, cbInfo->parameterCount, rbParams); + RB_GC_GUARD_PTR(rbParams); + + if (unlikely(returnType->nativeType == NATIVE_MAPPED)) { + VALUE values[] = { rbReturnValue, Qnil }; + rbReturnValue = rb_funcall2(((MappedType *) returnType)->rbConverter, id_to_native, 2, values); + rbReturnType = ((MappedType *) returnType)->rbType; + returnType = ((MappedType* ) returnType)->type; + } + + if (rbReturnValue == Qnil || TYPE(rbReturnValue) == T_NIL) { + memset(retval, 0, returnType->ffiType->size); + } else switch (returnType->nativeType) { + case NATIVE_INT8: + case NATIVE_INT16: + case NATIVE_INT32: + *((ffi_sarg *) retval) = NUM2INT(rbReturnValue); + break; + case NATIVE_UINT8: + case NATIVE_UINT16: + case NATIVE_UINT32: + *((ffi_arg *) retval) = NUM2UINT(rbReturnValue); + break; + case NATIVE_INT64: + *((int64_t *) retval) = NUM2LL(rbReturnValue); + break; + case NATIVE_UINT64: + *((uint64_t *) retval) = NUM2ULL(rbReturnValue); + break; + case NATIVE_LONG: + *((ffi_sarg *) retval) = NUM2LONG(rbReturnValue); + break; + case NATIVE_ULONG: + *((ffi_arg *) retval) = NUM2ULONG(rbReturnValue); + break; + case NATIVE_FLOAT32: + *((float *) retval) = (float) NUM2DBL(rbReturnValue); + break; + case NATIVE_FLOAT64: + *((double *) retval) = NUM2DBL(rbReturnValue); + break; + case NATIVE_POINTER: + if (TYPE(rbReturnValue) == T_DATA && rb_obj_is_kind_of(rbReturnValue, rbffi_PointerClass)) { + *((void **) retval) = ((AbstractMemory *) DATA_PTR(rbReturnValue))->address; + } else { + /* Default to returning NULL if not a value pointer object. handles nil case as well */ + *((void **) retval) = NULL; + } + break; + + case NATIVE_BOOL: + *((ffi_arg *) retval) = rbReturnValue == Qtrue; + break; + + case NATIVE_FUNCTION: + case NATIVE_CALLBACK: + if (TYPE(rbReturnValue) == T_DATA && rb_obj_is_kind_of(rbReturnValue, rbffi_PointerClass)) { + + *((void **) retval) = ((AbstractMemory *) DATA_PTR(rbReturnValue))->address; + + } else if (rb_obj_is_kind_of(rbReturnValue, rb_cProc) || rb_respond_to(rbReturnValue, id_call)) { + VALUE function; + + function = rbffi_Function_ForProc(rbReturnType, rbReturnValue); + + *((void **) retval) = ((AbstractMemory *) DATA_PTR(function))->address; + } else { + *((void **) retval) = NULL; + } + break; + + case NATIVE_STRUCT: + if (TYPE(rbReturnValue) == T_DATA && rb_obj_is_kind_of(rbReturnValue, rbffi_StructClass)) { + AbstractMemory* memory = ((Struct *) DATA_PTR(rbReturnValue))->pointer; + + if (memory->address != NULL) { + memcpy(retval, memory->address, returnType->ffiType->size); + + } else { + memset(retval, 0, returnType->ffiType->size); + } + + } else { + memset(retval, 0, returnType->ffiType->size); + } + break; + + default: + *((ffi_arg *) retval) = 0; + break; + } + + return Qnil; +} + +static VALUE +save_callback_exception(void* data, VALUE exc) +{ + struct gvl_callback* cb = (struct gvl_callback *) data; + + memset(cb->retval, 0, ((Function *) cb->closure->info)->info->returnType->ffiType->size); + if (cb->frame != NULL) cb->frame->exc = exc; + + return Qnil; +} + +static bool +callback_prep(void* ctx, void* code, Closure* closure, char* errmsg, size_t errmsgsize) +{ + FunctionType* fnInfo = (FunctionType *) ctx; + ffi_status ffiStatus; + + ffiStatus = ffi_prep_closure(code, &fnInfo->ffi_cif, callback_invoke, closure); + if (ffiStatus != FFI_OK) { + snprintf(errmsg, errmsgsize, "ffi_prep_closure failed. status=%#x", ffiStatus); + return false; + } + + return true; +} + +void +rbffi_Function_Init(VALUE moduleFFI) +{ + rbffi_FunctionInfo_Init(moduleFFI); + /* + * Document-class: FFI::Function < FFI::Pointer + */ + rbffi_FunctionClass = rb_define_class_under(moduleFFI, "Function", rbffi_PointerClass); + + rb_global_variable(&rbffi_FunctionClass); + rb_define_alloc_func(rbffi_FunctionClass, function_allocate); + + rb_define_method(rbffi_FunctionClass, "initialize", function_initialize, -1); + rb_define_method(rbffi_FunctionClass, "initialize_copy", function_initialize_copy, 1); + rb_define_method(rbffi_FunctionClass, "call", function_call, -1); + rb_define_method(rbffi_FunctionClass, "attach", function_attach, 2); + rb_define_method(rbffi_FunctionClass, "free", function_release, 0); + rb_define_method(rbffi_FunctionClass, "autorelease=", function_set_autorelease, 1); + /* + * call-seq: autorelease + * @return [Boolean] + * Get +autorelease+ attribute. + * Synonymous for {#autorelease?}. + */ + rb_define_method(rbffi_FunctionClass, "autorelease", function_autorelease_p, 0); + /* + * call-seq: autorelease? + * @return [Boolean] +autorelease+ attribute + * Get +autorelease+ attribute. + */ + rb_define_method(rbffi_FunctionClass, "autorelease?", function_autorelease_p, 0); + + id_call = rb_intern("call"); + id_cbtable = rb_intern("@__ffi_callback_table__"); + id_cb_ref = rb_intern("@__ffi_callback__"); + id_to_native = rb_intern("to_native"); + id_from_native = rb_intern("from_native"); +#if defined(_WIN32) + InitializeCriticalSection(&async_cb_lock); + async_cb_cond = CreateEvent(NULL, FALSE, FALSE, NULL); +#endif +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Function.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Function.h new file mode 100644 index 000000000..052aaf6a2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Function.h @@ -0,0 +1,87 @@ +/* + * Copyright (c) 2009, Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RBFFI_FUNCTION_H +#define RBFFI_FUNCTION_H + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef _MSC_VER +# include +#else +# include "win32/stdbool.h" +#endif + +#include + +typedef struct FunctionType_ FunctionType; + +#include "Type.h" +#include "Call.h" +#include "ClosurePool.h" + +struct FunctionType_ { + Type type; /* The native type of a FunctionInfo object */ + VALUE rbReturnType; + VALUE rbParameterTypes; + + Type* returnType; + Type** parameterTypes; + NativeType* nativeParameterTypes; + ffi_type* ffiReturnType; + ffi_type** ffiParameterTypes; + ffi_cif ffi_cif; + Invoker invoke; + ClosurePool* closurePool; + int parameterCount; + int flags; + ffi_abi abi; + int callbackCount; + VALUE* callbackParameters; + VALUE rbEnums; + bool ignoreErrno; + bool blocking; + bool hasStruct; +}; + +extern VALUE rbffi_FunctionTypeClass, rbffi_FunctionClass; + +void rbffi_Function_Init(VALUE moduleFFI); +VALUE rbffi_Function_NewInstance(VALUE functionInfo, VALUE proc); +VALUE rbffi_Function_ForProc(VALUE cbInfo, VALUE proc); +void rbffi_FunctionInfo_Init(VALUE moduleFFI); + +#ifdef __cplusplus +} +#endif + +#endif /* RBFFI_FUNCTION_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Function.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Function.o new file mode 100644 index 000000000..f1c4a6127 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Function.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/FunctionInfo.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/FunctionInfo.c new file mode 100644 index 000000000..8085c870e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/FunctionInfo.c @@ -0,0 +1,271 @@ +/* + * Copyright (c) 2009, Wayne Meissner + * Copyright (C) 2009 Andrea Fazzi + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MSC_VER +# include +#endif +#include +#include + +#ifndef _MSC_VER +# include +# include +#else +# include "win32/stdbool.h" +#endif + +#include +#include + +#include +#include "rbffi.h" +#include "compat.h" + +#include "AbstractMemory.h" +#include "Types.h" +#include "Type.h" +#include "StructByValue.h" +#include "Function.h" + +static VALUE fntype_allocate(VALUE klass); +static VALUE fntype_initialize(int argc, VALUE* argv, VALUE self); +static void fntype_mark(FunctionType*); +static void fntype_free(FunctionType *); + +VALUE rbffi_FunctionTypeClass = Qnil; + +static VALUE +fntype_allocate(VALUE klass) +{ + FunctionType* fnInfo; + VALUE obj = Data_Make_Struct(klass, FunctionType, fntype_mark, fntype_free, fnInfo); + + fnInfo->type.ffiType = &ffi_type_pointer; + fnInfo->type.nativeType = NATIVE_FUNCTION; + fnInfo->rbReturnType = Qnil; + fnInfo->rbParameterTypes = Qnil; + fnInfo->rbEnums = Qnil; + fnInfo->invoke = rbffi_CallFunction; + fnInfo->closurePool = NULL; + + return obj; +} + +static void +fntype_mark(FunctionType* fnInfo) +{ + rb_gc_mark(fnInfo->rbReturnType); + rb_gc_mark(fnInfo->rbParameterTypes); + rb_gc_mark(fnInfo->rbEnums); + if (fnInfo->callbackCount > 0 && fnInfo->callbackParameters != NULL) { + rb_gc_mark_locations(&fnInfo->callbackParameters[0], &fnInfo->callbackParameters[fnInfo->callbackCount]); + } +} + +static void +fntype_free(FunctionType* fnInfo) +{ + xfree(fnInfo->parameterTypes); + xfree(fnInfo->ffiParameterTypes); + xfree(fnInfo->nativeParameterTypes); + xfree(fnInfo->callbackParameters); + if (fnInfo->closurePool != NULL) { + rbffi_ClosurePool_Free(fnInfo->closurePool); + } + xfree(fnInfo); +} + +/* + * call-seq: initialize(return_type, param_types, options={}) + * @param [Type, Symbol] return_type return type for the function + * @param [Array] param_types array of parameters types + * @param [Hash] options + * @option options [Boolean] :blocking set to true if the C function is a blocking call + * @option options [Symbol] :convention calling convention see {FFI::Library#calling_convention} + * @option options [FFI::Enums] :enums + * @return [self] + * A new FunctionType instance. + */ +static VALUE +fntype_initialize(int argc, VALUE* argv, VALUE self) +{ + FunctionType *fnInfo; + ffi_status status; + VALUE rbReturnType = Qnil, rbParamTypes = Qnil, rbOptions = Qnil; + VALUE rbEnums = Qnil, rbConvention = Qnil, rbBlocking = Qnil; +#if defined(X86_WIN32) + VALUE rbConventionStr; +#endif + int i, nargs; + + nargs = rb_scan_args(argc, argv, "21", &rbReturnType, &rbParamTypes, &rbOptions); + if (nargs >= 3 && rbOptions != Qnil) { + rbConvention = rb_hash_aref(rbOptions, ID2SYM(rb_intern("convention"))); + rbEnums = rb_hash_aref(rbOptions, ID2SYM(rb_intern("enums"))); + rbBlocking = rb_hash_aref(rbOptions, ID2SYM(rb_intern("blocking"))); + } + + Check_Type(rbParamTypes, T_ARRAY); + + Data_Get_Struct(self, FunctionType, fnInfo); + fnInfo->parameterCount = (int) RARRAY_LEN(rbParamTypes); + fnInfo->parameterTypes = xcalloc(fnInfo->parameterCount, sizeof(*fnInfo->parameterTypes)); + fnInfo->ffiParameterTypes = xcalloc(fnInfo->parameterCount, sizeof(ffi_type *)); + fnInfo->nativeParameterTypes = xcalloc(fnInfo->parameterCount, sizeof(*fnInfo->nativeParameterTypes)); + fnInfo->rbParameterTypes = rb_ary_new2(fnInfo->parameterCount); + fnInfo->rbEnums = rbEnums; + fnInfo->blocking = RTEST(rbBlocking); + fnInfo->hasStruct = false; + + for (i = 0; i < fnInfo->parameterCount; ++i) { + VALUE entry = rb_ary_entry(rbParamTypes, i); + VALUE type = rbffi_Type_Lookup(entry); + + if (!RTEST(type)) { + VALUE typeName = rb_funcall2(entry, rb_intern("inspect"), 0, NULL); + rb_raise(rb_eTypeError, "Invalid parameter type (%s)", RSTRING_PTR(typeName)); + } + + if (rb_obj_is_kind_of(type, rbffi_FunctionTypeClass)) { + REALLOC_N(fnInfo->callbackParameters, VALUE, fnInfo->callbackCount + 1); + fnInfo->callbackParameters[fnInfo->callbackCount++] = type; + } + + if (rb_obj_is_kind_of(type, rbffi_StructByValueClass)) { + fnInfo->hasStruct = true; + } + + rb_ary_push(fnInfo->rbParameterTypes, type); + Data_Get_Struct(type, Type, fnInfo->parameterTypes[i]); + fnInfo->ffiParameterTypes[i] = fnInfo->parameterTypes[i]->ffiType; + fnInfo->nativeParameterTypes[i] = fnInfo->parameterTypes[i]->nativeType; + } + + fnInfo->rbReturnType = rbffi_Type_Lookup(rbReturnType); + if (!RTEST(fnInfo->rbReturnType)) { + VALUE typeName = rb_funcall2(rbReturnType, rb_intern("inspect"), 0, NULL); + rb_raise(rb_eTypeError, "Invalid return type (%s)", RSTRING_PTR(typeName)); + } + + if (rb_obj_is_kind_of(fnInfo->rbReturnType, rbffi_StructByValueClass)) { + fnInfo->hasStruct = true; + } + + Data_Get_Struct(fnInfo->rbReturnType, Type, fnInfo->returnType); + fnInfo->ffiReturnType = fnInfo->returnType->ffiType; + + +#if defined(X86_WIN32) + rbConventionStr = (rbConvention != Qnil) ? rb_funcall2(rbConvention, rb_intern("to_s"), 0, NULL) : Qnil; + fnInfo->abi = (rbConventionStr != Qnil && strcmp(StringValueCStr(rbConventionStr), "stdcall") == 0) + ? FFI_STDCALL : FFI_DEFAULT_ABI; +#else + fnInfo->abi = FFI_DEFAULT_ABI; +#endif + + status = ffi_prep_cif(&fnInfo->ffi_cif, fnInfo->abi, fnInfo->parameterCount, + fnInfo->ffiReturnType, fnInfo->ffiParameterTypes); + switch (status) { + case FFI_BAD_ABI: + rb_raise(rb_eArgError, "Invalid ABI specified"); + case FFI_BAD_TYPEDEF: + rb_raise(rb_eArgError, "Invalid argument type specified"); + case FFI_OK: + break; + default: + rb_raise(rb_eArgError, "Unknown FFI error"); + } + + fnInfo->invoke = rbffi_GetInvoker(fnInfo); + + return self; +} + +/* + * call-seq: result_type + * @return [Type] + * Get the return type of the function type + */ +static VALUE +fntype_result_type(VALUE self) +{ + FunctionType* ft; + + Data_Get_Struct(self, FunctionType, ft); + + return ft->rbReturnType; +} + +/* + * call-seq: param_types + * @return [Array] + * Get parameters types. + */ +static VALUE +fntype_param_types(VALUE self) +{ + FunctionType* ft; + + Data_Get_Struct(self, FunctionType, ft); + + return rb_ary_dup(ft->rbParameterTypes); +} + +void +rbffi_FunctionInfo_Init(VALUE moduleFFI) +{ + VALUE ffi_Type; + + ffi_Type = rbffi_TypeClass; + + /* + * Document-class: FFI::FunctionType < FFI::Type + */ + rbffi_FunctionTypeClass = rb_define_class_under(moduleFFI, "FunctionType",ffi_Type); + rb_global_variable(&rbffi_FunctionTypeClass); + /* + * Document-const: FFI::CallbackInfo = FFI::FunctionType + */ + rb_define_const(moduleFFI, "CallbackInfo", rbffi_FunctionTypeClass); + /* + * Document-const: FFI::FunctionInfo = FFI::FunctionType + */ + rb_define_const(moduleFFI, "FunctionInfo", rbffi_FunctionTypeClass); + /* + * Document-const: FFI::Type::Function = FFI::FunctionType + */ + rb_define_const(ffi_Type, "Function", rbffi_FunctionTypeClass); + + rb_define_alloc_func(rbffi_FunctionTypeClass, fntype_allocate); + rb_define_method(rbffi_FunctionTypeClass, "initialize", fntype_initialize, -1); + rb_define_method(rbffi_FunctionTypeClass, "result_type", fntype_result_type, 0); + rb_define_method(rbffi_FunctionTypeClass, "param_types", fntype_param_types, 0); + +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/FunctionInfo.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/FunctionInfo.o new file mode 100644 index 000000000..35a385fcd Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/FunctionInfo.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/LastError.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/LastError.c new file mode 100644 index 000000000..795a42e55 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/LastError.c @@ -0,0 +1,184 @@ +/* + * Copyright (c) 2008, 2009, Wayne Meissner + * Copyright (C) 2009 Aman Gupta + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MSC_VER +# include +#endif +#include +#include +#ifndef _MSC_VER +# include +# include +#else +# include "win32/stdbool.h" +#endif +#include +#include + +#include "LastError.h" + +#if defined(HAVE_NATIVETHREAD) && !defined(_WIN32) && !defined(__WIN32__) +# include +# define USE_PTHREAD_LOCAL +#endif + +typedef struct ThreadData { + int td_errno; +} ThreadData; + +#if defined(USE_PTHREAD_LOCAL) +static pthread_key_t threadDataKey; +#endif + +static inline ThreadData* thread_data_get(void); + +#if defined(USE_PTHREAD_LOCAL) + +static ThreadData* +thread_data_init(void) +{ + ThreadData* td = xcalloc(1, sizeof(ThreadData)); + + pthread_setspecific(threadDataKey, td); + + return td; +} + + +static inline ThreadData* +thread_data_get(void) +{ + ThreadData* td = pthread_getspecific(threadDataKey); + return td != NULL ? td : thread_data_init(); +} + +static void +thread_data_free(void *ptr) +{ + xfree(ptr); +} + +#else +static ID id_thread_data; + +static ThreadData* +thread_data_init(void) +{ + ThreadData* td; + VALUE obj; + + obj = Data_Make_Struct(rb_cObject, ThreadData, NULL, -1, td); + rb_thread_local_aset(rb_thread_current(), id_thread_data, obj); + + return td; +} + +static inline ThreadData* +thread_data_get() +{ + VALUE obj = rb_thread_local_aref(rb_thread_current(), id_thread_data); + + if (obj != Qnil && TYPE(obj) == T_DATA) { + return (ThreadData *) DATA_PTR(obj); + } + + return thread_data_init(); +} + +#endif + + +/* + * call-seq: error + * @return [Numeric] + * Get +errno+ value. + */ +static VALUE +get_last_error(VALUE self) +{ + return INT2NUM(thread_data_get()->td_errno); +} + + +/* + * call-seq: error(error) + * @param [Numeric] error + * @return [nil] + * Set +errno+ value. + */ +static VALUE +set_last_error(VALUE self, VALUE error) +{ + +#ifdef _WIN32 + SetLastError(NUM2INT(error)); +#else + errno = NUM2INT(error); +#endif + + return Qnil; +} + + +void +rbffi_save_errno(void) +{ + int error = 0; + +#ifdef _WIN32 + error = GetLastError(); +#else + error = errno; +#endif + + thread_data_get()->td_errno = error; +} + + +void +rbffi_LastError_Init(VALUE moduleFFI) +{ + /* + * Document-module: FFI::LastError + * This module defines a couple of method to set and get +errno+ + * for current thread. + */ + VALUE moduleError = rb_define_module_under(moduleFFI, "LastError"); + + rb_define_module_function(moduleError, "error", get_last_error, 0); + rb_define_module_function(moduleError, "error=", set_last_error, 1); + +#if defined(USE_PTHREAD_LOCAL) + pthread_key_create(&threadDataKey, thread_data_free); +#else + id_thread_data = rb_intern("ffi_thread_local_data"); +#endif /* USE_PTHREAD_LOCAL */ +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/LastError.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/LastError.h new file mode 100644 index 000000000..ee1dfbb2d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/LastError.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2008, 2009, Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RBFFI_LASTERROR_H +#define RBFFI_LASTERROR_H + +#ifdef __cplusplus +extern "C" { +#endif + + +void rbffi_LastError_Init(VALUE moduleFFI); + +void rbffi_save_errno(void); + +#ifdef __cplusplus +} +#endif + +#endif /* RBFFI_LASTERROR_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/LastError.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/LastError.o new file mode 100644 index 000000000..4578192ab Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/LastError.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/LongDouble.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/LongDouble.c new file mode 100644 index 000000000..a21883afe --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/LongDouble.c @@ -0,0 +1,63 @@ +#include "LongDouble.h" +#include +#include +#include + +#if defined (__CYGWIN__) || defined(__INTERIX) +# define strtold(str, endptr) ((long double) strtod((str), (endptr))) +#endif /* defined (__CYGWIN__) */ + +static VALUE rb_cBigDecimal = Qnil; +static VALUE bigdecimal_load(VALUE unused); +static VALUE bigdecimal_failed(VALUE value); + +VALUE +rbffi_longdouble_new(long double ld) +{ + if (!RTEST(rb_cBigDecimal)) { + /* allow fallback if the bigdecimal library is unavailable in future ruby versions */ + rb_cBigDecimal = rb_rescue(bigdecimal_load, Qnil, bigdecimal_failed, rb_cObject); + } + + if (RTEST(rb_cBigDecimal) && rb_cBigDecimal != rb_cObject) { + char buf[128]; + return rb_funcall(rb_cBigDecimal, rb_intern("new"), 1, rb_str_new(buf, sprintf(buf, "%.35Le", ld))); + } + + /* Fall through to handling as a float */ + return rb_float_new(ld); +} + +long double +rbffi_num2longdouble(VALUE value) +{ + if (TYPE(value) == T_FLOAT) { + return rb_num2dbl(value); + } + + if (!RTEST(rb_cBigDecimal) && rb_const_defined(rb_cObject, rb_intern("BigDecimal"))) { + rb_cBigDecimal = rb_const_get(rb_cObject, rb_intern("BigDecimal")); + } + + if (RTEST(rb_cBigDecimal) && rb_cBigDecimal != rb_cObject && RTEST(rb_obj_is_kind_of(value, rb_cBigDecimal))) { + VALUE s = rb_funcall(value, rb_intern("to_s"), 1, rb_str_new2("E")); + return strtold(RSTRING_PTR(s), NULL); + } + + /* Fall through to handling as a float */ + return rb_num2dbl(value); +} + + +static VALUE +bigdecimal_load(VALUE unused) +{ + rb_require("bigdecimal"); + return rb_const_get(rb_cObject, rb_intern("BigDecimal")); +} + +static VALUE +bigdecimal_failed(VALUE value) +{ + return value; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/LongDouble.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/LongDouble.h new file mode 100644 index 000000000..2e52ccb33 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/LongDouble.h @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2012, Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RBFFI_LONGDOUBLE_H +#define RBFFI_LONGDOUBLE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _MSC_VER +#define strtold strtod +#endif + +extern VALUE rbffi_longdouble_new(long double ld); +extern long double rbffi_num2longdouble(VALUE value); + +#ifdef __cplusplus +} +#endif + +#endif /* RBFFI_LONGDOUBLE_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/LongDouble.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/LongDouble.o new file mode 100644 index 000000000..0ee5f38c7 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/LongDouble.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Makefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Makefile new file mode 100644 index 000000000..8a502ec2a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Makefile @@ -0,0 +1,187 @@ + +SHELL = /bin/sh + +#### Start of system configuration section. #### + +srcdir = . +topdir = /Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 +hdrdir = /Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 +arch_hdrdir = /Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/$(arch) +VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby +prefix = $(DESTDIR)/Users/tacyas/Eos/util/X86MAC64 +rubylibprefix = $(libdir)/$(RUBY_BASE_NAME) +exec_prefix = $(prefix) +vendorhdrdir = $(rubyhdrdir)/vendor_ruby +sitehdrdir = $(rubyhdrdir)/site_ruby +rubyhdrdir = $(includedir)/$(RUBY_BASE_NAME)-$(ruby_version) +vendordir = $(rubylibprefix)/vendor_ruby +sitedir = $(rubylibprefix)/site_ruby +ridir = $(datarootdir)/$(RI_BASE_NAME) +mandir = $(datarootdir)/man +localedir = $(datarootdir)/locale +libdir = $(exec_prefix)/lib +psdir = $(docdir) +pdfdir = $(docdir) +dvidir = $(docdir) +htmldir = $(docdir) +infodir = $(datarootdir)/info +docdir = $(datarootdir)/doc/$(PACKAGE) +oldincludedir = $(DESTDIR)/usr/include +includedir = $(prefix)/include +localstatedir = $(prefix)/var +sharedstatedir = $(prefix)/com +sysconfdir = $(prefix)/etc +datadir = $(datarootdir) +datarootdir = $(prefix)/share +libexecdir = $(exec_prefix)/libexec +sbindir = $(exec_prefix)/sbin +bindir = $(exec_prefix)/bin +rubylibdir = $(rubylibprefix)/$(ruby_version) +archdir = $(rubylibdir)/$(arch) +sitelibdir = $(sitedir)/$(ruby_version) +sitearchdir = $(sitelibdir)/$(sitearch) +vendorlibdir = $(vendordir)/$(ruby_version) +vendorarchdir = $(vendorlibdir)/$(sitearch) + +CC = gcc +CXX = g++ +LIBRUBY = $(LIBRUBY_A) +LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a +LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME) +LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static +OUTFLAG = -o +COUTFLAG = -o + +RUBY_EXTCONF_H = extconf.h +cflags = $(optflags) $(debugflags) $(warnflags) +optflags = -O3 +debugflags = -ggdb +warnflags = -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long +CFLAGS = -fno-common $(cflags) -pipe +INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir) -I/usr/include/ffi +DEFS = +CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\" -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags) +CXXFLAGS = $(CFLAGS) $(cxxflags) +ldflags = -L. -L/usr/local/lib +dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace +ARCH_FLAG = +DLDFLAGS = $(ldflags) $(dldflags) +LDSHARED = $(CC) -dynamic -bundle +LDSHAREDXX = $(CXX) -dynamic -bundle +AR = ar +EXEEXT = + +RUBY_BASE_NAME = ruby +RUBY_INSTALL_NAME = ruby +RUBY_SO_NAME = ruby +arch = x86_64-darwin13.2.0 +sitearch = $(arch) +ruby_version = 1.9.1 +ruby = /Users/tacyas/Eos/util/X86MAC64/bin/ruby +RUBY = $(ruby) +RM = rm -f +RM_RF = $(RUBY) -run -e rm -- -rf +RMDIRS = $(RUBY) -run -e rmdir -- -p +MAKEDIRS = mkdir -p +INSTALL = /usr/bin/install -c +INSTALL_PROG = $(INSTALL) -m 0755 +INSTALL_DATA = $(INSTALL) -m 644 +COPY = cp + +#### End of system configuration section. #### + +preload = + +libpath = . $(libdir) +LIBPATH = -L. -L$(libdir) +DEFFILE = + +CLEANFILES = mkmf.log +DISTCLEANFILES = +DISTCLEANDIRS = + +extout = +extout_prefix = +target_prefix = +LOCAL_LIBS = +LIBS = -lffi -lpthread -ldl -lobjc +SRCS = AbstractMemory.c ArrayType.c Buffer.c Call.c ClosurePool.c DataConverter.c DynamicLibrary.c ffi.c Function.c FunctionInfo.c LastError.c LongDouble.c MappedType.c MemoryPointer.c MethodHandle.c Platform.c Pointer.c Struct.c StructByReference.c StructByValue.c StructLayout.c Thread.c Type.c Types.c Variadic.c +OBJS = AbstractMemory.o ArrayType.o Buffer.o Call.o ClosurePool.o DataConverter.o DynamicLibrary.o ffi.o Function.o FunctionInfo.o LastError.o LongDouble.o MappedType.o MemoryPointer.o MethodHandle.o Platform.o Pointer.o Struct.o StructByReference.o StructByValue.o StructLayout.o Thread.o Type.o Types.o Variadic.o +TARGET = ffi_c +DLLIB = $(TARGET).bundle +EXTSTATIC = +STATIC_LIB = + +BINDIR = $(bindir) +RUBYCOMMONDIR = $(sitedir)$(target_prefix) +RUBYLIBDIR = /Users/tacyas/Eos/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib$(target_prefix) +RUBYARCHDIR = /Users/tacyas/Eos/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib$(target_prefix) +HDRDIR = $(rubyhdrdir)/ruby$(target_prefix) +ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix) + +TARGET_SO = $(DLLIB) +CLEANLIBS = $(TARGET).bundle +CLEANOBJS = *.o *.bak + +all: $(DLLIB) +static: $(STATIC_LIB) +.PHONY: all install static install-so install-rb +.PHONY: clean clean-so clean-rb + +clean-rb-default:: +clean-rb:: +clean-so:: +clean: clean-so clean-rb-default clean-rb + @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) + +distclean-rb-default:: +distclean-rb:: +distclean-so:: +distclean: clean distclean-so distclean-rb-default distclean-rb + @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log + @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES) + @-$(RMDIRS) $(DISTCLEANDIRS) + +realclean: distclean +install: install-so install-rb + +install-so: $(RUBYARCHDIR) +install-so: $(RUBYARCHDIR)/$(DLLIB) +$(RUBYARCHDIR)/$(DLLIB): $(DLLIB) + @-$(MAKEDIRS) $(@D) + $(INSTALL_PROG) $(DLLIB) $(@D) +install-rb: pre-install-rb install-rb-default +install-rb-default: pre-install-rb-default +pre-install-rb: Makefile +pre-install-rb-default: Makefile +$(RUBYARCHDIR): + $(MAKEDIRS) $@ + +site-install: site-install-so site-install-rb +site-install-so: install-so +site-install-rb: install-rb + +.SUFFIXES: .c .m .cc .cxx .cpp .C .o + +.cc.o: + $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< + +.cxx.o: + $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< + +.cpp.o: + $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< + +.C.o: + $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< + +.c.o: + $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $< + +$(DLLIB): $(OBJS) Makefile + @-$(RM) $(@) + $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS) + + + +$(OBJS): $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h $(RUBY_EXTCONF_H) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MappedType.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MappedType.c new file mode 100644 index 000000000..d1a41894b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MappedType.c @@ -0,0 +1,168 @@ +/* + * Copyright (c) 2010, Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#include +#include "rbffi.h" + +#include "Type.h" +#include "MappedType.h" + + +static VALUE mapped_allocate(VALUE); +static VALUE mapped_initialize(VALUE, VALUE); +static void mapped_mark(MappedType *); +static ID id_native_type, id_to_native, id_from_native; + +VALUE rbffi_MappedTypeClass = Qnil; + +static VALUE +mapped_allocate(VALUE klass) +{ + MappedType* m; + + VALUE obj = Data_Make_Struct(klass, MappedType, mapped_mark, -1, m); + + m->rbConverter = Qnil; + m->rbType = Qnil; + m->type = NULL; + m->base.nativeType = NATIVE_MAPPED; + m->base.ffiType = &ffi_type_void; + + return obj; +} + +/* + * call-seq: initialize(converter) + * @param [#native_type, #to_native, #from_native] converter +converter+ must respond to + * all these methods + * @return [self] + */ +static VALUE +mapped_initialize(VALUE self, VALUE rbConverter) +{ + MappedType* m = NULL; + + if (!rb_respond_to(rbConverter, id_native_type)) { + rb_raise(rb_eNoMethodError, "native_type method not implemented"); + } + + if (!rb_respond_to(rbConverter, id_to_native)) { + rb_raise(rb_eNoMethodError, "to_native method not implemented"); + } + + if (!rb_respond_to(rbConverter, id_from_native)) { + rb_raise(rb_eNoMethodError, "from_native method not implemented"); + } + + Data_Get_Struct(self, MappedType, m); + m->rbType = rb_funcall2(rbConverter, id_native_type, 0, NULL); + if (!(rb_obj_is_kind_of(m->rbType, rbffi_TypeClass))) { + rb_raise(rb_eTypeError, "native_type did not return instance of FFI::Type"); + } + + m->rbConverter = rbConverter; + Data_Get_Struct(m->rbType, Type, m->type); + m->base.ffiType = m->type->ffiType; + + return self; +} + +static void +mapped_mark(MappedType* m) +{ + rb_gc_mark(m->rbType); + rb_gc_mark(m->rbConverter); +} + +/* + * call-seq: mapped_type.native_type + * @return [Type] + * Get native type of mapped type. + */ +static VALUE +mapped_native_type(VALUE self) +{ + MappedType*m = NULL; + Data_Get_Struct(self, MappedType, m); + + return m->rbType; +} + +/* + * call-seq: mapped_type.to_native(*args) + * @param args depends on {FFI::DataConverter} used to initialize +self+ + */ +static VALUE +mapped_to_native(int argc, VALUE* argv, VALUE self) +{ + MappedType*m = NULL; + + Data_Get_Struct(self, MappedType, m); + + return rb_funcall2(m->rbConverter, id_to_native, argc, argv); +} + +/* + * call-seq: mapped_type.from_native(*args) + * @param args depends on {FFI::DataConverter} used to initialize +self+ + */ +static VALUE +mapped_from_native(int argc, VALUE* argv, VALUE self) +{ + MappedType*m = NULL; + + Data_Get_Struct(self, MappedType, m); + + return rb_funcall2(m->rbConverter, id_from_native, argc, argv); +} + +void +rbffi_MappedType_Init(VALUE moduleFFI) +{ + /* + * Document-class: FFI::Type::Mapped < FFI::Type + */ + rbffi_MappedTypeClass = rb_define_class_under(rbffi_TypeClass, "Mapped", rbffi_TypeClass); + + rb_global_variable(&rbffi_MappedTypeClass); + + id_native_type = rb_intern("native_type"); + id_to_native = rb_intern("to_native"); + id_from_native = rb_intern("from_native"); + + rb_define_alloc_func(rbffi_MappedTypeClass, mapped_allocate); + rb_define_method(rbffi_MappedTypeClass, "initialize", mapped_initialize, 1); + rb_define_method(rbffi_MappedTypeClass, "type", mapped_native_type, 0); + rb_define_method(rbffi_MappedTypeClass, "native_type", mapped_native_type, 0); + rb_define_method(rbffi_MappedTypeClass, "to_native", mapped_to_native, -1); + rb_define_method(rbffi_MappedTypeClass, "from_native", mapped_from_native, -1); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MappedType.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MappedType.h new file mode 100644 index 000000000..4b26cc1c6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MappedType.h @@ -0,0 +1,59 @@ +/* + * Copyright (c) 2010, Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RBFFI_MAPPEDTYPE_H +#define RBFFI_MAPPEDTYPE_H + + +#include + +#ifdef __cplusplus +extern "C" { +#endif + + +typedef struct MappedType_ { + Type base; + Type* type; + VALUE rbConverter; + VALUE rbType; + +} MappedType; + +void rbffi_MappedType_Init(VALUE moduleFFI); + +extern VALUE rbffi_MappedTypeClass; + + +#ifdef __cplusplus +} +#endif + +#endif /* RBFFI_MAPPEDTYPE_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MappedType.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MappedType.o new file mode 100644 index 000000000..a34900416 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MappedType.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MemoryPointer.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MemoryPointer.c new file mode 100644 index 000000000..0d91c35b7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MemoryPointer.c @@ -0,0 +1,197 @@ +/* + * Copyright (c) 2008, 2009, Wayne Meissner + * Copyright (C) 2009 Luc Heinrich + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MSC_VER +# include +# include +#else +# include "win32/stdbool.h" +# include "win32/stdint.h" +#endif +#include +#include +#include "rbffi.h" +#include "AbstractMemory.h" +#include "Pointer.h" +#include "MemoryPointer.h" + + +static VALUE memptr_allocate(VALUE klass); +static void memptr_release(Pointer* ptr); +static VALUE memptr_malloc(VALUE self, long size, long count, bool clear); +static VALUE memptr_free(VALUE self); + +VALUE rbffi_MemoryPointerClass; + +#define MEMPTR(obj) ((MemoryPointer *) rbffi_AbstractMemory_Cast(obj, rbffi_MemoryPointerClass)) + +VALUE +rbffi_MemoryPointer_NewInstance(long size, long count, bool clear) +{ + return memptr_malloc(memptr_allocate(rbffi_MemoryPointerClass), size, count, clear); +} + +static VALUE +memptr_allocate(VALUE klass) +{ + Pointer* p; + VALUE obj = Data_Make_Struct(klass, Pointer, NULL, memptr_release, p); + p->rbParent = Qnil; + p->memory.flags = MEM_RD | MEM_WR; + + return obj; +} + +/* + * call-seq: initialize(size, count=1, clear=true) + * @param [Fixnum, Bignum, Symbol, FFI::Type] size size of a memory cell (in bytes, or type whom size will be used) + * @param [Numeric] count number of cells in memory + * @param [Boolean] clear set memory to all-zero if +true+ + * @return [self] + * A new instance of FFI::MemoryPointer. + */ +static VALUE +memptr_initialize(int argc, VALUE* argv, VALUE self) +{ + VALUE size = Qnil, count = Qnil, clear = Qnil; + int nargs = rb_scan_args(argc, argv, "12", &size, &count, &clear); + + memptr_malloc(self, rbffi_type_size(size), nargs > 1 ? NUM2LONG(count) : 1, + RTEST(clear) || clear == Qnil); + + if (rb_block_given_p()) { + return rb_ensure(rb_yield, self, memptr_free, self); + } + + return self; +} + +static VALUE +memptr_malloc(VALUE self, long size, long count, bool clear) +{ + Pointer* p; + unsigned long msize; + + Data_Get_Struct(self, Pointer, p); + + msize = size * count; + + p->storage = xmalloc(msize + 7); + if (p->storage == NULL) { + rb_raise(rb_eNoMemError, "Failed to allocate memory size=%ld bytes", msize); + return Qnil; + } + p->autorelease = true; + p->memory.typeSize = (int) size; + p->memory.size = msize; + /* ensure the memory is aligned on at least a 8 byte boundary */ + p->memory.address = (char *) (((uintptr_t) p->storage + 0x7) & (uintptr_t) ~0x7UL);; + p->allocated = true; + + if (clear && p->memory.size > 0) { + memset(p->memory.address, 0, p->memory.size); + } + + return self; +} + +static VALUE +memptr_free(VALUE self) +{ + Pointer* ptr; + + Data_Get_Struct(self, Pointer, ptr); + + if (ptr->allocated) { + if (ptr->storage != NULL) { + xfree(ptr->storage); + ptr->storage = NULL; + } + ptr->allocated = false; + } + + return self; +} + +static void +memptr_release(Pointer* ptr) +{ + if (ptr->autorelease && ptr->allocated && ptr->storage != NULL) { + xfree(ptr->storage); + ptr->storage = NULL; + } + xfree(ptr); +} + +/* + * call-seq: from_string(s) + * @param [String] s string + * @return [MemoryPointer] + * Create a {MemoryPointer} with +s+ inside. + */ +static VALUE +memptr_s_from_string(VALUE klass, VALUE to_str) +{ + VALUE s = StringValue(to_str); + VALUE args[] = { INT2FIX(1), LONG2NUM(RSTRING_LEN(s) + 1), Qfalse }; + VALUE obj = rb_class_new_instance(3, args, klass); + rb_funcall(obj, rb_intern("put_string"), 2, INT2FIX(0), s); + + return obj; +} + +void +rbffi_MemoryPointer_Init(VALUE moduleFFI) +{ + VALUE ffi_Pointer; + + ffi_Pointer = rbffi_PointerClass; + + /* + * Document-class: FFI::MemoryPointer < FFI::Pointer + * A MemoryPointer is a specific {Pointer}. It points to a memory composed of cells. All cells have the + * same size. + * + * @example Create a new MemoryPointer + * mp = FFI::MemoryPointer.new(:long, 16) # Create a pointer on a memory of 16 long ints. + * @example Create a new MemoryPointer from a String + * mp1 = FFI::MemoryPointer.from_string("this is a string") + * # same as: + * mp2 = FFI::MemoryPointer.new(:char,16) + * mp2.put_string("this is a string") + */ + rbffi_MemoryPointerClass = rb_define_class_under(moduleFFI, "MemoryPointer", ffi_Pointer); + rb_global_variable(&rbffi_MemoryPointerClass); + + rb_define_alloc_func(rbffi_MemoryPointerClass, memptr_allocate); + rb_define_method(rbffi_MemoryPointerClass, "initialize", memptr_initialize, -1); + rb_define_singleton_method(rbffi_MemoryPointerClass, "from_string", memptr_s_from_string, 1); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MemoryPointer.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MemoryPointer.h new file mode 100644 index 000000000..12576838a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MemoryPointer.h @@ -0,0 +1,53 @@ +/* + * Copyright (c) 2008, 2009, Wayne Meissner + * Copyright (c) 2008, Luc Heinrich + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RBFFI_MEMORYPOINTER_H +#define RBFFI_MEMORYPOINTER_H + +#ifndef _MSC_VER +# include +#else +# include "win32/stdbool.h" +#endif +#include + +#ifdef __cplusplus +extern "C" { +#endif + + extern void rbffi_MemoryPointer_Init(VALUE moduleFFI); + extern VALUE rbffi_MemoryPointerClass; + extern VALUE rbffi_MemoryPointer_NewInstance(long size, long count, bool clear); +#ifdef __cplusplus +} +#endif + +#endif /* RBFFI_MEMORYPOINTER_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MemoryPointer.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MemoryPointer.o new file mode 100644 index 000000000..f01cfa537 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MemoryPointer.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MethodHandle.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MethodHandle.c new file mode 100644 index 000000000..cee1df5d0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MethodHandle.c @@ -0,0 +1,360 @@ +/* + * Copyright (c) 2009, 2010 Wayne Meissner + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MSC_VER +#include +#endif +#include +#ifndef _WIN32 +# include +#endif +#include +#ifndef _MSC_VER +# include +# include +#else +# include "win32/stdint.h" +# include "win32/stdbool.h" +#endif +#ifndef _WIN32 +# include +#endif +#include +#include +#if defined(HAVE_NATIVETHREAD) && !defined(_WIN32) && !defined(__WIN32__) +# include +#endif + +#include +#include "rbffi.h" +#include "compat.h" + +#include "Function.h" +#include "Types.h" +#include "Type.h" +#include "LastError.h" +#include "Call.h" +#include "ClosurePool.h" +#include "MethodHandle.h" + + +#define MAX_METHOD_FIXED_ARITY (6) + +#ifndef roundup +# define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) +#endif +#ifdef _WIN32 + typedef char* caddr_t; +#endif + +#ifdef USE_RAW +# define METHOD_CLOSURE ffi_raw_closure +# define METHOD_PARAMS ffi_raw* +#else +# define METHOD_CLOSURE ffi_closure +# define METHOD_PARAMS void** +#endif + + + +static bool prep_trampoline(void* ctx, void* code, Closure* closure, char* errmsg, size_t errmsgsize); +static long trampoline_size(void); + +#if defined(__x86_64__) && (defined(__linux__) || defined(__APPLE__)) +# define CUSTOM_TRAMPOLINE 1 +#endif + + +struct MethodHandle { + Closure* closure; +}; + +static ClosurePool* defaultClosurePool; + + +MethodHandle* +rbffi_MethodHandle_Alloc(FunctionType* fnInfo, void* function) +{ + MethodHandle* handle; + Closure* closure = rbffi_Closure_Alloc(defaultClosurePool); + if (closure == NULL) { + rb_raise(rb_eNoMemError, "failed to allocate closure from pool"); + return NULL; + } + + handle = xcalloc(1, sizeof(*handle)); + handle->closure = closure; + closure->info = fnInfo; + closure->function = function; + + return handle; +} + +void +rbffi_MethodHandle_Free(MethodHandle* handle) +{ + if (handle != NULL) { + rbffi_Closure_Free(handle->closure); + } +} + +void* +rbffi_MethodHandle_CodeAddress(MethodHandle* handle) +{ + return handle->closure->code; +} + +#ifndef CUSTOM_TRAMPOLINE +static void attached_method_invoke(ffi_cif* cif, void* retval, METHOD_PARAMS parameters, void* user_data); + +static ffi_type* methodHandleParamTypes[] = { + &ffi_type_sint, + &ffi_type_pointer, + &ffi_type_ulong, +}; + +static ffi_cif mh_cif; + +static bool +prep_trampoline(void* ctx, void* code, Closure* closure, char* errmsg, size_t errmsgsize) +{ + ffi_status ffiStatus; + +#if defined(USE_RAW) + ffiStatus = ffi_prep_raw_closure(code, &mh_cif, attached_method_invoke, closure); +#else + ffiStatus = ffi_prep_closure(code, &mh_cif, attached_method_invoke, closure); +#endif + if (ffiStatus != FFI_OK) { + snprintf(errmsg, errmsgsize, "ffi_prep_closure failed. status=%#x", ffiStatus); + return false; + } + + return true; +} + + +static long +trampoline_size(void) +{ + return sizeof(METHOD_CLOSURE); +} + +/* + * attached_method_invoke is used functions with more than 6 parameters, or + * with struct param or return values + */ +static void +attached_method_invoke(ffi_cif* cif, void* mretval, METHOD_PARAMS parameters, void* user_data) +{ + Closure* handle = (Closure *) user_data; + FunctionType* fnInfo = (FunctionType *) handle->info; + +#ifdef USE_RAW + int argc = parameters[0].sint; + VALUE* argv = *(VALUE **) ¶meters[1]; +#else + int argc = *(int *) parameters[0]; + VALUE* argv = *(VALUE **) parameters[1]; +#endif + + *(VALUE *) mretval = (*fnInfo->invoke)(argc, argv, handle->function, fnInfo); +} + +#endif + + + +#if defined(CUSTOM_TRAMPOLINE) +#if defined(__x86_64__) + +static VALUE custom_trampoline(int argc, VALUE* argv, VALUE self, Closure*); + +#define TRAMPOLINE_CTX_MAGIC (0xfee1deadcafebabe) +#define TRAMPOLINE_FUN_MAGIC (0xfeedfacebeeff00d) + +/* + * This is a hand-coded trampoline to speedup entry from ruby to the FFI translation + * layer for x86_64 arches. + * + * Since a ruby function has exactly 3 arguments, and the first 6 arguments are + * passed in registers for x86_64, we can tack on a context pointer by simply + * putting a value in %rcx, then jumping to the C trampoline code. + * + * This results in approx a 30% speedup for x86_64 FFI dispatch + */ +__asm__( + ".text\n\t" + ".globl ffi_trampoline\n\t" + ".globl _ffi_trampoline\n\t" + "ffi_trampoline:\n\t" + "_ffi_trampoline:\n\t" + "movabsq $0xfee1deadcafebabe, %rcx\n\t" + "movabsq $0xfeedfacebeeff00d, %r11\n\t" + "jmpq *%r11\n\t" + ".globl ffi_trampoline_end\n\t" + "ffi_trampoline_end:\n\t" + ".globl _ffi_trampoline_end\n\t" + "_ffi_trampoline_end:\n\t" +); + +static VALUE +custom_trampoline(int argc, VALUE* argv, VALUE self, Closure* handle) +{ + FunctionType* fnInfo = (FunctionType *) handle->info; + VALUE rbReturnValue; + + RB_GC_GUARD(rbReturnValue) = (*fnInfo->invoke)(argc, argv, handle->function, fnInfo); + RB_GC_GUARD_PTR(argv); + RB_GC_GUARD(self); + + return rbReturnValue; +} + +#elif defined(__i386__) && 0 + +static VALUE custom_trampoline(caddr_t args, Closure*); +#define TRAMPOLINE_CTX_MAGIC (0xfee1dead) +#define TRAMPOLINE_FUN_MAGIC (0xbeefcafe) + +/* + * This is a hand-coded trampoline to speedup entry from ruby to the FFI translation + * layer for i386 arches. + * + * This does not make a discernable difference vs a raw closure, so for now, + * it is not enabled. + */ +__asm__( + ".text\n\t" + ".globl ffi_trampoline\n\t" + ".globl _ffi_trampoline\n\t" + "ffi_trampoline:\n\t" + "_ffi_trampoline:\n\t" + "subl $12, %esp\n\t" + "leal 16(%esp), %eax\n\t" + "movl %eax, (%esp)\n\t" + "movl $0xfee1dead, 4(%esp)\n\t" + "movl $0xbeefcafe, %eax\n\t" + "call *%eax\n\t" + "addl $12, %esp\n\t" + "ret\n\t" + ".globl ffi_trampoline_end\n\t" + "ffi_trampoline_end:\n\t" + ".globl _ffi_trampoline_end\n\t" + "_ffi_trampoline_end:\n\t" +); + +static VALUE +custom_trampoline(caddr_t args, Closure* handle) +{ + FunctionType* fnInfo = (FunctionType *) handle->info; + return (*fnInfo->invoke)(*(int *) args, *(VALUE **) (args + 4), handle->function, fnInfo); +} + +#endif /* __x86_64__ else __i386__ */ + +extern void ffi_trampoline(int argc, VALUE* argv, VALUE self); +extern void ffi_trampoline_end(void); +static int trampoline_offsets(long *, long *); + +static long trampoline_ctx_offset, trampoline_func_offset; + +static long +trampoline_offset(int off, const long value) +{ + caddr_t ptr; + for (ptr = (caddr_t) &ffi_trampoline + off; ptr < (caddr_t) &ffi_trampoline_end; ++ptr) { + if (*(long *) ptr == value) { + return ptr - (caddr_t) &ffi_trampoline; + } + } + + return -1; +} + +static int +trampoline_offsets(long* ctxOffset, long* fnOffset) +{ + *ctxOffset = trampoline_offset(0, TRAMPOLINE_CTX_MAGIC); + if (*ctxOffset == -1) { + return -1; + } + + *fnOffset = trampoline_offset(0, TRAMPOLINE_FUN_MAGIC); + if (*fnOffset == -1) { + return -1; + } + + return 0; +} + +static bool +prep_trampoline(void* ctx, void* code, Closure* closure, char* errmsg, size_t errmsgsize) +{ + caddr_t ptr = (caddr_t) code; + + memcpy(ptr, &ffi_trampoline, trampoline_size()); + /* Patch the context and function addresses into the stub code */ + *(intptr_t *)(ptr + trampoline_ctx_offset) = (intptr_t) closure; + *(intptr_t *)(ptr + trampoline_func_offset) = (intptr_t) custom_trampoline; + + return true; +} + +static long +trampoline_size(void) +{ + return (caddr_t) &ffi_trampoline_end - (caddr_t) &ffi_trampoline; +} + +#endif /* CUSTOM_TRAMPOLINE */ + + +void +rbffi_MethodHandle_Init(VALUE module) +{ +#ifndef CUSTOM_TRAMPOLINE + ffi_status ffiStatus; +#endif + + defaultClosurePool = rbffi_ClosurePool_New((int) trampoline_size(), prep_trampoline, NULL); + +#if defined(CUSTOM_TRAMPOLINE) + if (trampoline_offsets(&trampoline_ctx_offset, &trampoline_func_offset) != 0) { + rb_raise(rb_eFatal, "Could not locate offsets in trampoline code"); + } +#else + ffiStatus = ffi_prep_cif(&mh_cif, FFI_DEFAULT_ABI, 3, &ffi_type_ulong, + methodHandleParamTypes); + if (ffiStatus != FFI_OK) { + rb_raise(rb_eFatal, "ffi_prep_cif failed. status=%#x", ffiStatus); + } + +#endif +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MethodHandle.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MethodHandle.h new file mode 100644 index 000000000..c3341bf30 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MethodHandle.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2009, Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RBFFI_METHODHANDLE_H +#define RBFFI_METHODHANDLE_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include "Function.h" + + +typedef struct MethodHandlePool MethodHandlePool; +typedef struct MethodHandle MethodHandle; + + +MethodHandle* rbffi_MethodHandle_Alloc(FunctionType* fnInfo, void* function); +void rbffi_MethodHandle_Free(MethodHandle* handle); +void* rbffi_MethodHandle_CodeAddress(MethodHandle* handle); +void rbffi_MethodHandle_Init(VALUE module); + +#ifdef __cplusplus +} +#endif + +#endif /* RBFFI_METHODHANDLE_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MethodHandle.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MethodHandle.o new file mode 100644 index 000000000..65e677abc Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/MethodHandle.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Platform.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Platform.c new file mode 100644 index 000000000..1305ad2b4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Platform.c @@ -0,0 +1,121 @@ +/* + * Copyright (c) 2008-2010 Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MSC_VER +# include +#endif +# include +#ifndef _MSC_VER +# include +# include +#else +# include "win32/stdint.h" +# include "win32/stdbool.h" +#endif +#include +#include +#include "rbffi_endian.h" +#include "Platform.h" + +#if defined(__GNU__) || defined(__GLIBC__) +# include +#endif + +static VALUE PlatformModule = Qnil; + +/* + * Determine the cpu type at compile time - useful for MacOSX where the the + * system installed ruby incorrectly reports 'host_cpu' as 'powerpc' when running + * on intel. + */ +#if defined(__x86_64__) || defined(__x86_64) || defined(__amd64) || defined(_M_X64) || defined(_M_AMD64) +# define CPU "x86_64" + +#elif defined(__i386__) || defined(__i386) || defined(_M_IX86) +# define CPU "i386" + +#elif defined(__ppc64__) || defined(__powerpc64__) || defined(_M_PPC) +# define CPU "ppc64" + +#elif defined(__ppc__) || defined(__powerpc__) || defined(__powerpc) +# define CPU "ppc" + +/* Need to check for __sparcv9 first, because __sparc will be defined either way. */ +#elif defined(__sparcv9__) || defined(__sparcv9) +# define CPU "sparcv9" + +#elif defined(__sparc__) || defined(__sparc) +# define CPU "sparc" + +#elif defined(__arm__) || defined(__arm) +# define CPU "arm" + +#elif defined(__mips__) || defined(__mips) +# define CPU "mips" + +#elif defined(__s390__) +# define CPU "s390" + +#else +# define CPU "unknown" +#endif + +static void +export_primitive_types(VALUE module) +{ +#define S(name, T) do { \ + typedef struct { char c; T v; } s; \ + rb_define_const(module, #name "_ALIGN", INT2NUM((sizeof(s) - sizeof(T)) * 8)); \ + rb_define_const(module, #name "_SIZE", INT2NUM(sizeof(T)* 8)); \ +} while(0) + S(INT8, char); + S(INT16, short); + S(INT32, int); + S(INT64, long long); + S(LONG, long); + S(FLOAT, float); + S(DOUBLE, double); + S(ADDRESS, void*); +#undef S +} + +void +rbffi_Platform_Init(VALUE moduleFFI) +{ + PlatformModule = rb_define_module_under(moduleFFI, "Platform"); + rb_define_const(PlatformModule, "BYTE_ORDER", INT2FIX(BYTE_ORDER)); + rb_define_const(PlatformModule, "LITTLE_ENDIAN", INT2FIX(LITTLE_ENDIAN)); + rb_define_const(PlatformModule, "BIG_ENDIAN", INT2FIX(BIG_ENDIAN)); + rb_define_const(PlatformModule, "CPU", rb_str_new2(CPU)); +#if defined(__GNU__) || defined(__GLIBC__) + rb_define_const(PlatformModule, "GNU_LIBC", rb_str_new2(LIBC_SO)); +#endif + export_primitive_types(PlatformModule); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Platform.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Platform.h new file mode 100644 index 000000000..5575e34ab --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Platform.h @@ -0,0 +1,45 @@ +/* + * Copyright (c) 2008-2010 Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RBFFI_PLATFORM_H +#define RBFFI_PLATFORM_H + +#ifdef __cplusplus +extern "C" { +#endif + + extern void rbffi_Platform_Init(VALUE moduleFFI); + + +#ifdef __cplusplus +} +#endif + +#endif /* RBFFI_PLATFORM_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Platform.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Platform.o new file mode 100644 index 000000000..f9a3286ee Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Platform.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Pointer.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Pointer.c new file mode 100644 index 000000000..edd931c43 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Pointer.c @@ -0,0 +1,508 @@ +/* + * Copyright (c) 2008, 2009, Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MSC_VER +# include +# include +#else +# include "win32/stdint.h" +# include "win32/stdbool.h" +#endif +#include +#include +#include "rbffi.h" +#include "rbffi_endian.h" +#include "AbstractMemory.h" +#include "Pointer.h" + +#define POINTER(obj) rbffi_AbstractMemory_Cast((obj), rbffi_PointerClass) + +VALUE rbffi_PointerClass = Qnil; +VALUE rbffi_NullPointerSingleton = Qnil; + +static void ptr_release(Pointer* ptr); +static void ptr_mark(Pointer* ptr); + +VALUE +rbffi_Pointer_NewInstance(void* addr) +{ + Pointer* p; + VALUE obj; + + if (addr == NULL) { + return rbffi_NullPointerSingleton; + } + + obj = Data_Make_Struct(rbffi_PointerClass, Pointer, NULL, -1, p); + p->memory.address = addr; + p->memory.size = LONG_MAX; + p->memory.flags = (addr == NULL) ? 0 : (MEM_RD | MEM_WR); + p->memory.typeSize = 1; + p->rbParent = Qnil; + + return obj; +} + +static VALUE +ptr_allocate(VALUE klass) +{ + Pointer* p; + VALUE obj; + + obj = Data_Make_Struct(klass, Pointer, ptr_mark, ptr_release, p); + p->rbParent = Qnil; + p->memory.flags = MEM_RD | MEM_WR; + + return obj; +} + +/* + * @overload initialize(pointer) + * @param [Pointer] pointer another pointer to initialize from + * Create a new pointer from another {Pointer}. + * @overload initialize(type, address) + * @param [Type] type type for pointer + * @param [Integer] address base address for pointer + * Create a new pointer from a {Type} and a base adresse + * @return [self] + * A new instance of Pointer. + */ +static VALUE +ptr_initialize(int argc, VALUE* argv, VALUE self) +{ + Pointer* p; + VALUE rbType = Qnil, rbAddress = Qnil; + int typeSize = 1; + + Data_Get_Struct(self, Pointer, p); + + switch (rb_scan_args(argc, argv, "11", &rbType, &rbAddress)) { + case 1: + rbAddress = rbType; + typeSize = 1; + break; + case 2: + typeSize = rbffi_type_size(rbType); + break; + default: + rb_raise(rb_eArgError, "Invalid arguments"); + } + + switch (TYPE(rbAddress)) { + case T_FIXNUM: + case T_BIGNUM: + p->memory.address = (void*) (uintptr_t) NUM2LL(rbAddress); + p->memory.size = LONG_MAX; + if (p->memory.address == NULL) { + p->memory.flags = 0; + } + break; + + default: + if (rb_obj_is_kind_of(rbAddress, rbffi_PointerClass)) { + Pointer* orig; + + p->rbParent = rbAddress; + Data_Get_Struct(rbAddress, Pointer, orig); + p->memory = orig->memory; + } else { + rb_raise(rb_eTypeError, "wrong argument type, expected Integer or FFI::Pointer"); + } + break; + } + + p->memory.typeSize = typeSize; + + return self; +} + +/* + * call-seq: ptr.initialize_copy(other) + * @param [Pointer] other source for cloning or dupping + * @return [self] + * @raise {RuntimeError} if +other+ is an unbounded memory area, or is unreable/unwritable + * @raise {NoMemError} if failed to allocate memory for new object + * DO NOT CALL THIS METHOD. + * + * This method is internally used by #dup and #clone. Memory contents is copied from +other+. + */ +static VALUE +ptr_initialize_copy(VALUE self, VALUE other) +{ + AbstractMemory* src; + Pointer* dst; + + Data_Get_Struct(self, Pointer, dst); + src = POINTER(other); + if (src->size == LONG_MAX) { + rb_raise(rb_eRuntimeError, "cannot duplicate unbounded memory area"); + return Qnil; + } + + if ((dst->memory.flags & (MEM_RD | MEM_WR)) != (MEM_RD | MEM_WR)) { + rb_raise(rb_eRuntimeError, "cannot duplicate unreadable/unwritable memory area"); + return Qnil; + } + + if (dst->storage != NULL) { + xfree(dst->storage); + dst->storage = NULL; + } + + dst->storage = xmalloc(src->size + 7); + if (dst->storage == NULL) { + rb_raise(rb_eNoMemError, "failed to allocate memory size=%lu bytes", src->size); + return Qnil; + } + + dst->allocated = true; + dst->autorelease = true; + dst->memory.address = (void *) (((uintptr_t) dst->storage + 0x7) & (uintptr_t) ~0x7UL); + dst->memory.size = src->size; + dst->memory.typeSize = src->typeSize; + + /* finally, copy the actual memory contents */ + memcpy(dst->memory.address, src->address, src->size); + + return self; +} + +static VALUE +slice(VALUE self, long offset, long size) +{ + AbstractMemory* ptr; + Pointer* p; + VALUE retval; + + Data_Get_Struct(self, AbstractMemory, ptr); + checkBounds(ptr, offset, size == LONG_MAX ? 1 : size); + + retval = Data_Make_Struct(rbffi_PointerClass, Pointer, ptr_mark, -1, p); + + p->memory.address = ptr->address + offset; + p->memory.size = size; + p->memory.flags = ptr->flags; + p->memory.typeSize = ptr->typeSize; + p->rbParent = self; + + return retval; +} + +/* + * Document-method: + + * call-seq: ptr + offset + * @param [Numeric] offset + * @return [Pointer] + * Return a new {Pointer} from an existing pointer and an +offset+. + */ +static VALUE +ptr_plus(VALUE self, VALUE offset) +{ + AbstractMemory* ptr; + long off = NUM2LONG(offset); + + Data_Get_Struct(self, AbstractMemory, ptr); + + return slice(self, off, ptr->size == LONG_MAX ? LONG_MAX : ptr->size - off); +} + +/* + * call-seq: ptr.slice(offset, length) + * @param [Numeric] offset + * @param [Numeric] length + * @return [Pointer] + * Return a new {Pointer} from an existing one. This pointer points on same contents + * from +offset+ for a length +length+. + */ +static VALUE +ptr_slice(VALUE self, VALUE rbOffset, VALUE rbLength) +{ + return slice(self, NUM2LONG(rbOffset), NUM2LONG(rbLength)); +} + +/* + * call-seq: ptr.inspect + * @return [String] + * Inspect pointer object. + */ +static VALUE +ptr_inspect(VALUE self) +{ + char buf[100]; + Pointer* ptr; + + Data_Get_Struct(self, Pointer, ptr); + + if (ptr->memory.size != LONG_MAX) { + snprintf(buf, sizeof(buf), "#<%s address=%p size=%lu>", + rb_obj_classname(self), ptr->memory.address, ptr->memory.size); + } else { + snprintf(buf, sizeof(buf), "#<%s address=%p>", rb_obj_classname(self), ptr->memory.address); + } + + return rb_str_new2(buf); +} + +/* + * Document-method: null? + * call-seq: ptr.null? + * @return [Boolean] + * Return +true+ if +self+ is a {NULL} pointer. + */ +static VALUE +ptr_null_p(VALUE self) +{ + Pointer* ptr; + + Data_Get_Struct(self, Pointer, ptr); + + return ptr->memory.address == NULL ? Qtrue : Qfalse; +} + +/* + * Document-method: == + * call-seq: ptr == other + * @param [Pointer] other + * Check equality between +self+ and +other+. Equality is tested on {#address}. + */ +static VALUE +ptr_equals(VALUE self, VALUE other) +{ + Pointer* ptr; + + Data_Get_Struct(self, Pointer, ptr); + + if (NIL_P(other)) { + return ptr->memory.address == NULL ? Qtrue : Qfalse; + } + + return ptr->memory.address == POINTER(other)->address ? Qtrue : Qfalse; +} + +/* + * call-seq: ptr.address + * @return [Numeric] pointer's base address + * Return +self+'s base address (alias: #to_i). + */ +static VALUE +ptr_address(VALUE self) +{ + Pointer* ptr; + + Data_Get_Struct(self, Pointer, ptr); + + return ULL2NUM((uintptr_t) ptr->memory.address); +} + +#if BYTE_ORDER == LITTLE_ENDIAN +# define SWAPPED_ORDER BIG_ENDIAN +#else +# define SWAPPED_ORDER LITTLE_ENDIAN +#endif + +/* + * Get or set +self+'s endianness + * @overload order + * @return [:big, :little] endianness of +self+ + * @overload order(order) + * @param [Symbol] order endianness to set (+:little+, +:big+ or +:network+). +:big+ and +:network+ + * are synonymous. + * @return [self] + */ +static VALUE +ptr_order(int argc, VALUE* argv, VALUE self) +{ + Pointer* ptr; + + Data_Get_Struct(self, Pointer, ptr); + if (argc == 0) { + int order = (ptr->memory.flags & MEM_SWAP) == 0 ? BYTE_ORDER : SWAPPED_ORDER; + return order == BIG_ENDIAN ? ID2SYM(rb_intern("big")) : ID2SYM(rb_intern("little")); + } else { + VALUE rbOrder = Qnil; + int order = BYTE_ORDER; + + if (rb_scan_args(argc, argv, "1", &rbOrder) < 1) { + rb_raise(rb_eArgError, "need byte order"); + } + if (SYMBOL_P(rbOrder)) { + ID id = SYM2ID(rbOrder); + if (id == rb_intern("little")) { + order = LITTLE_ENDIAN; + + } else if (id == rb_intern("big") || id == rb_intern("network")) { + order = BIG_ENDIAN; + } + } + if (order != BYTE_ORDER) { + Pointer* p2; + VALUE retval = slice(self, 0, ptr->memory.size); + + Data_Get_Struct(retval, Pointer, p2); + p2->memory.flags |= MEM_SWAP; + return retval; + } + + return self; + } +} + + +/* + * call-seq: ptr.free + * @return [self] + * Free memory pointed by +self+. + */ +static VALUE +ptr_free(VALUE self) +{ + Pointer* ptr; + + Data_Get_Struct(self, Pointer, ptr); + + if (ptr->allocated) { + if (ptr->storage != NULL) { + xfree(ptr->storage); + ptr->storage = NULL; + } + ptr->allocated = false; + + } else { + VALUE caller = rb_funcall(rb_funcall(Qnil, rb_intern("caller"), 0), rb_intern("first"), 0); + + rb_warn("calling free on non allocated pointer %s from %s", RSTRING_PTR(ptr_inspect(self)), RSTRING_PTR(rb_str_to_str(caller))); + } + + return self; +} + +static VALUE +ptr_type_size(VALUE self) +{ + Pointer* ptr; + + Data_Get_Struct(self, Pointer, ptr); + + return INT2NUM(ptr->memory.typeSize); +} + +/* + * call-seq: ptr.autorelease = autorelease + * @param [Boolean] autorelease + * @return [Boolean] +autorelease+ + * Set +autorelease+ attribute. See also Autorelease section. + */ +static VALUE +ptr_autorelease(VALUE self, VALUE autorelease) +{ + Pointer* ptr; + + Data_Get_Struct(self, Pointer, ptr); + ptr->autorelease = autorelease == Qtrue; + + return autorelease; +} + +/* + * call-seq: ptr.autorelease? + * @return [Boolean] + * Get +autorelease+ attribute. See also Autorelease section. + */ +static VALUE +ptr_autorelease_p(VALUE self) +{ + Pointer* ptr; + + Data_Get_Struct(self, Pointer, ptr); + + return ptr->autorelease ? Qtrue : Qfalse; +} + + +static void +ptr_release(Pointer* ptr) +{ + if (ptr->autorelease && ptr->allocated && ptr->storage != NULL) { + xfree(ptr->storage); + ptr->storage = NULL; + } + xfree(ptr); +} + +static void +ptr_mark(Pointer* ptr) +{ + rb_gc_mark(ptr->rbParent); +} + +void +rbffi_Pointer_Init(VALUE moduleFFI) +{ + VALUE rbNullAddress = ULL2NUM(0); + VALUE ffi_AbstractMemory = rbffi_AbstractMemoryClass; + + /* + * Document-class: FFI::Pointer < FFI::AbstractMemory + * Pointer class is used to manage C pointers with ease. A {Pointer} object is defined by his + * {#address} (as a C pointer). It permits additions with an integer for pointer arithmetic. + * + * ==Autorelease + * A pointer object may autorelease his contents when freed (by default). This behaviour may be + * changed with {#autorelease=} method. + */ + rbffi_PointerClass = rb_define_class_under(moduleFFI, "Pointer", ffi_AbstractMemory); + /* + * Document-variable: Pointer + */ + rb_global_variable(&rbffi_PointerClass); + + rb_define_alloc_func(rbffi_PointerClass, ptr_allocate); + rb_define_method(rbffi_PointerClass, "initialize", ptr_initialize, -1); + rb_define_method(rbffi_PointerClass, "initialize_copy", ptr_initialize_copy, 1); + rb_define_method(rbffi_PointerClass, "inspect", ptr_inspect, 0); + rb_define_method(rbffi_PointerClass, "to_s", ptr_inspect, 0); + rb_define_method(rbffi_PointerClass, "+", ptr_plus, 1); + rb_define_method(rbffi_PointerClass, "slice", ptr_slice, 2); + rb_define_method(rbffi_PointerClass, "null?", ptr_null_p, 0); + rb_define_method(rbffi_PointerClass, "address", ptr_address, 0); + rb_define_alias(rbffi_PointerClass, "to_i", "address"); + rb_define_method(rbffi_PointerClass, "==", ptr_equals, 1); + rb_define_method(rbffi_PointerClass, "order", ptr_order, -1); + rb_define_method(rbffi_PointerClass, "autorelease=", ptr_autorelease, 1); + rb_define_method(rbffi_PointerClass, "autorelease?", ptr_autorelease_p, 0); + rb_define_method(rbffi_PointerClass, "free", ptr_free, 0); + rb_define_method(rbffi_PointerClass, "type_size", ptr_type_size, 0); + + rbffi_NullPointerSingleton = rb_class_new_instance(1, &rbNullAddress, rbffi_PointerClass); + /* + * NULL pointer + */ + rb_define_const(rbffi_PointerClass, "NULL", rbffi_NullPointerSingleton); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Pointer.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Pointer.h new file mode 100644 index 000000000..2d868518e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Pointer.h @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2008, 2009, Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RBFFI_POINTER_H +#define RBFFI_POINTER_H + +#ifndef _MSC_VER +# include +#else +# include "win32/stdbool.h" +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#include "AbstractMemory.h" + +extern void rbffi_Pointer_Init(VALUE moduleFFI); +extern VALUE rbffi_Pointer_NewInstance(void* addr); +extern VALUE rbffi_PointerClass; +extern VALUE rbffi_NullPointerSingleton; + +typedef struct Pointer { + AbstractMemory memory; + VALUE rbParent; + char* storage; /* start of malloc area */ + bool autorelease; + bool allocated; +} Pointer; + +#ifdef __cplusplus +} +#endif + +#endif /* RBFFI_POINTER_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Pointer.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Pointer.o new file mode 100644 index 000000000..74e39a620 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Pointer.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Struct.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Struct.c new file mode 100644 index 000000000..c6428a212 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Struct.c @@ -0,0 +1,829 @@ +/* + * Copyright (c) 2008, 2009, Wayne Meissner + * Copyright (C) 2009 Luc Heinrich + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#ifndef _MSC_VER +# include +# include +# include +#else +# include "win32/stdbool.h" +# include "win32/stdint.h" +#endif +#include +#include "rbffi.h" +#include "compat.h" +#include "AbstractMemory.h" +#include "Pointer.h" +#include "MemoryPointer.h" +#include "Function.h" +#include "Types.h" +#include "Function.h" +#include "StructByValue.h" +#include "ArrayType.h" +#include "MappedType.h" +#include "Struct.h" + +typedef struct InlineArray_ { + VALUE rbMemory; + VALUE rbField; + + AbstractMemory* memory; + StructField* field; + MemoryOp *op; + Type* componentType; + ArrayType* arrayType; + int length; +} InlineArray; + + +static void struct_mark(Struct *); +static void struct_free(Struct *); +static VALUE struct_class_layout(VALUE klass); +static void struct_malloc(Struct* s); +static void inline_array_mark(InlineArray *); +static void store_reference_value(StructField* f, Struct* s, VALUE value); + +VALUE rbffi_StructClass = Qnil; + +VALUE rbffi_StructInlineArrayClass = Qnil; +VALUE rbffi_StructLayoutCharArrayClass = Qnil; + +static ID id_pointer_ivar = 0, id_layout_ivar = 0; +static ID id_get = 0, id_put = 0, id_to_ptr = 0, id_to_s = 0, id_layout = 0; + +static inline char* +memory_address(VALUE self) +{ + return ((AbstractMemory *)DATA_PTR((self)))->address; +} + +static VALUE +struct_allocate(VALUE klass) +{ + Struct* s; + VALUE obj = Data_Make_Struct(klass, Struct, struct_mark, struct_free, s); + + s->rbPointer = Qnil; + s->rbLayout = Qnil; + + return obj; +} + +/* + * call-seq: initialize + * @overload initialize(pointer, *args) + * @param [AbstractMemory] pointer + * @param [Array] args + * @return [self] + */ +static VALUE +struct_initialize(int argc, VALUE* argv, VALUE self) +{ + Struct* s; + VALUE rbPointer = Qnil, rest = Qnil, klass = CLASS_OF(self); + int nargs; + + Data_Get_Struct(self, Struct, s); + + nargs = rb_scan_args(argc, argv, "01*", &rbPointer, &rest); + + /* Call up into ruby code to adjust the layout */ + if (nargs > 1) { + s->rbLayout = rb_funcall2(CLASS_OF(self), id_layout, (int) RARRAY_LEN(rest), RARRAY_PTR(rest)); + } else { + s->rbLayout = struct_class_layout(klass); + } + + if (!rb_obj_is_kind_of(s->rbLayout, rbffi_StructLayoutClass)) { + rb_raise(rb_eRuntimeError, "Invalid Struct layout"); + } + + Data_Get_Struct(s->rbLayout, StructLayout, s->layout); + + if (rbPointer != Qnil) { + s->pointer = MEMORY(rbPointer); + s->rbPointer = rbPointer; + } else { + struct_malloc(s); + } + + return self; +} + +/* + * call-seq: initialize_copy(other) + * @return [nil] + * DO NOT CALL THIS METHOD + */ +static VALUE +struct_initialize_copy(VALUE self, VALUE other) +{ + Struct* src; + Struct* dst; + + Data_Get_Struct(self, Struct, dst); + Data_Get_Struct(other, Struct, src); + if (dst == src) { + return self; + } + + dst->rbLayout = src->rbLayout; + dst->layout = src->layout; + + /* + * A new MemoryPointer instance is allocated here instead of just calling + * #dup on rbPointer, since the Pointer may not know its length, or may + * be longer than just this struct. + */ + if (src->pointer->address != NULL) { + dst->rbPointer = rbffi_MemoryPointer_NewInstance(1, src->layout->size, false); + dst->pointer = MEMORY(dst->rbPointer); + memcpy(dst->pointer->address, src->pointer->address, src->layout->size); + } else { + dst->rbPointer = src->rbPointer; + dst->pointer = src->pointer; + } + + if (src->layout->referenceFieldCount > 0) { + dst->rbReferences = ALLOC_N(VALUE, dst->layout->referenceFieldCount); + memcpy(dst->rbReferences, src->rbReferences, dst->layout->referenceFieldCount * sizeof(VALUE)); + } + + return self; +} + +static VALUE +struct_class_layout(VALUE klass) +{ + VALUE layout; + if (!rb_ivar_defined(klass, id_layout_ivar)) { + rb_raise(rb_eRuntimeError, "no Struct layout configured for %s", rb_class2name(klass)); + } + + layout = rb_ivar_get(klass, id_layout_ivar); + if (!rb_obj_is_kind_of(layout, rbffi_StructLayoutClass)) { + rb_raise(rb_eRuntimeError, "invalid Struct layout for %s", rb_class2name(klass)); + } + + return layout; +} + +static StructLayout* +struct_layout(VALUE self) +{ + Struct* s = (Struct *) DATA_PTR(self); + if (s->layout != NULL) { + return s->layout; + } + + if (s->layout == NULL) { + s->rbLayout = struct_class_layout(CLASS_OF(self)); + Data_Get_Struct(s->rbLayout, StructLayout, s->layout); + } + + return s->layout; +} + +static Struct* +struct_validate(VALUE self) +{ + Struct* s; + Data_Get_Struct(self, Struct, s); + + if (struct_layout(self) == NULL) { + rb_raise(rb_eRuntimeError, "struct layout == null"); + } + + if (s->pointer == NULL) { + struct_malloc(s); + } + + return s; +} + +static void +struct_malloc(Struct* s) +{ + if (s->rbPointer == Qnil) { + s->rbPointer = rbffi_MemoryPointer_NewInstance(s->layout->size, 1, true); + + } else if (!rb_obj_is_kind_of(s->rbPointer, rbffi_AbstractMemoryClass)) { + rb_raise(rb_eRuntimeError, "invalid pointer in struct"); + } + + s->pointer = (AbstractMemory *) DATA_PTR(s->rbPointer); +} + +static void +struct_mark(Struct *s) +{ + rb_gc_mark(s->rbPointer); + rb_gc_mark(s->rbLayout); + if (s->rbReferences != NULL) { + rb_gc_mark_locations(&s->rbReferences[0], &s->rbReferences[s->layout->referenceFieldCount]); + } +} + +static void +struct_free(Struct* s) +{ + xfree(s->rbReferences); + xfree(s); +} + + +static void +store_reference_value(StructField* f, Struct* s, VALUE value) +{ + if (unlikely(f->referenceIndex == -1)) { + rb_raise(rb_eRuntimeError, "put_reference_value called for non-reference type"); + return; + } + if (s->rbReferences == NULL) { + int i; + s->rbReferences = ALLOC_N(VALUE, s->layout->referenceFieldCount); + for (i = 0; i < s->layout->referenceFieldCount; ++i) { + s->rbReferences[i] = Qnil; + } + } + + s->rbReferences[f->referenceIndex] = value; +} + + +static VALUE +struct_field(Struct* s, VALUE fieldName) +{ + StructLayout* layout = s->layout; + VALUE rbField; + + if (likely(SYMBOL_P(fieldName) && st_lookup(layout->fieldSymbolTable, fieldName, (st_data_t *) &rbField))) { + return rbField; + } + + // TODO does this ever return anything? + rbField = rb_hash_aref(layout->rbFieldMap, fieldName); + if (rbField == Qnil) { + VALUE str = rb_funcall2(fieldName, id_to_s, 0, NULL); + rb_raise(rb_eArgError, "No such field '%s'", StringValuePtr(str)); + } + + return rbField; +} + +/* + * call-seq: struct[field_name] + * @param field_name field to access + * Acces to a Struct field. + */ +static VALUE +struct_aref(VALUE self, VALUE fieldName) +{ + Struct* s; + VALUE rbField; + StructField* f; + + s = struct_validate(self); + + rbField = struct_field(s, fieldName); + f = (StructField *) DATA_PTR(rbField); + + if (f->get != NULL) { + return (*f->get)(f, s); + + } else if (f->memoryOp != NULL) { + return (*f->memoryOp->get)(s->pointer, f->offset); + + } else { + + /* call up to the ruby code to fetch the value */ + return rb_funcall2(rbField, id_get, 1, &s->rbPointer); + } +} + +/* + * call-seq: []=(field_name, value) + * @param field_name field to access + * @param value value to set to +field_name+ + * @return [value] + * Set a field in Struct. + */ +static VALUE +struct_aset(VALUE self, VALUE fieldName, VALUE value) +{ + Struct* s; + VALUE rbField; + StructField* f; + + + s = struct_validate(self); + + rbField = struct_field(s, fieldName); + f = (StructField *) DATA_PTR(rbField); + if (f->put != NULL) { + (*f->put)(f, s, value); + + } else if (f->memoryOp != NULL) { + + (*f->memoryOp->put)(s->pointer, f->offset, value); + + } else { + /* call up to the ruby code to set the value */ + VALUE argv[2]; + argv[0] = s->rbPointer; + argv[1] = value; + rb_funcall2(rbField, id_put, 2, argv); + } + + if (f->referenceRequired) { + store_reference_value(f, s, value); + } + + return value; +} + +/* + * call-seq: pointer= pointer + * @param [AbstractMemory] pointer + * @return [self] + * Make Struct point to +pointer+. + */ +static VALUE +struct_set_pointer(VALUE self, VALUE pointer) +{ + Struct* s; + StructLayout* layout; + AbstractMemory* memory; + + if (!rb_obj_is_kind_of(pointer, rbffi_AbstractMemoryClass)) { + rb_raise(rb_eTypeError, "wrong argument type %s (expected Pointer or Buffer)", + rb_obj_classname(pointer)); + return Qnil; + } + + + Data_Get_Struct(self, Struct, s); + Data_Get_Struct(pointer, AbstractMemory, memory); + layout = struct_layout(self); + + if ((int) layout->base.ffiType->size > memory->size) { + rb_raise(rb_eArgError, "memory of %ld bytes too small for struct %s (expected at least %ld)", + memory->size, rb_obj_classname(self), (long) layout->base.ffiType->size); + } + + s->pointer = MEMORY(pointer); + s->rbPointer = pointer; + rb_ivar_set(self, id_pointer_ivar, pointer); + + return self; +} + +/* + * call-seq: pointer + * @return [AbstractMemory] + * Get pointer to Struct contents. + */ +static VALUE +struct_get_pointer(VALUE self) +{ + Struct* s; + + Data_Get_Struct(self, Struct, s); + + return s->rbPointer; +} + +/* + * call-seq: layout= layout + * @param [StructLayout] layout + * @return [self] + * Set the Struct's layout. + */ +static VALUE +struct_set_layout(VALUE self, VALUE layout) +{ + Struct* s; + Data_Get_Struct(self, Struct, s); + + if (!rb_obj_is_kind_of(layout, rbffi_StructLayoutClass)) { + rb_raise(rb_eTypeError, "wrong argument type %s (expected %s)", + rb_obj_classname(layout), rb_class2name(rbffi_StructLayoutClass)); + return Qnil; + } + + Data_Get_Struct(layout, StructLayout, s->layout); + rb_ivar_set(self, id_layout_ivar, layout); + + return self; +} + +/* + * call-seq: layout + * @return [StructLayout] + * Get the Struct's layout. + */ +static VALUE +struct_get_layout(VALUE self) +{ + Struct* s; + + Data_Get_Struct(self, Struct, s); + + return s->rbLayout; +} + +/* + * call-seq: null? + * @return [Boolean] + * Test if Struct's pointer is NULL + */ +static VALUE +struct_null_p(VALUE self) +{ + Struct* s; + + Data_Get_Struct(self, Struct, s); + + return s->pointer->address == NULL ? Qtrue : Qfalse; +} + +/* + * (see Pointer#order) + */ +static VALUE +struct_order(int argc, VALUE* argv, VALUE self) +{ + Struct* s; + + Data_Get_Struct(self, Struct, s); + if (argc == 0) { + return rb_funcall(s->rbPointer, rb_intern("order"), 0); + + } else { + VALUE retval = rb_obj_dup(self); + VALUE rbPointer = rb_funcall2(s->rbPointer, rb_intern("order"), argc, argv); + struct_set_pointer(retval, rbPointer); + + return retval; + } +} + +static VALUE +inline_array_allocate(VALUE klass) +{ + InlineArray* array; + VALUE obj; + + obj = Data_Make_Struct(klass, InlineArray, inline_array_mark, -1, array); + array->rbField = Qnil; + array->rbMemory = Qnil; + + return obj; +} + +static void +inline_array_mark(InlineArray* array) +{ + rb_gc_mark(array->rbField); + rb_gc_mark(array->rbMemory); +} + +/* + * Document-method: FFI::Struct::InlineArray#initialize + * call-seq: initialize(memory, field) + * @param [AbstractMemory] memory + * @param [StructField] field + * @return [self] + */ +static VALUE +inline_array_initialize(VALUE self, VALUE rbMemory, VALUE rbField) +{ + InlineArray* array; + + Data_Get_Struct(self, InlineArray, array); + array->rbMemory = rbMemory; + array->rbField = rbField; + + Data_Get_Struct(rbMemory, AbstractMemory, array->memory); + Data_Get_Struct(rbField, StructField, array->field); + Data_Get_Struct(array->field->rbType, ArrayType, array->arrayType); + Data_Get_Struct(array->arrayType->rbComponentType, Type, array->componentType); + + array->op = get_memory_op(array->componentType); + if (array->op == NULL && array->componentType->nativeType == NATIVE_MAPPED) { + array->op = get_memory_op(((MappedType *) array->componentType)->type); + } + + array->length = array->arrayType->length; + + return self; +} + +/* + * call-seq: size + * @return [Numeric] + * Get size + */ +static VALUE +inline_array_size(VALUE self) +{ + InlineArray* array; + + Data_Get_Struct(self, InlineArray, array); + + return UINT2NUM(((ArrayType *) array->field->type)->length); +} + +static int +inline_array_offset(InlineArray* array, int index) +{ + if (index < 0 || (index >= array->length && array->length > 0)) { + rb_raise(rb_eIndexError, "index %d out of bounds", index); + } + + return (int) array->field->offset + (index * (int) array->componentType->ffiType->size); +} + +/* + * call-seq: [](index) + * @param [Numeric] index + * @return [Type, Struct] + */ +static VALUE +inline_array_aref(VALUE self, VALUE rbIndex) +{ + InlineArray* array; + + Data_Get_Struct(self, InlineArray, array); + + if (array->op != NULL) { + VALUE rbNativeValue = array->op->get(array->memory, + inline_array_offset(array, NUM2INT(rbIndex))); + if (unlikely(array->componentType->nativeType == NATIVE_MAPPED)) { + return rb_funcall(((MappedType *) array->componentType)->rbConverter, + rb_intern("from_native"), 2, rbNativeValue, Qnil); + } else { + return rbNativeValue; + } + + } else if (array->componentType->nativeType == NATIVE_STRUCT) { + VALUE rbOffset = INT2NUM(inline_array_offset(array, NUM2INT(rbIndex))); + VALUE rbLength = INT2NUM(array->componentType->ffiType->size); + VALUE rbPointer = rb_funcall(array->rbMemory, rb_intern("slice"), 2, rbOffset, rbLength); + + return rb_class_new_instance(1, &rbPointer, ((StructByValue *) array->componentType)->rbStructClass); + } else { + + rb_raise(rb_eArgError, "get not supported for %s", rb_obj_classname(array->arrayType->rbComponentType)); + return Qnil; + } +} + +/* + * call-seq: []=(index, value) + * @param [Numeric] index + * @param [Type, Struct] + * @return [value] + */ +static VALUE +inline_array_aset(VALUE self, VALUE rbIndex, VALUE rbValue) +{ + InlineArray* array; + + Data_Get_Struct(self, InlineArray, array); + + if (array->op != NULL) { + if (unlikely(array->componentType->nativeType == NATIVE_MAPPED)) { + rbValue = rb_funcall(((MappedType *) array->componentType)->rbConverter, + rb_intern("to_native"), 2, rbValue, Qnil); + } + array->op->put(array->memory, inline_array_offset(array, NUM2INT(rbIndex)), + rbValue); + + } else if (array->componentType->nativeType == NATIVE_STRUCT) { + int offset = inline_array_offset(array, NUM2INT(rbIndex)); + Struct* s; + + if (!rb_obj_is_kind_of(rbValue, rbffi_StructClass)) { + rb_raise(rb_eTypeError, "argument not an instance of struct"); + return Qnil; + } + + checkWrite(array->memory); + checkBounds(array->memory, offset, array->componentType->ffiType->size); + + Data_Get_Struct(rbValue, Struct, s); + checkRead(s->pointer); + checkBounds(s->pointer, 0, array->componentType->ffiType->size); + + memcpy(array->memory->address + offset, s->pointer->address, array->componentType->ffiType->size); + + } else { + ArrayType* arrayType; + Data_Get_Struct(array->field->rbType, ArrayType, arrayType); + + rb_raise(rb_eArgError, "set not supported for %s", rb_obj_classname(arrayType->rbComponentType)); + return Qnil; + } + + return rbValue; +} + +/* + * call-seq: each + * Yield block for each element of +self+. + */ +static VALUE +inline_array_each(VALUE self) +{ + InlineArray* array; + + int i; + + Data_Get_Struct(self, InlineArray, array); + + for (i = 0; i < array->length; ++i) { + rb_yield(inline_array_aref(self, INT2FIX(i))); + } + + return self; +} + +/* + * call-seq: to_a + * @return [Array] + * Convert +self+ to an array. + */ +static VALUE +inline_array_to_a(VALUE self) +{ + InlineArray* array; + VALUE obj; + int i; + + Data_Get_Struct(self, InlineArray, array); + obj = rb_ary_new2(array->length); + + + for (i = 0; i < array->length; ++i) { + rb_ary_push(obj, inline_array_aref(self, INT2FIX(i))); + } + + return obj; +} + +/* + * Document-method: FFI::StructLayout::CharArray#to_s + * call-seq: to_s + * @return [String] + * Convert +self+ to a string. + */ +static VALUE +inline_array_to_s(VALUE self) +{ + InlineArray* array; + VALUE argv[2]; + + Data_Get_Struct(self, InlineArray, array); + + if (array->componentType->nativeType != NATIVE_INT8 && array->componentType->nativeType != NATIVE_UINT8) { + VALUE dummy = Qnil; + return rb_call_super(0, &dummy); + } + + argv[0] = UINT2NUM(array->field->offset); + argv[1] = UINT2NUM(array->length); + + return rb_funcall2(array->rbMemory, rb_intern("get_string"), 2, argv); +} + +/* + * call-seq: to_ptr + * @return [AbstractMemory] + * Get pointer to +self+ content. + */ +static VALUE +inline_array_to_ptr(VALUE self) +{ + InlineArray* array; + + Data_Get_Struct(self, InlineArray, array); + + return rb_funcall(array->rbMemory, rb_intern("slice"), 2, + UINT2NUM(array->field->offset), UINT2NUM(array->arrayType->base.ffiType->size)); +} + + +void +rbffi_Struct_Init(VALUE moduleFFI) +{ + VALUE StructClass; + + rbffi_StructLayout_Init(moduleFFI); + + /* + * Document-class: FFI::Struct + * + * A FFI::Struct means to mirror a C struct. + * + * A Struct is defined as: + * class MyStruct < FFI::Struct + * layout :value1, :int, + * :value2, :double + * end + * and is used as: + * my_struct = MyStruct.new + * my_struct[:value1] = 12 + * + * For more information, see http://github.com/ffi/ffi/wiki/Structs + */ + rbffi_StructClass = rb_define_class_under(moduleFFI, "Struct", rb_cObject); + StructClass = rbffi_StructClass; // put on a line alone to help RDoc + rb_global_variable(&rbffi_StructClass); + + /* + * Document-class: FFI::Struct::InlineArray + */ + rbffi_StructInlineArrayClass = rb_define_class_under(rbffi_StructClass, "InlineArray", rb_cObject); + rb_global_variable(&rbffi_StructInlineArrayClass); + + /* + * Document-class: FFI::StructLayout::CharArray < FFI::Struct::InlineArray + */ + rbffi_StructLayoutCharArrayClass = rb_define_class_under(rbffi_StructLayoutClass, "CharArray", + rbffi_StructInlineArrayClass); + rb_global_variable(&rbffi_StructLayoutCharArrayClass); + + + rb_define_alloc_func(StructClass, struct_allocate); + rb_define_method(StructClass, "initialize", struct_initialize, -1); + rb_define_method(StructClass, "initialize_copy", struct_initialize_copy, 1); + rb_define_method(StructClass, "order", struct_order, -1); + + rb_define_alias(rb_singleton_class(StructClass), "alloc_in", "new"); + rb_define_alias(rb_singleton_class(StructClass), "alloc_out", "new"); + rb_define_alias(rb_singleton_class(StructClass), "alloc_inout", "new"); + rb_define_alias(rb_singleton_class(StructClass), "new_in", "new"); + rb_define_alias(rb_singleton_class(StructClass), "new_out", "new"); + rb_define_alias(rb_singleton_class(StructClass), "new_inout", "new"); + + rb_define_method(StructClass, "pointer", struct_get_pointer, 0); + rb_define_private_method(StructClass, "pointer=", struct_set_pointer, 1); + + rb_define_method(StructClass, "layout", struct_get_layout, 0); + rb_define_private_method(StructClass, "layout=", struct_set_layout, 1); + + rb_define_method(StructClass, "[]", struct_aref, 1); + rb_define_method(StructClass, "[]=", struct_aset, 2); + rb_define_method(StructClass, "null?", struct_null_p, 0); + + rb_include_module(rbffi_StructInlineArrayClass, rb_mEnumerable); + rb_define_alloc_func(rbffi_StructInlineArrayClass, inline_array_allocate); + rb_define_method(rbffi_StructInlineArrayClass, "initialize", inline_array_initialize, 2); + rb_define_method(rbffi_StructInlineArrayClass, "[]", inline_array_aref, 1); + rb_define_method(rbffi_StructInlineArrayClass, "[]=", inline_array_aset, 2); + rb_define_method(rbffi_StructInlineArrayClass, "each", inline_array_each, 0); + rb_define_method(rbffi_StructInlineArrayClass, "size", inline_array_size, 0); + rb_define_method(rbffi_StructInlineArrayClass, "to_a", inline_array_to_a, 0); + rb_define_method(rbffi_StructInlineArrayClass, "to_ptr", inline_array_to_ptr, 0); + + rb_define_method(rbffi_StructLayoutCharArrayClass, "to_s", inline_array_to_s, 0); + rb_define_alias(rbffi_StructLayoutCharArrayClass, "to_str", "to_s"); + + id_pointer_ivar = rb_intern("@pointer"); + id_layout_ivar = rb_intern("@layout"); + id_layout = rb_intern("layout"); + id_get = rb_intern("get"); + id_put = rb_intern("put"); + id_to_ptr = rb_intern("to_ptr"); + id_to_s = rb_intern("to_s"); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Struct.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Struct.h new file mode 100644 index 000000000..85e826390 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Struct.h @@ -0,0 +1,106 @@ +/* + * Copyright (c) 2008, 2009, Wayne Meissner + * Copyright (c) 2009, Luc Heinrich + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RBFFI_STRUCT_H +#define RBFFI_STRUCT_H + +#include "extconf.h" +#include "AbstractMemory.h" +#include "Type.h" +#ifdef RUBY_1_9 +#include +#else +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + + extern void rbffi_Struct_Init(VALUE ffiModule); + extern void rbffi_StructLayout_Init(VALUE ffiModule); + typedef struct StructField_ StructField; + typedef struct StructLayout_ StructLayout; + typedef struct Struct_ Struct; + + struct StructField_ { + Type* type; + unsigned int offset; + + int referenceIndex; + + bool referenceRequired; + VALUE rbType; + VALUE rbName; + + VALUE (*get)(StructField* field, Struct* s); + void (*put)(StructField* field, Struct* s, VALUE value); + + MemoryOp* memoryOp; + }; + + struct StructLayout_ { + Type base; + StructField** fields; + int fieldCount; + int size; + int align; + ffi_type** ffiTypes; + struct st_table* fieldSymbolTable; + + /** The number of reference tracking fields in this struct */ + int referenceFieldCount; + + VALUE rbFieldNames; + VALUE rbFieldMap; + VALUE rbFields; + }; + + struct Struct_ { + StructLayout* layout; + AbstractMemory* pointer; + VALUE* rbReferences; + + VALUE rbLayout; + VALUE rbPointer; + }; + + extern VALUE rbffi_StructClass, rbffi_StructLayoutClass; + extern VALUE rbffi_StructLayoutFieldClass, rbffi_StructLayoutFunctionFieldClass; + extern VALUE rbffi_StructLayoutArrayFieldClass; + extern VALUE rbffi_StructInlineArrayClass; + extern VALUE rbffi_StructLayoutCharArrayClass; + +#ifdef __cplusplus +} +#endif + +#endif /* RBFFI_STRUCT_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Struct.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Struct.o new file mode 100644 index 000000000..90d0fefc0 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Struct.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructByReference.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructByReference.c new file mode 100644 index 000000000..73e51116e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructByReference.c @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2010, Wayne Meissner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * The name of the author or authors may not be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MSC_VER +# include +#endif +#include +#include +#ifndef _MSC_VER +# include +# include +#else +# include "win32/stdbool.h" +# include "win32/stdint.h" +#endif +#include +#include + +#include +#include "rbffi.h" +#include "compat.h" + +#include "Pointer.h" +#include "Struct.h" +#include "StructByReference.h" + + +#define FFI_ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) + +static VALUE sbr_allocate(VALUE); +static VALUE sbr_initialize(VALUE, VALUE); +static void sbr_mark(StructByReference *); + +VALUE rbffi_StructByReferenceClass = Qnil; + +static VALUE +sbr_allocate(VALUE klass) +{ + StructByReference* sbr; + + VALUE obj = Data_Make_Struct(klass, StructByReference, sbr_mark, -1, sbr); + + sbr->rbStructClass = Qnil; + + return obj; +} + +/* + * call-seq: initialize(struc_class) + * @param [Struct] struct_calss + * @return [self] + * A new instance of StructByReference. + */ +static VALUE +sbr_initialize(VALUE self, VALUE rbStructClass) +{ + StructByReference* sbr = NULL; + + if (!rb_class_inherited_p(rbStructClass, rbffi_StructClass)) { + rb_raise(rb_eTypeError, "wrong type (expected subclass of FFI::Struct)"); + } + + Data_Get_Struct(self, StructByReference, sbr); + sbr->rbStructClass = rbStructClass; + + return self; +} + +static void +sbr_mark(StructByReference *sbr) +{ + rb_gc_mark(sbr->rbStructClass); +} + + +/* + * call-seq: struct_class + * @return [Struct] + * Get +struct_class+. + */ +static VALUE +sbr_struct_class(VALUE self) +{ + StructByReference* sbr; + + Data_Get_Struct(self, StructByReference, sbr); + + return sbr->rbStructClass; +} + +/* + * call-seq: native_type + * @return [Class] + * Always get {FFI::Type}::POINTER. + */ +static VALUE +sbr_native_type(VALUE self) +{ + return rb_const_get(rbffi_TypeClass, rb_intern("POINTER")); +} + +/* + * call-seq: to_native(value, ctx) + * @param [nil, Struct] value + * @param [nil] ctx + * @return [AbstractMemory] Pointer on +value+. + */ +static VALUE +sbr_to_native(VALUE self, VALUE value, VALUE ctx) +{ + StructByReference* sbr; + Struct* s; + + if (unlikely(value == Qnil)) { + return rbffi_NullPointerSingleton; + } + + Data_Get_Struct(self, StructByReference, sbr); + if (!rb_obj_is_kind_of(value, sbr->rbStructClass)) { + rb_raise(rb_eTypeError, "wrong argument type %s (expected %s)", + rb_obj_classname(value), + RSTRING_PTR(rb_class_name(sbr->rbStructClass))); + } + + Data_Get_Struct(value, Struct, s); + + return s->rbPointer; +} + +/* + * call-seq: from_native(value, ctx) + * @param [AbstractMemory] value + * @param [nil] ctx + * @return [Struct] + * Create a struct from content of memory +value+. + */ +static VALUE +sbr_from_native(VALUE self, VALUE value, VALUE ctx) +{ + StructByReference* sbr; + + Data_Get_Struct(self, StructByReference, sbr); + + return rb_class_new_instance(1, &value, sbr->rbStructClass); +} + + +void +rbffi_StructByReference_Init(VALUE moduleFFI) +{ + /* + * Document-class: FFI::StructByReference + * This class includes {FFI::DataConverter} module. + */ + rbffi_StructByReferenceClass = rb_define_class_under(moduleFFI, "StructByReference", rb_cObject); + rb_global_variable(&rbffi_StructByReferenceClass); + rb_include_module(rbffi_StructByReferenceClass, rb_const_get(moduleFFI, rb_intern("DataConverter"))); + + rb_define_alloc_func(rbffi_StructByReferenceClass, sbr_allocate); + rb_define_method(rbffi_StructByReferenceClass, "initialize", sbr_initialize, 1); + rb_define_method(rbffi_StructByReferenceClass, "struct_class", sbr_struct_class, 0); + rb_define_method(rbffi_StructByReferenceClass, "native_type", sbr_native_type, 0); + rb_define_method(rbffi_StructByReferenceClass, "to_native", sbr_to_native, 2); + rb_define_method(rbffi_StructByReferenceClass, "from_native", sbr_from_native, 2); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructByReference.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructByReference.h new file mode 100644 index 000000000..cf797af62 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructByReference.h @@ -0,0 +1,50 @@ +/* + * Copyright (c) 2009, Wayne Meissner + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * The name of the author or authors may not be used to endorse or promote + * products derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RBFFI_STRUCTBYREFERENCE_H +#define RBFFI_STRUCTBYREFERENCE_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct StructByReference_ { + VALUE rbStructClass; +} StructByReference; + +void rbffi_StructByReference_Init(VALUE moduleFFI); + +extern VALUE rbffi_StructByReferenceClass; + +#ifdef __cplusplus +} +#endif + +#endif /* RBFFI_STRUCTBYREFERENCE_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructByReference.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructByReference.o new file mode 100644 index 000000000..c2829b044 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructByReference.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructByValue.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructByValue.c new file mode 100644 index 000000000..0d9fb9c53 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructByValue.c @@ -0,0 +1,150 @@ +/* + * Copyright (c) 2009, Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MSC_VER +#include +#endif +#include +#include +#ifndef _MSC_VER +# include +# include +#else +# include "win32/stdbool.h" +# include "win32/stdint.h" +#endif +#include +#include + +#include +#include "rbffi.h" +#include "compat.h" + +#include "Type.h" +#include "StructByValue.h" +#include "Struct.h" + +#define FFI_ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) + +static VALUE sbv_allocate(VALUE); +static VALUE sbv_initialize(VALUE, VALUE); +static void sbv_mark(StructByValue *); +static void sbv_free(StructByValue *); + +VALUE rbffi_StructByValueClass = Qnil; + +static VALUE +sbv_allocate(VALUE klass) +{ + StructByValue* sbv; + + VALUE obj = Data_Make_Struct(klass, StructByValue, sbv_mark, sbv_free, sbv); + + sbv->rbStructClass = Qnil; + sbv->rbStructLayout = Qnil; + sbv->base.nativeType = NATIVE_STRUCT; + + sbv->base.ffiType = xcalloc(1, sizeof(*sbv->base.ffiType)); + sbv->base.ffiType->size = 0; + sbv->base.ffiType->alignment = 1; + sbv->base.ffiType->type = FFI_TYPE_STRUCT; + + return obj; +} + +static VALUE +sbv_initialize(VALUE self, VALUE rbStructClass) +{ + StructByValue* sbv = NULL; + StructLayout* layout = NULL; + VALUE rbLayout = Qnil; + + rbLayout = rb_ivar_get(rbStructClass, rb_intern("@layout")); + if (!rb_obj_is_instance_of(rbLayout, rbffi_StructLayoutClass)) { + rb_raise(rb_eTypeError, "wrong type in @layout ivar (expected FFI::StructLayout)"); + } + + Data_Get_Struct(rbLayout, StructLayout, layout); + Data_Get_Struct(self, StructByValue, sbv); + sbv->rbStructClass = rbStructClass; + sbv->rbStructLayout = rbLayout; + + /* We can just use everything from the ffi_type directly */ + *sbv->base.ffiType = *layout->base.ffiType; + + return self; +} + +static void +sbv_mark(StructByValue *sbv) +{ + rb_gc_mark(sbv->rbStructClass); + rb_gc_mark(sbv->rbStructLayout); +} + +static void +sbv_free(StructByValue *sbv) +{ + xfree(sbv->base.ffiType); + xfree(sbv); +} + + +static VALUE +sbv_layout(VALUE self) +{ + StructByValue* sbv; + + Data_Get_Struct(self, StructByValue, sbv); + return sbv->rbStructLayout; +} + +static VALUE +sbv_struct_class(VALUE self) +{ + StructByValue* sbv; + + Data_Get_Struct(self, StructByValue, sbv); + + return sbv->rbStructClass; +} + +void +rbffi_StructByValue_Init(VALUE moduleFFI) +{ + rbffi_StructByValueClass = rb_define_class_under(moduleFFI, "StructByValue", rbffi_TypeClass); + rb_global_variable(&rbffi_StructByValueClass); + rb_define_const(rbffi_TypeClass, "Struct", rbffi_StructByValueClass); + + rb_define_alloc_func(rbffi_StructByValueClass, sbv_allocate); + rb_define_method(rbffi_StructByValueClass, "initialize", sbv_initialize, 1); + rb_define_method(rbffi_StructByValueClass, "layout", sbv_layout, 0); + rb_define_method(rbffi_StructByValueClass, "struct_class", sbv_struct_class, 0); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructByValue.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructByValue.h new file mode 100644 index 000000000..07b27639d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructByValue.h @@ -0,0 +1,55 @@ +/* + * Copyright (c) 2009, Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RBFFI_STRUCTBYVALUE_H +#define RBFFI_STRUCTBYVALUE_H + +#include +#include "Type.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct StructByValue_ { + Type base; + VALUE rbStructClass; + VALUE rbStructLayout; +} StructByValue; + +void rbffi_StructByValue_Init(VALUE moduleFFI); + +extern VALUE rbffi_StructByValueClass; + +#ifdef __cplusplus +} +#endif + +#endif /* RBFFI_STRUCTBYVALUE_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructByValue.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructByValue.o new file mode 100644 index 000000000..e83575fa5 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructByValue.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructLayout.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructLayout.c new file mode 100644 index 000000000..483e53286 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructLayout.c @@ -0,0 +1,698 @@ +/* + * Copyright (c) 2008, 2009, Wayne Meissner + * Copyright (c) 2009, Luc Heinrich + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#ifndef _MSC_VER +# include +# include +# include +#else +# include "win32/stdbool.h" +# include "win32/stdint.h" +#endif +#include +#include "rbffi.h" +#include "compat.h" +#include "AbstractMemory.h" +#include "Pointer.h" +#include "MemoryPointer.h" +#include "Function.h" +#include "Types.h" +#include "StructByValue.h" +#include "ArrayType.h" +#include "Function.h" +#include "MappedType.h" +#include "Struct.h" + +#define FFI_ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) + +static void struct_layout_mark(StructLayout *); +static void struct_layout_free(StructLayout *); +static void struct_field_mark(StructField* ); + +VALUE rbffi_StructLayoutFieldClass = Qnil; +VALUE rbffi_StructLayoutNumberFieldClass = Qnil, rbffi_StructLayoutPointerFieldClass = Qnil; +VALUE rbffi_StructLayoutStringFieldClass = Qnil; +VALUE rbffi_StructLayoutFunctionFieldClass = Qnil, rbffi_StructLayoutArrayFieldClass = Qnil; + +VALUE rbffi_StructLayoutClass = Qnil; + + +static VALUE +struct_field_allocate(VALUE klass) +{ + StructField* field; + VALUE obj; + + obj = Data_Make_Struct(klass, StructField, struct_field_mark, -1, field); + field->rbType = Qnil; + field->rbName = Qnil; + + return obj; +} + +static void +struct_field_mark(StructField* f) +{ + rb_gc_mark(f->rbType); + rb_gc_mark(f->rbName); +} + +/* + * call-seq: initialize(name, offset, type) + * @param [String,Symbol] name + * @param [Fixnum] offset + * @param [FFI::Type] type + * @return [self] + * A new FFI::StructLayout::Field instance. + */ +static VALUE +struct_field_initialize(int argc, VALUE* argv, VALUE self) +{ + VALUE rbOffset = Qnil, rbName = Qnil, rbType = Qnil; + StructField* field; + int nargs; + + Data_Get_Struct(self, StructField, field); + + nargs = rb_scan_args(argc, argv, "3", &rbName, &rbOffset, &rbType); + + if (TYPE(rbName) != T_SYMBOL && TYPE(rbName) != T_STRING) { + rb_raise(rb_eTypeError, "wrong argument type %s (expected Symbol/String)", + rb_obj_classname(rbName)); + } + + Check_Type(rbOffset, T_FIXNUM); + + if (!rb_obj_is_kind_of(rbType, rbffi_TypeClass)) { + rb_raise(rb_eTypeError, "wrong argument type %s (expected FFI::Type)", + rb_obj_classname(rbType)); + } + + field->offset = NUM2UINT(rbOffset); + field->rbName = (TYPE(rbName) == T_SYMBOL) ? rbName : rb_str_intern(rbName); + field->rbType = rbType; + Data_Get_Struct(field->rbType, Type, field->type); + field->memoryOp = get_memory_op(field->type); + field->referenceIndex = -1; + + switch (field->type->nativeType == NATIVE_MAPPED ? ((MappedType *) field->type)->type->nativeType : field->type->nativeType) { + case NATIVE_FUNCTION: + case NATIVE_CALLBACK: + case NATIVE_POINTER: + field->referenceRequired = true; + break; + + default: + field->referenceRequired = (rb_respond_to(self, rb_intern("reference_required?")) + && RTEST(rb_funcall2(self, rb_intern("reference_required?"), 0, NULL))) + || (rb_respond_to(rbType, rb_intern("reference_required?")) + && RTEST(rb_funcall2(rbType, rb_intern("reference_required?"), 0, NULL))); + break; + } + + return self; +} + +/* + * call-seq: offset + * @return [Numeric] + * Get the field offset. + */ +static VALUE +struct_field_offset(VALUE self) +{ + StructField* field; + Data_Get_Struct(self, StructField, field); + return UINT2NUM(field->offset); +} + +/* + * call-seq: size + * @return [Numeric] + * Get the field size. + */ +static VALUE +struct_field_size(VALUE self) +{ + StructField* field; + Data_Get_Struct(self, StructField, field); + return UINT2NUM(field->type->ffiType->size); +} + +/* + * call-seq: alignment + * @return [Numeric] + * Get the field alignment. + */ +static VALUE +struct_field_alignment(VALUE self) +{ + StructField* field; + Data_Get_Struct(self, StructField, field); + return UINT2NUM(field->type->ffiType->alignment); +} + +/* + * call-seq: type + * @return [Type] + * Get the field type. + */ +static VALUE +struct_field_type(VALUE self) +{ + StructField* field; + Data_Get_Struct(self, StructField, field); + + return field->rbType; +} + +/* + * call-seq: name + * @return [Symbol] + * Get the field name. + */ +static VALUE +struct_field_name(VALUE self) +{ + StructField* field; + Data_Get_Struct(self, StructField, field); + return field->rbName; +} + +/* + * call-seq: get(pointer) + * @param [AbstractMemory] pointer pointer on a {Struct} + * @return [Object] + * Get an object of type {#type} from memory pointed by +pointer+. + */ +static VALUE +struct_field_get(VALUE self, VALUE pointer) +{ + StructField* f; + + Data_Get_Struct(self, StructField, f); + if (f->memoryOp == NULL) { + rb_raise(rb_eArgError, "get not supported for %s", rb_obj_classname(f->rbType)); + return Qnil; + } + + return (*f->memoryOp->get)(MEMORY(pointer), f->offset); +} + +/* + * call-seq: put(pointer, value) + * @param [AbstractMemory] pointer pointer on a {Struct} + * @param [Object] value this object must be a kind of {#type} + * @return [self] + * Put an object to memory pointed by +pointer+. + */ +static VALUE +struct_field_put(VALUE self, VALUE pointer, VALUE value) +{ + StructField* f; + + Data_Get_Struct(self, StructField, f); + if (f->memoryOp == NULL) { + rb_raise(rb_eArgError, "put not supported for %s", rb_obj_classname(f->rbType)); + return self; + } + + (*f->memoryOp->put)(MEMORY(pointer), f->offset, value); + + return self; +} + +/* + * call-seq: get(pointer) + * @param [AbstractMemory] pointer pointer on a {Struct} + * @return [Function] + * Get a {Function} from memory pointed by +pointer+. + */ +static VALUE +function_field_get(VALUE self, VALUE pointer) +{ + StructField* f; + + Data_Get_Struct(self, StructField, f); + + return rbffi_Function_NewInstance(f->rbType, (*rbffi_AbstractMemoryOps.pointer->get)(MEMORY(pointer), f->offset)); +} + +/* + * call-seq: put(pointer, proc) + * @param [AbstractMemory] pointer pointer to a {Struct} + * @param [Function, Proc] proc + * @return [Function] + * Set a {Function} to memory pointed by +pointer+ as a function. + * + * If a Proc is submitted as +proc+, it is automatically transformed to a {Function}. + */ +static VALUE +function_field_put(VALUE self, VALUE pointer, VALUE proc) +{ + StructField* f; + VALUE value = Qnil; + + Data_Get_Struct(self, StructField, f); + + if (NIL_P(proc) || rb_obj_is_kind_of(proc, rbffi_FunctionClass)) { + value = proc; + } else if (rb_obj_is_kind_of(proc, rb_cProc) || rb_respond_to(proc, rb_intern("call"))) { + value = rbffi_Function_ForProc(f->rbType, proc); + } else { + rb_raise(rb_eTypeError, "wrong type (expected Proc or Function)"); + } + + (*rbffi_AbstractMemoryOps.pointer->put)(MEMORY(pointer), f->offset, value); + + return self; +} + +static inline bool +isCharArray(ArrayType* arrayType) +{ + return arrayType->componentType->nativeType == NATIVE_INT8 + || arrayType->componentType->nativeType == NATIVE_UINT8; +} + +/* + * call-seq: get(pointer) + * @param [AbstractMemory] pointer pointer on a {Struct} + * @return [FFI::StructLayout::CharArray, FFI::Struct::InlineArray] + * Get an array from a {Struct}. + */ +static VALUE +array_field_get(VALUE self, VALUE pointer) +{ + StructField* f; + ArrayType* array; + VALUE argv[2]; + + Data_Get_Struct(self, StructField, f); + Data_Get_Struct(f->rbType, ArrayType, array); + + argv[0] = pointer; + argv[1] = self; + + return rb_class_new_instance(2, argv, isCharArray(array) + ? rbffi_StructLayoutCharArrayClass : rbffi_StructInlineArrayClass); +} + +/* + * call-seq: put(pointer, value) + * @param [AbstractMemory] pointer pointer on a {Struct} + * @param [String, Array] value +value+ may be a String only if array's type is a kind of +int8+ + * @return [value] + * Set an array in a {Struct}. + */ +static VALUE +array_field_put(VALUE self, VALUE pointer, VALUE value) +{ + StructField* f; + ArrayType* array; + + + Data_Get_Struct(self, StructField, f); + Data_Get_Struct(f->rbType, ArrayType, array); + + if (isCharArray(array) && rb_obj_is_instance_of(value, rb_cString)) { + VALUE argv[2]; + + argv[0] = INT2FIX(f->offset); + argv[1] = value; + + rb_funcall2(pointer, rb_intern("put_string"), 2, argv); + + } else { +#ifdef notyet + MemoryOp* op; + int count = RARRAY_LEN(value); + int i; + AbstractMemory* memory = MEMORY(pointer); + + if (count > array->length) { + rb_raise(rb_eIndexError, "array too large"); + } + + /* clear the contents in case of a short write */ + checkWrite(memory); + checkBounds(memory, f->offset, f->type->ffiType->size); + if (count < array->length) { + memset(memory->address + f->offset + (count * array->componentType->ffiType->size), + 0, (array->length - count) * array->componentType->ffiType->size); + } + + /* now copy each element in */ + if ((op = get_memory_op(array->componentType)) != NULL) { + + for (i = 0; i < count; ++i) { + (*op->put)(memory, f->offset + (i * array->componentType->ffiType->size), rb_ary_entry(value, i)); + } + + } else if (array->componentType->nativeType == NATIVE_STRUCT) { + + for (i = 0; i < count; ++i) { + VALUE entry = rb_ary_entry(value, i); + Struct* s; + + if (!rb_obj_is_kind_of(entry, rbffi_StructClass)) { + rb_raise(rb_eTypeError, "array element not an instance of FFI::Struct"); + break; + } + + Data_Get_Struct(entry, Struct, s); + checkRead(s->pointer); + checkBounds(s->pointer, 0, array->componentType->ffiType->size); + + memcpy(memory->address + f->offset + (i * array->componentType->ffiType->size), + s->pointer->address, array->componentType->ffiType->size); + } + + } else { + rb_raise(rb_eNotImpError, "put not supported for arrays of type %s", rb_obj_classname(array->rbComponentType)); + } +#else + rb_raise(rb_eNotImpError, "cannot set array field"); +#endif + } + + return value; +} + + +static VALUE +struct_layout_allocate(VALUE klass) +{ + StructLayout* layout; + VALUE obj; + + obj = Data_Make_Struct(klass, StructLayout, struct_layout_mark, struct_layout_free, layout); + layout->rbFieldMap = Qnil; + layout->rbFieldNames = Qnil; + layout->rbFields = Qnil; + layout->fieldSymbolTable = st_init_numtable(); + layout->base.ffiType = xcalloc(1, sizeof(*layout->base.ffiType)); + layout->base.ffiType->size = 0; + layout->base.ffiType->alignment = 0; + layout->base.ffiType->type = FFI_TYPE_STRUCT; + + return obj; +} + +/* + * call-seq: initialize(fields, size, align) + * @param [Array] fields + * @param [Numeric] size + * @param [Numeric] align + * @return [self] + * A new StructLayout instance. + */ +static VALUE +struct_layout_initialize(VALUE self, VALUE fields, VALUE size, VALUE align) +{ + StructLayout* layout; + ffi_type* ltype; + int i; + + Data_Get_Struct(self, StructLayout, layout); + layout->fieldCount = (int) RARRAY_LEN(fields); + layout->rbFieldMap = rb_hash_new(); + layout->rbFieldNames = rb_ary_new2(layout->fieldCount); + layout->size = (int) FFI_ALIGN(NUM2INT(size), NUM2INT(align)); + layout->align = NUM2INT(align); + layout->fields = xcalloc(layout->fieldCount, sizeof(StructField *)); + layout->ffiTypes = xcalloc(layout->fieldCount + 1, sizeof(ffi_type *)); + layout->rbFields = rb_ary_new2(layout->fieldCount); + layout->referenceFieldCount = 0; + layout->base.ffiType->elements = layout->ffiTypes; + layout->base.ffiType->size = layout->size; + layout->base.ffiType->alignment = layout->align; + + ltype = layout->base.ffiType; + for (i = 0; i < (int) layout->fieldCount; ++i) { + VALUE rbField = rb_ary_entry(fields, i); + VALUE rbName; + StructField* field; + ffi_type* ftype; + + + if (!rb_obj_is_kind_of(rbField, rbffi_StructLayoutFieldClass)) { + rb_raise(rb_eTypeError, "wrong type for field %d.", i); + } + rbName = rb_funcall2(rbField, rb_intern("name"), 0, NULL); + + Data_Get_Struct(rbField, StructField, field); + layout->fields[i] = field; + + if (field->type == NULL || field->type->ffiType == NULL) { + rb_raise(rb_eRuntimeError, "type of field %d not supported", i); + } + + ftype = field->type->ffiType; + if (ftype->size == 0 && i < ((int) layout->fieldCount - 1)) { + rb_raise(rb_eTypeError, "type of field %d has zero size", i); + } + + if (field->referenceRequired) { + field->referenceIndex = layout->referenceFieldCount++; + } + + + layout->ffiTypes[i] = ftype->size > 0 ? ftype : NULL; + st_insert(layout->fieldSymbolTable, rbName, rbField); + rb_hash_aset(layout->rbFieldMap, rbName, rbField); + rb_ary_push(layout->rbFields, rbField); + rb_ary_push(layout->rbFieldNames, rbName); + } + + if (ltype->size == 0) { + rb_raise(rb_eRuntimeError, "Struct size is zero"); + } + + return self; +} + +/* + * call-seq: [](field) + * @param [Symbol] field + * @return [StructLayout::Field] + * Get a field from the layout. + */ +static VALUE +struct_layout_union_bang(VALUE self) +{ + const ffi_type *alignment_types[] = { &ffi_type_sint8, &ffi_type_sint16, &ffi_type_sint32, &ffi_type_sint64, + &ffi_type_float, &ffi_type_double, &ffi_type_longdouble, NULL }; + StructLayout* layout; + ffi_type *t = NULL; + int count, i; + + Data_Get_Struct(self, StructLayout, layout); + + for (i = 0; alignment_types[i] != NULL; ++i) { + if (alignment_types[i]->alignment == layout->align) { + t = (ffi_type *) alignment_types[i]; + break; + } + } + if (t == NULL) { + rb_raise(rb_eRuntimeError, "cannot create libffi union representation for alignment %d", layout->align); + return Qnil; + } + + count = (int) layout->size / (int) t->size; + xfree(layout->ffiTypes); + layout->ffiTypes = xcalloc(count + 1, sizeof(ffi_type *)); + layout->base.ffiType->elements = layout->ffiTypes; + + for (i = 0; i < count; ++i) { + layout->ffiTypes[i] = t; + } + + return self; +} + +static VALUE +struct_layout_aref(VALUE self, VALUE field) +{ + StructLayout* layout; + + Data_Get_Struct(self, StructLayout, layout); + + return rb_hash_aref(layout->rbFieldMap, field); +} + +/* + * call-seq: fields + * @return [Array] + * Get fields list. + */ +static VALUE +struct_layout_fields(VALUE self) +{ + StructLayout* layout; + + Data_Get_Struct(self, StructLayout, layout); + + return rb_ary_dup(layout->rbFields); +} + +/* + * call-seq: members + * @return [Array] + * Get list of field names. + */ +static VALUE +struct_layout_members(VALUE self) +{ + StructLayout* layout; + + Data_Get_Struct(self, StructLayout, layout); + + return rb_ary_dup(layout->rbFieldNames); +} + +/* + * call-seq: to_a + * @return [Array] + * Get an array of fields. + */ +static VALUE +struct_layout_to_a(VALUE self) +{ + StructLayout* layout; + + Data_Get_Struct(self, StructLayout, layout); + + return rb_ary_dup(layout->rbFields); +} + +static void +struct_layout_mark(StructLayout *layout) +{ + rb_gc_mark(layout->rbFieldMap); + rb_gc_mark(layout->rbFieldNames); + rb_gc_mark(layout->rbFields); +} + +static void +struct_layout_free(StructLayout *layout) +{ + xfree(layout->ffiTypes); + xfree(layout->base.ffiType); + xfree(layout->fields); + st_free_table(layout->fieldSymbolTable); + xfree(layout); +} + + +void +rbffi_StructLayout_Init(VALUE moduleFFI) +{ + VALUE ffi_Type = rbffi_TypeClass; + + /* + * Document-class: FFI::StructLayout < FFI::Type + * + * This class aims at defining a struct layout. + */ + rbffi_StructLayoutClass = rb_define_class_under(moduleFFI, "StructLayout", ffi_Type); + rb_global_variable(&rbffi_StructLayoutClass); + + /* + * Document-class: FFI::StructLayout::Field + * A field in a {StructLayout}. + */ + rbffi_StructLayoutFieldClass = rb_define_class_under(rbffi_StructLayoutClass, "Field", rb_cObject); + rb_global_variable(&rbffi_StructLayoutFieldClass); + + /* + * Document-class: FFI::StructLayout::Number + * A numeric {Field} in a {StructLayout}. + */ + rbffi_StructLayoutNumberFieldClass = rb_define_class_under(rbffi_StructLayoutClass, "Number", rbffi_StructLayoutFieldClass); + rb_global_variable(&rbffi_StructLayoutNumberFieldClass); + + /* + * Document-class: FFI::StructLayout::String + * A string {Field} in a {StructLayout}. + */ + rbffi_StructLayoutStringFieldClass = rb_define_class_under(rbffi_StructLayoutClass, "String", rbffi_StructLayoutFieldClass); + rb_global_variable(&rbffi_StructLayoutStringFieldClass); + + /* + * Document-class: FFI::StructLayout::Pointer + * A pointer {Field} in a {StructLayout}. + */ + rbffi_StructLayoutPointerFieldClass = rb_define_class_under(rbffi_StructLayoutClass, "Pointer", rbffi_StructLayoutFieldClass); + rb_global_variable(&rbffi_StructLayoutPointerFieldClass); + + /* + * Document-class: FFI::StructLayout::Function + * A function pointer {Field} in a {StructLayout}. + */ + rbffi_StructLayoutFunctionFieldClass = rb_define_class_under(rbffi_StructLayoutClass, "Function", rbffi_StructLayoutFieldClass); + rb_global_variable(&rbffi_StructLayoutFunctionFieldClass); + + /* + * Document-class: FFI::StructLayout::Array + * An array {Field} in a {StructLayout}. + */ + rbffi_StructLayoutArrayFieldClass = rb_define_class_under(rbffi_StructLayoutClass, "Array", rbffi_StructLayoutFieldClass); + rb_global_variable(&rbffi_StructLayoutArrayFieldClass); + + rb_define_alloc_func(rbffi_StructLayoutFieldClass, struct_field_allocate); + rb_define_method(rbffi_StructLayoutFieldClass, "initialize", struct_field_initialize, -1); + rb_define_method(rbffi_StructLayoutFieldClass, "offset", struct_field_offset, 0); + rb_define_method(rbffi_StructLayoutFieldClass, "size", struct_field_size, 0); + rb_define_method(rbffi_StructLayoutFieldClass, "alignment", struct_field_alignment, 0); + rb_define_method(rbffi_StructLayoutFieldClass, "name", struct_field_name, 0); + rb_define_method(rbffi_StructLayoutFieldClass, "type", struct_field_type, 0); + rb_define_method(rbffi_StructLayoutFieldClass, "put", struct_field_put, 2); + rb_define_method(rbffi_StructLayoutFieldClass, "get", struct_field_get, 1); + + rb_define_method(rbffi_StructLayoutFunctionFieldClass, "put", function_field_put, 2); + rb_define_method(rbffi_StructLayoutFunctionFieldClass, "get", function_field_get, 1); + + rb_define_method(rbffi_StructLayoutArrayFieldClass, "get", array_field_get, 1); + rb_define_method(rbffi_StructLayoutArrayFieldClass, "put", array_field_put, 2); + + rb_define_alloc_func(rbffi_StructLayoutClass, struct_layout_allocate); + rb_define_method(rbffi_StructLayoutClass, "initialize", struct_layout_initialize, 3); + rb_define_method(rbffi_StructLayoutClass, "[]", struct_layout_aref, 1); + rb_define_method(rbffi_StructLayoutClass, "fields", struct_layout_fields, 0); + rb_define_method(rbffi_StructLayoutClass, "members", struct_layout_members, 0); + rb_define_method(rbffi_StructLayoutClass, "to_a", struct_layout_to_a, 0); + rb_define_method(rbffi_StructLayoutClass, "__union!", struct_layout_union_bang, 0); + +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructLayout.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructLayout.o new file mode 100644 index 000000000..960e74288 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/StructLayout.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Thread.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Thread.c new file mode 100644 index 000000000..32ae05f72 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Thread.c @@ -0,0 +1,352 @@ +/* + * Copyright (c) 2010 Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MSC_VER +#include +#else +# include "win32/stdbool.h" +# include "win32/stdint.h" +#endif + +#if defined(__CYGWIN__) || !defined(_WIN32) +# include +# include +# include +# include +#else +# include +# define _WINSOCKAPI_ +# include +#endif +#include +#include "Thread.h" + +#ifdef _WIN32 +static volatile DWORD frame_thread_key = TLS_OUT_OF_INDEXES; +#else +static pthread_key_t thread_data_key; +struct thread_data { + rbffi_frame_t* frame; +}; +static inline struct thread_data* thread_data_get(void); + +#endif + +rbffi_frame_t* +rbffi_frame_current(void) +{ +#ifdef _WIN32 + return (rbffi_frame_t *) TlsGetValue(frame_thread_key); +#else + struct thread_data* td = (struct thread_data *) pthread_getspecific(thread_data_key); + return td != NULL ? td->frame : NULL; +#endif +} + +void +rbffi_frame_push(rbffi_frame_t* frame) +{ + memset(frame, 0, sizeof(*frame)); + frame->has_gvl = true; + frame->exc = Qnil; + +#ifdef _WIN32 + frame->prev = TlsGetValue(frame_thread_key); + TlsSetValue(frame_thread_key, frame); +#else + frame->td = thread_data_get(); + frame->prev = frame->td->frame; + frame->td->frame = frame; +#endif +} + +void +rbffi_frame_pop(rbffi_frame_t* frame) +{ +#ifdef _WIN32 + TlsSetValue(frame_thread_key, frame->prev); +#else + frame->td->frame = frame->prev; +#endif +} + +#if !(defined(HAVE_RB_THREAD_BLOCKING_REGION) || defined(HAVE_RB_THREAD_CALL_WITHOUT_GVL)) + +#if !defined(_WIN32) + +struct BlockingThread { + pthread_t tid; + VALUE (*fn)(void *); + void *data; + void (*ubf)(void *); + void *data2; + VALUE retval; + int wrfd; + int rdfd; +}; + +static void* +rbffi_blocking_thread(void* args) +{ + struct BlockingThread* thr = (struct BlockingThread *) args; + char c = 1; + VALUE retval; + + retval = (*thr->fn)(thr->data); + + pthread_testcancel(); + + thr->retval = retval; + + write(thr->wrfd, &c, sizeof(c)); + + return NULL; +} + +static VALUE +wait_for_thread(void *data) +{ + struct BlockingThread* thr = (struct BlockingThread *) data; + char c; + + if (read(thr->rdfd, &c, 1) < 1) { + rb_thread_wait_fd(thr->rdfd); + while (read(thr->rdfd, &c, 1) < 1 && rb_io_wait_readable(thr->rdfd) == Qtrue) { + ; + } + } + + return Qnil; +} + +static VALUE +cleanup_blocking_thread(void *data, VALUE exc) +{ + struct BlockingThread* thr = (struct BlockingThread *) data; + + if (thr->ubf != (void (*)(void *)) -1) { + (*thr->ubf)(thr->data2); + } else { + pthread_kill(thr->tid, SIGVTALRM); + } + + return exc; +} + +VALUE +rbffi_thread_blocking_region(VALUE (*func)(void *), void *data1, void (*ubf)(void *), void *data2) +{ + struct BlockingThread* thr; + int fd[2]; + VALUE exc; + + if (pipe(fd) < 0) { + rb_raise(rb_eSystemCallError, "pipe(2) failed"); + return Qnil; + } + fcntl(fd[0], F_SETFL, fcntl(fd[0], F_GETFL) | O_NONBLOCK); + + thr = ALLOC_N(struct BlockingThread, 1); + thr->rdfd = fd[0]; + thr->wrfd = fd[1]; + thr->fn = func; + thr->data = data1; + thr->ubf = ubf; + thr->data2 = data2; + thr->retval = Qnil; + + if (pthread_create(&thr->tid, NULL, rbffi_blocking_thread, thr) != 0) { + close(fd[0]); + close(fd[1]); + xfree(thr); + rb_raise(rb_eSystemCallError, "pipe(2) failed"); + return Qnil; + } + + exc = rb_rescue2(wait_for_thread, (VALUE) thr, cleanup_blocking_thread, (VALUE) thr, + rb_eException); + + pthread_join(thr->tid, NULL); + close(fd[1]); + close(fd[0]); + xfree(thr); + + if (exc != Qnil) { + rb_exc_raise(exc); + } + + return thr->retval; +} + +#else +/* win32 implementation */ + +struct BlockingThread { + HANDLE tid; + VALUE (*fn)(void *); + void *data; + void (*ubf)(void *); + void *data2; + VALUE retval; + int wrfd; + int rdfd; +}; + +static DWORD __stdcall +rbffi_blocking_thread(LPVOID args) +{ + struct BlockingThread* thr = (struct BlockingThread *) args; + char c = 1; + VALUE retval; + + retval = (*thr->fn)(thr->data); + thr->retval = retval; + + write(thr->wrfd, &c, sizeof(c)); + + return 0; +} + +static VALUE +wait_for_thread(void *data) +{ + struct BlockingThread* thr = (struct BlockingThread *) data; + char c, res; + fd_set rfds; + + FD_ZERO(&rfds); + FD_SET(thr->rdfd, &rfds); + rb_thread_select(thr->rdfd + 1, &rfds, NULL, NULL, NULL); + read(thr->rdfd, &c, 1); + return Qnil; +} + +static VALUE +cleanup_blocking_thread(void *data, VALUE exc) +{ + struct BlockingThread* thr = (struct BlockingThread *) data; + + if (thr->ubf != (void (*)(void *)) -1) { + (*thr->ubf)(thr->data2); + } else { + TerminateThread(thr->tid, 0); + } + + return exc; +} + +VALUE +rbffi_thread_blocking_region(VALUE (*func)(void *), void *data1, void (*ubf)(void *), void *data2) +{ + struct BlockingThread* thr; + int fd[2]; + VALUE exc; + DWORD state; + DWORD res; + + if (_pipe(fd, 1024, O_BINARY) == -1) { + rb_raise(rb_eSystemCallError, "_pipe() failed"); + return Qnil; + } + + thr = ALLOC_N(struct BlockingThread, 1); + thr->rdfd = fd[0]; + thr->wrfd = fd[1]; + thr->fn = func; + thr->data = data1; + thr->ubf = ubf; + thr->data2 = data2; + thr->retval = Qnil; + + thr->tid = CreateThread(NULL, 0, rbffi_blocking_thread, thr, 0, NULL); + if (!thr->tid) { + close(fd[0]); + close(fd[1]); + xfree(thr); + rb_raise(rb_eSystemCallError, "CreateThread() failed"); + return Qnil; + } + + exc = rb_rescue2(wait_for_thread, (VALUE) thr, cleanup_blocking_thread, (VALUE) thr, + rb_eException); + + /* The thread should be finished, already. */ + WaitForSingleObject(thr->tid, INFINITE); + CloseHandle(thr->tid); + close(fd[1]); + close(fd[0]); + xfree(thr); + + if (exc != Qnil) { + rb_exc_raise(exc); + } + + return thr->retval; +} + +#endif /* !_WIN32 */ + +#endif /* HAVE_RB_THREAD_BLOCKING_REGION */ + +#ifndef _WIN32 +static struct thread_data* thread_data_init(void); + +static inline struct thread_data* +thread_data_get(void) +{ + struct thread_data* td = (struct thread_data *) pthread_getspecific(thread_data_key); + return td != NULL ? td : thread_data_init(); +} + +static struct thread_data* +thread_data_init(void) +{ + struct thread_data* td = calloc(1, sizeof(struct thread_data)); + + pthread_setspecific(thread_data_key, td); + + return td; +} + +static void +thread_data_free(void *ptr) +{ + free(ptr); +} +#endif + +void +rbffi_Thread_Init(VALUE moduleFFI) +{ +#ifdef _WIN32 + frame_thread_key = TlsAlloc(); +#else + pthread_key_create(&thread_data_key, thread_data_free); +#endif +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Thread.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Thread.h new file mode 100644 index 000000000..c51a5a93e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Thread.h @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2010 Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RBFFI_THREAD_H +#define RBFFI_THREAD_H + +#ifndef _MSC_VER +# include +#else +# include "win32/stdbool.h" +# include "win32/stdint.h" +#endif +#include +#include "extconf.h" + +#ifdef __cplusplus +extern "C" { +#endif + + +#ifdef _WIN32 +# include +#else +# include +#endif + +typedef struct { +#ifdef _WIN32 + DWORD id; +#else + pthread_t id; +#endif + bool valid; + bool has_gvl; + VALUE exc; +} rbffi_thread_t; + +typedef struct rbffi_frame { +#ifndef _WIN32 + struct thread_data* td; +#endif + struct rbffi_frame* prev; + bool has_gvl; + VALUE exc; +} rbffi_frame_t; + +rbffi_frame_t* rbffi_frame_current(void); +void rbffi_frame_push(rbffi_frame_t* frame); +void rbffi_frame_pop(rbffi_frame_t* frame); + +#ifdef HAVE_RB_THREAD_CALL_WITHOUT_GVL +# define rbffi_thread_blocking_region rb_thread_call_without_gvl + +#elif defined(HAVE_RB_THREAD_BLOCKING_REGION) +# define rbffi_thread_blocking_region rb_thread_blocking_region + +#else + +VALUE rbffi_thread_blocking_region(VALUE (*func)(void *), void *data1, void (*ubf)(void *), void *data2); + +#endif + + +#ifdef __cplusplus +} +#endif + +#endif /* RBFFI_THREAD_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Thread.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Thread.o new file mode 100644 index 000000000..b6323ee21 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Thread.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Type.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Type.c new file mode 100644 index 000000000..034482f2c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Type.c @@ -0,0 +1,397 @@ +/* + * Copyright (c) 2009, Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MSC_VER +#include +#endif + +#include +#include +#include +#include "rbffi.h" +#include "compat.h" +#include "Types.h" +#include "Type.h" + + +typedef struct BuiltinType_ { + Type type; + char* name; +} BuiltinType; + +static void builtin_type_free(BuiltinType *); + +VALUE rbffi_TypeClass = Qnil; + +static VALUE classBuiltinType = Qnil; +static VALUE moduleNativeType = Qnil; +static VALUE typeMap = Qnil, sizeMap = Qnil; +static ID id_find_type = 0, id_type_size = 0, id_size = 0; + +static VALUE +type_allocate(VALUE klass) +{ + Type* type; + VALUE obj = Data_Make_Struct(klass, Type, NULL, -1, type); + + type->nativeType = -1; + type->ffiType = &ffi_type_void; + + return obj; +} + +/* + * Document-method: initialize + * call-seq: initialize(value) + * @param [Fixnum,Type] value + * @return [self] + */ +static VALUE +type_initialize(VALUE self, VALUE value) +{ + Type* type; + Type* other; + + Data_Get_Struct(self, Type, type); + + if (FIXNUM_P(value)) { + type->nativeType = FIX2INT(value); + } else if (rb_obj_is_kind_of(value, rbffi_TypeClass)) { + Data_Get_Struct(value, Type, other); + type->nativeType = other->nativeType; + type->ffiType = other->ffiType; + } else { + rb_raise(rb_eArgError, "wrong type"); + } + + return self; +} + +/* + * call-seq: type.size + * @return [Fixnum] + * Return type's size, in bytes. + */ +static VALUE +type_size(VALUE self) +{ + Type *type; + + Data_Get_Struct(self, Type, type); + + return INT2FIX(type->ffiType->size); +} + +/* + * call-seq: type.alignment + * @return [Fixnum] + * Get Type alignment. + */ +static VALUE +type_alignment(VALUE self) +{ + Type *type; + + Data_Get_Struct(self, Type, type); + + return INT2FIX(type->ffiType->alignment); +} + +/* + * call-seq: type.inspect + * @return [String] + * Inspect {Type} object. + */ +static VALUE +type_inspect(VALUE self) +{ + char buf[100]; + Type *type; + + Data_Get_Struct(self, Type, type); + + snprintf(buf, sizeof(buf), "#<%s:%p size=%d alignment=%d>", + rb_obj_classname(self), type, (int) type->ffiType->size, (int) type->ffiType->alignment); + + return rb_str_new2(buf); +} + +static VALUE +builtin_type_new(VALUE klass, int nativeType, ffi_type* ffiType, const char* name) +{ + BuiltinType* type; + VALUE obj = Qnil; + + obj = Data_Make_Struct(klass, BuiltinType, NULL, builtin_type_free, type); + + type->name = strdup(name); + type->type.nativeType = nativeType; + type->type.ffiType = ffiType; + + return obj; +} + +static void +builtin_type_free(BuiltinType *type) +{ + free(type->name); + xfree(type); +} + +/* + * call-seq: type.inspect + * @return [String] + * Inspect {Type::Builtin} object. + */ +static VALUE +builtin_type_inspect(VALUE self) +{ + char buf[100]; + BuiltinType *type; + + Data_Get_Struct(self, BuiltinType, type); + snprintf(buf, sizeof(buf), "#<%s:%s size=%d alignment=%d>", + rb_obj_classname(self), type->name, (int) type->type.ffiType->size, type->type.ffiType->alignment); + + return rb_str_new2(buf); +} + +int +rbffi_type_size(VALUE type) +{ + int t = TYPE(type); + + if (t == T_FIXNUM || t == T_BIGNUM) { + return NUM2INT(type); + + } else if (t == T_SYMBOL) { + /* + * Try looking up directly in the type and size maps + */ + VALUE nType; + if ((nType = rb_hash_lookup(typeMap, type)) != Qnil) { + if (rb_obj_is_kind_of(nType, rbffi_TypeClass)) { + Type* type; + Data_Get_Struct(nType, Type, type); + return (int) type->ffiType->size; + + } else if (rb_respond_to(nType, id_size)) { + return NUM2INT(rb_funcall2(nType, id_size, 0, NULL)); + } + } + + /* Not found - call up to the ruby version to resolve */ + return NUM2INT(rb_funcall2(rbffi_FFIModule, id_type_size, 1, &type)); + + } else { + return NUM2INT(rb_funcall2(type, id_size, 0, NULL)); + } +} + +VALUE +rbffi_Type_Lookup(VALUE name) +{ + int t = TYPE(name); + if (t == T_SYMBOL || t == T_STRING) { + /* + * Try looking up directly in the type Map + */ + VALUE nType; + if ((nType = rb_hash_lookup(typeMap, name)) != Qnil && rb_obj_is_kind_of(nType, rbffi_TypeClass)) { + return nType; + } + } else if (rb_obj_is_kind_of(name, rbffi_TypeClass)) { + + return name; + } + + /* Nothing found - let caller handle raising exceptions */ + return Qnil; +} + +/** + * rbffi_Type_Find() is like rbffi_Type_Lookup, but an error is raised if the + * type is not found. + */ +VALUE +rbffi_Type_Find(VALUE name) +{ + VALUE rbType = rbffi_Type_Lookup(name); + + if (!RTEST(rbType)) { + VALUE s = rb_inspect(name); + rb_raise(rb_eTypeError, "invalid type, %s", RSTRING_PTR(s)); + RB_GC_GUARD(s); + } + + return rbType; +} + +void +rbffi_Type_Init(VALUE moduleFFI) +{ + /* + * Document-class: FFI::Type + * This class manages C types. + * + * It embbed {FFI::Type::Builtin} objects as constants (for names, + * see {FFI::NativeType}). + */ + rbffi_TypeClass = rb_define_class_under(moduleFFI, "Type", rb_cObject); + + /* + * Document-constant: FFI::TypeDefs + */ + rb_define_const(moduleFFI, "TypeDefs", typeMap = rb_hash_new()); + rb_define_const(moduleFFI, "SizeTypes", sizeMap = rb_hash_new()); + rb_global_variable(&typeMap); + rb_global_variable(&sizeMap); + id_find_type = rb_intern("find_type"); + id_type_size = rb_intern("type_size"); + id_size = rb_intern("size"); + + /* + * Document-class: FFI::Type::Builtin + * Class for Built-in types. + */ + classBuiltinType = rb_define_class_under(rbffi_TypeClass, "Builtin", rbffi_TypeClass); + /* + * Document-module: FFI::NativeType + * This module defines constants for native (C) types. + * + * ==Native type constants + * Native types are defined by constants : + * * INT8, SCHAR, CHAR + * * UINT8, UCHAR + * * INT16, SHORT, SSHORT + * * UINT16, USHORT + * * INT32,, INT, SINT + * * UINT32, UINT + * * INT64, LONG_LONG, SLONG_LONG + * * UINT64, ULONG_LONG + * * LONG, SLONG + * * ULONG + * * FLOAT32, FLOAT + * * FLOAT64, DOUBLE + * * POINTER + * * CALLBACK + * * FUNCTION + * * CHAR_ARRAY + * * BOOL + * * STRING (immutable string, nul terminated) + * * STRUCT (struct-b-value param or result) + * * ARRAY (array type definition) + * * MAPPED (custom native type) + * For function return type only : + * * VOID + * For function argument type only : + * * BUFFER_IN + * * BUFFER_OUT + * * VARARGS (function takes a variable number of arguments) + * + * All these constants are exported to {FFI} module prefixed with "TYPE_". + * They are objets from {FFI::Type::Builtin} class. + */ + moduleNativeType = rb_define_module_under(moduleFFI, "NativeType"); + + /* + * Document-global: FFI::Type + */ + rb_global_variable(&rbffi_TypeClass); + rb_global_variable(&classBuiltinType); + rb_global_variable(&moduleNativeType); + + rb_define_alloc_func(rbffi_TypeClass, type_allocate); + rb_define_method(rbffi_TypeClass, "initialize", type_initialize, 1); + rb_define_method(rbffi_TypeClass, "size", type_size, 0); + rb_define_method(rbffi_TypeClass, "alignment", type_alignment, 0); + rb_define_method(rbffi_TypeClass, "inspect", type_inspect, 0); + + /* Make Type::Builtin non-allocatable */ + rb_undef_method(CLASS_OF(classBuiltinType), "new"); + rb_define_method(classBuiltinType, "inspect", builtin_type_inspect, 0); + + rb_global_variable(&rbffi_TypeClass); + rb_global_variable(&classBuiltinType); + + /* Define all the builtin types */ + #define T(x, ffiType) do { \ + VALUE t = Qnil; \ + rb_define_const(rbffi_TypeClass, #x, t = builtin_type_new(classBuiltinType, NATIVE_##x, ffiType, #x)); \ + rb_define_const(moduleNativeType, #x, t); \ + rb_define_const(moduleFFI, "TYPE_" #x, t); \ + } while(0) + + #define A(old_type, new_type) do { \ + VALUE t = rb_const_get(rbffi_TypeClass, rb_intern(#old_type)); \ + rb_const_set(rbffi_TypeClass, rb_intern(#new_type), t); \ + } while(0) + + /* + * Document-constant: FFI::Type::Builtin::VOID + */ + T(VOID, &ffi_type_void); + T(INT8, &ffi_type_sint8); + A(INT8, SCHAR); + A(INT8, CHAR); + T(UINT8, &ffi_type_uint8); + A(UINT8, UCHAR); + + T(INT16, &ffi_type_sint16); + A(INT16, SHORT); + A(INT16, SSHORT); + T(UINT16, &ffi_type_uint16); + A(UINT16, USHORT); + T(INT32, &ffi_type_sint32); + A(INT32, INT); + A(INT32, SINT); + T(UINT32, &ffi_type_uint32); + A(UINT32, UINT); + T(INT64, &ffi_type_sint64); + A(INT64, LONG_LONG); + A(INT64, SLONG_LONG); + T(UINT64, &ffi_type_uint64); + A(UINT64, ULONG_LONG); + T(LONG, &ffi_type_slong); + A(LONG, SLONG); + T(ULONG, &ffi_type_ulong); + T(FLOAT32, &ffi_type_float); + A(FLOAT32, FLOAT); + T(FLOAT64, &ffi_type_double); + A(FLOAT64, DOUBLE); + T(LONGDOUBLE, &ffi_type_longdouble); + T(POINTER, &ffi_type_pointer); + T(STRING, &ffi_type_pointer); + T(BUFFER_IN, &ffi_type_pointer); + T(BUFFER_OUT, &ffi_type_pointer); + T(BUFFER_INOUT, &ffi_type_pointer); + T(BOOL, &ffi_type_uchar); + T(VARARGS, &ffi_type_void); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Type.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Type.h new file mode 100644 index 000000000..d5522ee8a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Type.h @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2009, Wayne Meissner + * Copyright (C) 2009 Luc Heinrich + * + * This file is part of ruby-ffi. + * + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, this + * list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright notice + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * * Neither the name of the Evan Phoenix nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR + * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER + * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + */ + +#ifndef RBFFI_TYPE_H +#define RBFFI_TYPE_H + +#include +#include + +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct Type_ Type; + +#include "Types.h" + +struct Type_ { + NativeType nativeType; + ffi_type* ffiType; +}; + +extern VALUE rbffi_TypeClass; +extern VALUE rbffi_Type_Lookup(VALUE type); +extern VALUE rbffi_Type_Find(VALUE type); + +#ifdef __cplusplus +} +#endif + +#endif /* RBFFI_TYPE_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Type.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Type.o new file mode 100644 index 000000000..2a42904d9 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Type.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Types.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Types.c new file mode 100644 index 000000000..bccf8943f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Types.c @@ -0,0 +1,139 @@ +/* + * Copyright (c) 2009, Wayne Meissner + * Copyright (c) 2009, Luc Heinrich + * Copyright (c) 2009, Aman Gupta. + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include "Pointer.h" +#include "rbffi.h" +#include "Function.h" +#include "StructByValue.h" +#include "Types.h" +#include "Struct.h" +#include "MappedType.h" +#include "MemoryPointer.h" +#include "LongDouble.h" + +static ID id_from_native = 0; + + +VALUE +rbffi_NativeValue_ToRuby(Type* type, VALUE rbType, const void* ptr) +{ + switch (type->nativeType) { + case NATIVE_VOID: + return Qnil; + case NATIVE_INT8: + return INT2NUM((signed char) *(ffi_sarg *) ptr); + case NATIVE_INT16: + return INT2NUM((signed short) *(ffi_sarg *) ptr); + case NATIVE_INT32: + return INT2NUM((signed int) *(ffi_sarg *) ptr); + case NATIVE_LONG: + return LONG2NUM((signed long) *(ffi_sarg *) ptr); + case NATIVE_INT64: + return LL2NUM(*(signed long long *) ptr); + + case NATIVE_UINT8: + return UINT2NUM((unsigned char) *(ffi_arg *) ptr); + case NATIVE_UINT16: + return UINT2NUM((unsigned short) *(ffi_arg *) ptr); + case NATIVE_UINT32: + return UINT2NUM((unsigned int) *(ffi_arg *) ptr); + case NATIVE_ULONG: + return ULONG2NUM((unsigned long) *(ffi_arg *) ptr); + case NATIVE_UINT64: + return ULL2NUM(*(unsigned long long *) ptr); + + case NATIVE_FLOAT32: + return rb_float_new(*(float *) ptr); + case NATIVE_FLOAT64: + return rb_float_new(*(double *) ptr); + + case NATIVE_LONGDOUBLE: + return rbffi_longdouble_new(*(long double *) ptr); + + case NATIVE_STRING: + return (*(void **) ptr != NULL) ? rb_tainted_str_new2(*(char **) ptr) : Qnil; + case NATIVE_POINTER: + return rbffi_Pointer_NewInstance(*(void **) ptr); + case NATIVE_BOOL: + return ((unsigned char) *(ffi_arg *) ptr) ? Qtrue : Qfalse; + + case NATIVE_FUNCTION: + case NATIVE_CALLBACK: { + return *(void **) ptr != NULL + ? rbffi_Function_NewInstance(rbType, rbffi_Pointer_NewInstance(*(void **) ptr)) + : Qnil; + } + + case NATIVE_STRUCT: { + StructByValue* sbv = (StructByValue *)type; + AbstractMemory* mem; + VALUE rbMemory = rbffi_MemoryPointer_NewInstance(1, sbv->base.ffiType->size, false); + + Data_Get_Struct(rbMemory, AbstractMemory, mem); + memcpy(mem->address, ptr, sbv->base.ffiType->size); + RB_GC_GUARD(rbMemory); + RB_GC_GUARD(rbType); + + return rb_class_new_instance(1, &rbMemory, sbv->rbStructClass); + } + + case NATIVE_MAPPED: { + /* + * For mapped types, first convert to the real native type, then upcall to + * ruby to convert to the expected return type + */ + MappedType* m = (MappedType *) type; + VALUE values[2], rbReturnValue; + + values[0] = rbffi_NativeValue_ToRuby(m->type, m->rbType, ptr); + values[1] = Qnil; + + + rbReturnValue = rb_funcall2(m->rbConverter, id_from_native, 2, values); + RB_GC_GUARD(values[0]); + RB_GC_GUARD(rbType); + + return rbReturnValue; + } + + default: + rb_raise(rb_eRuntimeError, "Unknown type: %d", type->nativeType); + return Qnil; + } +} + +void +rbffi_Types_Init(VALUE moduleFFI) +{ + id_from_native = rb_intern("from_native"); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Types.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Types.h new file mode 100644 index 000000000..0d4806f85 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Types.h @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2008, 2009, Wayne Meissner + * Copyright (c) 2009, Luc Heinrich + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RBFFI_TYPES_H +#define RBFFI_TYPES_H + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + NATIVE_VOID, + NATIVE_INT8, + NATIVE_UINT8, + NATIVE_INT16, + NATIVE_UINT16, + NATIVE_INT32, + NATIVE_UINT32, + NATIVE_INT64, + NATIVE_UINT64, + NATIVE_LONG, + NATIVE_ULONG, + NATIVE_FLOAT32, + NATIVE_FLOAT64, + NATIVE_LONGDOUBLE, + NATIVE_POINTER, + NATIVE_CALLBACK, + NATIVE_FUNCTION, + NATIVE_BUFFER_IN, + NATIVE_BUFFER_OUT, + NATIVE_BUFFER_INOUT, + NATIVE_CHAR_ARRAY, + NATIVE_BOOL, + + /** An immutable string. Nul terminated, but only copies in to the native function */ + NATIVE_STRING, + + /** The function takes a variable number of arguments */ + NATIVE_VARARGS, + + /** Struct-by-value param or result */ + NATIVE_STRUCT, + + /** An array type definition */ + NATIVE_ARRAY, + + /** Custom native type */ + NATIVE_MAPPED, +} NativeType; + +#include +#include "Type.h" + +VALUE rbffi_NativeValue_ToRuby(Type* type, VALUE rbType, const void* ptr); +void rbffi_Types_Init(VALUE moduleFFI); + +#ifdef __cplusplus +} +#endif + +#endif /* RBFFI_TYPES_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Types.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Types.o new file mode 100644 index 000000000..de8829751 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Types.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Variadic.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Variadic.c new file mode 100644 index 000000000..0027be2b4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Variadic.c @@ -0,0 +1,280 @@ +/* + * Copyright (c) 2008-2010 Wayne Meissner + * Copyright (C) 2009 Andrea Fazzi + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef _MSC_VER +#include +#endif +#include + +#include +#ifndef _MSC_VER +# include +# include +#else +# include "win32/stdbool.h" +# include "win32/stdint.h" +#endif +#include + +#include +#include "rbffi.h" +#include "compat.h" + +#include "AbstractMemory.h" +#include "Pointer.h" +#include "Types.h" +#include "Type.h" +#include "LastError.h" +#include "MethodHandle.h" +#include "Call.h" +#include "Thread.h" + +typedef struct VariadicInvoker_ { + VALUE rbAddress; + VALUE rbReturnType; + VALUE rbEnums; + + Type* returnType; + ffi_abi abi; + void* function; + int paramCount; +} VariadicInvoker; + + +static VALUE variadic_allocate(VALUE klass); +static VALUE variadic_initialize(VALUE self, VALUE rbFunction, VALUE rbParameterTypes, + VALUE rbReturnType, VALUE options); +static void variadic_mark(VariadicInvoker *); + +static VALUE classVariadicInvoker = Qnil; + + +static VALUE +variadic_allocate(VALUE klass) +{ + VariadicInvoker *invoker; + VALUE obj = Data_Make_Struct(klass, VariadicInvoker, variadic_mark, -1, invoker); + + invoker->rbAddress = Qnil; + invoker->rbEnums = Qnil; + invoker->rbReturnType = Qnil; + + return obj; +} + +static void +variadic_mark(VariadicInvoker *invoker) +{ + rb_gc_mark(invoker->rbEnums); + rb_gc_mark(invoker->rbAddress); + rb_gc_mark(invoker->rbReturnType); +} + +static VALUE +variadic_initialize(VALUE self, VALUE rbFunction, VALUE rbParameterTypes, VALUE rbReturnType, VALUE options) +{ + VariadicInvoker* invoker = NULL; + VALUE retval = Qnil; + VALUE convention = Qnil; + VALUE fixed = Qnil; +#if defined(X86_WIN32) + VALUE rbConventionStr; +#endif + int i; + + Check_Type(options, T_HASH); + convention = rb_hash_aref(options, ID2SYM(rb_intern("convention"))); + + Data_Get_Struct(self, VariadicInvoker, invoker); + invoker->rbEnums = rb_hash_aref(options, ID2SYM(rb_intern("enums"))); + invoker->rbAddress = rbFunction; + invoker->function = rbffi_AbstractMemory_Cast(rbFunction, rbffi_PointerClass)->address; + +#if defined(X86_WIN32) + rbConventionStr = rb_funcall2(convention, rb_intern("to_s"), 0, NULL); + invoker->abi = (RTEST(convention) && strcmp(StringValueCStr(rbConventionStr), "stdcall") == 0) + ? FFI_STDCALL : FFI_DEFAULT_ABI; +#else + invoker->abi = FFI_DEFAULT_ABI; +#endif + + invoker->rbReturnType = rbffi_Type_Lookup(rbReturnType); + if (!RTEST(invoker->rbReturnType)) { + VALUE typeName = rb_funcall2(rbReturnType, rb_intern("inspect"), 0, NULL); + rb_raise(rb_eTypeError, "Invalid return type (%s)", RSTRING_PTR(typeName)); + } + + Data_Get_Struct(rbReturnType, Type, invoker->returnType); + + invoker->paramCount = -1; + + fixed = rb_ary_new2(RARRAY_LEN(rbParameterTypes) - 1); + for (i = 0; i < RARRAY_LEN(rbParameterTypes); ++i) { + VALUE entry = rb_ary_entry(rbParameterTypes, i); + VALUE rbType = rbffi_Type_Lookup(entry); + Type* type; + + if (!RTEST(rbType)) { + VALUE typeName = rb_funcall2(entry, rb_intern("inspect"), 0, NULL); + rb_raise(rb_eTypeError, "Invalid parameter type (%s)", RSTRING_PTR(typeName)); + } + Data_Get_Struct(rbType, Type, type); + if (type->nativeType != NATIVE_VARARGS) { + rb_ary_push(fixed, entry); + } + } + /* + * @fixed and @type_map are used by the parameter mangling ruby code + */ + rb_iv_set(self, "@fixed", fixed); + rb_iv_set(self, "@type_map", rb_hash_aref(options, ID2SYM(rb_intern("type_map")))); + + return retval; +} + +static VALUE +variadic_invoke(VALUE self, VALUE parameterTypes, VALUE parameterValues) +{ + VariadicInvoker* invoker; + FFIStorage* params; + void* retval; + ffi_cif cif; + void** ffiValues; + ffi_type** ffiParamTypes; + ffi_type* ffiReturnType; + Type** paramTypes; + VALUE* argv; + int paramCount = 0, fixedCount = 0, i; + ffi_status ffiStatus; + rbffi_frame_t frame = { 0 }; + + Check_Type(parameterTypes, T_ARRAY); + Check_Type(parameterValues, T_ARRAY); + + Data_Get_Struct(self, VariadicInvoker, invoker); + paramCount = (int) RARRAY_LEN(parameterTypes); + paramTypes = ALLOCA_N(Type *, paramCount); + ffiParamTypes = ALLOCA_N(ffi_type *, paramCount); + params = ALLOCA_N(FFIStorage, paramCount); + ffiValues = ALLOCA_N(void*, paramCount); + argv = ALLOCA_N(VALUE, paramCount); + retval = alloca(MAX(invoker->returnType->ffiType->size, FFI_SIZEOF_ARG)); + + for (i = 0; i < paramCount; ++i) { + VALUE rbType = rb_ary_entry(parameterTypes, i); + + if (!rb_obj_is_kind_of(rbType, rbffi_TypeClass)) { + rb_raise(rb_eTypeError, "wrong type. Expected (FFI::Type)"); + } + Data_Get_Struct(rbType, Type, paramTypes[i]); + + switch (paramTypes[i]->nativeType) { + case NATIVE_INT8: + case NATIVE_INT16: + case NATIVE_INT32: + rbType = rb_const_get(rbffi_TypeClass, rb_intern("INT32")); + Data_Get_Struct(rbType, Type, paramTypes[i]); + break; + case NATIVE_UINT8: + case NATIVE_UINT16: + case NATIVE_UINT32: + rbType = rb_const_get(rbffi_TypeClass, rb_intern("UINT32")); + Data_Get_Struct(rbType, Type, paramTypes[i]); + break; + + case NATIVE_FLOAT32: + rbType = rb_const_get(rbffi_TypeClass, rb_intern("DOUBLE")); + Data_Get_Struct(rbType, Type, paramTypes[i]); + break; + + default: + break; + } + + + ffiParamTypes[i] = paramTypes[i]->ffiType; + if (ffiParamTypes[i] == NULL) { + rb_raise(rb_eArgError, "Invalid parameter type #%x", paramTypes[i]->nativeType); + } + argv[i] = rb_ary_entry(parameterValues, i); + } + + ffiReturnType = invoker->returnType->ffiType; + if (ffiReturnType == NULL) { + rb_raise(rb_eArgError, "Invalid return type"); + } + + /*Get the number of fixed args from @fixed array*/ + fixedCount = RARRAY_LEN(rb_iv_get(self, "@fixed")); + +#ifdef HAVE_FFI_PREP_CIF_VAR + ffiStatus = ffi_prep_cif_var(&cif, invoker->abi, fixedCount, paramCount, ffiReturnType, ffiParamTypes); +#else + ffiStatus = ffi_prep_cif(&cif, invoker->abi, paramCount, ffiReturnType, ffiParamTypes); +#endif + switch (ffiStatus) { + case FFI_BAD_ABI: + rb_raise(rb_eArgError, "Invalid ABI specified"); + case FFI_BAD_TYPEDEF: + rb_raise(rb_eArgError, "Invalid argument type specified"); + case FFI_OK: + break; + default: + rb_raise(rb_eArgError, "Unknown FFI error"); + } + + rbffi_SetupCallParams(paramCount, argv, -1, paramTypes, params, + ffiValues, NULL, 0, invoker->rbEnums); + + rbffi_frame_push(&frame); + ffi_call(&cif, FFI_FN(invoker->function), retval, ffiValues); + rbffi_frame_pop(&frame); + + rbffi_save_errno(); + + if (RTEST(frame.exc) && frame.exc != Qnil) { + rb_exc_raise(frame.exc); + } + + return rbffi_NativeValue_ToRuby(invoker->returnType, invoker->rbReturnType, retval); +} + + +void +rbffi_Variadic_Init(VALUE moduleFFI) +{ + classVariadicInvoker = rb_define_class_under(moduleFFI, "VariadicInvoker", rb_cObject); + rb_global_variable(&classVariadicInvoker); + + rb_define_alloc_func(classVariadicInvoker, variadic_allocate); + + rb_define_method(classVariadicInvoker, "initialize", variadic_initialize, 4); + rb_define_method(classVariadicInvoker, "invoke", variadic_invoke, 2); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Variadic.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Variadic.o new file mode 100644 index 000000000..0912c2073 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/Variadic.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/compat.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/compat.h new file mode 100644 index 000000000..4a1c64662 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/compat.h @@ -0,0 +1,83 @@ +/* + * Copyright (c) 2008, 2009, Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RBFFI_COMPAT_H +#define RBFFI_COMPAT_H + +#include + +#ifndef RARRAY_LEN +# define RARRAY_LEN(ary) RARRAY(ary)->len +#endif + +#ifndef RARRAY_PTR +# define RARRAY_PTR(ary) RARRAY(ary)->ptr +#endif + +#ifndef RSTRING_LEN +# define RSTRING_LEN(s) RSTRING(s)->len +#endif + +#ifndef RSTRING_PTR +# define RSTRING_PTR(s) RSTRING(s)->ptr +#endif + +#ifndef NUM2ULL +# define NUM2ULL(x) rb_num2ull((VALUE)x) +#endif + +#ifndef roundup +# define roundup(x, y) ((((x)+((y)-1))/(y))*(y)) +#endif + +#ifdef __GNUC__ +# define likely(x) __builtin_expect((x), 1) +# define unlikely(x) __builtin_expect((x), 0) +#else +# define likely(x) (x) +# define unlikely(x) (x) +#endif + +#ifndef MAX +# define MAX(a, b) ((a) < (b) ? (b) : (a)) +#endif +#ifndef MIN +# define MIN(a, b) ((a) < (b) ? (a) : (b)) +#endif + +#ifndef RB_GC_GUARD +# define RB_GC_GUARD(x) (x) +#endif + +#ifndef RB_GC_GUARD_PTR +# define RB_GC_GUARD_PTR(x) (x) +#endif + +#endif /* RBFFI_COMPAT_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/extconf.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/extconf.h new file mode 100644 index 000000000..9588c4bbf --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/extconf.h @@ -0,0 +1,8 @@ +#ifndef EXTCONF_H +#define EXTCONF_H +#define HAVE_FFI_PREP_CLOSURE 1 +#define HAVE_RB_THREAD_BLOCKING_REGION 1 +#define HAVE_RB_THREAD_CALL_WITH_GVL 1 +#define HAVE_RB_THREAD_CALL_WITHOUT_GVL 1 +#define RUBY_1_9 1 +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/extconf.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/extconf.rb new file mode 100644 index 000000000..180634f42 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/extconf.rb @@ -0,0 +1,65 @@ +#!/usr/bin/env ruby + +if !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx' + require 'mkmf' + require 'rbconfig' + dir_config("ffi_c") + + # recent versions of ruby add restrictive ansi and warning flags on a whim - kill them all + $warnflags = '' + $CFLAGS.gsub!(/[\s+]-ansi/, '') + $CFLAGS.gsub!(/[\s+]-std=[^\s]+/, '') + # solaris 10 needs -c99 for + $CFLAGS << " -std=c99" if RbConfig::CONFIG['host_os'] =~ /solaris(!?2\.11)/ + + if ENV['RUBY_CC_VERSION'].nil? && (pkg_config("libffi") || + have_header("ffi.h") || + find_header("ffi.h", "/usr/local/include", "/usr/include/ffi")) + + # We need at least ffi_call and ffi_prep_closure + libffi_ok = have_library("ffi", "ffi_call", [ "ffi.h" ]) || + have_library("libffi", "ffi_call", [ "ffi.h" ]) + libffi_ok &&= have_func("ffi_prep_closure") + + # Check if the raw api is available. + $defs << "-DHAVE_RAW_API" if have_func("ffi_raw_call") && have_func("ffi_prep_raw_closure") + end + + have_func('rb_thread_blocking_region') + have_func('rb_thread_call_with_gvl') + have_func('rb_thread_call_without_gvl') + have_func('ffi_prep_cif_var') + + $defs << "-DHAVE_EXTCONF_H" if $defs.empty? # needed so create_header works + $defs << "-DUSE_INTERNAL_LIBFFI" unless libffi_ok + $defs << "-DRUBY_1_9" if RUBY_VERSION >= "1.9.0" + $defs << "-DFFI_BUILDING" if RbConfig::CONFIG['host_os'] =~ /mswin/ # for compatibility with newer libffi + + create_header + + $LOCAL_LIBS << " ./libffi/.libs/libffi_convenience.lib" if !libffi_ok && RbConfig::CONFIG['host_os'] =~ /mswin/ + + create_makefile("ffi_c") + unless libffi_ok + File.open("Makefile", "a") do |mf| + mf.puts "LIBFFI_HOST=--host=#{RbConfig::CONFIG['host_alias']}" if RbConfig::CONFIG.has_key?("host_alias") + if RbConfig::CONFIG['host_os'].downcase =~ /darwin/ + mf.puts "include ${srcdir}/libffi.darwin.mk" + elsif RbConfig::CONFIG['host_os'].downcase =~ /bsd/ + mf.puts '.include "${srcdir}/libffi.bsd.mk"' + elsif RbConfig::CONFIG['host_os'].downcase =~ /mswin64/ + mf.puts '!include $(srcdir)/libffi.vc64.mk' + elsif RbConfig::CONFIG['host_os'].downcase =~ /mswin32/ + mf.puts '!include $(srcdir)/libffi.vc.mk' + else + mf.puts "include ${srcdir}/libffi.mk" + end + end + end + +else + File.open("Makefile", "w") do |mf| + mf.puts "# Dummy makefile for non-mri rubies" + mf.puts "all install::\n" + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ffi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ffi.c new file mode 100644 index 000000000..ea9a05876 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ffi.c @@ -0,0 +1,98 @@ +/* + * Copyright (c) 2008, 2009, Wayne Meissner + * Copyright (C) 2009 Luc Heinrich + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include + +#include + +#include "rbffi.h" +#include "AbstractMemory.h" +#include "Pointer.h" +#include "MemoryPointer.h" +#include "Struct.h" +#include "StructByValue.h" +#include "StructByReference.h" +#include "DynamicLibrary.h" +#include "Platform.h" +#include "Types.h" +#include "LastError.h" +#include "Function.h" +#include "ClosurePool.h" +#include "MethodHandle.h" +#include "Call.h" +#include "ArrayType.h" +#include "MappedType.h" + +void Init_ffi_c(void); + +VALUE rbffi_FFIModule = Qnil; + +static VALUE moduleFFI = Qnil; + +void +Init_ffi_c(void) +{ + /* + * Document-module: FFI + * + * This module embbed type constants from {FFI::NativeType}. + */ + rbffi_FFIModule = moduleFFI = rb_define_module("FFI"); + rb_global_variable(&rbffi_FFIModule); + + rbffi_Thread_Init(rbffi_FFIModule); + + /* FFI::Type needs to be initialized before most other classes */ + rbffi_Type_Init(moduleFFI); + + rbffi_DataConverter_Init(moduleFFI); + + rbffi_ArrayType_Init(moduleFFI); + rbffi_LastError_Init(moduleFFI); + rbffi_Call_Init(moduleFFI); + rbffi_ClosurePool_Init(moduleFFI); + rbffi_MethodHandle_Init(moduleFFI); + rbffi_Platform_Init(moduleFFI); + rbffi_AbstractMemory_Init(moduleFFI); + rbffi_Pointer_Init(moduleFFI); + rbffi_Function_Init(moduleFFI); + rbffi_MemoryPointer_Init(moduleFFI); + rbffi_Buffer_Init(moduleFFI); + rbffi_StructByValue_Init(moduleFFI); + rbffi_StructByReference_Init(moduleFFI); + rbffi_Struct_Init(moduleFFI); + rbffi_DynamicLibrary_Init(moduleFFI); + rbffi_Variadic_Init(moduleFFI); + rbffi_Types_Init(moduleFFI); + rbffi_MappedType_Init(moduleFFI); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ffi.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ffi.o new file mode 100644 index 000000000..68be41411 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ffi.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ffi_c.bundle b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ffi_c.bundle new file mode 100755 index 000000000..1fedb0a88 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/ffi_c.bundle differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi.bsd.mk b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi.bsd.mk new file mode 100644 index 000000000..16ec6b5e4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi.bsd.mk @@ -0,0 +1,34 @@ +# -*- makefile -*- +# +# Makefile for BSD systems +# + +INCFLAGS += -I${LIBFFI_BUILD_DIR}/include +LOCAL_LIBS += ${LIBFFI} -lpthread + +LIBFFI_CFLAGS = ${FFI_MMAP_EXEC} -pthread +LIBFFI_BUILD_DIR = ${.CURDIR}/libffi-${arch} + +.if ${srcdir} == "." + LIBFFI_SRC_DIR := ${.CURDIR}/libffi +.else + LIBFFI_SRC_DIR := ${srcdir}/libffi +.endif + + +LIBFFI = ${LIBFFI_BUILD_DIR}/.libs/libffi_convenience.a +LIBFFI_CONFIGURE = ${LIBFFI_SRC_DIR}/configure --disable-static \ + --with-pic=yes --disable-dependency-tracking + +$(OBJS): ${LIBFFI} + +$(LIBFFI): + @mkdir -p ${LIBFFI_BUILD_DIR} + @if [ ! -f ${LIBFFI_BUILD_DIR}/Makefile ]; then \ + echo "Configuring libffi"; \ + cd ${LIBFFI_BUILD_DIR} && \ + /usr/bin/env CC="${CC}" LD="${LD}" CFLAGS="${LIBFFI_CFLAGS}" GREP_OPTIONS="" \ + /bin/sh ${LIBFFI_CONFIGURE} ${LIBFFI_HOST} > /dev/null; \ + fi + @cd ${LIBFFI_BUILD_DIR} && ${MAKE} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi.darwin.mk b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi.darwin.mk new file mode 100644 index 000000000..f68badd99 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi.darwin.mk @@ -0,0 +1,95 @@ +# -*- makefile -*- + +include ${srcdir}/libffi.gnu.mk + +CCACHE := $(shell type -p ccache) +BUILD_DIR := $(shell pwd) + +INCFLAGS += -I"$(BUILD_DIR)" + +# Work out which arches we need to compile the lib for +ARCHES := +ARCHFLAGS ?= $(filter -arch %, $(CFLAGS)) + +ifneq ($(findstring -arch ppc,$(ARCHFLAGS)),) + ARCHES += ppc +endif + +ifneq ($(findstring -arch i386,$(ARCHFLAGS)),) + ARCHES += i386 +endif + +ifneq ($(findstring -arch x86_64,$(ARCHFLAGS)),) + ARCHES += x86_64 +endif + +ifeq ($(strip $(ARCHES)),) +LIBFFI_BUILD_DIR = $(BUILD_DIR)/libffi-$(arch) +# Just build the one (default) architecture +$(LIBFFI): + @mkdir -p "$(LIBFFI_BUILD_DIR)" "$(@D)" + @if [ ! -f "$(LIBFFI_BUILD_DIR)"/Makefile ]; then \ + echo "Configuring libffi"; \ + cd "$(LIBFFI_BUILD_DIR)" && \ + /usr/bin/env CC="$(CC)" LD="$(LD)" CFLAGS="$(LIBFFI_CFLAGS)" GREP_OPTIONS="" \ + /bin/sh $(LIBFFI_CONFIGURE) $(LIBFFI_HOST) > /dev/null; \ + fi + cd "$(LIBFFI_BUILD_DIR)" && $(MAKE) + +else +LIBTARGETS = $(foreach arch,$(ARCHES),"$(BUILD_DIR)"/libffi-$(arch)/.libs/libffi_convenience.a) + +# Build a fat binary and assemble +build_ffi = \ + mkdir -p "$(BUILD_DIR)"/libffi-$(1); \ + (if [ ! -f "$(BUILD_DIR)"/libffi-$(1)/Makefile ]; then \ + echo "Configuring libffi for $(1)"; \ + cd "$(BUILD_DIR)"/libffi-$(1) && \ + env CC="$(CCACHE) $(CC)" CFLAGS="-arch $(1) $(LIBFFI_CFLAGS)" LDFLAGS="-arch $(1)" \ + $(LIBFFI_CONFIGURE) --host=$(1)-apple-darwin > /dev/null; \ + fi); \ + env MACOSX_DEPLOYMENT_TARGET=10.4 $(MAKE) -C "$(BUILD_DIR)"/libffi-$(1) + +target_ffi = "$(BUILD_DIR)"/libffi-$(1)/.libs/libffi_convenience.a:; $(call build_ffi,$(1)) + +# Work out which arches we need to compile the lib for +ifneq ($(findstring ppc,$(ARCHES)),) + $(call target_ffi,ppc) +endif + +ifneq ($(findstring i386,$(ARCHES)),) + $(call target_ffi,i386) +endif + +ifneq ($(findstring x86_64,$(ARCHES)),) + $(call target_ffi,x86_64) +endif + + +$(LIBFFI): $(LIBTARGETS) + # Assemble into a FAT (x86_64, i386, ppc) library + @mkdir -p "$(@D)" + /usr/bin/libtool -static -o $@ \ + $(foreach arch, $(ARCHES),"$(BUILD_DIR)"/libffi-$(arch)/.libs/libffi_convenience.a) + @mkdir -p "$(LIBFFI_BUILD_DIR)"/include + $(RM) "$(LIBFFI_BUILD_DIR)"/include/ffi.h + @( \ + printf "#if defined(__i386__)\n"; \ + printf "#include \"libffi-i386/include/ffi.h\"\n"; \ + printf "#elif defined(__x86_64__)\n"; \ + printf "#include \"libffi-x86_64/include/ffi.h\"\n";\ + printf "#elif defined(__ppc__)\n"; \ + printf "#include \"libffi-ppc/include/ffi.h\"\n";\ + printf "#endif\n";\ + ) > "$(LIBFFI_BUILD_DIR)"/include/ffi.h + @( \ + printf "#if defined(__i386__)\n"; \ + printf "#include \"libffi-i386/include/ffitarget.h\"\n"; \ + printf "#elif defined(__x86_64__)\n"; \ + printf "#include \"libffi-x86_64/include/ffitarget.h\"\n";\ + printf "#elif defined(__ppc__)\n"; \ + printf "#include \"libffi-ppc/include/ffitarget.h\"\n";\ + printf "#endif\n";\ + ) > "$(LIBFFI_BUILD_DIR)"/include/ffitarget.h + +endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi.gnu.mk b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi.gnu.mk new file mode 100644 index 000000000..2af7a75ff --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi.gnu.mk @@ -0,0 +1,31 @@ +# -*- makefile -*- +# +# Common definitions for all systems that use GNU make +# + + +# Tack the extra deps onto the autogenerated variables +INCFLAGS += -I"$(LIBFFI_BUILD_DIR)"/include +LOCAL_LIBS += $(LIBFFI) +BUILD_DIR = $(shell pwd) +LIBFFI_CFLAGS = $(FFI_MMAP_EXEC) +LIBFFI_BUILD_DIR = $(BUILD_DIR)/libffi-$(arch) + +ifeq ($(srcdir),.) + LIBFFI_SRC_DIR := $(shell pwd)/libffi +else ifeq ($(srcdir),..) + LIBFFI_SRC_DIR := $(shell pwd)/../libffi +else + LIBFFI_SRC_DIR := $(realpath $(srcdir)/libffi) +endif + +LIBFFI = "$(LIBFFI_BUILD_DIR)"/.libs/libffi_convenience.a +LIBFFI_CONFIGURE = "$(LIBFFI_SRC_DIR)"/configure --disable-static \ + --with-pic=yes --disable-dependency-tracking + +$(OBJS): $(LIBFFI) + +# +# libffi.mk or libffi.darwin.mk contains rules for building the actual library +# + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi.mk b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi.mk new file mode 100644 index 000000000..85c15c56a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi.mk @@ -0,0 +1,13 @@ +# -*- makefile -*- + +include ${srcdir}/libffi.gnu.mk + +$(LIBFFI): + @mkdir -p "$(LIBFFI_BUILD_DIR)" "$@(D)" + @if [ ! -f "$(LIBFFI_BUILD_DIR)"/Makefile ]; then \ + echo "Configuring libffi"; \ + cd "$(LIBFFI_BUILD_DIR)" && \ + /usr/bin/env CFLAGS="$(LIBFFI_CFLAGS)" GREP_OPTIONS="" \ + /bin/sh $(LIBFFI_CONFIGURE) $(LIBFFI_HOST) > /dev/null; \ + fi + $(MAKE) -C "$(LIBFFI_BUILD_DIR)" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi.vc.mk b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi.vc.mk new file mode 100644 index 000000000..c62e55ff0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi.vc.mk @@ -0,0 +1,26 @@ +# -*- makefile -*- +# +# Makefile for msvc +# + +# Tack the extra deps onto the autogenerated variables +INCFLAGS = $(INCFLAGS) -I$(LIBFFI_BUILD_DIR)/include -I$(LIBFFI_BUILD_DIR)/src/x86 +LOCAL_LIBS = $(LOCAL_LIBS) $(LIBFFI) +BUILD_DIR = $(MAKEDIR) +LIBFFI_BUILD_DIR = $(BUILD_DIR)/libffi + +!IF "$(srcdir)" == "." +LIBFFI_SRC_DIR = $(MAKEDIR)/libffi +!ELSE +LIBFFI_SRC_DIR = $(srcdir)/libffi +!ENDIF + +LIBFFI = $(LIBFFI_BUILD_DIR)/.libs/libffi_convenience.lib + +$(OBJS): $(LIBFFI) + +$(LIBFFI): + @$(MAKEDIRS) $(LIBFFI_BUILD_DIR) + @cd $(LIBFFI_BUILD_DIR) && $(MAKE) -f Makefile.vc + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi.vc64.mk b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi.vc64.mk new file mode 100644 index 000000000..958294876 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi.vc64.mk @@ -0,0 +1,26 @@ +# -*- makefile -*- +# +# Makefile for msvc +# + +# Tack the extra deps onto the autogenerated variables +INCFLAGS = $(INCFLAGS) -I$(LIBFFI_BUILD_DIR)/include -I$(LIBFFI_BUILD_DIR)/src/x86 +LOCAL_LIBS = $(LOCAL_LIBS) $(LIBFFI) +BUILD_DIR = $(MAKEDIR) +LIBFFI_BUILD_DIR = $(BUILD_DIR)/libffi + +!IF "$(srcdir)" == "." +LIBFFI_SRC_DIR = $(MAKEDIR)/libffi +!ELSE +LIBFFI_SRC_DIR = $(srcdir)/libffi +!ENDIF + +LIBFFI = $(LIBFFI_BUILD_DIR)/.libs/libffi_convenience.lib + +$(OBJS): $(LIBFFI) + +$(LIBFFI): + @$(MAKEDIRS) $(LIBFFI_BUILD_DIR) + @cd $(LIBFFI_BUILD_DIR) && $(MAKE) -f Makefile.vc64 + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/ChangeLog b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/ChangeLog new file mode 100644 index 000000000..d5d102421 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/ChangeLog @@ -0,0 +1,4600 @@ +2011-08-22 Jasper Lievisse Adriaanse + + * configure.ac: Add OpenBSD/hppa and OpenBSD/powerpc support. + * configure: Rebuilt. + +2011-07-11 Andrew Haley + + * src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Clear icache. + +2011-06-29 Rainer Orth + + * testsuite/libffi.call/cls_double_va.c: Move PR number to comment. + * testsuite/libffi.call/cls_longdouble_va.c: Likewise. + +2011-06-29 Rainer Orth + + PR libffi/46660 + * testsuite/libffi.call/cls_double_va.c: xfail dg-output on + mips-sgi-irix6*. + * testsuite/libffi.call/cls_longdouble_va.c: Likewise. + +2011-06-14 Rainer Orth + + * testsuite/libffi.call/huge_struct.c (test_large_fn): Use PRIu8, + PRId8 instead of %hhu, %hhd. + * testsuite/libffi.call/ffitest.h [__alpha__ && __osf__] (PRId8, + PRIu8): Define. + [__sgi__] (PRId8, PRIu8): Define. + +2011-04-29 Rainer Orth + + * src/alpha/osf.S (UA_SI, FDE_ENCODING, FDE_ENCODE, FDE_ARANGE): + Define. + Use them to handle ELF vs. ECOFF differences. + [__osf__] (_GLOBAL__F_ffi_call_osf): Define. + +2011-03-30 Timothy Wall + + * src/powerpc/darwin.S: Fix unknown FDE encoding. + * src/powerpc/darwin_closure.S: ditto. + +2011-02-25 Anthony Green + + * src/powerpc/ffi.c (ffi_prep_closure_loc): Allow for more + 32-bit ABIs. + +2011-02-15 Anthony Green + + * m4/ax_cc_maxopt.m4: Don't -malign-double or use -ffast-math. + * configure: Rebuilt. + +2011-02-13 Ralf Wildenhues + + * configure: Regenerate. + +2011-02-13 Anthony Green + + * include/ffi_common.h (UNLIKELY, LIKELY): Define. + * src/x86/ffi64.c (UNLIKELY, LIKELY): Remove definition. + * src/prep_cif.c (UNLIKELY, LIKELY): Remove definition. + + * src/prep_cif.c (initialize_aggregate): Convert assertion into + FFI_BAD_TYPEDEF return. Initialize arg size and alignment to 0. + + * src/pa/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, + just return FFI_BAD_ABI when things are wrong. + * src/arm/ffi.c (ffi_prep_closure_loc): Ditto. + * src/powerpc/ffi.c (ffi_prep_closure_loc): Ditto. + * src/mips/ffi.c (ffi_prep_closure_loc): Ditto. + * src/ia64/ffi.c (ffi_prep_closure_loc): Ditto. + * src/avr32/ffi.c (ffi_prep_closure_loc): Ditto. + +2011-02-11 Anthony Green + + * src/sparc/ffi.c (ffi_prep_closure_loc): Don't ASSERT ABI test, + just return FFI_BAD_ABI when things are wrong. + +2011-02-09 Stuart Shelton + + http://bugs.gentoo.org/show_bug.cgi?id=286911 + * src/mips/ffitarget.h: Clean up error messages. + * src/java_raw_api.c (ffi_java_translate_args): Cast raw arg to + ffi_raw*. + * include/ffi.h.in: Add pragma for SGI compiler. + +2011-02-09 Anthony Green + + * configure.ac: Add powerpc64-*-darwin* support. + +2011-02-09 Anthony Green + + * README: Mention Interix. + +2011-02-09 Jonathan Callen + + * configure.ac: Add Interix to win32/cygwin/mingw case. + * configure: Ditto. + * src/closures.c: Treat Interix like Cygwin, instead of as a + generic win32. + +2011-02-09 Anthony Green + + * testsuite/libffi.call/err_bad_typedef.c: Remove xfail. + * testsuite/libffi.call/err_bad_abi.c: Remove xfail. + * src/x86/ffi64.c (UNLIKELY, LIKELY): Define. + (ffi_prep_closure_loc): Check for bad ABI. + * src/prep_cif.c (UNLIKELY, LIKELY): Define. + (initialize_aggregate): Check for bad types. + +2011-02-09 Landon Fuller + + * Makefile.am (EXTRA_DIST): Add build-ios.sh, src/arm/gentramp.sh, + src/arm/trampoline.S. + (nodist_libffi_la_SOURCES): Add src/arc/trampoline.S. + * configure.ac (FFI_EXEC_TRAMPOLINE_TABLE): Define. + * src/arm/ffi.c (ffi_trampoline_table) + (ffi_closure_trampoline_table_page, ffi_trampoline_table_entry) + (FFI_TRAMPOLINE_CODELOC_CONFIG, FFI_TRAMPOLINE_CONFIG_PAGE_OFFSET) + (FFI_TRAMPOLINE_COUNT, ffi_trampoline_lock, ffi_trampoline_tables) + (ffi_trampoline_table_alloc, ffi_closure_alloc, ffi_closure_free): + Define for FFI_EXEC_TRAMPOLINE_TABLE case (iOS). + (ffi_prep_closure_loc): Handl FFI_EXEC_TRAMPOLINE_TABLE case + separately. + * src/arm/sysv.S: Handle Apple iOS host. + * src/closures.c: Handle FFI_EXEC_TRAMPOLINE_TABLE case. + * build-ios.sh: New file. + * fficonfig.h.in, configure, Makefile.in: Rebuilt. + * README: Mention ARM iOS. + +2011-02-08 Oren Held + + * src/dlmalloc.c (_STRUCT_MALLINFO): Define in order to avoid + redefinition of mallinfo on HP-UX. + +2011-02-08 Ginn Chen + + * src/sparc/ffi.c (ffi_call): Make compatible with Solaris Studio + aggregate return ABI. Flush cache. + (ffi_prep_closure_loc): Flush cache. + +2011-02-11 Anthony Green + + From Tom Honermann : + * src/powerpc/aix.S (ffi_call_AIX): Support for xlc toolchain on + AIX. Declare .ffi_prep_args. Insert nops after branch + instructions so that the AIX linker can insert TOC reload + instructions. + * src/powerpc/aix_closure.S: Declare .ffi_closure_helper_DARWIN. + +2011-02-08 Ed + + * src/powerpc/asm.h: Fix grammar nit in comment. + +2011-02-08 Uli Link + + * include/ffi.h.in (FFI_64_BIT_MAX): Define and use. + +2011-02-09 Rainer Orth + + PR libffi/46661 + * testsuite/libffi.call/cls_pointer.c (main): Cast void * to + uintptr_t first. + * testsuite/libffi.call/cls_pointer_stack.c (main): Likewise. + +2011-02-08 Rafael Avila de Espindola + + * configure.ac: Fix x86 test for pc related relocs. + * configure: Rebuilt. + +2011-02-07 Joel Sherrill + + * libffi/src/m68k/ffi.c: Add RTEMS support for cache flushing. + Handle case when CPU variant does not have long double support. + * libffi/src/m68k/sysv.S: Add support for mc68000, Coldfire, + and cores with soft floating point. + +2011-02-07 Joel Sherrill + + * configure.ac: Add mips*-*-rtems* support. + * configure: Regenerate. + * src/mips/ffitarget.h: Ensure needed constants are available + for targets which do not have sgidefs.h. + +2011-01-26 Dave Korn + + PR target/40125 + * configure.ac (AM_LTLDFLAGS): Add -bindir option for windows DLLs. + * configure: Regenerate. + +2010-12-18 Iain Sandoe + + PR libffi/29152 + PR libffi/42378 + * src/powerpc/darwin_closure.S: Provide Darwin64 implementation, + update comments. + * src/powerpc/ffitarget.h (POWERPC_DARWIN64): New, + (FFI_TRAMPOLINE_SIZE): Update for Darwin64. + * src/powerpc/darwin.S: Provide Darwin64 implementation, + update comments. + * src/powerpc/ffi_darwin.c: Likewise. + +2010-12-06 Rainer Orth + + * configure.ac (libffi_cv_as_ascii_pseudo_op): Use double + backslashes. + (libffi_cv_as_string_pseudo_op): Likewise. + * configure: Regenerate. + +2010-12-03 Chung-Lin Tang + + * src/arm/sysv.S (ffi_closure_SYSV): Add UNWIND to .pad directive. + (ffi_closure_VFP): Same. + (ffi_call_VFP): Move down to before ffi_closure_VFP. Add '.fpu vfp' + directive. + +2010-12-01 Rainer Orth + + * testsuite/libffi.call/ffitest.h [__sgi] (PRId64, PRIu64): Define. + (PRIuPTR): Define. + +2010-11-29 Richard Henderson + Rainer Orth + + * src/x86/sysv.S (FDE_ENCODING, FDE_ENCODE): Define. + (.eh_frame): Use FDE_ENCODING. + (.LASFDE1, .LASFDE2, LASFDE3): Simplify with FDE_ENCODE. + +2010-11-22 Jacek Caban + + * configure.ac: Check for symbol underscores on mingw-w64. + * configure: Rebuilt. + * src/x86/win64.S: Correctly access extern symbols in respect to + underscores. + +2010-11-15 Rainer Orth + + * testsuite/lib/libffi-dg.exp: Rename ... + * testsuite/lib/libffi.exp: ... to this. + * libffi/testsuite/libffi.call/call.exp: Don't load libffi-dg.exp. + * libffi/testsuite/libffi.special/special.exp: Likewise. + +2010-10-28 Chung-Lin Tang + + * src/arm/ffi.c (ffi_prep_args): Add VFP register argument handling + code, new parameter, and return value. Update comments. + (ffi_prep_cif_machdep): Add case for VFP struct return values. Add + call to layout_vfp_args(). + (ffi_call_SYSV): Update declaration. + (ffi_call_VFP): New declaration. + (ffi_call): Add VFP struct return conditions. Call ffi_call_VFP() + when ABI is FFI_VFP. + (ffi_closure_VFP): New declaration. + (ffi_closure_SYSV_inner): Add new vfp_args parameter, update call to + ffi_prep_incoming_args_SYSV(). + (ffi_prep_incoming_args_SYSV): Update parameters. Add VFP argument + case handling. + (ffi_prep_closure_loc): Pass ffi_closure_VFP to trampoline + construction under VFP hard-float. + (rec_vfp_type_p): New function. + (vfp_type_p): Same. + (place_vfp_arg): Same. + (layout_vfp_args): Same. + * src/arm/ffitarget.h (ffi_abi): Add FFI_VFP. Define FFI_DEFAULT_ABI + based on __ARM_PCS_VFP. + (FFI_EXTRA_CIF_FIELDS): Define for adding VFP hard-float specific + fields. + (FFI_TYPE_STRUCT_VFP_FLOAT): Define internally used type code. + (FFI_TYPE_STRUCT_VFP_DOUBLE): Same. + * src/arm/sysv.S (ffi_call_SYSV): Change call of ffi_prep_args() to + direct call. Move function pointer load upwards. + (ffi_call_VFP): New function. + (ffi_closure_VFP): Same. + + * testsuite/lib/libffi-dg.exp (check-flags): New function. + (dg-skip-if): New function. + * testsuite/libffi.call/cls_double_va.c: Skip if target is arm*-*-* + and compiler options include -mfloat-abi=hard. + * testsuite/libffi.call/cls_longdouble_va.c: Same. + +2010-10-01 Jakub Jelinek + + PR libffi/45677 + * src/x86/ffi64.c (ffi_prep_cif_machdep): Ensure cif->bytes is + a multiple of 8. + * testsuite/libffi.call/many2.c: New test. + +2010-08-20 Mark Wielaard + + * src/closures.c (open_temp_exec_file_mnt): Check if getmntent_r + returns NULL. + +2010-08-09 Andreas Tobler + + * configure.ac: Add target powerpc64-*-freebsd*. + * configure: Regenerate. + * testsuite/libffi.call/cls_align_longdouble_split.c: Pass + -mlong-double-128 only to linux targets. + * testsuite/libffi.call/cls_align_longdouble_split2.c: Likewise. + * testsuite/libffi.call/cls_longdouble.c: Likewise. + * testsuite/libffi.call/huge_struct.c: Likewise. + +2010-08-05 Dan Witte + + * Makefile.am: Pass FFI_DEBUG define to msvcc.sh for linking to the + debug CRT when --enable-debug is given. + * configure.ac: Define it. + * msvcc.sh: Translate -g and -DFFI_DEBUG appropriately. + +2010-08-04 Dan Witte + + * src/x86/ffitarget.h: Add X86_ANY define for all x86/x86_64 + platforms. + * src/x86/ffi.c: Remove redundant ifdef checks. + * src/prep_cif.c: Push stack space computation into src/x86/ffi.c + for X86_ANY so return value space doesn't get added twice. + +2010-08-03 Neil Rashbrooke + + * msvcc.sh: Don't pass -safeseh to ml64 because behavior is buggy. + +2010-07-22 Dan Witte + + * src/*/ffitarget.h: Make FFI_LAST_ABI one past the last valid ABI. + * src/prep_cif.c: Fix ABI assertion. + * src/cris/ffi.c: Ditto. + +2010-07-10 Evan Phoenix + + * src/closures.c (selinux_enabled_check): Fix strncmp usage bug. + +2010-07-07 Dan Horák + + * include/ffi.h.in: Protect #define with #ifndef. + * src/powerpc/ffitarget.h: Ditto. + * src/s390/ffitarget.h: Ditto. + * src/sparc/ffitarget.h: Ditto. + +2010-07-07 Neil Roberts + + * src/x86/sysv.S (ffi_call_SYSV): Align the stack pointer to + 16-bytes. + +2010-07-02 Jakub Jelinek + + * Makefile.am (AM_MAKEFLAGS): Pass also mandir to submakes. + * Makefile.in: Regenerated. + +2010-05-19 Rainer Orth + + * configure.ac (libffi_cv_as_x86_pcrel): Check for illegal in as + output, too. + (libffi_cv_as_ascii_pseudo_op): Check for .ascii. + (libffi_cv_as_string_pseudo_op): Check for .string. + * configure: Regenerate. + * fficonfig.h.in: Regenerate. + * src/x86/sysv.S (.eh_frame): Use .ascii, .string or error. + +2010-05-11 Dan Witte + + * doc/libffi.tex: Document previous change. + +2010-05-11 Makoto Kato + + * src/x86/ffi.c (ffi_call): Don't copy structs passed by value. + +2010-05-05 Michael Kohler + + * src/dlmalloc.c (dlfree): Fix spelling. + * src/ia64/ffi.c (ffi_prep_cif_machdep): Ditto. + * configure.ac: Ditto. + * configure: Rebuilt. + +2010-04-13 Dan Witte + + * msvcc.sh: Build with -W3 instead of -Wall. + * src/powerpc/ffi_darwin.c: Remove build warnings. + * src/x86/ffi.c: Ditto. + * src/x86/ffitarget.h: Ditto. + +2010-04-12 Dan Witte + Walter Meinl + + * configure.ac: Add OS/2 support. + * configure: Rebuilt. + * src/closures.c: Ditto. + * src/dlmalloc.c: Ditto. + * src/x86/win32.S: Ditto. + +2010-04-07 Jakub Jelinek + + * testsuite/libffi.call/err_bad_abi.c: Remove unused args variable. + +2010-04-02 Ralf Wildenhues + + * Makefile.in: Regenerate. + * aclocal.m4: Regenerate. + * include/Makefile.in: Regenerate. + * man/Makefile.in: Regenerate. + * testsuite/Makefile.in: Regenerate. + +2010-03-30 Dan Witte + + * msvcc.sh: Disable build warnings. + * README (tested): Clarify windows build procedure. + +2010-03-15 Rainer Orth + + * configure.ac (libffi_cv_as_x86_64_unwind_section_type): New test. + * configure: Regenerate. + * fficonfig.h.in: Regenerate. + * libffi/src/x86/unix64.S (.eh_frame) + [HAVE_AS_X86_64_UNWIND_SECTION_TYPE]: Use @unwind section type. + +2010-03-14 Matthias Klose + + * src/x86/ffi64.c: Fix typo in comment. + * src/x86/ffi.c: Use /* ... */ comment style. + +2010-02-24 Rainer Orth + + * doc/libffi.texi (The Closure API): Fix typo. + * doc/libffi.info: Remove. + +2010-02-15 Matthias Klose + + * src/arm/sysv.S (__ARM_ARCH__): Define for processor + __ARM_ARCH_7EM__. + +2010-01-15 Anthony Green + + * README: Add notes on building with Microsoft Visual C++. + +2010-01-15 Daniel Witte + + * msvcc.sh: New file. + + * src/x86/win32.S: Port assembly routines to MSVC and #ifdef. + * src/x86/ffi.c: Tweak function declaration and remove excess + parens. + * include/ffi.h.in: Add __declspec(align(8)) to typedef struct + ffi_closure. + + * src/x86/ffi.c: Merge ffi_call_SYSV and ffi_call_STDCALL into new + function ffi_call_win32 on X86_WIN32. + * src/x86/win32.S (ffi_call_SYSV): Rename to ffi_call_win32. + (ffi_call_STDCALL): Remove. + + * src/prep_cif.c (ffi_prep_cif): Move stack space allocation code + to ffi_prep_cif_machdep for x86. + * src/x86/ffi.c (ffi_prep_cif_machdep): To here. + +2010-01-15 Oliver Kiddle + + * src/x86/ffitarget.h (ffi_abi): Check for __i386 and __amd64 for + Sun Studio compiler compatibility. + +2010-01-12 Conrad Irwin + + * doc/libffi.texi: Add closure example. + +2010-01-07 Rainer Orth + + PR libffi/40701 + * testsuite/libffi.call/ffitest.h [__alpha__ && __osf__] (PRIdLL, + PRIuLL, PRId64, PRIu64, PRIuPTR): Define. + * testsuite/libffi.call/cls_align_sint64.c: Add -Wno-format on + alpha*-dec-osf*. + * testsuite/libffi.call/cls_align_uint64.c: Likewise. + * testsuite/libffi.call/cls_ulonglong.c: Likewise. + * testsuite/libffi.call/return_ll1.c: Likewise. + * testsuite/libffi.call/stret_medium2.c: Likewise. + * testsuite/libffi.special/ffitestcxx.h (allocate_mmap): Cast + MAP_FAILED to char *. + +2010-01-06 Rainer Orth + + * src/mips/n32.S: Use .abicalls and .eh_frame with __GNUC__. + +2009-12-31 Anthony Green + + * README: Update for libffi 3.0.9. + +2009-12-27 Matthias Klose + + * configure.ac (HAVE_LONG_DOUBLE): Define for mips when + appropriate. + * configure: Rebuilt. + +2009-12-26 Anthony Green + + * testsuite/libffi.call/cls_longdouble_va.c: Mark as xfail for + avr32*-*-*. + * testsuite/libffi.call/cls_double_va.c: Ditto. + +2009-12-26 Andreas Tobler + + * testsuite/libffi.call/ffitest.h: Conditionally include stdint.h + and inttypes.h. + * testsuite/libffi.special/unwindtest.cc: Ditto. + +2009-12-26 Andreas Tobler + + * configure.ac: Add amd64-*-openbsd*. + * configure: Rebuilt. + * testsuite/lib/libffi-dg.exp (libffi_target_compile): Link + openbsd programs with -lpthread. + +2009-12-26 Anthony Green + + * testsuite/libffi.call/cls_double_va.c, + testsuite/libffi.call/cls_longdouble.c, + testsuite/libffi.call/cls_longdouble_va.c, + testsuite/libffi.call/cls_pointer.c, + testsuite/libffi.call/cls_pointer_stack.c: Remove xfail for + mips*-*-* and arm*-*-*. + * testsuite/libffi.call/cls_align_longdouble_split.c, + testsuite/libffi.call/cls_align_longdouble_split2.c, + testsuite/libffi.call/stret_medium2.c, + testsuite/libffi.call/stret_medium.c, + testsuite/libffi.call/stret_large.c, + testsuite/libffi.call/stret_large2.c: Remove xfail for arm*-*-*. + +2009-12-31 Kay Tietz + + * testsuite/libffi.call/ffitest.h, + testsuite/libffi.special/ffitestcxx.h (PRIdLL, PRuLL): Fix + definitions. + +2009-12-31 Carlo Bramini + + * configure.ac (AM_LTLDFLAGS): Define for windows hosts. + * Makefile.am (libffi_la_LDFLAGS): Add AM_LTLDFLAGS. + * configure: Rebuilt. + * Makefile.in: Rebuilt. + +2009-12-31 Anthony Green + Blake Chaffin. + + * testsuite/libffi.call/huge_struct.c: New test case from Blake + Chaffin @ Apple. + +2009-12-28 David Edelsohn + + * src/powerpc/ffi_darwin.c (ffi_prep_args): Copy abi and nargs to + local variables. + (aix_adjust_aggregate_sizes): New function. + (ffi_prep_cif_machdep): Call it. + +2009-12-26 Andreas Tobler + + * configure.ac: Define FFI_MMAP_EXEC_WRIT for the given targets. + * configure: Regenerate. + * fficonfig.h.in: Likewise. + * src/closures.c: Remove the FFI_MMAP_EXEC_WRIT definition for + Solaris/x86. + +2009-12-26 Andreas Schwab + + * src/powerpc/ffi.c (ffi_prep_args_SYSV): Advance intarg_count + when a float arguments is passed in memory. + (ffi_closure_helper_SYSV): Mark general registers as used up when + a 64bit or soft-float long double argument is passed in memory. + +2009-12-25 Matthias Klose + + * man/ffi_call.3: Fix #include in examples. + * doc/libffi.texi: Add dircategory. + +2009-12-25 Frank Everdij + + * include/ffi.h.in: Placed '__GNUC__' ifdef around + '__attribute__((aligned(8)))' in ffi_closure, fixes compile for + IRIX MIPSPro c99. + * include/ffi_common.h: Added '__sgi' define to non + '__attribute__((__mode__()))' integer typedefs. + * src/mips/ffi.c (ffi_call, ffi_closure_mips_inner_O32, + ffi_closure_mips_inner_N32): Added 'defined(_MIPSEB)' to BE check. + (ffi_closure_mips_inner_O32, ffi_closure_mips_inner_N32): Added + FFI_LONGDOUBLE support and alignment(N32 only). + * src/mips/ffitarget.h: Corrected '#include ' for IRIX and + fixed non '__attribute__((__mode__()))' integer typedefs. + * src/mips/n32.S: Put '#ifdef linux' around '.abicalls' and '.eh_frame' + since they are Linux/GNU Assembler specific. + +2009-12-25 Bradley Smith + + * configure.ac, Makefile.am, src/avr32/ffi.c, + src/avr32/ffitarget.h, + src/avr32/sysv.S: Add AVR32 port. + * configure, Makefile.in: Rebuilt. + +2009-12-21 Andreas Tobler + + * configure.ac: Make i?86 build on FreeBSD and OpenBSD. + * configure: Regenerate. + +2009-12-15 John David Anglin + + * testsuite/libffi.call/ffitest.h: Define PRIuPTR on PA HP-UX. + +2009-12-13 John David Anglin + + * src/pa/ffi.c (ffi_closure_inner_pa32): Handle FFI_TYPE_LONGDOUBLE + type on HP-UX. + +2009-12-11 Eric Botcazou + + * src/sparc/ffi.c (ffi_closure_sparc_inner_v9): Properly align 'long + double' arguments. + +2009-12-11 Eric Botcazou + + * testsuite/libffi.call/ffitest.h: Define PRIuPTR on Solaris < 10. + +2009-12-10 Rainer Orth + + PR libffi/40700 + * src/closures.c [X86_64 && __sun__ && __svr4__] + (FFI_MMAP_EXEC_WRIT): Define. + +2009-12-08 David Daney + + * testsuite/libffi.call/stret_medium.c: Remove xfail for mips*-*-* + * testsuite/libffi.call/cls_align_longdouble_split2.c: Same. + * testsuite/libffi.call/stret_large.c: Same. + * testsuite/libffi.call/cls_align_longdouble_split.c: Same. + * testsuite/libffi.call/stret_large2.c: Same. + * testsuite/libffi.call/stret_medium2.c: Same. + +2009-12-07 David Edelsohn + + * src/powerpc/aix_closure.S (libffi_closure_ASM): Fix tablejump + typo. + +2009-12-05 David Edelsohn + + * src/powerpc/aix.S: Update AIX32 code to be consistent with AIX64 + code. + * src/powerpc/aix_closure.S: Same. + +2009-12-05 Ralf Wildenhues + + * Makefile.in: Regenerate. + * configure: Regenerate. + * include/Makefile.in: Regenerate. + * man/Makefile.in: Regenerate. + * testsuite/Makefile.in: Regenerate. + +2009-12-04 David Edelsohn + + * src/powerpc/aix_closure.S: Reorganize 64-bit code to match + linux64_closure.S. + +2009-12-04 Uros Bizjak + + PR libffi/41908 + * src/x86/ffi64.c (classify_argument): Update from + gcc/config/i386/i386.c. + (ffi_closure_unix64_inner): Do not use the address of two consecutive + SSE registers directly. + * testsuite/libffi.call/cls_dbls_struct.c (main): Remove xfail + for x86_64 linux targets. + +2009-12-04 David Edelsohn + + * src/powerpc/ffi_darwin.c (ffi_closure_helper_DARWIN): Increment + pfr for long double split between fpr13 and stack. + +2009-12-03 David Edelsohn + + * src/powerpc/ffi_darwin.c (ffi_prep_args): Increment next_arg and + fparg_count twice for long double. + +2009-12-03 David Edelsohn + + PR libffi/42243 + * src/powerpc/ffi_darwin.c (ffi_prep_args): Remove extra parentheses. + +2009-12-03 Uros Bizjak + + * testsuite/libffi.call/cls_longdouble_va.c (main): Fix format string. + Remove xfails for x86 linux targets. + +2009-12-02 David Edelsohn + + * src/powerpc/ffi_darwin.c (ffi_prep_args): Fix typo in INT64 + case. + +2009-12-01 David Edelsohn + + * src/powerpc/aix.S (ffi_call_AIX): Convert to more standard + register usage. Call ffi_prep_args directly. Add long double + return value support. + * src/powerpc/ffi_darwin.c (ffi_prep_args): Double arg increment + applies to FFI_TYPE_DOUBLE. Correct fpr_base increment typo. + Separate FFI_TYPE_SINT32 and FFI_TYPE_UINT32 cases. + (ffi_prep_cif_machdep): Only 16 byte stack alignment in 64 bit + mode. + (ffi_closure_helper_DARWIN): Remove nf and ng counters. Move temp + into case. + * src/powerpc/aix_closure.S: Maintain 16 byte stack alignment. + Allocate result area between params and FPRs. + +2009-11-30 David Edelsohn + + PR target/35484 + * src/powerpc/ffitarget.h (POWERPC64): Define for PPC64 Linux and + AIX64. + * src/powerpc/aix.S: Implement AIX64 version. + * src/powerpc/aix_closure.S: Implement AIX64 version. + (ffi_closure_ASM): Use extsb, lha and displament addresses. + * src/powerpc/ffi_darwin.c (ffi_prep_args): Implement AIX64 + support. + (ffi_prep_cif_machdep): Same. + (ffi_call): Same. + (ffi_closure_helper_DARWIN): Same. + +2009-11-02 Andreas Tobler + + PR libffi/41908 + * testsuite/libffi.call/testclosure.c: New test. + +2009-09-28 Kai Tietz + + * src/x86/win64.S (_ffi_call_win64 stack): Remove for gnu + assembly version use of ___chkstk. + +2009-09-23 Matthias Klose + + PR libffi/40242, PR libffi/41443 + * src/arm/sysv.S (__ARM_ARCH__): Define for processors + __ARM_ARCH_6T2__, __ARM_ARCH_6M__, __ARM_ARCH_7__, + __ARM_ARCH_7A__, __ARM_ARCH_7R__, __ARM_ARCH_7M__. + Change the conditionals to __SOFTFP__ || __ARM_EABI__ + for -mfloat-abi=softfp to work. + +2009-09-17 Loren J. Rittle + + PR testsuite/32843 (strikes again) + * src/x86/ffi.c (ffi_prep_cif_machdep): Add X86_FREEBSD to + enable proper extension on char and short. + +2009-09-15 David Daney + + * src/java_raw_api.c (ffi_java_raw_to_rvalue): Remove special + handling for FFI_TYPE_POINTER. + * src/mips/ffitarget.h (FFI_TYPE_STRUCT_D_SOFT, + FFI_TYPE_STRUCT_F_SOFT, FFI_TYPE_STRUCT_DD_SOFT, + FFI_TYPE_STRUCT_FF_SOFT, FFI_TYPE_STRUCT_FD_SOFT, + FFI_TYPE_STRUCT_DF_SOFT, FFI_TYPE_STRUCT_SOFT): New defines. + (FFI_N32_SOFT_FLOAT, FFI_N64_SOFT_FLOAT): New ffi_abi enumerations. + (enum ffi_abi): Set FFI_DEFAULT_ABI for soft-float. + * src/mips/n32.S (ffi_call_N32): Add handling for soft-float + structure and pointer returns. + (ffi_closure_N32): Add handling for pointer returns. + * src/mips/ffi.c (ffi_prep_args, calc_n32_struct_flags, + calc_n32_return_struct_flags): Handle soft-float. + (ffi_prep_cif_machdep): Handle soft-float, fix pointer handling. + (ffi_call_N32): Declare proper argument types. + (ffi_call, copy_struct_N32, ffi_closure_mips_inner_N32): Handle + soft-float. + +2009-08-24 Ralf Wildenhues + + * configure.ac (AC_PREREQ): Bump to 2.64. + +2009-08-22 Ralf Wildenhues + + * Makefile.am (install-html, install-pdf): Remove. + * Makefile.in: Regenerate. + + * Makefile.in: Regenerate. + * aclocal.m4: Regenerate. + * configure: Regenerate. + * fficonfig.h.in: Regenerate. + * include/Makefile.in: Regenerate. + * man/Makefile.in: Regenerate. + * testsuite/Makefile.in: Regenerate. + +2009-07-30 Ralf Wildenhues + + * configure.ac (_AC_ARG_VAR_PRECIOUS): Use m4_rename_force. + +2009-07-24 Dave Korn + + PR libffi/40807 + * src/x86/ffi.c (ffi_prep_cif_machdep): Also use sign/zero-extending + return types for X86_WIN32. + * src/x86/win32.S (_ffi_call_SYSV): Handle omitted return types. + (_ffi_call_STDCALL, _ffi_closure_SYSV, _ffi_closure_raw_SYSV, + _ffi_closure_STDCALL): Likewise. + + * src/closures.c (is_selinux_enabled): Define to const 0 for Cygwin. + (dlmmap, dlmunmap): Also use these functions on Cygwin. + +2009-07-11 Richard Sandiford + + PR testsuite/40699 + PR testsuite/40707 + PR testsuite/40709 + * testsuite/lib/libffi-dg.exp: Revert 2009-07-02, 2009-07-01 and + 2009-06-30 commits. + +2009-07-01 Richard Sandiford + + * testsuite/lib/libffi-dg.exp (libffi-init): Set ld_library_path + to "" before adding paths. (This reinstates an assignment that + was removed by my 2009-06-30 commit, but changes the initial + value from "." to "".) + +2009-07-01 H.J. Lu + + PR testsuite/40601 + * testsuite/lib/libffi-dg.exp (libffi-init): Properly set + gccdir. Adjust ld_library_path for gcc only if gccdir isn't + empty. + +2009-06-30 Richard Sandiford + + * testsuite/lib/libffi-dg.exp (libffi-init): Don't add "." + to ld_library_path. Use add_path. Add just find_libgcc_s + to ld_library_path, not every libgcc multilib directory. + +2009-06-16 Wim Lewis + + * src/powerpc/ffi.c: Avoid clobbering cr3 and cr4, which are + supposed to be callee-saved. + * src/powerpc/sysv.S (small_struct_return_value): Fix overrun of + return buffer for odd-size structs. + +2009-06-16 Andreas Tobler + + PR libffi/40444 + * testsuite/lib/libffi-dg.exp (libffi_target_compile): Add + allow_stack_execute for Darwin. + +2009-06-16 Andrew Haley + + * configure.ac (TARGETDIR): Add missing blank lines. + * configure: Regenerate. + +2009-06-16 Andrew Haley + + * testsuite/libffi.call/cls_align_sint64.c, + testsuite/libffi.call/cls_align_uint64.c, + testsuite/libffi.call/cls_longdouble_va.c, + testsuite/libffi.call/cls_ulonglong.c, + testsuite/libffi.call/return_ll1.c, + testsuite/libffi.call/stret_medium2.c: Fix printf format + specifiers. + * testsuite/libffi.call/ffitest.h, + testsuite/libffi.special/ffitestcxx.h (PRIdLL, PRIuLL): Define. + +2009-06-15 Andrew Haley + + * testsuite/libffi.call/err_bad_typedef.c: xfail everywhere. + * testsuite/libffi.call/err_bad_abi.c: Likewise. + +2009-06-12 Andrew Haley + + * Makefile.am: Remove info_TEXINFOS. + +2009-06-12 Andrew Haley + + * ChangeLog.libffi: testsuite/libffi.call/cls_align_sint64.c, + testsuite/libffi.call/cls_align_uint64.c, + testsuite/libffi.call/cls_ulonglong.c, + testsuite/libffi.call/return_ll1.c, + testsuite/libffi.call/stret_medium2.c: Fix printf format + specifiers. + testsuite/libffi.special/unwindtest.cc: include stdint.h. + +2009-06-11 Timothy Wall + + * Makefile.am, + configure.ac, + include/ffi.h.in, + include/ffi_common.h, + src/closures.c, + src/dlmalloc.c, + src/x86/ffi.c, + src/x86/ffitarget.h, + src/x86/win64.S (new), + README: Added win64 support (mingw or MSVC) + * Makefile.in, + include/Makefile.in, + man/Makefile.in, + testsuite/Makefile.in, + configure, + aclocal.m4: Regenerated + * ltcf-c.sh: properly escape cygwin/w32 path + * man/ffi_call.3: Clarify size requirements for return value. + * src/x86/ffi64.c: Fix filename in comment. + * src/x86/win32.S: Remove unused extern. + + * testsuite/libffi.call/closure_fn0.c, + testsuite/libffi.call/closure_fn1.c, + testsuite/libffi.call/closure_fn2.c, + testsuite/libffi.call/closure_fn3.c, + testsuite/libffi.call/closure_fn4.c, + testsuite/libffi.call/closure_fn5.c, + testsuite/libffi.call/closure_fn6.c, + testsuite/libffi.call/closure_stdcall.c, + testsuite/libffi.call/cls_12byte.c, + testsuite/libffi.call/cls_16byte.c, + testsuite/libffi.call/cls_18byte.c, + testsuite/libffi.call/cls_19byte.c, + testsuite/libffi.call/cls_1_1byte.c, + testsuite/libffi.call/cls_20byte.c, + testsuite/libffi.call/cls_20byte1.c, + testsuite/libffi.call/cls_24byte.c, + testsuite/libffi.call/cls_2byte.c, + testsuite/libffi.call/cls_3_1byte.c, + testsuite/libffi.call/cls_3byte1.c, + testsuite/libffi.call/cls_3byte2.c, + testsuite/libffi.call/cls_4_1byte.c, + testsuite/libffi.call/cls_4byte.c, + testsuite/libffi.call/cls_5_1_byte.c, + testsuite/libffi.call/cls_5byte.c, + testsuite/libffi.call/cls_64byte.c, + testsuite/libffi.call/cls_6_1_byte.c, + testsuite/libffi.call/cls_6byte.c, + testsuite/libffi.call/cls_7_1_byte.c, + testsuite/libffi.call/cls_7byte.c, + testsuite/libffi.call/cls_8byte.c, + testsuite/libffi.call/cls_9byte1.c, + testsuite/libffi.call/cls_9byte2.c, + testsuite/libffi.call/cls_align_double.c, + testsuite/libffi.call/cls_align_float.c, + testsuite/libffi.call/cls_align_longdouble.c, + testsuite/libffi.call/cls_align_longdouble_split.c, + testsuite/libffi.call/cls_align_longdouble_split2.c, + testsuite/libffi.call/cls_align_pointer.c, + testsuite/libffi.call/cls_align_sint16.c, + testsuite/libffi.call/cls_align_sint32.c, + testsuite/libffi.call/cls_align_sint64.c, + testsuite/libffi.call/cls_align_uint16.c, + testsuite/libffi.call/cls_align_uint32.c, + testsuite/libffi.call/cls_align_uint64.c, + testsuite/libffi.call/cls_dbls_struct.c, + testsuite/libffi.call/cls_double.c, + testsuite/libffi.call/cls_double_va.c, + testsuite/libffi.call/cls_float.c, + testsuite/libffi.call/cls_longdouble.c, + testsuite/libffi.call/cls_longdouble_va.c, + testsuite/libffi.call/cls_multi_schar.c, + testsuite/libffi.call/cls_multi_sshort.c, + testsuite/libffi.call/cls_multi_sshortchar.c, + testsuite/libffi.call/cls_multi_uchar.c, + testsuite/libffi.call/cls_multi_ushort.c, + testsuite/libffi.call/cls_multi_ushortchar.c, + testsuite/libffi.call/cls_pointer.c, + testsuite/libffi.call/cls_pointer_stack.c, + testsuite/libffi.call/cls_schar.c, + testsuite/libffi.call/cls_sint.c, + testsuite/libffi.call/cls_sshort.c, + testsuite/libffi.call/cls_uchar.c, + testsuite/libffi.call/cls_uint.c, + testsuite/libffi.call/cls_ulonglong.c, + testsuite/libffi.call/cls_ushort.c, + testsuite/libffi.call/err_bad_abi.c, + testsuite/libffi.call/err_bad_typedef.c, + testsuite/libffi.call/float2.c, + testsuite/libffi.call/huge_struct.c, + testsuite/libffi.call/nested_struct.c, + testsuite/libffi.call/nested_struct1.c, + testsuite/libffi.call/nested_struct10.c, + testsuite/libffi.call/nested_struct2.c, + testsuite/libffi.call/nested_struct3.c, + testsuite/libffi.call/nested_struct4.c, + testsuite/libffi.call/nested_struct5.c, + testsuite/libffi.call/nested_struct6.c, + testsuite/libffi.call/nested_struct7.c, + testsuite/libffi.call/nested_struct8.c, + testsuite/libffi.call/nested_struct9.c, + testsuite/libffi.call/problem1.c, + testsuite/libffi.call/return_ldl.c, + testsuite/libffi.call/return_ll1.c, + testsuite/libffi.call/stret_large.c, + testsuite/libffi.call/stret_large2.c, + testsuite/libffi.call/stret_medium.c, + testsuite/libffi.call/stret_medium2.c, + testsuite/libffi.special/unwindtest.cc: use ffi_closure_alloc instead + of checking for MMAP. Use intptr_t instead of long casts. + +2009-06-11 Kaz Kojima + + * testsuite/libffi.call/cls_longdouble_va.c: Add xfail sh*-*-linux-*. + * testsuite/libffi.call/err_bad_abi.c: Add xfail sh*-*-*. + * testsuite/libffi.call/err_bad_typedef.c: Likewise. + +2009-06-09 Andrew Haley + + * src/x86/freebsd.S: Add missing file. + +2009-06-08 Andrew Haley + + Import from libffi 3.0.8: + + * doc/libffi.texi: New file. + * doc/libffi.info: Likewise. + * doc/stamp-vti: Likewise. + * man/Makefile.am: New file. + * man/ffi_call.3: New file. + + * Makefile.am (EXTRA_DIST): Add src/x86/darwin64.S, + src/dlmalloc.c. + (nodist_libffi_la_SOURCES): Add X86_FREEBSD. + + * configure.ac: Bump version to 3.0.8. + parisc*-*-linux*: Add. + i386-*-freebsd* | i386-*-openbsd*: Add. + powerpc-*-beos*: Add. + AM_CONDITIONAL X86_FREEBSD: Add. + AC_CONFIG_FILES: Add man/Makefile. + + * include/ffi.h.in (FFI_FN): Change void (*)() to void (*)(void). + +2009-06-08 Andrew Haley + + * README: Import from libffi 3.0.8. + +2009-06-08 Andrew Haley + + * testsuite/libffi.call/err_bad_abi.c: Add xfails. + * testsuite/libffi.call/cls_longdouble_va.c: Add xfails. + * testsuite/libffi.call/cls_dbls_struct.c: Add xfail x86_64-*-linux-*. + * testsuite/libffi.call/err_bad_typedef.c: Add xfails. + + * testsuite/libffi.call/stret_medium2.c: Add __UNUSED__ to args. + * testsuite/libffi.call/stret_medium.c: Likewise. + * testsuite/libffi.call/stret_large2.c: Likewise. + * testsuite/libffi.call/stret_large.c: Likewise. + +2008-12-26 Timothy Wall + + * testsuite/libffi.call/cls_longdouble.c, + testsuite/libffi.call/cls_longdouble_va.c, + testsuite/libffi.call/cls_align_longdouble.c, + testsuite/libffi.call/cls_align_longdouble_split.c, + testsuite/libffi.call/cls_align_longdouble_split2.c: mark expected + failures on x86_64 cygwin/mingw. + +2008-12-22 Timothy Wall + + * testsuite/libffi.call/closure_fn0.c, + testsuite/libffi.call/closure_fn1.c, + testsuite/libffi.call/closure_fn2.c, + testsuite/libffi.call/closure_fn3.c, + testsuite/libffi.call/closure_fn4.c, + testsuite/libffi.call/closure_fn5.c, + testsuite/libffi.call/closure_fn6.c, + testsuite/libffi.call/closure_loc_fn0.c, + testsuite/libffi.call/closure_stdcall.c, + testsuite/libffi.call/cls_align_pointer.c, + testsuite/libffi.call/cls_pointer.c, + testsuite/libffi.call/cls_pointer_stack.c: use portable cast from + pointer to integer (intptr_t). + * testsuite/libffi.call/cls_longdouble.c: disable for win64. + +2008-07-24 Anthony Green + + * testsuite/libffi.call/cls_dbls_struct.c, + testsuite/libffi.call/cls_double_va.c, + testsuite/libffi.call/cls_longdouble.c, + testsuite/libffi.call/cls_longdouble_va.c, + testsuite/libffi.call/cls_pointer.c, + testsuite/libffi.call/cls_pointer_stack.c, + testsuite/libffi.call/err_bad_abi.c: Clean up failures from + compiler warnings. + +2008-03-04 Anthony Green + Blake Chaffin + hos@tamanegi.org + + * testsuite/libffi.call/cls_align_longdouble_split2.c + testsuite/libffi.call/cls_align_longdouble_split.c + testsuite/libffi.call/cls_dbls_struct.c + testsuite/libffi.call/cls_double_va.c + testsuite/libffi.call/cls_longdouble.c + testsuite/libffi.call/cls_longdouble_va.c + testsuite/libffi.call/cls_pointer.c + testsuite/libffi.call/cls_pointer_stack.c + testsuite/libffi.call/err_bad_abi.c + testsuite/libffi.call/err_bad_typedef.c + testsuite/libffi.call/stret_large2.c + testsuite/libffi.call/stret_large.c + testsuite/libffi.call/stret_medium2.c + testsuite/libffi.call/stret_medium.c: New tests from Apple. + +2009-06-05 Andrew Haley + + * src/x86/ffitarget.h, src/x86/ffi.c: Merge stdcall changes from + libffi. + +2009-06-04 Andrew Haley + + * src/x86/ffitarget.h, src/x86/win32.S, src/x86/ffi.c: Back out + stdcall changes. + +2008-02-26 Anthony Green + Thomas Heller + + * src/x86/ffi.c (ffi_closure_SYSV_inner): Change C++ comment to C + comment. + +2008-02-03 Timothy Wall + + * src/x86/ffi.c (FFI_INIT_TRAMPOLINE_STDCALL): Calculate jump return + offset based on code pointer, not data pointer. + +2008-01-31 Timothy Wall + + * testsuite/libffi.call/closure_stdcall.c: Add test for stdcall + closures. + * src/x86/ffitarget.h: Increase size of trampoline for stdcall + closures. + * src/x86/win32.S: Add assembly for stdcall closure. + * src/x86/ffi.c: Initialize stdcall closure trampoline. + +2009-06-04 Andrew Haley + + * include/ffi.h.in: Change void (*)() to void (*)(void). + * src/x86/ffi.c: Likewise. + +2009-06-04 Andrew Haley + + * src/powerpc/ppc_closure.S: Insert licence header. + * src/powerpc/linux64_closure.S: Likewise. + * src/m68k/sysv.S: Likewise. + + * src/sh64/ffi.c: Change void (*)() to void (*)(void). + * src/powerpc/ffi.c: Likewise. + * src/powerpc/ffi_darwin.c: Likewise. + * src/m32r/ffi.c: Likewise. + * src/sh64/ffi.c: Likewise. + * src/x86/ffi64.c: Likewise. + * src/alpha/ffi.c: Likewise. + * src/alpha/osf.S: Likewise. + * src/frv/ffi.c: Likewise. + * src/s390/ffi.c: Likewise. + * src/pa/ffi.c: Likewise. + * src/pa/hpux32.S: Likewise. + * src/ia64/unix.S: Likewise. + * src/ia64/ffi.c: Likewise. + * src/sparc/ffi.c: Likewise. + * src/mips/ffi.c: Likewise. + * src/sh/ffi.c: Likewise. + +2008-02-15 David Daney + + * src/mips/ffi.c (USE__BUILTIN___CLEAR_CACHE): + Define (conditionally), and use it to include cachectl.h. + (ffi_prep_closure_loc): Fix cache flushing. + * src/mips/ffitarget.h (_ABIN32, _ABI64, _ABIO32): Define. + +2009-06-04 Andrew Haley + + include/ffi.h.in, + src/arm/ffitarget.h, + src/arm/ffi.c, + src/arm/sysv.S, + src/powerpc/ffitarget.h, + src/closures.c, + src/sh64/ffitarget.h, + src/sh64/ffi.c, + src/sh64/sysv.S, + src/types.c, + src/x86/ffi64.c, + src/x86/ffitarget.h, + src/x86/win32.S, + src/x86/darwin.S, + src/x86/ffi.c, + src/x86/sysv.S, + src/x86/unix64.S, + src/alpha/ffitarget.h, + src/alpha/ffi.c, + src/alpha/osf.S, + src/m68k/ffitarget.h, + src/frv/ffitarget.h, + src/frv/ffi.c, + src/s390/ffitarget.h, + src/s390/sysv.S, + src/cris/ffitarget.h, + src/pa/linux.S, + src/pa/ffitarget.h, + src/pa/ffi.c, + src/raw_api.c, + src/ia64/ffitarget.h, + src/ia64/unix.S, + src/ia64/ffi.c, + src/ia64/ia64_flags.h, + src/java_raw_api.c, + src/debug.c, + src/sparc/v9.S, + src/sparc/ffitarget.h, + src/sparc/ffi.c, + src/sparc/v8.S, + src/mips/ffitarget.h, + src/mips/n32.S, + src/mips/o32.S, + src/mips/ffi.c, + src/prep_cif.c, + src/sh/ffitarget.h, + src/sh/ffi.c, + src/sh/sysv.S: Update license text. + +2009-05-22 Dave Korn + + * src/x86/win32.S (_ffi_closure_STDCALL): New function. + (.eh_frame): Add FDE for it. + +2009-05-22 Dave Korn + + * configure.ac: Also check if assembler supports pc-relative + relocs on X86_WIN32 targets. + * configure: Regenerate. + * src/x86/win32.S (ffi_prep_args): Declare extern, not global. + (_ffi_call_SYSV): Add missing function type symbol .def and + add EH markup labels. + (_ffi_call_STDCALL): Likewise. + (_ffi_closure_SYSV): Likewise. + (_ffi_closure_raw_SYSV): Likewise. + (.eh_frame): Add hand-crafted EH data. + +2009-04-09 Jakub Jelinek + + * testsuite/lib/libffi-dg.exp: Change copyright header to refer to + version 3 of the GNU General Public License and to point readers + at the COPYING3 file and the FSF's license web page. + * testsuite/libffi.call/call.exp: Likewise. + * testsuite/libffi.special/special.exp: Likewise. + +2009-03-01 Ralf Wildenhues + + * configure: Regenerate. + +2008-12-18 Rainer Orth + + PR libffi/26048 + * configure.ac (HAVE_AS_X86_PCREL): New test. + * configure: Regenerate. + * fficonfig.h.in: Regenerate. + * src/x86/sysv.S [!FFI_NO_RAW_API]: Precalculate + RAW_CLOSURE_CIF_OFFSET, RAW_CLOSURE_FUN_OFFSET, + RAW_CLOSURE_USER_DATA_OFFSET for the Solaris 10/x86 assembler. + (.eh_frame): Only use SYMBOL-. iff HAVE_AS_X86_PCREL. + * src/x86/unix64.S (.Lstore_table): Move to .text section. + (.Lload_table): Likewise. + (.eh_frame): Only use SYMBOL-. iff HAVE_AS_X86_PCREL. + +2008-12-18 Ralf Wildenhues + + * configure: Regenerate. + +2008-11-21 Eric Botcazou + + * src/sparc/ffi.c (ffi_prep_cif_machdep): Add support for + signed/unsigned int8/16 return values. + * src/sparc/v8.S (ffi_call_v8): Likewise. + (ffi_closure_v8): Likewise. + +2008-09-26 Peter O'Gorman + Steve Ellcey + + * configure: Regenerate for new libtool. + * Makefile.in: Ditto. + * include/Makefile.in: Ditto. + * aclocal.m4: Ditto. + +2008-08-25 Andreas Tobler + + * src/powerpc/ffitarget.h (ffi_abi): Add FFI_LINUX and + FFI_LINUX_SOFT_FLOAT to the POWERPC_FREEBSD enum. + Add note about flag bits used for FFI_SYSV_TYPE_SMALL_STRUCT. + Adjust copyright notice. + * src/powerpc/ffi.c: Add two new flags to indicate if we have one + register or two register to use for FFI_SYSV structs. + (ffi_prep_cif_machdep): Pass the right register flag introduced above. + (ffi_closure_helper_SYSV): Fix the return type for + FFI_SYSV_TYPE_SMALL_STRUCT. Comment. + Adjust copyright notice. + +2008-07-16 Kaz Kojima + + * src/sh/ffi.c (ffi_prep_closure_loc): Turn INSN into an unsigned + int. + +2008-06-17 Ralf Wildenhues + + * configure: Regenerate. + * include/Makefile.in: Regenerate. + * testsuite/Makefile.in: Regenerate. + +2008-06-07 Joseph Myers + + * configure.ac (parisc*-*-linux*, powerpc-*-sysv*, + powerpc-*-beos*): Remove. + * configure: Regenerate. + +2008-05-09 Julian Brown + + * Makefile.am (LTLDFLAGS): New. + (libffi_la_LDFLAGS): Use above. + * Makefile.in: Regenerate. + +2008-04-18 Paolo Bonzini + + PR bootstrap/35457 + * aclocal.m4: Regenerate. + * configure: Regenerate. + +2008-03-26 Kaz Kojima + + * src/sh/sysv.S: Add .note.GNU-stack on Linux. + * src/sh64/sysv.S: Likewise. + +2008-03-26 Daniel Jacobowitz + + * src/arm/sysv.S: Fix ARM comment marker. + +2008-03-26 Jakub Jelinek + + * src/alpha/osf.S: Add .note.GNU-stack on Linux. + * src/s390/sysv.S: Likewise. + * src/powerpc/ppc_closure.S: Likewise. + * src/powerpc/sysv.S: Likewise. + * src/x86/unix64.S: Likewise. + * src/x86/sysv.S: Likewise. + * src/sparc/v8.S: Likewise. + * src/sparc/v9.S: Likewise. + * src/m68k/sysv.S: Likewise. + * src/arm/sysv.S: Likewise. + +2008-03-16 Ralf Wildenhues + + * aclocal.m4: Regenerate. + * configure: Likewise. + * Makefile.in: Likewise. + * include/Makefile.in: Likewise. + * testsuite/Makefile.in: Likewise. + +2008-02-12 Bjoern Koenig + Andreas Tobler + + * configure.ac: Add amd64-*-freebsd* target. + * configure: Regenerate. + +2008-01-30 H.J. Lu + + PR libffi/34612 + * src/x86/sysv.S (ffi_closure_SYSV): Pop 4 byte from stack when + returning struct. + + * testsuite/libffi.call/call.exp: Add "-O2 -fomit-frame-pointer" + tests. + +2008-01-24 David Edelsohn + + * configure: Regenerate. + +2008-01-06 Andreas Tobler + + * src/x86/ffi.c (ffi_prep_cif_machdep): Fix thinko. + +2008-01-05 Andreas Tobler + + PR testsuite/32843 + * src/x86/ffi.c (ffi_prep_cif_machdep): Add code for + signed/unsigned int8/16 for X86_DARWIN. + Updated copyright info. + Handle one and two byte structs with special cif->flags. + * src/x86/ffitarget.h: Add special types for one and two byte structs. + Updated copyright info. + * src/x86/darwin.S (ffi_call_SYSV): Rewrite to use a jump table like + sysv.S + Remove code to pop args from the stack after call. + Special-case signed/unsigned for int8/16, one and two byte structs. + (ffi_closure_raw_SYSV): Handle FFI_TYPE_UINT8, + FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32, + FFI_TYPE_SINT32. + Updated copyright info. + +2007-12-08 David Daney + + * src/mips/n32.S (ffi_call_N32): Replace dadd with ADDU, dsub with + SUBU, add with ADDU and use smaller code sequences. + +2007-12-07 David Daney + + * src/mips/ffi.c (ffi_prep_cif_machdep): Handle long double return + type. + +2007-12-06 David Daney + + * include/ffi.h.in (FFI_SIZEOF_JAVA_RAW): Define if not already + defined. + (ffi_java_raw): New typedef. + (ffi_java_raw_call, ffi_java_ptrarray_to_raw, + ffi_java_raw_to_ptrarray): Change parameter types from ffi_raw to + ffi_java_raw. + (ffi_java_raw_closure) : Same. + (ffi_prep_java_raw_closure, ffi_prep_java_raw_closure_loc): Change + parameter types. + * src/java_raw_api.c (ffi_java_raw_size): Replace FFI_SIZEOF_ARG with + FFI_SIZEOF_JAVA_RAW. + (ffi_java_raw_to_ptrarray): Change type of raw to ffi_java_raw. + Replace FFI_SIZEOF_ARG with FFI_SIZEOF_JAVA_RAW. Use + sizeof(ffi_java_raw) for alignment calculations. + (ffi_java_ptrarray_to_raw): Same. + (ffi_java_rvalue_to_raw): Add special handling for FFI_TYPE_POINTER + if FFI_SIZEOF_JAVA_RAW == 4. + (ffi_java_raw_to_rvalue): Same. + (ffi_java_raw_call): Change type of raw to ffi_java_raw. + (ffi_java_translate_args): Same. + (ffi_prep_java_raw_closure_loc, ffi_prep_java_raw_closure): Change + parameter types. + * src/mips/ffitarget.h (FFI_SIZEOF_JAVA_RAW): Define for N32 ABI. + +2007-12-06 David Daney + + * src/mips/n32.S (ffi_closure_N32): Use 64-bit add instruction on + pointer values. + +2007-12-01 Andreas Tobler + + PR libffi/31937 + * src/powerpc/ffitarget.h: Introduce new ABI FFI_LINUX_SOFT_FLOAT. + Add local FFI_TYPE_UINT128 to handle soft-float long-double-128. + * src/powerpc/ffi.c: Distinguish between __NO_FPRS__ and not and + set the NUM_FPR_ARG_REGISTERS according to. + Add support for potential soft-float support under hard-float + architecture. + (ffi_prep_args_SYSV): Set NUM_FPR_ARG_REGISTERS to 0 in case of + FFI_LINUX_SOFT_FLOAT, handle float, doubles and long-doubles according + to the FFI_LINUX_SOFT_FLOAT ABI. + (ffi_prep_cif_machdep): Likewise. + (ffi_closure_helper_SYSV): Likewise. + * src/powerpc/ppc_closure.S: Make sure not to store float/double + on archs where __NO_FPRS__ is true. + Add FFI_TYPE_UINT128 support. + * src/powerpc/sysv.S: Add support for soft-float long-double-128. + Adjust copyright notice. + +2007-11-25 Andreas Tobler + + * src/closures.c: Move defintion of MAYBE_UNUSED from here to ... + * include/ffi_common.h: ... here. + Update copyright. + +2007-11-17 Andreas Tobler + + * src/powerpc/sysv.S: Load correct cr to compare if we have long double. + * src/powerpc/linux64.S: Likewise. + * src/powerpc/ffi.c: Add a comment to show which part goes into cr6. + * testsuite/libffi.call/return_ldl.c: New test. + +2007-09-04 + + * src/arm/sysv.S (UNWIND): New. + (Whole file): Conditionally compile unwinder directives. + * src/arm/sysv.S: Add unwinder directives. + + * src/arm/ffi.c (ffi_prep_args): Align structs by at least 4 bytes. + Only treat r0 as a struct address if we're actually returning a + struct by address. + Only copy the bytes that are actually within a struct. + (ffi_prep_cif_machdep): A Composite Type not larger than 4 bytes + is returned in r0, not passed by address. + (ffi_call): Allocate a word-sized temporary for the case where + a composite is returned in r0. + (ffi_prep_incoming_args_SYSV): Align as necessary. + +2007-08-05 Steven Newbury + + * src/arm/ffi.c (FFI_INIT_TRAMPOLINE): Use __clear_cache instead of + directly using the sys_cacheflush syscall. + +2007-07-27 Andrew Haley + + * src/arm/sysv.S (ffi_closure_SYSV): Add soft-float. + +2007-09-03 Maciej W. Rozycki + + * Makefile.am: Unify MIPS_IRIX and MIPS_LINUX into MIPS. + * configure.ac: Likewise. + * Makefile.in: Regenerate. + * include/Makefile.in: Likewise. + * testsuite/Makefile.in: Likewise. + * configure: Likewise. + +2007-08-24 David Daney + + * testsuite/libffi.call/return_sl.c: New test. + +2007-08-10 David Daney + + * testsuite/libffi.call/cls_multi_ushort.c, + testsuite/libffi.call/cls_align_uint16.c, + testsuite/libffi.call/nested_struct1.c, + testsuite/libffi.call/nested_struct3.c, + testsuite/libffi.call/cls_7_1_byte.c, + testsuite/libffi.call/nested_struct5.c, + testsuite/libffi.call/cls_double.c, + testsuite/libffi.call/nested_struct7.c, + testsuite/libffi.call/cls_sint.c, + testsuite/libffi.call/nested_struct9.c, + testsuite/libffi.call/cls_20byte1.c, + testsuite/libffi.call/cls_multi_sshortchar.c, + testsuite/libffi.call/cls_align_sint64.c, + testsuite/libffi.call/cls_3byte2.c, + testsuite/libffi.call/cls_multi_schar.c, + testsuite/libffi.call/cls_multi_uchar.c, + testsuite/libffi.call/cls_19byte.c, + testsuite/libffi.call/cls_9byte1.c, + testsuite/libffi.call/cls_align_float.c, + testsuite/libffi.call/closure_fn1.c, + testsuite/libffi.call/problem1.c, + testsuite/libffi.call/closure_fn3.c, + testsuite/libffi.call/cls_sshort.c, + testsuite/libffi.call/closure_fn5.c, + testsuite/libffi.call/cls_align_double.c, + testsuite/libffi.call/nested_struct.c, + testsuite/libffi.call/cls_2byte.c, + testsuite/libffi.call/nested_struct10.c, + testsuite/libffi.call/cls_4byte.c, + testsuite/libffi.call/cls_6byte.c, + testsuite/libffi.call/cls_8byte.c, + testsuite/libffi.call/cls_multi_sshort.c, + testsuite/libffi.call/cls_align_sint16.c, + testsuite/libffi.call/cls_align_uint32.c, + testsuite/libffi.call/cls_20byte.c, + testsuite/libffi.call/cls_float.c, + testsuite/libffi.call/nested_struct2.c, + testsuite/libffi.call/cls_5_1_byte.c, + testsuite/libffi.call/nested_struct4.c, + testsuite/libffi.call/cls_24byte.c, + testsuite/libffi.call/nested_struct6.c, + testsuite/libffi.call/cls_64byte.c, + testsuite/libffi.call/nested_struct8.c, + testsuite/libffi.call/cls_uint.c, + testsuite/libffi.call/cls_multi_ushortchar.c, + testsuite/libffi.call/cls_schar.c, + testsuite/libffi.call/cls_uchar.c, + testsuite/libffi.call/cls_align_uint64.c, + testsuite/libffi.call/cls_ulonglong.c, + testsuite/libffi.call/cls_align_longdouble.c, + testsuite/libffi.call/cls_1_1byte.c, + testsuite/libffi.call/cls_12byte.c, + testsuite/libffi.call/cls_3_1byte.c, + testsuite/libffi.call/cls_3byte1.c, + testsuite/libffi.call/cls_4_1byte.c, + testsuite/libffi.call/cls_6_1_byte.c, + testsuite/libffi.call/cls_16byte.c, + testsuite/libffi.call/cls_18byte.c, + testsuite/libffi.call/closure_fn0.c, + testsuite/libffi.call/cls_9byte2.c, + testsuite/libffi.call/closure_fn2.c, + testsuite/libffi.call/closure_fn4.c, + testsuite/libffi.call/cls_ushort.c, + testsuite/libffi.call/closure_fn6.c, + testsuite/libffi.call/cls_5byte.c, + testsuite/libffi.call/cls_align_pointer.c, + testsuite/libffi.call/cls_7byte.c, + testsuite/libffi.call/cls_align_sint32.c, + testsuite/libffi.special/unwindtest_ffi_call.cc, + testsuite/libffi.special/unwindtest.cc: Remove xfail for mips64*-*-*. + +2007-08-10 David Daney + + PR libffi/28313 + * configure.ac: Don't treat mips64 as a special case. + * Makefile.am (nodist_libffi_la_SOURCES): Add n32.S. + * configure: Regenerate + * Makefile.in: Ditto. + * fficonfig.h.in: Ditto. + * src/mips/ffitarget.h (REG_L, REG_S, SUBU, ADDU, SRL, LI): Indent. + (LA, EH_FRAME_ALIGN, FDE_ADDR_BYTES): New preprocessor macros. + (FFI_DEFAULT_ABI): Set for n64 case. + (FFI_CLOSURES, FFI_TRAMPOLINE_SIZE): Define for n32 and n64 cases. + * src/mips/n32.S (ffi_call_N32): Add debug macros and labels for FDE. + (ffi_closure_N32): New function. + (.eh_frame): New section + * src/mips/o32.S: Clean up comments. + (ffi_closure_O32): Pass ffi_closure parameter in $12. + * src/mips/ffi.c: Use FFI_MIPS_N32 instead of + _MIPS_SIM == _ABIN32 throughout. + (FFI_MIPS_STOP_HERE): New, use in place of + ffi_stop_here. + (ffi_prep_args): Use unsigned long to hold pointer values. Rewrite + to support n32/n64 ABIs. + (calc_n32_struct_flags): Rewrite. + (calc_n32_return_struct_flags): Remove unused variable. Reverse + position of flag bits. + (ffi_prep_cif_machdep): Rewrite n32 portion. + (ffi_call): Enable for n64. Add special handling for small structure + return values. + (ffi_prep_closure_loc): Add n32 and n64 support. + (ffi_closure_mips_inner_O32): Add cast to silence warning. + (copy_struct_N32, ffi_closure_mips_inner_N32): New functions. + +2007-08-08 David Daney + + * testsuite/libffi.call/ffitest.h (ffi_type_mylong): Remove definition. + * testsuite/libffi.call/cls_align_uint16.c (main): Use correct type + specifiers. + * testsuite/libffi.call/nested_struct1.c (main): Ditto. + * testsuite/libffi.call/cls_sint.c (main): Ditto. + * testsuite/libffi.call/nested_struct9.c (main): Ditto. + * testsuite/libffi.call/cls_20byte1.c (main): Ditto. + * testsuite/libffi.call/cls_9byte1.c (main): Ditto. + * testsuite/libffi.call/closure_fn1.c (main): Ditto. + * testsuite/libffi.call/closure_fn3.c (main): Ditto. + * testsuite/libffi.call/return_dbl2.c (main): Ditto. + * testsuite/libffi.call/cls_sshort.c (main): Ditto. + * testsuite/libffi.call/return_fl3.c (main): Ditto. + * testsuite/libffi.call/closure_fn5.c (main): Ditto. + * testsuite/libffi.call/nested_struct.c (main): Ditto. + * testsuite/libffi.call/nested_struct10.c (main): Ditto. + * testsuite/libffi.call/return_ll1.c (main): Ditto. + * testsuite/libffi.call/cls_8byte.c (main): Ditto. + * testsuite/libffi.call/cls_align_uint32.c (main): Ditto. + * testsuite/libffi.call/cls_align_sint16.c (main): Ditto. + * testsuite/libffi.call/cls_20byte.c (main): Ditto. + * testsuite/libffi.call/nested_struct2.c (main): Ditto. + * testsuite/libffi.call/cls_24byte.c (main): Ditto. + * testsuite/libffi.call/nested_struct6.c (main): Ditto. + * testsuite/libffi.call/cls_uint.c (main): Ditto. + * testsuite/libffi.call/cls_12byte.c (main): Ditto. + * testsuite/libffi.call/cls_16byte.c (main): Ditto. + * testsuite/libffi.call/closure_fn0.c (main): Ditto. + * testsuite/libffi.call/cls_9byte2.c (main): Ditto. + * testsuite/libffi.call/closure_fn2.c (main): Ditto. + * testsuite/libffi.call/return_dbl1.c (main): Ditto. + * testsuite/libffi.call/closure_fn4.c (main): Ditto. + * testsuite/libffi.call/closure_fn6.c (main): Ditto. + * testsuite/libffi.call/cls_align_sint32.c (main): Ditto. + +2007-08-07 Andrew Haley + + * src/x86/sysv.S (ffi_closure_raw_SYSV): Fix typo in previous + checkin. + +2007-08-06 Andrew Haley + + PR testsuite/32843 + * src/x86/sysv.S (ffi_closure_raw_SYSV): Handle FFI_TYPE_UINT8, + FFI_TYPE_SINT8, FFI_TYPE_UINT16, FFI_TYPE_SINT16, FFI_TYPE_UINT32, + FFI_TYPE_SINT32. + +2007-08-02 David Daney + + * testsuite/libffi.call/return_ul.c (main): Define return type as + ffi_arg. Use proper printf conversion specifier. + +2007-07-30 Andrew Haley + + PR testsuite/32843 + * src/x86/ffi.c (ffi_prep_cif_machdep): in x86 case, add code for + signed/unsigned int8/16. + * src/x86/sysv.S (ffi_call_SYSV): Rewrite to: + Use a jump table. + Remove code to pop args from the stack after call. + Special-case signed/unsigned int8/16. + * testsuite/libffi.call/return_sc.c (main): Revert. + +2007-07-26 Richard Guenther + + PR testsuite/32843 + * testsuite/libffi.call/return_sc.c (main): Verify call + result as signed char, not ffi_arg. + +2007-07-16 Rainer Orth + + * configure.ac (i?86-*-solaris2.1[0-9]): Set TARGET to X86_64. + * configure: Regenerate. + +2007-07-11 David Daney + + * src/mips/ffi.c: Don't include sys/cachectl.h. + (ffi_prep_closure_loc): Use __builtin___clear_cache() instead of + cacheflush(). + +2007-05-18 Aurelien Jarno + + * src/arm/ffi.c (ffi_prep_closure_loc): Renamed and ajusted + from (ffi_prep_closure): ... this. + (FFI_INIT_TRAMPOLINE): Adjust. + +2005-12-31 Phil Blundell + + * src/arm/ffi.c (ffi_prep_incoming_args_SYSV, + ffi_closure_SYSV_inner, ffi_prep_closure): New, add closure support. + * src/arm/sysv.S(ffi_closure_SYSV): Likewise. + * src/arm/ffitarget.h (FFI_TRAMPOLINE_SIZE): Likewise. + (FFI_CLOSURES): Enable closure support. + +2007-07-03 Andrew Haley + + * testsuite/libffi.call/cls_multi_ushort.c, + testsuite/libffi.call/cls_align_uint16.c, + testsuite/libffi.call/nested_struct1.c, + testsuite/libffi.call/nested_struct3.c, + testsuite/libffi.call/cls_7_1_byte.c, + testsuite/libffi.call/cls_double.c, + testsuite/libffi.call/nested_struct5.c, + testsuite/libffi.call/nested_struct7.c, + testsuite/libffi.call/cls_sint.c, + testsuite/libffi.call/nested_struct9.c, + testsuite/libffi.call/cls_20byte1.c, + testsuite/libffi.call/cls_multi_sshortchar.c, + testsuite/libffi.call/cls_align_sint64.c, + testsuite/libffi.call/cls_3byte2.c, + testsuite/libffi.call/cls_multi_schar.c, + testsuite/libffi.call/cls_multi_uchar.c, + testsuite/libffi.call/cls_19byte.c, + testsuite/libffi.call/cls_9byte1.c, + testsuite/libffi.call/cls_align_float.c, + testsuite/libffi.call/closure_fn1.c, + testsuite/libffi.call/problem1.c, + testsuite/libffi.call/closure_fn3.c, + testsuite/libffi.call/cls_sshort.c, + testsuite/libffi.call/closure_fn5.c, + testsuite/libffi.call/cls_align_double.c, + testsuite/libffi.call/cls_2byte.c, + testsuite/libffi.call/nested_struct.c, + testsuite/libffi.call/nested_struct10.c, + testsuite/libffi.call/cls_4byte.c, + testsuite/libffi.call/cls_6byte.c, + testsuite/libffi.call/cls_8byte.c, + testsuite/libffi.call/cls_multi_sshort.c, + testsuite/libffi.call/cls_align_uint32.c, + testsuite/libffi.call/cls_align_sint16.c, + testsuite/libffi.call/cls_float.c, + testsuite/libffi.call/cls_20byte.c, + testsuite/libffi.call/cls_5_1_byte.c, + testsuite/libffi.call/nested_struct2.c, + testsuite/libffi.call/cls_24byte.c, + testsuite/libffi.call/nested_struct4.c, + testsuite/libffi.call/nested_struct6.c, + testsuite/libffi.call/cls_64byte.c, + testsuite/libffi.call/nested_struct8.c, + testsuite/libffi.call/cls_uint.c, + testsuite/libffi.call/cls_multi_ushortchar.c, + testsuite/libffi.call/cls_schar.c, + testsuite/libffi.call/cls_uchar.c, + testsuite/libffi.call/cls_align_uint64.c, + testsuite/libffi.call/cls_ulonglong.c, + testsuite/libffi.call/cls_align_longdouble.c, + testsuite/libffi.call/cls_1_1byte.c, + testsuite/libffi.call/cls_12byte.c, + testsuite/libffi.call/cls_3_1byte.c, + testsuite/libffi.call/cls_3byte1.c, + testsuite/libffi.call/cls_4_1byte.c, + testsuite/libffi.call/cls_6_1_byte.c, + testsuite/libffi.call/cls_16byte.c, + testsuite/libffi.call/cls_18byte.c, + testsuite/libffi.call/closure_fn0.c, + testsuite/libffi.call/cls_9byte2.c, + testsuite/libffi.call/closure_fn2.c, + testsuite/libffi.call/closure_fn4.c, + testsuite/libffi.call/cls_ushort.c, + testsuite/libffi.call/closure_fn6.c, + testsuite/libffi.call/cls_5byte.c, + testsuite/libffi.call/cls_align_pointer.c, + testsuite/libffi.call/cls_7byte.c, + testsuite/libffi.call/cls_align_sint32.c, + testsuite/libffi.special/unwindtest_ffi_call.cc, + testsuite/libffi.special/unwindtest.cc: Enable for ARM. + +2007-07-05 H.J. Lu + + * aclocal.m4: Regenerated. + +2007-06-02 Paolo Bonzini + + * configure: Regenerate. + +2007-05-23 Steve Ellcey + + * Makefile.in: Regenerate. + * configure: Regenerate. + * aclocal.m4: Regenerate. + * include/Makefile.in: Regenerate. + * testsuite/Makefile.in: Regenerate. + +2007-05-10 Roman Zippel + + * src/m68k/ffi.c (ffi_prep_incoming_args_SYSV, + ffi_closure_SYSV_inner,ffi_prep_closure): New, add closure support. + * src/m68k/sysv.S(ffi_closure_SYSV,ffi_closure_struct_SYSV): Likewise. + * src/m68k/ffitarget.h (FFI_TRAMPOLINE_SIZE): Likewise. + (FFI_CLOSURES): Enable closure support. + +2007-05-10 Roman Zippel + + * configure.ac (HAVE_AS_CFI_PSEUDO_OP): New test. + * configure: Regenerate. + * fficonfig.h.in: Regenerate. + * src/m68k/sysv.S (CFI_STARTPROC,CFI_ENDPROC, + CFI_OFFSET,CFI_DEF_CFA): New macros. + (ffi_call_SYSV): Add callframe annotation. + +2007-05-10 Roman Zippel + + * src/m68k/ffi.c (ffi_prep_args,ffi_prep_cif_machdep): Fix + numerous test suite failures. + * src/m68k/sysv.S (ffi_call_SYSV): Likewise. + +2007-04-11 Paolo Bonzini + + * Makefile.am (EXTRA_DIST): Bring up to date. + * Makefile.in: Regenerate. + * src/frv/eabi.S: Remove RCS keyword. + +2007-04-06 Richard Henderson + + * configure.ac: Tidy target case. + (HAVE_LONG_DOUBLE): Allow the target to override. + * configure: Regenerate. + * include/ffi.h.in: Don't define ffi_type_foo if + LIBFFI_HIDE_BASIC_TYPES is defined. + (ffi_type_longdouble): If not HAVE_LONG_DOUBLE, define + to ffi_type_double. + * types.c (LIBFFI_HIDE_BASIC_TYPES): Define. + (FFI_TYPEDEF, ffi_type_void): Mark the data const. + (ffi_type_longdouble): Special case for Alpha. Don't define + if long double == double. + + * src/alpha/ffi.c (FFI_TYPE_LONGDOUBLE): Assert unique value. + (ffi_prep_cif_machdep): Handle it as the 128-bit type. + (ffi_call, ffi_closure_osf_inner): Likewise. + (ffi_closure_osf_inner): Likewise. Mark hidden. + (ffi_call_osf, ffi_closure_osf): Mark hidden. + * src/alpha/ffitarget.h (FFI_LAST_ABI): Tidy definition. + * src/alpha/osf.S (ffi_call_osf, ffi_closure_osf): Mark hidden. + (load_table): Handle 128-bit long double. + + * testsuite/libffi.call/float4.c: Add -mieee for alpha. + +2007-04-06 Tom Tromey + + PR libffi/31491: + * README: Fixed bug in example. + +2007-04-03 Jakub Jelinek + + * src/closures.c: Include sys/statfs.h. + (_GNU_SOURCE): Define on Linux. + (FFI_MMAP_EXEC_SELINUX): Define. + (selinux_enabled): New variable. + (selinux_enabled_check): New function. + (is_selinux_enabled): Define. + (dlmmap): Use it. + +2007-03-24 Uros Bizjak + + * testsuite/libffi.call/return_fl2.c (return_fl): Mark as static. + Use 'volatile float sum' to create sum of floats to avoid false + negative due to excess precision on ix86 targets. + (main): Ditto. + +2007-03-08 Alexandre Oliva + + * src/powerpc/ffi.c (flush_icache): Fix left-over from previous + patch. + (ffi_prep_closure_loc): Remove unneeded casts. Add needed ones. + +2007-03-07 Alexandre Oliva + + * include/ffi.h.in (ffi_closure_alloc, ffi_closure_free): New. + (ffi_prep_closure_loc): New. + (ffi_prep_raw_closure_loc): New. + (ffi_prep_java_raw_closure_loc): New. + * src/closures.c: New file. + * src/dlmalloc.c [FFI_MMAP_EXEC_WRIT] (struct malloc_segment): + Replace sflags with exec_offset. + [FFI_MMAP_EXEC_WRIT] (mmap_exec_offset, add_segment_exec_offset, + sub_segment_exec_offset): New macros. + (get_segment_flags, set_segment_flags, check_segment_merge): New + macros. + (is_mmapped_segment, is_extern_segment): Use get_segment_flags. + (add_segment, sys_alloc, create_mspace, create_mspace_with_base, + destroy_mspace): Use new macros. + (sys_alloc): Silence warning. + * Makefile.am (libffi_la_SOURCES): Add src/closures.c. + * Makefile.in: Rebuilt. + * src/prep_cif [FFI_CLOSURES] (ffi_prep_closure): Implement in + terms of ffi_prep_closure_loc. + * src/raw_api.c (ffi_prep_raw_closure_loc): Renamed and adjusted + from... + (ffi_prep_raw_closure): ... this. Re-implement in terms of the + renamed version. + * src/java_raw_api (ffi_prep_java_raw_closure_loc): Renamed and + adjusted from... + (ffi_prep_java_raw_closure): ... this. Re-implement in terms of + the renamed version. + * src/alpha/ffi.c (ffi_prep_closure_loc): Renamed from + (ffi_prep_closure): ... this. + * src/pa/ffi.c: Likewise. + * src/cris/ffi.c: Likewise. Adjust. + * src/frv/ffi.c: Likewise. + * src/ia64/ffi.c: Likewise. + * src/mips/ffi.c: Likewise. + * src/powerpc/ffi_darwin.c: Likewise. + * src/s390/ffi.c: Likewise. + * src/sh/ffi.c: Likewise. + * src/sh64/ffi.c: Likewise. + * src/sparc/ffi.c: Likewise. + * src/x86/ffi64.c: Likewise. + * src/x86/ffi.c: Likewise. + (FFI_INIT_TRAMPOLINE): Adjust. + (ffi_prep_raw_closure_loc): Renamed and adjusted from... + (ffi_prep_raw_closure): ... this. + * src/powerpc/ffi.c (ffi_prep_closure_loc): Renamed from + (ffi_prep_closure): ... this. + (flush_icache): Adjust. + +2007-03-07 Alexandre Oliva + + * src/dlmalloc.c: New file, imported version 2.8.3 of Doug + Lea's malloc. + +2007-03-01 Brooks Moses + + * Makefile.am: Add dummy install-pdf target. + * Makefile.in: Regenerate + +2007-02-13 Andreas Krebbel + + * src/s390/ffi.c (ffi_prep_args, ffi_prep_cif_machdep, + ffi_closure_helper_SYSV): Add long double handling. + +2007-02-02 Jakub Jelinek + + * src/powerpc/linux64.S (ffi_call_LINUX64): Move restore of r2 + immediately after bctrl instruction. + +2007-01-18 Alexandre Oliva + + * Makefile.am (all-recursive, install-recursive, + mostlyclean-recursive, clean-recursive, distclean-recursive, + maintainer-clean-recursive): Add missing targets. + * Makefile.in: Rebuilt. + +2006-12-14 Andreas Tobler + + * configure.ac: Add TARGET for x86_64-*-darwin*. + * Makefile.am (nodist_libffi_la_SOURCES): Add rules for 64-bit sources + for X86_DARWIN. + * src/x86/ffitarget.h: Set trampoline size for x86_64-*-darwin*. + * src/x86/darwin64.S: New file for x86_64-*-darwin* support. + * configure: Regenerate. + * Makefile.in: Regenerate. + * include/Makefile.in: Regenerate. + * testsuite/Makefile.in: Regenerate. + * testsuite/libffi.special/unwindtest_ffi_call.cc: New test case for + ffi_call only. + +2006-12-13 Andreas Tobler + + * aclocal.m4: Regenerate with aclocal -I .. as written in the + Makefile.am. + +2006-10-31 Geoffrey Keating + + * src/powerpc/ffi_darwin.c (darwin_adjust_aggregate_sizes): New. + (ffi_prep_cif_machdep): Call darwin_adjust_aggregate_sizes for + Darwin. + * testsuite/libffi.call/nested_struct4.c: Remove Darwin XFAIL. + * testsuite/libffi.call/nested_struct6.c: Remove Darwin XFAIL. + +2006-10-10 Paolo Bonzini + Sandro Tolaini + + * configure.ac [i*86-*-darwin*]: Set X86_DARWIN symbol and + conditional. + * configure: Regenerated. + * Makefile.am (nodist_libffi_la_SOURCES) [X86_DARWIN]: New case. + (EXTRA_DIST): Add src/x86/darwin.S. + * Makefile.in: Regenerated. + * include/Makefile.in: Regenerated. + * testsuite/Makefile.in: Regenerated. + + * src/x86/ffi.c (ffi_prep_cif_machdep) [X86_DARWIN]: Treat like + X86_WIN32, and additionally align stack to 16 bytes. + * src/x86/darwin.S: New, based on sysv.S. + * src/prep_cif.c (ffi_prep_cif) [X86_DARWIN]: Align > 8-byte structs. + +2006-09-12 David Daney + + PR libffi/23935 + * include/Makefile.am: Install both ffi.h and ffitarget.h in + $(libdir)/gcc/$(target_alias)/$(gcc_version)/include. + * aclocal.m4: Regenerated for automake 1.9.6. + * Makefile.in: Regenerated. + * include/Makefile.in: Regenerated. + * testsuite/Makefile.in: Regenerated. + +2006-08-17 Andreas Tobler + + * include/ffi_common.h (struct): Revert accidental commit. + +2006-08-15 Andreas Tobler + + * include/ffi_common.h: Remove lint directives. + * include/ffi.h.in: Likewise. + +2006-07-25 Torsten Schoenfeld + + * include/ffi.h.in (ffi_type_ulong, ffi_type_slong): Define correctly + for 32-bit architectures. + * testsuite/libffi.call/return_ul.c: New test case. + +2006-07-19 David Daney + + * testsuite/libffi.call/closure_fn6.c: Remove xfail for mips, + xfail remains for mips64. + +2006-05-23 Carlos O'Donell + + * Makefile.am: Add install-html target. Add install-html to .PHONY + * Makefile.in: Regenerate. + * aclocal.m4: Regenerate. + * include/Makefile.in: Regenerate. + * testsuite/Makefile.in: Regenerate. + +2006-05-18 John David Anglin + + * pa/ffi.c (ffi_prep_args_pa32): Load floating point arguments from + stack slot. + +2006-04-22 Andreas Tobler + + * README: Remove notice about 'Crazy Comments'. + * src/debug.c: Remove lint directives. Cleanup white spaces. + * src/java_raw_api.c: Likewise. + * src/prep_cif.c: Likewise. + * src/raw_api.c: Likewise. + * src/ffitest.c: Delete. No longer needed, all test cases migrated + to the testsuite. + * src/arm/ffi.c: Remove lint directives. + * src/m32r/ffi.c: Likewise. + * src/pa/ffi.c: Likewise. + * src/powerpc/ffi.c: Likewise. + * src/powerpc/ffi_darwin.c: Likewise. + * src/sh/ffi.c: Likewise. + * src/sh64/ffi.c: Likewise. + * src/x86/ffi.c: Likewise. + * testsuite/libffi.call/float2.c: Likewise. + * testsuite/libffi.call/promotion.c: Likewise. + * testsuite/libffi.call/struct1.c: Likewise. + +2006-04-13 Andreas Tobler + + * src/pa/hpux32.S: Correct unwind offset calculation for + ffi_closure_pa32. + * src/pa/linux.S: Likewise. + +2006-04-12 James E Wilson + + PR libgcj/26483 + * src/ia64/ffi.c (stf_spill, ldf_fill): Rewrite as macros. + (hfa_type_load): Call stf_spill. + (hfa_type_store): Call ldf_fill. + (ffi_call): Adjust calls to above routines. Add local temps for + macro result. + +2006-04-10 Matthias Klose + + * testsuite/lib/libffi-dg.exp (libffi-init): Recognize multilib + directory names containing underscores. + +2006-04-07 James E Wilson + + * testsuite/libffi.call/float4.c: New testcase. + +2006-04-05 John David Anglin + Andreas Tobler + + * Makefile.am: Add PA_HPUX port. + * Makefile.in: Regenerate. + * include/Makefile.in: Likewise. + * testsuite/Makefile.in: Likewise. + * configure.ac: Add PA_HPUX rules. + * configure: Regenerate. + * src/pa/ffitarget.h: Rename linux target to PA_LINUX. + Add PA_HPUX and PA64_HPUX. + Rename FFI_LINUX ABI to FFI_PA32 ABI. + (FFI_TRAMPOLINE_SIZE): Define for 32-bit HP-UX targets. + (FFI_TYPE_SMALL_STRUCT2): Define. + (FFI_TYPE_SMALL_STRUCT4): Likewise. + (FFI_TYPE_SMALL_STRUCT8): Likewise. + (FFI_TYPE_SMALL_STRUCT3): Redefine. + (FFI_TYPE_SMALL_STRUCT5): Likewise. + (FFI_TYPE_SMALL_STRUCT6): Likewise. + (FFI_TYPE_SMALL_STRUCT7): Likewise. + * src/pa/ffi.c (ROUND_DOWN): Delete. + (fldw, fstw, fldd, fstd): Use '__asm__'. + (ffi_struct_type): Add support for FFI_TYPE_SMALL_STRUCT2, + FFI_TYPE_SMALL_STRUCT4 and FFI_TYPE_SMALL_STRUCT8. + (ffi_prep_args_LINUX): Rename to ffi_prep_args_pa32. Update comment. + Simplify incrementing of stack slot variable. Change type of local + 'n' to unsigned int. + (ffi_size_stack_LINUX): Rename to ffi_size_stack_pa32. Handle long + double on PA_HPUX. + (ffi_prep_cif_machdep): Likewise. + (ffi_call): Likewise. + (ffi_closure_inner_LINUX): Rename to ffi_closure_inner_pa32. Change + return type to ffi_status. Simplify incrementing of stack slot + variable. Only copy floating point argument registers when PA_LINUX + is true. Reformat debug statement. + Add support for FFI_TYPE_SMALL_STRUCT2, FFI_TYPE_SMALL_STRUCT4 and + FFI_TYPE_SMALL_STRUCT8. + (ffi_closure_LINUX): Rename to ffi_closure_pa32. Add 'extern' to + declaration. + (ffi_prep_closure): Make linux trampoline conditional on PA_LINUX. + Add nops to cache flush. Add trampoline for PA_HPUX. + * src/pa/hpux32.S: New file. + * src/pa/linux.S (ffi_call_LINUX): Rename to ffi_call_pa32. Rename + ffi_prep_args_LINUX to ffi_prep_args_pa32. + Localize labels. Add support for 2, 4 and 8-byte small structs. Handle + unaligned destinations in 3, 5, 6 and 7-byte small structs. Order + argument type checks so that common argument types appear first. + (ffi_closure_LINUX): Rename to ffi_closure_pa32. Rename + ffi_closure_inner_LINUX to ffi_closure_inner_pa32. + +2006-03-24 Alan Modra + + * src/powerpc/ffitarget.h (enum ffi_abi): Add FFI_LINUX. Default + for 32-bit using IBM extended double format. Fix FFI_LAST_ABI. + * src/powerpc/ffi.c (ffi_prep_args_SYSV): Handle linux variant of + FFI_TYPE_LONGDOUBLE. + (ffi_prep_args64): Assert using IBM extended double. + (ffi_prep_cif_machdep): Don't munge FFI_TYPE_LONGDOUBLE type. + Handle FFI_LINUX FFI_TYPE_LONGDOUBLE return and args. + (ffi_call): Handle FFI_LINUX. + (ffi_closure_helper_SYSV): Non FFI_LINUX long double return needs + gpr3 return pointer as for struct return. Handle FFI_LINUX + FFI_TYPE_LONGDOUBLE return and args. Don't increment "nf" + unnecessarily. + * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Load both f1 and f2 + for FFI_TYPE_LONGDOUBLE. Move epilogue insns into case table. + Don't use r6 as pointer to results, instead use sp offset. Don't + make a special call to load lr with case table address, instead + use offset from previous call. + * src/powerpc/sysv.S (ffi_call_SYSV): Save long double return. + * src/powerpc/linux64.S (ffi_call_LINUX64): Simplify long double + return. + +2006-03-15 Kaz Kojima + + * src/sh64/ffi.c (ffi_prep_cif_machdep): Handle float arguments + passed with FP registers correctly. + (ffi_closure_helper_SYSV): Likewise. + * src/sh64/sysv.S: Likewise. + +2006-03-01 Andreas Tobler + + * testsuite/libffi.special/unwindtest.cc (closure_test_fn): Mark cif, + args and userdata unused. + (closure_test_fn1): Mark cif and userdata unused. + (main): Remove unused res. + +2006-02-28 Andreas Tobler + + * testsuite/libffi.call/call.exp: Adjust FSF address. Add test runs for + -O2, -O3, -Os and the warning flags -W -Wall. + * testsuite/libffi.special/special.exp: Likewise. + * testsuite/libffi.call/ffitest.h: Add an __UNUSED__ macro to mark + unused parameter unused for gcc or else do nothing. + * testsuite/libffi.special/ffitestcxx.h: Likewise. + * testsuite/libffi.call/cls_12byte.c (cls_struct_12byte_gn): Mark cif + and userdata unused. + * testsuite/libffi.call/cls_16byte.c (cls_struct_16byte_gn): Likewise. + * testsuite/libffi.call/cls_18byte.c (cls_struct_18byte_gn): Likewise. + * testsuite/libffi.call/cls_19byte.c (cls_struct_19byte_gn): Likewise. + * testsuite/libffi.call/cls_1_1byte.c (cls_struct_1_1byte_gn): Likewise. + * testsuite/libffi.call/cls_20byte.c (cls_struct_20byte_gn): Likewise. + * testsuite/libffi.call/cls_20byte1.c (cls_struct_20byte_gn): Likewise. + * testsuite/libffi.call/cls_24byte.c (cls_struct_24byte_gn): Likewise. + * testsuite/libffi.call/cls_2byte.c (cls_struct_2byte_gn): Likewise. + * testsuite/libffi.call/cls_3_1byte.c (cls_struct_3_1byte_gn): Likewise. + * testsuite/libffi.call/cls_3byte1.c (cls_struct_3byte_gn): Likewise. + * testsuite/libffi.call/cls_3byte2.c (cls_struct_3byte_gn1): Likewise. + * testsuite/libffi.call/cls_4_1byte.c (cls_struct_4_1byte_gn): Likewise. + * testsuite/libffi.call/cls_4byte.c (cls_struct_4byte_gn): Likewise. + * testsuite/libffi.call/cls_5_1_byte.c (cls_struct_5byte_gn): Likewise. + * testsuite/libffi.call/cls_5byte.c (cls_struct_5byte_gn): Likewise. + * testsuite/libffi.call/cls_64byte.c (cls_struct_64byte_gn): Likewise. + * testsuite/libffi.call/cls_6_1_byte.c (cls_struct_6byte_gn): Likewise. + * testsuite/libffi.call/cls_6byte.c (cls_struct_6byte_gn): Likewise. + * testsuite/libffi.call/cls_7_1_byte.c (cls_struct_7byte_gn): Likewise. + * testsuite/libffi.call/cls_7byte.c (cls_struct_7byte_gn): Likewise. + * testsuite/libffi.call/cls_8byte.c (cls_struct_8byte_gn): Likewise. + * testsuite/libffi.call/cls_9byte1.c (cls_struct_9byte_gn): Likewise. + * testsuite/libffi.call/cls_9byte2.c (cls_struct_9byte_gn): Likewise. + * testsuite/libffi.call/cls_align_double.c (cls_struct_align_gn): + Likewise. + * testsuite/libffi.call/cls_align_float.c (cls_struct_align_gn): + Likewise. + * testsuite/libffi.call/cls_align_longdouble.c (cls_struct_align_gn): + Likewise. + * testsuite/libffi.call/cls_align_pointer.c (cls_struct_align_fn): Cast + void* to avoid compiler warning. + (main): Likewise. + (cls_struct_align_gn): Mark cif and userdata unused. + * testsuite/libffi.call/cls_align_sint16.c (cls_struct_align_gn): + Likewise. + * testsuite/libffi.call/cls_align_sint32.c (cls_struct_align_gn): + Likewise. + * testsuite/libffi.call/cls_align_sint64.c (cls_struct_align_gn): + Likewise. + * testsuite/libffi.call/cls_align_uint16.c (cls_struct_align_gn): + Likewise. + * testsuite/libffi.call/cls_align_uint32.c (cls_struct_align_gn): + Likewise. + * testsuite/libffi.call/cls_double.c (cls_ret_double_fn): Likewise. + * testsuite/libffi.call/cls_float.c (cls_ret_float_fn): Likewise. + * testsuite/libffi.call/cls_multi_schar.c (test_func_gn): Mark cif and + data unused. + (main): Cast res_call to silence gcc. + * testsuite/libffi.call/cls_multi_sshort.c (test_func_gn): Mark cif and + data unused. + (main): Cast res_call to silence gcc. + * testsuite/libffi.call/cls_multi_sshortchar.c (test_func_gn): Mark cif + and data unused. + (main): Cast res_call to silence gcc. + * testsuite/libffi.call/cls_multi_uchar.c (test_func_gn): Mark cif and + data unused. + (main): Cast res_call to silence gcc. + * testsuite/libffi.call/cls_multi_ushort.c (test_func_gn): Mark cif and + data unused. + (main): Cast res_call to silence gcc. + * testsuite/libffi.call/cls_multi_ushortchar.c (test_func_gn): Mark cif + and data unused. + (main): Cast res_call to silence gcc. + * testsuite/libffi.call/cls_schar.c (cls_ret_schar_fn): Mark cif and + userdata unused. + (cls_ret_schar_fn): Cast printf parameter to silence gcc. + * testsuite/libffi.call/cls_sint.c (cls_ret_sint_fn): Mark cif and + userdata unused. + (cls_ret_sint_fn): Cast printf parameter to silence gcc. + * testsuite/libffi.call/cls_sshort.c (cls_ret_sshort_fn): Mark cif and + userdata unused. + (cls_ret_sshort_fn): Cast printf parameter to silence gcc. + * testsuite/libffi.call/cls_uchar.c (cls_ret_uchar_fn): Mark cif and + userdata unused. + (cls_ret_uchar_fn): Cast printf parameter to silence gcc. + * testsuite/libffi.call/cls_uint.c (cls_ret_uint_fn): Mark cif and + userdata unused. + (cls_ret_uint_fn): Cast printf parameter to silence gcc. + * testsuite/libffi.call/cls_ulonglong.c (cls_ret_ulonglong_fn): Mark cif + and userdata unused. + * testsuite/libffi.call/cls_ushort.c (cls_ret_ushort_fn): Mark cif and + userdata unused. + (cls_ret_ushort_fn): Cast printf parameter to silence gcc. + * testsuite/libffi.call/float.c (floating): Remove unused parameter e. + * testsuite/libffi.call/float1.c (main): Remove unused variable i. + Cleanup white spaces. + * testsuite/libffi.call/negint.c (checking): Remove unused variable i. + * testsuite/libffi.call/nested_struct.c (cls_struct_combined_gn): Mark + cif and userdata unused. + * testsuite/libffi.call/nested_struct1.c (cls_struct_combined_gn): + Likewise. + * testsuite/libffi.call/nested_struct10.c (B_gn): Likewise. + * testsuite/libffi.call/nested_struct2.c (B_fn): Adjust printf + formatters to silence gcc. + (B_gn): Mark cif and userdata unused. + * testsuite/libffi.call/nested_struct3.c (B_gn): Mark cif and userdata + unused. + * testsuite/libffi.call/nested_struct4.c: Mention related PR. + (B_gn): Mark cif and userdata unused. + * testsuite/libffi.call/nested_struct5.c (B_gn): Mark cif and userdata + unused. + * testsuite/libffi.call/nested_struct6.c: Mention related PR. + (B_gn): Mark cif and userdata unused. + * testsuite/libffi.call/nested_struct7.c (B_gn): Mark cif and userdata + unused. + * testsuite/libffi.call/nested_struct8.c (B_gn): Likewise. + * testsuite/libffi.call/nested_struct9.c (B_gn): Likewise. + * testsuite/libffi.call/problem1.c (stub): Likewise. + * testsuite/libffi.call/pyobjc-tc.c (main): Cast the result to silence + gcc. + * testsuite/libffi.call/return_fl2.c (return_fl): Add the note mentioned + in the last commit for this test case in the test case itself. + * testsuite/libffi.call/closure_fn0.c (closure_test_fn0): Mark cif as + unused. + * testsuite/libffi.call/closure_fn1.c (closure_test_fn1): Likewise. + * testsuite/libffi.call/closure_fn2.c (closure_test_fn2): Likewise. + * testsuite/libffi.call/closure_fn3.c (closure_test_fn3): Likewise. + * testsuite/libffi.call/closure_fn4.c (closure_test_fn0): Likewise. + * testsuite/libffi.call/closure_fn5.c (closure_test_fn5): Likewise. + * testsuite/libffi.call/closure_fn6.c (closure_test_fn0): Likewise. + +2006-02-22 Kaz Kojima + + * src/sh/sysv.S: Fix register numbers in the FDE for + ffi_closure_SYSV. + +2006-02-20 Andreas Tobler + + * testsuite/libffi.call/return_fl2.c (return_fl): Remove static + declaration to avoid a false negative on ix86. See PR323. + +2006-02-18 Kaz Kojima + + * src/sh/ffi.c (ffi_closure_helper_SYSV): Remove unused variable + and cast integer to void * if needed. Update the pointer to + the FP register saved area correctly. + +2006-02-17 Andreas Tobler + + * testsuite/libffi.call/nested_struct6.c: XFAIL this test until PR25630 + is fixed. + * testsuite/libffi.call/nested_struct4.c: Likewise. + +2006-02-16 Andreas Tobler + + * testsuite/libffi.call/return_dbl.c: New test case. + * testsuite/libffi.call/return_dbl1.c: Likewise. + * testsuite/libffi.call/return_dbl2.c: Likewise. + * testsuite/libffi.call/return_fl.c: Likewise. + * testsuite/libffi.call/return_fl1.c: Likewise. + * testsuite/libffi.call/return_fl2.c: Likewise. + * testsuite/libffi.call/return_fl3.c: Likewise. + * testsuite/libffi.call/closure_fn6.c: Likewise. + + * testsuite/libffi.call/nested_struct2.c: Remove ffi_type_mylong + definition. + * testsuite/libffi.call/ffitest.h: Add ffi_type_mylong definition + here to be used by other test cases too. + + * testsuite/libffi.call/nested_struct10.c: New test case. + * testsuite/libffi.call/nested_struct9.c: Likewise. + * testsuite/libffi.call/nested_struct8.c: Likewise. + * testsuite/libffi.call/nested_struct7.c: Likewise. + * testsuite/libffi.call/nested_struct6.c: Likewise. + * testsuite/libffi.call/nested_struct5.c: Likewise. + * testsuite/libffi.call/nested_struct4.c: Likewise. + +2006-01-21 Andreas Tobler + + * configure.ac: Enable libffi for sparc64-*-freebsd*. + * configure: Rebuilt. + +2006-01-18 Jakub Jelinek + + * src/powerpc/sysv.S (smst_two_register): Don't call __ashldi3, + instead do the shifting inline. + * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Don't compute %r5 + shift count unconditionally. Simplify load sequences for 1, 2, 3, 4 + and 8 byte structs, for the remaining struct sizes don't call + __lshrdi3, instead do the shifting inline. + +2005-12-07 Thiemo Seufer + + * src/mips/ffitarget.h: Remove obsolete sgidefs.h include. Add + missing parentheses. + * src/mips/o32.S (ffi_call_O32): Code formatting. Define + and use A3_OFF, FP_OFF, RA_OFF. Micro-optimizations. + (ffi_closure_O32): Likewise, but with newly defined A3_OFF2, + A2_OFF2, A1_OFF2, A0_OFF2, RA_OFF2, FP_OFF2, S0_OFF2, GP_OFF2, + V1_OFF2, V0_OFF2, FA_1_1_OFF2, FA_1_0_OFF2, FA_0_1_OFF2, + FA_0_0_OFF2. + * src/mips/ffi.c (ffi_prep_args): Code formatting. Fix + endianness bugs. + (ffi_prep_closure): Improve trampoline instruction scheduling. + (ffi_closure_mips_inner_O32): Fix endianness bugs. + +2005-12-03 Alan Modra + + * src/powerpc/ffi.c: Formatting. + (ffi_prep_args_SYSV): Avoid possible aliasing problems by using unions. + (ffi_prep_args64): Likewise. + +2005-09-30 Geoffrey Keating + + * testsuite/lib/libffi-dg.exp (libffi_target_compile): For + darwin, use -shared-libgcc not -lgcc_s, and explain why. + +2005-09-26 Tom Tromey + + * testsuite/libffi.call/float1.c (value_type): New typedef. + (CANARY): New define. + (main): Check for result buffer overflow. + * src/powerpc/linux64.S: Handle linux64 long double returns. + * src/powerpc/ffi.c (FLAG_RETURNS_128BITS): New constant. + (ffi_prep_cif_machdep): Handle linux64 long double returns. + +2005-08-25 Alan Modra + + PR target/23404 + * src/powerpc/ffi.c (ffi_prep_args_SYSV): Correct placement of stack + homed fp args. + (ffi_status ffi_prep_cif_machdep): Correct stack sizing for same. + +2005-08-11 Jakub Jelinek + + * configure.ac (HAVE_HIDDEN_VISIBILITY_ATTRIBUTE): New test. + (AH_BOTTOM): Add FFI_HIDDEN definition. + * configure: Rebuilt. + * fficonfig.h.in: Rebuilt. + * src/powerpc/ffi.c (hidden): Remove. + (ffi_closure_LINUX64, ffi_prep_args64, ffi_call_LINUX64, + ffi_closure_helper_LINUX64): Use FFI_HIDDEN instead of hidden. + * src/powerpc/linux64_closure.S (ffi_closure_LINUX64, + .ffi_closure_LINUX64): Use FFI_HIDDEN instead of .hidden. + * src/x86/ffi.c (ffi_closure_SYSV, ffi_closure_raw_SYSV): Remove, + add FFI_HIDDEN to its prototype. + (ffi_closure_SYSV_inner): New. + * src/x86/sysv.S (ffi_closure_SYSV, ffi_closure_raw_SYSV): New. + * src/x86/win32.S (ffi_closure_SYSV, ffi_closure_raw_SYSV): New. + +2005-08-10 Alfred M. Szmidt + + PR libffi/21819: + * configure: Rebuilt. + * configure.ac: Handle i*86-*-gnu*. + +2005-08-09 Jakub Jelinek + + * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Use + DW_CFA_offset_extended_sf rather than + DW_CFA_GNU_negative_offset_extended. + * src/powerpc/sysv.S (ffi_call_SYSV): Likewise. + +2005-07-22 SUGIOKA Toshinobu + + * src/sh/sysv.S (ffi_call_SYSV): Stop argument popping correctly + on sh3. + (ffi_closure_SYSV): Change the stack layout for sh3 struct argument. + * src/sh/ffi.c (ffi_prep_args): Fix sh3 argument copy, when it is + partially on register. + (ffi_closure_helper_SYSV): Likewise. + (ffi_prep_cif_machdep): Don't set too many cif->flags. + +2005-07-20 Kaz Kojima + + * src/sh/ffi.c (ffi_call): Handle small structures correctly. + Remove empty line. + * src/sh64/ffi.c (simple_type): Remove. + (return_type): Handle small structures correctly. + (ffi_prep_args): Likewise. + (ffi_call): Likewise. + (ffi_closure_helper_SYSV): Likewise. + * src/sh64/sysv.S (ffi_call_SYSV): Handle 1, 2 and 4-byte return. + Emit position independent code if PIC and remove wrong datalabel + prefixes from EH data. + +2005-07-19 Andreas Tobler + + * Makefile.am (nodist_libffi_la_SOURCES): Add POWERPC_FREEBSD. + * Makefile.in: Regenerate. + * include/Makefile.in: Likewise. + * testsuite/Makefile.in: Likewise. + * configure.ac: Add POWERPC_FREEBSD rules. + * configure: Regenerate. + * src/powerpc/ffitarget.h: Add POWERPC_FREEBSD rules. + (FFI_SYSV_TYPE_SMALL_STRUCT): Define. + * src/powerpc/ffi.c: Add flags to handle small structure returns + in ffi_call_SYSV. + (ffi_prep_cif_machdep): Handle small structures for SYSV 4 ABI. + Aka FFI_SYSV. + (ffi_closure_helper_SYSV): Likewise. + * src/powerpc/ppc_closure.S: Add return types for small structures. + * src/powerpc/sysv.S: Add bits to handle small structures for + final SYSV 4 ABI. + +2005-07-10 Andreas Tobler + + * testsuite/libffi.call/cls_5_1_byte.c: New test file. + * testsuite/libffi.call/cls_6_1_byte.c: Likewise. + * testsuite/libffi.call/cls_7_1_byte.c: Likewise. + +2005-07-05 Randolph Chung + + * src/pa/ffi.c (ffi_struct_type): Rename FFI_TYPE_SMALL_STRUCT1 + as FFI_TYPE_SMALL_STRUCT3. Break out handling for 5-7 byte + structures. Kill compilation warnings. + (ffi_closure_inner_LINUX): Print return values as hex in debug + message. Rename FFI_TYPE_SMALL_STRUCT1 as FFI_TYPE_SMALL_STRUCT3. + Properly handle 5-7 byte structure returns. + * src/pa/ffitarget.h (FFI_TYPE_SMALL_STRUCT1) + (FFI_TYPE_SMALL_STRUCT2): Remove. + (FFI_TYPE_SMALL_STRUCT3, FFI_TYPE_SMALL_STRUCT5) + (FFI_TYPE_SMALL_STRUCT6, FFI_TYPE_SMALL_STRUCT7): Define. + * src/pa/linux.S: Mark source file as using PA1.1 assembly. + (checksmst1, checksmst2): Remove. + (checksmst3): Optimize handling of 3-byte struct returns. + (checksmst567): Properly handle 5-7 byte struct returns. + +2005-06-15 Rainer Orth + + PR libgcj/21943 + * src/mips/n32.S: Enforce PIC code. + * src/mips/o32.S: Likewise. + +2005-06-15 Rainer Orth + + * configure.ac: Treat i*86-*-solaris2.10 and up as X86_64. + * configure: Regenerate. + +2005-06-01 Alan Modra + + * src/powerpc/ppc_closure.S (ffi_closure_SYSV): Don't use JUMPTARGET + to call ffi_closure_helper_SYSV. Append @local instead. + * src/powerpc/sysv.S (ffi_call_SYSV): Likewise for ffi_prep_args_SYSV. + +2005-05-17 Kelley Cook + + * configure.ac: Use AC_C_BIGENDIAN instead of AC_C_BIGENDIAN_CROSS. + Use AC_CHECK_SIZEOF instead of AC_COMPILE_CHECK_SIZEOF. + * Makefile.am (ACLOCAL_AMFLAGS): Remove -I ../config. + * aclocal.m4, configure, fficonfig.h.in, Makefile.in, + include/Makefile.in, testsuite/Makefile.in: Regenerate. + +2005-05-09 Mike Stump + + * configure: Regenerate. + +2005-05-08 Richard Henderson + + PR libffi/21285 + * src/alpha/osf.S: Update unwind into to match code. + +2005-05-04 Andreas Degert + Richard Henderson + + * src/x86/ffi64.c (ffi_prep_cif_machdep): Save sse-used flag in + bit 11 of flags. + (ffi_call): Mask return type field. Pass ssecount to ffi_call_unix64. + (ffi_prep_closure): Set carry bit if sse-used flag set. + * src/x86/unix64.S (ffi_call_unix64): Add ssecount argument. + Only load sse registers if ssecount non-zero. + (ffi_closure_unix64): Only save sse registers if carry set on entry. + +2005-04-29 Ralf Corsepius + + * configure.ac: Add i*86-*-rtems*, sparc*-*-rtems*, + powerpc-*rtems*, arm*-*-rtems*, sh-*-rtems*. + * configure: Regenerate. + +2005-04-20 Hans-Peter Nilsson + + * testsuite/lib/libffi-dg.exp (libffi-dg-test-1): In regsub use, + have Tcl8.3-compatible intermediate variable. + +2005-04-18 Simon Posnjak + Hans-Peter Nilsson + + * Makefile.am: Add CRIS support. + * configure.ac: Likewise. + * Makefile.in, configure, testsuite/Makefile.in, + include/Makefile.in: Regenerate. + * src/cris: New directory. + * src/cris/ffi.c, src/cris/sysv.S, src/cris/ffitarget.h: New files. + * src/prep_cif.c (ffi_prep_cif): Wrap in #ifndef __CRIS__. + + * testsuite/lib/libffi-dg.exp (libffi-dg-test-1): Replace \n with + \r?\n in output tests. + +2005-04-12 Mike Stump + + * configure: Regenerate. + +2005-03-30 Hans Boehm + + * src/ia64/ffitarget.h (ffi_arg): Use long long instead of DI. + +2005-03-30 Steve Ellcey + + * src/ia64/ffitarget.h (ffi_arg) ADD DI attribute. + (ffi_sarg) Ditto. + * src/ia64/unix.S (ffi_closure_unix): Extend gp + to 64 bits in ILP32 mode. + Load 64 bits even for short data. + +2005-03-23 Mike Stump + + * src/powerpc/darwin.S: Update for -m64 multilib. + * src/powerpc/darwin_closure.S: Likewise. + +2005-03-21 Zack Weinberg + + * configure.ac: Do not invoke TL_AC_GCC_VERSION. + Do not set tool_include_dir. + * aclocal.m4, configure, Makefile.in, testsuite/Makefile.in: + Regenerate. + * include/Makefile.am: Set gcc_version and toollibffidir. + * include/Makefile.in: Regenerate. + +2005-02-22 Andrew Haley + + * src/powerpc/ffi.c (ffi_prep_cif_machdep): Bump alignment to + odd-numbered register pairs for 64-bit integer types. + +2005-02-23 Andreas Tobler + + PR libffi/20104 + * testsuite/libffi.call/return_ll1.c: New test case. + +2005-02-11 Janis Johnson + + * testsuite/libffi.call/cls_align_longdouble.c: Remove dg-options. + * testsuite/libffi.call/float.c: Ditto. + * testsuite/libffi.call/float2.c: Ditto. + * testsuite/libffi.call/float3.c: Ditto. + +2005-02-08 Andreas Tobler + + * src/frv/ffitarget.h: Remove PPC stuff which does not belong to frv. + +2005-01-12 Eric Botcazou + + * testsuite/libffi.special/special.exp (cxx_options): Add + -shared-libgcc. + +2004-12-31 Richard Henderson + + * src/types.c (FFI_AGGREGATE_TYPEDEF): Remove. + (FFI_TYPEDEF): Rename from FFI_INTEGRAL_TYPEDEF. Replace size and + offset parameters with a type parameter; deduce size and structure + alignment. Update all users. + +2004-12-31 Richard Henderson + + * src/types.c (FFI_TYPE_POINTER): Define with sizeof. + (FFI_TYPE_LONGDOUBLE): Fix for ia64. + * src/ia64/ffitarget.h (struct ffi_ia64_trampoline_struct): Move + into ffi_prep_closure. + * src/ia64/ia64_flags.h, src/ia64/ffi.c, src/ia64/unix.S: Rewrite + from scratch. + +2004-12-27 Richard Henderson + + * src/x86/unix64.S: Fix typo in unwind info. + +2004-12-25 Richard Henderson + + * src/x86/ffi64.c (struct register_args): Rename from stackLayout. + (enum x86_64_reg_class): Add X86_64_COMPLEX_X87_CLASS. + (merge_classes): Check for it. + (SSE_CLASS_P): New. + (classify_argument): Pass byte_offset by value; perform all updates + inside struct case. + (examine_argument): Add classes argument; handle + X86_64_COMPLEX_X87_CLASS. + (ffi_prep_args): Merge into ... + (ffi_call): ... here. Share stack frame with ffi_call_unix64. + (ffi_prep_cif_machdep): Setup cif->flags for proper structure return. + (ffi_fill_return_value): Remove. + (ffi_prep_closure): Remove dead assert. + (ffi_closure_unix64_inner): Rename from ffi_closure_UNIX64_inner. + Rewrite to use struct register_args instead of va_list. Create + flags for handling structure returns. + * src/x86/unix64.S: Remove dead strings. + (ffi_call_unix64): Rename from ffi_call_UNIX64. Rewrite to share + stack frame with ffi_call. Handle structure returns properly. + (float2sse, floatfloat2sse, double2sse): Remove. + (sse2float, sse2double, sse2floatfloat): Remove. + (ffi_closure_unix64): Rename from ffi_closure_UNIX64. Rewrite + to handle structure returns properly. + +2004-12-08 David Edelsohn + + * Makefile.am (AM_MAKEFLAGS): Remove duplicate LIBCFLAGS and + PICFLAG. + * Makefile.in: Regenerated. + +2004-12-02 Richard Sandiford + + * configure.ac: Use TL_AC_GCC_VERSION to set gcc_version. + * configure, aclocal.m4, Makefile.in: Regenerate. + * include/Makefile.in, testsuite/Makefile.in: Regenerate. + +2004-11-29 Kelley Cook + + * configure: Regenerate for libtool change. + +2004-11-25 Kelley Cook + + * configure: Regenerate for libtool reversion. + +2004-11-24 Kelley Cook + + * configure: Regenerate for libtool change. + +2004-11-23 John David Anglin + + * testsuite/lib/libffi-dg.exp: Use new procs in target-libpath.exp. + +2004-11-23 Richard Sandiford + + * src/mips/o32.S (ffi_call_O32, ffi_closure_O32): Use jalr instead + of jal. Use an absolute encoding for the frame information. + +2004-11-23 Kelley Cook + + * Makefile.am: Remove no-dependencies. Add ACLOCAL_AMFLAGS. + * acinclude.m4: Delete logic for sincludes. + * aclocal.m4, Makefile.in, configure: Regenerate. + * include/Makefile: Likewise. + * testsuite/Makefile: Likewise. + +2004-11-22 Eric Botcazou + + * src/sparc/ffi.c (ffi_prep_closure): Align doubles and 64-bit integers + on a 8-byte boundary. + * src/sparc/v8.S (ffi_closure_v8): Reserve frame space for arguments. + +2004-10-27 Richard Earnshaw + + * src/arm/ffi.c (ffi_prep_cif_machdep): Handle functions that return + long long values. Round stack allocation to a multiple of 8 bytes + for ATPCS compatibility. + * src/arm/sysv.S (ffi_call_SYSV): Rework to avoid use of APCS register + names. Handle returning long long types. Add Thumb and interworking + support. Improve soft-float code. + +2004-10-27 Richard Earnshaw + + * testsuite/lib/libffi-db.exp (load_gcc_lib): New function. + (libffi_exit): New function. + (libffi_init): Build the testglue wrapper if needed. + +2004-10-25 Eric Botcazou + + PR other/18138 + * testsuite/lib/libffi-dg.exp: Accept more than one multilib libgcc. + +2004-10-25 Kazuhiro Inaoka + + * src/m32r/libffitarget.h (FFI_CLOSURES): Set to 0. + +2004-10-20 Kaz Kojima + + * src/sh/sysv.S (ffi_call_SYSV): Don't align for double data. + * testsuite/libffi.call/float3.c: New test case. + +2004-10-18 Kaz Kojima + + * src/sh/ffi.c (ffi_prep_closure): Set T bit in trampoline for + the function returning a structure pointed with R2. + * src/sh/sysv.S (ffi_closure_SYSV): Use R2 as the pointer to + the structure return value if T bit set. Emit position + independent code and EH data if PIC. + +2004-10-13 Kazuhiro Inaoka + + * Makefile.am: Add m32r support. + * configure.ac: Likewise. + * Makefile.in: Regenerate. + * confiugre: Regenerate. + * src/types.c: Add m32r port to FFI_INTERNAL_TYPEDEF + (uint64, sint64, double, longdouble) + * src/m32r: New directory. + * src/m32r/ffi.c: New file. + * src/m32r/sysv.S: Likewise. + * src/m32r/ffitarget.h: Likewise. + +2004-10-02 Kaz Kojima + + * testsuite/libffi.call/negint.c: New test case. + +2004-09-14 H.J. Lu + + PR libgcj/17465 + * testsuite/lib/libffi-dg.exp: Don't use global ld_library_path. + Set up LD_LIBRARY_PATH, SHLIB_PATH, LD_LIBRARYN32_PATH, + LD_LIBRARY64_PATH, LD_LIBRARY_PATH_32, LD_LIBRARY_PATH_64 and + DYLD_LIBRARY_PATH. + +2004-09-05 Andreas Tobler + + * testsuite/libffi.call/many_win32.c: Remove whitespaces. + * testsuite/libffi.call/promotion.c: Likewise. + * testsuite/libffi.call/return_ll.c: Remove unused var. Cleanup + whitespaces. + * testsuite/libffi.call/return_sc.c: Likewise. + * testsuite/libffi.call/return_uc.c: Likewise. + +2004-09-05 Andreas Tobler + + * src/powerpc/darwin.S: Fix comments and identation. + * src/powerpc/darwin_closure.S: Likewise. + +2004-09-02 Andreas Tobler + + * src/powerpc/ffi_darwin.c: Add flag for longdouble return values. + (ffi_prep_args): Handle longdouble arguments. + (ffi_prep_cif_machdep): Set flags for longdouble. Calculate space for + longdouble. + (ffi_closure_helper_DARWIN): Add closure handling for longdouble. + * src/powerpc/darwin.S (_ffi_call_DARWIN): Add handling of longdouble + values. + * src/powerpc/darwin_closure.S (_ffi_closure_ASM): Likewise. + * src/types.c: Defined longdouble size and alignment for darwin. + +2004-09-02 Andreas Tobler + + * src/powerpc/aix.S: Remove whitespaces. + * src/powerpc/aix_closure.S: Likewise. + * src/powerpc/asm.h: Likewise. + * src/powerpc/ffi.c: Likewise. + * src/powerpc/ffitarget.h: Likewise. + * src/powerpc/linux64.S: Likewise. + * src/powerpc/linux64_closure.S: Likewise. + * src/powerpc/ppc_closure.S: Likewise. + * src/powerpc/sysv.S: Likewise. + +2004-08-30 Anthony Green + + * Makefile.am: Add frv support. + * Makefile.in, testsuite/Makefile.in: Rebuilt. + * configure.ac: Read configure.host. + * configure.in: Read configure.host. + * configure.host: New file. frv-elf needs libgloss. + * include/ffi.h.in: Force ffi_closure to have a nice big (8) + alignment. This is needed to frv and shouldn't harm the others. + * include/ffi_common.h (ALIGN_DOWN): New macro. + * src/frv/ffi.c, src/frv/ffitarget.h, src/frv/eabi.S: New files. + +2004-08-24 David Daney + + * testsuite/libffi.call/closure_fn0.c: Xfail mips64* instead of mips*. + * testsuite/libffi.call/closure_fn1.c: Likewise. + * testsuite/libffi.call/closure_fn2.c Likewise. + * testsuite/libffi.call/closure_fn3.c: Likewise. + * testsuite/libffi.call/closure_fn4.c: Likewise. + * testsuite/libffi.call/closure_fn5.c: Likewise. + * testsuite/libffi.call/cls_18byte.c: Likewise. + * testsuite/libffi.call/cls_19byte.c: Likewise. + * testsuite/libffi.call/cls_1_1byte.c: Likewise. + * testsuite/libffi.call/cls_20byte.c: Likewise. + * testsuite/libffi.call/cls_20byte1.c: Likewise. + * testsuite/libffi.call/cls_24byte.c: Likewise. + * testsuite/libffi.call/cls_2byte.c: Likewise. + * testsuite/libffi.call/cls_3_1byte.c: Likewise. + * testsuite/libffi.call/cls_3byte1.c: Likewise. + * testsuite/libffi.call/cls_3byte2.c: Likewise. + * testsuite/libffi.call/cls_4_1byte.c: Likewise. + * testsuite/libffi.call/cls_4byte.c: Likewise. + * testsuite/libffi.call/cls_64byte.c: Likewise. + * testsuite/libffi.call/cls_6byte.c: Likewise. + * testsuite/libffi.call/cls_7byte.c: Likewise. + * testsuite/libffi.call/cls_8byte.c: Likewise. + * testsuite/libffi.call/cls_9byte1.c: Likewise. + * testsuite/libffi.call/cls_9byte2.c: Likewise. + * testsuite/libffi.call/cls_align_double.c: Likewise. + * testsuite/libffi.call/cls_align_float.c: Likewise. + * testsuite/libffi.call/cls_align_longdouble.c: Likewise. + * testsuite/libffi.call/cls_align_pointer.c: Likewise. + * testsuite/libffi.call/cls_align_sint16.c: Likewise. + * testsuite/libffi.call/cls_align_sint32.c: Likewise. + * testsuite/libffi.call/cls_align_sint64.c: Likewise. + * testsuite/libffi.call/cls_align_uint16.c: Likewise. + * testsuite/libffi.call/cls_align_uint32.c: Likewise. + * testsuite/libffi.call/cls_align_uint64.c: Likewise. + * testsuite/libffi.call/cls_double.c: Likewise. + * testsuite/libffi.call/cls_float.c: Likewise. + * testsuite/libffi.call/cls_multi_schar.c: Likewise. + * testsuite/libffi.call/cls_multi_sshort.c: Likewise. + * testsuite/libffi.call/cls_multi_sshortchar.c: Likewise. + * testsuite/libffi.call/cls_multi_uchar.c: Likewise. + * testsuite/libffi.call/cls_multi_ushort.c: Likewise. + * testsuite/libffi.call/cls_multi_ushortchar.c: Likewise. + * testsuite/libffi.call/cls_schar.c: Likewise. + * testsuite/libffi.call/cls_sint.c: Likewise. + * testsuite/libffi.call/cls_sshort.c: Likewise. + * testsuite/libffi.call/cls_uchar.c: Likewise. + * testsuite/libffi.call/cls_uint.c: Likewise. + * testsuite/libffi.call/cls_ulonglong.c: Likewise. + * testsuite/libffi.call/cls_ushort.c: Likewise. + * testsuite/libffi.call/nested_struct.c: Likewise. + * testsuite/libffi.call/nested_struct1.c: Likewise. + * testsuite/libffi.call/nested_struct2.c: Likewise. + * testsuite/libffi.call/nested_struct3.c: Likewise. + * testsuite/libffi.call/problem1.c: Likewise. + * testsuite/libffi.special/unwindtest.cc: Likewise. + * testsuite/libffi.call/cls_12byte.c: Likewise and set return value + to zero. + * testsuite/libffi.call/cls_16byte.c: Likewise. + * testsuite/libffi.call/cls_5byte.c: Likewise. + +2004-08-23 David Daney + + PR libgcj/13141 + * src/mips/ffitarget.h (FFI_O32_SOFT_FLOAT): New ABI. + * src/mips/ffi.c (ffi_prep_args): Fix alignment calculation. + (ffi_prep_cif_machdep): Handle FFI_O32_SOFT_FLOAT floating point + parameters and return types. + (ffi_call): Handle FFI_O32_SOFT_FLOAT ABI. + (ffi_prep_closure): Ditto. + (ffi_closure_mips_inner_O32): Handle FFI_O32_SOFT_FLOAT ABI, fix + alignment calculations. + * src/mips/o32.S (ffi_closure_O32): Don't use floating point + instructions if FFI_O32_SOFT_FLOAT, make stack frame ABI compliant. + +2004-08-14 Casey Marshall + + * src/mips/ffi.c (ffi_pref_cif_machdep): set `cif->flags' to + contain `FFI_TYPE_UINT64' as return type for any 64-bit + integer (O32 ABI only). + (ffi_prep_closure): new function. + (ffi_closure_mips_inner_O32): new function. + * src/mips/ffitarget.h: Define `FFI_CLOSURES' and + `FFI_TRAMPOLINE_SIZE' appropriately if the ABI is o32. + * src/mips/o32.S (ffi_call_O32): add labels for .eh_frame. Return + 64 bit integers correctly. + (ffi_closure_O32): new function. + Added DWARF-2 unwind info for both functions. + +2004-08-10 Andrew Haley + + * src/x86/ffi64.c (ffi_prep_args ): 8-align all stack arguments. + +2004-08-01 Robert Millan + + * configure.ac: Detect knetbsd-gnu and kfreebsd-gnu. + * configure: Regenerate. + +2004-07-30 Maciej W. Rozycki + + * acinclude.m4 (AC_FUNC_MMAP_BLACKLIST): Check for + and mmap() explicitly instead of relying on preset autoconf cache + variables. + * aclocal.m4: Regenerate. + * configure: Regenerate. + +2004-07-11 Ulrich Weigand + + * src/s390/ffi.c (ffi_prep_args): Fix C aliasing violation. + (ffi_check_float_struct): Remove unused prototype. + +2004-06-30 Geoffrey Keating + + * src/powerpc/ffi_darwin.c (flush_icache): ';' is a comment + character on Darwin, use '\n\t' instead. + +2004-06-26 Matthias Klose + + * libtool-version: Fix typo in revision/age. + +2004-06-17 Matthias Klose + + * libtool-version: New. + * Makefile.am (libffi_la_LDFLAGS): Use -version-info for soname. + * Makefile.in: Regenerate. + +2004-06-15 Paolo Bonzini + + * Makefile.am: Remove useless multilib rules. + * Makefile.in: Regenerate. + * aclocal.m4: Regenerate with automake 1.8.5. + * configure.ac: Remove useless multilib configury. + * configure: Regenerate. + +2004-06-15 Paolo Bonzini + + * .cvsignore: New file. + +2004-06-10 Jakub Jelinek + + * src/ia64/unix.S (ffi_call_unix): Insert group barrier break + fp_done. + (ffi_closure_UNIX): Fix f14/f15 adjustment if FLOAT_SZ is ever + changed from 8. + +2004-06-06 Sean McNeil + + * configure.ac: Add x86_64-*-freebsd* support. + * configure: Regenerate. + +2004-04-26 Joe Buck + + Bug 15093 + * configure.ac: Test for existence of mmap and sys/mman.h before + checking blacklist. Fix suggested by Jim Wilson. + * configure: Regenerate. + +2004-04-26 Matt Austern + + * src/powerpc/darwin.S: Go through a non-lazy pointer for initial + FDE location. + * src/powerpc/darwin_closure.S: Likewise. + +2004-04-24 Andreas Tobler + + * testsuite/libffi.call/cls_multi_schar.c (main): Fix initialization + error. Reported by Thomas Heller . + * testsuite/libffi.call/cls_multi_sshort.c (main): Likewise. + * testsuite/libffi.call/cls_multi_ushort.c (main): Likewise. + +2004-03-20 Matthias Klose + + * src/pa/linux.S: Fix typo. + +2004-03-19 Matthias Klose + + * Makefile.am: Update. + * Makefile.in: Regenerate. + * src/pa/ffi.h.in: Remove. + * src/pa/ffitarget.h: New file. + +2004-02-10 Randolph Chung + + * Makefile.am: Add PA support. + * Makefile.in: Regenerate. + * include/Makefile.in: Regenerate. + * configure.ac: Add PA target. + * configure: Regenerate. + * src/pa/ffi.c: New file. + * src/pa/ffi.h.in: Add PA support. + * src/pa/linux.S: New file. + * prep_cif.c: Add PA support. + +2004-03-16 Hosaka Yuji + + * src/types.c: Fix alignment size of X86_WIN32 case int64 and + double. + * src/x86/ffi.c (ffi_prep_args): Replace ecif->cif->rtype->type + with ecif->cif->flags. + (ffi_call, ffi_prep_incoming_args_SYSV): Replace cif->rtype->type + with cif->flags. + (ffi_prep_cif_machdep): Add X86_WIN32 struct case. + (ffi_closure_SYSV): Add 1 or 2-bytes struct case for X86_WIN32. + * src/x86/win32.S (retstruct1b, retstruct2b, sc_retstruct1b, + sc_retstruct2b): Add for 1 or 2-bytes struct case. + +2004-03-15 Kelley Cook + + * configure.in: Rename file to ... + * configure.ac: ... this. + * fficonfig.h.in: Regenerate. + * Makefile.in: Regenerate. + * include/Makefile.in: Regenerate. + * testsuite/Makefile.in: Regenerate. + +2004-03-12 Matt Austern + + * src/powerpc/darwin.S: Fix EH information so it corresponds to + changes in EH format resulting from addition of linkonce support. + * src/powerpc/darwin_closure.S: Likewise. + +2004-03-11 Andreas Tobler + Paolo Bonzini + + * Makefile.am (AUTOMAKE_OPTIONS): Set them. + Remove VPATH. Remove rules for object files. Remove multilib support. + (AM_CCASFLAGS): Add. + * configure.in (AC_CONFIG_HEADERS): Relace AM_CONFIG_HEADER. + (AC_PREREQ): Bump version to 2.59. + (AC_INIT): Fill with version info and bug address. + (ORIGINAL_LD_FOR_MULTILIBS): Remove. + (AM_ENABLE_MULTILIB): Use this instead of AC_ARG_ENABLE. + De-precious CC so that the right flags are passed down to multilibs. + (AC_MSG_ERROR): Replace obsolete macro AC_ERROR. + (AC_CONFIG_FILES): Replace obsolete macro AC_LINK_FILES. + (AC_OUTPUT): Reorganize the output with AC_CONFIG_COMMANDS. + * configure: Rebuilt. + * aclocal.m4: Likewise. + * Makefile.in, include/Makefile.in, testsuite/Makefile.in: Likewise. + * fficonfig.h.in: Likewise. + +2004-03-11 Andreas Schwab + + * src/ia64/ffi.c (ffi_prep_incoming_args_UNIX): Get floating point + arguments from fp registers only for the first 8 parameter slots. + Don't convert a float parameter when passed in memory. + +2004-03-09 Hans-Peter Nilsson + + * configure: Regenerate for config/accross.m4 correction. + +2004-02-25 Matt Kraai + + * src/powerpc/ffi.c (ffi_prep_args_SYSV): Change + ecif->cif->bytes to bytes. + (ffi_prep_cif_machdep): Add braces around nested if statement. + +2004-02-09 Alan Modra + + * src/types.c (pointer): POWERPC64 has 8 byte pointers. + + * src/powerpc/ffi.c (ffi_prep_args64): Correct long double handling. + (ffi_closure_helper_LINUX64): Fix typo. + * testsuite/libffi.call/cls_align_longdouble.c: Pass -mlong-double-128 + for powerpc64-*-*. + * testsuite/libffi.call/float.c: Likewise. + * testsuite/libffi.call/float2.c: Likewise. + +2004-02-08 Alan Modra + + * src/powerpc/ffi.c (ffi_prep_cif_machdep ): Correct + long double function return and long double arg handling. + (ffi_closure_helper_LINUX64): Formatting. Delete unused "ng" var. + Use "end_pfr" instead of "nf". Correct long double handling. + Localise "temp". + * src/powerpc/linux64.S (ffi_call_LINUX64): Save f2 long double + return value. + * src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Allocate + space for long double return value. Adjust stack frame and offsets. + Load f2 long double return. + +2004-02-07 Alan Modra + + * src/types.c: Use 16 byte long double for POWERPC64. + +2004-01-25 Eric Botcazou + + * src/sparc/ffi.c (ffi_prep_args_v9): Shift the parameter array + when the structure return address is passed in %o0. + (ffi_V9_return_struct): Rename into ffi_v9_layout_struct. + (ffi_v9_layout_struct): Align the field following a nested structure + on a word boundary. Use memmove instead of memcpy. + (ffi_call): Update call to ffi_V9_return_struct. + (ffi_prep_closure): Define 'ctx' only for V8. + (ffi_closure_sparc_inner): Clone into ffi_closure_sparc_inner_v8 + and ffi_closure_sparc_inner_v9. + (ffi_closure_sparc_inner_v8): Return long doubles by reference. + Always skip the structure return address. For structures and long + doubles, copy the argument directly. + (ffi_closure_sparc_inner_v9): Skip the structure return address only + if required. Shift the maximum floating-point slot accordingly. For + big structures, copy the argument directly; otherwise, left-justify the + argument and call ffi_v9_layout_struct to lay out the structure on + the stack. + * src/sparc/v8.S: Undef STACKFRAME before defining it. + (ffi_closure_v8): Pass the structure return address. Update call to + ffi_closure_sparc_inner_v8. Short-circuit FFI_TYPE_INT handling. + Skip the 'unimp' insn when returning long doubles and structures. + * src/sparc/v9.S: Undef STACKFRAME before defining it. + (ffi_closure_v9): Increase the frame size by 2 words. Short-circuit + FFI_TYPE_INT handling. Load structures both in integers and + floating-point registers on return. + * README: Update status of the SPARC port. + +2004-01-24 Andreas Tobler + + * testsuite/libffi.call/pyobjc-tc.c (main): Treat result value + as of type ffi_arg. + * testsuite/libffi.call/struct3.c (main): Fix CHECK. + +2004-01-22 Ulrich Weigand + + * testsuite/libffi.call/cls_uint.c (cls_ret_uint_fn): Treat result + value as of type ffi_arg, not unsigned int. + +2004-01-21 Michael Ritzert + + * ffi64.c (ffi_prep_args): Cast the RHS of an assignment instead + of the LHS. + +2004-01-12 Andreas Tobler + + * testsuite/lib/libffi-dg.exp: Set LD_LIBRARY_PATH_32 for + Solaris. + +2004-01-08 Rainer Orth + + * testsuite/libffi.call/ffitest.h (allocate_mmap): Cast MAP_FAILED + to void *. + +2003-12-10 Richard Henderson + + * testsuite/libffi.call/cls_align_pointer.c: Cast pointers to + size_t instead of int. + +2003-12-04 Hosaka Yuji + + * testsuite/libffi.call/many_win32.c: Include . + * testsuite/libffi.call/many_win32.c (main): Replace variable + int i with unsigned long ul. + + * testsuite/libffi.call/cls_align_uint64.c: New test case. + * testsuite/libffi.call/cls_align_sint64.c: Likewise. + * testsuite/libffi.call/cls_align_uint32.c: Likewise. + * testsuite/libffi.call/cls_align_sint32.c: Likewise. + * testsuite/libffi.call/cls_align_uint16.c: Likewise. + * testsuite/libffi.call/cls_align_sint16.c: Likewise. + * testsuite/libffi.call/cls_align_float.c: Likewise. + * testsuite/libffi.call/cls_align_double.c: Likewise. + * testsuite/libffi.call/cls_align_longdouble.c: Likewise. + * testsuite/libffi.call/cls_align_pointer.c: Likewise. + +2003-12-02 Hosaka Yuji + + PR other/13221 + * src/x86/ffi.c (ffi_prep_args, ffi_prep_incoming_args_SYSV): + Align arguments to 32 bits. + +2003-12-01 Andreas Tobler + + PR other/13221 + * testsuite/libffi.call/cls_multi_sshort.c: New test case. + * testsuite/libffi.call/cls_multi_sshortchar.c: Likewise. + * testsuite/libffi.call/cls_multi_uchar.c: Likewise. + * testsuite/libffi.call/cls_multi_schar.c: Likewise. + * testsuite/libffi.call/cls_multi_ushortchar.c: Likewise. + * testsuite/libffi.call/cls_multi_ushort.c: Likewise. + + * testsuite/libffi.special/unwindtest.cc: Cosmetics. + +2003-11-26 Kaveh R. Ghazi + + * testsuite/libffi.call/ffitest.h: Include . + * testsuite/libffi.special/ffitestcxx.h: Likewise. + +2003-11-22 Andreas Tobler + + * Makefile.in: Rebuilt. + * configure: Likewise. + * testsuite/libffi.special/unwindtest.cc: Convert the mmap to + the right type. + +2003-11-21 Andreas Jaeger + Andreas Tobler + + * acinclude.m4: Add AC_FUNC_MMAP_BLACKLIST. + * configure.in: Call AC_FUNC_MMAP_BLACKLIST. + * Makefile.in: Rebuilt. + * aclocal.m4: Likewise. + * configure: Likewise. + * fficonfig.h.in: Likewise. + * testsuite/lib/libffi-dg.exp: Add include dir. + * testsuite/libffi.call/ffitest.h: Add MMAP definitions. + * testsuite/libffi.special/ffitestcxx.h: Likewise. + * testsuite/libffi.call/closure_fn0.c: Use MMAP functionality + for ffi_closure if available. + * testsuite/libffi.call/closure_fn1.c: Likewise. + * testsuite/libffi.call/closure_fn2.c: Likewise. + * testsuite/libffi.call/closure_fn3.c: Likewise. + * testsuite/libffi.call/closure_fn4.c: Likewise. + * testsuite/libffi.call/closure_fn5.c: Likewise. + * testsuite/libffi.call/cls_12byte.c: Likewise. + * testsuite/libffi.call/cls_16byte.c: Likewise. + * testsuite/libffi.call/cls_18byte.c: Likewise. + * testsuite/libffi.call/cls_19byte.c: Likewise. + * testsuite/libffi.call/cls_1_1byte.c: Likewise. + * testsuite/libffi.call/cls_20byte.c: Likewise. + * testsuite/libffi.call/cls_20byte1.c: Likewise. + * testsuite/libffi.call/cls_24byte.c: Likewise. + * testsuite/libffi.call/cls_2byte.c: Likewise. + * testsuite/libffi.call/cls_3_1byte.c: Likewise. + * testsuite/libffi.call/cls_3byte1.c: Likewise. + * testsuite/libffi.call/cls_3byte2.c: Likewise. + * testsuite/libffi.call/cls_4_1byte.c: Likewise. + * testsuite/libffi.call/cls_4byte.c: Likewise. + * testsuite/libffi.call/cls_5byte.c: Likewise. + * testsuite/libffi.call/cls_64byte.c: Likewise. + * testsuite/libffi.call/cls_6byte.c: Likewise. + * testsuite/libffi.call/cls_7byte.c: Likewise. + * testsuite/libffi.call/cls_8byte.c: Likewise. + * testsuite/libffi.call/cls_9byte1.c: Likewise. + * testsuite/libffi.call/cls_9byte2.c: Likewise. + * testsuite/libffi.call/cls_double.c: Likewise. + * testsuite/libffi.call/cls_float.c: Likewise. + * testsuite/libffi.call/cls_schar.c: Likewise. + * testsuite/libffi.call/cls_sint.c: Likewise. + * testsuite/libffi.call/cls_sshort.c: Likewise. + * testsuite/libffi.call/cls_uchar.c: Likewise. + * testsuite/libffi.call/cls_uint.c: Likewise. + * testsuite/libffi.call/cls_ulonglong.c: Likewise. + * testsuite/libffi.call/cls_ushort.c: Likewise. + * testsuite/libffi.call/nested_struct.c: Likewise. + * testsuite/libffi.call/nested_struct1.c: Likewise. + * testsuite/libffi.call/nested_struct2.c: Likewise. + * testsuite/libffi.call/nested_struct3.c: Likewise. + * testsuite/libffi.call/problem1.c: Likewise. + * testsuite/libffi.special/unwindtest.cc: Likewise. + +2003-11-20 Andreas Tobler + + * testsuite/lib/libffi-dg.exp: Make the -lgcc_s conditional. + +2003-11-19 Andreas Tobler + + * testsuite/lib/libffi-dg.exp: Add DYLD_LIBRARY_PATH for darwin. + Add -lgcc_s to additional flags. + +2003-11-12 Andreas Tobler + + * configure.in, include/Makefile.am: PR libgcj/11147, install + the ffitarget.h header file in a gcc versioned and target + dependent place. + * configure: Regenerated. + * Makefile.in, include/Makefile.in: Likewise. + * testsuite/Makefile.in: Likewise. + +2003-11-09 Andreas Tobler + + * testsuite/libffi.call/closure_fn0.c: Print result and check + with dg-output to make debugging easier. + * testsuite/libffi.call/closure_fn1.c: Likewise. + * testsuite/libffi.call/closure_fn2.c: Likewise. + * testsuite/libffi.call/closure_fn3.c: Likewise. + * testsuite/libffi.call/closure_fn4.c: Likewise. + * testsuite/libffi.call/closure_fn5.c: Likewise. + * testsuite/libffi.call/cls_12byte.c: Likewise. + * testsuite/libffi.call/cls_16byte.c: Likewise. + * testsuite/libffi.call/cls_18byte.c: Likewise. + * testsuite/libffi.call/cls_19byte.c: Likewise. + * testsuite/libffi.call/cls_1_1byte.c: Likewise. + * testsuite/libffi.call/cls_20byte.c: Likewise. + * testsuite/libffi.call/cls_20byte1.c: Likewise. + * testsuite/libffi.call/cls_24byte.c: Likewise. + * testsuite/libffi.call/cls_2byte.c: Likewise. + * testsuite/libffi.call/cls_3_1byte.c: Likewise. + * testsuite/libffi.call/cls_3byte1.c: Likewise. + * testsuite/libffi.call/cls_3byte2.c: Likewise. + * testsuite/libffi.call/cls_4_1byte.c: Likewise. + * testsuite/libffi.call/cls_4byte.c: Likewise. + * testsuite/libffi.call/cls_5byte.c: Likewise. + * testsuite/libffi.call/cls_64byte.c: Likewise. + * testsuite/libffi.call/cls_6byte.c: Likewise. + * testsuite/libffi.call/cls_7byte.c: Likewise. + * testsuite/libffi.call/cls_8byte.c: Likewise. + * testsuite/libffi.call/cls_9byte1.c: Likewise. + * testsuite/libffi.call/cls_9byte2.c: Likewise. + * testsuite/libffi.call/cls_double.c: Likewise. + * testsuite/libffi.call/cls_float.c: Likewise. + * testsuite/libffi.call/cls_schar.c: Likewise. + * testsuite/libffi.call/cls_sint.c: Likewise. + * testsuite/libffi.call/cls_sshort.c: Likewise. + * testsuite/libffi.call/cls_uchar.c: Likewise. + * testsuite/libffi.call/cls_uint.c: Likewise. + * testsuite/libffi.call/cls_ulonglong.c: Likewise. + * testsuite/libffi.call/cls_ushort.c: Likewise. + * testsuite/libffi.call/problem1.c: Likewise. + + * testsuite/libffi.special/unwindtest.cc: Make ffi_closure + static. + +2003-11-08 Andreas Tobler + + * testsuite/libffi.call/cls_9byte2.c: New test case. + * testsuite/libffi.call/cls_9byte1.c: Likewise. + * testsuite/libffi.call/cls_64byte.c: Likewise. + * testsuite/libffi.call/cls_20byte1.c: Likewise. + * testsuite/libffi.call/cls_19byte.c: Likewise. + * testsuite/libffi.call/cls_18byte.c: Likewise. + * testsuite/libffi.call/closure_fn4.c: Likewise. + * testsuite/libffi.call/closure_fn5.c: Likewise. + * testsuite/libffi.call/cls_schar.c: Likewise. + * testsuite/libffi.call/cls_sint.c: Likewise. + * testsuite/libffi.call/cls_sshort.c: Likewise. + * testsuite/libffi.call/nested_struct2.c: Likewise. + * testsuite/libffi.call/nested_struct3.c: Likewise. + +2003-11-08 Andreas Tobler + + * testsuite/libffi.call/cls_double.c: Do a check on the result. + * testsuite/libffi.call/cls_uchar.c: Likewise. + * testsuite/libffi.call/cls_uint.c: Likewise. + * testsuite/libffi.call/cls_ulonglong.c: Likewise. + * testsuite/libffi.call/cls_ushort.c: Likewise. + * testsuite/libffi.call/return_sc.c: Cleanup whitespaces. + +2003-11-06 Andreas Tobler + + * src/prep_cif.c (ffi_prep_cif): Move the validity check after + the initialization. + +2003-10-23 Andreas Tobler + + * src/java_raw_api.c (ffi_java_ptrarray_to_raw): Replace + FFI_ASSERT(FALSE) with FFI_ASSERT(0). + +2003-10-22 David Daney + + * src/mips/ffitarget.h: Replace undefined UINT32 and friends with + __attribute__((__mode__(__SI__))) and friends. + +2003-10-22 Andreas Schwab + + * src/ia64/ffi.c: Replace FALSE/TRUE with false/true. + +2003-10-21 Andreas Tobler + + * configure.in: AC_LINK_FILES(ffitarget.h). + * configure: Regenerate. + * Makefile.in: Likewise. + * include/Makefile.in: Likewise. + * testsuite/Makefile.in: Likewise. + * fficonfig.h.in: Likewise. + +2003-10-21 Paolo Bonzini + Richard Henderson + + Avoid that ffi.h includes fficonfig.h. + + * Makefile.am (EXTRA_DIST): Include ffitarget.h files + (TARGET_SRC_MIPS_GCC): Renamed to TARGET_SRC_MIPS_IRIX. + (TARGET_SRC_MIPS_SGI): Removed. + (MIPS_GCC): Renamed to TARGET_SRC_MIPS_IRIX. + (MIPS_SGI): Removed. + (CLEANFILES): Removed. + (mostlyclean-am, clean-am, mostlyclean-sub, clean-sub): New + targets. + * acconfig.h: Removed. + * configure.in: Compute sizeofs only for double and long double. + Use them to define and subst HAVE_LONG_DOUBLE. Include comments + into AC_DEFINE instead of using acconfig.h. Create + include/ffitarget.h instead of include/fficonfig.h. Rename + MIPS_GCC to MIPS_IRIX, drop MIPS_SGI since we are in gcc's tree. + AC_DEFINE EH_FRAME_FLAGS. + * include/Makefile.am (DISTCLEANFILES): New automake macro. + (hack_DATA): Add ffitarget.h. + * include/ffi.h.in: Remove all system specific definitions. + Declare raw API even if it is not installed, why bother? + Use limits.h instead of SIZEOF_* to define ffi_type_*. Do + not define EH_FRAME_FLAGS, it is in fficonfig.h now. Include + ffitarget.h instead of fficonfig.h. Remove ALIGN macro. + (UINT_ARG, INT_ARG): Removed, use ffi_arg and ffi_sarg instead. + * include/ffi_common.h (bool): Do not define. + (ffi_assert): Accept failed assertion. + (ffi_type_test): Return void and accept file/line. + (FFI_ASSERT): Pass stringized failed assertion. + (FFI_ASSERT_AT): New macro. + (FFI_ASSERT_VALID_TYPE): New macro. + (UINT8, SINT8, UINT16, SINT16, UINT32, SINT32, + UINT64, SINT64): Define here with gcc's __attribute__ macro + instead of in ffi.h + (FLOAT32, ALIGN): Define here instead of in ffi.h + * include/ffi-mips.h: Removed. Its content moved to + src/mips/ffitarget.h after separating assembly and C sections. + * src/alpha/ffi.c, src/alpha/ffi.c, src/java_raw_api.c + src/prep_cif.c, src/raw_api.c, src/ia64/ffi.c, + src/mips/ffi.c, src/mips/n32.S, src/mips/o32.S, + src/mips/ffitarget.h, src/sparc/ffi.c, src/x86/ffi64.c: + SIZEOF_ARG -> FFI_SIZEOF_ARG. + * src/ia64/ffi.c: Include stdbool.h (provided by GCC 2.95+). + * src/debug.c (ffi_assert): Accept stringized failed assertion. + (ffi_type_test): Rewritten. + * src/prep-cif.c (initialize_aggregate, ffi_prep_cif): Call + FFI_ASSERT_VALID_TYPE. + * src/alpha/ffitarget.h, src/arm/ffitarget.h, + src/ia64/ffitarget.h, src/m68k/ffitarget.h, + src/mips/ffitarget.h, src/powerpc/ffitarget.h, + src/s390/ffitarget.h, src/sh/ffitarget.h, + src/sh64/ffitarget.h, src/sparc/ffitarget.h, + src/x86/ffitarget.h: New files. + * src/alpha/osf.S, src/arm/sysv.S, src/ia64/unix.S, + src/m68k/sysv.S, src/mips/n32.S, src/mips/o32.S, + src/powerpc/aix.S, src/powerpc/darwin.S, + src/powerpc/ffi_darwin.c, src/powerpc/linux64.S, + src/powerpc/linux64_closure.S, src/powerpc/ppc_closure.S, + src/powerpc/sysv.S, src/s390/sysv.S, src/sh/sysv.S, + src/sh64/sysv.S, src/sparc/v8.S, src/sparc/v9.S, + src/x86/sysv.S, src/x86/unix64.S, src/x86/win32.S: + include fficonfig.h + +2003-10-20 Rainer Orth + + * src/mips/ffi.c: Use _ABIN32, _ABIO32 instead of external + _MIPS_SIM_NABI32, _MIPS_SIM_ABI32. + +2003-10-19 Andreas Tobler + + * src/powerpc/ffi_darwin.c (ffi_prep_args): Declare bytes again. + Used when FFI_DEBUG = 1. + +2003-10-14 Alan Modra + + * src/types.c (double, longdouble): Default POWERPC64 to 8 byte size + and align. + +2003-10-06 Rainer Orth + + * include/ffi_mips.h: Define FFI_MIPS_N32 for N32/N64 ABIs, + FFI_MIPS_O32 for O32 ABI. + +2003-10-01 Andreas Tobler + + * testsuite/lib/libffi-dg.exp: Set LD_LIBRARY_PATH_64 for + SPARC64. Cleanup whitespaces. + +2003-09-19 Andreas Tobler + + * testsuite/libffi.call/closure_fn0.c: Xfail mips, arm, + strongarm, xscale. Cleanup whitespaces. + * testsuite/libffi.call/closure_fn1.c: Likewise. + * testsuite/libffi.call/closure_fn2.c: Likewise. + * testsuite/libffi.call/closure_fn3.c: Likewise. + * testsuite/libffi.call/cls_12byte.c: Likewise. + * testsuite/libffi.call/cls_16byte.c: Likewise. + * testsuite/libffi.call/cls_1_1byte.c: Likewise. + * testsuite/libffi.call/cls_20byte.c: Likewise. + * testsuite/libffi.call/cls_24byte.c: Likewise. + * testsuite/libffi.call/cls_2byte.c: Likewise. + * testsuite/libffi.call/cls_3_1byte.c: Likewise. + * testsuite/libffi.call/cls_3byte1.c: Likewise. + * testsuite/libffi.call/cls_3byte2.c: Likewise. + * testsuite/libffi.call/cls_4_1byte.c: Likewise. + * testsuite/libffi.call/cls_4byte.c: Likewise. + * testsuite/libffi.call/cls_5byte.c: Likewise. + * testsuite/libffi.call/cls_6byte.c: Likewise. + * testsuite/libffi.call/cls_7byte.c: Likewise. + * testsuite/libffi.call/cls_8byte.c: Likewise. + * testsuite/libffi.call/cls_double.c: Likewise. + * testsuite/libffi.call/cls_float.c: Likewise. + * testsuite/libffi.call/cls_uchar.c: Likewise. + * testsuite/libffi.call/cls_uint.c: Likewise. + * testsuite/libffi.call/cls_ulonglong.c: Likewise. + * testsuite/libffi.call/cls_ushort.c: Likewise. + * testsuite/libffi.call/nested_struct.c: Likewise. + * testsuite/libffi.call/nested_struct1.c: Likewise. + * testsuite/libffi.call/problem1.c: Likewise. + * testsuite/libffi.special/unwindtest.cc: Likewise. + * testsuite/libffi.call/pyobjc-tc.c: Cleanup whitespaces. + +2003-09-18 David Edelsohn + + * src/powerpc/aix.S: Cleanup whitespaces. + * src/powerpc/aix_closure.S: Likewise. + +2003-09-18 Andreas Tobler + + * src/powerpc/darwin.S: Cleanup whitespaces, comment formatting. + * src/powerpc/darwin_closure.S: Likewise. + * src/powerpc/ffi_darwin.c: Likewise. + +2003-09-18 Andreas Tobler + David Edelsohn + + * src/types.c (double): Add AIX and Darwin to the right TYPEDEF. + * src/powerpc/aix_closure.S: Remove the pointer to the outgoing + parameter stack. + * src/powerpc/darwin_closure.S: Likewise. + * src/powerpc/ffi_darwin.c (ffi_prep_args): Handle structures + according to the Darwin/AIX ABI. + (ffi_prep_cif_machdep): Likewise. + (ffi_closure_helper_DARWIN): Likewise. + Remove the outgoing parameter stack logic. Simplify the evaluation + of the different CASE types. + (ffi_prep_clousure): Avoid the casts on lvalues. Change the branch + statement in the trampoline code. + +2003-09-18 Kaz Kojima + + * src/sh/ffi.c (ffi_prep_args): Take account into the alignement + for the register size. + (ffi_closure_helper_SYSV): Handle the structure return value + address correctly. + (ffi_closure_helper_SYSV): Return the appropriate type when + the registers are used for the structure return value. + * src/sh/sysv.S (ffi_closure_SYSV): Fix the stack layout for + the 64-bit return value. Update copyright years. + +2003-09-17 Rainer Orth + + * testsuite/lib/libffi-dg.exp (libffi_target_compile): Search in + srcdir for ffi_mips.h. + +2003-09-12 Alan Modra + + * src/prep_cif.c (initialize_aggregate): Include tail padding in + structure size. + * src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Correct + placement of float result. + * testsuite/libffi.special/unwindtest.cc (closure_test_fn1): Correct + cast of "resp" for big-endian 64 bit machines. + +2003-09-11 Alan Modra + + * src/types.c (double, longdouble): Merge identical SH and ARM + typedefs, and add POWERPC64. + * src/powerpc/ffi.c (ffi_prep_args64): Correct next_arg calc for + struct split over gpr and rest. + (ffi_prep_cif_machdep): Correct intarg_count for structures. + * src/powerpc/linux64.S (ffi_call_LINUX64): Fix gpr offsets. + +2003-09-09 Andreas Tobler + + * src/powerpc/ffi.c (ffi_closure_helper_SYSV) Handle struct + passing correctly. + +2003-09-09 Alan Modra + + * configure: Regenerate. + +2003-09-04 Andreas Tobler + + * Makefile.am: Remove build rules for ffitest. + * Makefile.in: Rebuilt. + +2003-09-04 Andreas Tobler + + * src/java_raw_api.c: Include to fix compiler warning + about implicit declaration of abort(). + +2003-09-04 Andreas Tobler + + * Makefile.am: Add dejagnu test framework. Fixes PR other/11411. + * Makefile.in: Rebuilt. + * configure.in: Add dejagnu test framework. + * configure: Rebuilt. + + * testsuite/Makefile.am: New file. + * testsuite/Makefile.in: Built + * testsuite/lib/libffi-dg.exp: New file. + * testsuite/config/default.exp: Likewise. + * testsuite/libffi.call/call.exp: Likewise. + * testsuite/libffi.call/ffitest.h: Likewise. + * testsuite/libffi.call/closure_fn0.c: Likewise. + * testsuite/libffi.call/closure_fn1.c: Likewise. + * testsuite/libffi.call/closure_fn2.c: Likewise. + * testsuite/libffi.call/closure_fn3.c: Likewise. + * testsuite/libffi.call/cls_1_1byte.c: Likewise. + * testsuite/libffi.call/cls_3_1byte.c: Likewise. + * testsuite/libffi.call/cls_4_1byte.c: Likewise. + * testsuite/libffi.call/cls_2byte.c: Likewise. + * testsuite/libffi.call/cls_3byte1.c: Likewise. + * testsuite/libffi.call/cls_3byte2.c: Likewise. + * testsuite/libffi.call/cls_4byte.c: Likewise. + * testsuite/libffi.call/cls_5byte.c: Likewise. + * testsuite/libffi.call/cls_6byte.c: Likewise. + * testsuite/libffi.call/cls_7byte.c: Likewise. + * testsuite/libffi.call/cls_8byte.c: Likewise. + * testsuite/libffi.call/cls_12byte.c: Likewise. + * testsuite/libffi.call/cls_16byte.c: Likewise. + * testsuite/libffi.call/cls_20byte.c: Likewise. + * testsuite/libffi.call/cls_24byte.c: Likewise. + * testsuite/libffi.call/cls_double.c: Likewise. + * testsuite/libffi.call/cls_float.c: Likewise. + * testsuite/libffi.call/cls_uchar.c: Likewise. + * testsuite/libffi.call/cls_uint.c: Likewise. + * testsuite/libffi.call/cls_ulonglong.c: Likewise. + * testsuite/libffi.call/cls_ushort.c: Likewise. + * testsuite/libffi.call/float.c: Likewise. + * testsuite/libffi.call/float1.c: Likewise. + * testsuite/libffi.call/float2.c: Likewise. + * testsuite/libffi.call/many.c: Likewise. + * testsuite/libffi.call/many_win32.c: Likewise. + * testsuite/libffi.call/nested_struct.c: Likewise. + * testsuite/libffi.call/nested_struct1.c: Likewise. + * testsuite/libffi.call/pyobjc-tc.c: Likewise. + * testsuite/libffi.call/problem1.c: Likewise. + * testsuite/libffi.call/promotion.c: Likewise. + * testsuite/libffi.call/return_ll.c: Likewise. + * testsuite/libffi.call/return_sc.c: Likewise. + * testsuite/libffi.call/return_uc.c: Likewise. + * testsuite/libffi.call/strlen.c: Likewise. + * testsuite/libffi.call/strlen_win32.c: Likewise. + * testsuite/libffi.call/struct1.c: Likewise. + * testsuite/libffi.call/struct2.c: Likewise. + * testsuite/libffi.call/struct3.c: Likewise. + * testsuite/libffi.call/struct4.c: Likewise. + * testsuite/libffi.call/struct5.c: Likewise. + * testsuite/libffi.call/struct6.c: Likewise. + * testsuite/libffi.call/struct7.c: Likewise. + * testsuite/libffi.call/struct8.c: Likewise. + * testsuite/libffi.call/struct9.c: Likewise. + * testsuite/libffi.special/special.exp: New file. + * testsuite/libffi.special/ffitestcxx.h: Likewise. + * testsuite/libffi.special/unwindtest.cc: Likewise. + + +2003-08-13 Kaz Kojima + + * src/sh/ffi.c (OFS_INT16): Set 0 for little endian case. Update + copyright years. + +2003-08-02 Alan Modra + + * src/powerpc/ffi.c (ffi_prep_args64): Modify for changed gcc + structure passing. + (ffi_closure_helper_LINUX64): Likewise. + * src/powerpc/linux64.S: Remove code writing to parm save area. + * src/powerpc/linux64_closure.S (ffi_closure_LINUX64): Use return + address in lr from ffi_closure_helper_LINUX64 call to calculate + table address. Optimize function tail. + +2003-07-28 Andreas Tobler + + * src/sparc/ffi.c: Handle all floating point registers. + * src/sparc/v9.S: Likewise. Fixes second part of PR target/11410. + +2003-07-11 Gerald Pfeifer + + * README: Note that libffi is not part of GCC. Update the project + URL and status. + +2003-06-19 Franz Sirl + + * src/powerpc/ppc_closure.S: Include ffi.h. + +2003-06-13 Rainer Orth + + * src/x86/sysv.S: Avoid gas-only .uleb128/.sleb128 directives. + Use C style comments. + +2003-06-13 Kaz Kojima + + * Makefile.am: Add SHmedia support. Fix a typo of SH support. + * Makefile.in: Regenerate. + * configure.in (sh64-*-linux*, sh5*-*-linux*): Add target. + * configure: Regenerate. + * include/ffi.h.in: Add SHmedia support. + * src/sh64/ffi.c: New file. + * src/sh64/sysv.S: New file. + +2003-05-16 Jakub Jelinek + + * configure.in (HAVE_RO_EH_FRAME): Check whether .eh_frame section + should be read-only. + * configure: Rebuilt. + * fficonfig.h.in: Rebuilt. + * include/ffi.h.in (EH_FRAME_FLAGS): Define. + * src/alpha/osf.S: Use EH_FRAME_FLAGS. + * src/powerpc/linux64.S: Likewise. + * src/powerpc/linux64_closure.S: Likewise. Include ffi.h. + * src/powerpc/sysv.S: Use EH_FRAME_FLAGS. Use pcrel encoding + if -fpic/-fPIC/-mrelocatable. + * src/powerpc/powerpc_closure.S: Likewise. + * src/sparc/v8.S: If HAVE_RO_EH_FRAME is defined, don't include + #write in .eh_frame flags. + * src/sparc/v9.S: Likewise. + * src/x86/unix64.S: Use EH_FRAME_FLAGS. + * src/x86/sysv.S: Likewise. Use pcrel encoding if -fpic/-fPIC. + * src/s390/sysv.S: Use EH_FRAME_FLAGS. Include ffi.h. + +2003-05-07 Jeff Sturm + + Fixes PR bootstrap/10656 + * configure.in (HAVE_AS_REGISTER_PSEUDO_OP): Test assembler + support for .register pseudo-op. + * src/sparc/v8.S: Use it. + * fficonfig.h.in: Rebuilt. + * configure: Rebuilt. + +2003-04-18 Jakub Jelinek + + * include/ffi.h.in (POWERPC64): Define if 64-bit. + (enum ffi_abi): Add FFI_LINUX64 on POWERPC. + Make it the default on POWERPC64. + (FFI_TRAMPOLINE_SIZE): Define to 24 on POWERPC64. + * configure.in: Change powerpc-*-linux* into powerpc*-*-linux*. + * configure: Rebuilt. + * src/powerpc/ffi.c (hidden): Define. + (ffi_prep_args_SYSV): Renamed from + ffi_prep_args. Cast pointers to unsigned long to shut up warnings. + (NUM_GPR_ARG_REGISTERS64, NUM_FPR_ARG_REGISTERS64, + ASM_NEEDS_REGISTERS64): New. + (ffi_prep_args64): New function. + (ffi_prep_cif_machdep): Handle FFI_LINUX64 ABI. + (ffi_call): Likewise. + (ffi_prep_closure): Likewise. + (flush_icache): Surround by #ifndef POWERPC64. + (ffi_dblfl): New union type. + (ffi_closure_helper_SYSV): Use it to avoid aliasing problems. + (ffi_closure_helper_LINUX64): New function. + * src/powerpc/ppc_closure.S: Surround whole file by #ifndef + __powerpc64__. + * src/powerpc/sysv.S: Likewise. + (ffi_call_SYSV): Rename ffi_prep_args to ffi_prep_args_SYSV. + * src/powerpc/linux64.S: New file. + * src/powerpc/linux64_closure.S: New file. + * Makefile.am (EXTRA_DIST): Add src/powerpc/linux64.S and + src/powerpc/linux64_closure.S. + (TARGET_SRC_POWERPC): Likewise. + + * src/ffitest.c (closure_test_fn, closure_test_fn1, closure_test_fn2, + closure_test_fn3): Fix result printing on big-endian 64-bit + machines. + (main): Print tst2_arg instead of uninitialized tst2_result. + + * src/ffitest.c (main): Hide what closure pointer really points to + from the compiler. + +2003-04-16 Richard Earnshaw + + * configure.in (arm-*-netbsdelf*): Add configuration. + (configure): Regenerated. + +2003-04-04 Loren J. Rittle + + * include/Makefile.in: Regenerate. + +2003-03-21 Zdenek Dvorak + + * libffi/include/ffi.h.in: Define X86 instead of X86_64 in 32 + bit mode. + * libffi/src/x86/ffi.c (ffi_closure_SYSV, ffi_closure_raw_SYSV): + Receive closure pointer through parameter, read args using + __builtin_dwarf_cfa. + (FFI_INIT_TRAMPOLINE): Send closure reference through eax. + +2003-03-12 Andreas Schwab + + * configure.in: Avoid trailing /. in toolexeclibdir. + * configure: Rebuilt. + +2003-03-03 Andreas Tobler + + * src/powerpc/darwin_closure.S: Recode to fit dynamic libraries. + +2003-02-06 Andreas Tobler + + * libffi/src/powerpc/darwin_closure.S: + Fix alignement bug, allocate 8 bytes for the result. + * libffi/src/powerpc/aix_closure.S: + Likewise. + * libffi/src/powerpc/ffi_darwin.c: + Update stackframe description for aix/darwin_closure.S. + +2003-02-06 Jakub Jelinek + + * src/s390/ffi.c (ffi_closure_helper_SYSV): Add hidden visibility + attribute. + +2003-01-31 Christian Cornelssen , + Andreas Schwab + + * configure.in: Adjust command to source config-ml.in to account + for changes to the libffi_basedir definition. + (libffi_basedir): Remove ${srcdir} from value and include trailing + slash if nonempty. + + * configure: Regenerate. + +2003-01-29 Franz Sirl + + * src/powerpc/ppc_closure.S: Recode to fit shared libs. + +2003-01-28 Andrew Haley + + * include/ffi.h.in: Enable FFI_CLOSURES for x86_64. + * src/x86/ffi64.c (ffi_prep_closure): New. + (ffi_closure_UNIX64_inner): New. + * src/x86/unix64.S (ffi_closure_UNIX64): New. + +2003-01-27 Alexandre Oliva + + * configure.in (toolexecdir, toolexeclibdir): Set and AC_SUBST. + Remove USE_LIBDIR conditional. + * Makefile.am (toolexecdir, toolexeclibdir): Don't override. + * Makefile.in, configure: Rebuilt. + +2003-01027 David Edelsohn + + * Makefile.am (TARGET_SRC_POWERPC_AIX): Fix typo. + * Makefile.in: Regenerate. + +2003-01-22 Andrew Haley + + * src/powerpc/darwin.S (_ffi_call_AIX): Add Augmentation size to + unwind info. + +2003-01-21 Andreas Tobler + + * src/powerpc/darwin.S: Add unwind info. + * src/powerpc/darwin_closure.S: Likewise. + +2003-01-14 Andrew Haley + + * src/x86/ffi64.c (ffi_prep_args): Check for void retval. + (ffi_prep_cif_machdep): Likewise. + * src/x86/unix64.S: Add unwind info. + +2003-01-14 Andreas Jaeger + + * src/ffitest.c (main): Only use ffi_closures if those are + supported. + +2003-01-13 Andreas Tobler + + * libffi/src/ffitest.c + add closure testcases + +2003-01-13 Kevin B. Hendricks + + * libffi/src/powerpc/ffi.c + fix alignment bug for float (4 byte aligned iso 8 byte) + +2003-01-09 Geoffrey Keating + + * src/powerpc/ffi_darwin.c: Remove RCS version string. + * src/powerpc/darwin.S: Remove RCS version string. + +2003-01-03 Jeff Sturm + + * include/ffi.h.in: Add closure defines for SPARC, SPARC64. + * src/ffitest.c (main): Use static storage for closure. + * src/sparc/ffi.c (ffi_prep_closure, ffi_closure_sparc_inner): New. + * src/sparc/v8.S (ffi_closure_v8): New. + * src/sparc/v9.S (ffi_closure_v9): New. + +2002-11-10 Ranjit Mathew + + * include/ffi.h.in: Added FFI_STDCALL ffi_type + enumeration for X86_WIN32. + * src/x86/win32.S: Added ffi_call_STDCALL function + definition. + * src/x86/ffi.c (ffi_call/ffi_raw_call): Added + switch cases for recognising FFI_STDCALL and + calling ffi_call_STDCALL if target is X86_WIN32. + * src/ffitest.c (my_stdcall_strlen/stdcall_many): + stdcall versions of the "my_strlen" and "many" + test functions (for X86_WIN32). + Added test cases to test stdcall invocation using + these functions. + +2002-12-02 Kaz Kojima + + * src/sh/sysv.S: Add DWARF2 unwind info. + +2002-11-27 Ulrich Weigand + + * src/s390/sysv.S (.eh_frame section): Make section read-only. + +2002-11-26 Jim Wilson + + * src/types.c (FFI_TYPE_POINTER): Has size 8 on IA64. + +2002-11-23 H.J. Lu + + * acinclude.m4: Add dummy AM_PROG_LIBTOOL. + Include ../config/accross.m4. + * aclocal.m4; Rebuild. + * configure: Likewise. + +2002-11-15 Ulrich Weigand + + * src/s390/sysv.S (.eh_frame section): Adapt to pcrel FDE encoding. + +2002-11-11 DJ Delorie + + * configure.in: Look for common files in the right place. + +2002-10-08 Ulrich Weigand + + * src/java_raw_api.c (ffi_java_raw_to_ptrarray): Interpret + raw data as _Jv_word values, not ffi_raw. + (ffi_java_ptrarray_to_raw): Likewise. + (ffi_java_rvalue_to_raw): New function. + (ffi_java_raw_call): Call it. + (ffi_java_raw_to_rvalue): New function. + (ffi_java_translate_args): Call it. + * src/ffitest.c (closure_test_fn): Interpret return value + as ffi_arg, not int. + * src/s390/ffi.c (ffi_prep_cif_machdep): Add missing + FFI_TYPE_POINTER case. + (ffi_closure_helper_SYSV): Likewise. Also, assume return + values extended to word size. + +2002-10-02 Andreas Jaeger + + * src/x86/ffi64.c (ffi_prep_cif_machdep): Remove debug output. + +2002-10-01 Bo Thorsen + + * include/ffi.h.in: Fix i386 win32 compilation. + +2002-09-30 Ulrich Weigand + + * configure.in: Add s390x-*-linux-* target. + * configure: Regenerate. + * include/ffi.h.in: Define S390X for s390x targets. + (FFI_CLOSURES): Define for s390/s390x. + (FFI_TRAMPOLINE_SIZE): Likewise. + (FFI_NATIVE_RAW_API): Likewise. + * src/prep_cif.c (ffi_prep_cif): Do not compute stack space for s390. + * src/types.c (FFI_TYPE_POINTER): Use 8-byte pointers on s390x. + * src/s390/ffi.c: Major rework of existing code. Add support for + s390x targets. Add closure support. + * src/s390/sysv.S: Likewise. + +2002-09-29 Richard Earnshaw + + * src/arm/sysv.S: Fix typo. + +2002-09-28 Richard Earnshaw + + * src/arm/sysv.S: If we don't have machine/asm.h and the pre-processor + has defined __USER_LABEL_PREFIX__, then use it in CNAME. + (ffi_call_SYSV): Handle soft-float. + +2002-09-27 Bo Thorsen + + * include/ffi.h.in: Fix multilib x86-64 support. + +2002-09-22 Kaveh R. Ghazi + + * Makefile.am (all-multi): Fix multilib parallel build. + +2002-07-19 Kaz Kojima + + * configure.in (sh[34]*-*-linux*): Add brackets. + * configure: Regenerate. + +2002-07-18 Kaz Kojima + + * Makefile.am: Add SH support. + * Makefile.in: Regenerate. + * configure.in (sh-*-linux*, sh[34]*-*-linux*): Add target. + * configure: Regenerate. + * include/ffi.h.in: Add SH support. + * src/sh/ffi.c: New file. + * src/sh/sysv.S: New file. + * src/types.c: Add SH support. + +2002-07-16 Bo Thorsen + + * src/x86/ffi64.c: New file that adds x86-64 support. + * src/x86/unix64.S: New file that handles argument setup for + x86-64. + * src/x86/sysv.S: Don't use this on x86-64. + * src/x86/ffi.c: Don't use this on x86-64. + Remove unused vars. + * src/prep_cif.c (ffi_prep_cif): Don't do stack size calculation + for x86-64. + * src/ffitest.c (struct6): New test that tests a special case in + the x86-64 ABI. + (struct7): Likewise. + (struct8): Likewise. + (struct9): Likewise. + (closure_test_fn): Silence warning about this when it's not used. + (main): Add the new tests. + (main): Fix a couple of wrong casts and silence some compiler warnings. + * include/ffi.h.in: Add x86-64 ABI definition. + * fficonfig.h.in: Regenerate. + * Makefile.am: Add x86-64 support. + * configure.in: Likewise. + * Makefile.in: Regenerate. + * configure: Likewise. + +2002-06-24 Bo Thorsen + + * src/types.c: Merge settings for similar architectures. + Add x86-64 sizes and alignments. + +2002-06-23 Bo Thorsen + + * src/arm/ffi.c (ffi_prep_args): Remove unused vars. + * src/sparc/ffi.c (ffi_prep_args_v8): Likewise. + * src/mips/ffi.c (ffi_prep_args): Likewise. + * src/m68k/ffi.c (ffi_prep_args): Likewise. + +2002-07-18 H.J. Lu (hjl@gnu.org) + + * Makefile.am (TARGET_SRC_MIPS_LINUX): New. + (libffi_la_SOURCES): Support MIPS_LINUX. + (libffi_convenience_la_SOURCES): Likewise. + * Makefile.in: Regenerated. + + * configure.in (mips64*-*): Skip. + (mips*-*-linux*): New. + * configure: Regenerated. + + * src/mips/ffi.c: Include . + +2002-06-06 Ulrich Weigand + + * src/s390/sysv.S: Save/restore %r6. Add DWARF-2 unwind info. + +2002-05-27 Roger Sayle + + * src/x86/ffi.c (ffi_prep_args): Remove reference to avn. + +2002-05-27 Bo Thorsen + + * src/x86/ffi.c (ffi_prep_args): Remove unused variable and + fix formatting. + +2002-05-13 Andreas Tobler + + * src/powerpc/ffi_darwin.c (ffi_prep_closure): Declare fd at + beginning of function (for older apple cc). + +2002-05-08 Alexandre Oliva + + * configure.in (ORIGINAL_LD_FOR_MULTILIBS): Preserve LD at + script entry, and set LD to it when configuring multilibs. + * configure: Rebuilt. + +2002-05-05 Jason Thorpe + + * configure.in (sparc64-*-netbsd*): Add target. + (sparc-*-netbsdelf*): Likewise. + * configure: Regenerate. + +2002-04-28 David S. Miller + + * configure.in, configure: Fix SPARC test in previous change. + +2002-04-29 Gerhard Tonn + + * Makefile.am: Add Linux for S/390 support. + * Makefile.in: Regenerate. + * configure.in: Add Linux for S/390 support. + * configure: Regenerate. + * include/ffi.h.in: Add Linux for S/390 support. + * src/s390/ffi.c: New file from libffi CVS tree. + * src/s390/sysv.S: New file from libffi CVS tree. + +2002-04-28 Jakub Jelinek + + * configure.in (HAVE_AS_SPARC_UA_PCREL): Check for working + %r_disp32(). + * src/sparc/v8.S: Use it. + * src/sparc/v9.S: Likewise. + * fficonfig.h.in: Rebuilt. + * configure: Rebuilt. + +2002-04-08 Hans Boehm + + * src/java_raw_api.c (ffi_java_raw_size): Handle FFI_TYPE_DOUBLE + correctly. + * src/ia64/unix.S: Add unwind information. Fix comments. + Save sp in a way that's compatible with unwind info. + (ffi_call_unix): Correctly restore sp in all cases. + * src/ia64/ffi.c: Add, fix comments. + +2002-04-08 Jakub Jelinek + + * src/sparc/v8.S: Make .eh_frame dependent on target word size. + +2002-04-06 Jason Thorpe + + * configure.in (alpha*-*-netbsd*): Add target. + * configure: Regenerate. + +2002-04-04 Jeff Sturm + + * src/sparc/v8.S: Add unwind info. + * src/sparc/v9.S: Likewise. + +2002-03-30 Krister Walfridsson + + * configure.in: Enable i*86-*-netbsdelf*. + * configure: Rebuilt. + +2002-03-29 David Billinghurst + + PR other/2620 + * src/mips/n32.s: Delete + * src/mips/o32.s: Delete + +2002-03-21 Loren J. Rittle + + * configure.in: Enable alpha*-*-freebsd*. + * configure: Rebuilt. + +2002-03-17 Bryce McKinlay + + * Makefile.am: libfficonvenience -> libffi_convenience. + * Makefile.in: Rebuilt. + + * Makefile.am: Define ffitest_OBJECTS. + * Makefile.in: Rebuilt. + +2002-03-07 Andreas Tobler + David Edelsohn + + * Makefile.am (EXTRA_DIST): Add Darwin and AIX closure files. + (TARGET_SRC_POWERPC_AIX): Add aix_closure.S. + (TARGET_SRC_POWERPC_DARWIN): Add darwin_closure.S. + * Makefile.in: Regenerate. + * include/ffi.h.in: Add AIX and Darwin closure definitions. + * src/powerpc/ffi_darwin.c (ffi_prep_closure): New function. + (flush_icache, flush_range): New functions. + (ffi_closure_helper_DARWIN): New function. + * src/powerpc/aix_closure.S: New file. + * src/powerpc/darwin_closure.S: New file. + +2002-02-24 Jeff Sturm + + * include/ffi.h.in: Add typedef for ffi_arg. + * src/ffitest.c (main): Declare rint with ffi_arg. + +2002-02-21 Andreas Tobler + + * src/powerpc/ffi_darwin.c (ffi_prep_args): Skip appropriate + number of GPRs for floating-point arguments. + +2002-01-31 Anthony Green + + * configure: Rebuilt. + * configure.in: Replace CHECK_SIZEOF and endian tests with + cross-compiler friendly macros. + * aclocal.m4 (AC_COMPILE_CHECK_SIZEOF, AC_C_BIGENDIAN_CROSS): New + macros. + +2002-01-18 David Edelsohn + + * src/powerpc/darwin.S (_ffi_call_AIX): New. + * src/powerpc/aix.S (ffi_call_DARWIN): New. + +2002-01-17 David Edelsohn + + * Makefile.am (EXTRA_DIST): Add Darwin and AIX files. + (TARGET_SRC_POWERPC_AIX): New. + (POWERPC_AIX): New stanza. + * Makefile.in: Regenerate. + * configure.in: Add AIX case. + * configure: Regenerate. + * include/ffi.h.in (ffi_abi): Add FFI_AIX. + * src/powerpc/ffi_darwin.c (ffi_status): Use "long" to scale frame + size. Fix "long double" support. + (ffi_call): Add FFI_AIX case. + * src/powerpc/aix.S: New. + +2001-10-09 John Hornkvist + + Implement Darwin PowerPC ABI. + * configure.in: Handle powerpc-*-darwin*. + * Makefile.am: Set source files for POWERPC_DARWIN. + * configure: Rebuilt. + * Makefile.in: Rebuilt. + * include/ffi.h.in: Define FFI_DARWIN and FFI_DEFAULT_ABI for + POWERPC_DARWIN. + * src/powerpc/darwin.S: New file. + * src/powerpc/ffi_darwin.c: New file. + +2001-10-07 Joseph S. Myers + + * src/x86/ffi.c: Fix spelling error of "separate" as "seperate". + +2001-07-16 Rainer Orth + + * src/x86/sysv.S: Avoid gas-only .balign directive. + Use C style comments. + +2001-07-16 Rainer Orth + + * src/alpha/ffi.c (ffi_prep_closure): Avoid gas-only mnemonic. + Fixes PR bootstrap/3563. + +2001-06-26 Rainer Orth + + * src/alpha/osf.S (ffi_closure_osf): Use .rdata for ECOFF. + +2001-06-25 Rainer Orth + + * configure.in: Recognize sparc*-sun-* host. + * configure: Regenerate. + +2001-06-06 Andrew Haley + + * src/alpha/osf.S (__FRAME_BEGIN__): Conditionalize for ELF. + +2001-06-03 Andrew Haley + + * src/alpha/osf.S: Add unwind info. + * src/powerpc/sysv.S: Add unwind info. + * src/powerpc/ppc_closure.S: Likewise. + +2000-05-31 Jeff Sturm + + * configure.in: Fix AC_ARG_ENABLE usage. + * configure: Rebuilt. + +2001-05-06 Bryce McKinlay + + * configure.in: Remove warning about beta code. + * configure: Rebuilt. + +2001-04-25 Hans Boehm + + * src/ia64/unix.S: Restore stack pointer when returning from + ffi_closure_UNIX. + * src/ia64/ffi.c: Fix typo in comment. + +2001-04-18 Jim Wilson + + * src/ia64/unix.S: Delete unnecessary increment and decrement of loc2 + to eliminate RAW DV. + +2001-04-12 Bryce McKinlay + + * Makefile.am: Make a libtool convenience library. + * Makefile.in: Rebuilt. + +2001-03-29 Bryce McKinlay + + * configure.in: Use different syntax for subdirectory creation. + * configure: Rebuilt. + +2001-03-27 Jon Beniston + + * configure.in: Added X86_WIN32 target (Win32, CygWin, MingW). + * configure: Rebuilt. + * Makefile.am: Added X86_WIN32 target support. + * Makefile.in: Rebuilt. + + * include/ffi.h.in: Added X86_WIN32 target support. + + * src/ffitest.c: Doesn't run structure tests for X86_WIN32 targets. + * src/types.c: Added X86_WIN32 target support. + + * src/x86/win32.S: New file. Based on sysv.S, but with EH + stuff removed and made to work with CygWin's gas. + +2001-03-26 Bryce McKinlay + + * configure.in: Make target subdirectory in build dir. + * Makefile.am: Override suffix based rules to specify correct output + subdirectory. + * Makefile.in: Rebuilt. + * configure: Rebuilt. + +2001-03-23 Kevin B Hendricks + + * src/powerpc/ppc_closure.S: New file. + * src/powerpc/ffi.c (ffi_prep_args): Fixed ABI compatibility bug + involving long long and register pairs. + (ffi_prep_closure): New function. + (flush_icache): Likewise. + (ffi_closure_helper_SYSV): Likewise. + * include/ffi.h.in (FFI_CLOSURES): Define on PPC. + (FFI_TRAMPOLINE_SIZE): Likewise. + (FFI_NATIVE_RAW_API): Likewise. + * Makefile.in: Rebuilt. + * Makefile.am (EXTRA_DIST): Added src/powerpc/ppc_closure.S. + (TARGET_SRC_POWERPC): Likewise. + +2001-03-19 Tom Tromey + + * Makefile.in: Rebuilt. + * Makefile.am (ffitest_LDFLAGS): New macro. + +2001-03-02 Nick Clifton + + * include/ffi.h.in: Remove RCS ident string. + * include/ffi_mips.h: Remove RCS ident string. + * src/debug.c: Remove RCS ident string. + * src/ffitest.c: Remove RCS ident string. + * src/prep_cif.c: Remove RCS ident string. + * src/types.c: Remove RCS ident string. + * src/alpha/ffi.c: Remove RCS ident string. + * src/alpha/osf.S: Remove RCS ident string. + * src/arm/ffi.c: Remove RCS ident string. + * src/arm/sysv.S: Remove RCS ident string. + * src/mips/ffi.c: Remove RCS ident string. + * src/mips/n32.S: Remove RCS ident string. + * src/mips/o32.S: Remove RCS ident string. + * src/sparc/ffi.c: Remove RCS ident string. + * src/sparc/v8.S: Remove RCS ident string. + * src/sparc/v9.S: Remove RCS ident string. + * src/x86/ffi.c: Remove RCS ident string. + * src/x86/sysv.S: Remove RCS ident string. + +2001-02-08 Joseph S. Myers + + * include/ffi.h.in: Change sourceware.cygnus.com references to + gcc.gnu.org. + +2000-12-09 Richard Henderson + + * src/alpha/ffi.c (ffi_call): Simplify struct return test. + (ffi_closure_osf_inner): Index rather than increment avalue + and arg_types. Give ffi_closure_osf the raw return value type. + * src/alpha/osf.S (ffi_closure_osf): Handle return value type + promotion. + +2000-12-07 Richard Henderson + + * src/raw_api.c (ffi_translate_args): Fix typo. + (ffi_prep_closure): Likewise. + + * include/ffi.h.in [ALPHA]: Define FFI_CLOSURES and + FFI_TRAMPOLINE_SIZE. + * src/alpha/ffi.c (ffi_prep_cif_machdep): Adjust minimal + cif->bytes for new ffi_call_osf implementation. + (ffi_prep_args): Absorb into ... + (ffi_call): ... here. Do all stack allocation here and + avoid a callback function. + (ffi_prep_closure, ffi_closure_osf_inner): New. + * src/alpha/osf.S (ffi_call_osf): Reimplement with no callback. + (ffi_closure_osf): New. + +2000-09-10 Alexandre Oliva + + * config.guess, config.sub, install-sh: Removed. + * ltconfig, ltmain.sh, missing, mkinstalldirs: Likewise. + * Makefile.in: Rebuilt. + + * acinclude.m4: Include libtool macros from the top level. + * aclocal.m4, configure: Rebuilt. + +2000-08-22 Alexandre Oliva + + * configure.in [i*86-*-freebsd*] (TARGET, TARGETDIR): Set. + * configure: Rebuilt. + +2000-05-11 Scott Bambrough + + * libffi/src/arm/sysv.S (ffi_call_SYSV): Doubles are not saved to + memory correctly. Use conditional instructions, not branches where + possible. + +2000-05-04 Tom Tromey + + * configure: Rebuilt. + * configure.in: Match `arm*-*-linux-*'. + From Chris Dornan . + +2000-04-28 Jakub Jelinek + + * Makefile.am (SUBDIRS): Define. + (AM_MAKEFLAGS): Likewise. + (Multilib support.): Add section. + * Makefile.in: Rebuilt. + * ltconfig (extra_compiler_flags, extra_compiler_flags_value): + New variables. Set for gcc using -print-multi-lib. Export them + to libtool. + (sparc64-*-linux-gnu*): Use libsuff 64 for search paths. + * ltmain.sh (B|b|V): Don't throw away gcc's -B, -b and -V options + for -shared links. + (extra_compiler_flags_value, extra_compiler_flags): Check these + for extra compiler options which need to be passed down in + compiler_flags. + +2000-04-16 Anthony Green + + * configure: Rebuilt. + * configure.in: Change i*86-pc-linux* to i*86-*-linux*. + +2000-04-14 Jakub Jelinek + + * include/ffi.h.in (SPARC64): Define for 64bit SPARC builds. + Set SPARC FFI_DEFAULT_ABI based on SPARC64 define. + * src/sparc/ffi.c (ffi_prep_args_v8): Renamed from ffi_prep_args. + Replace all void * sizeofs with sizeof(int). + Only compare type with FFI_TYPE_LONGDOUBLE if LONGDOUBLE is + different than DOUBLE. + Remove FFI_TYPE_SINT32 and FFI_TYPE_UINT32 cases (handled elsewhere). + (ffi_prep_args_v9): New function. + (ffi_prep_cif_machdep): Handle V9 ABI and long long on V8. + (ffi_V9_return_struct): New function. + (ffi_call): Handle FFI_V9 ABI from 64bit code and FFI_V8 ABI from + 32bit code (not yet cross-arch calls). + * src/sparc/v8.S: Add struct return delay nop. + Handle long long. + * src/sparc/v9.S: New file. + * src/prep_cif.c (ffi_prep_cif): Return structure pointer + is used on sparc64 only for structures larger than 32 bytes. + Pass by reference for structures is done for structure arguments + larger than 16 bytes. + * src/ffitest.c (main): Use 64bit rint on sparc64. + Run long long tests on sparc. + * src/types.c (FFI_TYPE_POINTER): Pointer is 64bit on alpha and + sparc64. + (FFI_TYPE_LONGDOUBLE): long double is 128 bit aligned to 128 bits + on sparc64. + * configure.in (sparc-*-linux*): New supported target. + (sparc64-*-linux*): Likewise. + * configure: Rebuilt. + * Makefile.am: Add v9.S to SPARC files. + * Makefile.in: Likewise. + (LINK): Surround $(CCLD) into double quotes, so that multilib + compiles work correctly. + +2000-04-04 Alexandre Petit-Bianco + + * configure: Rebuilt. + * configure.in: (i*86-*-solaris*): New libffi target. Patch + proposed by Bryce McKinlay. + +2000-03-20 Tom Tromey + + * Makefile.in: Hand edit for java_raw_api.lo. + +2000-03-08 Bryce McKinlay + + * config.guess, config.sub: Update from the gcc tree. + Fix for PR libgcj/168. + +2000-03-03 Tom Tromey + + * Makefile.in: Fixed ia64 by hand. + + * configure: Rebuilt. + * configure.in (--enable-multilib): New option. + (libffi_basedir): New subst. + (AC_OUTPUT): Added multilib code. + +2000-03-02 Tom Tromey + + * Makefile.in: Rebuilt. + * Makefile.am (TARGET_SRC_IA64): Use `ia64', not `alpha', as + directory name. + +2000-02-25 Hans Boehm + + * src/ia64/ffi.c, src/ia64/ia64_flags.h, src/ia64/unix.S: New + files. + * src/raw_api.c (ffi_translate_args): Fixed typo in argument + list. + (ffi_prep_raw_closure): Use ffi_translate_args, not + ffi_closure_translate. + * src/java_raw_api.c: New file. + * src/ffitest.c (closure_test_fn): New function. + (main): Define `rint' as long long on IA64. Added new test when + FFI_CLOSURES is defined. + * include/ffi.h.in (ALIGN): Use size_t, not unsigned. + (ffi_abi): Recognize IA64. + (ffi_raw): Added `flt' field. + Added "Java raw API" code. + * configure.in: Recognize ia64. + * Makefile.am (TARGET_SRC_IA64): New macro. + (libffi_la_common_SOURCES): Added java_raw_api.c. + (libffi_la_SOURCES): Define in IA64 case. + +2000-01-04 Tom Tromey + + * Makefile.in: Rebuilt with newer automake. + +1999-12-31 Tom Tromey + + * Makefile.am (INCLUDES): Added -I$(top_srcdir)/src. + +1999-09-01 Tom Tromey + + * include/ffi.h.in: Removed PACKAGE and VERSION defines and + undefs. + * fficonfig.h.in: Rebuilt. + * configure: Rebuilt. + * configure.in: Pass 3rd argument to AM_INIT_AUTOMAKE. + Use AM_PROG_LIBTOOL (automake 1.4 compatibility). + * acconfig.h: Don't #undef PACKAGE or VERSION. + +1999-08-09 Anthony Green + + * include/ffi.h.in: Try to work around messy header problem + with PACKAGE and VERSION. + + * configure: Rebuilt. + * configure.in: Change version to 2.00-beta. + + * fficonfig.h.in: Rebuilt. + * acconfig.h (FFI_NO_STRUCTS, FFI_NO_RAW_API): Define. + + * src/x86/ffi.c (ffi_raw_call): Rename. + +1999-08-02 Kresten Krab Thorup + + * src/x86/ffi.c (ffi_closure_SYSV): New function. + (ffi_prep_incoming_args_SYSV): Ditto. + (ffi_prep_closure): Ditto. + (ffi_closure_raw_SYSV): Ditto. + (ffi_prep_raw_closure): More ditto. + (ffi_call_raw): Final ditto. + + * include/ffi.h.in: Add definitions for closure and raw API. + + * src/x86/ffi.c (ffi_prep_cif_machdep): Added case for + FFI_TYPE_UINT64. + + * Makefile.am (libffi_la_common_SOURCES): Added raw_api.c + + * src/raw_api.c: New file. + + * include/ffi.h.in (ffi_raw): New type. + (UINT_ARG, SINT_ARG): New defines. + (ffi_closure, ffi_raw_closure): New types. + (ffi_prep_closure, ffi_prep_raw_closure): New declarations. + + * configure.in: Add check for endianness and sizeof void*. + + * src/x86/sysv.S (ffi_call_SYSV): Call fixup routine via argument, + instead of directly. + + * configure: Rebuilt. + +Thu Jul 8 14:28:42 1999 Anthony Green + + * configure.in: Add x86 and powerpc BeOS configurations. + From Makoto Kato . + +1999-05-09 Anthony Green + + * configure.in: Add warning about this being beta code. + Remove src/Makefile.am from the picture. + * configure: Rebuilt. + + * Makefile.am: Move logic from src/Makefile.am. Add changes + to support libffi as a target library. + * Makefile.in: Rebuilt. + + * aclocal.m4, config.guess, config.sub, ltconfig, ltmain.sh: + Upgraded to new autoconf, automake, libtool. + + * README: Tweaks. + + * LICENSE: Update copyright date. + + * src/Makefile.am, src/Makefile.in: Removed. + +1998-11-29 Anthony Green + + * include/ChangeLog: Removed. + * src/ChangeLog: Removed. + * src/mips/ChangeLog: Removed. + * src/sparc/ChangeLog: Remboved. + * src/x86/ChangeLog: Removed. + + * ChangeLog.v1: Created. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/ChangeLog.libffi b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/ChangeLog.libffi new file mode 100644 index 000000000..f3ee8b004 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/ChangeLog.libffi @@ -0,0 +1,584 @@ +2011-02-08 Andreas Tobler + + * testsuite/lib/libffi.exp: Tweak for stand-alone mode. + +2009-12-25 Samuli Suominen + + * configure.ac: Undefine _AC_ARG_VAR_PRECIOUS for autoconf 2.64. + * configure: Rebuilt. + * fficonfig.h.in: Rebuilt. + +2009-06-16 Andrew Haley + + * testsuite/libffi.call/cls_align_sint64.c, + testsuite/libffi.call/cls_align_uint64.c, + testsuite/libffi.call/cls_longdouble_va.c, + testsuite/libffi.call/cls_ulonglong.c, + testsuite/libffi.call/return_ll1.c, + testsuite/libffi.call/stret_medium2.c: Fix printf format + specifiers. + * testsuite/libffi.call/huge_struct.c: Ad x86 XFAILs. + * testsuite/libffi.call/float2.c: Fix dg-excess-errors. + * testsuite/libffi.call/ffitest.h, + testsuite/libffi.special/ffitestcxx.h (PRIdLL, PRIuLL): Define. + +2009-06-12 Andrew Haley + + * testsuite/libffi.call/cls_align_sint64.c, + testsuite/libffi.call/cls_align_uint64.c, + testsuite/libffi.call/cls_ulonglong.c, + testsuite/libffi.call/return_ll1.c, + testsuite/libffi.call/stret_medium2.c: Fix printf format + specifiers. + testsuite/libffi.special/unwindtest.cc: include stdint.h. + +2009-06-11 Timothy Wall + + * Makefile.am, + configure.ac, + include/ffi.h.in, + include/ffi_common.h, + src/closures.c, + src/dlmalloc.c, + src/x86/ffi.c, + src/x86/ffitarget.h, + src/x86/win64.S (new), + README: Added win64 support (mingw or MSVC) + * Makefile.in, + include/Makefile.in, + man/Makefile.in, + testsuite/Makefile.in, + configure, + aclocal.m4: Regenerated + * ltcf-c.sh: properly escape cygwin/w32 path + * man/ffi_call.3: Clarify size requirements for return value. + * src/x86/ffi64.c: Fix filename in comment. + * src/x86/win32.S: Remove unused extern. + + * testsuite/libffi.call/closure_fn0.c, + testsuite/libffi.call/closure_fn1.c, + testsuite/libffi.call/closure_fn2.c, + testsuite/libffi.call/closure_fn3.c, + testsuite/libffi.call/closure_fn4.c, + testsuite/libffi.call/closure_fn5.c, + testsuite/libffi.call/closure_fn6.c, + testsuite/libffi.call/closure_stdcall.c, + testsuite/libffi.call/cls_12byte.c, + testsuite/libffi.call/cls_16byte.c, + testsuite/libffi.call/cls_18byte.c, + testsuite/libffi.call/cls_19byte.c, + testsuite/libffi.call/cls_1_1byte.c, + testsuite/libffi.call/cls_20byte.c, + testsuite/libffi.call/cls_20byte1.c, + testsuite/libffi.call/cls_24byte.c, + testsuite/libffi.call/cls_2byte.c, + testsuite/libffi.call/cls_3_1byte.c, + testsuite/libffi.call/cls_3byte1.c, + testsuite/libffi.call/cls_3byte2.c, + testsuite/libffi.call/cls_4_1byte.c, + testsuite/libffi.call/cls_4byte.c, + testsuite/libffi.call/cls_5_1_byte.c, + testsuite/libffi.call/cls_5byte.c, + testsuite/libffi.call/cls_64byte.c, + testsuite/libffi.call/cls_6_1_byte.c, + testsuite/libffi.call/cls_6byte.c, + testsuite/libffi.call/cls_7_1_byte.c, + testsuite/libffi.call/cls_7byte.c, + testsuite/libffi.call/cls_8byte.c, + testsuite/libffi.call/cls_9byte1.c, + testsuite/libffi.call/cls_9byte2.c, + testsuite/libffi.call/cls_align_double.c, + testsuite/libffi.call/cls_align_float.c, + testsuite/libffi.call/cls_align_longdouble.c, + testsuite/libffi.call/cls_align_longdouble_split.c, + testsuite/libffi.call/cls_align_longdouble_split2.c, + testsuite/libffi.call/cls_align_pointer.c, + testsuite/libffi.call/cls_align_sint16.c, + testsuite/libffi.call/cls_align_sint32.c, + testsuite/libffi.call/cls_align_sint64.c, + testsuite/libffi.call/cls_align_uint16.c, + testsuite/libffi.call/cls_align_uint32.c, + testsuite/libffi.call/cls_align_uint64.c, + testsuite/libffi.call/cls_dbls_struct.c, + testsuite/libffi.call/cls_double.c, + testsuite/libffi.call/cls_double_va.c, + testsuite/libffi.call/cls_float.c, + testsuite/libffi.call/cls_longdouble.c, + testsuite/libffi.call/cls_longdouble_va.c, + testsuite/libffi.call/cls_multi_schar.c, + testsuite/libffi.call/cls_multi_sshort.c, + testsuite/libffi.call/cls_multi_sshortchar.c, + testsuite/libffi.call/cls_multi_uchar.c, + testsuite/libffi.call/cls_multi_ushort.c, + testsuite/libffi.call/cls_multi_ushortchar.c, + testsuite/libffi.call/cls_pointer.c, + testsuite/libffi.call/cls_pointer_stack.c, + testsuite/libffi.call/cls_schar.c, + testsuite/libffi.call/cls_sint.c, + testsuite/libffi.call/cls_sshort.c, + testsuite/libffi.call/cls_uchar.c, + testsuite/libffi.call/cls_uint.c, + testsuite/libffi.call/cls_ulonglong.c, + testsuite/libffi.call/cls_ushort.c, + testsuite/libffi.call/err_bad_abi.c, + testsuite/libffi.call/err_bad_typedef.c, + testsuite/libffi.call/float2.c, + testsuite/libffi.call/huge_struct.c, + testsuite/libffi.call/nested_struct.c, + testsuite/libffi.call/nested_struct1.c, + testsuite/libffi.call/nested_struct10.c, + testsuite/libffi.call/nested_struct2.c, + testsuite/libffi.call/nested_struct3.c, + testsuite/libffi.call/nested_struct4.c, + testsuite/libffi.call/nested_struct5.c, + testsuite/libffi.call/nested_struct6.c, + testsuite/libffi.call/nested_struct7.c, + testsuite/libffi.call/nested_struct8.c, + testsuite/libffi.call/nested_struct9.c, + testsuite/libffi.call/problem1.c, + testsuite/libffi.call/return_ldl.c, + testsuite/libffi.call/return_ll1.c, + testsuite/libffi.call/stret_large.c, + testsuite/libffi.call/stret_large2.c, + testsuite/libffi.call/stret_medium.c, + testsuite/libffi.call/stret_medium2.c, + testsuite/libffi.special/unwindtest.cc: use ffi_closure_alloc instead + of checking for MMAP. Use intptr_t instead of long casts. + +2009-06-04 Andrew Haley + + * src/powerpc/ffitarget.h: Fix misapplied merge from gcc. + +2009-06-04 Andrew Haley + + * src/mips/o32.S, + src/mips/n32.S: Fix licence formatting. + +2009-06-04 Andrew Haley + + * src/x86/darwin.S: Fix licence formatting. + src/x86/win32.S: Likewise. + src/sh64/sysv.S: Likewise. + src/sh/sysv.S: Likewise. + +2009-06-04 Andrew Haley + + * src/sh64/ffi.c: Remove lint directives. Was missing from merge + of Andreas Tobler's patch from 2006-04-22. + +2009-06-04 Andrew Haley + + * src/sh/ffi.c: Apply missing hunk from Alexandre Oliva's patch of + 2007-03-07. + +2008-12-26 Timothy Wall + + * testsuite/libffi.call/cls_longdouble.c, + testsuite/libffi.call/cls_longdouble_va.c, + testsuite/libffi.call/cls_align_longdouble.c, + testsuite/libffi.call/cls_align_longdouble_split.c, + testsuite/libffi.call/cls_align_longdouble_split2.c: mark expected + failures on x86_64 cygwin/mingw. + +2008-12-22 Timothy Wall + + * testsuite/libffi.call/closure_fn0.c, + testsuite/libffi.call/closure_fn1.c, + testsuite/libffi.call/closure_fn2.c, + testsuite/libffi.call/closure_fn3.c, + testsuite/libffi.call/closure_fn4.c, + testsuite/libffi.call/closure_fn5.c, + testsuite/libffi.call/closure_fn6.c, + testsuite/libffi.call/closure_loc_fn0.c, + testsuite/libffi.call/closure_stdcall.c, + testsuite/libffi.call/cls_align_pointer.c, + testsuite/libffi.call/cls_pointer.c, + testsuite/libffi.call/cls_pointer_stack.c: use portable cast from + pointer to integer (intptr_t). + * testsuite/libffi.call/cls_longdouble.c: disable for win64. + +2008-12-19 Anthony Green + + * configure.ac: Bump version to 3.0.8. + * configure, doc/stamp-vti, doc/version.texi: Rebuilt. + * libtool-version: Increment revision. + * README: Update for new release. + +2008-11-11 Anthony Green + + * configure.ac: Bump version to 3.0.7. + * configure, doc/stamp-vti, doc/version.texi: Rebuilt. + * libtool-version: Increment revision. + * README: Update for new release. + +2008-08-25 Andreas Tobler + + * src/powerpc/ffitarget.h (ffi_abi): Add FFI_LINUX and + FFI_LINUX_SOFT_FLOAT to the POWERPC_FREEBSD enum. + Add note about flag bits used for FFI_SYSV_TYPE_SMALL_STRUCT. + Adjust copyright notice. + * src/powerpc/ffi.c: Add two new flags to indicate if we have one + register or two register to use for FFI_SYSV structs. + (ffi_prep_cif_machdep): Pass the right register flag introduced above. + (ffi_closure_helper_SYSV): Fix the return type for + FFI_SYSV_TYPE_SMALL_STRUCT. Comment. + Adjust copyright notice. + +2008-07-24 Anthony Green + + * testsuite/libffi.call/cls_dbls_struct.c, + testsuite/libffi.call/cls_double_va.c, + testsuite/libffi.call/cls_longdouble.c, + testsuite/libffi.call/cls_longdouble_va.c, + testsuite/libffi.call/cls_pointer.c, + testsuite/libffi.call/cls_pointer_stack.c, + testsuite/libffi.call/err_bad_abi.c: Clean up failures from + compiler warnings. + +2008-07-17 Anthony Green + + * configure.ac: Bump version to 3.0.6. + * configure, doc/stamp-vti, doc/version.texi: Rebuilt. + * libtool-version: Increment revision. Add documentation. + * README: Update for new release. + +2008-07-16 Kaz Kojima + + * src/sh/ffi.c (ffi_prep_closure_loc): Turn INSN into an unsigned + int. + +2008-07-16 Kaz Kojima + + * src/sh/sysv.S: Add .note.GNU-stack on Linux. + * src/sh64/sysv.S: Likewise. + +2008-04-03 Anthony Green + + * libffi.pc.in (Libs): Add -L${libdir}. + * configure.ac: Bump version to 3.0.5. + * configure, doc/stamp-vti, doc/version.texi: Rebuilt. + * libtool-version: Increment revision. + * README: Update for new release. + +2008-04-03 Anthony Green + Xerces Ranby + + * include/ffi.h.in: Wrap definition of target architecture to + protect from double definitions. + +2008-03-22 Moriyoshi Koizumi + + * src/x86/ffi.c (ffi_prep_closure_loc): Fix for bug revealed in + closure_loc_fn0.c. + * testsuite/libffi.call/closure_loc_fn0.c (closure_loc_test_fn0): + New test. + +2008-03-04 Anthony Green + Blake Chaffin + hos@tamanegi.org + + * testsuite/libffi.call/cls_align_longdouble_split2.c + testsuite/libffi.call/cls_align_longdouble_split.c + testsuite/libffi.call/cls_dbls_struct.c + testsuite/libffi.call/cls_double_va.c + testsuite/libffi.call/cls_longdouble.c + testsuite/libffi.call/cls_longdouble_va.c + testsuite/libffi.call/cls_pointer.c + testsuite/libffi.call/cls_pointer_stack.c + testsuite/libffi.call/err_bad_abi.c + testsuite/libffi.call/err_bad_typedef.c + testsuite/libffi.call/huge_struct.c + testsuite/libffi.call/stret_large2.c + testsuite/libffi.call/stret_large.c + testsuite/libffi.call/stret_medium2.c + testsuite/libffi.call/stret_medium.c: New tests from Apple. + +2008-02-26 Jakub Jelinek + Anthony Green + + * src/alpha/osf.S: Add .note.GNU-stack on Linux. + * src/s390/sysv.S: Likewise. + * src/powerpc/linux64.S: Likewise. + * src/powerpc/linux64_closure.S: Likewise. + * src/powerpc/ppc_closure.S: Likewise. + * src/powerpc/sysv.S: Likewise. + * src/x86/unix64.S: Likewise. + * src/x86/sysv.S: Likewise. + * src/sparc/v8.S: Likewise. + * src/sparc/v9.S: Likewise. + * src/m68k/sysv.S: Likewise. + * src/ia64/unix.S: Likewise. + * src/arm/sysv.S: Likewise. + +2008-02-26 Anthony Green + Thomas Heller + + * src/x86/ffi.c (ffi_closure_SYSV_inner): Change C++ comment to C + comment. + +2008-02-26 Anthony Green + Thomas Heller + + * include/ffi.h.in: Change void (*)() to void (*)(void). + +2008-02-26 Anthony Green + Thomas Heller + + * src/alpha/ffi.c: Change void (*)() to void (*)(void). + src/alpha/osf.S, src/arm/ffi.c, src/frv/ffi.c, src/ia64/ffi.c, + src/ia64/unix.S, src/java_raw_api.c, src/m32r/ffi.c, + src/mips/ffi.c, src/pa/ffi.c, src/pa/hpux32.S, src/pa/linux.S, + src/powerpc/ffi.c, src/powerpc/ffi_darwin.c, src/raw_api.c, + src/s390/ffi.c, src/sh/ffi.c, src/sh64/ffi.c, src/sparc/ffi.c, + src/x86/ffi.c, src/x86/unix64.S, src/x86/darwin64.S, + src/x86/ffi64.c: Ditto. + +2008-02-24 Anthony Green + + * configure.ac: Accept openbsd*, not just openbsd. + Bump version to 3.0.4. + * configure, doc/stamp-vti, doc/version.texi: Rebuilt. + * libtool-version: Increment revision. + * README: Update for new release. + +2008-02-22 Anthony Green + + * README: Clean up list of tested platforms. + +2008-02-22 Anthony Green + + * configure.ac: Bump version to 3.0.3. + * configure, doc/stamp-vti, doc/version.texi: Rebuilt. + * libtool-version: Increment revision. + * README: Update for new release. Clean up test docs. + +2008-02-22 Bjoern Koenig + Andreas Tobler + + * configure.ac: Add amd64-*-freebsd* target. + * configure: Regenerate. + +2008-02-22 Thomas Heller + + * configure.ac: Add x86 OpenBSD support. + * configure: Rebuilt. + +2008-02-21 Thomas Heller + + * README: Change "make test" to "make check". + +2008-02-21 Anthony Green + + * configure.ac: Bump version to 3.0.2. + * configure, doc/stamp-vti, doc/version.texi: Rebuilt. + * libtool-version: Increment revision. + * README: Update for new release. + +2008-02-21 Björn König + + * src/x86/freebsd.S: New file. + * configure.ac: Add x86 FreeBSD support. + * Makefile.am: Ditto. + +2008-02-15 Anthony Green + + * configure.ac: Bump version to 3.0.1. + * configure, doc/stamp-vti, doc/version.texi: Rebuilt. + * libtool-version: Increment revision. + * README: Update for new release. + +2008-02-15 David Daney + + * src/mips/ffi.c: Remove extra '>' from include directive. + (ffi_prep_closure_loc): Use clear_location instead of tramp. + +2008-02-15 Anthony Green + + * configure.ac: Bump version to 3.0.0. + * configure, doc/stamp-vti, doc/version.texi: Rebuilt. + +2008-02-15 David Daney + + * src/mips/ffi.c (USE__BUILTIN___CLEAR_CACHE): + Define (conditionally), and use it to include cachectl.h. + (ffi_prep_closure_loc): Fix cache flushing. + * src/mips/ffitarget.h (_ABIN32, _ABI64, _ABIO32): Define. + +2008-02-15 Anthony Green + + * man/ffi_call.3, man/ffi_prep_cif.3, man/ffi.3: + Update dates and remove all references to ffi_prep_closure. + * configure.ac: Bump version to 2.99.9. + * configure, doc/stamp-vti, doc/version.texi: Rebuilt. + +2008-02-15 Anthony Green + + * man/ffi_prep_closure.3: Delete. + * man/Makefile.am (EXTRA_DIST): Remove ffi_prep_closure.3. + (man_MANS): Ditto. + * man/Makefile.in: Rebuilt. + * configure.ac: Bump version to 2.99.8. + * configure, doc/stamp-vti, doc/version.texi: Rebuilt. + +2008-02-14 Anthony Green + + * configure.ac: Bump version to 2.99.7. + * configure, doc/stamp-vti, doc/version.texi: Rebuilt. + * include/ffi.h.in LICENSE src/debug.c src/closures.c + src/ffitest.c src/s390/sysv.S src/s390/ffitarget.h + src/types.c src/m68k/ffitarget.h src/raw_api.c src/frv/ffi.c + src/frv/ffitarget.h src/sh/ffi.c src/sh/sysv.S + src/sh/ffitarget.h src/powerpc/ffitarget.h src/pa/ffi.c + src/pa/ffitarget.h src/pa/linux.S src/java_raw_api.c + src/cris/ffitarget.h src/x86/ffi.c src/x86/sysv.S + src/x86/unix64.S src/x86/win32.S src/x86/ffitarget.h + src/x86/ffi64.c src/x86/darwin.S src/ia64/ffi.c + src/ia64/ffitarget.h src/ia64/ia64_flags.h src/ia64/unix.S + src/sparc/ffi.c src/sparc/v9.S src/sparc/ffitarget.h + src/sparc/v8.S src/alpha/ffi.c src/alpha/ffitarget.h + src/alpha/osf.S src/sh64/ffi.c src/sh64/sysv.S + src/sh64/ffitarget.h src/mips/ffi.c src/mips/ffitarget.h + src/mips/n32.S src/mips/o32.S src/arm/ffi.c src/arm/sysv.S + src/arm/ffitarget.h src/prep_cif.c: Update license text. + +2008-02-14 Anthony Green + + * README: Update tested platforms. + * configure.ac: Bump version to 2.99.6. + * configure: Rebuilt. + +2008-02-14 Anthony Green + + * configure.ac: Bump version to 2.99.5. + * configure: Rebuilt. + * Makefile.am (EXTRA_DIST): Add darwin64.S + * Makefile.in: Rebuilt. + * testsuite/lib/libffi-dg.exp: Remove libstdc++ bits from GCC tree. + * LICENSE: Update WARRANTY. + +2008-02-14 Anthony Green + + * libffi.pc.in (libdir): Fix libdir definition. + * configure.ac: Bump version to 2.99.4. + * configure: Rebuilt. + +2008-02-14 Anthony Green + + * README: Update. + * libffi.info: New file. + * doc/stamp-vti: New file. + * configure.ac: Bump version to 2.99.3. + * configure: Rebuilt. + +2008-02-14 Anthony Green + + * Makefile.am (SUBDIRS): Add man dir. + * Makefile.in: Rebuilt. + * configure.ac: Create Makefile. + * configure: Rebuilt. + * man/ffi_call.3 man/ffi_prep_cif.3 man/ffi_prep_closure.3 + man/Makefile.am man/Makefile.in: New files. + +2008-02-14 Tom Tromey + + * aclocal.m4, Makefile.in, configure, fficonfig.h.in: Rebuilt. + * mdate-sh, texinfo.tex: New files. + * Makefile.am (info_TEXINFOS): New variable. + * doc/libffi.texi: New file. + * doc/version.texi: Likewise. + +2008-02-14 Anthony Green + + * Makefile.am (AM_CFLAGS): Don't compile with -D$(TARGET). + (lib_LTLIBRARIES): Define. + (toolexeclib_LIBRARIES): Undefine. + * Makefile.in: Rebuilt. + * configure.ac: Reset version to 2.99.1. + * configure.in: Rebuilt. + +2008-02-14 Anthony Green + + * libffi.pc.in: Use @PACKAGE_NAME@ and @PACKAGE_VERSION@. + * configure.ac: Reset version to 2.99.1. + * configure.in: Rebuilt. + * Makefile.am (EXTRA_DIST): Add ChangeLog.libffi. + * Makefile.in: Rebuilt. + * LICENSE: Update copyright notice. + +2008-02-14 Anthony Green + + * include/Makefile.am (nodist_includes_HEADERS): Define. Don't + distribute ffitarget.h or ffi.h from the build include dir. + * Makefile.in: Rebuilt. + +2008-02-14 Anthony Green + + * include/Makefile.am (includesdir): Install headers under libdir. + (pkgconfigdir): Define. Install libffi.pc. + * include/Makefile.in: Rebuilt. + * libffi.pc.in: Create. + * libtool-version: Increment CURRENT + * configure.ac: Add libffi.pc.in + * configure: Rebuilt. + +2008-02-03 Anthony Green + + * include/Makefile.am (includesdir): Fix header install with + DESTDIR. + * include/Makefile.in: Rebuilt. + +2008-02-03 Timothy Wall + + * src/x86/ffi.c (FFI_INIT_TRAMPOLINE_STDCALL): Calculate jump return + offset based on code pointer, not data pointer. + +2008-02-01 Anthony Green + + * include/Makefile.am: Fix header installs. + * Makefile.am: Ditto. + * include/Makefile.in: Rebuilt. + * Makefile.in: Ditto. + +2008-02-01 Anthony Green + + * src/x86/ffi.c (FFI_INIT_TRAMPOLINE_STDCALL, + FFI_INIT_TRAMPOLINE): Revert my broken changes to twall's last + patch. + +2008-01-31 Anthony Green + + * Makefile.am (EXTRA_DIST): Add missing files. + * testsuite/Makefile.am: Ditto. + * Makefile.in, testsuite/Makefile.in: Rebuilt. + +2008-01-31 Timothy Wall + + * testsuite/libffi.call/closure_stdcall.c: Add test for stdcall + closures. + * src/x86/ffitarget.h: Increase size of trampoline for stdcall + closures. + * src/x86/win32.S: Add assembly for stdcall closure. + * src/x86/ffi.c: Initialize stdcall closure trampoline. + +2008-01-30 H.J. Lu + + PR libffi/34612 + * src/x86/sysv.S (ffi_closure_SYSV): Pop 4 byte from stack when + returning struct. + + * testsuite/libffi.call/call.exp: Add "-O2 -fomit-frame-pointer" + tests. + +2008-01-30 Anthony Green + + * Makefile.am, include/Makefile.am: Move headers to + libffi_la_SOURCES for new automake. + * Makefile.in, include/Makefile.in: Rebuilt. + + * testsuite/lib/wrapper.exp: Copied from gcc tree to allow for + execution outside of gcc tree. + * testsuite/lib/target-libpath.exp: Ditto. + + * testsuite/lib/libffi-dg.exp: Many changes to allow for execution + outside of gcc tree. + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/ChangeLog.libgcj b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/ChangeLog.libgcj new file mode 100644 index 000000000..ea5d02f19 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/ChangeLog.libgcj @@ -0,0 +1,40 @@ +2004-01-14 Kelley Cook + + * configure.in: Add in AC_PREREQ(2.13) + +2003-02-20 Alexandre Oliva + + * configure.in: Propagate ORIGINAL_LD_FOR_MULTILIBS to + config.status. + * configure: Rebuilt. + +2002-01-27 Alexandre Oliva + + * configure.in (toolexecdir, toolexeclibdir): Set and AC_SUBST. + Remove USE_LIBDIR conditional. + * Makefile.am (toolexecdir, toolexeclibdir): Don't override. + * Makefile.in, configure: Rebuilt. + +Mon Aug 9 18:33:38 1999 Rainer Orth + + * include/Makefile.in: Rebuilt. + * Makefile.in: Rebuilt + * Makefile.am (toolexeclibdir): Add $(MULTISUBDIR) even for native + builds. + Use USE_LIBDIR. + + * configure: Rebuilt. + * configure.in (USE_LIBDIR): Define for native builds. + Use lowercase in configure --help explanations. + +1999-08-08 Anthony Green + + * include/ffi.h.in (FFI_FN): Remove `...'. + +1999-08-08 Anthony Green + + * Makefile.in: Rebuilt. + * Makefile.am (AM_CFLAGS): Compile with -fexceptions. + + * src/x86/sysv.S: Add exception handling metadata. + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/ChangeLog.v1 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/ChangeLog.v1 new file mode 100644 index 000000000..369820cbd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/ChangeLog.v1 @@ -0,0 +1,764 @@ +The libffi version 1 ChangeLog archive. + +Version 1 of libffi had per-directory ChangeLogs. Current and future +versions have a single ChangeLog file in the root directory. The +version 1 ChangeLogs have all been concatonated into this file for +future reference only. + +--- libffi ---------------------------------------------------------------- + +Mon Oct 5 02:17:50 1998 Anthony Green + + * configure.in: Boosted rev. + * configure, Makefile.in, aclocal.m4: Rebuilt. + * README: Boosted rev and updated release notes. + +Mon Oct 5 01:03:03 1998 Anthony Green + + * configure.in: Boosted rev. + * configure, Makefile.in, aclocal.m4: Rebuilt. + * README: Boosted rev and updated release notes. + +1998-07-25 Andreas Schwab + + * m68k/ffi.c (ffi_prep_cif_machdep): Use bitmask for cif->flags. + Correctly handle small structures. + (ffi_prep_args): Also handle small structures. + (ffi_call): Pass size of return type to ffi_call_SYSV. + * m68k/sysv.S: Adjust for above changes. Correctly align small + structures in the return value. + + * types.c (uint64, sint64) [M68K]: Change alignment to 4. + +Fri Apr 17 17:26:58 1998 Anthony Green + + * configure.in: Boosted rev. + * configure,Makefile.in,aclocal.m4: Rebuilt. + * README: Boosted rev and added release notes. + +Sun Feb 22 00:50:41 1998 Geoff Keating + + * configure.in: Add PowerPC config bits. + +1998-02-14 Andreas Schwab + + * configure.in: Add m68k config bits. Change AC_CANONICAL_SYSTEM + to AC_CANONICAL_HOST, this is not a compiler. Use $host instead + of $target. Remove AC_CHECK_SIZEOF(char), we already know the + result. Fix argument of AC_ARG_ENABLE. + * configure, fficonfig.h.in: Rebuilt. + +Tue Feb 10 20:53:40 1998 Richard Henderson + + * configure.in: Add Alpha config bits. + +Tue May 13 13:39:20 1997 Anthony Green + + * README: Updated dates and reworded Irix comments. + + * configure.in: Removed AC_PROG_RANLIB. + + * Makefile.in, aclocal.m4, config.guess, config.sub, configure, + ltmain.sh, */Makefile.in: libtoolized again and rebuilt with + automake and autoconf. + +Sat May 10 18:44:50 1997 Tom Tromey + + * configure, aclocal.m4: Rebuilt. + * configure.in: Don't compute EXTRADIST; now handled in + src/Makefile.in. Removed macros implied by AM_INIT_AUTOMAKE. + Don't run AM_MAINTAINER_MODE. + +Thu May 8 14:34:05 1997 Anthony Green + + * missing, ltmain.sh, ltconfig.sh: Created. These are new files + required by automake and libtool. + + * README: Boosted rev to 1.14. Added notes. + + * acconfig.h: Moved PACKAGE and VERSION for new automake. + + * configure.in: Changes for libtool. + + * Makefile.am (check): make test now make check. Uses libtool now. + + * Makefile.in, configure.in, aclocal.h, fficonfig.h.in: Rebuilt. + +Thu May 1 16:27:07 1997 Anthony Green + + * missing: Added file required by new automake. + +Tue Nov 26 14:10:42 1996 Anthony Green + + * acconfig.h: Added USING_PURIFY flag. This is defined when + --enable-purify-safety was used at configure time. + + * configure.in (allsources): Added --enable-purify-safety switch. + (VERSION): Boosted rev to 1.13. + * configure: Rebuilt. + +Fri Nov 22 06:46:12 1996 Anthony Green + + * configure.in (VERSION): Boosted rev to 1.12. + Removed special CFLAGS hack for gcc. + * configure: Rebuilt. + + * README: Boosted rev to 1.12. Added notes. + + * Many files: Cygnus Support changed to Cygnus Solutions. + +Wed Oct 30 11:15:25 1996 Anthony Green + + * configure.in (VERSION): Boosted rev to 1.11. + * configure: Rebuilt. + + * README: Boosted rev to 1.11. Added notes about GNU make. + +Tue Oct 29 12:25:12 1996 Anthony Green + + * configure.in: Fixed -Wall trick. + (VERSION): Boosted rev. + * configure: Rebuilt + + * acconfig.h: Needed for --enable-debug configure switch. + + * README: Boosted rev to 1.09. Added more notes on building + libffi, and LCLint. + + * configure.in: Added --enable-debug switch. Boosted rev to + 1.09. + * configure: Rebuilt + +Tue Oct 15 13:11:28 1996 Anthony Green + + * configure.in (VERSION): Boosted rev to 1.08 + * configure: Rebuilt. + + * README: Added n32 bug fix notes. + + * Makefile.am: Added "make lint" production. + * Makefile.in: Rebuilt. + +Mon Oct 14 10:54:46 1996 Anthony Green + + * README: Added web page reference. + + * configure.in, README: Boosted rev to 1.05 + * configure: Rebuilt. + + * README: Fixed n32 sample code. + +Fri Oct 11 17:09:28 1996 Anthony Green + + * README: Added sparc notes. + + * configure.in, README: Boosted rev to 1.04. + * configure: Rebuilt. + +Thu Oct 10 10:31:03 1996 Anthony Green + + * configure.in, README: Boosted rev to 1.03. + * configure: Rebuilt. + + * README: Added struct notes. + + * Makefile.am (EXTRA_DIST): Added LICENSE to distribution. + * Makefile.in: Rebuilt. + + * README: Removed Linux section. No special notes now + because aggregates arg/return types work. + +Wed Oct 9 16:16:42 1996 Anthony Green + + * README, configure.in (VERSION): Boosted rev to 1.02 + * configure: Rebuilt. + +Tue Oct 8 11:56:33 1996 Anthony Green + + * README (NOTE): Added n32 notes. + + * Makefile.am: Added test production. + * Makefile: Rebuilt + + * README: spell checked! + + * configure.in (VERSION): Boosted rev to 1.01 + * configure: Rebuilt. + +Mon Oct 7 15:50:22 1996 Anthony Green + + * configure.in: Added nasty bit to support SGI tools. + * configure: Rebuilt. + + * README: Added SGI notes. Added note about automake bug. + +Mon Oct 7 11:00:28 1996 Anthony Green + + * README: Rewrote intro, and fixed examples. + +Fri Oct 4 10:19:55 1996 Anthony Green + + * configure.in: -D$TARGET is no longer used as a compiler switch. + It is now inserted into ffi.h at configure time. + * configure: Rebuilt. + + * FFI_ABI and FFI_STATUS are now ffi_abi and ffi_status. + +Thu Oct 3 13:47:34 1996 Anthony Green + + * README, LICENSE: Created. Wrote some docs. + + * configure.in: Don't barf on i586-unknown-linuxaout. + Added EXTRADIST code for "make dist". + * configure: Rebuilt. + + * */Makefile.in: Rebuilt with patched automake. + +Tue Oct 1 17:12:25 1996 Anthony Green + + * Makefile.am, aclocal.m4, config.guess, config.sub, + configure.in, fficonfig.h.in, install-sh, mkinstalldirs, + stamp-h.in: Created + * Makefile.in, configure: Generated + +--- libffi/include -------------------------------------------------------- + +Tue Feb 24 13:09:36 1998 Anthony Green + + * ffi_mips.h: Updated FFI_TYPE_STRUCT_* values based on + ffi.h.in changes. This is a work-around for SGI's "simple" + assembler. + +Sun Feb 22 00:51:55 1998 Geoff Keating + + * ffi.h.in: PowerPC support. + +1998-02-14 Andreas Schwab + + * ffi.h.in: Add m68k support. + (FFI_TYPE_LONGDOUBLE): Make it a separate value. + +Tue Feb 10 20:55:16 1998 Richard Henderson + + * ffi.h.in (SIZEOF_ARG): Use a pointer type by default. + + * ffi.h.in: Alpha support. + +Fri Nov 22 06:48:45 1996 Anthony Green + + * ffi.h.in, ffi_common.h: Cygnus Support -> Cygnus Solutions. + +Wed Nov 20 22:31:01 1996 Anthony Green + + * ffi.h.in: Added ffi_type_void definition. + +Tue Oct 29 12:22:40 1996 Anthony Green + + * Makefile.am (hack_DATA): Always install ffi_mips.h. + + * ffi.h.in: Removed FFI_DEBUG. It's now in the correct + place (acconfig.h). + Added #include for size_t definition. + +Tue Oct 15 17:23:35 1996 Anthony Green + + * ffi.h.in, ffi_common.h, ffi_mips.h: More clean up. + Commented out #define of FFI_DEBUG. + +Tue Oct 15 13:01:06 1996 Anthony Green + + * ffi_common.h: Added bool definition. + + * ffi.h.in, ffi_common.h: Clean up based on LCLint output. + Added funny /*@...@*/ comments to annotate source. + +Mon Oct 14 12:29:23 1996 Anthony Green + + * ffi.h.in: Interface changes based on feedback from Jim + Blandy. + +Fri Oct 11 16:49:35 1996 Anthony Green + + * ffi.h.in: Small change for sparc support. + +Thu Oct 10 14:53:37 1996 Anthony Green + + * ffi_mips.h: Added FFI_TYPE_STRUCT_* definitions for + special structure return types. + +Wed Oct 9 13:55:57 1996 Anthony Green + + * ffi.h.in: Added SIZEOF_ARG definition for X86 + +Tue Oct 8 11:40:36 1996 Anthony Green + + * ffi.h.in (FFI_FN): Added macro for eliminating compiler warnings. + Use it to case your function pointers to the proper type. + + * ffi_mips.h (SIZEOF_ARG): Added magic to fix type promotion bug. + + * Makefile.am (EXTRA_DIST): Added ffi_mips.h to EXTRA_DIST. + * Makefile: Rebuilt. + + * ffi_mips.h: Created. Moved all common mips definitions here. + +Mon Oct 7 10:58:12 1996 Anthony Green + + * ffi.h.in: The SGI assember is very picky about parens. Redefined + some macros to avoid problems. + + * ffi.h.in: Added FFI_DEFAULT_ABI definitions. Also added + externs for pointer, and 64bit integral ffi_types. + +Fri Oct 4 09:51:37 1996 Anthony Green + + * ffi.h.in: Added FFI_ABI member to ffi_cif and changed + function prototypes accordingly. + Added #define @TARGET@. Now programs including ffi.h don't + have to specify this themselves. + +Thu Oct 3 15:36:44 1996 Anthony Green + + * ffi.h.in: Changed ffi_prep_cif's values from void* to void** + + * Makefile.am (EXTRA_DIST): Added EXTRA_DIST for "make dist" + to work. + * Makefile.in: Regenerated. + +Wed Oct 2 10:16:59 1996 Anthony Green + + * Makefile.am: Created + * Makefile.in: Generated + + * ffi_common.h: Added rcsid comment + +Tue Oct 1 17:13:51 1996 Anthony Green + + * ffi.h.in, ffi_common.h: Created + +--- libffi/src ------------------------------------------------------------ + +Mon Oct 5 02:17:50 1998 Anthony Green + + * arm/ffi.c, arm/sysv.S: Created. + + * Makefile.am: Added arm files. + * Makefile.in: Rebuilt. + +Mon Oct 5 01:41:38 1998 Anthony Green + + * Makefile.am (libffi_la_LDFLAGS): Incremented revision. + +Sun Oct 4 16:27:17 1998 Anthony Green + + * alpha/osf.S (ffi_call_osf): Patch for DU assembler. + + * ffitest.c (main): long long and long double return values work + for x86. + +Fri Apr 17 11:50:58 1998 Anthony Green + + * Makefile.in: Rebuilt. + + * ffitest.c (main): Floating point tests not executed for systems + with broken lond double (SunOS 4 w/ GCC). + + * types.c: Fixed x86 alignment info for long long types. + +Thu Apr 16 07:15:28 1998 Anthony Green + + * ffitest.c: Added more notes about GCC bugs under Irix 6. + +Wed Apr 15 08:42:22 1998 Anthony Green + + * ffitest.c (struct5): New test function. + (main): New test with struct5. + +Thu Mar 5 10:48:11 1998 Anthony Green + + * prep_cif.c (initialize_aggregate): Fix assertion for + nested structures. + +Tue Feb 24 16:33:41 1998 Anthony Green + + * prep_cif.c (ffi_prep_cif): Added long double support for sparc. + +Sun Feb 22 00:52:18 1998 Geoff Keating + + * powerpc/asm.h: New file. + * powerpc/ffi.c: New file. + * powerpc/sysv.S: New file. + * Makefile.am: PowerPC port. + * ffitest.c (main): Allow all tests to run even in presence of gcc + bug on PowerPC. + +1998-02-17 Anthony Green + + * mips/ffi.c: Fixed comment typo. + + * x86/ffi.c (ffi_prep_cif_machdep), x86/sysv.S (retfloat): + Fixed x86 long double return handling. + + * types.c: Fixed x86 long double alignment info. + +1998-02-14 Andreas Schwab + + * types.c: Add m68k support. + + * ffitest.c (floating): Add long double parameter. + (return_ll, ldblit): New functions to test long long and long + double return value. + (main): Fix type error in assignment of ts[1-4]_type.elements. + Add tests for long long and long double arguments and return + values. + + * prep_cif.c (ffi_prep_cif) [M68K]: Don't allocate argument for + struct value pointer. + + * m68k/ffi.c, m68k/sysv.S: New files. + * Makefile.am: Add bits for m68k port. Add kludge to work around + automake deficiency. + (test): Don't require "." in $PATH. + * Makefile.in: Rebuilt. + +Wed Feb 11 07:36:50 1998 Anthony Green + + * Makefile.in: Rebuilt. + +Tue Feb 10 20:56:00 1998 Richard Henderson + + * alpha/ffi.c, alpha/osf.S: New files. + * Makefile.am: Alpha port. + +Tue Nov 18 14:12:07 1997 Anthony Green + + * mips/ffi.c (ffi_prep_cif_machdep): Initialize rstruct_flag + for n32. + +Tue Jun 3 17:18:20 1997 Anthony Green + + * ffitest.c (main): Added hack to get structure tests working + correctly. + +Sat May 10 19:06:42 1997 Tom Tromey + + * Makefile.in: Rebuilt. + * Makefile.am (EXTRA_DIST): Explicitly list all distributable + files in subdirs. + (VERSION, CC): Removed. + +Thu May 8 17:19:01 1997 Anthony Green + + * Makefile.am: Many changes for new automake and libtool. + * Makefile.in: Rebuilt. + +Fri Nov 22 06:57:56 1996 Anthony Green + + * ffitest.c (main): Fixed test case for non mips machines. + +Wed Nov 20 22:31:59 1996 Anthony Green + + * types.c: Added ffi_type_void declaration. + +Tue Oct 29 13:07:19 1996 Anthony Green + + * ffitest.c (main): Fixed character constants. + (main): Emit warning for structure test 3 failure on Sun. + + * Makefile.am (VPATH): Fixed VPATH def'n so automake won't + strip it out. + Moved distdir hack from libffi to automake. + (ffitest): Added missing -c for $(COMPILE) (change in automake). + * Makefile.in: Rebuilt. + +Tue Oct 15 13:08:20 1996 Anthony Green + + * Makefile.am: Added "make lint" production. + * Makefile.in: Rebuilt. + + * prep_cif.c (STACK_ARG_SIZE): Improved STACK_ARG_SIZE macro. + Clean up based on LCLint output. Added funny /*@...@*/ comments to + annotate source. + + * ffitest.c, debug.c: Cleaned up code. + +Mon Oct 14 12:26:56 1996 Anthony Green + + * ffitest.c: Changes based on interface changes. + + * prep_cif.c (ffi_prep_cif): Cleaned up interface based on + feedback from Jim Blandy. + +Fri Oct 11 15:53:18 1996 Anthony Green + + * ffitest.c: Reordered tests while porting to sparc. + Made changes to handle lame structure passing for sparc. + Removed calls to fflush(). + + * prep_cif.c (ffi_prep_cif): Added special case for sparc + aggregate type arguments. + +Thu Oct 10 09:56:51 1996 Anthony Green + + * ffitest.c (main): Added structure passing/returning tests. + + * prep_cif.c (ffi_prep_cif): Perform proper initialization + of structure return types if needed. + (initialize_aggregate): Bug fix + +Wed Oct 9 16:04:20 1996 Anthony Green + + * types.c: Added special definitions for x86 (double doesn't + need double word alignment). + + * ffitest.c: Added many tests + +Tue Oct 8 09:19:22 1996 Anthony Green + + * prep_cif.c (ffi_prep_cif): Fixed assertion. + + * debug.c (ffi_assert): Must return a non void now. + + * Makefile.am: Added test production. + * Makefile: Rebuilt. + + * ffitest.c (main): Created. + + * types.c: Created. Stripped common code out of */ffi.c. + + * prep_cif.c: Added missing stdlib.h include. + + * debug.c (ffi_type_test): Used "a" to eliminate compiler + warnings in non-debug builds. Included ffi_common.h. + +Mon Oct 7 15:36:42 1996 Anthony Green + + * Makefile.am: Added a rule for .s -> .o + This is required by the SGI compiler. + * Makefile: Rebuilt. + +Fri Oct 4 09:51:08 1996 Anthony Green + + * prep_cif.c (initialize_aggregate): Moved abi specification + to ffi_prep_cif(). + +Thu Oct 3 15:37:37 1996 Anthony Green + + * prep_cif.c (ffi_prep_cif): Changed values from void* to void**. + (initialize_aggregate): Fixed aggregate type initialization. + + * Makefile.am (EXTRA_DIST): Added support code for "make dist". + * Makefile.in: Regenerated. + +Wed Oct 2 11:41:57 1996 Anthony Green + + * debug.c, prep_cif: Created. + + * Makefile.am: Added debug.o and prep_cif.o to OBJ. + * Makefile.in: Regenerated. + + * Makefile.am (INCLUDES): Added missing -I../include + * Makefile.in: Regenerated. + +Tue Oct 1 17:11:51 1996 Anthony Green + + * error.c, Makefile.am: Created. + * Makefile.in: Generated. + +--- libffi/src/x86 -------------------------------------------------------- + +Sun Oct 4 16:27:17 1998 Anthony Green + + * sysv.S (retlongdouble): Fixed long long return value support. + * ffi.c (ffi_prep_cif_machdep): Ditto. + +Wed May 13 04:30:33 1998 Anthony Green + + * ffi.c (ffi_prep_cif_machdep): Fixed long double return value + support. + +Wed Apr 15 08:43:20 1998 Anthony Green + + * ffi.c (ffi_prep_args): small struct support was missing. + +Thu May 8 16:53:58 1997 Anthony Green + + * objects.mak: Removed. + +Mon Dec 2 15:12:58 1996 Tom Tromey + + * sysv.S: Use .balign, for a.out Linux boxes. + +Tue Oct 15 13:06:50 1996 Anthony Green + + * ffi.c: Clean up based on LCLint output. + Added funny /*@...@*/ comments to annotate source. + +Fri Oct 11 16:43:38 1996 Anthony Green + + * ffi.c (ffi_call): Added assertion for bad ABIs. + +Wed Oct 9 13:57:27 1996 Anthony Green + + * sysv.S (retdouble): Fixed double return problems. + + * ffi.c (ffi_call): Corrected fn arg definition. + (ffi_prep_cif_machdep): Fixed double return problems + +Tue Oct 8 12:12:49 1996 Anthony Green + + * ffi.c: Moved ffi_type definitions to types.c. + (ffi_prep_args): Fixed type promotion bug. + +Mon Oct 7 15:53:06 1996 Anthony Green + + * ffi.c (FFI_*_TYPEDEF): Removed redundant ';' + +Fri Oct 4 09:54:53 1996 Anthony Green + + * ffi.c (ffi_call): Removed FFI_ABI arg, and swapped + remaining args. + +Wed Oct 2 10:07:05 1996 Anthony Green + + * ffi.c, sysv.S, objects.mak: Created. + (ffi_prep_cif): cif->rvalue no longer initialized to NULL. + (ffi_prep_cif_machdep): Moved machine independent cif processing + to src/prep_cif.c. Introduced ffi_prep_cif_machdep(). + +--- libffi/src/mips ------------------------------------------------------- + +Tue Feb 17 17:18:07 1998 Anthony Green + + * o32.S: Fixed typo in comment. + + * ffi.c (ffi_prep_cif_machdep): Fixed argument processing. + +Thu May 8 16:53:58 1997 Anthony Green + + * o32.s, n32.s: Wrappers for SGI tool support. + + * objects.mak: Removed. + +Tue Oct 29 14:37:45 1996 Anthony Green + + * ffi.c (ffi_prep_args): Changed int z to size_t z. + +Tue Oct 15 13:17:25 1996 Anthony Green + + * n32.S: Fixed bad stack munging. + + * ffi.c: Moved prototypes for ffi_call_?32() to here from + ffi_mips.h because extended_cif is not defined in ffi_mips.h. + +Mon Oct 14 12:42:02 1996 Anthony Green + + * ffi.c: Interface changes based on feedback from Jim Blandy. + +Thu Oct 10 11:22:16 1996 Anthony Green + + * n32.S, ffi.c: Lots of changes to support passing and + returning structures with the n32 calling convention. + + * n32.S: Fixed fn pointer bug. + + * ffi.c (ffi_prep_cif_machdep): Fix for o32 structure + return values. + (ffi_prep_args): Fixed n32 structure passing when structures + partially fit in registers. + +Wed Oct 9 13:49:25 1996 Anthony Green + + * objects.mak: Added n32.o. + + * n32.S: Created. + + * ffi.c (ffi_prep_args): Added magic to support proper + n32 processing. + +Tue Oct 8 10:37:35 1996 Anthony Green + + * ffi.c: Moved ffi_type definitions to types.c. + (ffi_prep_args): Fixed type promotion bug. + + * o32.S: This code is only built for o32 compiles. + A lot of the #define cruft has moved to ffi_mips.h. + + * ffi.c (ffi_prep_cif_machdep): Fixed arg flags. Second arg + is only processed if the first is either a float or double. + +Mon Oct 7 15:33:59 1996 Anthony Green + + * o32.S: Modified to compile under each of o32, n32 and n64. + + * ffi.c (FFI_*_TYPEDEF): Removed redundant ';' + +Fri Oct 4 09:53:25 1996 Anthony Green + + * ffi.c (ffi_call): Removed FFI_ABI arg, and swapped + remaining args. + +Wed Oct 2 17:41:22 1996 Anthony Green + + * o32.S: Removed crufty definitions. + +Wed Oct 2 12:53:42 1996 Anthony Green + + * ffi.c (ffi_prep_cif): cif->rvalue no longer initialized to NULL. + (ffi_prep_cif_machdep): Moved all machine independent cif processing + to src/prep_cif.c. Introduced ffi_prep_cif_machdep. Return types + of FFI_TYPE_STRUCT are no different than FFI_TYPE_INT. + +Tue Oct 1 17:11:02 1996 Anthony Green + + * ffi.c, o32.S, object.mak: Created + +--- libffi/src/sparc ------------------------------------------------------ + +Tue Feb 24 16:33:18 1998 Anthony Green + + * ffi.c (ffi_prep_args): Added long double support. + +Thu May 8 16:53:58 1997 Anthony Green + + * objects.mak: Removed. + +Thu May 1 16:07:56 1997 Anthony Green + + * v8.S: Fixed minor portability problem reported by + Russ McManus . + +Tue Nov 26 14:12:43 1996 Anthony Green + + * v8.S: Used STACKFRAME define elsewhere. + + * ffi.c (ffi_prep_args): Zero out space when USING_PURIFY + is set. + (ffi_prep_cif_machdep): Allocate the correct stack frame + space for functions with < 6 args. + +Tue Oct 29 15:08:55 1996 Anthony Green + + * ffi.c (ffi_prep_args): int z is now size_t z. + +Mon Oct 14 13:31:24 1996 Anthony Green + + * v8.S (ffi_call_V8): Gordon rewrites this again. It looks + great now. + + * ffi.c (ffi_call): The comment about hijacked registers + is no longer valid after gordoni hacked v8.S. + + * v8.S (ffi_call_V8): Rewrote with gordoni. Much simpler. + + * v8.S, ffi.c: ffi_call() had changed to accept more than + two args, so v8.S had to change (because it hijacks incoming + arg registers). + + * ffi.c: Interface changes based on feedback from Jim Blandy. + +Thu Oct 10 17:48:16 1996 Anthony Green + + * ffi.c, v8.S, objects.mak: Created. + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/LICENSE b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/LICENSE new file mode 100644 index 000000000..7d1266643 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/LICENSE @@ -0,0 +1,21 @@ +libffi - Copyright (c) 1996-2011 Anthony Green, Red Hat, Inc and others. +See source files for details. + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +``Software''), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/Makefile.am b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/Makefile.am new file mode 100644 index 000000000..86119d8a9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/Makefile.am @@ -0,0 +1,196 @@ +## Process this with automake to create Makefile.in + +AUTOMAKE_OPTIONS = foreign subdir-objects + +SUBDIRS = include testsuite man + +EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ + src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \ + src/arm/ffi.c src/arm/sysv.S src/arm/trampoline.S \ + src/arm/ffitarget.h src/avr32/ffi.c src/avr32/sysv.S \ + src/avr32/ffitarget.h src/cris/ffi.c src/cris/sysv.S \ + src/cris/ffitarget.h src/ia64/ffi.c src/ia64/ffitarget.h \ + src/ia64/ia64_flags.h src/ia64/unix.S src/mips/ffi.c \ + src/mips/n32.S src/mips/o32.S src/mips/ffitarget.h \ + src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \ + src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \ + src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/linux64.S \ + src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S \ + src/powerpc/asm.h src/powerpc/aix.S src/powerpc/darwin.S \ + src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ + src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ + src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ + src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c \ + src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S \ + src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c \ + src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S \ + src/x86/win32.S src/x86/win64.S src/x86/darwin.S \ + src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S \ + src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c \ + src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/frv/eabi.S \ + src/frv/ffitarget.h src/dlmalloc.c src/moxie/ffi.c \ + src/moxie/eabi.S libtool-version ChangeLog.libffi \ + m4/libtool.m4 m4/lt~obsolete.m4 m4/ltoptions.m4 m4/ltsugar.m4 \ + m4/ltversion.m4 build-ios.sh src/arm/gentramp.sh src/debug.c \ + msvcc.sh + + +info_TEXINFOS = doc/libffi.texi + +## ################################################################ + +## +## This section is for make and multilib madness. +## + +# Work around what appears to be a GNU make bug handling MAKEFLAGS +# values defined in terms of make variables, as is the case for CC and +# friends when we are called from the top level Makefile. +AM_MAKEFLAGS = \ + "AR_FLAGS=$(AR_FLAGS)" \ + "CC_FOR_BUILD=$(CC_FOR_BUILD)" \ + "CFLAGS=$(CFLAGS)" \ + "CXXFLAGS=$(CXXFLAGS)" \ + "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \ + "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \ + "INSTALL=$(INSTALL)" \ + "INSTALL_DATA=$(INSTALL_DATA)" \ + "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ + "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \ + "JC1FLAGS=$(JC1FLAGS)" \ + "LDFLAGS=$(LDFLAGS)" \ + "LIBCFLAGS=$(LIBCFLAGS)" \ + "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \ + "MAKE=$(MAKE)" \ + "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \ + "PICFLAG=$(PICFLAG)" \ + "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \ + "RUNTESTFLAGS=$(RUNTESTFLAGS)" \ + "SHELL=$(SHELL)" \ + "exec_prefix=$(exec_prefix)" \ + "infodir=$(infodir)" \ + "libdir=$(libdir)" \ + "mandir=$(mandir)" \ + "prefix=$(prefix)" \ + "AR=$(AR)" \ + "AS=$(AS)" \ + "CC=$(CC)" \ + "CXX=$(CXX)" \ + "LD=$(LD)" \ + "NM=$(NM)" \ + "RANLIB=$(RANLIB)" \ + "DESTDIR=$(DESTDIR)" + +MAKEOVERRIDES= + +ACLOCAL_AMFLAGS=$(ACLOCAL_AMFLAGS) -I m4 + +lib_LTLIBRARIES = libffi.la +noinst_LTLIBRARIES = libffi_convenience.la + +libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c \ + src/raw_api.c src/java_raw_api.c src/closures.c + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libffi.pc + +nodist_libffi_la_SOURCES = + +if MIPS +nodist_libffi_la_SOURCES += src/mips/ffi.c src/mips/o32.S src/mips/n32.S +endif +if X86 +nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/sysv.S +endif +if X86_FREEBSD +nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/freebsd.S +endif +if X86_WIN32 +nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/win32.S +endif +if X86_WIN64 +nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/win64.S +endif +if X86_DARWIN +nodist_libffi_la_SOURCES += src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S +endif +if SPARC +nodist_libffi_la_SOURCES += src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S +endif +if ALPHA +nodist_libffi_la_SOURCES += src/alpha/ffi.c src/alpha/osf.S +endif +if IA64 +nodist_libffi_la_SOURCES += src/ia64/ffi.c src/ia64/unix.S +endif +if M32R +nodist_libffi_la_SOURCES += src/m32r/sysv.S src/m32r/ffi.c +endif +if M68K +nodist_libffi_la_SOURCES += src/m68k/ffi.c src/m68k/sysv.S +endif +if POWERPC +nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S +endif +if POWERPC_AIX +nodist_libffi_la_SOURCES += src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S +endif +if POWERPC_DARWIN +nodist_libffi_la_SOURCES += src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S +endif +if POWERPC_FREEBSD +nodist_libffi_la_SOURCES += src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S +endif +if ARM +nodist_libffi_la_SOURCES += src/arm/sysv.S src/arm/ffi.c +if FFI_EXEC_TRAMPOLINE_TABLE +nodist_libffi_la_SOURCES += src/arm/trampoline.S +endif +endif +if AVR32 +nodist_libffi_la_SOURCES += src/avr32/sysv.S src/avr32/ffi.c +endif +if LIBFFI_CRIS +nodist_libffi_la_SOURCES += src/cris/sysv.S src/cris/ffi.c +endif +if FRV +nodist_libffi_la_SOURCES += src/frv/eabi.S src/frv/ffi.c +endif +if S390 +nodist_libffi_la_SOURCES += src/s390/sysv.S src/s390/ffi.c +endif +if X86_64 +nodist_libffi_la_SOURCES += src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S +endif +if SH +nodist_libffi_la_SOURCES += src/sh/sysv.S src/sh/ffi.c +endif +if SH64 +nodist_libffi_la_SOURCES += src/sh64/sysv.S src/sh64/ffi.c +endif +if PA_LINUX +nodist_libffi_la_SOURCES += src/pa/linux.S src/pa/ffi.c +endif +if PA_HPUX +nodist_libffi_la_SOURCES += src/pa/hpux32.S src/pa/ffi.c +endif + +libffi_convenience_la_SOURCES = $(libffi_la_SOURCES) +nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES) + +AM_CFLAGS = -g +if FFI_DEBUG +# Build debug. Define FFI_DEBUG on the commandline so that, when building with +# MSVC, it can link against the debug CRT. +AM_CFLAGS += -DFFI_DEBUG +endif + +libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) + +AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src +AM_CCASFLAGS = $(AM_CPPFLAGS) + +# No install-html or install-pdf support in automake yet +.PHONY: install-html install-pdf +install-html: +install-pdf: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/Makefile.in b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/Makefile.in new file mode 100644 index 000000000..cbe1589da --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/Makefile.in @@ -0,0 +1,1820 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +@MIPS_TRUE@am__append_1 = src/mips/ffi.c src/mips/o32.S src/mips/n32.S +@X86_TRUE@am__append_2 = src/x86/ffi.c src/x86/sysv.S +@X86_FREEBSD_TRUE@am__append_3 = src/x86/ffi.c src/x86/freebsd.S +@X86_WIN32_TRUE@am__append_4 = src/x86/ffi.c src/x86/win32.S +@X86_WIN64_TRUE@am__append_5 = src/x86/ffi.c src/x86/win64.S +@X86_DARWIN_TRUE@am__append_6 = src/x86/ffi.c src/x86/darwin.S src/x86/ffi64.c src/x86/darwin64.S +@SPARC_TRUE@am__append_7 = src/sparc/ffi.c src/sparc/v8.S src/sparc/v9.S +@ALPHA_TRUE@am__append_8 = src/alpha/ffi.c src/alpha/osf.S +@IA64_TRUE@am__append_9 = src/ia64/ffi.c src/ia64/unix.S +@M32R_TRUE@am__append_10 = src/m32r/sysv.S src/m32r/ffi.c +@M68K_TRUE@am__append_11 = src/m68k/ffi.c src/m68k/sysv.S +@POWERPC_TRUE@am__append_12 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S src/powerpc/linux64.S src/powerpc/linux64_closure.S +@POWERPC_AIX_TRUE@am__append_13 = src/powerpc/ffi_darwin.c src/powerpc/aix.S src/powerpc/aix_closure.S +@POWERPC_DARWIN_TRUE@am__append_14 = src/powerpc/ffi_darwin.c src/powerpc/darwin.S src/powerpc/darwin_closure.S +@POWERPC_FREEBSD_TRUE@am__append_15 = src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/ppc_closure.S +@ARM_TRUE@am__append_16 = src/arm/sysv.S src/arm/ffi.c +@ARM_TRUE@@FFI_EXEC_TRAMPOLINE_TABLE_TRUE@am__append_17 = src/arm/trampoline.S +@AVR32_TRUE@am__append_18 = src/avr32/sysv.S src/avr32/ffi.c +@LIBFFI_CRIS_TRUE@am__append_19 = src/cris/sysv.S src/cris/ffi.c +@FRV_TRUE@am__append_20 = src/frv/eabi.S src/frv/ffi.c +@S390_TRUE@am__append_21 = src/s390/sysv.S src/s390/ffi.c +@X86_64_TRUE@am__append_22 = src/x86/ffi64.c src/x86/unix64.S src/x86/ffi.c src/x86/sysv.S +@SH_TRUE@am__append_23 = src/sh/sysv.S src/sh/ffi.c +@SH64_TRUE@am__append_24 = src/sh64/sysv.S src/sh64/ffi.c +@PA_LINUX_TRUE@am__append_25 = src/pa/linux.S src/pa/ffi.c +@PA_HPUX_TRUE@am__append_26 = src/pa/hpux32.S src/pa/ffi.c +# Build debug. Define FFI_DEBUG on the commandline so that, when building with +# MSVC, it can link against the debug CRT. +@FFI_DEBUG_TRUE@am__append_27 = -DFFI_DEBUG +subdir = . +DIST_COMMON = README $(am__configure_deps) $(srcdir)/Makefile.am \ + $(srcdir)/Makefile.in $(srcdir)/doc/stamp-vti \ + $(srcdir)/doc/version.texi $(srcdir)/fficonfig.h.in \ + $(srcdir)/libffi.pc.in $(top_srcdir)/configure ChangeLog \ + compile config.guess config.sub depcomp install-sh ltmain.sh \ + mdate-sh missing texinfo.tex +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cc_maxopt.m4 \ + $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ + $(top_srcdir)/m4/ax_check_compiler_flags.m4 \ + $(top_srcdir)/m4/ax_compiler_vendor.m4 \ + $(top_srcdir)/m4/ax_configure_args.m4 \ + $(top_srcdir)/m4/ax_enable_builddir.m4 \ + $(top_srcdir)/m4/ax_gcc_archflag.m4 \ + $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \ + configure.lineno config.status.lineno +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = fficonfig.h +CONFIG_CLEAN_FILES = libffi.pc +CONFIG_CLEAN_VPATH_FILES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(infodir)" \ + "$(DESTDIR)$(pkgconfigdir)" +LTLIBRARIES = $(lib_LTLIBRARIES) $(noinst_LTLIBRARIES) +libffi_la_LIBADD = +am__dirstamp = $(am__leading_dot)dirstamp +am_libffi_la_OBJECTS = src/debug.lo src/prep_cif.lo src/types.lo \ + src/raw_api.lo src/java_raw_api.lo src/closures.lo +@MIPS_TRUE@am__objects_1 = src/mips/ffi.lo src/mips/o32.lo \ +@MIPS_TRUE@ src/mips/n32.lo +@X86_TRUE@am__objects_2 = src/x86/ffi.lo src/x86/sysv.lo +@X86_FREEBSD_TRUE@am__objects_3 = src/x86/ffi.lo src/x86/freebsd.lo +@X86_WIN32_TRUE@am__objects_4 = src/x86/ffi.lo src/x86/win32.lo +@X86_WIN64_TRUE@am__objects_5 = src/x86/ffi.lo src/x86/win64.lo +@X86_DARWIN_TRUE@am__objects_6 = src/x86/ffi.lo src/x86/darwin.lo \ +@X86_DARWIN_TRUE@ src/x86/ffi64.lo src/x86/darwin64.lo +@SPARC_TRUE@am__objects_7 = src/sparc/ffi.lo src/sparc/v8.lo \ +@SPARC_TRUE@ src/sparc/v9.lo +@ALPHA_TRUE@am__objects_8 = src/alpha/ffi.lo src/alpha/osf.lo +@IA64_TRUE@am__objects_9 = src/ia64/ffi.lo src/ia64/unix.lo +@M32R_TRUE@am__objects_10 = src/m32r/sysv.lo src/m32r/ffi.lo +@M68K_TRUE@am__objects_11 = src/m68k/ffi.lo src/m68k/sysv.lo +@POWERPC_TRUE@am__objects_12 = src/powerpc/ffi.lo src/powerpc/sysv.lo \ +@POWERPC_TRUE@ src/powerpc/ppc_closure.lo \ +@POWERPC_TRUE@ src/powerpc/linux64.lo \ +@POWERPC_TRUE@ src/powerpc/linux64_closure.lo +@POWERPC_AIX_TRUE@am__objects_13 = src/powerpc/ffi_darwin.lo \ +@POWERPC_AIX_TRUE@ src/powerpc/aix.lo \ +@POWERPC_AIX_TRUE@ src/powerpc/aix_closure.lo +@POWERPC_DARWIN_TRUE@am__objects_14 = src/powerpc/ffi_darwin.lo \ +@POWERPC_DARWIN_TRUE@ src/powerpc/darwin.lo \ +@POWERPC_DARWIN_TRUE@ src/powerpc/darwin_closure.lo +@POWERPC_FREEBSD_TRUE@am__objects_15 = src/powerpc/ffi.lo \ +@POWERPC_FREEBSD_TRUE@ src/powerpc/sysv.lo \ +@POWERPC_FREEBSD_TRUE@ src/powerpc/ppc_closure.lo +@ARM_TRUE@am__objects_16 = src/arm/sysv.lo src/arm/ffi.lo +@ARM_TRUE@@FFI_EXEC_TRAMPOLINE_TABLE_TRUE@am__objects_17 = src/arm/trampoline.lo +@AVR32_TRUE@am__objects_18 = src/avr32/sysv.lo src/avr32/ffi.lo +@LIBFFI_CRIS_TRUE@am__objects_19 = src/cris/sysv.lo src/cris/ffi.lo +@FRV_TRUE@am__objects_20 = src/frv/eabi.lo src/frv/ffi.lo +@S390_TRUE@am__objects_21 = src/s390/sysv.lo src/s390/ffi.lo +@X86_64_TRUE@am__objects_22 = src/x86/ffi64.lo src/x86/unix64.lo \ +@X86_64_TRUE@ src/x86/ffi.lo src/x86/sysv.lo +@SH_TRUE@am__objects_23 = src/sh/sysv.lo src/sh/ffi.lo +@SH64_TRUE@am__objects_24 = src/sh64/sysv.lo src/sh64/ffi.lo +@PA_LINUX_TRUE@am__objects_25 = src/pa/linux.lo src/pa/ffi.lo +@PA_HPUX_TRUE@am__objects_26 = src/pa/hpux32.lo src/pa/ffi.lo +nodist_libffi_la_OBJECTS = $(am__objects_1) $(am__objects_2) \ + $(am__objects_3) $(am__objects_4) $(am__objects_5) \ + $(am__objects_6) $(am__objects_7) $(am__objects_8) \ + $(am__objects_9) $(am__objects_10) $(am__objects_11) \ + $(am__objects_12) $(am__objects_13) $(am__objects_14) \ + $(am__objects_15) $(am__objects_16) $(am__objects_17) \ + $(am__objects_18) $(am__objects_19) $(am__objects_20) \ + $(am__objects_21) $(am__objects_22) $(am__objects_23) \ + $(am__objects_24) $(am__objects_25) $(am__objects_26) +libffi_la_OBJECTS = $(am_libffi_la_OBJECTS) \ + $(nodist_libffi_la_OBJECTS) +libffi_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(libffi_la_LDFLAGS) $(LDFLAGS) -o $@ +libffi_convenience_la_LIBADD = +am__objects_27 = src/debug.lo src/prep_cif.lo src/types.lo \ + src/raw_api.lo src/java_raw_api.lo src/closures.lo +am_libffi_convenience_la_OBJECTS = $(am__objects_27) +am__objects_28 = $(am__objects_1) $(am__objects_2) $(am__objects_3) \ + $(am__objects_4) $(am__objects_5) $(am__objects_6) \ + $(am__objects_7) $(am__objects_8) $(am__objects_9) \ + $(am__objects_10) $(am__objects_11) $(am__objects_12) \ + $(am__objects_13) $(am__objects_14) $(am__objects_15) \ + $(am__objects_16) $(am__objects_17) $(am__objects_18) \ + $(am__objects_19) $(am__objects_20) $(am__objects_21) \ + $(am__objects_22) $(am__objects_23) $(am__objects_24) \ + $(am__objects_25) $(am__objects_26) +nodist_libffi_convenience_la_OBJECTS = $(am__objects_28) +libffi_convenience_la_OBJECTS = $(am_libffi_convenience_la_OBJECTS) \ + $(nodist_libffi_convenience_la_OBJECTS) +DEFAULT_INCLUDES = -I.@am__isrc@ +depcomp = $(SHELL) $(top_srcdir)/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +CPPASCOMPILE = $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) +LTCPPASCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CCAS) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CCASFLAGS) $(CCASFLAGS) +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \ + $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +CCLD = $(CC) +LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \ + --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \ + $(LDFLAGS) -o $@ +SOURCES = $(libffi_la_SOURCES) $(nodist_libffi_la_SOURCES) \ + $(libffi_convenience_la_SOURCES) \ + $(nodist_libffi_convenience_la_SOURCES) +DIST_SOURCES = $(libffi_la_SOURCES) $(libffi_convenience_la_SOURCES) +INFO_DEPS = $(srcdir)/doc/libffi.info +am__TEXINFO_TEX_DIR = $(srcdir) +DVIS = doc/libffi.dvi +PDFS = doc/libffi.pdf +PSS = doc/libffi.ps +HTMLS = doc/libffi.html +TEXINFOS = doc/libffi.texi +TEXI2DVI = texi2dvi +TEXI2PDF = $(TEXI2DVI) --pdf --batch +MAKEINFOHTML = $(MAKEINFO) --html +AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS) +DVIPS = dvips +RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \ + html-recursive info-recursive install-data-recursive \ + install-dvi-recursive install-exec-recursive \ + install-html-recursive install-info-recursive \ + install-pdf-recursive install-ps-recursive install-recursive \ + installcheck-recursive installdirs-recursive pdf-recursive \ + ps-recursive uninstall-recursive +DATA = $(pkgconfig_DATA) +RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \ + distclean-recursive maintainer-clean-recursive +AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \ + $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \ + distdir dist dist-all distcheck +ETAGS = etags +CTAGS = ctags +DIST_SUBDIRS = $(SUBDIRS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +distdir = $(PACKAGE)-$(VERSION) +top_distdir = $(distdir) +am__remove_distdir = \ + { test ! -d "$(distdir)" \ + || { find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \ + && rm -fr "$(distdir)"; }; } +am__relativize = \ + dir0=`pwd`; \ + sed_first='s,^\([^/]*\)/.*$$,\1,'; \ + sed_rest='s,^[^/]*/*,,'; \ + sed_last='s,^.*/\([^/]*\)$$,\1,'; \ + sed_butlast='s,/*[^/]*$$,,'; \ + while test -n "$$dir1"; do \ + first=`echo "$$dir1" | sed -e "$$sed_first"`; \ + if test "$$first" != "."; then \ + if test "$$first" = ".."; then \ + dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \ + dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \ + else \ + first2=`echo "$$dir2" | sed -e "$$sed_first"`; \ + if test "$$first2" = "$$first"; then \ + dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \ + else \ + dir2="../$$dir2"; \ + fi; \ + dir0="$$dir0"/"$$first"; \ + fi; \ + fi; \ + dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \ + done; \ + reldir="$$dir2" +DIST_ARCHIVES = $(distdir).tar.gz +GZIP_ENV = --best +distuninstallcheck_listfiles = find . -type f -print +distcleancheck_listfiles = find . -type f -print +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_LTLDFLAGS = @AM_LTLDFLAGS@ +AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PRTDIAG = @PRTDIAG@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TARGET = @TARGET@ +TARGETDIR = @TARGETDIR@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_enable_builddir_sed = @ax_enable_builddir_sed@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sys_symbol_underscore = @sys_symbol_underscore@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +toolexecdir = @toolexecdir@ +toolexeclibdir = @toolexeclibdir@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = foreign subdir-objects +SUBDIRS = include testsuite man +EXTRA_DIST = LICENSE ChangeLog.v1 ChangeLog.libgcj configure.host \ + src/alpha/ffi.c src/alpha/osf.S src/alpha/ffitarget.h \ + src/arm/ffi.c src/arm/sysv.S src/arm/trampoline.S \ + src/arm/ffitarget.h src/avr32/ffi.c src/avr32/sysv.S \ + src/avr32/ffitarget.h src/cris/ffi.c src/cris/sysv.S \ + src/cris/ffitarget.h src/ia64/ffi.c src/ia64/ffitarget.h \ + src/ia64/ia64_flags.h src/ia64/unix.S src/mips/ffi.c \ + src/mips/n32.S src/mips/o32.S src/mips/ffitarget.h \ + src/m32r/ffi.c src/m32r/sysv.S src/m32r/ffitarget.h \ + src/m68k/ffi.c src/m68k/sysv.S src/m68k/ffitarget.h \ + src/powerpc/ffi.c src/powerpc/sysv.S src/powerpc/linux64.S \ + src/powerpc/linux64_closure.S src/powerpc/ppc_closure.S \ + src/powerpc/asm.h src/powerpc/aix.S src/powerpc/darwin.S \ + src/powerpc/aix_closure.S src/powerpc/darwin_closure.S \ + src/powerpc/ffi_darwin.c src/powerpc/ffitarget.h \ + src/s390/ffi.c src/s390/sysv.S src/s390/ffitarget.h \ + src/sh/ffi.c src/sh/sysv.S src/sh/ffitarget.h src/sh64/ffi.c \ + src/sh64/sysv.S src/sh64/ffitarget.h src/sparc/v8.S \ + src/sparc/v9.S src/sparc/ffitarget.h src/sparc/ffi.c \ + src/x86/darwin64.S src/x86/ffi.c src/x86/sysv.S \ + src/x86/win32.S src/x86/win64.S src/x86/darwin.S \ + src/x86/freebsd.S src/x86/ffi64.c src/x86/unix64.S \ + src/x86/ffitarget.h src/pa/ffitarget.h src/pa/ffi.c \ + src/pa/linux.S src/pa/hpux32.S src/frv/ffi.c src/frv/eabi.S \ + src/frv/ffitarget.h src/dlmalloc.c src/moxie/ffi.c \ + src/moxie/eabi.S libtool-version ChangeLog.libffi \ + m4/libtool.m4 m4/lt~obsolete.m4 m4/ltoptions.m4 m4/ltsugar.m4 \ + m4/ltversion.m4 build-ios.sh src/arm/gentramp.sh src/debug.c \ + msvcc.sh + +info_TEXINFOS = doc/libffi.texi + +# Work around what appears to be a GNU make bug handling MAKEFLAGS +# values defined in terms of make variables, as is the case for CC and +# friends when we are called from the top level Makefile. +AM_MAKEFLAGS = \ + "AR_FLAGS=$(AR_FLAGS)" \ + "CC_FOR_BUILD=$(CC_FOR_BUILD)" \ + "CFLAGS=$(CFLAGS)" \ + "CXXFLAGS=$(CXXFLAGS)" \ + "CFLAGS_FOR_BUILD=$(CFLAGS_FOR_BUILD)" \ + "CFLAGS_FOR_TARGET=$(CFLAGS_FOR_TARGET)" \ + "INSTALL=$(INSTALL)" \ + "INSTALL_DATA=$(INSTALL_DATA)" \ + "INSTALL_PROGRAM=$(INSTALL_PROGRAM)" \ + "INSTALL_SCRIPT=$(INSTALL_SCRIPT)" \ + "JC1FLAGS=$(JC1FLAGS)" \ + "LDFLAGS=$(LDFLAGS)" \ + "LIBCFLAGS=$(LIBCFLAGS)" \ + "LIBCFLAGS_FOR_TARGET=$(LIBCFLAGS_FOR_TARGET)" \ + "MAKE=$(MAKE)" \ + "MAKEINFO=$(MAKEINFO) $(MAKEINFOFLAGS)" \ + "PICFLAG=$(PICFLAG)" \ + "PICFLAG_FOR_TARGET=$(PICFLAG_FOR_TARGET)" \ + "RUNTESTFLAGS=$(RUNTESTFLAGS)" \ + "SHELL=$(SHELL)" \ + "exec_prefix=$(exec_prefix)" \ + "infodir=$(infodir)" \ + "libdir=$(libdir)" \ + "mandir=$(mandir)" \ + "prefix=$(prefix)" \ + "AR=$(AR)" \ + "AS=$(AS)" \ + "CC=$(CC)" \ + "CXX=$(CXX)" \ + "LD=$(LD)" \ + "NM=$(NM)" \ + "RANLIB=$(RANLIB)" \ + "DESTDIR=$(DESTDIR)" + +MAKEOVERRIDES = +ACLOCAL_AMFLAGS = $(ACLOCAL_AMFLAGS) -I m4 +lib_LTLIBRARIES = libffi.la +noinst_LTLIBRARIES = libffi_convenience.la +libffi_la_SOURCES = src/debug.c src/prep_cif.c src/types.c \ + src/raw_api.c src/java_raw_api.c src/closures.c + +pkgconfigdir = $(libdir)/pkgconfig +pkgconfig_DATA = libffi.pc +nodist_libffi_la_SOURCES = $(am__append_1) $(am__append_2) \ + $(am__append_3) $(am__append_4) $(am__append_5) \ + $(am__append_6) $(am__append_7) $(am__append_8) \ + $(am__append_9) $(am__append_10) $(am__append_11) \ + $(am__append_12) $(am__append_13) $(am__append_14) \ + $(am__append_15) $(am__append_16) $(am__append_17) \ + $(am__append_18) $(am__append_19) $(am__append_20) \ + $(am__append_21) $(am__append_22) $(am__append_23) \ + $(am__append_24) $(am__append_25) $(am__append_26) +libffi_convenience_la_SOURCES = $(libffi_la_SOURCES) +nodist_libffi_convenience_la_SOURCES = $(nodist_libffi_la_SOURCES) +AM_CFLAGS = -g $(am__append_27) +libffi_la_LDFLAGS = -version-info `grep -v '^\#' $(srcdir)/libtool-version` $(LTLDFLAGS) $(AM_LTLDFLAGS) +AM_CPPFLAGS = -I. -I$(top_srcdir)/include -Iinclude -I$(top_srcdir)/src +AM_CCASFLAGS = $(AM_CPPFLAGS) +all: fficonfig.h + $(MAKE) $(AM_MAKEFLAGS) all-recursive + +.SUFFIXES: +.SUFFIXES: .S .c .dvi .lo .o .obj .ps +am--refresh: + @: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + echo ' cd $(srcdir) && $(AUTOMAKE) --foreign'; \ + $(am__cd) $(srcdir) && $(AUTOMAKE) --foreign \ + && exit 0; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + echo ' $(SHELL) ./config.status'; \ + $(SHELL) ./config.status;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + $(SHELL) ./config.status --recheck + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + $(am__cd) $(srcdir) && $(AUTOCONF) +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS) +$(am__aclocal_m4_deps): + +fficonfig.h: stamp-h1 + @if test ! -f $@; then \ + rm -f stamp-h1; \ + $(MAKE) $(AM_MAKEFLAGS) stamp-h1; \ + else :; fi + +stamp-h1: $(srcdir)/fficonfig.h.in $(top_builddir)/config.status + @rm -f stamp-h1 + cd $(top_builddir) && $(SHELL) ./config.status fficonfig.h +$(srcdir)/fficonfig.h.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + ($(am__cd) $(top_srcdir) && $(AUTOHEADER)) + rm -f stamp-h1 + touch $@ + +distclean-hdr: + -rm -f fficonfig.h stamp-h1 +libffi.pc: $(top_builddir)/config.status $(srcdir)/libffi.pc.in + cd $(top_builddir) && $(SHELL) ./config.status $@ +install-libLTLIBRARIES: $(lib_LTLIBRARIES) + @$(NORMAL_INSTALL) + test -z "$(libdir)" || $(MKDIR_P) "$(DESTDIR)$(libdir)" + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + list2=; for p in $$list; do \ + if test -f $$p; then \ + list2="$$list2 $$p"; \ + else :; fi; \ + done; \ + test -z "$$list2" || { \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \ + } + +uninstall-libLTLIBRARIES: + @$(NORMAL_UNINSTALL) + @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \ + $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \ + done + +clean-libLTLIBRARIES: + -test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES) + @list='$(lib_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done + +clean-noinstLTLIBRARIES: + -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES) + @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \ + dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \ + test "$$dir" != "$$p" || dir=.; \ + echo "rm -f \"$${dir}/so_locations\""; \ + rm -f "$${dir}/so_locations"; \ + done +src/$(am__dirstamp): + @$(MKDIR_P) src + @: > src/$(am__dirstamp) +src/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/$(DEPDIR) + @: > src/$(DEPDIR)/$(am__dirstamp) +src/debug.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) +src/prep_cif.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) +src/types.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) +src/raw_api.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) +src/java_raw_api.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) +src/closures.lo: src/$(am__dirstamp) src/$(DEPDIR)/$(am__dirstamp) +src/mips/$(am__dirstamp): + @$(MKDIR_P) src/mips + @: > src/mips/$(am__dirstamp) +src/mips/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/mips/$(DEPDIR) + @: > src/mips/$(DEPDIR)/$(am__dirstamp) +src/mips/ffi.lo: src/mips/$(am__dirstamp) \ + src/mips/$(DEPDIR)/$(am__dirstamp) +src/mips/o32.lo: src/mips/$(am__dirstamp) \ + src/mips/$(DEPDIR)/$(am__dirstamp) +src/mips/n32.lo: src/mips/$(am__dirstamp) \ + src/mips/$(DEPDIR)/$(am__dirstamp) +src/x86/$(am__dirstamp): + @$(MKDIR_P) src/x86 + @: > src/x86/$(am__dirstamp) +src/x86/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/x86/$(DEPDIR) + @: > src/x86/$(DEPDIR)/$(am__dirstamp) +src/x86/ffi.lo: src/x86/$(am__dirstamp) \ + src/x86/$(DEPDIR)/$(am__dirstamp) +src/x86/sysv.lo: src/x86/$(am__dirstamp) \ + src/x86/$(DEPDIR)/$(am__dirstamp) +src/x86/freebsd.lo: src/x86/$(am__dirstamp) \ + src/x86/$(DEPDIR)/$(am__dirstamp) +src/x86/win32.lo: src/x86/$(am__dirstamp) \ + src/x86/$(DEPDIR)/$(am__dirstamp) +src/x86/win64.lo: src/x86/$(am__dirstamp) \ + src/x86/$(DEPDIR)/$(am__dirstamp) +src/x86/darwin.lo: src/x86/$(am__dirstamp) \ + src/x86/$(DEPDIR)/$(am__dirstamp) +src/x86/ffi64.lo: src/x86/$(am__dirstamp) \ + src/x86/$(DEPDIR)/$(am__dirstamp) +src/x86/darwin64.lo: src/x86/$(am__dirstamp) \ + src/x86/$(DEPDIR)/$(am__dirstamp) +src/sparc/$(am__dirstamp): + @$(MKDIR_P) src/sparc + @: > src/sparc/$(am__dirstamp) +src/sparc/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/sparc/$(DEPDIR) + @: > src/sparc/$(DEPDIR)/$(am__dirstamp) +src/sparc/ffi.lo: src/sparc/$(am__dirstamp) \ + src/sparc/$(DEPDIR)/$(am__dirstamp) +src/sparc/v8.lo: src/sparc/$(am__dirstamp) \ + src/sparc/$(DEPDIR)/$(am__dirstamp) +src/sparc/v9.lo: src/sparc/$(am__dirstamp) \ + src/sparc/$(DEPDIR)/$(am__dirstamp) +src/alpha/$(am__dirstamp): + @$(MKDIR_P) src/alpha + @: > src/alpha/$(am__dirstamp) +src/alpha/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/alpha/$(DEPDIR) + @: > src/alpha/$(DEPDIR)/$(am__dirstamp) +src/alpha/ffi.lo: src/alpha/$(am__dirstamp) \ + src/alpha/$(DEPDIR)/$(am__dirstamp) +src/alpha/osf.lo: src/alpha/$(am__dirstamp) \ + src/alpha/$(DEPDIR)/$(am__dirstamp) +src/ia64/$(am__dirstamp): + @$(MKDIR_P) src/ia64 + @: > src/ia64/$(am__dirstamp) +src/ia64/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/ia64/$(DEPDIR) + @: > src/ia64/$(DEPDIR)/$(am__dirstamp) +src/ia64/ffi.lo: src/ia64/$(am__dirstamp) \ + src/ia64/$(DEPDIR)/$(am__dirstamp) +src/ia64/unix.lo: src/ia64/$(am__dirstamp) \ + src/ia64/$(DEPDIR)/$(am__dirstamp) +src/m32r/$(am__dirstamp): + @$(MKDIR_P) src/m32r + @: > src/m32r/$(am__dirstamp) +src/m32r/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/m32r/$(DEPDIR) + @: > src/m32r/$(DEPDIR)/$(am__dirstamp) +src/m32r/sysv.lo: src/m32r/$(am__dirstamp) \ + src/m32r/$(DEPDIR)/$(am__dirstamp) +src/m32r/ffi.lo: src/m32r/$(am__dirstamp) \ + src/m32r/$(DEPDIR)/$(am__dirstamp) +src/m68k/$(am__dirstamp): + @$(MKDIR_P) src/m68k + @: > src/m68k/$(am__dirstamp) +src/m68k/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/m68k/$(DEPDIR) + @: > src/m68k/$(DEPDIR)/$(am__dirstamp) +src/m68k/ffi.lo: src/m68k/$(am__dirstamp) \ + src/m68k/$(DEPDIR)/$(am__dirstamp) +src/m68k/sysv.lo: src/m68k/$(am__dirstamp) \ + src/m68k/$(DEPDIR)/$(am__dirstamp) +src/powerpc/$(am__dirstamp): + @$(MKDIR_P) src/powerpc + @: > src/powerpc/$(am__dirstamp) +src/powerpc/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/powerpc/$(DEPDIR) + @: > src/powerpc/$(DEPDIR)/$(am__dirstamp) +src/powerpc/ffi.lo: src/powerpc/$(am__dirstamp) \ + src/powerpc/$(DEPDIR)/$(am__dirstamp) +src/powerpc/sysv.lo: src/powerpc/$(am__dirstamp) \ + src/powerpc/$(DEPDIR)/$(am__dirstamp) +src/powerpc/ppc_closure.lo: src/powerpc/$(am__dirstamp) \ + src/powerpc/$(DEPDIR)/$(am__dirstamp) +src/powerpc/linux64.lo: src/powerpc/$(am__dirstamp) \ + src/powerpc/$(DEPDIR)/$(am__dirstamp) +src/powerpc/linux64_closure.lo: src/powerpc/$(am__dirstamp) \ + src/powerpc/$(DEPDIR)/$(am__dirstamp) +src/powerpc/ffi_darwin.lo: src/powerpc/$(am__dirstamp) \ + src/powerpc/$(DEPDIR)/$(am__dirstamp) +src/powerpc/aix.lo: src/powerpc/$(am__dirstamp) \ + src/powerpc/$(DEPDIR)/$(am__dirstamp) +src/powerpc/aix_closure.lo: src/powerpc/$(am__dirstamp) \ + src/powerpc/$(DEPDIR)/$(am__dirstamp) +src/powerpc/darwin.lo: src/powerpc/$(am__dirstamp) \ + src/powerpc/$(DEPDIR)/$(am__dirstamp) +src/powerpc/darwin_closure.lo: src/powerpc/$(am__dirstamp) \ + src/powerpc/$(DEPDIR)/$(am__dirstamp) +src/arm/$(am__dirstamp): + @$(MKDIR_P) src/arm + @: > src/arm/$(am__dirstamp) +src/arm/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/arm/$(DEPDIR) + @: > src/arm/$(DEPDIR)/$(am__dirstamp) +src/arm/sysv.lo: src/arm/$(am__dirstamp) \ + src/arm/$(DEPDIR)/$(am__dirstamp) +src/arm/ffi.lo: src/arm/$(am__dirstamp) \ + src/arm/$(DEPDIR)/$(am__dirstamp) +src/arm/trampoline.lo: src/arm/$(am__dirstamp) \ + src/arm/$(DEPDIR)/$(am__dirstamp) +src/avr32/$(am__dirstamp): + @$(MKDIR_P) src/avr32 + @: > src/avr32/$(am__dirstamp) +src/avr32/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/avr32/$(DEPDIR) + @: > src/avr32/$(DEPDIR)/$(am__dirstamp) +src/avr32/sysv.lo: src/avr32/$(am__dirstamp) \ + src/avr32/$(DEPDIR)/$(am__dirstamp) +src/avr32/ffi.lo: src/avr32/$(am__dirstamp) \ + src/avr32/$(DEPDIR)/$(am__dirstamp) +src/cris/$(am__dirstamp): + @$(MKDIR_P) src/cris + @: > src/cris/$(am__dirstamp) +src/cris/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/cris/$(DEPDIR) + @: > src/cris/$(DEPDIR)/$(am__dirstamp) +src/cris/sysv.lo: src/cris/$(am__dirstamp) \ + src/cris/$(DEPDIR)/$(am__dirstamp) +src/cris/ffi.lo: src/cris/$(am__dirstamp) \ + src/cris/$(DEPDIR)/$(am__dirstamp) +src/frv/$(am__dirstamp): + @$(MKDIR_P) src/frv + @: > src/frv/$(am__dirstamp) +src/frv/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/frv/$(DEPDIR) + @: > src/frv/$(DEPDIR)/$(am__dirstamp) +src/frv/eabi.lo: src/frv/$(am__dirstamp) \ + src/frv/$(DEPDIR)/$(am__dirstamp) +src/frv/ffi.lo: src/frv/$(am__dirstamp) \ + src/frv/$(DEPDIR)/$(am__dirstamp) +src/s390/$(am__dirstamp): + @$(MKDIR_P) src/s390 + @: > src/s390/$(am__dirstamp) +src/s390/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/s390/$(DEPDIR) + @: > src/s390/$(DEPDIR)/$(am__dirstamp) +src/s390/sysv.lo: src/s390/$(am__dirstamp) \ + src/s390/$(DEPDIR)/$(am__dirstamp) +src/s390/ffi.lo: src/s390/$(am__dirstamp) \ + src/s390/$(DEPDIR)/$(am__dirstamp) +src/x86/unix64.lo: src/x86/$(am__dirstamp) \ + src/x86/$(DEPDIR)/$(am__dirstamp) +src/sh/$(am__dirstamp): + @$(MKDIR_P) src/sh + @: > src/sh/$(am__dirstamp) +src/sh/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/sh/$(DEPDIR) + @: > src/sh/$(DEPDIR)/$(am__dirstamp) +src/sh/sysv.lo: src/sh/$(am__dirstamp) \ + src/sh/$(DEPDIR)/$(am__dirstamp) +src/sh/ffi.lo: src/sh/$(am__dirstamp) src/sh/$(DEPDIR)/$(am__dirstamp) +src/sh64/$(am__dirstamp): + @$(MKDIR_P) src/sh64 + @: > src/sh64/$(am__dirstamp) +src/sh64/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/sh64/$(DEPDIR) + @: > src/sh64/$(DEPDIR)/$(am__dirstamp) +src/sh64/sysv.lo: src/sh64/$(am__dirstamp) \ + src/sh64/$(DEPDIR)/$(am__dirstamp) +src/sh64/ffi.lo: src/sh64/$(am__dirstamp) \ + src/sh64/$(DEPDIR)/$(am__dirstamp) +src/pa/$(am__dirstamp): + @$(MKDIR_P) src/pa + @: > src/pa/$(am__dirstamp) +src/pa/$(DEPDIR)/$(am__dirstamp): + @$(MKDIR_P) src/pa/$(DEPDIR) + @: > src/pa/$(DEPDIR)/$(am__dirstamp) +src/pa/linux.lo: src/pa/$(am__dirstamp) \ + src/pa/$(DEPDIR)/$(am__dirstamp) +src/pa/ffi.lo: src/pa/$(am__dirstamp) src/pa/$(DEPDIR)/$(am__dirstamp) +src/pa/hpux32.lo: src/pa/$(am__dirstamp) \ + src/pa/$(DEPDIR)/$(am__dirstamp) +libffi.la: $(libffi_la_OBJECTS) $(libffi_la_DEPENDENCIES) + $(libffi_la_LINK) -rpath $(libdir) $(libffi_la_OBJECTS) $(libffi_la_LIBADD) $(LIBS) +libffi_convenience.la: $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_DEPENDENCIES) + $(LINK) $(libffi_convenience_la_OBJECTS) $(libffi_convenience_la_LIBADD) $(LIBS) + +mostlyclean-compile: + -rm -f *.$(OBJEXT) + -rm -f src/alpha/ffi.$(OBJEXT) + -rm -f src/alpha/ffi.lo + -rm -f src/alpha/osf.$(OBJEXT) + -rm -f src/alpha/osf.lo + -rm -f src/arm/ffi.$(OBJEXT) + -rm -f src/arm/ffi.lo + -rm -f src/arm/sysv.$(OBJEXT) + -rm -f src/arm/sysv.lo + -rm -f src/arm/trampoline.$(OBJEXT) + -rm -f src/arm/trampoline.lo + -rm -f src/avr32/ffi.$(OBJEXT) + -rm -f src/avr32/ffi.lo + -rm -f src/avr32/sysv.$(OBJEXT) + -rm -f src/avr32/sysv.lo + -rm -f src/closures.$(OBJEXT) + -rm -f src/closures.lo + -rm -f src/cris/ffi.$(OBJEXT) + -rm -f src/cris/ffi.lo + -rm -f src/cris/sysv.$(OBJEXT) + -rm -f src/cris/sysv.lo + -rm -f src/debug.$(OBJEXT) + -rm -f src/debug.lo + -rm -f src/frv/eabi.$(OBJEXT) + -rm -f src/frv/eabi.lo + -rm -f src/frv/ffi.$(OBJEXT) + -rm -f src/frv/ffi.lo + -rm -f src/ia64/ffi.$(OBJEXT) + -rm -f src/ia64/ffi.lo + -rm -f src/ia64/unix.$(OBJEXT) + -rm -f src/ia64/unix.lo + -rm -f src/java_raw_api.$(OBJEXT) + -rm -f src/java_raw_api.lo + -rm -f src/m32r/ffi.$(OBJEXT) + -rm -f src/m32r/ffi.lo + -rm -f src/m32r/sysv.$(OBJEXT) + -rm -f src/m32r/sysv.lo + -rm -f src/m68k/ffi.$(OBJEXT) + -rm -f src/m68k/ffi.lo + -rm -f src/m68k/sysv.$(OBJEXT) + -rm -f src/m68k/sysv.lo + -rm -f src/mips/ffi.$(OBJEXT) + -rm -f src/mips/ffi.lo + -rm -f src/mips/n32.$(OBJEXT) + -rm -f src/mips/n32.lo + -rm -f src/mips/o32.$(OBJEXT) + -rm -f src/mips/o32.lo + -rm -f src/pa/ffi.$(OBJEXT) + -rm -f src/pa/ffi.lo + -rm -f src/pa/hpux32.$(OBJEXT) + -rm -f src/pa/hpux32.lo + -rm -f src/pa/linux.$(OBJEXT) + -rm -f src/pa/linux.lo + -rm -f src/powerpc/aix.$(OBJEXT) + -rm -f src/powerpc/aix.lo + -rm -f src/powerpc/aix_closure.$(OBJEXT) + -rm -f src/powerpc/aix_closure.lo + -rm -f src/powerpc/darwin.$(OBJEXT) + -rm -f src/powerpc/darwin.lo + -rm -f src/powerpc/darwin_closure.$(OBJEXT) + -rm -f src/powerpc/darwin_closure.lo + -rm -f src/powerpc/ffi.$(OBJEXT) + -rm -f src/powerpc/ffi.lo + -rm -f src/powerpc/ffi_darwin.$(OBJEXT) + -rm -f src/powerpc/ffi_darwin.lo + -rm -f src/powerpc/linux64.$(OBJEXT) + -rm -f src/powerpc/linux64.lo + -rm -f src/powerpc/linux64_closure.$(OBJEXT) + -rm -f src/powerpc/linux64_closure.lo + -rm -f src/powerpc/ppc_closure.$(OBJEXT) + -rm -f src/powerpc/ppc_closure.lo + -rm -f src/powerpc/sysv.$(OBJEXT) + -rm -f src/powerpc/sysv.lo + -rm -f src/prep_cif.$(OBJEXT) + -rm -f src/prep_cif.lo + -rm -f src/raw_api.$(OBJEXT) + -rm -f src/raw_api.lo + -rm -f src/s390/ffi.$(OBJEXT) + -rm -f src/s390/ffi.lo + -rm -f src/s390/sysv.$(OBJEXT) + -rm -f src/s390/sysv.lo + -rm -f src/sh/ffi.$(OBJEXT) + -rm -f src/sh/ffi.lo + -rm -f src/sh/sysv.$(OBJEXT) + -rm -f src/sh/sysv.lo + -rm -f src/sh64/ffi.$(OBJEXT) + -rm -f src/sh64/ffi.lo + -rm -f src/sh64/sysv.$(OBJEXT) + -rm -f src/sh64/sysv.lo + -rm -f src/sparc/ffi.$(OBJEXT) + -rm -f src/sparc/ffi.lo + -rm -f src/sparc/v8.$(OBJEXT) + -rm -f src/sparc/v8.lo + -rm -f src/sparc/v9.$(OBJEXT) + -rm -f src/sparc/v9.lo + -rm -f src/types.$(OBJEXT) + -rm -f src/types.lo + -rm -f src/x86/darwin.$(OBJEXT) + -rm -f src/x86/darwin.lo + -rm -f src/x86/darwin64.$(OBJEXT) + -rm -f src/x86/darwin64.lo + -rm -f src/x86/ffi.$(OBJEXT) + -rm -f src/x86/ffi.lo + -rm -f src/x86/ffi64.$(OBJEXT) + -rm -f src/x86/ffi64.lo + -rm -f src/x86/freebsd.$(OBJEXT) + -rm -f src/x86/freebsd.lo + -rm -f src/x86/sysv.$(OBJEXT) + -rm -f src/x86/sysv.lo + -rm -f src/x86/unix64.$(OBJEXT) + -rm -f src/x86/unix64.lo + -rm -f src/x86/win32.$(OBJEXT) + -rm -f src/x86/win32.lo + -rm -f src/x86/win64.$(OBJEXT) + -rm -f src/x86/win64.lo + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/closures.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/debug.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/java_raw_api.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/prep_cif.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/raw_api.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/$(DEPDIR)/types.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/alpha/$(DEPDIR)/ffi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/alpha/$(DEPDIR)/osf.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/arm/$(DEPDIR)/ffi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/arm/$(DEPDIR)/sysv.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/arm/$(DEPDIR)/trampoline.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/avr32/$(DEPDIR)/ffi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/avr32/$(DEPDIR)/sysv.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/cris/$(DEPDIR)/ffi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/cris/$(DEPDIR)/sysv.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/frv/$(DEPDIR)/eabi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/frv/$(DEPDIR)/ffi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/ia64/$(DEPDIR)/ffi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/ia64/$(DEPDIR)/unix.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/m32r/$(DEPDIR)/ffi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/m32r/$(DEPDIR)/sysv.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/m68k/$(DEPDIR)/ffi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/m68k/$(DEPDIR)/sysv.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/mips/$(DEPDIR)/ffi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/mips/$(DEPDIR)/n32.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/mips/$(DEPDIR)/o32.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/pa/$(DEPDIR)/ffi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/pa/$(DEPDIR)/hpux32.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/pa/$(DEPDIR)/linux.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/aix.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/aix_closure.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/darwin.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/darwin_closure.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ffi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ffi_darwin.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/linux64.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/linux64_closure.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/ppc_closure.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/powerpc/$(DEPDIR)/sysv.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/s390/$(DEPDIR)/ffi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/s390/$(DEPDIR)/sysv.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/sh/$(DEPDIR)/ffi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/sh/$(DEPDIR)/sysv.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/sh64/$(DEPDIR)/ffi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/sh64/$(DEPDIR)/sysv.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/sparc/$(DEPDIR)/ffi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/sparc/$(DEPDIR)/v8.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/sparc/$(DEPDIR)/v9.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/darwin.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/darwin64.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/ffi.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/ffi64.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/freebsd.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/sysv.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/unix64.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/win32.Plo@am__quote@ +@AMDEP_TRUE@@am__include@ @am__quote@src/x86/$(DEPDIR)/win64.Plo@am__quote@ + +.S.o: +@am__fastdepCCAS_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCCAS_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ $< + +.S.obj: +@am__fastdepCCAS_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCCAS_TRUE@ $(CPPASCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCCAS_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCCAS_FALSE@ $(CPPASCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.S.lo: +@am__fastdepCCAS_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCCAS_TRUE@ $(LTCPPASCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCCAS_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCCAS_FALSE@ DEPDIR=$(DEPDIR) $(CCASDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCCAS_FALSE@ $(LTCPPASCOMPILE) -c -o $@ $< + +.c.o: +@am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs + -rm -rf src/.libs src/_libs + -rm -rf src/alpha/.libs src/alpha/_libs + -rm -rf src/arm/.libs src/arm/_libs + -rm -rf src/avr32/.libs src/avr32/_libs + -rm -rf src/cris/.libs src/cris/_libs + -rm -rf src/frv/.libs src/frv/_libs + -rm -rf src/ia64/.libs src/ia64/_libs + -rm -rf src/m32r/.libs src/m32r/_libs + -rm -rf src/m68k/.libs src/m68k/_libs + -rm -rf src/mips/.libs src/mips/_libs + -rm -rf src/pa/.libs src/pa/_libs + -rm -rf src/powerpc/.libs src/powerpc/_libs + -rm -rf src/s390/.libs src/s390/_libs + -rm -rf src/sh/.libs src/sh/_libs + -rm -rf src/sh64/.libs src/sh64/_libs + -rm -rf src/sparc/.libs src/sparc/_libs + -rm -rf src/x86/.libs src/x86/_libs + +distclean-libtool: + -rm -f libtool config.lt +doc/$(am__dirstamp): + @$(MKDIR_P) doc + @: > doc/$(am__dirstamp) + +$(srcdir)/doc/libffi.info: doc/libffi.texi $(srcdir)/doc/version.texi + restore=: && backupdir="$(am__leading_dot)am$$$$" && \ + am__cwd=`pwd` && $(am__cd) $(srcdir) && \ + rm -rf $$backupdir && mkdir $$backupdir && \ + if ($(MAKEINFO) --version) >/dev/null 2>&1; then \ + for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \ + if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \ + done; \ + else :; fi && \ + cd "$$am__cwd"; \ + if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc \ + -o $@ $(srcdir)/doc/libffi.texi; \ + then \ + rc=0; \ + $(am__cd) $(srcdir); \ + else \ + rc=$$?; \ + $(am__cd) $(srcdir) && \ + $$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \ + fi; \ + rm -rf $$backupdir; exit $$rc + +doc/libffi.dvi: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \ + $(TEXI2DVI) -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi + +doc/libffi.pdf: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc' \ + $(TEXI2PDF) -o $@ `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi + +doc/libffi.html: doc/libffi.texi $(srcdir)/doc/version.texi doc/$(am__dirstamp) + rm -rf $(@:.html=.htp) + if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I doc -I $(srcdir)/doc \ + -o $(@:.html=.htp) `test -f 'doc/libffi.texi' || echo '$(srcdir)/'`doc/libffi.texi; \ + then \ + rm -rf $@; \ + if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ + mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \ + else \ + if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \ + rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \ + exit 1; \ + fi +$(srcdir)/doc/version.texi: @MAINTAINER_MODE_TRUE@ $(srcdir)/doc/stamp-vti +$(srcdir)/doc/stamp-vti: doc/libffi.texi $(top_srcdir)/configure + test -f doc/$(am__dirstamp) || $(MAKE) $(AM_MAKEFLAGS) doc/$(am__dirstamp) + @(dir=.; test -f ./doc/libffi.texi || dir=$(srcdir); \ + set `$(SHELL) $(srcdir)/mdate-sh $$dir/doc/libffi.texi`; \ + echo "@set UPDATED $$1 $$2 $$3"; \ + echo "@set UPDATED-MONTH $$2 $$3"; \ + echo "@set EDITION $(VERSION)"; \ + echo "@set VERSION $(VERSION)") > vti.tmp + @cmp -s vti.tmp $(srcdir)/doc/version.texi \ + || (echo "Updating $(srcdir)/doc/version.texi"; \ + cp vti.tmp $(srcdir)/doc/version.texi) + -@rm -f vti.tmp + @cp $(srcdir)/doc/version.texi $@ + +mostlyclean-vti: + -rm -f vti.tmp + +maintainer-clean-vti: +@MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/doc/stamp-vti $(srcdir)/doc/version.texi +.dvi.ps: + TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \ + $(DVIPS) -o $@ $< + +uninstall-dvi-am: + @$(NORMAL_UNINSTALL) + @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \ + rm -f "$(DESTDIR)$(dvidir)/$$f"; \ + done + +uninstall-html-am: + @$(NORMAL_UNINSTALL) + @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \ + rm -rf "$(DESTDIR)$(htmldir)/$$f"; \ + done + +uninstall-info-am: + @$(PRE_UNINSTALL) + @if test -d '$(DESTDIR)$(infodir)' && \ + (install-info --version && \ + install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ + list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \ + if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \ + then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \ + done; \ + else :; fi + @$(NORMAL_UNINSTALL) + @list='$(INFO_DEPS)'; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \ + (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \ + echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \ + rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \ + else :; fi); \ + done + +uninstall-pdf-am: + @$(NORMAL_UNINSTALL) + @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \ + rm -f "$(DESTDIR)$(pdfdir)/$$f"; \ + done + +uninstall-ps-am: + @$(NORMAL_UNINSTALL) + @list='$(PSS)'; test -n "$(psdir)" || list=; \ + for p in $$list; do \ + $(am__strip_dir) \ + echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \ + rm -f "$(DESTDIR)$(psdir)/$$f"; \ + done + +dist-info: $(INFO_DEPS) + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; \ + for base in $$list; do \ + case $$base in \ + $(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$base; then d=.; else d=$(srcdir); fi; \ + base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \ + for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \ + if test -f $$file; then \ + relfile=`expr "$$file" : "$$d/\(.*\)"`; \ + test -f "$(distdir)/$$relfile" || \ + cp -p $$file "$(distdir)/$$relfile"; \ + else :; fi; \ + done; \ + done + +mostlyclean-aminfo: + -rm -rf libffi.aux libffi.cp libffi.cps libffi.fn libffi.ky libffi.log \ + libffi.pg libffi.tmp libffi.toc libffi.tp libffi.vr + +clean-aminfo: + -test -z "doc/libffi.dvi doc/libffi.pdf doc/libffi.ps doc/libffi.html" \ + || rm -rf doc/libffi.dvi doc/libffi.pdf doc/libffi.ps doc/libffi.html + +maintainer-clean-aminfo: + @list='$(INFO_DEPS)'; for i in $$list; do \ + i_i=`echo "$$i" | sed 's|\.info$$||;s|$$|.i|'`; \ + echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]"; \ + rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \ + done +install-pkgconfigDATA: $(pkgconfig_DATA) + @$(NORMAL_INSTALL) + test -z "$(pkgconfigdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgconfigdir)" + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pkgconfigdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pkgconfigdir)" || exit $$?; \ + done + +uninstall-pkgconfigDATA: + @$(NORMAL_UNINSTALL) + @list='$(pkgconfig_DATA)'; test -n "$(pkgconfigdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(pkgconfigdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(pkgconfigdir)" && rm -f $$files + +# This directory's subdirectories are mostly independent; you can cd +# into them and run `make' without going through this Makefile. +# To change the values of `make' variables: instead of editing Makefiles, +# (1) if the variable is set in `config.status', edit `config.status' +# (which will cause the Makefiles to be regenerated when you run `make'); +# (2) otherwise, pass the desired values on the `make' command line. +$(RECURSIVE_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + target=`echo $@ | sed s/-recursive//`; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + dot_seen=yes; \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done; \ + if test "$$dot_seen" = "no"; then \ + $(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \ + fi; test -z "$$fail" + +$(RECURSIVE_CLEAN_TARGETS): + @fail= failcom='exit 1'; \ + for f in x $$MAKEFLAGS; do \ + case $$f in \ + *=* | --[!k]*);; \ + *k*) failcom='fail=yes';; \ + esac; \ + done; \ + dot_seen=no; \ + case "$@" in \ + distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \ + *) list='$(SUBDIRS)' ;; \ + esac; \ + rev=''; for subdir in $$list; do \ + if test "$$subdir" = "."; then :; else \ + rev="$$subdir $$rev"; \ + fi; \ + done; \ + rev="$$rev ."; \ + target=`echo $@ | sed s/-recursive//`; \ + for subdir in $$rev; do \ + echo "Making $$target in $$subdir"; \ + if test "$$subdir" = "."; then \ + local_target="$$target-am"; \ + else \ + local_target="$$target"; \ + fi; \ + ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \ + || eval $$failcom; \ + done && test -z "$$fail" +tags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \ + done +ctags-recursive: + list='$(SUBDIRS)'; for subdir in $$list; do \ + test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \ + done + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: tags-recursive $(HEADERS) $(SOURCES) fficonfig.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \ + include_option=--etags-include; \ + empty_fix=.; \ + else \ + include_option=--include; \ + empty_fix=; \ + fi; \ + list='$(SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test ! -f $$subdir/TAGS || \ + set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \ + fi; \ + done; \ + list='$(SOURCES) $(HEADERS) fficonfig.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: ctags-recursive $(HEADERS) $(SOURCES) fficonfig.h.in $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) fficonfig.h.in $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + $(am__remove_distdir) + test -d "$(distdir)" || mkdir "$(distdir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + test -d "$(distdir)/$$subdir" \ + || $(MKDIR_P) "$(distdir)/$$subdir" \ + || exit 1; \ + fi; \ + done + @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \ + if test "$$subdir" = .; then :; else \ + dir1=$$subdir; dir2="$(distdir)/$$subdir"; \ + $(am__relativize); \ + new_distdir=$$reldir; \ + dir1=$$subdir; dir2="$(top_distdir)"; \ + $(am__relativize); \ + new_top_distdir=$$reldir; \ + echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \ + echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \ + ($(am__cd) $$subdir && \ + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$$new_top_distdir" \ + distdir="$$new_distdir" \ + am__remove_distdir=: \ + am__skip_length_check=: \ + am__skip_mode_fix=: \ + distdir) \ + || exit 1; \ + fi; \ + done + $(MAKE) $(AM_MAKEFLAGS) \ + top_distdir="$(top_distdir)" distdir="$(distdir)" \ + dist-info + -test -n "$(am__skip_mode_fix)" \ + || find "$(distdir)" -type d ! -perm -755 \ + -exec chmod u+rwx,go+rx {} \; -o \ + ! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -400 -exec chmod a+r {} \; -o \ + ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \ + || chmod -R a+r "$(distdir)" +dist-gzip: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +dist-bzip2: distdir + tardir=$(distdir) && $(am__tar) | bzip2 -9 -c >$(distdir).tar.bz2 + $(am__remove_distdir) + +dist-lzma: distdir + tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma + $(am__remove_distdir) + +dist-xz: distdir + tardir=$(distdir) && $(am__tar) | xz -c >$(distdir).tar.xz + $(am__remove_distdir) + +dist-tarZ: distdir + tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z + $(am__remove_distdir) + +dist-shar: distdir + shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz + $(am__remove_distdir) + +dist-zip: distdir + -rm -f $(distdir).zip + zip -rq $(distdir).zip $(distdir) + $(am__remove_distdir) + +dist dist-all: distdir + tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz + $(am__remove_distdir) + +# This target untars the dist file and tries a VPATH configuration. Then +# it guarantees that the distribution is self-contained by making another +# tarfile. +distcheck: dist + case '$(DIST_ARCHIVES)' in \ + *.tar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\ + *.tar.bz2*) \ + bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\ + *.tar.lzma*) \ + lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\ + *.tar.xz*) \ + xz -dc $(distdir).tar.xz | $(am__untar) ;;\ + *.tar.Z*) \ + uncompress -c $(distdir).tar.Z | $(am__untar) ;;\ + *.shar.gz*) \ + GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\ + *.zip*) \ + unzip $(distdir).zip ;;\ + esac + chmod -R a-w $(distdir); chmod a+w $(distdir) + mkdir $(distdir)/_build + mkdir $(distdir)/_inst + chmod a-w $(distdir) + test -d $(distdir)/_build || exit 0; \ + dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \ + && dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \ + && am__cwd=`pwd` \ + && $(am__cd) $(distdir)/_build \ + && ../configure --srcdir=.. --prefix="$$dc_install_base" \ + $(DISTCHECK_CONFIGURE_FLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) \ + && $(MAKE) $(AM_MAKEFLAGS) dvi \ + && $(MAKE) $(AM_MAKEFLAGS) check \ + && $(MAKE) $(AM_MAKEFLAGS) install \ + && $(MAKE) $(AM_MAKEFLAGS) installcheck \ + && $(MAKE) $(AM_MAKEFLAGS) uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \ + distuninstallcheck \ + && chmod -R a-w "$$dc_install_base" \ + && ({ \ + (cd ../.. && umask 077 && mkdir "$$dc_destdir") \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \ + && $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \ + distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \ + } || { rm -rf "$$dc_destdir"; exit 1; }) \ + && rm -rf "$$dc_destdir" \ + && $(MAKE) $(AM_MAKEFLAGS) dist \ + && rm -rf $(DIST_ARCHIVES) \ + && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \ + && cd "$$am__cwd" \ + || exit 1 + $(am__remove_distdir) + @(echo "$(distdir) archives ready for distribution: "; \ + list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \ + sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x' +distuninstallcheck: + @$(am__cd) '$(distuninstallcheck_dir)' \ + && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \ + || { echo "ERROR: files left after uninstall:" ; \ + if test -n "$(DESTDIR)"; then \ + echo " (check DESTDIR support)"; \ + fi ; \ + $(distuninstallcheck_listfiles) ; \ + exit 1; } >&2 +distcleancheck: distclean + @if test '$(srcdir)' = . ; then \ + echo "ERROR: distcleancheck can only run from a VPATH build" ; \ + exit 1 ; \ + fi + @test `$(distcleancheck_listfiles) | wc -l` -eq 0 \ + || { echo "ERROR: files left in build directory after distclean:" ; \ + $(distcleancheck_listfiles) ; \ + exit 1; } >&2 +check-am: all-am +check: check-recursive +all-am: Makefile $(INFO_DEPS) $(LTLIBRARIES) $(DATA) fficonfig.h +installdirs: installdirs-recursive +installdirs-am: + for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(infodir)" "$(DESTDIR)$(pkgconfigdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-recursive +install-exec: install-exec-recursive +install-data: install-data-recursive +uninstall: uninstall-recursive + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-recursive +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -rm -f doc/$(am__dirstamp) + -rm -f src/$(DEPDIR)/$(am__dirstamp) + -rm -f src/$(am__dirstamp) + -rm -f src/alpha/$(DEPDIR)/$(am__dirstamp) + -rm -f src/alpha/$(am__dirstamp) + -rm -f src/arm/$(DEPDIR)/$(am__dirstamp) + -rm -f src/arm/$(am__dirstamp) + -rm -f src/avr32/$(DEPDIR)/$(am__dirstamp) + -rm -f src/avr32/$(am__dirstamp) + -rm -f src/cris/$(DEPDIR)/$(am__dirstamp) + -rm -f src/cris/$(am__dirstamp) + -rm -f src/frv/$(DEPDIR)/$(am__dirstamp) + -rm -f src/frv/$(am__dirstamp) + -rm -f src/ia64/$(DEPDIR)/$(am__dirstamp) + -rm -f src/ia64/$(am__dirstamp) + -rm -f src/m32r/$(DEPDIR)/$(am__dirstamp) + -rm -f src/m32r/$(am__dirstamp) + -rm -f src/m68k/$(DEPDIR)/$(am__dirstamp) + -rm -f src/m68k/$(am__dirstamp) + -rm -f src/mips/$(DEPDIR)/$(am__dirstamp) + -rm -f src/mips/$(am__dirstamp) + -rm -f src/pa/$(DEPDIR)/$(am__dirstamp) + -rm -f src/pa/$(am__dirstamp) + -rm -f src/powerpc/$(DEPDIR)/$(am__dirstamp) + -rm -f src/powerpc/$(am__dirstamp) + -rm -f src/s390/$(DEPDIR)/$(am__dirstamp) + -rm -f src/s390/$(am__dirstamp) + -rm -f src/sh/$(DEPDIR)/$(am__dirstamp) + -rm -f src/sh/$(am__dirstamp) + -rm -f src/sh64/$(DEPDIR)/$(am__dirstamp) + -rm -f src/sh64/$(am__dirstamp) + -rm -f src/sparc/$(DEPDIR)/$(am__dirstamp) + -rm -f src/sparc/$(am__dirstamp) + -rm -f src/x86/$(DEPDIR)/$(am__dirstamp) + -rm -f src/x86/$(am__dirstamp) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-recursive + +clean-am: clean-aminfo clean-generic clean-libLTLIBRARIES \ + clean-libtool clean-noinstLTLIBRARIES mostlyclean-am + +distclean: distclean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR) + -rm -f Makefile +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-hdr distclean-libtool distclean-tags + +dvi: dvi-recursive + +dvi-am: $(DVIS) + +html: html-recursive + +html-am: $(HTMLS) + +info: info-recursive + +info-am: $(INFO_DEPS) + +install-data-am: install-info-am install-pkgconfigDATA + +install-dvi: install-dvi-recursive + +install-dvi-am: $(DVIS) + @$(NORMAL_INSTALL) + test -z "$(dvidir)" || $(MKDIR_P) "$(DESTDIR)$(dvidir)" + @list='$(DVIS)'; test -n "$(dvidir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \ + done +install-exec-am: install-libLTLIBRARIES + +install-html-am: $(HTMLS) + @$(NORMAL_INSTALL) + test -z "$(htmldir)" || $(MKDIR_P) "$(DESTDIR)$(htmldir)" + @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \ + for p in $$list; do \ + if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \ + $(am__strip_dir) \ + if test -d "$$d$$p"; then \ + echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \ + $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \ + echo " $(INSTALL_DATA) '$$d$$p'/* '$(DESTDIR)$(htmldir)/$$f'"; \ + $(INSTALL_DATA) "$$d$$p"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \ + else \ + list2="$$list2 $$d$$p"; \ + fi; \ + done; \ + test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \ + done; } +install-info: install-info-recursive + +install-info-am: $(INFO_DEPS) + @$(NORMAL_INSTALL) + test -z "$(infodir)" || $(MKDIR_P) "$(DESTDIR)$(infodir)" + @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \ + list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ + for file in $$list; do \ + case $$file in \ + $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \ + esac; \ + if test -f $$file; then d=.; else d=$(srcdir); fi; \ + file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \ + for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \ + $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \ + if test -f $$ifile; then \ + echo "$$ifile"; \ + else : ; fi; \ + done; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done + @$(POST_INSTALL) + @if (install-info --version && \ + install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \ + list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \ + for file in $$list; do \ + relfile=`echo "$$file" | sed 's|^.*/||'`; \ + echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\ + install-info --info-dir="$(DESTDIR)$(infodir)" "$(DESTDIR)$(infodir)/$$relfile" || :;\ + done; \ + else : ; fi +install-man: + +install-pdf-am: $(PDFS) + @$(NORMAL_INSTALL) + test -z "$(pdfdir)" || $(MKDIR_P) "$(DESTDIR)$(pdfdir)" + @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done +install-ps: install-ps-recursive + +install-ps-am: $(PSS) + @$(NORMAL_INSTALL) + test -z "$(psdir)" || $(MKDIR_P) "$(DESTDIR)$(psdir)" + @list='$(PSS)'; test -n "$(psdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done +installcheck-am: + +maintainer-clean: maintainer-clean-recursive + -rm -f $(am__CONFIG_DISTCLEAN_FILES) + -rm -rf $(top_srcdir)/autom4te.cache + -rm -rf src/$(DEPDIR) src/alpha/$(DEPDIR) src/arm/$(DEPDIR) src/avr32/$(DEPDIR) src/cris/$(DEPDIR) src/frv/$(DEPDIR) src/ia64/$(DEPDIR) src/m32r/$(DEPDIR) src/m68k/$(DEPDIR) src/mips/$(DEPDIR) src/pa/$(DEPDIR) src/powerpc/$(DEPDIR) src/s390/$(DEPDIR) src/sh/$(DEPDIR) src/sh64/$(DEPDIR) src/sparc/$(DEPDIR) src/x86/$(DEPDIR) + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-aminfo \ + maintainer-clean-generic maintainer-clean-vti + +mostlyclean: mostlyclean-recursive + +mostlyclean-am: mostlyclean-aminfo mostlyclean-compile \ + mostlyclean-generic mostlyclean-libtool mostlyclean-vti + +pdf: pdf-recursive + +pdf-am: $(PDFS) + +ps: ps-recursive + +ps-am: $(PSS) + +uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \ + uninstall-libLTLIBRARIES uninstall-pdf-am \ + uninstall-pkgconfigDATA uninstall-ps-am + +.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all \ + ctags-recursive install-am install-strip tags-recursive + +.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \ + all all-am am--refresh check check-am clean clean-aminfo \ + clean-generic clean-libLTLIBRARIES clean-libtool \ + clean-noinstLTLIBRARIES ctags ctags-recursive dist dist-all \ + dist-bzip2 dist-gzip dist-info dist-lzma dist-shar dist-tarZ \ + dist-xz dist-zip distcheck distclean distclean-compile \ + distclean-generic distclean-hdr distclean-libtool \ + distclean-tags distcleancheck distdir distuninstallcheck dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-libLTLIBRARIES \ + install-man install-pdf install-pdf-am install-pkgconfigDATA \ + install-ps install-ps-am install-strip installcheck \ + installcheck-am installdirs installdirs-am maintainer-clean \ + maintainer-clean-aminfo maintainer-clean-generic \ + maintainer-clean-vti mostlyclean mostlyclean-aminfo \ + mostlyclean-compile mostlyclean-generic mostlyclean-libtool \ + mostlyclean-vti pdf pdf-am ps ps-am tags tags-recursive \ + uninstall uninstall-am uninstall-dvi-am uninstall-html-am \ + uninstall-info-am uninstall-libLTLIBRARIES uninstall-pdf-am \ + uninstall-pkgconfigDATA uninstall-ps-am + + +# No install-html or install-pdf support in automake yet +.PHONY: install-html install-pdf +install-html: +install-pdf: + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/Makefile.vc b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/Makefile.vc new file mode 100644 index 000000000..c22c895b2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/Makefile.vc @@ -0,0 +1,141 @@ +# +# ==================================================================== +# +# libffi Windows Makefile +# +# +# ==================================================================== +# + +NAME=ffi-3 +VERSION=3.0.10 +TARGET=X86_WIN32 +CC=cl.exe +AS=ml.exe +RC=rc.exe +MT=mt.exe +AR="link.exe" +SO=.dll +OBJ=.obj +EXE=.exe +LA=.lib +LINK="link.exe" +PREFIX= +TOPDIR=. +CPP=cl.exe -EP +CFLAGS=-nologo -Zi -D_MD -W3 -DWIN32 -DWINNT -D_WIN32 -D_WINDOWS -D_WINNT -D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x0600 -D_X86_=1 -DNDEBUG -MD -O2 -Ob2 -Oy- +LDFLAGS=/NOLOGO /MACHINE:X86 +SHFLAGS=/DLL /INCREMENTAL:NO /DEBUG /SUBSYSTEM:WINDOWS /OPT:REF +ARFLAGS=/LIB +ASFLAGS=-coff -W3 -Cx -Zm -Di386 -DQUIET -D?QUIET +RCFLAGS=/l 0x409 -DNDEBUG +INCLUDES=-I . -I .\include -I .\src\x86 +LIBS=kernel32.lib advapi32.lib shell32.lib user32.lib gdi32.lib + +VERSION_MAJOR=3 +VERSION_MINOR=1 +VERSION_PATCH=10rc + +DESTDIR=$(PREFIX) +DESTBIN=$(PREFIX)\bin +DESTLIB=$(PREFIX)\lib +DESTINC=$(PREFIX)\include +SRCDIR=$(TOPDIR)\src + +WORKDIR=$(TOPDIR)\.libs +SOLIBNAME=lib$(NAME) +LALIBNAME=libffi_convenience +STATICLIB=$(WORKDIR)\$(LALIBNAME)$(LA) + +BUILDPDB = $(WORKDIR)\$(SOLIBNAME).pdb + +HEADERS = \ + $(TOPDIR)\fficonfig.h + +FFI_HEADERS = \ + $(TOPDIR)\include\ffi.h + +OBJECTS = \ + $(SRCDIR)\closures.obj \ + $(SRCDIR)\debug.obj \ + $(SRCDIR)\java_raw_api.obj \ + $(SRCDIR)\prep_cif.obj \ + $(SRCDIR)\raw_api.obj \ + $(SRCDIR)\types.obj \ + $(SRCDIR)\x86\ffi.obj + +!IF "$(TARGET)" == "X86_WIN32" +OBJECTS = $(OBJECTS) \ + $(SRCDIR)\x86\win32.obj +ASMSRCS = \ + $(SRCDIR)\x86\win32.asm + +!ENDIF +!IF "$(TARGET)" == "X86_WIN64" +OBJECTS = $(OBJECTS) \ + $(SRCDIR)\x86\win64.obj +ASMSRCS = \ + $(SRCDIR)\x86\win64.asm + +!ENDIF + +.SUFFIXES : .S .asm + +all: $(WORKDIR) $(STATICLIB) + +.c$(OBJ): + $(CC) -c $(CFLAGS) $(INCLUDES) -Fo$@ -Fd$(WORKDIR)\$(NAME)-src $< + +.asm$(OBJ): + $(AS) -c $(ASFLAGS) /Fo $@ $< + +.S.asm: + $(CPP) $(CFLAGS) $(INCLUDES) $< >$@ + +.rc.res: + $(RC) $(RCFLAGS) /fo $@ $< + +$(WORKDIR) : + -@if not exist "$(WORKDIR)\$(NULL)" mkdir $(WORKDIR) + +$(HEADERS) : + -@if not exist $(HEADERS) copy $(HEADERS)w $(HEADERS) + +$(FFI_HEADERS) : + -@if not exist $(FFI_HEADERS) copy $(FFI_HEADERS).vc $(FFI_HEADERS) + +$(STATICLIB): $(WORKDIR) $(FFI_HEADERS) $(HEADERS) $(ASMSRCS) $(OBJECTS) + $(AR) $(ARFLAGS) $(LDFLAGS) /out:$(STATICLIB) @<< + $(OBJECTS) +<< + + +!IF !DEFINED(PREFIX) || "$(PREFIX)" == "" + +install: + @echo ERROR: You must define installation PREFIX=destination + +!ELSE + +install: all + -@xcopy "$(TOPDIR)\include\*.h" "$(DESTINC)\" /Y /Q + -@xcopy "$(SRCDIR)\x86\ffitarget.h" "$(DESTINC)\" /Y /Q + -@xcopy "$(WORKDIR)\$(LALIBNAME)$(LA)" "$(DESTLIB)\" /Y /Q + -@xcopy "$(WORKDIR)\$(SOLIBNAME)$(LA)" "$(DESTLIB)\" /Y /Q + -@xcopy "$(WORKDIR)\$(SOLIBNAME)$(SO)" "$(DESTBIN)\" /Y /Q + -@xcopy "$(WORKDIR)\$(SOLIBNAME).pdb" "$(DESTLIB)\" /Y /Q + +!ENDIF + +clean: + -@del /Q $(OBJECTS) 2>NUL + -@del /Q $(RESOURCES) 2>NUL + -@del /Q $(ASMSRCS) 2>NUL + -@del /Q /S $(WORKDIR) 2>NUL + +distclean: clean + -@del /Q $(HEADERS) 2>NUL + -@del /Q $(TOPDIR)\include\ffi.h 2>NUL + -@del /Q $(TOPDIR)\fficonfig.h 2>NUL + -@del /Q $(TOPDIR)\Makefile.vc 2>NUL + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/Makefile.vc64 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/Makefile.vc64 new file mode 100644 index 000000000..3e99baa5e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/Makefile.vc64 @@ -0,0 +1,141 @@ +# +# ==================================================================== +# +# libffi Windows Makefile +# +# +# ==================================================================== +# + +NAME=ffi-3 +VERSION=3.0.10 +TARGET=X86_WIN64 +CC=cl.exe +AS=ml64.exe +RC=rc.exe +MT=mt.exe +AR="link.exe" +SO=.dll +OBJ=.obj +EXE=.exe +LA=.lib +LINK="link.exe" +PREFIX= +TOPDIR=. +CPP=cl.exe -EP +CFLAGS=-nologo -Zi -D_MD -W3 -DWIN64 -DWINNT -D_WIN32 -D_WINDOWS -D_WINNT -D_WIN32_WINNT=0x0501 -D_WIN32_IE=0x0600 -D_AMD64_=1 -DNDEBUG -MD -O2 -Ob2 -Oy- +LDFLAGS=/NOLOGO /MACHINE:X64 +SHFLAGS=/DLL /INCREMENTAL:NO /DEBUG /SUBSYSTEM:WINDOWS /OPT:REF +ARFLAGS=/LIB +ASFLAGS=-coff -W3 -Cx -Zm -Di386 -DQUIET -D?QUIET +RCFLAGS=/l 0x409 -DNDEBUG +INCLUDES=-I . -I .\include -I .\src\x86 +LIBS=kernel32.lib advapi32.lib shell32.lib user32.lib gdi32.lib + +VERSION_MAJOR=3 +VERSION_MINOR=1 +VERSION_PATCH=10rc + +DESTDIR=$(PREFIX) +DESTBIN=$(PREFIX)\bin +DESTLIB=$(PREFIX)\lib +DESTINC=$(PREFIX)\include +SRCDIR=$(TOPDIR)\src + +WORKDIR=$(TOPDIR)\.libs +SOLIBNAME=lib$(NAME) +LALIBNAME=libffi_convenience +STATICLIB=$(WORKDIR)\$(LALIBNAME)$(LA) + +BUILDPDB = $(WORKDIR)\$(SOLIBNAME).pdb + +HEADERS = \ + $(TOPDIR)\fficonfig.h + +FFI_HEADERS = \ + $(TOPDIR)\include\ffi.h + +OBJECTS = \ + $(SRCDIR)\closures.obj \ + $(SRCDIR)\debug.obj \ + $(SRCDIR)\java_raw_api.obj \ + $(SRCDIR)\prep_cif.obj \ + $(SRCDIR)\raw_api.obj \ + $(SRCDIR)\types.obj \ + $(SRCDIR)\x86\ffi.obj + +!IF "$(TARGET)" == "X86_WIN32" +OBJECTS = $(OBJECTS) \ + $(SRCDIR)\x86\win32.obj +ASMSRCS = \ + $(SRCDIR)\x86\win32.asm + +!ENDIF +!IF "$(TARGET)" == "X86_WIN64" +OBJECTS = $(OBJECTS) \ + $(SRCDIR)\x86\win64.obj +ASMSRCS = \ + $(SRCDIR)\x86\win64.asm + +!ENDIF + +.SUFFIXES : .S .asm + +all: $(WORKDIR) $(STATICLIB) + +.c$(OBJ): + $(CC) -c $(CFLAGS) $(INCLUDES) -Fo$@ -Fd$(WORKDIR)\$(NAME)-src $< + +.asm$(OBJ): + $(AS) -c $(ASFLAGS) /Fo $@ $< + +.S.asm: + $(CPP) $(CFLAGS) $(INCLUDES) $< >$@ + +.rc.res: + $(RC) $(RCFLAGS) /fo $@ $< + +$(WORKDIR) : + -@if not exist "$(WORKDIR)\$(NULL)" mkdir $(WORKDIR) + +$(HEADERS) : + -@if not exist $(HEADERS) copy $(HEADERS)w $(HEADERS) + +$(FFI_HEADERS) : + -@if not exist $(FFI_HEADERS) copy $(FFI_HEADERS).vc64 $(FFI_HEADERS) + +$(STATICLIB): $(WORKDIR) $(FFI_HEADERS) $(HEADERS) $(ASMSRCS) $(OBJECTS) + $(AR) $(ARFLAGS) $(LDFLAGS) /out:$(STATICLIB) @<< + $(OBJECTS) +<< + + +!IF !DEFINED(PREFIX) || "$(PREFIX)" == "" + +install: + @echo ERROR: You must define installation PREFIX=destination + +!ELSE + +install: all + -@xcopy "$(TOPDIR)\include\*.h" "$(DESTINC)\" /Y /Q + -@xcopy "$(SRCDIR)\x86\ffitarget.h" "$(DESTINC)\" /Y /Q + -@xcopy "$(WORKDIR)\$(LALIBNAME)$(LA)" "$(DESTLIB)\" /Y /Q + -@xcopy "$(WORKDIR)\$(SOLIBNAME)$(LA)" "$(DESTLIB)\" /Y /Q + -@xcopy "$(WORKDIR)\$(SOLIBNAME)$(SO)" "$(DESTBIN)\" /Y /Q + -@xcopy "$(WORKDIR)\$(SOLIBNAME).pdb" "$(DESTLIB)\" /Y /Q + +!ENDIF + +clean: + -@del /Q $(OBJECTS) 2>NUL + -@del /Q $(RESOURCES) 2>NUL + -@del /Q $(ASMSRCS) 2>NUL + -@del /Q /S $(WORKDIR) 2>NUL + +distclean: clean + -@del /Q $(HEADERS) 2>NUL + -@del /Q $(TOPDIR)\include\ffi.h 2>NUL + -@del /Q $(TOPDIR)\fficonfig.h 2>NUL + -@del /Q $(TOPDIR)\Makefile.vc 2>NUL + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/README b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/README new file mode 100644 index 000000000..297c0441c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/README @@ -0,0 +1,342 @@ +Status +====== + +libffi-3.0.10 was released on August 23, 2011. Check the libffi web +page for updates: . + + +What is libffi? +=============== + +Compilers for high level languages generate code that follow certain +conventions. These conventions are necessary, in part, for separate +compilation to work. One such convention is the "calling +convention". The "calling convention" is essentially a set of +assumptions made by the compiler about where function arguments will +be found on entry to a function. A "calling convention" also specifies +where the return value for a function is found. + +Some programs may not know at the time of compilation what arguments +are to be passed to a function. For instance, an interpreter may be +told at run-time about the number and types of arguments used to call +a given function. Libffi can be used in such programs to provide a +bridge from the interpreter program to compiled code. + +The libffi library provides a portable, high level programming +interface to various calling conventions. This allows a programmer to +call any function specified by a call interface description at run +time. + +FFI stands for Foreign Function Interface. A foreign function +interface is the popular name for the interface that allows code +written in one language to call code written in another language. The +libffi library really only provides the lowest, machine dependent +layer of a fully featured foreign function interface. A layer must +exist above libffi that handles type conversions for values passed +between the two languages. + + +Supported Platforms +=================== + +Libffi has been ported to many different platforms. +For specific configuration details and testing status, please +refer to the wiki page here: + + http://www.moxielogic.org/wiki/index.php?title=Libffi_3.0.10 + +At the time of release, the following basic configurations have been +tested: + +|--------------+------------------| +| Architecture | Operating System | +|--------------+------------------| +| Alpha | Linux | +| Alpha | Tru64 | +| ARM | Linux | +| ARM | iOS | +| AVR32 | Linux | +| HPPA | HPUX | +| IA-64 | Linux | +| M68K | RTEMS | +| MIPS | IRIX | +| MIPS | Linux | +| MIPS | RTEMS | +| MIPS64 | Linux | +| PowerPC | Linux | +| PowerPC | Mac OSX | +| PowerPC | FreeBSD | +| PowerPC64 | Linux | +| S390 | Linux | +| S390X | Linux | +| SPARC | Linux | +| SPARC | Solaris | +| SPARC64 | Linux | +| SPARC64 | FreeBSD | +| X86 | FreeBSD | +| X86 | Interix | +| X86 | kFreeBSD | +| X86 | Linux | +| X86 | Mac OSX | +| X86 | OpenBSD | +| X86 | OS/2 | +| X86 | Solaris | +| X86 | Windows/Cygwin | +| X86 | Windows/MingW | +| X86-64 | FreeBSD | +| X86-64 | Linux | +| X86-64 | OpenBSD | +| X86-64 | Windows/MingW | +|--------------+------------------| + +Please send additional platform test results to +libffi-discuss@sourceware.org and feel free to update the wiki page +above. + +Installing libffi +================= + +First you must configure the distribution for your particular +system. Go to the directory you wish to build libffi in and run the +"configure" program found in the root directory of the libffi source +distribution. + +You may want to tell configure where to install the libffi library and +header files. To do that, use the --prefix configure switch. Libffi +will install under /usr/local by default. + +If you want to enable extra run-time debugging checks use the the +--enable-debug configure switch. This is useful when your program dies +mysteriously while using libffi. + +Another useful configure switch is --enable-purify-safety. Using this +will add some extra code which will suppress certain warnings when you +are using Purify with libffi. Only use this switch when using +Purify, as it will slow down the library. + +It's also possible to build libffi on Windows platforms with +Microsoft's Visual C++ compiler. In this case, use the msvcc.sh +wrapper script during configuration like so: + +path/to/configure CC=path/to/msvcc.sh LD=link CPP=\"cl -nologo -EP\" + +For 64-bit Windows builds, use CC="path/to/msvcc.sh -m64". +You may also need to specify --build appropriately. When building with MSVC +under a MingW environment, you may need to remove the line in configure +that sets 'fix_srcfile_path' to a 'cygpath' command. ('cygpath' is not +present in MingW, and is not required when using MingW-style paths.) + +For iOS builds, refer to the build-ios.sh script for guidance. + +Configure has many other options. Use "configure --help" to see them all. + +Once configure has finished, type "make". Note that you must be using +GNU make. You can ftp GNU make from prep.ai.mit.edu:/pub/gnu. + +To ensure that libffi is working as advertised, type "make check". +This will require that you have DejaGNU installed. + +To install the library and header files, type "make install". + + +History +======= + +See the ChangeLog files for details. + +3.0.10 Aug-23-11 + Add support for Apple's iOS. + Add support for ARM VFP ABI. + Add RTEMS support for MIPS and M68K. + Fix instruction cache clearing problems on + ARM and SPARC. + Fix the N64 build on mips-sgi-irix6.5. + Enable builds with Microsoft's compiler. + Enable x86 builds with Oracle's Solaris compiler. + Fix support for calling code compiled with Oracle's Sparc + Solaris compiler. + Testsuite fixes for Tru64 Unix. + Additional platform support. + +3.0.9 Dec-31-09 + Add AVR32 and win64 ports. Add ARM softfp support. + Many fixes for AIX, Solaris, HP-UX, *BSD. + Several PowerPC and x86-64 bug fixes. + Build DLL for windows. + +3.0.8 Dec-19-08 + Add *BSD, BeOS, and PA-Linux support. + +3.0.7 Nov-11-08 + Fix for ppc FreeBSD. + (thanks to Andreas Tobler) + +3.0.6 Jul-17-08 + Fix for closures on sh. + Mark the sh/sh64 stack as non-executable. + (both thanks to Kaz Kojima) + +3.0.5 Apr-3-08 + Fix libffi.pc file. + Fix #define ARM for IcedTea users. + Fix x86 closure bug. + +3.0.4 Feb-24-08 + Fix x86 OpenBSD configury. + +3.0.3 Feb-22-08 + Enable x86 OpenBSD thanks to Thomas Heller, and + x86-64 FreeBSD thanks to Björn König and Andreas Tobler. + Clean up test instruction in README. + +3.0.2 Feb-21-08 + Improved x86 FreeBSD support. + Thanks to Björn König. + +3.0.1 Feb-15-08 + Fix instruction cache flushing bug on MIPS. + Thanks to David Daney. + +3.0.0 Feb-15-08 + Many changes, mostly thanks to the GCC project. + Cygnus Solutions is now Red Hat. + + [10 years go by...] + +1.20 Oct-5-98 + Raffaele Sena produces ARM port. + +1.19 Oct-5-98 + Fixed x86 long double and long long return support. + m68k bug fixes from Andreas Schwab. + Patch for DU assembler compatibility for the Alpha from Richard + Henderson. + +1.18 Apr-17-98 + Bug fixes and MIPS configuration changes. + +1.17 Feb-24-98 + Bug fixes and m68k port from Andreas Schwab. PowerPC port from + Geoffrey Keating. Various bug x86, Sparc and MIPS bug fixes. + +1.16 Feb-11-98 + Richard Henderson produces Alpha port. + +1.15 Dec-4-97 + Fixed an n32 ABI bug. New libtool, auto* support. + +1.14 May-13-97 + libtool is now used to generate shared and static libraries. + Fixed a minor portability problem reported by Russ McManus + . + +1.13 Dec-2-96 + Added --enable-purify-safety to keep Purify from complaining + about certain low level code. + Sparc fix for calling functions with < 6 args. + Linux x86 a.out fix. + +1.12 Nov-22-96 + Added missing ffi_type_void, needed for supporting void return + types. Fixed test case for non MIPS machines. Cygnus Support + is now Cygnus Solutions. + +1.11 Oct-30-96 + Added notes about GNU make. + +1.10 Oct-29-96 + Added configuration fix for non GNU compilers. + +1.09 Oct-29-96 + Added --enable-debug configure switch. Clean-ups based on LCLint + feedback. ffi_mips.h is always installed. Many configuration + fixes. Fixed ffitest.c for sparc builds. + +1.08 Oct-15-96 + Fixed n32 problem. Many clean-ups. + +1.07 Oct-14-96 + Gordon Irlam rewrites v8.S again. Bug fixes. + +1.06 Oct-14-96 + Gordon Irlam improved the sparc port. + +1.05 Oct-14-96 + Interface changes based on feedback. + +1.04 Oct-11-96 + Sparc port complete (modulo struct passing bug). + +1.03 Oct-10-96 + Passing struct args, and returning struct values works for + all architectures/calling conventions. Expanded tests. + +1.02 Oct-9-96 + Added SGI n32 support. Fixed bugs in both o32 and Linux support. + Added "make test". + +1.01 Oct-8-96 + Fixed float passing bug in mips version. Restructured some + of the code. Builds cleanly with SGI tools. + +1.00 Oct-7-96 + First release. No public announcement. + + +Authors & Credits +================= + +libffi was originally written by Anthony Green . + +The developers of the GNU Compiler Collection project have made +innumerable valuable contributions. See the ChangeLog file for +details. + +Some of the ideas behind libffi were inspired by Gianni Mariani's free +gencall library for Silicon Graphics machines. + +The closure mechanism was designed and implemented by Kresten Krab +Thorup. + +Major processor architecture ports were contributed by the following +developers: + +alpha Richard Henderson +arm Raffaele Sena +cris Simon Posnjak, Hans-Peter Nilsson +frv Anthony Green +ia64 Hans Boehm +m32r Kazuhiro Inaoka +m68k Andreas Schwab +mips Anthony Green, Casey Marshall +mips64 David Daney +pa Randolph Chung, Dave Anglin, Andreas Tobler +powerpc Geoffrey Keating, Andreas Tobler, + David Edelsohn, John Hornkvist +powerpc64 Jakub Jelinek +s390 Gerhard Tonn, Ulrich Weigand +sh Kaz Kojima +sh64 Kaz Kojima +sparc Anthony Green, Gordon Irlam +x86 Anthony Green, Jon Beniston +x86-64 Bo Thorsen + +Jesper Skov and Andrew Haley both did more than their fair share of +stepping through the code and tracking down bugs. + +Thanks also to Tom Tromey for bug fixes, documentation and +configuration help. + +Thanks to Jim Blandy, who provided some useful feedback on the libffi +interface. + +Andreas Tobler has done a tremendous amount of work on the testsuite. + +Alex Oliva solved the executable page problem for SElinux. + +The list above is almost certainly incomplete and inaccurate. I'm +happy to make corrections or additions upon request. + +If you have a problem, or have found a bug, please send a note to the +author at green@moxielogic.com, or the project mailing list at +libffi-discuss@sourceware.org. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/acinclude.m4 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/acinclude.m4 new file mode 100644 index 000000000..3e8f8ba57 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/acinclude.m4 @@ -0,0 +1,92 @@ +# mmap(2) blacklisting. Some platforms provide the mmap library routine +# but don't support all of the features we need from it. +AC_DEFUN([AC_FUNC_MMAP_BLACKLIST], +[ +AC_CHECK_HEADER([sys/mman.h], + [libffi_header_sys_mman_h=yes], [libffi_header_sys_mman_h=no]) +AC_CHECK_FUNC([mmap], [libffi_func_mmap=yes], [libffi_func_mmap=no]) +if test "$libffi_header_sys_mman_h" != yes \ + || test "$libffi_func_mmap" != yes; then + ac_cv_func_mmap_file=no + ac_cv_func_mmap_dev_zero=no + ac_cv_func_mmap_anon=no +else + AC_CACHE_CHECK([whether read-only mmap of a plain file works], + ac_cv_func_mmap_file, + [# Add a system to this blacklist if + # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a + # memory area containing the same data that you'd get if you applied + # read() to the same fd. The only system known to have a problem here + # is VMS, where text files have record structure. + case "$host_os" in + vms* | ultrix*) + ac_cv_func_mmap_file=no ;; + *) + ac_cv_func_mmap_file=yes;; + esac]) + AC_CACHE_CHECK([whether mmap from /dev/zero works], + ac_cv_func_mmap_dev_zero, + [# Add a system to this blacklist if it has mmap() but /dev/zero + # does not exist, or if mmapping /dev/zero does not give anonymous + # zeroed pages with both the following properties: + # 1. If you map N consecutive pages in with one call, and then + # unmap any subset of those pages, the pages that were not + # explicitly unmapped remain accessible. + # 2. If you map two adjacent blocks of memory and then unmap them + # both at once, they must both go away. + # Systems known to be in this category are Windows (all variants), + # VMS, and Darwin. + case "$host_os" in + vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00) + ac_cv_func_mmap_dev_zero=no ;; + *) + ac_cv_func_mmap_dev_zero=yes;; + esac]) + + # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for. + AC_CACHE_CHECK([for MAP_ANON(YMOUS)], ac_cv_decl_map_anon, + [AC_TRY_COMPILE( +[#include +#include +#include + +#ifndef MAP_ANONYMOUS +#define MAP_ANONYMOUS MAP_ANON +#endif +], +[int n = MAP_ANONYMOUS;], + ac_cv_decl_map_anon=yes, + ac_cv_decl_map_anon=no)]) + + if test $ac_cv_decl_map_anon = no; then + ac_cv_func_mmap_anon=no + else + AC_CACHE_CHECK([whether mmap with MAP_ANON(YMOUS) works], + ac_cv_func_mmap_anon, + [# Add a system to this blacklist if it has mmap() and MAP_ANON or + # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) + # doesn't give anonymous zeroed pages with the same properties listed + # above for use of /dev/zero. + # Systems known to be in this category are Windows, VMS, and SCO Unix. + case "$host_os" in + vms* | cygwin* | pe | mingw* | sco* | udk* ) + ac_cv_func_mmap_anon=no ;; + *) + ac_cv_func_mmap_anon=yes;; + esac]) + fi +fi + +if test $ac_cv_func_mmap_file = yes; then + AC_DEFINE(HAVE_MMAP_FILE, 1, + [Define if read-only mmap of a plain file works.]) +fi +if test $ac_cv_func_mmap_dev_zero = yes; then + AC_DEFINE(HAVE_MMAP_DEV_ZERO, 1, + [Define if mmap of /dev/zero works.]) +fi +if test $ac_cv_func_mmap_anon = yes; then + AC_DEFINE(HAVE_MMAP_ANON, 1, + [Define if mmap with MAP_ANON(YMOUS) works.]) +fi +]) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/aclocal.m4 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/aclocal.m4 new file mode 100644 index 000000000..6132c39ab --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/aclocal.m4 @@ -0,0 +1,1873 @@ +# generated automatically by aclocal 1.11.1 -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.68],, +[m4_warning([this file was generated for autoconf 2.68. +You have another version of autoconf. It may work, but is not guaranteed to. +If you have problems, you may need to regenerate the build system entirely. +To do so, use the procedure documented by the package, typically `autoreconf'.])]) + +# ltdl.m4 - Configure ltdl for the target system. -*-Autoconf-*- +# +# Copyright (C) 1999-2006, 2007, 2008 Free Software Foundation, Inc. +# Written by Thomas Tanner, 1999 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 18 LTDL_INIT + +# LT_CONFIG_LTDL_DIR(DIRECTORY, [LTDL-MODE]) +# ------------------------------------------ +# DIRECTORY contains the libltdl sources. It is okay to call this +# function multiple times, as long as the same DIRECTORY is always given. +AC_DEFUN([LT_CONFIG_LTDL_DIR], +[AC_BEFORE([$0], [LTDL_INIT]) +_$0($*) +])# LT_CONFIG_LTDL_DIR + +# We break this out into a separate macro, so that we can call it safely +# internally without being caught accidentally by the sed scan in libtoolize. +m4_defun([_LT_CONFIG_LTDL_DIR], +[dnl remove trailing slashes +m4_pushdef([_ARG_DIR], m4_bpatsubst([$1], [/*$])) +m4_case(_LTDL_DIR, + [], [dnl only set lt_ltdl_dir if _ARG_DIR is not simply `.' + m4_if(_ARG_DIR, [.], + [], + [m4_define([_LTDL_DIR], _ARG_DIR) + _LT_SHELL_INIT([lt_ltdl_dir=']_ARG_DIR['])])], + [m4_if(_ARG_DIR, _LTDL_DIR, + [], + [m4_fatal([multiple libltdl directories: `]_LTDL_DIR[', `]_ARG_DIR['])])]) +m4_popdef([_ARG_DIR]) +])# _LT_CONFIG_LTDL_DIR + +# Initialise: +m4_define([_LTDL_DIR], []) + + +# _LT_BUILD_PREFIX +# ---------------- +# If Autoconf is new enough, expand to `${top_build_prefix}', otherwise +# to `${top_builddir}/'. +m4_define([_LT_BUILD_PREFIX], +[m4_ifdef([AC_AUTOCONF_VERSION], + [m4_if(m4_version_compare(m4_defn([AC_AUTOCONF_VERSION]), [2.62]), + [-1], [m4_ifdef([_AC_HAVE_TOP_BUILD_PREFIX], + [${top_build_prefix}], + [${top_builddir}/])], + [${top_build_prefix}])], + [${top_builddir}/])[]dnl +]) + + +# LTDL_CONVENIENCE +# ---------------- +# sets LIBLTDL to the link flags for the libltdl convenience library and +# LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-convenience to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called here. LIBLTDL will be prefixed with +# '${top_build_prefix}' if available, otherwise with '${top_builddir}/', +# and LTDLINCL will be prefixed with '${top_srcdir}/' (note the single +# quotes!). If your package is not flat and you're not using automake, +# define top_build_prefix, top_builddir, and top_srcdir appropriately +# in your Makefiles. +AC_DEFUN([LTDL_CONVENIENCE], +[AC_BEFORE([$0], [LTDL_INIT])dnl +dnl Although the argument is deprecated and no longer documented, +dnl LTDL_CONVENIENCE used to take a DIRECTORY orgument, if we have one +dnl here make sure it is the same as any other declaration of libltdl's +dnl location! This also ensures lt_ltdl_dir is set when configure.ac is +dnl not yet using an explicit LT_CONFIG_LTDL_DIR. +m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl +_$0() +])# LTDL_CONVENIENCE + +# AC_LIBLTDL_CONVENIENCE accepted a directory argument in older libtools, +# now we have LT_CONFIG_LTDL_DIR: +AU_DEFUN([AC_LIBLTDL_CONVENIENCE], +[_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) +_LTDL_CONVENIENCE]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBLTDL_CONVENIENCE], []) + + +# _LTDL_CONVENIENCE +# ----------------- +# Code shared by LTDL_CONVENIENCE and LTDL_INIT([convenience]). +m4_defun([_LTDL_CONVENIENCE], +[case $enable_ltdl_convenience in + no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;; + "") enable_ltdl_convenience=yes + ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;; +esac +LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdlc.la" +LTDLDEPS=$LIBLTDL +LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" + +AC_SUBST([LIBLTDL]) +AC_SUBST([LTDLDEPS]) +AC_SUBST([LTDLINCL]) + +# For backwards non-gettext consistent compatibility... +INCLTDL="$LTDLINCL" +AC_SUBST([INCLTDL]) +])# _LTDL_CONVENIENCE + + +# LTDL_INSTALLABLE +# ---------------- +# sets LIBLTDL to the link flags for the libltdl installable library +# and LTDLINCL to the include flags for the libltdl header and adds +# --enable-ltdl-install to the configure arguments. Note that +# AC_CONFIG_SUBDIRS is not called from here. If an installed libltdl +# is not found, LIBLTDL will be prefixed with '${top_build_prefix}' if +# available, otherwise with '${top_builddir}/', and LTDLINCL will be +# prefixed with '${top_srcdir}/' (note the single quotes!). If your +# package is not flat and you're not using automake, define top_build_prefix, +# top_builddir, and top_srcdir appropriately in your Makefiles. +# In the future, this macro may have to be called after LT_INIT. +AC_DEFUN([LTDL_INSTALLABLE], +[AC_BEFORE([$0], [LTDL_INIT])dnl +dnl Although the argument is deprecated and no longer documented, +dnl LTDL_INSTALLABLE used to take a DIRECTORY orgument, if we have one +dnl here make sure it is the same as any other declaration of libltdl's +dnl location! This also ensures lt_ltdl_dir is set when configure.ac is +dnl not yet using an explicit LT_CONFIG_LTDL_DIR. +m4_ifval([$1], [_LT_CONFIG_LTDL_DIR([$1])])dnl +_$0() +])# LTDL_INSTALLABLE + +# AC_LIBLTDL_INSTALLABLE accepted a directory argument in older libtools, +# now we have LT_CONFIG_LTDL_DIR: +AU_DEFUN([AC_LIBLTDL_INSTALLABLE], +[_LT_CONFIG_LTDL_DIR([m4_default([$1], [libltdl])]) +_LTDL_INSTALLABLE]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBLTDL_INSTALLABLE], []) + + +# _LTDL_INSTALLABLE +# ----------------- +# Code shared by LTDL_INSTALLABLE and LTDL_INIT([installable]). +m4_defun([_LTDL_INSTALLABLE], +[if test -f $prefix/lib/libltdl.la; then + lt_save_LDFLAGS="$LDFLAGS" + LDFLAGS="-L$prefix/lib $LDFLAGS" + AC_CHECK_LIB([ltdl], [lt_dlinit], [lt_lib_ltdl=yes]) + LDFLAGS="$lt_save_LDFLAGS" + if test x"${lt_lib_ltdl-no}" = xyes; then + if test x"$enable_ltdl_install" != xyes; then + # Don't overwrite $prefix/lib/libltdl.la without --enable-ltdl-install + AC_MSG_WARN([not overwriting libltdl at $prefix, force with `--enable-ltdl-install']) + enable_ltdl_install=no + fi + elif test x"$enable_ltdl_install" = xno; then + AC_MSG_WARN([libltdl not installed, but installation disabled]) + fi +fi + +# If configure.ac declared an installable ltdl, and the user didn't override +# with --disable-ltdl-install, we will install the shipped libltdl. +case $enable_ltdl_install in + no) ac_configure_args="$ac_configure_args --enable-ltdl-install=no" + LIBLTDL="-lltdl" + LTDLDEPS= + LTDLINCL= + ;; + *) enable_ltdl_install=yes + ac_configure_args="$ac_configure_args --enable-ltdl-install" + LIBLTDL='_LT_BUILD_PREFIX'"${lt_ltdl_dir+$lt_ltdl_dir/}libltdl.la" + LTDLDEPS=$LIBLTDL + LTDLINCL='-I${top_srcdir}'"${lt_ltdl_dir+/$lt_ltdl_dir}" + ;; +esac + +AC_SUBST([LIBLTDL]) +AC_SUBST([LTDLDEPS]) +AC_SUBST([LTDLINCL]) + +# For backwards non-gettext consistent compatibility... +INCLTDL="$LTDLINCL" +AC_SUBST([INCLTDL]) +])# LTDL_INSTALLABLE + + +# _LTDL_MODE_DISPATCH +# ------------------- +m4_define([_LTDL_MODE_DISPATCH], +[dnl If _LTDL_DIR is `.', then we are configuring libltdl itself: +m4_if(_LTDL_DIR, [], + [], + dnl if _LTDL_MODE was not set already, the default value is `subproject': + [m4_case(m4_default(_LTDL_MODE, [subproject]), + [subproject], [AC_CONFIG_SUBDIRS(_LTDL_DIR) + _LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"])], + [nonrecursive], [_LT_SHELL_INIT([lt_dlopen_dir="$lt_ltdl_dir"; lt_libobj_prefix="$lt_ltdl_dir/"])], + [recursive], [], + [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])])dnl +dnl Be careful not to expand twice: +m4_define([$0], []) +])# _LTDL_MODE_DISPATCH + + +# _LT_LIBOBJ(MODULE_NAME) +# ----------------------- +# Like AC_LIBOBJ, except that MODULE_NAME goes into _LT_LIBOBJS instead +# of into LIBOBJS. +AC_DEFUN([_LT_LIBOBJ], [ + m4_pattern_allow([^_LT_LIBOBJS$]) + _LT_LIBOBJS="$_LT_LIBOBJS $1.$ac_objext" +])# _LT_LIBOBJS + + +# LTDL_INIT([OPTIONS]) +# -------------------- +# Clients of libltdl can use this macro to allow the installer to +# choose between a shipped copy of the ltdl sources or a preinstalled +# version of the library. If the shipped ltdl sources are not in a +# subdirectory named libltdl, the directory name must be given by +# LT_CONFIG_LTDL_DIR. +AC_DEFUN([LTDL_INIT], +[dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +dnl We need to keep our own list of libobjs separate from our parent project, +dnl and the easiest way to do that is redefine the AC_LIBOBJs macro while +dnl we look for our own LIBOBJs. +m4_pushdef([AC_LIBOBJ], m4_defn([_LT_LIBOBJ])) +m4_pushdef([AC_LIBSOURCES]) + +dnl If not otherwise defined, default to the 1.5.x compatible subproject mode: +m4_if(_LTDL_MODE, [], + [m4_define([_LTDL_MODE], m4_default([$2], [subproject])) + m4_if([-1], [m4_bregexp(_LTDL_MODE, [\(subproject\|\(non\)?recursive\)])], + [m4_fatal([unknown libltdl mode: ]_LTDL_MODE)])]) + +AC_ARG_WITH([included_ltdl], + [AS_HELP_STRING([--with-included-ltdl], + [use the GNU ltdl sources included here])]) + +if test "x$with_included_ltdl" != xyes; then + # We are not being forced to use the included libltdl sources, so + # decide whether there is a useful installed version we can use. + AC_CHECK_HEADER([ltdl.h], + [AC_CHECK_DECL([lt_dlinterface_register], + [AC_CHECK_LIB([ltdl], [lt_dladvise_preload], + [with_included_ltdl=no], + [with_included_ltdl=yes])], + [with_included_ltdl=yes], + [AC_INCLUDES_DEFAULT + #include ])], + [with_included_ltdl=yes], + [AC_INCLUDES_DEFAULT] + ) +fi + +dnl If neither LT_CONFIG_LTDL_DIR, LTDL_CONVENIENCE nor LTDL_INSTALLABLE +dnl was called yet, then for old times' sake, we assume libltdl is in an +dnl eponymous directory: +AC_PROVIDE_IFELSE([LT_CONFIG_LTDL_DIR], [], [_LT_CONFIG_LTDL_DIR([libltdl])]) + +AC_ARG_WITH([ltdl_include], + [AS_HELP_STRING([--with-ltdl-include=DIR], + [use the ltdl headers installed in DIR])]) + +if test -n "$with_ltdl_include"; then + if test -f "$with_ltdl_include/ltdl.h"; then : + else + AC_MSG_ERROR([invalid ltdl include directory: `$with_ltdl_include']) + fi +else + with_ltdl_include=no +fi + +AC_ARG_WITH([ltdl_lib], + [AS_HELP_STRING([--with-ltdl-lib=DIR], + [use the libltdl.la installed in DIR])]) + +if test -n "$with_ltdl_lib"; then + if test -f "$with_ltdl_lib/libltdl.la"; then : + else + AC_MSG_ERROR([invalid ltdl library directory: `$with_ltdl_lib']) + fi +else + with_ltdl_lib=no +fi + +case ,$with_included_ltdl,$with_ltdl_include,$with_ltdl_lib, in + ,yes,no,no,) + m4_case(m4_default(_LTDL_TYPE, [convenience]), + [convenience], [_LTDL_CONVENIENCE], + [installable], [_LTDL_INSTALLABLE], + [m4_fatal([unknown libltdl build type: ]_LTDL_TYPE)]) + ;; + ,no,no,no,) + # If the included ltdl is not to be used, then use the + # preinstalled libltdl we found. + AC_DEFINE([HAVE_LTDL], [1], + [Define this if a modern libltdl is already installed]) + LIBLTDL=-lltdl + LTDLDEPS= + LTDLINCL= + ;; + ,no*,no,*) + AC_MSG_ERROR([`--with-ltdl-include' and `--with-ltdl-lib' options must be used together]) + ;; + *) with_included_ltdl=no + LIBLTDL="-L$with_ltdl_lib -lltdl" + LTDLDEPS= + LTDLINCL="-I$with_ltdl_include" + ;; +esac +INCLTDL="$LTDLINCL" + +# Report our decision... +AC_MSG_CHECKING([where to find libltdl headers]) +AC_MSG_RESULT([$LTDLINCL]) +AC_MSG_CHECKING([where to find libltdl library]) +AC_MSG_RESULT([$LIBLTDL]) + +_LTDL_SETUP + +dnl restore autoconf definition. +m4_popdef([AC_LIBOBJ]) +m4_popdef([AC_LIBSOURCES]) + +AC_CONFIG_COMMANDS_PRE([ + _ltdl_libobjs= + _ltdl_ltlibobjs= + if test -n "$_LT_LIBOBJS"; then + # Remove the extension. + _lt_sed_drop_objext='s/\.o$//;s/\.obj$//' + for i in `for i in $_LT_LIBOBJS; do echo "$i"; done | sed "$_lt_sed_drop_objext" | sort -u`; do + _ltdl_libobjs="$_ltdl_libobjs $lt_libobj_prefix$i.$ac_objext" + _ltdl_ltlibobjs="$_ltdl_ltlibobjs $lt_libobj_prefix$i.lo" + done + fi + AC_SUBST([ltdl_LIBOBJS], [$_ltdl_libobjs]) + AC_SUBST([ltdl_LTLIBOBJS], [$_ltdl_ltlibobjs]) +]) + +# Only expand once: +m4_define([LTDL_INIT]) +])# LTDL_INIT + +# Old names: +AU_DEFUN([AC_LIB_LTDL], [LTDL_INIT($@)]) +AU_DEFUN([AC_WITH_LTDL], [LTDL_INIT($@)]) +AU_DEFUN([LT_WITH_LTDL], [LTDL_INIT($@)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIB_LTDL], []) +dnl AC_DEFUN([AC_WITH_LTDL], []) +dnl AC_DEFUN([LT_WITH_LTDL], []) + + +# _LTDL_SETUP +# ----------- +# Perform all the checks necessary for compilation of the ltdl objects +# -- including compiler checks and header checks. This is a public +# interface mainly for the benefit of libltdl's own configure.ac, most +# other users should call LTDL_INIT instead. +AC_DEFUN([_LTDL_SETUP], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_SYS_MODULE_EXT])dnl +AC_REQUIRE([LT_SYS_MODULE_PATH])dnl +AC_REQUIRE([LT_SYS_DLSEARCH_PATH])dnl +AC_REQUIRE([LT_LIB_DLLOAD])dnl +AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl +AC_REQUIRE([LT_FUNC_DLSYM_USCORE])dnl +AC_REQUIRE([LT_SYS_DLOPEN_DEPLIBS])dnl +AC_REQUIRE([gl_FUNC_ARGZ])dnl + +m4_require([_LT_CHECK_OBJDIR])dnl +m4_require([_LT_HEADER_DLFCN])dnl +m4_require([_LT_CHECK_DLPREOPEN])dnl +m4_require([_LT_DECL_SED])dnl + +dnl Don't require this, or it will be expanded earlier than the code +dnl that sets the variables it relies on: +_LT_ENABLE_INSTALL + +dnl _LTDL_MODE specific code must be called at least once: +_LTDL_MODE_DISPATCH + +# In order that ltdl.c can compile, find out the first AC_CONFIG_HEADERS +# the user used. This is so that ltdl.h can pick up the parent projects +# config.h file, The first file in AC_CONFIG_HEADERS must contain the +# definitions required by ltdl.c. +# FIXME: Remove use of undocumented AC_LIST_HEADERS (2.59 compatibility). +AC_CONFIG_COMMANDS_PRE([dnl +m4_pattern_allow([^LT_CONFIG_H$])dnl +m4_ifset([AH_HEADER], + [LT_CONFIG_H=AH_HEADER], + [m4_ifset([AC_LIST_HEADERS], + [LT_CONFIG_H=`echo "AC_LIST_HEADERS" | $SED 's,^[[ ]]*,,;s,[[ :]].*$,,'`], + [])])]) +AC_SUBST([LT_CONFIG_H]) + +AC_CHECK_HEADERS([unistd.h dl.h sys/dl.h dld.h mach-o/dyld.h dirent.h], + [], [], [AC_INCLUDES_DEFAULT]) + +AC_CHECK_FUNCS([closedir opendir readdir], [], [AC_LIBOBJ([lt__dirent])]) +AC_CHECK_FUNCS([strlcat strlcpy], [], [AC_LIBOBJ([lt__strl])]) + +m4_pattern_allow([LT_LIBEXT])dnl +AC_DEFINE_UNQUOTED([LT_LIBEXT],["$libext"],[The archive extension]) + +name= +eval "lt_libprefix=\"$libname_spec\"" +m4_pattern_allow([LT_LIBPREFIX])dnl +AC_DEFINE_UNQUOTED([LT_LIBPREFIX],["$lt_libprefix"],[The archive prefix]) + +name=ltdl +eval "LTDLOPEN=\"$libname_spec\"" +AC_SUBST([LTDLOPEN]) +])# _LTDL_SETUP + + +# _LT_ENABLE_INSTALL +# ------------------ +m4_define([_LT_ENABLE_INSTALL], +[AC_ARG_ENABLE([ltdl-install], + [AS_HELP_STRING([--enable-ltdl-install], [install libltdl])]) + +case ,${enable_ltdl_install},${enable_ltdl_convenience} in + *yes*) ;; + *) enable_ltdl_convenience=yes ;; +esac + +m4_ifdef([AM_CONDITIONAL], +[AM_CONDITIONAL(INSTALL_LTDL, test x"${enable_ltdl_install-no}" != xno) + AM_CONDITIONAL(CONVENIENCE_LTDL, test x"${enable_ltdl_convenience-no}" != xno)]) +])# _LT_ENABLE_INSTALL + + +# LT_SYS_DLOPEN_DEPLIBS +# --------------------- +AC_DEFUN([LT_SYS_DLOPEN_DEPLIBS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_CACHE_CHECK([whether deplibs are loaded by dlopen], + [lt_cv_sys_dlopen_deplibs], + [# PORTME does your system automatically load deplibs for dlopen? + # or its logical equivalent (e.g. shl_load for HP-UX < 11) + # For now, we just catch OSes we know something about -- in the + # future, we'll try test this programmatically. + lt_cv_sys_dlopen_deplibs=unknown + case $host_os in + aix3*|aix4.1.*|aix4.2.*) + # Unknown whether this is true for these versions of AIX, but + # we want this `case' here to explicitly catch those versions. + lt_cv_sys_dlopen_deplibs=unknown + ;; + aix[[4-9]]*) + lt_cv_sys_dlopen_deplibs=yes + ;; + amigaos*) + case $host_cpu in + powerpc) + lt_cv_sys_dlopen_deplibs=no + ;; + esac + ;; + darwin*) + # Assuming the user has installed a libdl from somewhere, this is true + # If you are looking for one http://www.opendarwin.org/projects/dlcompat + lt_cv_sys_dlopen_deplibs=yes + ;; + freebsd* | dragonfly*) + lt_cv_sys_dlopen_deplibs=yes + ;; + gnu* | linux* | k*bsd*-gnu | kopensolaris*-gnu) + # GNU and its variants, using gnu ld.so (Glibc) + lt_cv_sys_dlopen_deplibs=yes + ;; + hpux10*|hpux11*) + lt_cv_sys_dlopen_deplibs=yes + ;; + interix*) + lt_cv_sys_dlopen_deplibs=yes + ;; + irix[[12345]]*|irix6.[[01]]*) + # Catch all versions of IRIX before 6.2, and indicate that we don't + # know how it worked for any of those versions. + lt_cv_sys_dlopen_deplibs=unknown + ;; + irix*) + # The case above catches anything before 6.2, and it's known that + # at 6.2 and later dlopen does load deplibs. + lt_cv_sys_dlopen_deplibs=yes + ;; + netbsd*) + lt_cv_sys_dlopen_deplibs=yes + ;; + openbsd*) + lt_cv_sys_dlopen_deplibs=yes + ;; + osf[[1234]]*) + # dlopen did load deplibs (at least at 4.x), but until the 5.x series, + # it did *not* use an RPATH in a shared library to find objects the + # library depends on, so we explicitly say `no'. + lt_cv_sys_dlopen_deplibs=no + ;; + osf5.0|osf5.0a|osf5.1) + # dlopen *does* load deplibs and with the right loader patch applied + # it even uses RPATH in a shared library to search for shared objects + # that the library depends on, but there's no easy way to know if that + # patch is installed. Since this is the case, all we can really + # say is unknown -- it depends on the patch being installed. If + # it is, this changes to `yes'. Without it, it would be `no'. + lt_cv_sys_dlopen_deplibs=unknown + ;; + osf*) + # the two cases above should catch all versions of osf <= 5.1. Read + # the comments above for what we know about them. + # At > 5.1, deplibs are loaded *and* any RPATH in a shared library + # is used to find them so we can finally say `yes'. + lt_cv_sys_dlopen_deplibs=yes + ;; + qnx*) + lt_cv_sys_dlopen_deplibs=yes + ;; + solaris*) + lt_cv_sys_dlopen_deplibs=yes + ;; + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + libltdl_cv_sys_dlopen_deplibs=yes + ;; + esac + ]) +if test "$lt_cv_sys_dlopen_deplibs" != yes; then + AC_DEFINE([LTDL_DLOPEN_DEPLIBS], [1], + [Define if the OS needs help to load dependent libraries for dlopen().]) +fi +])# LT_SYS_DLOPEN_DEPLIBS + +# Old name: +AU_ALIAS([AC_LTDL_SYS_DLOPEN_DEPLIBS], [LT_SYS_DLOPEN_DEPLIBS]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SYS_DLOPEN_DEPLIBS], []) + + +# LT_SYS_MODULE_EXT +# ----------------- +AC_DEFUN([LT_SYS_MODULE_EXT], +[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl +AC_CACHE_CHECK([which extension is used for runtime loadable modules], + [libltdl_cv_shlibext], +[ +module=yes +eval libltdl_cv_shlibext=$shrext_cmds + ]) +if test -n "$libltdl_cv_shlibext"; then + m4_pattern_allow([LT_MODULE_EXT])dnl + AC_DEFINE_UNQUOTED([LT_MODULE_EXT], ["$libltdl_cv_shlibext"], + [Define to the extension used for runtime loadable modules, say, ".so".]) +fi +])# LT_SYS_MODULE_EXT + +# Old name: +AU_ALIAS([AC_LTDL_SHLIBEXT], [LT_SYS_MODULE_EXT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SHLIBEXT], []) + + +# LT_SYS_MODULE_PATH +# ------------------ +AC_DEFUN([LT_SYS_MODULE_PATH], +[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl +AC_CACHE_CHECK([which variable specifies run-time module search path], + [lt_cv_module_path_var], [lt_cv_module_path_var="$shlibpath_var"]) +if test -n "$lt_cv_module_path_var"; then + m4_pattern_allow([LT_MODULE_PATH_VAR])dnl + AC_DEFINE_UNQUOTED([LT_MODULE_PATH_VAR], ["$lt_cv_module_path_var"], + [Define to the name of the environment variable that determines the run-time module search path.]) +fi +])# LT_SYS_MODULE_PATH + +# Old name: +AU_ALIAS([AC_LTDL_SHLIBPATH], [LT_SYS_MODULE_PATH]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SHLIBPATH], []) + + +# LT_SYS_DLSEARCH_PATH +# -------------------- +AC_DEFUN([LT_SYS_DLSEARCH_PATH], +[m4_require([_LT_SYS_DYNAMIC_LINKER])dnl +AC_CACHE_CHECK([for the default library search path], + [lt_cv_sys_dlsearch_path], + [lt_cv_sys_dlsearch_path="$sys_lib_dlsearch_path_spec"]) +if test -n "$lt_cv_sys_dlsearch_path"; then + sys_dlsearch_path= + for dir in $lt_cv_sys_dlsearch_path; do + if test -z "$sys_dlsearch_path"; then + sys_dlsearch_path="$dir" + else + sys_dlsearch_path="$sys_dlsearch_path$PATH_SEPARATOR$dir" + fi + done + m4_pattern_allow([LT_DLSEARCH_PATH])dnl + AC_DEFINE_UNQUOTED([LT_DLSEARCH_PATH], ["$sys_dlsearch_path"], + [Define to the system default library search path.]) +fi +])# LT_SYS_DLSEARCH_PATH + +# Old name: +AU_ALIAS([AC_LTDL_SYSSEARCHPATH], [LT_SYS_DLSEARCH_PATH]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SYSSEARCHPATH], []) + + +# _LT_CHECK_DLPREOPEN +# ------------------- +m4_defun([_LT_CHECK_DLPREOPEN], +[m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +AC_CACHE_CHECK([whether libtool supports -dlopen/-dlpreopen], + [libltdl_cv_preloaded_symbols], + [if test -n "$lt_cv_sys_global_symbol_pipe"; then + libltdl_cv_preloaded_symbols=yes + else + libltdl_cv_preloaded_symbols=no + fi + ]) +if test x"$libltdl_cv_preloaded_symbols" = xyes; then + AC_DEFINE([HAVE_PRELOADED_SYMBOLS], [1], + [Define if libtool can extract symbol lists from object files.]) +fi +])# _LT_CHECK_DLPREOPEN + + +# LT_LIB_DLLOAD +# ------------- +AC_DEFUN([LT_LIB_DLLOAD], +[m4_pattern_allow([^LT_DLLOADERS$]) +LT_DLLOADERS= +AC_SUBST([LT_DLLOADERS]) + +AC_LANG_PUSH([C]) + +LIBADD_DLOPEN= +AC_SEARCH_LIBS([dlopen], [dl], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + if test "$ac_cv_search_dlopen" != "none required" ; then + LIBADD_DLOPEN="-ldl" + fi + libltdl_cv_lib_dl_dlopen="yes" + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], + [AC_LINK_IFELSE([AC_LANG_PROGRAM([[#if HAVE_DLFCN_H +# include +#endif + ]], [[dlopen(0, 0);]])], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + libltdl_cv_func_dlopen="yes" + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"], + [AC_CHECK_LIB([svld], [dlopen], + [AC_DEFINE([HAVE_LIBDL], [1], + [Define if you have the libdl library or equivalent.]) + LIBADD_DLOPEN="-lsvld" libltdl_cv_func_dlopen="yes" + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dlopen.la"])])]) +if test x"$libltdl_cv_func_dlopen" = xyes || test x"$libltdl_cv_lib_dl_dlopen" = xyes +then + lt_save_LIBS="$LIBS" + LIBS="$LIBS $LIBADD_DLOPEN" + AC_CHECK_FUNCS([dlerror]) + LIBS="$lt_save_LIBS" +fi +AC_SUBST([LIBADD_DLOPEN]) + +LIBADD_SHL_LOAD= +AC_CHECK_FUNC([shl_load], + [AC_DEFINE([HAVE_SHL_LOAD], [1], + [Define if you have the shl_load function.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la"], + [AC_CHECK_LIB([dld], [shl_load], + [AC_DEFINE([HAVE_SHL_LOAD], [1], + [Define if you have the shl_load function.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}shl_load.la" + LIBADD_SHL_LOAD="-ldld"])]) +AC_SUBST([LIBADD_SHL_LOAD]) + +case $host_os in +darwin[[1567]].*) +# We only want this for pre-Mac OS X 10.4. + AC_CHECK_FUNC([_dyld_func_lookup], + [AC_DEFINE([HAVE_DYLD], [1], + [Define if you have the _dyld_func_lookup function.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dyld.la"]) + ;; +beos*) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}load_add_on.la" + ;; +cygwin* | mingw* | os2* | pw32*) + AC_CHECK_DECLS([cygwin_conv_path], [], [], [[#include ]]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}loadlibrary.la" + ;; +esac + +AC_CHECK_LIB([dld], [dld_link], + [AC_DEFINE([HAVE_DLD], [1], + [Define if you have the GNU dld library.]) + LT_DLLOADERS="$LT_DLLOADERS ${lt_dlopen_dir+$lt_dlopen_dir/}dld_link.la"]) +AC_SUBST([LIBADD_DLD_LINK]) + +m4_pattern_allow([^LT_DLPREOPEN$]) +LT_DLPREOPEN= +if test -n "$LT_DLLOADERS" +then + for lt_loader in $LT_DLLOADERS; do + LT_DLPREOPEN="$LT_DLPREOPEN-dlpreopen $lt_loader " + done + AC_DEFINE([HAVE_LIBDLLOADER], [1], + [Define if libdlloader will be built on this platform]) +fi +AC_SUBST([LT_DLPREOPEN]) + +dnl This isn't used anymore, but set it for backwards compatibility +LIBADD_DL="$LIBADD_DLOPEN $LIBADD_SHL_LOAD" +AC_SUBST([LIBADD_DL]) + +AC_LANG_POP +])# LT_LIB_DLLOAD + +# Old name: +AU_ALIAS([AC_LTDL_DLLIB], [LT_LIB_DLLOAD]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_DLLIB], []) + + +# LT_SYS_SYMBOL_USCORE +# -------------------- +# does the compiler prefix global symbols with an underscore? +AC_DEFUN([LT_SYS_SYMBOL_USCORE], +[m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +AC_CACHE_CHECK([for _ prefix in compiled symbols], + [lt_cv_sys_symbol_underscore], + [lt_cv_sys_symbol_underscore=no + cat > conftest.$ac_ext <<_LT_EOF +void nm_test_func(){} +int main(){nm_test_func;return 0;} +_LT_EOF + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + ac_nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) && test -s "$ac_nlist"; then + # See whether the symbols have a leading underscore. + if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then + lt_cv_sys_symbol_underscore=yes + else + if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then + : + else + echo "configure: cannot find nm_test_func in $ac_nlist" >&AS_MESSAGE_LOG_FD + fi + fi + else + echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "configure: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.c >&AS_MESSAGE_LOG_FD + fi + rm -rf conftest* + ]) + sys_symbol_underscore=$lt_cv_sys_symbol_underscore + AC_SUBST([sys_symbol_underscore]) +])# LT_SYS_SYMBOL_USCORE + +# Old name: +AU_ALIAS([AC_LTDL_SYMBOL_USCORE], [LT_SYS_SYMBOL_USCORE]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_SYMBOL_USCORE], []) + + +# LT_FUNC_DLSYM_USCORE +# -------------------- +AC_DEFUN([LT_FUNC_DLSYM_USCORE], +[AC_REQUIRE([LT_SYS_SYMBOL_USCORE])dnl +if test x"$lt_cv_sys_symbol_underscore" = xyes; then + if test x"$libltdl_cv_func_dlopen" = xyes || + test x"$libltdl_cv_lib_dl_dlopen" = xyes ; then + AC_CACHE_CHECK([whether we have to add an underscore for dlsym], + [libltdl_cv_need_uscore], + [libltdl_cv_need_uscore=unknown + save_LIBS="$LIBS" + LIBS="$LIBS $LIBADD_DLOPEN" + _LT_TRY_DLOPEN_SELF( + [libltdl_cv_need_uscore=no], [libltdl_cv_need_uscore=yes], + [], [libltdl_cv_need_uscore=cross]) + LIBS="$save_LIBS" + ]) + fi +fi + +if test x"$libltdl_cv_need_uscore" = xyes; then + AC_DEFINE([NEED_USCORE], [1], + [Define if dlsym() requires a leading underscore in symbol names.]) +fi +])# LT_FUNC_DLSYM_USCORE + +# Old name: +AU_ALIAS([AC_LTDL_DLSYM_USCORE], [LT_FUNC_DLSYM_USCORE]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LTDL_DLSYM_USCORE], []) + +# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_AUTOMAKE_VERSION(VERSION) +# ---------------------------- +# Automake X.Y traces this macro to ensure aclocal.m4 has been +# generated from the m4 files accompanying Automake X.Y. +# (This private macro should not be called outside this file.) +AC_DEFUN([AM_AUTOMAKE_VERSION], +[am__api_version='1.11' +dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to +dnl require some minimum version. Point them to the right macro. +m4_if([$1], [1.11.1], [], + [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl +]) + +# _AM_AUTOCONF_VERSION(VERSION) +# ----------------------------- +# aclocal traces this macro to find the Autoconf version. +# This is a private macro too. Using m4_define simplifies +# the logic in aclocal, which can simply ignore this definition. +m4_define([_AM_AUTOCONF_VERSION], []) + +# AM_SET_CURRENT_AUTOMAKE_VERSION +# ------------------------------- +# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. +# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. +AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], +[AM_AUTOMAKE_VERSION([1.11.1])dnl +m4_ifndef([AC_AUTOCONF_VERSION], + [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl +_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) + +# Figure out how to run the assembler. -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_PROG_AS +# ---------- +AC_DEFUN([AM_PROG_AS], +[# By default we simply use the C compiler to build assembly code. +AC_REQUIRE([AC_PROG_CC]) +test "${CCAS+set}" = set || CCAS=$CC +test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS +AC_ARG_VAR([CCAS], [assembler compiler command (defaults to CC)]) +AC_ARG_VAR([CCASFLAGS], [assembler compiler flags (defaults to CFLAGS)]) +_AM_IF_OPTION([no-dependencies],, [_AM_DEPENDENCIES([CCAS])])dnl +]) + +# AM_AUX_DIR_EXPAND -*- Autoconf -*- + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets +# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to +# `$srcdir', `$srcdir/..', or `$srcdir/../..'. +# +# Of course, Automake must honor this variable whenever it calls a +# tool from the auxiliary directory. The problem is that $srcdir (and +# therefore $ac_aux_dir as well) can be either absolute or relative, +# depending on how configure is run. This is pretty annoying, since +# it makes $ac_aux_dir quite unusable in subdirectories: in the top +# source directory, any form will work fine, but in subdirectories a +# relative path needs to be adjusted first. +# +# $ac_aux_dir/missing +# fails when called from a subdirectory if $ac_aux_dir is relative +# $top_srcdir/$ac_aux_dir/missing +# fails if $ac_aux_dir is absolute, +# fails when called from a subdirectory in a VPATH build with +# a relative $ac_aux_dir +# +# The reason of the latter failure is that $top_srcdir and $ac_aux_dir +# are both prefixed by $srcdir. In an in-source build this is usually +# harmless because $srcdir is `.', but things will broke when you +# start a VPATH build or use an absolute $srcdir. +# +# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, +# iff we strip the leading $srcdir from $ac_aux_dir. That would be: +# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` +# and then we would define $MISSING as +# MISSING="\${SHELL} $am_aux_dir/missing" +# This will work as long as MISSING is not called from configure, because +# unfortunately $(top_srcdir) has no meaning in configure. +# However there are other variables, like CC, which are often used in +# configure, and could therefore not use this "fixed" $ac_aux_dir. +# +# Another solution, used here, is to always expand $ac_aux_dir to an +# absolute PATH. The drawback is that using absolute paths prevent a +# configured tree to be moved without reconfiguration. + +AC_DEFUN([AM_AUX_DIR_EXPAND], +[dnl Rely on autoconf to set up CDPATH properly. +AC_PREREQ([2.50])dnl +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` +]) + +# AM_CONDITIONAL -*- Autoconf -*- + +# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 9 + +# AM_CONDITIONAL(NAME, SHELL-CONDITION) +# ------------------------------------- +# Define a conditional. +AC_DEFUN([AM_CONDITIONAL], +[AC_PREREQ(2.52)dnl + ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], + [$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl +AC_SUBST([$1_TRUE])dnl +AC_SUBST([$1_FALSE])dnl +_AM_SUBST_NOTMAKE([$1_TRUE])dnl +_AM_SUBST_NOTMAKE([$1_FALSE])dnl +m4_define([_AM_COND_VALUE_$1], [$2])dnl +if $2; then + $1_TRUE= + $1_FALSE='#' +else + $1_TRUE='#' + $1_FALSE= +fi +AC_CONFIG_COMMANDS_PRE( +[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then + AC_MSG_ERROR([[conditional "$1" was never defined. +Usually this means the macro was only invoked conditionally.]]) +fi])]) + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 10 + +# There are a few dirty hacks below to avoid letting `AC_PROG_CC' be +# written in clear, in which case automake, when reading aclocal.m4, +# will think it sees a *use*, and therefore will trigger all it's +# C support machinery. Also note that it means that autoscan, seeing +# CC etc. in the Makefile, will ask for an AC_PROG_CC use... + + +# _AM_DEPENDENCIES(NAME) +# ---------------------- +# See how the compiler implements dependency checking. +# NAME is "CC", "CXX", "GCJ", or "OBJC". +# We try a few techniques and use that to set a single cache variable. +# +# We don't AC_REQUIRE the corresponding AC_PROG_CC since the latter was +# modified to invoke _AM_DEPENDENCIES(CC); we would have a circular +# dependency, and given that the user is not expected to run this macro, +# just rely on AC_PROG_CC. +AC_DEFUN([_AM_DEPENDENCIES], +[AC_REQUIRE([AM_SET_DEPDIR])dnl +AC_REQUIRE([AM_OUTPUT_DEPENDENCY_COMMANDS])dnl +AC_REQUIRE([AM_MAKE_INCLUDE])dnl +AC_REQUIRE([AM_DEP_TRACK])dnl + +ifelse([$1], CC, [depcc="$CC" am_compiler_list=], + [$1], CXX, [depcc="$CXX" am_compiler_list=], + [$1], OBJC, [depcc="$OBJC" am_compiler_list='gcc3 gcc'], + [$1], UPC, [depcc="$UPC" am_compiler_list=], + [$1], GCJ, [depcc="$GCJ" am_compiler_list='gcc3 gcc'], + [depcc="$$1" am_compiler_list=]) + +AC_CACHE_CHECK([dependency style of $depcc], + [am_cv_$1_dependencies_compiler_type], +[if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_$1_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n ['s/^#*\([a-zA-Z0-9]*\))$/\1/p'] < ./depcomp` + fi + am__universal=false + m4_case([$1], [CC], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac], + [CXX], + [case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac]) + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_$1_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_$1_dependencies_compiler_type=none +fi +]) +AC_SUBST([$1DEPMODE], [depmode=$am_cv_$1_dependencies_compiler_type]) +AM_CONDITIONAL([am__fastdep$1], [ + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_$1_dependencies_compiler_type" = gcc3]) +]) + + +# AM_SET_DEPDIR +# ------------- +# Choose a directory name for dependency files. +# This macro is AC_REQUIREd in _AM_DEPENDENCIES +AC_DEFUN([AM_SET_DEPDIR], +[AC_REQUIRE([AM_SET_LEADING_DOT])dnl +AC_SUBST([DEPDIR], ["${am__leading_dot}deps"])dnl +]) + + +# AM_DEP_TRACK +# ------------ +AC_DEFUN([AM_DEP_TRACK], +[AC_ARG_ENABLE(dependency-tracking, +[ --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors]) +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi +AM_CONDITIONAL([AMDEP], [test "x$enable_dependency_tracking" != xno]) +AC_SUBST([AMDEPBACKSLASH])dnl +_AM_SUBST_NOTMAKE([AMDEPBACKSLASH])dnl +]) + +# Generate code to set up dependency tracking. -*- Autoconf -*- + +# Copyright (C) 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +#serial 5 + +# _AM_OUTPUT_DEPENDENCY_COMMANDS +# ------------------------------ +AC_DEFUN([_AM_OUTPUT_DEPENDENCY_COMMANDS], +[{ + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`AS_DIRNAME("$mf")` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`AS_DIRNAME(["$file"])` + AS_MKDIR_P([$dirpart/$fdir]) + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} +])# _AM_OUTPUT_DEPENDENCY_COMMANDS + + +# AM_OUTPUT_DEPENDENCY_COMMANDS +# ----------------------------- +# This macro should only be invoked once -- use via AC_REQUIRE. +# +# This code is only required when automatic dependency tracking +# is enabled. FIXME. This creates each `.P' file that we will +# need in order to bootstrap the dependency handling code. +AC_DEFUN([AM_OUTPUT_DEPENDENCY_COMMANDS], +[AC_CONFIG_COMMANDS([depfiles], + [test x"$AMDEP_TRUE" != x"" || _AM_OUTPUT_DEPENDENCY_COMMANDS], + [AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir"]) +]) + +# Do all the work for Automake. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, +# 2005, 2006, 2008, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 16 + +# This macro actually does too much. Some checks are only needed if +# your package does certain things. But this isn't really a big deal. + +# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) +# AM_INIT_AUTOMAKE([OPTIONS]) +# ----------------------------------------------- +# The call with PACKAGE and VERSION arguments is the old style +# call (pre autoconf-2.50), which is being phased out. PACKAGE +# and VERSION should now be passed to AC_INIT and removed from +# the call to AM_INIT_AUTOMAKE. +# We support both call styles for the transition. After +# the next Automake release, Autoconf can make the AC_INIT +# arguments mandatory, and then we can depend on a new Autoconf +# release and drop the old call support. +AC_DEFUN([AM_INIT_AUTOMAKE], +[AC_PREREQ([2.62])dnl +dnl Autoconf wants to disallow AM_ names. We explicitly allow +dnl the ones we care about. +m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl +AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl +AC_REQUIRE([AC_PROG_INSTALL])dnl +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi +AC_SUBST([CYGPATH_W]) + +# Define the identity of the package. +dnl Distinguish between old-style and new-style calls. +m4_ifval([$2], +[m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl + AC_SUBST([PACKAGE], [$1])dnl + AC_SUBST([VERSION], [$2])], +[_AM_SET_OPTIONS([$1])dnl +dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. +m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,, + [m4_fatal([AC_INIT should be called with package and version arguments])])dnl + AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl + AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl + +_AM_IF_OPTION([no-define],, +[AC_DEFINE_UNQUOTED(PACKAGE, "$PACKAGE", [Name of package]) + AC_DEFINE_UNQUOTED(VERSION, "$VERSION", [Version number of package])])dnl + +# Some tools Automake needs. +AC_REQUIRE([AM_SANITY_CHECK])dnl +AC_REQUIRE([AC_ARG_PROGRAM])dnl +AM_MISSING_PROG(ACLOCAL, aclocal-${am__api_version}) +AM_MISSING_PROG(AUTOCONF, autoconf) +AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version}) +AM_MISSING_PROG(AUTOHEADER, autoheader) +AM_MISSING_PROG(MAKEINFO, makeinfo) +AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl +AC_REQUIRE([AM_PROG_MKDIR_P])dnl +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([AC_PROG_MAKE_SET])dnl +AC_REQUIRE([AM_SET_LEADING_DOT])dnl +_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], + [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], + [_AM_PROG_TAR([v7])])]) +_AM_IF_OPTION([no-dependencies],, +[AC_PROVIDE_IFELSE([AC_PROG_CC], + [_AM_DEPENDENCIES(CC)], + [define([AC_PROG_CC], + defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_CXX], + [_AM_DEPENDENCIES(CXX)], + [define([AC_PROG_CXX], + defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl +AC_PROVIDE_IFELSE([AC_PROG_OBJC], + [_AM_DEPENDENCIES(OBJC)], + [define([AC_PROG_OBJC], + defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl +]) +_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl +dnl The `parallel-tests' driver may need to know about EXEEXT, so add the +dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro +dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. +AC_CONFIG_COMMANDS_PRE(dnl +[m4_provide_if([_AM_COMPILER_EXEEXT], + [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl +]) + +dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not +dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further +dnl mangled by Autoconf and run in a shell conditional statement. +m4_define([_AC_COMPILER_EXEEXT], +m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) + + +# When config.status generates a header, we must update the stamp-h file. +# This file resides in the same directory as the config header +# that is generated. The stamp files are numbered to have different names. + +# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the +# loop where config.status creates the headers, so we can generate +# our stamp files there. +AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], +[# Compute $1's index in $config_headers. +_am_arg=$1 +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) + +# Copyright (C) 2001, 2003, 2005, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_SH +# ------------------ +# Define $install_sh. +AC_DEFUN([AM_PROG_INSTALL_SH], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi +AC_SUBST(install_sh)]) + +# Copyright (C) 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# Check whether the underlying file-system supports filenames +# with a leading dot. For instance MS-DOS doesn't. +AC_DEFUN([AM_SET_LEADING_DOT], +[rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null +AC_SUBST([am__leading_dot])]) + +# Add --enable-maintainer-mode option to configure. -*- Autoconf -*- +# From Jim Meyering + +# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_MAINTAINER_MODE([DEFAULT-MODE]) +# ---------------------------------- +# Control maintainer-specific portions of Makefiles. +# Default is to disable them, unless `enable' is passed literally. +# For symmetry, `disable' may be passed as well. Anyway, the user +# can override the default with the --enable/--disable switch. +AC_DEFUN([AM_MAINTAINER_MODE], +[m4_case(m4_default([$1], [disable]), + [enable], [m4_define([am_maintainer_other], [disable])], + [disable], [m4_define([am_maintainer_other], [enable])], + [m4_define([am_maintainer_other], [enable]) + m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])]) +AC_MSG_CHECKING([whether to am_maintainer_other maintainer-specific portions of Makefiles]) + dnl maintainer-mode's default is 'disable' unless 'enable' is passed + AC_ARG_ENABLE([maintainer-mode], +[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful + (and sometimes confusing) to the casual installer], + [USE_MAINTAINER_MODE=$enableval], + [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes])) + AC_MSG_RESULT([$USE_MAINTAINER_MODE]) + AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes]) + MAINT=$MAINTAINER_MODE_TRUE + AC_SUBST([MAINT])dnl +] +) + +AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE]) + +# Check to see how 'make' treats includes. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2009 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# AM_MAKE_INCLUDE() +# ----------------- +# Check to see how make treats includes. +AC_DEFUN([AM_MAKE_INCLUDE], +[am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +AC_MSG_CHECKING([for style of include used by $am_make]) +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi +AC_SUBST([am__include]) +AC_SUBST([am__quote]) +AC_MSG_RESULT([$_am_result]) +rm -f confinc confmf +]) + +# Copyright (C) 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# AM_PROG_CC_C_O +# -------------- +# Like AC_PROG_CC_C_O, but changed for automake. +AC_DEFUN([AM_PROG_CC_C_O], +[AC_REQUIRE([AC_PROG_CC_C_O])dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([compile])dnl +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +am_cc=`echo $[2] | sed ['s/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/']` +eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o +if test "$am_t" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi +dnl Make sure AC_PROG_CC is never called again, or it will override our +dnl setting of CC. +m4_define([AC_PROG_CC], + [m4_fatal([AC_PROG_CC cannot be called after AM_PROG_CC_C_O])]) +]) + +# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- + +# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 6 + +# AM_MISSING_PROG(NAME, PROGRAM) +# ------------------------------ +AC_DEFUN([AM_MISSING_PROG], +[AC_REQUIRE([AM_MISSING_HAS_RUN]) +$1=${$1-"${am_missing_run}$2"} +AC_SUBST($1)]) + + +# AM_MISSING_HAS_RUN +# ------------------ +# Define MISSING if not defined so far and test if it supports --run. +# If it does, set am_missing_run to use it, otherwise, to nothing. +AC_DEFUN([AM_MISSING_HAS_RUN], +[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl +AC_REQUIRE_AUX_FILE([missing])dnl +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + AC_MSG_WARN([`missing' script is too old or missing]) +fi +]) + +# Copyright (C) 2003, 2004, 2005, 2006 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_MKDIR_P +# --------------- +# Check for `mkdir -p'. +AC_DEFUN([AM_PROG_MKDIR_P], +[AC_PREREQ([2.60])dnl +AC_REQUIRE([AC_PROG_MKDIR_P])dnl +dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P, +dnl while keeping a definition of mkdir_p for backward compatibility. +dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile. +dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of +dnl Makefile.ins that do not define MKDIR_P, so we do our own +dnl adjustment using top_builddir (which is defined more often than +dnl MKDIR_P). +AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl +case $mkdir_p in + [[\\/$]]* | ?:[[\\/]]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac +]) + +# Helper functions for option handling. -*- Autoconf -*- + +# Copyright (C) 2001, 2002, 2003, 2005, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 4 + +# _AM_MANGLE_OPTION(NAME) +# ----------------------- +AC_DEFUN([_AM_MANGLE_OPTION], +[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) + +# _AM_SET_OPTION(NAME) +# ------------------------------ +# Set option NAME. Presently that only means defining a flag for this option. +AC_DEFUN([_AM_SET_OPTION], +[m4_define(_AM_MANGLE_OPTION([$1]), 1)]) + +# _AM_SET_OPTIONS(OPTIONS) +# ---------------------------------- +# OPTIONS is a space-separated list of Automake options. +AC_DEFUN([_AM_SET_OPTIONS], +[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) + +# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) +# ------------------------------------------- +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +AC_DEFUN([_AM_IF_OPTION], +[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) + +# Check to make sure that the build environment is sane. -*- Autoconf -*- + +# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008 +# Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 5 + +# AM_SANITY_CHECK +# --------------- +AC_DEFUN([AM_SANITY_CHECK], +[AC_MSG_CHECKING([whether build environment is sane]) +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[[\\\"\#\$\&\'\`$am_lf]]*) + AC_MSG_ERROR([unsafe absolute working directory name]);; +esac +case $srcdir in + *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) + AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$[*]" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$[*]" != "X $srcdir/configure conftest.file" \ + && test "$[*]" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken +alias in your environment]) + fi + + test "$[2]" = conftest.file + ) +then + # Ok. + : +else + AC_MSG_ERROR([newly created file is older than distributed files! +Check your system clock]) +fi +AC_MSG_RESULT(yes)]) + +# Copyright (C) 2001, 2003, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# AM_PROG_INSTALL_STRIP +# --------------------- +# One issue with vendor `install' (even GNU) is that you can't +# specify the program used to strip binaries. This is especially +# annoying in cross-compiling environments, where the build's strip +# is unlikely to handle the host's binaries. +# Fortunately install-sh will honor a STRIPPROG variable, so we +# always use install-sh in `make install-strip', and initialize +# STRIPPROG with the value of the STRIP variable (set by the user). +AC_DEFUN([AM_PROG_INSTALL_STRIP], +[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +dnl Don't test for $cross_compiling = yes, because it might be `maybe'. +if test "$cross_compiling" != no; then + AC_CHECK_TOOL([STRIP], [strip], :) +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" +AC_SUBST([INSTALL_STRIP_PROGRAM])]) + +# Copyright (C) 2006, 2008 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. +# This macro is traced by Automake. +AC_DEFUN([_AM_SUBST_NOTMAKE]) + +# AM_SUBST_NOTMAKE(VARIABLE) +# --------------------------- +# Public sister of _AM_SUBST_NOTMAKE. +AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) + +# Check how to create a tarball. -*- Autoconf -*- + +# Copyright (C) 2004, 2005 Free Software Foundation, Inc. +# +# This file is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# serial 2 + +# _AM_PROG_TAR(FORMAT) +# -------------------- +# Check how to create a tarball in format FORMAT. +# FORMAT should be one of `v7', `ustar', or `pax'. +# +# Substitute a variable $(am__tar) that is a command +# writing to stdout a FORMAT-tarball containing the directory +# $tardir. +# tardir=directory && $(am__tar) > result.tar +# +# Substitute a variable $(am__untar) that extract such +# a tarball read from stdin. +# $(am__untar) < result.tar +AC_DEFUN([_AM_PROG_TAR], +[# Always define AMTAR for backward compatibility. +AM_MISSING_PROG([AMTAR], [tar]) +m4_if([$1], [v7], + [am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -'], + [m4_case([$1], [ustar],, [pax],, + [m4_fatal([Unknown tar format])]) +AC_MSG_CHECKING([how to create a $1 tar archive]) +# Loop over all known methods to create a tar archive until one works. +_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' +_am_tools=${am_cv_prog_tar_$1-$_am_tools} +# Do not fold the above two line into one, because Tru64 sh and +# Solaris sh will not grok spaces in the rhs of `-'. +for _am_tool in $_am_tools +do + case $_am_tool in + gnutar) + for _am_tar in tar gnutar gtar; + do + AM_RUN_LOG([$_am_tar --version]) && break + done + am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' + am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' + am__untar="$_am_tar -xf -" + ;; + plaintar) + # Must skip GNU tar: if it does not support --format= it doesn't create + # ustar tarball either. + (tar --version) >/dev/null 2>&1 && continue + am__tar='tar chf - "$$tardir"' + am__tar_='tar chf - "$tardir"' + am__untar='tar xf -' + ;; + pax) + am__tar='pax -L -x $1 -w "$$tardir"' + am__tar_='pax -L -x $1 -w "$tardir"' + am__untar='pax -r' + ;; + cpio) + am__tar='find "$$tardir" -print | cpio -o -H $1 -L' + am__tar_='find "$tardir" -print | cpio -o -H $1 -L' + am__untar='cpio -i -H $1 -d' + ;; + none) + am__tar=false + am__tar_=false + am__untar=false + ;; + esac + + # If the value was cached, stop now. We just wanted to have am__tar + # and am__untar set. + test -n "${am_cv_prog_tar_$1}" && break + + # tar/untar a dummy directory, and stop if the command works + rm -rf conftest.dir + mkdir conftest.dir + echo GrepMe > conftest.dir/file + AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) + rm -rf conftest.dir + if test -s conftest.tar; then + AM_RUN_LOG([$am__untar /dev/null 2>&1 && break + fi +done +rm -rf conftest.dir + +AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) +AC_MSG_RESULT([$am_cv_prog_tar_$1])]) +AC_SUBST([am__tar]) +AC_SUBST([am__untar]) +]) # _AM_PROG_TAR + +m4_include([m4/ax_cc_maxopt.m4]) +m4_include([m4/ax_cflags_warn_all.m4]) +m4_include([m4/ax_check_compiler_flags.m4]) +m4_include([m4/ax_compiler_vendor.m4]) +m4_include([m4/ax_configure_args.m4]) +m4_include([m4/ax_enable_builddir.m4]) +m4_include([m4/ax_gcc_archflag.m4]) +m4_include([m4/ax_gcc_x86_cpuid.m4]) +m4_include([m4/libtool.m4]) +m4_include([m4/ltoptions.m4]) +m4_include([m4/ltsugar.m4]) +m4_include([m4/ltversion.m4]) +m4_include([m4/lt~obsolete.m4]) +m4_include([acinclude.m4]) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/build-ios.sh b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/build-ios.sh new file mode 100755 index 000000000..3dea24225 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/build-ios.sh @@ -0,0 +1,67 @@ +#!/bin/sh + +PLATFORM_IOS=/Developer/Platforms/iPhoneOS.platform/ +PLATFORM_IOS_SIM=/Developer/Platforms/iPhoneSimulator.platform/ +SDK_IOS_VERSION="4.2" +MIN_IOS_VERSION="3.0" +OUTPUT_DIR="universal-ios" + +build_target () { + local platform=$1 + local sdk=$2 + local arch=$3 + local triple=$4 + local builddir=$5 + + mkdir -p "${builddir}" + pushd "${builddir}" + export CC="${platform}"/Developer/usr/bin/gcc-4.2 + export CFLAGS="-arch ${arch} -isysroot ${sdk} -miphoneos-version-min=${MIN_IOS_VERSION}" + ../configure --host=${triple} && make + popd +} + +# Build all targets +build_target "${PLATFORM_IOS}" "${PLATFORM_IOS}/Developer/SDKs/iPhoneOS${SDK_IOS_VERSION}.sdk/" armv6 arm-apple-darwin10 armv6-ios +build_target "${PLATFORM_IOS}" "${PLATFORM_IOS}/Developer/SDKs/iPhoneOS${SDK_IOS_VERSION}.sdk/" armv7 arm-apple-darwin10 armv7-ios +build_target "${PLATFORM_IOS_SIM}" "${PLATFORM_IOS_SIM}/Developer/SDKs/iPhoneSimulator${SDK_IOS_VERSION}.sdk/" i386 i386-apple-darwin10 i386-ios-sim + +# Create universal output directories +mkdir -p "${OUTPUT_DIR}" +mkdir -p "${OUTPUT_DIR}/include" +mkdir -p "${OUTPUT_DIR}/include/armv6" +mkdir -p "${OUTPUT_DIR}/include/armv7" +mkdir -p "${OUTPUT_DIR}/include/i386" + +# Create the universal binary +lipo -create armv6-ios/.libs/libffi.a armv7-ios/.libs/libffi.a i386-ios-sim/.libs/libffi.a -output "${OUTPUT_DIR}/libffi.a" + +# Copy in the headers +copy_headers () { + local src=$1 + local dest=$2 + + # Fix non-relative header reference + sed 's//"ffitarget.h"/' < "${src}/include/ffi.h" > "${dest}/ffi.h" + cp "${src}/include/ffitarget.h" "${dest}" +} + +copy_headers armv6-ios "${OUTPUT_DIR}/include/armv6" +copy_headers armv7-ios "${OUTPUT_DIR}/include/armv7" +copy_headers i386-ios-sim "${OUTPUT_DIR}/include/i386" + +# Create top-level header +( +cat << EOF +#ifdef __arm__ + #include + #ifdef _ARM_ARCH_6 + #include "include/armv6/ffi.h" + #elif _ARM_ARCH_7 + #include "include/armv7/ffi.h" + #endif +#elif defined(__i386__) + #include "include/i386/ffi.h" +#endif +EOF +) > "${OUTPUT_DIR}/ffi.h" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/compile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/compile new file mode 100755 index 000000000..c0096a7b5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/compile @@ -0,0 +1,143 @@ +#! /bin/sh +# Wrapper for compilers which do not understand `-c -o'. + +scriptversion=2009-10-06.20; # UTC + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2009 Free Software +# Foundation, Inc. +# Written by Tom Tromey . +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: compile [--help] [--version] PROGRAM [ARGS] + +Wrapper for compilers which do not understand `-c -o'. +Remove `-o dest.o' from ARGS, run PROGRAM with the remaining +arguments, and rename the output as expected. + +If you are trying to build a whole package this is not the +right script to run: please start by reading the file `INSTALL'. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "compile $scriptversion" + exit $? + ;; +esac + +ofile= +cfile= +eat= + +for arg +do + if test -n "$eat"; then + eat= + else + case $1 in + -o) + # configure might choose to run compile as `compile cc -o foo foo.c'. + # So we strip `-o arg' only if arg is an object. + eat=1 + case $2 in + *.o | *.obj) + ofile=$2 + ;; + *) + set x "$@" -o "$2" + shift + ;; + esac + ;; + *.c) + cfile=$1 + set x "$@" "$1" + shift + ;; + *) + set x "$@" "$1" + shift + ;; + esac + fi + shift +done + +if test -z "$ofile" || test -z "$cfile"; then + # If no `-o' option was seen then we might have been invoked from a + # pattern rule where we don't need one. That is ok -- this is a + # normal compilation that the losing compiler can handle. If no + # `.c' file was seen then we are probably linking. That is also + # ok. + exec "$@" +fi + +# Name of file we expect compiler to create. +cofile=`echo "$cfile" | sed 's|^.*[\\/]||; s|^[a-zA-Z]:||; s/\.c$/.o/'` + +# Create the lock directory. +# Note: use `[/\\:.-]' here to ensure that we don't use the same name +# that we are using for the .o file. Also, base the name on the expected +# object file name, since that is what matters with a parallel build. +lockdir=`echo "$cofile" | sed -e 's|[/\\:.-]|_|g'`.d +while true; do + if mkdir "$lockdir" >/dev/null 2>&1; then + break + fi + sleep 1 +done +# FIXME: race condition here if user kills between mkdir and trap. +trap "rmdir '$lockdir'; exit 1" 1 2 15 + +# Run the compile. +"$@" +ret=$? + +if test -f "$cofile"; then + test "$cofile" = "$ofile" || mv "$cofile" "$ofile" +elif test -f "${cofile}bj"; then + test "${cofile}bj" = "$ofile" || mv "${cofile}bj" "$ofile" +fi + +rmdir "$lockdir" +exit $ret + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/config.guess b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/config.guess new file mode 100755 index 000000000..dc84c68ef --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/config.guess @@ -0,0 +1,1501 @@ +#! /bin/sh +# Attempt to guess a canonical system name. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +# Free Software Foundation, Inc. + +timestamp='2009-11-20' + +# This file is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Originally written by Per Bothner. Please send patches (context +# diff format) to and include a ChangeLog +# entry. +# +# This script attempts to guess a canonical system name similar to +# config.sub. If it succeeds, it prints the system name on stdout, and +# exits with 0. Otherwise, it exits with 1. +# +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.guess;hb=HEAD + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] + +Output the configuration name of the system \`$me' is run on. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.guess ($timestamp) + +Originally written by Per Bothner. +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" >&2 + exit 1 ;; + * ) + break ;; + esac +done + +if test $# != 0; then + echo "$me: too many arguments$help" >&2 + exit 1 +fi + +trap 'exit 1' 1 2 15 + +# CC_FOR_BUILD -- compiler used by this script. Note that the use of a +# compiler to aid in system detection is discouraged as it requires +# temporary files to be created and, as you can see below, it is a +# headache to deal with in a portable fashion. + +# Historically, `CC_FOR_BUILD' used to be named `HOST_CC'. We still +# use `HOST_CC' if defined, but it is deprecated. + +# Portable tmp directory creation inspired by the Autoconf team. + +set_cc_for_build=' +trap "exitcode=\$?; (rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null) && exit \$exitcode" 0 ; +trap "rm -f \$tmpfiles 2>/dev/null; rmdir \$tmp 2>/dev/null; exit 1" 1 2 13 15 ; +: ${TMPDIR=/tmp} ; + { tmp=`(umask 077 && mktemp -d "$TMPDIR/cgXXXXXX") 2>/dev/null` && test -n "$tmp" && test -d "$tmp" ; } || + { test -n "$RANDOM" && tmp=$TMPDIR/cg$$-$RANDOM && (umask 077 && mkdir $tmp) ; } || + { tmp=$TMPDIR/cg-$$ && (umask 077 && mkdir $tmp) && echo "Warning: creating insecure temp directory" >&2 ; } || + { echo "$me: cannot create a temporary directory in $TMPDIR" >&2 ; exit 1 ; } ; +dummy=$tmp/dummy ; +tmpfiles="$dummy.c $dummy.o $dummy.rel $dummy" ; +case $CC_FOR_BUILD,$HOST_CC,$CC in + ,,) echo "int x;" > $dummy.c ; + for c in cc gcc c89 c99 ; do + if ($c -c -o $dummy.o $dummy.c) >/dev/null 2>&1 ; then + CC_FOR_BUILD="$c"; break ; + fi ; + done ; + if test x"$CC_FOR_BUILD" = x ; then + CC_FOR_BUILD=no_compiler_found ; + fi + ;; + ,,*) CC_FOR_BUILD=$CC ;; + ,*,*) CC_FOR_BUILD=$HOST_CC ;; +esac ; set_cc_for_build= ;' + +# This is needed to find uname on a Pyramid OSx when run in the BSD universe. +# (ghazi@noc.rutgers.edu 1994-08-24) +if (test -f /.attbin/uname) >/dev/null 2>&1 ; then + PATH=$PATH:/.attbin ; export PATH +fi + +UNAME_MACHINE=`(uname -m) 2>/dev/null` || UNAME_MACHINE=unknown +UNAME_RELEASE=`(uname -r) 2>/dev/null` || UNAME_RELEASE=unknown +UNAME_SYSTEM=`(uname -s) 2>/dev/null` || UNAME_SYSTEM=unknown +UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown + +# Note: order is significant - the case branches are not exclusive. + +case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in + *:NetBSD:*:*) + # NetBSD (nbsd) targets should (where applicable) match one or + # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*, + # *-*-netbsdecoff* and *-*-netbsd*. For targets that recently + # switched to ELF, *-*-netbsd* would select the old + # object file format. This provides both forward + # compatibility and a consistent mechanism for selecting the + # object file format. + # + # Note: NetBSD doesn't particularly care about the vendor + # portion of the name. We always set it to "unknown". + sysctl="sysctl -n hw.machine_arch" + UNAME_MACHINE_ARCH=`(/sbin/$sysctl 2>/dev/null || \ + /usr/sbin/$sysctl 2>/dev/null || echo unknown)` + case "${UNAME_MACHINE_ARCH}" in + armeb) machine=armeb-unknown ;; + arm*) machine=arm-unknown ;; + sh3el) machine=shl-unknown ;; + sh3eb) machine=sh-unknown ;; + sh5el) machine=sh5le-unknown ;; + *) machine=${UNAME_MACHINE_ARCH}-unknown ;; + esac + # The Operating System including object format, if it has switched + # to ELF recently, or will in the future. + case "${UNAME_MACHINE_ARCH}" in + arm*|i386|m68k|ns32k|sh3*|sparc|vax) + eval $set_cc_for_build + if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ELF__ + then + # Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout). + # Return netbsd for either. FIX? + os=netbsd + else + os=netbsdelf + fi + ;; + *) + os=netbsd + ;; + esac + # The OS release + # Debian GNU/NetBSD machines have a different userland, and + # thus, need a distinct triplet. However, they do not need + # kernel version information, so it can be replaced with a + # suitable tag, in the style of linux-gnu. + case "${UNAME_VERSION}" in + Debian*) + release='-gnu' + ;; + *) + release=`echo ${UNAME_RELEASE}|sed -e 's/[-_].*/\./'` + ;; + esac + # Since CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM: + # contains redundant information, the shorter form: + # CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used. + echo "${machine}-${os}${release}" + exit ;; + *:OpenBSD:*:*) + UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'` + echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE} + exit ;; + *:ekkoBSD:*:*) + echo ${UNAME_MACHINE}-unknown-ekkobsd${UNAME_RELEASE} + exit ;; + *:SolidBSD:*:*) + echo ${UNAME_MACHINE}-unknown-solidbsd${UNAME_RELEASE} + exit ;; + macppc:MirBSD:*:*) + echo powerpc-unknown-mirbsd${UNAME_RELEASE} + exit ;; + *:MirBSD:*:*) + echo ${UNAME_MACHINE}-unknown-mirbsd${UNAME_RELEASE} + exit ;; + alpha:OSF1:*:*) + case $UNAME_RELEASE in + *4.0) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'` + ;; + *5.*) + UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'` + ;; + esac + # According to Compaq, /usr/sbin/psrinfo has been available on + # OSF/1 and Tru64 systems produced since 1995. I hope that + # covers most systems running today. This code pipes the CPU + # types through head -n 1, so we only detect the type of CPU 0. + ALPHA_CPU_TYPE=`/usr/sbin/psrinfo -v | sed -n -e 's/^ The alpha \(.*\) processor.*$/\1/p' | head -n 1` + case "$ALPHA_CPU_TYPE" in + "EV4 (21064)") + UNAME_MACHINE="alpha" ;; + "EV4.5 (21064)") + UNAME_MACHINE="alpha" ;; + "LCA4 (21066/21068)") + UNAME_MACHINE="alpha" ;; + "EV5 (21164)") + UNAME_MACHINE="alphaev5" ;; + "EV5.6 (21164A)") + UNAME_MACHINE="alphaev56" ;; + "EV5.6 (21164PC)") + UNAME_MACHINE="alphapca56" ;; + "EV5.7 (21164PC)") + UNAME_MACHINE="alphapca57" ;; + "EV6 (21264)") + UNAME_MACHINE="alphaev6" ;; + "EV6.7 (21264A)") + UNAME_MACHINE="alphaev67" ;; + "EV6.8CB (21264C)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8AL (21264B)") + UNAME_MACHINE="alphaev68" ;; + "EV6.8CX (21264D)") + UNAME_MACHINE="alphaev68" ;; + "EV6.9A (21264/EV69A)") + UNAME_MACHINE="alphaev69" ;; + "EV7 (21364)") + UNAME_MACHINE="alphaev7" ;; + "EV7.9 (21364A)") + UNAME_MACHINE="alphaev79" ;; + esac + # A Pn.n version is a patched version. + # A Vn.n version is a released version. + # A Tn.n version is a released field test version. + # A Xn.n version is an unreleased experimental baselevel. + # 1.2 uses "1.2" for uname -r. + echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + exit ;; + Alpha\ *:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # Should we change UNAME_MACHINE based on the output of uname instead + # of the specific Alpha model? + echo alpha-pc-interix + exit ;; + 21064:Windows_NT:50:3) + echo alpha-dec-winnt3.5 + exit ;; + Amiga*:UNIX_System_V:4.0:*) + echo m68k-unknown-sysv4 + exit ;; + *:[Aa]miga[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-amigaos + exit ;; + *:[Mm]orph[Oo][Ss]:*:*) + echo ${UNAME_MACHINE}-unknown-morphos + exit ;; + *:OS/390:*:*) + echo i370-ibm-openedition + exit ;; + *:z/VM:*:*) + echo s390-ibm-zvmoe + exit ;; + *:OS400:*:*) + echo powerpc-ibm-os400 + exit ;; + arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*) + echo arm-acorn-riscix${UNAME_RELEASE} + exit ;; + arm:riscos:*:*|arm:RISCOS:*:*) + echo arm-unknown-riscos + exit ;; + SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*) + echo hppa1.1-hitachi-hiuxmpp + exit ;; + Pyramid*:OSx*:*:* | MIS*:OSx*:*:* | MIS*:SMP_DC-OSx*:*:*) + # akee@wpdis03.wpafb.af.mil (Earle F. Ake) contributed MIS and NILE. + if test "`(/bin/universe) 2>/dev/null`" = att ; then + echo pyramid-pyramid-sysv3 + else + echo pyramid-pyramid-bsd + fi + exit ;; + NILE*:*:*:dcosx) + echo pyramid-pyramid-svr4 + exit ;; + DRS?6000:unix:4.0:6*) + echo sparc-icl-nx6 + exit ;; + DRS?6000:UNIX_SV:4.2*:7* | DRS?6000:isis:4.2*:7*) + case `/usr/bin/uname -p` in + sparc) echo sparc-icl-nx7; exit ;; + esac ;; + s390x:SunOS:*:*) + echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4H:SunOS:5.*:*) + echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*) + echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*) + echo i386-pc-auroraux${UNAME_RELEASE} + exit ;; + i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*) + eval $set_cc_for_build + SUN_ARCH="i386" + # If there is a compiler, see if it is configured for 64-bit objects. + # Note that the Sun cc does not turn __LP64__ into 1 like gcc does. + # This test works for both compilers. + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + SUN_ARCH="x86_64" + fi + fi + echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:6*:*) + # According to config.sub, this is the proper way to canonicalize + # SunOS6. Hard to guess exactly what SunOS6 will be like, but + # it's likely to be more like Solaris than SunOS4. + echo sparc-sun-solaris3`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + sun4*:SunOS:*:*) + case "`/usr/bin/arch -k`" in + Series*|S4*) + UNAME_RELEASE=`uname -v` + ;; + esac + # Japanese Language versions have a version number like `4.1.3-JL'. + echo sparc-sun-sunos`echo ${UNAME_RELEASE}|sed -e 's/-/_/'` + exit ;; + sun3*:SunOS:*:*) + echo m68k-sun-sunos${UNAME_RELEASE} + exit ;; + sun*:*:4.2BSD:*) + UNAME_RELEASE=`(sed 1q /etc/motd | awk '{print substr($5,1,3)}') 2>/dev/null` + test "x${UNAME_RELEASE}" = "x" && UNAME_RELEASE=3 + case "`/bin/arch`" in + sun3) + echo m68k-sun-sunos${UNAME_RELEASE} + ;; + sun4) + echo sparc-sun-sunos${UNAME_RELEASE} + ;; + esac + exit ;; + aushp:SunOS:*:*) + echo sparc-auspex-sunos${UNAME_RELEASE} + exit ;; + # The situation for MiNT is a little confusing. The machine name + # can be virtually everything (everything which is not + # "atarist" or "atariste" at least should have a processor + # > m68000). The system name ranges from "MiNT" over "FreeMiNT" + # to the lowercase version "mint" (or "freemint"). Finally + # the system name "TOS" denotes a system which is actually not + # MiNT. But MiNT is downward compatible to TOS, so this should + # be no problem. + atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + *falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*) + echo m68k-atari-mint${UNAME_RELEASE} + exit ;; + milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*) + echo m68k-milan-mint${UNAME_RELEASE} + exit ;; + hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*) + echo m68k-hades-mint${UNAME_RELEASE} + exit ;; + *:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*) + echo m68k-unknown-mint${UNAME_RELEASE} + exit ;; + m68k:machten:*:*) + echo m68k-apple-machten${UNAME_RELEASE} + exit ;; + powerpc:machten:*:*) + echo powerpc-apple-machten${UNAME_RELEASE} + exit ;; + RISC*:Mach:*:*) + echo mips-dec-mach_bsd4.3 + exit ;; + RISC*:ULTRIX:*:*) + echo mips-dec-ultrix${UNAME_RELEASE} + exit ;; + VAX*:ULTRIX*:*:*) + echo vax-dec-ultrix${UNAME_RELEASE} + exit ;; + 2020:CLIX:*:* | 2430:CLIX:*:*) + echo clipper-intergraph-clix${UNAME_RELEASE} + exit ;; + mips:*:*:UMIPS | mips:*:*:RISCos) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c +#ifdef __cplusplus +#include /* for printf() prototype */ + int main (int argc, char *argv[]) { +#else + int main (argc, argv) int argc; char *argv[]; { +#endif + #if defined (host_mips) && defined (MIPSEB) + #if defined (SYSTYPE_SYSV) + printf ("mips-mips-riscos%ssysv\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_SVR4) + printf ("mips-mips-riscos%ssvr4\n", argv[1]); exit (0); + #endif + #if defined (SYSTYPE_BSD43) || defined(SYSTYPE_BSD) + printf ("mips-mips-riscos%sbsd\n", argv[1]); exit (0); + #endif + #endif + exit (-1); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && + dummyarg=`echo "${UNAME_RELEASE}" | sed -n 's/\([0-9]*\).*/\1/p'` && + SYSTEM_NAME=`$dummy $dummyarg` && + { echo "$SYSTEM_NAME"; exit; } + echo mips-mips-riscos${UNAME_RELEASE} + exit ;; + Motorola:PowerMAX_OS:*:*) + echo powerpc-motorola-powermax + exit ;; + Motorola:*:4.3:PL8-*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:*:*:PowerMAX_OS | Synergy:PowerMAX_OS:*:*) + echo powerpc-harris-powermax + exit ;; + Night_Hawk:Power_UNIX:*:*) + echo powerpc-harris-powerunix + exit ;; + m88k:CX/UX:7*:*) + echo m88k-harris-cxux7 + exit ;; + m88k:*:4*:R4*) + echo m88k-motorola-sysv4 + exit ;; + m88k:*:3*:R3*) + echo m88k-motorola-sysv3 + exit ;; + AViiON:dgux:*:*) + # DG/UX returns AViiON for all architectures + UNAME_PROCESSOR=`/usr/bin/uname -p` + if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ] + then + if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \ + [ ${TARGET_BINARY_INTERFACE}x = x ] + then + echo m88k-dg-dgux${UNAME_RELEASE} + else + echo m88k-dg-dguxbcs${UNAME_RELEASE} + fi + else + echo i586-dg-dgux${UNAME_RELEASE} + fi + exit ;; + M88*:DolphinOS:*:*) # DolphinOS (SVR3) + echo m88k-dolphin-sysv3 + exit ;; + M88*:*:R3*:*) + # Delta 88k system running SVR3 + echo m88k-motorola-sysv3 + exit ;; + XD88*:*:*:*) # Tektronix XD88 system running UTekV (SVR3) + echo m88k-tektronix-sysv3 + exit ;; + Tek43[0-9][0-9]:UTek:*:*) # Tektronix 4300 system running UTek (BSD) + echo m68k-tektronix-bsd + exit ;; + *:IRIX*:*:*) + echo mips-sgi-irix`echo ${UNAME_RELEASE}|sed -e 's/-/_/g'` + exit ;; + ????????:AIX?:[12].1:2) # AIX 2.2.1 or AIX 2.1.1 is RT/PC AIX. + echo romp-ibm-aix # uname -m gives an 8 hex-code CPU id + exit ;; # Note that: echo "'`uname -s`'" gives 'AIX ' + i*86:AIX:*:*) + echo i386-ibm-aix + exit ;; + ia64:AIX:*:*) + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${UNAME_MACHINE}-ibm-aix${IBM_REV} + exit ;; + *:AIX:2:3) + if grep bos325 /usr/include/stdio.h >/dev/null 2>&1; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + + main() + { + if (!__power_pc()) + exit(1); + puts("powerpc-ibm-aix3.2.5"); + exit(0); + } +EOF + if $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` + then + echo "$SYSTEM_NAME" + else + echo rs6000-ibm-aix3.2.5 + fi + elif grep bos324 /usr/include/stdio.h >/dev/null 2>&1; then + echo rs6000-ibm-aix3.2.4 + else + echo rs6000-ibm-aix3.2 + fi + exit ;; + *:AIX:*:[456]) + IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'` + if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then + IBM_ARCH=rs6000 + else + IBM_ARCH=powerpc + fi + if [ -x /usr/bin/oslevel ] ; then + IBM_REV=`/usr/bin/oslevel` + else + IBM_REV=${UNAME_VERSION}.${UNAME_RELEASE} + fi + echo ${IBM_ARCH}-ibm-aix${IBM_REV} + exit ;; + *:AIX:*:*) + echo rs6000-ibm-aix + exit ;; + ibmrt:4.4BSD:*|romp-ibm:BSD:*) + echo romp-ibm-bsd4.4 + exit ;; + ibmrt:*BSD:*|romp-ibm:BSD:*) # covers RT/PC BSD and + echo romp-ibm-bsd${UNAME_RELEASE} # 4.3 with uname added to + exit ;; # report: romp-ibm BSD 4.3 + *:BOSX:*:*) + echo rs6000-bull-bosx + exit ;; + DPX/2?00:B.O.S.:*:*) + echo m68k-bull-sysv3 + exit ;; + 9000/[34]??:4.3bsd:1.*:*) + echo m68k-hp-bsd + exit ;; + hp300:4.4BSD:*:* | 9000/[34]??:4.3bsd:2.*:*) + echo m68k-hp-bsd4.4 + exit ;; + 9000/[34678]??:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + case "${UNAME_MACHINE}" in + 9000/31? ) HP_ARCH=m68000 ;; + 9000/[34]?? ) HP_ARCH=m68k ;; + 9000/[678][0-9][0-9]) + if [ -x /usr/bin/getconf ]; then + sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null` + sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null` + case "${sc_cpu_version}" in + 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0 + 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1 + 532) # CPU_PA_RISC2_0 + case "${sc_kernel_bits}" in + 32) HP_ARCH="hppa2.0n" ;; + 64) HP_ARCH="hppa2.0w" ;; + '') HP_ARCH="hppa2.0" ;; # HP-UX 10.20 + esac ;; + esac + fi + if [ "${HP_ARCH}" = "" ]; then + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + + #define _HPUX_SOURCE + #include + #include + + int main () + { + #if defined(_SC_KERNEL_BITS) + long bits = sysconf(_SC_KERNEL_BITS); + #endif + long cpu = sysconf (_SC_CPU_VERSION); + + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1"); break; + case CPU_PA_RISC2_0: + #if defined(_SC_KERNEL_BITS) + switch (bits) + { + case 64: puts ("hppa2.0w"); break; + case 32: puts ("hppa2.0n"); break; + default: puts ("hppa2.0"); break; + } break; + #else /* !defined(_SC_KERNEL_BITS) */ + puts ("hppa2.0"); break; + #endif + default: puts ("hppa1.0"); break; + } + exit (0); + } +EOF + (CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy` + test -z "$HP_ARCH" && HP_ARCH=hppa + fi ;; + esac + if [ ${HP_ARCH} = "hppa2.0w" ] + then + eval $set_cc_for_build + + # hppa2.0w-hp-hpux* has a 64-bit kernel and a compiler generating + # 32-bit code. hppa64-hp-hpux* has the same kernel and a compiler + # generating 64-bit code. GNU and HP use different nomenclature: + # + # $ CC_FOR_BUILD=cc ./config.guess + # => hppa2.0w-hp-hpux11.23 + # $ CC_FOR_BUILD="cc +DA2.0w" ./config.guess + # => hppa64-hp-hpux11.23 + + if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | + grep -q __LP64__ + then + HP_ARCH="hppa2.0w" + else + HP_ARCH="hppa64" + fi + fi + echo ${HP_ARCH}-hp-hpux${HPUX_REV} + exit ;; + ia64:HP-UX:*:*) + HPUX_REV=`echo ${UNAME_RELEASE}|sed -e 's/[^.]*.[0B]*//'` + echo ia64-hp-hpux${HPUX_REV} + exit ;; + 3050*:HI-UX:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #include + int + main () + { + long cpu = sysconf (_SC_CPU_VERSION); + /* The order matters, because CPU_IS_HP_MC68K erroneously returns + true for CPU_PA_RISC1_0. CPU_IS_PA_RISC returns correct + results, however. */ + if (CPU_IS_PA_RISC (cpu)) + { + switch (cpu) + { + case CPU_PA_RISC1_0: puts ("hppa1.0-hitachi-hiuxwe2"); break; + case CPU_PA_RISC1_1: puts ("hppa1.1-hitachi-hiuxwe2"); break; + case CPU_PA_RISC2_0: puts ("hppa2.0-hitachi-hiuxwe2"); break; + default: puts ("hppa-hitachi-hiuxwe2"); break; + } + } + else if (CPU_IS_HP_MC68K (cpu)) + puts ("m68k-hitachi-hiuxwe2"); + else puts ("unknown-hitachi-hiuxwe2"); + exit (0); + } +EOF + $CC_FOR_BUILD -o $dummy $dummy.c && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + echo unknown-hitachi-hiuxwe2 + exit ;; + 9000/7??:4.3bsd:*:* | 9000/8?[79]:4.3bsd:*:* ) + echo hppa1.1-hp-bsd + exit ;; + 9000/8??:4.3bsd:*:*) + echo hppa1.0-hp-bsd + exit ;; + *9??*:MPE/iX:*:* | *3000*:MPE/iX:*:*) + echo hppa1.0-hp-mpeix + exit ;; + hp7??:OSF1:*:* | hp8?[79]:OSF1:*:* ) + echo hppa1.1-hp-osf + exit ;; + hp8??:OSF1:*:*) + echo hppa1.0-hp-osf + exit ;; + i*86:OSF1:*:*) + if [ -x /usr/sbin/sysversion ] ; then + echo ${UNAME_MACHINE}-unknown-osf1mk + else + echo ${UNAME_MACHINE}-unknown-osf1 + fi + exit ;; + parisc*:Lites*:*:*) + echo hppa1.1-hp-lites + exit ;; + C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*) + echo c1-convex-bsd + exit ;; + C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*) + echo c34-convex-bsd + exit ;; + C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*) + echo c38-convex-bsd + exit ;; + C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*) + echo c4-convex-bsd + exit ;; + CRAY*Y-MP:*:*:*) + echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*[A-Z]90:*:*:*) + echo ${UNAME_MACHINE}-cray-unicos${UNAME_RELEASE} \ + | sed -e 's/CRAY.*\([A-Z]90\)/\1/' \ + -e y/ABCDEFGHIJKLMNOPQRSTUVWXYZ/abcdefghijklmnopqrstuvwxyz/ \ + -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*TS:*:*:*) + echo t90-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*T3E:*:*:*) + echo alphaev5-cray-unicosmk${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + CRAY*SV1:*:*:*) + echo sv1-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + *:UNICOS/mp:*:*) + echo craynv-cray-unicosmp${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/' + exit ;; + F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*) + FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'` + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'` + echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + 5000:UNIX_System_V:4.*:*) + FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'` + FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'` + echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}" + exit ;; + i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*) + echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE} + exit ;; + sparc*:BSD/OS:*:*) + echo sparc-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:BSD/OS:*:*) + echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE} + exit ;; + *:FreeBSD:*:*) + case ${UNAME_MACHINE} in + pc98) + echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + amd64) + echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + *) + echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;; + esac + exit ;; + i*:CYGWIN*:*) + echo ${UNAME_MACHINE}-pc-cygwin + exit ;; + *:MINGW*:*) + echo ${UNAME_MACHINE}-pc-mingw32 + exit ;; + i*:windows32*:*) + # uname -m includes "-pc" on this system. + echo ${UNAME_MACHINE}-mingw32 + exit ;; + i*:PW*:*) + echo ${UNAME_MACHINE}-pc-pw32 + exit ;; + *:Interix*:*) + case ${UNAME_MACHINE} in + x86) + echo i586-pc-interix${UNAME_RELEASE} + exit ;; + authenticamd | genuineintel | EM64T) + echo x86_64-unknown-interix${UNAME_RELEASE} + exit ;; + IA64) + echo ia64-unknown-interix${UNAME_RELEASE} + exit ;; + esac ;; + [345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*) + echo i${UNAME_MACHINE}-pc-mks + exit ;; + 8664:Windows_NT:*) + echo x86_64-pc-mks + exit ;; + i*:Windows_NT*:* | Pentium*:Windows_NT*:*) + # How do we know it's Interix rather than the generic POSIX subsystem? + # It also conflicts with pre-2.0 versions of AT&T UWIN. Should we + # UNAME_MACHINE based on the output of uname instead of i386? + echo i586-pc-interix + exit ;; + i*:UWIN*:*) + echo ${UNAME_MACHINE}-pc-uwin + exit ;; + amd64:CYGWIN*:*:* | x86_64:CYGWIN*:*:*) + echo x86_64-unknown-cygwin + exit ;; + p*:CYGWIN*:*) + echo powerpcle-unknown-cygwin + exit ;; + prep*:SunOS:5.*:*) + echo powerpcle-unknown-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'` + exit ;; + *:GNU:*:*) + # the GNU system + echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'` + exit ;; + *:GNU/*:*:*) + # other systems with GNU libc and userland + echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu + exit ;; + i*86:Minix:*:*) + echo ${UNAME_MACHINE}-pc-minix + exit ;; + alpha:Linux:*:*) + case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in + EV5) UNAME_MACHINE=alphaev5 ;; + EV56) UNAME_MACHINE=alphaev56 ;; + PCA56) UNAME_MACHINE=alphapca56 ;; + PCA57) UNAME_MACHINE=alphapca56 ;; + EV6) UNAME_MACHINE=alphaev6 ;; + EV67) UNAME_MACHINE=alphaev67 ;; + EV68*) UNAME_MACHINE=alphaev68 ;; + esac + objdump --private-headers /bin/sh | grep -q ld.so.1 + if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi + echo ${UNAME_MACHINE}-unknown-linux-gnu${LIBC} + exit ;; + arm*:Linux:*:*) + eval $set_cc_for_build + if echo __ARM_EABI__ | $CC_FOR_BUILD -E - 2>/dev/null \ + | grep -q __ARM_EABI__ + then + echo ${UNAME_MACHINE}-unknown-linux-gnu + else + echo ${UNAME_MACHINE}-unknown-linux-gnueabi + fi + exit ;; + avr32*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + cris:Linux:*:*) + echo cris-axis-linux-gnu + exit ;; + crisv32:Linux:*:*) + echo crisv32-axis-linux-gnu + exit ;; + frv:Linux:*:*) + echo frv-unknown-linux-gnu + exit ;; + i*86:Linux:*:*) + LIBC=gnu + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #ifdef __dietlibc__ + LIBC=dietlibc + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^LIBC'` + echo "${UNAME_MACHINE}-pc-linux-${LIBC}" + exit ;; + ia64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m32r*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + m68*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + mips:Linux:*:* | mips64:Linux:*:*) + eval $set_cc_for_build + sed 's/^ //' << EOF >$dummy.c + #undef CPU + #undef ${UNAME_MACHINE} + #undef ${UNAME_MACHINE}el + #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL) + CPU=${UNAME_MACHINE}el + #else + #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB) + CPU=${UNAME_MACHINE} + #else + CPU= + #endif + #endif +EOF + eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'` + test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; } + ;; + or32:Linux:*:*) + echo or32-unknown-linux-gnu + exit ;; + padre:Linux:*:*) + echo sparc-unknown-linux-gnu + exit ;; + parisc64:Linux:*:* | hppa64:Linux:*:*) + echo hppa64-unknown-linux-gnu + exit ;; + parisc:Linux:*:* | hppa:Linux:*:*) + # Look for CPU level + case `grep '^cpu[^a-z]*:' /proc/cpuinfo 2>/dev/null | cut -d' ' -f2` in + PA7*) echo hppa1.1-unknown-linux-gnu ;; + PA8*) echo hppa2.0-unknown-linux-gnu ;; + *) echo hppa-unknown-linux-gnu ;; + esac + exit ;; + ppc64:Linux:*:*) + echo powerpc64-unknown-linux-gnu + exit ;; + ppc:Linux:*:*) + echo powerpc-unknown-linux-gnu + exit ;; + s390:Linux:*:* | s390x:Linux:*:*) + echo ${UNAME_MACHINE}-ibm-linux + exit ;; + sh64*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sh*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + sparc:Linux:*:* | sparc64:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + vax:Linux:*:*) + echo ${UNAME_MACHINE}-dec-linux-gnu + exit ;; + x86_64:Linux:*:*) + echo x86_64-unknown-linux-gnu + exit ;; + xtensa*:Linux:*:*) + echo ${UNAME_MACHINE}-unknown-linux-gnu + exit ;; + i*86:DYNIX/ptx:4*:*) + # ptx 4.0 does uname -s correctly, with DYNIX/ptx in there. + # earlier versions are messed up and put the nodename in both + # sysname and nodename. + echo i386-sequent-sysv4 + exit ;; + i*86:UNIX_SV:4.2MP:2.*) + # Unixware is an offshoot of SVR4, but it has its own version + # number series starting with 2... + # I am not positive that other SVR4 systems won't match this, + # I just have to hope. -- rms. + # Use sysv4.2uw... so that sysv4* matches it. + echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION} + exit ;; + i*86:OS/2:*:*) + # If we were able to find `uname', then EMX Unix compatibility + # is probably installed. + echo ${UNAME_MACHINE}-pc-os2-emx + exit ;; + i*86:XTS-300:*:STOP) + echo ${UNAME_MACHINE}-unknown-stop + exit ;; + i*86:atheos:*:*) + echo ${UNAME_MACHINE}-unknown-atheos + exit ;; + i*86:syllable:*:*) + echo ${UNAME_MACHINE}-pc-syllable + exit ;; + i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*) + echo i386-unknown-lynxos${UNAME_RELEASE} + exit ;; + i*86:*DOS:*:*) + echo ${UNAME_MACHINE}-pc-msdosdjgpp + exit ;; + i*86:*:4.*:* | i*86:SYSTEM_V:4.*:*) + UNAME_REL=`echo ${UNAME_RELEASE} | sed 's/\/MP$//'` + if grep Novell /usr/include/link.h >/dev/null 2>/dev/null; then + echo ${UNAME_MACHINE}-univel-sysv${UNAME_REL} + else + echo ${UNAME_MACHINE}-pc-sysv${UNAME_REL} + fi + exit ;; + i*86:*:5:[678]*) + # UnixWare 7.x, OpenUNIX and OpenServer 6. + case `/bin/uname -X | grep "^Machine"` in + *486*) UNAME_MACHINE=i486 ;; + *Pentium) UNAME_MACHINE=i586 ;; + *Pent*|*Celeron) UNAME_MACHINE=i686 ;; + esac + echo ${UNAME_MACHINE}-unknown-sysv${UNAME_RELEASE}${UNAME_SYSTEM}${UNAME_VERSION} + exit ;; + i*86:*:3.2:*) + if test -f /usr/options/cb.name; then + UNAME_REL=`sed -n 's/.*Version //p' /dev/null >/dev/null ; then + UNAME_REL=`(/bin/uname -X|grep Release|sed -e 's/.*= //')` + (/bin/uname -X|grep i80486 >/dev/null) && UNAME_MACHINE=i486 + (/bin/uname -X|grep '^Machine.*Pentium' >/dev/null) \ + && UNAME_MACHINE=i586 + (/bin/uname -X|grep '^Machine.*Pent *II' >/dev/null) \ + && UNAME_MACHINE=i686 + (/bin/uname -X|grep '^Machine.*Pentium Pro' >/dev/null) \ + && UNAME_MACHINE=i686 + echo ${UNAME_MACHINE}-pc-sco$UNAME_REL + else + echo ${UNAME_MACHINE}-pc-sysv32 + fi + exit ;; + pc:*:*:*) + # Left here for compatibility: + # uname -m prints for DJGPP always 'pc', but it prints nothing about + # the processor, so we play safe by assuming i586. + # Note: whatever this is, it MUST be the same as what config.sub + # prints for the "djgpp" host, or else GDB configury will decide that + # this is a cross-build. + echo i586-pc-msdosdjgpp + exit ;; + Intel:Mach:3*:*) + echo i386-pc-mach3 + exit ;; + paragon:*:*:*) + echo i860-intel-osf1 + exit ;; + i860:*:4.*:*) # i860-SVR4 + if grep Stardent /usr/include/sys/uadmin.h >/dev/null 2>&1 ; then + echo i860-stardent-sysv${UNAME_RELEASE} # Stardent Vistra i860-SVR4 + else # Add other i860-SVR4 vendors below as they are discovered. + echo i860-unknown-sysv${UNAME_RELEASE} # Unknown i860-SVR4 + fi + exit ;; + mini*:CTIX:SYS*5:*) + # "miniframe" + echo m68010-convergent-sysv + exit ;; + mc68k:UNIX:SYSTEM5:3.51m) + echo m68k-convergent-sysv + exit ;; + M680?0:D-NIX:5.3:*) + echo m68k-diab-dnix + exit ;; + M68*:*:R3V[5678]*:*) + test -r /sysV68 && { echo 'm68k-motorola-sysv'; exit; } ;; + 3[345]??:*:4.0:3.0 | 3[34]??A:*:4.0:3.0 | 3[34]??,*:*:4.0:3.0 | 3[34]??/*:*:4.0:3.0 | 4400:*:4.0:3.0 | 4850:*:4.0:3.0 | SKA40:*:4.0:3.0 | SDS2:*:4.0:3.0 | SHG2:*:4.0:3.0 | S7501*:*:4.0:3.0) + OS_REL='' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + 3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*) + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4; exit; } ;; + NCR*:*:4.2:* | MPRAS*:*:4.2:*) + OS_REL='.3' + test -r /etc/.relid \ + && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid` + /bin/uname -p 2>/dev/null | grep 86 >/dev/null \ + && { echo i486-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } + /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \ + && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;; + m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*) + echo m68k-unknown-lynxos${UNAME_RELEASE} + exit ;; + mc68030:UNIX_System_V:4.*:*) + echo m68k-atari-sysv4 + exit ;; + TSUNAMI:LynxOS:2.*:*) + echo sparc-unknown-lynxos${UNAME_RELEASE} + exit ;; + rs6000:LynxOS:2.*:*) + echo rs6000-unknown-lynxos${UNAME_RELEASE} + exit ;; + PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*) + echo powerpc-unknown-lynxos${UNAME_RELEASE} + exit ;; + SM[BE]S:UNIX_SV:*:*) + echo mips-dde-sysv${UNAME_RELEASE} + exit ;; + RM*:ReliantUNIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + RM*:SINIX-*:*:*) + echo mips-sni-sysv4 + exit ;; + *:SINIX-*:*:*) + if uname -p 2>/dev/null >/dev/null ; then + UNAME_MACHINE=`(uname -p) 2>/dev/null` + echo ${UNAME_MACHINE}-sni-sysv4 + else + echo ns32k-sni-sysv + fi + exit ;; + PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort + # says + echo i586-unisys-sysv4 + exit ;; + *:UNIX_System_V:4*:FTX*) + # From Gerald Hewes . + # How about differentiating between stratus architectures? -djm + echo hppa1.1-stratus-sysv4 + exit ;; + *:*:*:FTX*) + # From seanf@swdc.stratus.com. + echo i860-stratus-sysv4 + exit ;; + i*86:VOS:*:*) + # From Paul.Green@stratus.com. + echo ${UNAME_MACHINE}-stratus-vos + exit ;; + *:VOS:*:*) + # From Paul.Green@stratus.com. + echo hppa1.1-stratus-vos + exit ;; + mc68*:A/UX:*:*) + echo m68k-apple-aux${UNAME_RELEASE} + exit ;; + news*:NEWS-OS:6*:*) + echo mips-sony-newsos6 + exit ;; + R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*) + if [ -d /usr/nec ]; then + echo mips-nec-sysv${UNAME_RELEASE} + else + echo mips-unknown-sysv${UNAME_RELEASE} + fi + exit ;; + BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only. + echo powerpc-be-beos + exit ;; + BeMac:BeOS:*:*) # BeOS running on Mac or Mac clone, PPC only. + echo powerpc-apple-beos + exit ;; + BePC:BeOS:*:*) # BeOS running on Intel PC compatible. + echo i586-pc-beos + exit ;; + BePC:Haiku:*:*) # Haiku running on Intel PC compatible. + echo i586-pc-haiku + exit ;; + SX-4:SUPER-UX:*:*) + echo sx4-nec-superux${UNAME_RELEASE} + exit ;; + SX-5:SUPER-UX:*:*) + echo sx5-nec-superux${UNAME_RELEASE} + exit ;; + SX-6:SUPER-UX:*:*) + echo sx6-nec-superux${UNAME_RELEASE} + exit ;; + SX-7:SUPER-UX:*:*) + echo sx7-nec-superux${UNAME_RELEASE} + exit ;; + SX-8:SUPER-UX:*:*) + echo sx8-nec-superux${UNAME_RELEASE} + exit ;; + SX-8R:SUPER-UX:*:*) + echo sx8r-nec-superux${UNAME_RELEASE} + exit ;; + Power*:Rhapsody:*:*) + echo powerpc-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Rhapsody:*:*) + echo ${UNAME_MACHINE}-apple-rhapsody${UNAME_RELEASE} + exit ;; + *:Darwin:*:*) + UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown + case $UNAME_PROCESSOR in + i386) + eval $set_cc_for_build + if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then + if (echo '#ifdef __LP64__'; echo IS_64BIT_ARCH; echo '#endif') | \ + (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \ + grep IS_64BIT_ARCH >/dev/null + then + UNAME_PROCESSOR="x86_64" + fi + fi ;; + unknown) UNAME_PROCESSOR=powerpc ;; + esac + echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE} + exit ;; + *:procnto*:*:* | *:QNX:[0123456789]*:*) + UNAME_PROCESSOR=`uname -p` + if test "$UNAME_PROCESSOR" = "x86"; then + UNAME_PROCESSOR=i386 + UNAME_MACHINE=pc + fi + echo ${UNAME_PROCESSOR}-${UNAME_MACHINE}-nto-qnx${UNAME_RELEASE} + exit ;; + *:QNX:*:4*) + echo i386-pc-qnx + exit ;; + NSE-?:NONSTOP_KERNEL:*:*) + echo nse-tandem-nsk${UNAME_RELEASE} + exit ;; + NSR-?:NONSTOP_KERNEL:*:*) + echo nsr-tandem-nsk${UNAME_RELEASE} + exit ;; + *:NonStop-UX:*:*) + echo mips-compaq-nonstopux + exit ;; + BS2000:POSIX*:*:*) + echo bs2000-siemens-sysv + exit ;; + DS/*:UNIX_System_V:*:*) + echo ${UNAME_MACHINE}-${UNAME_SYSTEM}-${UNAME_RELEASE} + exit ;; + *:Plan9:*:*) + # "uname -m" is not consistent, so use $cputype instead. 386 + # is converted to i386 for consistency with other x86 + # operating systems. + if test "$cputype" = "386"; then + UNAME_MACHINE=i386 + else + UNAME_MACHINE="$cputype" + fi + echo ${UNAME_MACHINE}-unknown-plan9 + exit ;; + *:TOPS-10:*:*) + echo pdp10-unknown-tops10 + exit ;; + *:TENEX:*:*) + echo pdp10-unknown-tenex + exit ;; + KS10:TOPS-20:*:* | KL10:TOPS-20:*:* | TYPE4:TOPS-20:*:*) + echo pdp10-dec-tops20 + exit ;; + XKL-1:TOPS-20:*:* | TYPE5:TOPS-20:*:*) + echo pdp10-xkl-tops20 + exit ;; + *:TOPS-20:*:*) + echo pdp10-unknown-tops20 + exit ;; + *:ITS:*:*) + echo pdp10-unknown-its + exit ;; + SEI:*:*:SEIUX) + echo mips-sei-seiux${UNAME_RELEASE} + exit ;; + *:DragonFly:*:*) + echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` + exit ;; + *:*VMS:*:*) + UNAME_MACHINE=`(uname -p) 2>/dev/null` + case "${UNAME_MACHINE}" in + A*) echo alpha-dec-vms ; exit ;; + I*) echo ia64-dec-vms ; exit ;; + V*) echo vax-dec-vms ; exit ;; + esac ;; + *:XENIX:*:SysV) + echo i386-pc-xenix + exit ;; + i*86:skyos:*:*) + echo ${UNAME_MACHINE}-pc-skyos`echo ${UNAME_RELEASE}` | sed -e 's/ .*$//' + exit ;; + i*86:rdos:*:*) + echo ${UNAME_MACHINE}-pc-rdos + exit ;; + i*86:AROS:*:*) + echo ${UNAME_MACHINE}-pc-aros + exit ;; +esac + +#echo '(No uname command or uname output not recognized.)' 1>&2 +#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2 + +eval $set_cc_for_build +cat >$dummy.c < +# include +#endif +main () +{ +#if defined (sony) +#if defined (MIPSEB) + /* BFD wants "bsd" instead of "newsos". Perhaps BFD should be changed, + I don't know.... */ + printf ("mips-sony-bsd\n"); exit (0); +#else +#include + printf ("m68k-sony-newsos%s\n", +#ifdef NEWSOS4 + "4" +#else + "" +#endif + ); exit (0); +#endif +#endif + +#if defined (__arm) && defined (__acorn) && defined (__unix) + printf ("arm-acorn-riscix\n"); exit (0); +#endif + +#if defined (hp300) && !defined (hpux) + printf ("m68k-hp-bsd\n"); exit (0); +#endif + +#if defined (NeXT) +#if !defined (__ARCHITECTURE__) +#define __ARCHITECTURE__ "m68k" +#endif + int version; + version=`(hostinfo | sed -n 's/.*NeXT Mach \([0-9]*\).*/\1/p') 2>/dev/null`; + if (version < 4) + printf ("%s-next-nextstep%d\n", __ARCHITECTURE__, version); + else + printf ("%s-next-openstep%d\n", __ARCHITECTURE__, version); + exit (0); +#endif + +#if defined (MULTIMAX) || defined (n16) +#if defined (UMAXV) + printf ("ns32k-encore-sysv\n"); exit (0); +#else +#if defined (CMU) + printf ("ns32k-encore-mach\n"); exit (0); +#else + printf ("ns32k-encore-bsd\n"); exit (0); +#endif +#endif +#endif + +#if defined (__386BSD__) + printf ("i386-pc-bsd\n"); exit (0); +#endif + +#if defined (sequent) +#if defined (i386) + printf ("i386-sequent-dynix\n"); exit (0); +#endif +#if defined (ns32000) + printf ("ns32k-sequent-dynix\n"); exit (0); +#endif +#endif + +#if defined (_SEQUENT_) + struct utsname un; + + uname(&un); + + if (strncmp(un.version, "V2", 2) == 0) { + printf ("i386-sequent-ptx2\n"); exit (0); + } + if (strncmp(un.version, "V1", 2) == 0) { /* XXX is V1 correct? */ + printf ("i386-sequent-ptx1\n"); exit (0); + } + printf ("i386-sequent-ptx\n"); exit (0); + +#endif + +#if defined (vax) +# if !defined (ultrix) +# include +# if defined (BSD) +# if BSD == 43 + printf ("vax-dec-bsd4.3\n"); exit (0); +# else +# if BSD == 199006 + printf ("vax-dec-bsd4.3reno\n"); exit (0); +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# endif +# else + printf ("vax-dec-bsd\n"); exit (0); +# endif +# else + printf ("vax-dec-ultrix\n"); exit (0); +# endif +#endif + +#if defined (alliant) && defined (i860) + printf ("i860-alliant-bsd\n"); exit (0); +#endif + + exit (1); +} +EOF + +$CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null && SYSTEM_NAME=`$dummy` && + { echo "$SYSTEM_NAME"; exit; } + +# Apollos put the system type in the environment. + +test -d /usr/apollo && { echo ${ISP}-apollo-${SYSTYPE}; exit; } + +# Convex versions that predate uname can use getsysinfo(1) + +if [ -x /usr/convex/getsysinfo ] +then + case `getsysinfo -f cpu_type` in + c1*) + echo c1-convex-bsd + exit ;; + c2*) + if getsysinfo -f scalar_acc + then echo c32-convex-bsd + else echo c2-convex-bsd + fi + exit ;; + c34*) + echo c34-convex-bsd + exit ;; + c38*) + echo c38-convex-bsd + exit ;; + c4*) + echo c4-convex-bsd + exit ;; + esac +fi + +cat >&2 < in order to provide the needed +information to handle your system. + +config.guess timestamp = $timestamp + +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null` + +hostinfo = `(hostinfo) 2>/dev/null` +/bin/universe = `(/bin/universe) 2>/dev/null` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null` +/bin/arch = `(/bin/arch) 2>/dev/null` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null` + +UNAME_MACHINE = ${UNAME_MACHINE} +UNAME_RELEASE = ${UNAME_RELEASE} +UNAME_SYSTEM = ${UNAME_SYSTEM} +UNAME_VERSION = ${UNAME_VERSION} +EOF + +exit 1 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/config.sub b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/config.sub new file mode 100755 index 000000000..2a55a5075 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/config.sub @@ -0,0 +1,1705 @@ +#! /bin/sh +# Configuration validation subroutine script. +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, +# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 +# Free Software Foundation, Inc. + +timestamp='2009-11-20' + +# This file is (in principle) common to ALL GNU software. +# The presence of a machine in this file suggests that SOME GNU software +# can handle that machine. It does not imply ALL GNU software can. +# +# This file is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA +# 02110-1301, USA. +# +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + + +# Please send patches to . Submit a context +# diff and a properly formatted GNU ChangeLog entry. +# +# Configuration subroutine to validate and canonicalize a configuration type. +# Supply the specified configuration type as an argument. +# If it is invalid, we print an error message on stderr and exit with code 1. +# Otherwise, we print the canonical config type on stdout and succeed. + +# You can get the latest version of this script from: +# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD + +# This file is supposed to be the same for all GNU packages +# and recognize all the CPU types, system types and aliases +# that are meaningful with *any* GNU software. +# Each package is responsible for reporting which valid configurations +# it does not support. The user should be able to distinguish +# a failure to support a valid configuration from a meaningless +# configuration. + +# The goal of this file is to map all the various variations of a given +# machine specification into a single specification in the form: +# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM +# or in some cases, the newer four-part form: +# CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM +# It is wrong to echo any other type of specification. + +me=`echo "$0" | sed -e 's,.*/,,'` + +usage="\ +Usage: $0 [OPTION] CPU-MFR-OPSYS + $0 [OPTION] ALIAS + +Canonicalize a configuration name. + +Operation modes: + -h, --help print this help, then exit + -t, --time-stamp print date of last modification, then exit + -v, --version print version number, then exit + +Report bugs and patches to ." + +version="\ +GNU config.sub ($timestamp) + +Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, +2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. + +This is free software; see the source for copying conditions. There is NO +warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE." + +help=" +Try \`$me --help' for more information." + +# Parse command line +while test $# -gt 0 ; do + case $1 in + --time-stamp | --time* | -t ) + echo "$timestamp" ; exit ;; + --version | -v ) + echo "$version" ; exit ;; + --help | --h* | -h ) + echo "$usage"; exit ;; + -- ) # Stop option processing + shift; break ;; + - ) # Use stdin as input. + break ;; + -* ) + echo "$me: invalid option $1$help" + exit 1 ;; + + *local*) + # First pass through any local machine types. + echo $1 + exit ;; + + * ) + break ;; + esac +done + +case $# in + 0) echo "$me: missing argument$help" >&2 + exit 1;; + 1) ;; + *) echo "$me: too many arguments$help" >&2 + exit 1;; +esac + +# Separate what the user gave into CPU-COMPANY and OS or KERNEL-OS (if any). +# Here we must recognize all the valid KERNEL-OS combinations. +maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'` +case $maybe_os in + nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \ + uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \ + kopensolaris*-gnu* | \ + storm-chaos* | os2-emx* | rtmk-nova*) + os=-$maybe_os + basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'` + ;; + *) + basic_machine=`echo $1 | sed 's/-[^-]*$//'` + if [ $basic_machine != $1 ] + then os=`echo $1 | sed 's/.*-/-/'` + else os=; fi + ;; +esac + +### Let's recognize common machines as not being operating systems so +### that things like config.sub decstation-3100 work. We also +### recognize some manufacturers as not being operating systems, so we +### can provide default operating systems below. +case $os in + -sun*os*) + # Prevent following clause from handling this invalid input. + ;; + -dec* | -mips* | -sequent* | -encore* | -pc532* | -sgi* | -sony* | \ + -att* | -7300* | -3300* | -delta* | -motorola* | -sun[234]* | \ + -unicom* | -ibm* | -next | -hp | -isi* | -apollo | -altos* | \ + -convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\ + -c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \ + -harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \ + -apple | -axis | -knuth | -cray | -microblaze) + os= + basic_machine=$1 + ;; + -bluegene*) + os=-cnk + ;; + -sim | -cisco | -oki | -wec | -winbond) + os= + basic_machine=$1 + ;; + -scout) + ;; + -wrs) + os=-vxworks + basic_machine=$1 + ;; + -chorusos*) + os=-chorusos + basic_machine=$1 + ;; + -chorusrdb) + os=-chorusrdb + basic_machine=$1 + ;; + -hiux*) + os=-hiuxwe2 + ;; + -sco6) + os=-sco5v6 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5) + os=-sco3.2v5 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco4) + os=-sco3.2v4 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2.[4-9]*) + os=`echo $os | sed -e 's/sco3.2./sco3.2v/'` + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco3.2v[4-9]*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco5v6*) + # Don't forget version if it is 3.2v4 or newer. + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -sco*) + os=-sco3.2v2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -udk*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -isc) + os=-isc2.2 + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -clix*) + basic_machine=clipper-intergraph + ;; + -isc*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'` + ;; + -lynx*) + os=-lynxos + ;; + -ptx*) + basic_machine=`echo $1 | sed -e 's/86-.*/86-sequent/'` + ;; + -windowsnt*) + os=`echo $os | sed -e 's/windowsnt/winnt/'` + ;; + -psos*) + os=-psos + ;; + -mint | -mint[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; +esac + +# Decode aliases for certain CPU-COMPANY combinations. +case $basic_machine in + # Recognize the basic CPU types without company name. + # Some are omitted here because they have special meanings below. + 1750a | 580 \ + | a29k \ + | alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \ + | alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \ + | am33_2.0 \ + | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \ + | bfin \ + | c4x | clipper \ + | d10v | d30v | dlx | dsp16xx \ + | fido | fr30 | frv \ + | h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \ + | i370 | i860 | i960 | ia64 \ + | ip2k | iq2000 \ + | lm32 \ + | m32c | m32r | m32rle | m68000 | m68k | m88k \ + | maxq | mb | microblaze | mcore | mep | metag \ + | mips | mipsbe | mipseb | mipsel | mipsle \ + | mips16 \ + | mips64 | mips64el \ + | mips64octeon | mips64octeonel \ + | mips64orion | mips64orionel \ + | mips64r5900 | mips64r5900el \ + | mips64vr | mips64vrel \ + | mips64vr4100 | mips64vr4100el \ + | mips64vr4300 | mips64vr4300el \ + | mips64vr5000 | mips64vr5000el \ + | mips64vr5900 | mips64vr5900el \ + | mipsisa32 | mipsisa32el \ + | mipsisa32r2 | mipsisa32r2el \ + | mipsisa64 | mipsisa64el \ + | mipsisa64r2 | mipsisa64r2el \ + | mipsisa64sb1 | mipsisa64sb1el \ + | mipsisa64sr71k | mipsisa64sr71kel \ + | mipstx39 | mipstx39el \ + | mn10200 | mn10300 \ + | moxie \ + | mt \ + | msp430 \ + | nios | nios2 \ + | ns16k | ns32k \ + | or32 \ + | pdp10 | pdp11 | pj | pjl \ + | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \ + | pyramid \ + | rx \ + | score \ + | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \ + | sh64 | sh64le \ + | sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \ + | sparcv8 | sparcv9 | sparcv9b | sparcv9v \ + | spu | strongarm \ + | tahoe | thumb | tic4x | tic80 | tron \ + | ubicom32 \ + | v850 | v850e \ + | we32k \ + | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \ + | z8k | z80) + basic_machine=$basic_machine-unknown + ;; + m6811 | m68hc11 | m6812 | m68hc12 | picochip) + # Motorola 68HC11/12. + basic_machine=$basic_machine-unknown + os=-none + ;; + m88110 | m680[12346]0 | m683?2 | m68360 | m5200 | v70 | w65 | z8k) + ;; + ms1) + basic_machine=mt-unknown + ;; + + # We use `pc' rather than `unknown' + # because (1) that's what they normally are, and + # (2) the word "unknown" tends to confuse beginning users. + i*86 | x86_64) + basic_machine=$basic_machine-pc + ;; + # Object if more than one company name word. + *-*-*) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; + # Recognize the basic CPU types with company name. + 580-* \ + | a29k-* \ + | alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \ + | alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \ + | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \ + | arm-* | armbe-* | armle-* | armeb-* | armv*-* \ + | avr-* | avr32-* \ + | bfin-* | bs2000-* \ + | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \ + | clipper-* | craynv-* | cydra-* \ + | d10v-* | d30v-* | dlx-* \ + | elxsi-* \ + | f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \ + | h8300-* | h8500-* \ + | hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \ + | i*86-* | i860-* | i960-* | ia64-* \ + | ip2k-* | iq2000-* \ + | lm32-* \ + | m32c-* | m32r-* | m32rle-* \ + | m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \ + | m88110-* | m88k-* | maxq-* | mcore-* | metag-* | microblaze-* \ + | mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \ + | mips16-* \ + | mips64-* | mips64el-* \ + | mips64octeon-* | mips64octeonel-* \ + | mips64orion-* | mips64orionel-* \ + | mips64r5900-* | mips64r5900el-* \ + | mips64vr-* | mips64vrel-* \ + | mips64vr4100-* | mips64vr4100el-* \ + | mips64vr4300-* | mips64vr4300el-* \ + | mips64vr5000-* | mips64vr5000el-* \ + | mips64vr5900-* | mips64vr5900el-* \ + | mipsisa32-* | mipsisa32el-* \ + | mipsisa32r2-* | mipsisa32r2el-* \ + | mipsisa64-* | mipsisa64el-* \ + | mipsisa64r2-* | mipsisa64r2el-* \ + | mipsisa64sb1-* | mipsisa64sb1el-* \ + | mipsisa64sr71k-* | mipsisa64sr71kel-* \ + | mipstx39-* | mipstx39el-* \ + | mmix-* \ + | mt-* \ + | msp430-* \ + | nios-* | nios2-* \ + | none-* | np1-* | ns16k-* | ns32k-* \ + | orion-* \ + | pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \ + | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \ + | pyramid-* \ + | romp-* | rs6000-* | rx-* \ + | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \ + | shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \ + | sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \ + | sparclite-* \ + | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \ + | tahoe-* | thumb-* \ + | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \ + | tron-* \ + | ubicom32-* \ + | v850-* | v850e-* | vax-* \ + | we32k-* \ + | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \ + | xstormy16-* | xtensa*-* \ + | ymp-* \ + | z8k-* | z80-*) + ;; + # Recognize the basic CPU types without company name, with glob match. + xtensa*) + basic_machine=$basic_machine-unknown + ;; + # Recognize the various machine names and aliases which stand + # for a CPU type and a company and sometimes even an OS. + 386bsd) + basic_machine=i386-unknown + os=-bsd + ;; + 3b1 | 7300 | 7300-att | att-7300 | pc7300 | safari | unixpc) + basic_machine=m68000-att + ;; + 3b*) + basic_machine=we32k-att + ;; + a29khif) + basic_machine=a29k-amd + os=-udi + ;; + abacus) + basic_machine=abacus-unknown + ;; + adobe68k) + basic_machine=m68010-adobe + os=-scout + ;; + alliant | fx80) + basic_machine=fx80-alliant + ;; + altos | altos3068) + basic_machine=m68k-altos + ;; + am29k) + basic_machine=a29k-none + os=-bsd + ;; + amd64) + basic_machine=x86_64-pc + ;; + amd64-*) + basic_machine=x86_64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + amdahl) + basic_machine=580-amdahl + os=-sysv + ;; + amiga | amiga-*) + basic_machine=m68k-unknown + ;; + amigaos | amigados) + basic_machine=m68k-unknown + os=-amigaos + ;; + amigaunix | amix) + basic_machine=m68k-unknown + os=-sysv4 + ;; + apollo68) + basic_machine=m68k-apollo + os=-sysv + ;; + apollo68bsd) + basic_machine=m68k-apollo + os=-bsd + ;; + aros) + basic_machine=i386-pc + os=-aros + ;; + aux) + basic_machine=m68k-apple + os=-aux + ;; + balance) + basic_machine=ns32k-sequent + os=-dynix + ;; + blackfin) + basic_machine=bfin-unknown + os=-linux + ;; + blackfin-*) + basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + bluegene*) + basic_machine=powerpc-ibm + os=-cnk + ;; + c90) + basic_machine=c90-cray + os=-unicos + ;; + cegcc) + basic_machine=arm-unknown + os=-cegcc + ;; + convex-c1) + basic_machine=c1-convex + os=-bsd + ;; + convex-c2) + basic_machine=c2-convex + os=-bsd + ;; + convex-c32) + basic_machine=c32-convex + os=-bsd + ;; + convex-c34) + basic_machine=c34-convex + os=-bsd + ;; + convex-c38) + basic_machine=c38-convex + os=-bsd + ;; + cray | j90) + basic_machine=j90-cray + os=-unicos + ;; + craynv) + basic_machine=craynv-cray + os=-unicosmp + ;; + cr16) + basic_machine=cr16-unknown + os=-elf + ;; + crds | unos) + basic_machine=m68k-crds + ;; + crisv32 | crisv32-* | etraxfs*) + basic_machine=crisv32-axis + ;; + cris | cris-* | etrax*) + basic_machine=cris-axis + ;; + crx) + basic_machine=crx-unknown + os=-elf + ;; + da30 | da30-*) + basic_machine=m68k-da30 + ;; + decstation | decstation-3100 | pmax | pmax-* | pmin | dec3100 | decstatn) + basic_machine=mips-dec + ;; + decsystem10* | dec10*) + basic_machine=pdp10-dec + os=-tops10 + ;; + decsystem20* | dec20*) + basic_machine=pdp10-dec + os=-tops20 + ;; + delta | 3300 | motorola-3300 | motorola-delta \ + | 3300-motorola | delta-motorola) + basic_machine=m68k-motorola + ;; + delta88) + basic_machine=m88k-motorola + os=-sysv3 + ;; + dicos) + basic_machine=i686-pc + os=-dicos + ;; + djgpp) + basic_machine=i586-pc + os=-msdosdjgpp + ;; + dpx20 | dpx20-*) + basic_machine=rs6000-bull + os=-bosx + ;; + dpx2* | dpx2*-bull) + basic_machine=m68k-bull + os=-sysv3 + ;; + ebmon29k) + basic_machine=a29k-amd + os=-ebmon + ;; + elxsi) + basic_machine=elxsi-elxsi + os=-bsd + ;; + encore | umax | mmax) + basic_machine=ns32k-encore + ;; + es1800 | OSE68k | ose68k | ose | OSE) + basic_machine=m68k-ericsson + os=-ose + ;; + fx2800) + basic_machine=i860-alliant + ;; + genix) + basic_machine=ns32k-ns + ;; + gmicro) + basic_machine=tron-gmicro + os=-sysv + ;; + go32) + basic_machine=i386-pc + os=-go32 + ;; + h3050r* | hiux*) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + h8300hms) + basic_machine=h8300-hitachi + os=-hms + ;; + h8300xray) + basic_machine=h8300-hitachi + os=-xray + ;; + h8500hms) + basic_machine=h8500-hitachi + os=-hms + ;; + harris) + basic_machine=m88k-harris + os=-sysv3 + ;; + hp300-*) + basic_machine=m68k-hp + ;; + hp300bsd) + basic_machine=m68k-hp + os=-bsd + ;; + hp300hpux) + basic_machine=m68k-hp + os=-hpux + ;; + hp3k9[0-9][0-9] | hp9[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k2[0-9][0-9] | hp9k31[0-9]) + basic_machine=m68000-hp + ;; + hp9k3[2-9][0-9]) + basic_machine=m68k-hp + ;; + hp9k6[0-9][0-9] | hp6[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hp9k7[0-79][0-9] | hp7[0-79][0-9]) + basic_machine=hppa1.1-hp + ;; + hp9k78[0-9] | hp78[0-9]) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[67]1 | hp8[67]1 | hp9k80[24] | hp80[24] | hp9k8[78]9 | hp8[78]9 | hp9k893 | hp893) + # FIXME: really hppa2.0-hp + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][13679] | hp8[0-9][13679]) + basic_machine=hppa1.1-hp + ;; + hp9k8[0-9][0-9] | hp8[0-9][0-9]) + basic_machine=hppa1.0-hp + ;; + hppa-next) + os=-nextstep3 + ;; + hppaosf) + basic_machine=hppa1.1-hp + os=-osf + ;; + hppro) + basic_machine=hppa1.1-hp + os=-proelf + ;; + i370-ibm* | ibm*) + basic_machine=i370-ibm + ;; +# I'm not sure what "Sysv32" means. Should this be sysv3.2? + i*86v32) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv32 + ;; + i*86v4*) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv4 + ;; + i*86v) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-sysv + ;; + i*86sol2) + basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'` + os=-solaris2 + ;; + i386mach) + basic_machine=i386-mach + os=-mach + ;; + i386-vsta | vsta) + basic_machine=i386-unknown + os=-vsta + ;; + iris | iris4d) + basic_machine=mips-sgi + case $os in + -irix*) + ;; + *) + os=-irix4 + ;; + esac + ;; + isi68 | isi) + basic_machine=m68k-isi + os=-sysv + ;; + m68knommu) + basic_machine=m68k-unknown + os=-linux + ;; + m68knommu-*) + basic_machine=m68k-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + m88k-omron*) + basic_machine=m88k-omron + ;; + magnum | m3230) + basic_machine=mips-mips + os=-sysv + ;; + merlin) + basic_machine=ns32k-utek + os=-sysv + ;; + microblaze) + basic_machine=microblaze-xilinx + ;; + mingw32) + basic_machine=i386-pc + os=-mingw32 + ;; + mingw32ce) + basic_machine=arm-unknown + os=-mingw32ce + ;; + miniframe) + basic_machine=m68000-convergent + ;; + *mint | -mint[0-9]* | *MiNT | *MiNT[0-9]*) + basic_machine=m68k-atari + os=-mint + ;; + mips3*-*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'` + ;; + mips3*) + basic_machine=`echo $basic_machine | sed -e 's/mips3/mips64/'`-unknown + ;; + monitor) + basic_machine=m68k-rom68k + os=-coff + ;; + morphos) + basic_machine=powerpc-unknown + os=-morphos + ;; + msdos) + basic_machine=i386-pc + os=-msdos + ;; + ms1-*) + basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'` + ;; + mvs) + basic_machine=i370-ibm + os=-mvs + ;; + ncr3000) + basic_machine=i486-ncr + os=-sysv4 + ;; + netbsd386) + basic_machine=i386-unknown + os=-netbsd + ;; + netwinder) + basic_machine=armv4l-rebel + os=-linux + ;; + news | news700 | news800 | news900) + basic_machine=m68k-sony + os=-newsos + ;; + news1000) + basic_machine=m68030-sony + os=-newsos + ;; + news-3600 | risc-news) + basic_machine=mips-sony + os=-newsos + ;; + necv70) + basic_machine=v70-nec + os=-sysv + ;; + next | m*-next ) + basic_machine=m68k-next + case $os in + -nextstep* ) + ;; + -ns2*) + os=-nextstep2 + ;; + *) + os=-nextstep3 + ;; + esac + ;; + nh3000) + basic_machine=m68k-harris + os=-cxux + ;; + nh[45]000) + basic_machine=m88k-harris + os=-cxux + ;; + nindy960) + basic_machine=i960-intel + os=-nindy + ;; + mon960) + basic_machine=i960-intel + os=-mon960 + ;; + nonstopux) + basic_machine=mips-compaq + os=-nonstopux + ;; + np1) + basic_machine=np1-gould + ;; + nsr-tandem) + basic_machine=nsr-tandem + ;; + op50n-* | op60c-*) + basic_machine=hppa1.1-oki + os=-proelf + ;; + openrisc | openrisc-*) + basic_machine=or32-unknown + ;; + os400) + basic_machine=powerpc-ibm + os=-os400 + ;; + OSE68000 | ose68000) + basic_machine=m68000-ericsson + os=-ose + ;; + os68k) + basic_machine=m68k-none + os=-os68k + ;; + pa-hitachi) + basic_machine=hppa1.1-hitachi + os=-hiuxwe2 + ;; + paragon) + basic_machine=i860-intel + os=-osf + ;; + parisc) + basic_machine=hppa-unknown + os=-linux + ;; + parisc-*) + basic_machine=hppa-`echo $basic_machine | sed 's/^[^-]*-//'` + os=-linux + ;; + pbd) + basic_machine=sparc-tti + ;; + pbb) + basic_machine=m68k-tti + ;; + pc532 | pc532-*) + basic_machine=ns32k-pc532 + ;; + pc98) + basic_machine=i386-pc + ;; + pc98-*) + basic_machine=i386-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium | p5 | k5 | k6 | nexgen | viac3) + basic_machine=i586-pc + ;; + pentiumpro | p6 | 6x86 | athlon | athlon_*) + basic_machine=i686-pc + ;; + pentiumii | pentium2 | pentiumiii | pentium3) + basic_machine=i686-pc + ;; + pentium4) + basic_machine=i786-pc + ;; + pentium-* | p5-* | k5-* | k6-* | nexgen-* | viac3-*) + basic_machine=i586-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumpro-* | p6-* | 6x86-* | athlon-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentiumii-* | pentium2-* | pentiumiii-* | pentium3-*) + basic_machine=i686-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pentium4-*) + basic_machine=i786-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + pn) + basic_machine=pn-gould + ;; + power) basic_machine=power-ibm + ;; + ppc) basic_machine=powerpc-unknown + ;; + ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppcle | powerpclittle | ppc-le | powerpc-little) + basic_machine=powerpcle-unknown + ;; + ppcle-* | powerpclittle-*) + basic_machine=powerpcle-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64) basic_machine=powerpc64-unknown + ;; + ppc64-*) basic_machine=powerpc64-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ppc64le | powerpc64little | ppc64-le | powerpc64-little) + basic_machine=powerpc64le-unknown + ;; + ppc64le-* | powerpc64little-*) + basic_machine=powerpc64le-`echo $basic_machine | sed 's/^[^-]*-//'` + ;; + ps2) + basic_machine=i386-ibm + ;; + pw32) + basic_machine=i586-unknown + os=-pw32 + ;; + rdos) + basic_machine=i386-pc + os=-rdos + ;; + rom68k) + basic_machine=m68k-rom68k + os=-coff + ;; + rm[46]00) + basic_machine=mips-siemens + ;; + rtpc | rtpc-*) + basic_machine=romp-ibm + ;; + s390 | s390-*) + basic_machine=s390-ibm + ;; + s390x | s390x-*) + basic_machine=s390x-ibm + ;; + sa29200) + basic_machine=a29k-amd + os=-udi + ;; + sb1) + basic_machine=mipsisa64sb1-unknown + ;; + sb1el) + basic_machine=mipsisa64sb1el-unknown + ;; + sde) + basic_machine=mipsisa32-sde + os=-elf + ;; + sei) + basic_machine=mips-sei + os=-seiux + ;; + sequent) + basic_machine=i386-sequent + ;; + sh) + basic_machine=sh-hitachi + os=-hms + ;; + sh5el) + basic_machine=sh5le-unknown + ;; + sh64) + basic_machine=sh64-unknown + ;; + sparclite-wrs | simso-wrs) + basic_machine=sparclite-wrs + os=-vxworks + ;; + sps7) + basic_machine=m68k-bull + os=-sysv2 + ;; + spur) + basic_machine=spur-unknown + ;; + st2000) + basic_machine=m68k-tandem + ;; + stratus) + basic_machine=i860-stratus + os=-sysv4 + ;; + sun2) + basic_machine=m68000-sun + ;; + sun2os3) + basic_machine=m68000-sun + os=-sunos3 + ;; + sun2os4) + basic_machine=m68000-sun + os=-sunos4 + ;; + sun3os3) + basic_machine=m68k-sun + os=-sunos3 + ;; + sun3os4) + basic_machine=m68k-sun + os=-sunos4 + ;; + sun4os3) + basic_machine=sparc-sun + os=-sunos3 + ;; + sun4os4) + basic_machine=sparc-sun + os=-sunos4 + ;; + sun4sol2) + basic_machine=sparc-sun + os=-solaris2 + ;; + sun3 | sun3-*) + basic_machine=m68k-sun + ;; + sun4) + basic_machine=sparc-sun + ;; + sun386 | sun386i | roadrunner) + basic_machine=i386-sun + ;; + sv1) + basic_machine=sv1-cray + os=-unicos + ;; + symmetry) + basic_machine=i386-sequent + os=-dynix + ;; + t3e) + basic_machine=alphaev5-cray + os=-unicos + ;; + t90) + basic_machine=t90-cray + os=-unicos + ;; + tic54x | c54x*) + basic_machine=tic54x-unknown + os=-coff + ;; + tic55x | c55x*) + basic_machine=tic55x-unknown + os=-coff + ;; + tic6x | c6x*) + basic_machine=tic6x-unknown + os=-coff + ;; + tile*) + basic_machine=tile-unknown + os=-linux-gnu + ;; + tx39) + basic_machine=mipstx39-unknown + ;; + tx39el) + basic_machine=mipstx39el-unknown + ;; + toad1) + basic_machine=pdp10-xkl + os=-tops20 + ;; + tower | tower-32) + basic_machine=m68k-ncr + ;; + tpf) + basic_machine=s390x-ibm + os=-tpf + ;; + udi29k) + basic_machine=a29k-amd + os=-udi + ;; + ultra3) + basic_machine=a29k-nyu + os=-sym1 + ;; + v810 | necv810) + basic_machine=v810-nec + os=-none + ;; + vaxv) + basic_machine=vax-dec + os=-sysv + ;; + vms) + basic_machine=vax-dec + os=-vms + ;; + vpp*|vx|vx-*) + basic_machine=f301-fujitsu + ;; + vxworks960) + basic_machine=i960-wrs + os=-vxworks + ;; + vxworks68) + basic_machine=m68k-wrs + os=-vxworks + ;; + vxworks29k) + basic_machine=a29k-wrs + os=-vxworks + ;; + w65*) + basic_machine=w65-wdc + os=-none + ;; + w89k-*) + basic_machine=hppa1.1-winbond + os=-proelf + ;; + xbox) + basic_machine=i686-pc + os=-mingw32 + ;; + xps | xps100) + basic_machine=xps100-honeywell + ;; + ymp) + basic_machine=ymp-cray + os=-unicos + ;; + z8k-*-coff) + basic_machine=z8k-unknown + os=-sim + ;; + z80-*-coff) + basic_machine=z80-unknown + os=-sim + ;; + none) + basic_machine=none-none + os=-none + ;; + +# Here we handle the default manufacturer of certain CPU types. It is in +# some cases the only manufacturer, in others, it is the most popular. + w89k) + basic_machine=hppa1.1-winbond + ;; + op50n) + basic_machine=hppa1.1-oki + ;; + op60c) + basic_machine=hppa1.1-oki + ;; + romp) + basic_machine=romp-ibm + ;; + mmix) + basic_machine=mmix-knuth + ;; + rs6000) + basic_machine=rs6000-ibm + ;; + vax) + basic_machine=vax-dec + ;; + pdp10) + # there are many clones, so DEC is not a safe bet + basic_machine=pdp10-unknown + ;; + pdp11) + basic_machine=pdp11-dec + ;; + we32k) + basic_machine=we32k-att + ;; + sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele) + basic_machine=sh-unknown + ;; + sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v) + basic_machine=sparc-sun + ;; + cydra) + basic_machine=cydra-cydrome + ;; + orion) + basic_machine=orion-highlevel + ;; + orion105) + basic_machine=clipper-highlevel + ;; + mac | mpw | mac-mpw) + basic_machine=m68k-apple + ;; + pmac | pmac-mpw) + basic_machine=powerpc-apple + ;; + *-unknown) + # Make sure to match an already-canonicalized machine name. + ;; + *) + echo Invalid configuration \`$1\': machine \`$basic_machine\' not recognized 1>&2 + exit 1 + ;; +esac + +# Here we canonicalize certain aliases for manufacturers. +case $basic_machine in + *-digital*) + basic_machine=`echo $basic_machine | sed 's/digital.*/dec/'` + ;; + *-commodore*) + basic_machine=`echo $basic_machine | sed 's/commodore.*/cbm/'` + ;; + *) + ;; +esac + +# Decode manufacturer-specific aliases for certain operating systems. + +if [ x"$os" != x"" ] +then +case $os in + # First match some system type aliases + # that might get confused with valid system types. + # -solaris* is a basic system type, with this one exception. + -auroraux) + os=-auroraux + ;; + -solaris1 | -solaris1.*) + os=`echo $os | sed -e 's|solaris1|sunos4|'` + ;; + -solaris) + os=-solaris2 + ;; + -svr4*) + os=-sysv4 + ;; + -unixware*) + os=-sysv4.2uw + ;; + -gnu/linux*) + os=`echo $os | sed -e 's|gnu/linux|linux-gnu|'` + ;; + # First accept the basic system types. + # The portable systems comes first. + # Each alternative MUST END IN A *, to match a version number. + # -sysv* is not here because it comes later, after sysvr4. + -gnu* | -bsd* | -mach* | -minix* | -genix* | -ultrix* | -irix* \ + | -*vms* | -sco* | -esix* | -isc* | -aix* | -cnk* | -sunos | -sunos[34]*\ + | -hpux* | -unos* | -osf* | -luna* | -dgux* | -auroraux* | -solaris* \ + | -sym* | -kopensolaris* \ + | -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \ + | -aos* | -aros* \ + | -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \ + | -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \ + | -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \ + | -openbsd* | -solidbsd* \ + | -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \ + | -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \ + | -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \ + | -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \ + | -chorusos* | -chorusrdb* | -cegcc* \ + | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \ + | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \ + | -uxpv* | -beos* | -mpeix* | -udk* \ + | -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \ + | -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \ + | -storm-chaos* | -tops10* | -tenex* | -tops20* | -its* \ + | -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \ + | -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \ + | -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \ + | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*) + # Remember, each alternative MUST END IN *, to match a version number. + ;; + -qnx*) + case $basic_machine in + x86-* | i*86-*) + ;; + *) + os=-nto$os + ;; + esac + ;; + -nto-qnx*) + ;; + -nto*) + os=`echo $os | sed -e 's|nto|nto-qnx|'` + ;; + -sim | -es1800* | -hms* | -xray | -os68k* | -none* | -v88r* \ + | -windows* | -osx | -abug | -netware* | -os9* | -beos* | -haiku* \ + | -macos* | -mpw* | -magic* | -mmixware* | -mon960* | -lnews*) + ;; + -mac*) + os=`echo $os | sed -e 's|mac|macos|'` + ;; + -linux-dietlibc) + os=-linux-dietlibc + ;; + -linux*) + os=`echo $os | sed -e 's|linux|linux-gnu|'` + ;; + -sunos5*) + os=`echo $os | sed -e 's|sunos5|solaris2|'` + ;; + -sunos6*) + os=`echo $os | sed -e 's|sunos6|solaris3|'` + ;; + -opened*) + os=-openedition + ;; + -os400*) + os=-os400 + ;; + -wince*) + os=-wince + ;; + -osfrose*) + os=-osfrose + ;; + -osf*) + os=-osf + ;; + -utek*) + os=-bsd + ;; + -dynix*) + os=-bsd + ;; + -acis*) + os=-aos + ;; + -atheos*) + os=-atheos + ;; + -syllable*) + os=-syllable + ;; + -386bsd) + os=-bsd + ;; + -ctix* | -uts*) + os=-sysv + ;; + -nova*) + os=-rtmk-nova + ;; + -ns2 ) + os=-nextstep2 + ;; + -nsk*) + os=-nsk + ;; + # Preserve the version number of sinix5. + -sinix5.*) + os=`echo $os | sed -e 's|sinix|sysv|'` + ;; + -sinix*) + os=-sysv4 + ;; + -tpf*) + os=-tpf + ;; + -triton*) + os=-sysv3 + ;; + -oss*) + os=-sysv3 + ;; + -svr4) + os=-sysv4 + ;; + -svr3) + os=-sysv3 + ;; + -sysvr4) + os=-sysv4 + ;; + # This must come after -sysvr4. + -sysv*) + ;; + -ose*) + os=-ose + ;; + -es1800*) + os=-ose + ;; + -xenix) + os=-xenix + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + os=-mint + ;; + -aros*) + os=-aros + ;; + -kaos*) + os=-kaos + ;; + -zvmoe) + os=-zvmoe + ;; + -dicos*) + os=-dicos + ;; + -none) + ;; + *) + # Get rid of the `-' at the beginning of $os. + os=`echo $os | sed 's/[^-]*-//'` + echo Invalid configuration \`$1\': system \`$os\' not recognized 1>&2 + exit 1 + ;; +esac +else + +# Here we handle the default operating systems that come with various machines. +# The value should be what the vendor currently ships out the door with their +# machine or put another way, the most popular os provided with the machine. + +# Note that if you're going to try to match "-MANUFACTURER" here (say, +# "-sun"), then you have to tell the case statement up towards the top +# that MANUFACTURER isn't an operating system. Otherwise, code above +# will signal an error saying that MANUFACTURER isn't an operating +# system, and we'll never get to this point. + +case $basic_machine in + score-*) + os=-elf + ;; + spu-*) + os=-elf + ;; + *-acorn) + os=-riscix1.2 + ;; + arm*-rebel) + os=-linux + ;; + arm*-semi) + os=-aout + ;; + c4x-* | tic4x-*) + os=-coff + ;; + # This must come before the *-dec entry. + pdp10-*) + os=-tops20 + ;; + pdp11-*) + os=-none + ;; + *-dec | vax-*) + os=-ultrix4.2 + ;; + m68*-apollo) + os=-domain + ;; + i386-sun) + os=-sunos4.0.2 + ;; + m68000-sun) + os=-sunos3 + # This also exists in the configure program, but was not the + # default. + # os=-sunos4 + ;; + m68*-cisco) + os=-aout + ;; + mep-*) + os=-elf + ;; + mips*-cisco) + os=-elf + ;; + mips*-*) + os=-elf + ;; + or32-*) + os=-coff + ;; + *-tti) # must be before sparc entry or we get the wrong os. + os=-sysv3 + ;; + sparc-* | *-sun) + os=-sunos4.1.1 + ;; + *-be) + os=-beos + ;; + *-haiku) + os=-haiku + ;; + *-ibm) + os=-aix + ;; + *-knuth) + os=-mmixware + ;; + *-wec) + os=-proelf + ;; + *-winbond) + os=-proelf + ;; + *-oki) + os=-proelf + ;; + *-hp) + os=-hpux + ;; + *-hitachi) + os=-hiux + ;; + i860-* | *-att | *-ncr | *-altos | *-motorola | *-convergent) + os=-sysv + ;; + *-cbm) + os=-amigaos + ;; + *-dg) + os=-dgux + ;; + *-dolphin) + os=-sysv3 + ;; + m68k-ccur) + os=-rtu + ;; + m88k-omron*) + os=-luna + ;; + *-next ) + os=-nextstep + ;; + *-sequent) + os=-ptx + ;; + *-crds) + os=-unos + ;; + *-ns) + os=-genix + ;; + i370-*) + os=-mvs + ;; + *-next) + os=-nextstep3 + ;; + *-gould) + os=-sysv + ;; + *-highlevel) + os=-bsd + ;; + *-encore) + os=-bsd + ;; + *-sgi) + os=-irix + ;; + *-siemens) + os=-sysv4 + ;; + *-masscomp) + os=-rtu + ;; + f30[01]-fujitsu | f700-fujitsu) + os=-uxpv + ;; + *-rom68k) + os=-coff + ;; + *-*bug) + os=-coff + ;; + *-apple) + os=-macos + ;; + *-atari*) + os=-mint + ;; + *) + os=-none + ;; +esac +fi + +# Here we handle the case where we know the os, and the CPU type, but not the +# manufacturer. We pick the logical manufacturer. +vendor=unknown +case $basic_machine in + *-unknown) + case $os in + -riscix*) + vendor=acorn + ;; + -sunos*) + vendor=sun + ;; + -cnk*|-aix*) + vendor=ibm + ;; + -beos*) + vendor=be + ;; + -hpux*) + vendor=hp + ;; + -mpeix*) + vendor=hp + ;; + -hiux*) + vendor=hitachi + ;; + -unos*) + vendor=crds + ;; + -dgux*) + vendor=dg + ;; + -luna*) + vendor=omron + ;; + -genix*) + vendor=ns + ;; + -mvs* | -opened*) + vendor=ibm + ;; + -os400*) + vendor=ibm + ;; + -ptx*) + vendor=sequent + ;; + -tpf*) + vendor=ibm + ;; + -vxsim* | -vxworks* | -windiss*) + vendor=wrs + ;; + -aux*) + vendor=apple + ;; + -hms*) + vendor=hitachi + ;; + -mpw* | -macos*) + vendor=apple + ;; + -*mint | -mint[0-9]* | -*MiNT | -MiNT[0-9]*) + vendor=atari + ;; + -vos*) + vendor=stratus + ;; + esac + basic_machine=`echo $basic_machine | sed "s/unknown/$vendor/"` + ;; +esac + +echo $basic_machine$os +exit + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "timestamp='" +# time-stamp-format: "%:y-%02m-%02d" +# time-stamp-end: "'" +# End: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/configure b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/configure new file mode 100755 index 000000000..231c83ab0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/configure @@ -0,0 +1,17191 @@ +#! /bin/sh +# Guess values for system-dependent variables and create Makefiles. +# Generated by GNU Autoconf 2.68 for libffi 3.0.10. +# +# Report bugs to . +# +# +# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, +# 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 Free Software +# Foundation, Inc. +# +# +# This configure script is free software; the Free Software Foundation +# gives unlimited permission to copy, distribute and modify it. +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +if test "x$CONFIG_SHELL" = x; then + as_bourne_compatible="if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi +" + as_required="as_fn_return () { (exit \$1); } +as_fn_success () { as_fn_return 0; } +as_fn_failure () { as_fn_return 1; } +as_fn_ret_success () { return 0; } +as_fn_ret_failure () { return 1; } + +exitcode=0 +as_fn_success || { exitcode=1; echo as_fn_success failed.; } +as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; } +as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; } +as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; } +if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then : + +else + exitcode=1; echo positional parameters were not saved. +fi +test x\$exitcode = x0 || exit 1" + as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO + as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO + eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" && + test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1 + + test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\ + || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1 +test \$(( 1 + 1 )) = 2 || exit 1" + if (eval "$as_required") 2>/dev/null; then : + as_have_required=yes +else + as_have_required=no +fi + if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then : + +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_found=false +for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + as_found=: + case $as_dir in #( + /*) + for as_base in sh bash ksh sh5; do + # Try only shells that exist, to save several forks. + as_shell=$as_dir/$as_base + if { test -f "$as_shell" || test -f "$as_shell.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then : + CONFIG_SHELL=$as_shell as_have_required=yes + if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then : + break 2 +fi +fi + done;; + esac + as_found=false +done +$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } && + { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then : + CONFIG_SHELL=$SHELL as_have_required=yes +fi; } +IFS=$as_save_IFS + + + if test "x$CONFIG_SHELL" != x; then : + # We cannot yet assume a decent shell, so we have to provide a + # neutralization value for shells without unset; and this also + # works around shells that cannot unset nonexistent variables. + # Preserve -v and -x to the replacement shell. + BASH_ENV=/dev/null + ENV=/dev/null + (unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV + export CONFIG_SHELL + case $- in # (((( + *v*x* | *x*v* ) as_opts=-vx ;; + *v* ) as_opts=-v ;; + *x* ) as_opts=-x ;; + * ) as_opts= ;; + esac + exec "$CONFIG_SHELL" $as_opts "$as_myself" ${1+"$@"} +fi + + if test x$as_have_required = xno; then : + $as_echo "$0: This script requires a shell more modern than all" + $as_echo "$0: the shells that I found on your system." + if test x${ZSH_VERSION+set} = xset ; then + $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should" + $as_echo "$0: be upgraded to zsh 4.3.4 or later." + else + $as_echo "$0: Please tell bug-autoconf@gnu.org and +$0: http://sourceware.org/libffi.html about your system, +$0: including any error possibly output before this +$0: message. Then install a modern shell, or manually run +$0: the script under such a shell if you do have one." + fi + exit 1 +fi +fi +fi +SHELL=${CONFIG_SHELL-/bin/sh} +export SHELL +# Unset more variables known to interfere with behavior of common tools. +CLICOLOR_FORCE= GREP_OPTIONS= +unset CLICOLOR_FORCE GREP_OPTIONS + +## --------------------- ## +## M4sh Shell Functions. ## +## --------------------- ## +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + + + as_lineno_1=$LINENO as_lineno_1a=$LINENO + as_lineno_2=$LINENO as_lineno_2a=$LINENO + eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" && + test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || { + # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-) + sed -n ' + p + /[$]LINENO/= + ' <$as_myself | + sed ' + s/[$]LINENO.*/&-/ + t lineno + b + :lineno + N + :loop + s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/ + t loop + s/-\n.*// + ' >$as_me.lineno && + chmod +x "$as_me.lineno" || + { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; } + + # Don't try to exec as it changes $[0], causing all sort of problems + # (the dirname of $[0] is not the place where we might find the + # original and so on. Autoconf is especially sensitive to this). + . "./$as_me.lineno" + # Exit status is that of the last command. + exit +} + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + +SHELL=${CONFIG_SHELL-/bin/sh} + + +test -n "$DJDIR" || exec 7<&0 &1 + +# Name of the host. +# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status, +# so uname gets run too. +ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q` + +# +# Initializations. +# +ac_default_prefix=/usr/local +ac_clean_files= +ac_config_libobj_dir=. +LIBOBJS= +cross_compiling=no +subdirs= +MFLAGS= +MAKEFLAGS= + +# Identity of this package. +PACKAGE_NAME='libffi' +PACKAGE_TARNAME='libffi' +PACKAGE_VERSION='3.0.10' +PACKAGE_STRING='libffi 3.0.10' +PACKAGE_BUGREPORT='http://sourceware.org/libffi.html' +PACKAGE_URL='' + +# Factoring default headers for most tests. +ac_includes_default="\ +#include +#ifdef HAVE_SYS_TYPES_H +# include +#endif +#ifdef HAVE_SYS_STAT_H +# include +#endif +#ifdef STDC_HEADERS +# include +# include +#else +# ifdef HAVE_STDLIB_H +# include +# endif +#endif +#ifdef HAVE_STRING_H +# if !defined STDC_HEADERS && defined HAVE_MEMORY_H +# include +# endif +# include +#endif +#ifdef HAVE_STRINGS_H +# include +#endif +#ifdef HAVE_INTTYPES_H +# include +#endif +#ifdef HAVE_STDINT_H +# include +#endif +#ifdef HAVE_UNISTD_H +# include +#endif" + +ac_subst_vars='am__EXEEXT_FALSE +am__EXEEXT_TRUE +LTLIBOBJS +LIBOBJS +toolexeclibdir +toolexecdir +FFI_DEBUG_FALSE +FFI_DEBUG_TRUE +TARGETDIR +TARGET +FFI_EXEC_TRAMPOLINE_TABLE +FFI_EXEC_TRAMPOLINE_TABLE_FALSE +FFI_EXEC_TRAMPOLINE_TABLE_TRUE +sys_symbol_underscore +HAVE_LONG_DOUBLE +ALLOCA +PA64_HPUX_FALSE +PA64_HPUX_TRUE +PA_HPUX_FALSE +PA_HPUX_TRUE +PA_LINUX_FALSE +PA_LINUX_TRUE +SH64_FALSE +SH64_TRUE +SH_FALSE +SH_TRUE +X86_64_FALSE +X86_64_TRUE +S390_FALSE +S390_TRUE +FRV_FALSE +FRV_TRUE +LIBFFI_CRIS_FALSE +LIBFFI_CRIS_TRUE +AVR32_FALSE +AVR32_TRUE +ARM_FALSE +ARM_TRUE +POWERPC_FREEBSD_FALSE +POWERPC_FREEBSD_TRUE +POWERPC_DARWIN_FALSE +POWERPC_DARWIN_TRUE +POWERPC_AIX_FALSE +POWERPC_AIX_TRUE +POWERPC_FALSE +POWERPC_TRUE +MOXIE_FALSE +MOXIE_TRUE +M68K_FALSE +M68K_TRUE +M32R_FALSE +M32R_TRUE +IA64_FALSE +IA64_TRUE +ALPHA_FALSE +ALPHA_TRUE +X86_DARWIN_FALSE +X86_DARWIN_TRUE +X86_WIN64_FALSE +X86_WIN64_TRUE +X86_WIN32_FALSE +X86_WIN32_TRUE +X86_FREEBSD_FALSE +X86_FREEBSD_TRUE +X86_FALSE +X86_TRUE +SPARC_FALSE +SPARC_TRUE +MIPS_FALSE +MIPS_TRUE +AM_LTLDFLAGS +AM_RUNTESTFLAGS +TESTSUBDIR_FALSE +TESTSUBDIR_TRUE +MAINT +MAINTAINER_MODE_FALSE +MAINTAINER_MODE_TRUE +PRTDIAG +CPP +OTOOL64 +OTOOL +LIPO +NMEDIT +DSYMUTIL +MANIFEST_TOOL +RANLIB +ac_ct_AR +AR +DLLTOOL +OBJDUMP +LN_S +NM +ac_ct_DUMPBIN +DUMPBIN +LD +FGREP +EGREP +GREP +SED +LIBTOOL +am__fastdepCCAS_FALSE +am__fastdepCCAS_TRUE +CCASDEPMODE +CCASFLAGS +CCAS +am__fastdepCC_FALSE +am__fastdepCC_TRUE +CCDEPMODE +AMDEPBACKSLASH +AMDEP_FALSE +AMDEP_TRUE +am__quote +am__include +DEPDIR +OBJEXT +EXEEXT +ac_ct_CC +CPPFLAGS +LDFLAGS +CFLAGS +CC +am__untar +am__tar +AMTAR +am__leading_dot +SET_MAKE +AWK +mkdir_p +MKDIR_P +INSTALL_STRIP_PROGRAM +STRIP +install_sh +MAKEINFO +AUTOHEADER +AUTOMAKE +AUTOCONF +ACLOCAL +VERSION +PACKAGE +CYGPATH_W +am__isrc +INSTALL_DATA +INSTALL_SCRIPT +INSTALL_PROGRAM +ax_enable_builddir_sed +target_os +target_vendor +target_cpu +target +host_os +host_vendor +host_cpu +host +build_os +build_vendor +build_cpu +build +target_alias +host_alias +build_alias +LIBS +ECHO_T +ECHO_N +ECHO_C +DEFS +mandir +localedir +libdir +psdir +pdfdir +dvidir +htmldir +infodir +docdir +oldincludedir +includedir +localstatedir +sharedstatedir +sysconfdir +datadir +datarootdir +libexecdir +sbindir +bindir +program_transform_name +prefix +exec_prefix +PACKAGE_URL +PACKAGE_BUGREPORT +PACKAGE_STRING +PACKAGE_VERSION +PACKAGE_TARNAME +PACKAGE_NAME +PATH_SEPARATOR +SHELL' +ac_subst_files='' +ac_user_opts=' +enable_option_checking +enable_builddir +enable_dependency_tracking +enable_shared +enable_static +with_pic +enable_fast_install +with_gnu_ld +with_sysroot +enable_libtool_lock +enable_portable_binary +with_gcc_arch +enable_maintainer_mode +enable_debug +enable_structs +enable_raw_api +enable_purify_safety +' + ac_precious_vars='build_alias +host_alias +target_alias +CCAS +CCASFLAGS +CPP +CPPFLAGS' + + +# Initialize some variables set by options. +ac_init_help= +ac_init_version=false +ac_unrecognized_opts= +ac_unrecognized_sep= +# The variables have the same names as the options, with +# dashes changed to underlines. +cache_file=/dev/null +exec_prefix=NONE +no_create= +no_recursion= +prefix=NONE +program_prefix=NONE +program_suffix=NONE +program_transform_name=s,x,x, +silent= +site= +srcdir= +verbose= +x_includes=NONE +x_libraries=NONE + +# Installation directory options. +# These are left unexpanded so users can "make install exec_prefix=/foo" +# and all the variables that are supposed to be based on exec_prefix +# by default will actually change. +# Use braces instead of parens because sh, perl, etc. also accept them. +# (The list follows the same order as the GNU Coding Standards.) +bindir='${exec_prefix}/bin' +sbindir='${exec_prefix}/sbin' +libexecdir='${exec_prefix}/libexec' +datarootdir='${prefix}/share' +datadir='${datarootdir}' +sysconfdir='${prefix}/etc' +sharedstatedir='${prefix}/com' +localstatedir='${prefix}/var' +includedir='${prefix}/include' +oldincludedir='/usr/include' +docdir='${datarootdir}/doc/${PACKAGE_TARNAME}' +infodir='${datarootdir}/info' +htmldir='${docdir}' +dvidir='${docdir}' +pdfdir='${docdir}' +psdir='${docdir}' +libdir='${exec_prefix}/lib' +localedir='${datarootdir}/locale' +mandir='${datarootdir}/man' + +ac_prev= +ac_dashdash= +for ac_option +do + # If the previous option needs an argument, assign it. + if test -n "$ac_prev"; then + eval $ac_prev=\$ac_option + ac_prev= + continue + fi + + case $ac_option in + *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;; + *=) ac_optarg= ;; + *) ac_optarg=yes ;; + esac + + # Accept the important Cygnus configure options, so we can diagnose typos. + + case $ac_dashdash$ac_option in + --) + ac_dashdash=yes ;; + + -bindir | --bindir | --bindi | --bind | --bin | --bi) + ac_prev=bindir ;; + -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*) + bindir=$ac_optarg ;; + + -build | --build | --buil | --bui | --bu) + ac_prev=build_alias ;; + -build=* | --build=* | --buil=* | --bui=* | --bu=*) + build_alias=$ac_optarg ;; + + -cache-file | --cache-file | --cache-fil | --cache-fi \ + | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c) + ac_prev=cache_file ;; + -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \ + | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*) + cache_file=$ac_optarg ;; + + --config-cache | -C) + cache_file=config.cache ;; + + -datadir | --datadir | --datadi | --datad) + ac_prev=datadir ;; + -datadir=* | --datadir=* | --datadi=* | --datad=*) + datadir=$ac_optarg ;; + + -datarootdir | --datarootdir | --datarootdi | --datarootd | --dataroot \ + | --dataroo | --dataro | --datar) + ac_prev=datarootdir ;; + -datarootdir=* | --datarootdir=* | --datarootdi=* | --datarootd=* \ + | --dataroot=* | --dataroo=* | --dataro=* | --datar=*) + datarootdir=$ac_optarg ;; + + -disable-* | --disable-*) + ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=no ;; + + -docdir | --docdir | --docdi | --doc | --do) + ac_prev=docdir ;; + -docdir=* | --docdir=* | --docdi=* | --doc=* | --do=*) + docdir=$ac_optarg ;; + + -dvidir | --dvidir | --dvidi | --dvid | --dvi | --dv) + ac_prev=dvidir ;; + -dvidir=* | --dvidir=* | --dvidi=* | --dvid=* | --dvi=* | --dv=*) + dvidir=$ac_optarg ;; + + -enable-* | --enable-*) + ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid feature name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"enable_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval enable_$ac_useropt=\$ac_optarg ;; + + -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \ + | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \ + | --exec | --exe | --ex) + ac_prev=exec_prefix ;; + -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \ + | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \ + | --exec=* | --exe=* | --ex=*) + exec_prefix=$ac_optarg ;; + + -gas | --gas | --ga | --g) + # Obsolete; use --with-gas. + with_gas=yes ;; + + -help | --help | --hel | --he | -h) + ac_init_help=long ;; + -help=r* | --help=r* | --hel=r* | --he=r* | -hr*) + ac_init_help=recursive ;; + -help=s* | --help=s* | --hel=s* | --he=s* | -hs*) + ac_init_help=short ;; + + -host | --host | --hos | --ho) + ac_prev=host_alias ;; + -host=* | --host=* | --hos=* | --ho=*) + host_alias=$ac_optarg ;; + + -htmldir | --htmldir | --htmldi | --htmld | --html | --htm | --ht) + ac_prev=htmldir ;; + -htmldir=* | --htmldir=* | --htmldi=* | --htmld=* | --html=* | --htm=* \ + | --ht=*) + htmldir=$ac_optarg ;; + + -includedir | --includedir | --includedi | --included | --include \ + | --includ | --inclu | --incl | --inc) + ac_prev=includedir ;; + -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \ + | --includ=* | --inclu=* | --incl=* | --inc=*) + includedir=$ac_optarg ;; + + -infodir | --infodir | --infodi | --infod | --info | --inf) + ac_prev=infodir ;; + -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*) + infodir=$ac_optarg ;; + + -libdir | --libdir | --libdi | --libd) + ac_prev=libdir ;; + -libdir=* | --libdir=* | --libdi=* | --libd=*) + libdir=$ac_optarg ;; + + -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \ + | --libexe | --libex | --libe) + ac_prev=libexecdir ;; + -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \ + | --libexe=* | --libex=* | --libe=*) + libexecdir=$ac_optarg ;; + + -localedir | --localedir | --localedi | --localed | --locale) + ac_prev=localedir ;; + -localedir=* | --localedir=* | --localedi=* | --localed=* | --locale=*) + localedir=$ac_optarg ;; + + -localstatedir | --localstatedir | --localstatedi | --localstated \ + | --localstate | --localstat | --localsta | --localst | --locals) + ac_prev=localstatedir ;; + -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \ + | --localstate=* | --localstat=* | --localsta=* | --localst=* | --locals=*) + localstatedir=$ac_optarg ;; + + -mandir | --mandir | --mandi | --mand | --man | --ma | --m) + ac_prev=mandir ;; + -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*) + mandir=$ac_optarg ;; + + -nfp | --nfp | --nf) + # Obsolete; use --without-fp. + with_fp=no ;; + + -no-create | --no-create | --no-creat | --no-crea | --no-cre \ + | --no-cr | --no-c | -n) + no_create=yes ;; + + -no-recursion | --no-recursion | --no-recursio | --no-recursi \ + | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) + no_recursion=yes ;; + + -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \ + | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \ + | --oldin | --oldi | --old | --ol | --o) + ac_prev=oldincludedir ;; + -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \ + | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \ + | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*) + oldincludedir=$ac_optarg ;; + + -prefix | --prefix | --prefi | --pref | --pre | --pr | --p) + ac_prev=prefix ;; + -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*) + prefix=$ac_optarg ;; + + -program-prefix | --program-prefix | --program-prefi | --program-pref \ + | --program-pre | --program-pr | --program-p) + ac_prev=program_prefix ;; + -program-prefix=* | --program-prefix=* | --program-prefi=* \ + | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*) + program_prefix=$ac_optarg ;; + + -program-suffix | --program-suffix | --program-suffi | --program-suff \ + | --program-suf | --program-su | --program-s) + ac_prev=program_suffix ;; + -program-suffix=* | --program-suffix=* | --program-suffi=* \ + | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*) + program_suffix=$ac_optarg ;; + + -program-transform-name | --program-transform-name \ + | --program-transform-nam | --program-transform-na \ + | --program-transform-n | --program-transform- \ + | --program-transform | --program-transfor \ + | --program-transfo | --program-transf \ + | --program-trans | --program-tran \ + | --progr-tra | --program-tr | --program-t) + ac_prev=program_transform_name ;; + -program-transform-name=* | --program-transform-name=* \ + | --program-transform-nam=* | --program-transform-na=* \ + | --program-transform-n=* | --program-transform-=* \ + | --program-transform=* | --program-transfor=* \ + | --program-transfo=* | --program-transf=* \ + | --program-trans=* | --program-tran=* \ + | --progr-tra=* | --program-tr=* | --program-t=*) + program_transform_name=$ac_optarg ;; + + -pdfdir | --pdfdir | --pdfdi | --pdfd | --pdf | --pd) + ac_prev=pdfdir ;; + -pdfdir=* | --pdfdir=* | --pdfdi=* | --pdfd=* | --pdf=* | --pd=*) + pdfdir=$ac_optarg ;; + + -psdir | --psdir | --psdi | --psd | --ps) + ac_prev=psdir ;; + -psdir=* | --psdir=* | --psdi=* | --psd=* | --ps=*) + psdir=$ac_optarg ;; + + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + silent=yes ;; + + -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb) + ac_prev=sbindir ;; + -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \ + | --sbi=* | --sb=*) + sbindir=$ac_optarg ;; + + -sharedstatedir | --sharedstatedir | --sharedstatedi \ + | --sharedstated | --sharedstate | --sharedstat | --sharedsta \ + | --sharedst | --shareds | --shared | --share | --shar \ + | --sha | --sh) + ac_prev=sharedstatedir ;; + -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \ + | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \ + | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \ + | --sha=* | --sh=*) + sharedstatedir=$ac_optarg ;; + + -site | --site | --sit) + ac_prev=site ;; + -site=* | --site=* | --sit=*) + site=$ac_optarg ;; + + -srcdir | --srcdir | --srcdi | --srcd | --src | --sr) + ac_prev=srcdir ;; + -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*) + srcdir=$ac_optarg ;; + + -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \ + | --syscon | --sysco | --sysc | --sys | --sy) + ac_prev=sysconfdir ;; + -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \ + | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*) + sysconfdir=$ac_optarg ;; + + -target | --target | --targe | --targ | --tar | --ta | --t) + ac_prev=target_alias ;; + -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*) + target_alias=$ac_optarg ;; + + -v | -verbose | --verbose | --verbos | --verbo | --verb) + verbose=yes ;; + + -version | --version | --versio | --versi | --vers | -V) + ac_init_version=: ;; + + -with-* | --with-*) + ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=\$ac_optarg ;; + + -without-* | --without-*) + ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'` + # Reject names that are not valid shell variable names. + expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null && + as_fn_error $? "invalid package name: $ac_useropt" + ac_useropt_orig=$ac_useropt + ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'` + case $ac_user_opts in + *" +"with_$ac_useropt" +"*) ;; + *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig" + ac_unrecognized_sep=', ';; + esac + eval with_$ac_useropt=no ;; + + --x) + # Obsolete; use --with-x. + with_x=yes ;; + + -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \ + | --x-incl | --x-inc | --x-in | --x-i) + ac_prev=x_includes ;; + -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \ + | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*) + x_includes=$ac_optarg ;; + + -x-libraries | --x-libraries | --x-librarie | --x-librari \ + | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l) + ac_prev=x_libraries ;; + -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \ + | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*) + x_libraries=$ac_optarg ;; + + -*) as_fn_error $? "unrecognized option: \`$ac_option' +Try \`$0 --help' for more information" + ;; + + *=*) + ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='` + # Reject names that are not valid shell variable names. + case $ac_envvar in #( + '' | [0-9]* | *[!_$as_cr_alnum]* ) + as_fn_error $? "invalid variable name: \`$ac_envvar'" ;; + esac + eval $ac_envvar=\$ac_optarg + export $ac_envvar ;; + + *) + # FIXME: should be removed in autoconf 3.0. + $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2 + expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null && + $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2 + : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}" + ;; + + esac +done + +if test -n "$ac_prev"; then + ac_option=--`echo $ac_prev | sed 's/_/-/g'` + as_fn_error $? "missing argument to $ac_option" +fi + +if test -n "$ac_unrecognized_opts"; then + case $enable_option_checking in + no) ;; + fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;; + *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;; + esac +fi + +# Check all directory arguments for consistency. +for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \ + datadir sysconfdir sharedstatedir localstatedir includedir \ + oldincludedir docdir infodir htmldir dvidir pdfdir psdir \ + libdir localedir mandir +do + eval ac_val=\$$ac_var + # Remove trailing slashes. + case $ac_val in + */ ) + ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'` + eval $ac_var=\$ac_val;; + esac + # Be sure to have absolute directory names. + case $ac_val in + [\\/$]* | ?:[\\/]* ) continue;; + NONE | '' ) case $ac_var in *prefix ) continue;; esac;; + esac + as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val" +done + +# There might be people who depend on the old broken behavior: `$host' +# used to hold the argument of --host etc. +# FIXME: To remove some day. +build=$build_alias +host=$host_alias +target=$target_alias + +# FIXME: To remove some day. +if test "x$host_alias" != x; then + if test "x$build_alias" = x; then + cross_compiling=maybe + $as_echo "$as_me: WARNING: if you wanted to set the --build type, don't use --host. + If a cross compiler is detected then cross compile mode will be used" >&2 + elif test "x$build_alias" != "x$host_alias"; then + cross_compiling=yes + fi +fi + +ac_tool_prefix= +test -n "$host_alias" && ac_tool_prefix=$host_alias- + +test "$silent" = yes && exec 6>/dev/null + + +ac_pwd=`pwd` && test -n "$ac_pwd" && +ac_ls_di=`ls -di .` && +ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` || + as_fn_error $? "working directory cannot be determined" +test "X$ac_ls_di" = "X$ac_pwd_ls_di" || + as_fn_error $? "pwd does not report name of working directory" + + +# Find the source files, if location was not specified. +if test -z "$srcdir"; then + ac_srcdir_defaulted=yes + # Try the directory containing this script, then the parent directory. + ac_confdir=`$as_dirname -- "$as_myself" || +$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_myself" : 'X\(//\)[^/]' \| \ + X"$as_myself" : 'X\(//\)$' \| \ + X"$as_myself" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_myself" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + srcdir=$ac_confdir + if test ! -r "$srcdir/$ac_unique_file"; then + srcdir=.. + fi +else + ac_srcdir_defaulted=no +fi +if test ! -r "$srcdir/$ac_unique_file"; then + test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .." + as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir" +fi +ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work" +ac_abs_confdir=`( + cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg" + pwd)` +# When building in place, set srcdir=. +if test "$ac_abs_confdir" = "$ac_pwd"; then + srcdir=. +fi +# Remove unnecessary trailing slashes from srcdir. +# Double slashes in file names in object file debugging info +# mess up M-x gdb in Emacs. +case $srcdir in +*/) srcdir=`expr "X$srcdir" : 'X\(.*[^/]\)' \| "X$srcdir" : 'X\(.*\)'`;; +esac +for ac_var in $ac_precious_vars; do + eval ac_env_${ac_var}_set=\${${ac_var}+set} + eval ac_env_${ac_var}_value=\$${ac_var} + eval ac_cv_env_${ac_var}_set=\${${ac_var}+set} + eval ac_cv_env_${ac_var}_value=\$${ac_var} +done + +# +# Report the --help message. +# +if test "$ac_init_help" = "long"; then + # Omit some internal or obsolete options to make the list less imposing. + # This message is too long to be a string in the A/UX 3.1 sh. + cat <<_ACEOF +\`configure' configures libffi 3.0.10 to adapt to many kinds of systems. + +Usage: $0 [OPTION]... [VAR=VALUE]... + +To assign environment variables (e.g., CC, CFLAGS...), specify them as +VAR=VALUE. See below for descriptions of some of the useful variables. + +Defaults for the options are specified in brackets. + +Configuration: + -h, --help display this help and exit + --help=short display options specific to this package + --help=recursive display the short help of all the included packages + -V, --version display version information and exit + -q, --quiet, --silent do not print \`checking ...' messages + --cache-file=FILE cache test results in FILE [disabled] + -C, --config-cache alias for \`--cache-file=config.cache' + -n, --no-create do not create output files + --srcdir=DIR find the sources in DIR [configure dir or \`..'] + +Installation directories: + --prefix=PREFIX install architecture-independent files in PREFIX + [$ac_default_prefix] + --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX + [PREFIX] + +By default, \`make install' will install all the files in +\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify +an installation prefix other than \`$ac_default_prefix' using \`--prefix', +for instance \`--prefix=\$HOME'. + +For better control, use the options below. + +Fine tuning of the installation directories: + --bindir=DIR user executables [EPREFIX/bin] + --sbindir=DIR system admin executables [EPREFIX/sbin] + --libexecdir=DIR program executables [EPREFIX/libexec] + --sysconfdir=DIR read-only single-machine data [PREFIX/etc] + --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com] + --localstatedir=DIR modifiable single-machine data [PREFIX/var] + --libdir=DIR object code libraries [EPREFIX/lib] + --includedir=DIR C header files [PREFIX/include] + --oldincludedir=DIR C header files for non-gcc [/usr/include] + --datarootdir=DIR read-only arch.-independent data root [PREFIX/share] + --datadir=DIR read-only architecture-independent data [DATAROOTDIR] + --infodir=DIR info documentation [DATAROOTDIR/info] + --localedir=DIR locale-dependent data [DATAROOTDIR/locale] + --mandir=DIR man documentation [DATAROOTDIR/man] + --docdir=DIR documentation root [DATAROOTDIR/doc/libffi] + --htmldir=DIR html documentation [DOCDIR] + --dvidir=DIR dvi documentation [DOCDIR] + --pdfdir=DIR pdf documentation [DOCDIR] + --psdir=DIR ps documentation [DOCDIR] +_ACEOF + + cat <<\_ACEOF + +Program names: + --program-prefix=PREFIX prepend PREFIX to installed program names + --program-suffix=SUFFIX append SUFFIX to installed program names + --program-transform-name=PROGRAM run sed PROGRAM on installed program names + +System types: + --build=BUILD configure for building on BUILD [guessed] + --host=HOST cross-compile to build programs to run on HOST [BUILD] + --target=TARGET configure for building compilers for TARGET [HOST] +_ACEOF +fi + +if test -n "$ac_init_help"; then + case $ac_init_help in + short | recursive ) echo "Configuration of libffi 3.0.10:";; + esac + cat <<\_ACEOF + +Optional Features: + --disable-option-checking ignore unrecognized --enable/--with options + --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no) + --enable-FEATURE[=ARG] include FEATURE [ARG=yes] + --disable-builddir disable automatic build in subdir of sources + + --disable-dependency-tracking speeds up one-time build + --enable-dependency-tracking do not reject slow dependency extractors + --enable-shared[=PKGS] build shared libraries [default=yes] + --enable-static[=PKGS] build static libraries [default=yes] + --enable-fast-install[=PKGS] + optimize for fast installation [default=yes] + --disable-libtool-lock avoid locking (might break parallel builds) + --enable-portable-binary + disable compiler optimizations that would produce + unportable binaries + --enable-maintainer-mode enable make rules and dependencies not useful + (and sometimes confusing) to the casual installer + --enable-debug debugging mode + --disable-structs omit code for struct support + --disable-raw-api make the raw api unavailable + --enable-purify-safety purify-safe mode + +Optional Packages: + --with-PACKAGE[=ARG] use PACKAGE [ARG=yes] + --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no) + --with-pic try to use only PIC/non-PIC objects [default=use + both] + --with-gnu-ld assume the C compiler uses GNU ld [default=no] + --with-sysroot=DIR Search for dependent libraries within DIR + (or the compiler's sysroot if not specified). + --with-gcc-arch= use architecture for gcc -march/-mtune, + instead of guessing + +Some influential environment variables: + CC C compiler command + CFLAGS C compiler flags + LDFLAGS linker flags, e.g. -L if you have libraries in a + nonstandard directory + LIBS libraries to pass to the linker, e.g. -l + CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I if + you have headers in a nonstandard directory + CCAS assembler compiler command (defaults to CC) + CCASFLAGS assembler compiler flags (defaults to CFLAGS) + CPP C preprocessor + +Use these variables to override the choices made by `configure' or to help +it to find libraries and programs with nonstandard names/locations. + +Report bugs to . +_ACEOF +ac_status=$? +fi + +if test "$ac_init_help" = "recursive"; then + # If there are subdirs, report their specific --help. + for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue + test -d "$ac_dir" || + { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } || + continue + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + cd "$ac_dir" || { ac_status=$?; continue; } + # Check for guested configure. + if test -f "$ac_srcdir/configure.gnu"; then + echo && + $SHELL "$ac_srcdir/configure.gnu" --help=recursive + elif test -f "$ac_srcdir/configure"; then + echo && + $SHELL "$ac_srcdir/configure" --help=recursive + else + $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2 + fi || ac_status=$? + cd "$ac_pwd" || { ac_status=$?; break; } + done +fi + +test -n "$ac_init_help" && exit $ac_status +if $ac_init_version; then + cat <<\_ACEOF +libffi configure 3.0.10 +generated by GNU Autoconf 2.68 + +Copyright (C) 2010 Free Software Foundation, Inc. +This configure script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it. +_ACEOF + exit +fi + +## ------------------------ ## +## Autoconf initialization. ## +## ------------------------ ## + +# ac_fn_c_try_compile LINENO +# -------------------------- +# Try to compile conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext + if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest.$ac_objext; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_compile + +# ac_fn_c_try_link LINENO +# ----------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_link () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + rm -f conftest.$ac_objext conftest$ac_exeext + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { + test -z "$ac_c_werror_flag" || + test ! -s conftest.err + } && test -s conftest$ac_exeext && { + test "$cross_compiling" = yes || + $as_test_x conftest$ac_exeext + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + # Delete the IPA/IPO (Inter Procedural Analysis/Optimization) information + # created by the PGI compiler (conftest_ipa8_conftest.oo), as it would + # interfere with the next link command; also delete a directory that is + # left behind by Apple's compiler. We do this before executing the actions. + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_link + +# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists and can be compiled using the include files in +# INCLUDES, setting the cache variable VAR accordingly. +ac_fn_c_check_header_compile () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_compile + +# ac_fn_c_try_cpp LINENO +# ---------------------- +# Try to preprocess conftest.$ac_ext, and return whether this succeeded. +ac_fn_c_try_cpp () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_cpp conftest.$ac_ext" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_cpp conftest.$ac_ext") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + grep -v '^ *+' conftest.err >conftest.er1 + cat conftest.er1 >&5 + mv -f conftest.er1 conftest.err + fi + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } > conftest.i && { + test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" || + test ! -s conftest.err + }; then : + ac_retval=0 +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=1 +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_cpp + +# ac_fn_c_try_run LINENO +# ---------------------- +# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes +# that executables *can* be run. +ac_fn_c_try_run () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && { ac_try='./conftest$ac_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then : + ac_retval=0 +else + $as_echo "$as_me: program exited with status $ac_status" >&5 + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + + ac_retval=$ac_status +fi + rm -rf conftest.dSYM conftest_ipa8_conftest.oo + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + as_fn_set_status $ac_retval + +} # ac_fn_c_try_run + +# ac_fn_c_check_func LINENO FUNC VAR +# ---------------------------------- +# Tests whether FUNC exists, setting the cache variable VAR accordingly +ac_fn_c_check_func () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +/* Define $2 to an innocuous variant, in case declares $2. + For example, HP-UX 11i declares gettimeofday. */ +#define $2 innocuous_$2 + +/* System header to define __stub macros and hopefully few prototypes, + which can conflict with char $2 (); below. + Prefer to if __STDC__ is defined, since + exists even on freestanding compilers. */ + +#ifdef __STDC__ +# include +#else +# include +#endif + +#undef $2 + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char $2 (); +/* The GNU C library defines this for functions which it implements + to always fail with ENOSYS. Some functions are actually named + something starting with __ and the normal name is an alias. */ +#if defined __stub_$2 || defined __stub___$2 +choke me +#endif + +int +main () +{ +return $2 (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + eval "$3=yes" +else + eval "$3=no" +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_func + +# ac_fn_c_check_header_mongrel LINENO HEADER VAR INCLUDES +# ------------------------------------------------------- +# Tests whether HEADER exists, giving a warning if it cannot be compiled using +# the include files in INCLUDES and setting the cache variable VAR +# accordingly. +ac_fn_c_check_header_mongrel () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if eval \${$3+:} false; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +else + # Is the header compilable? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5 +$as_echo_n "checking $2 usability... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +#include <$2> +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_header_compiler=yes +else + ac_header_compiler=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5 +$as_echo "$ac_header_compiler" >&6; } + +# Is the header present? +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5 +$as_echo_n "checking $2 presence... " >&6; } +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include <$2> +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + ac_header_preproc=yes +else + ac_header_preproc=no +fi +rm -f conftest.err conftest.i conftest.$ac_ext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5 +$as_echo "$ac_header_preproc" >&6; } + +# So? What about this header? +case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #(( + yes:no: ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5 +$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} + ;; + no:yes:* ) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5 +$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5 +$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5 +$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5 +$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5 +$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;} +( $as_echo "## ------------------------------------------------ ## +## Report this to http://sourceware.org/libffi.html ## +## ------------------------------------------------ ##" + ) | sed "s/^/$as_me: WARNING: /" >&2 + ;; +esac + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=\$ac_header_compiler" +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } +fi + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_header_mongrel + +# ac_fn_c_check_type LINENO TYPE VAR INCLUDES +# ------------------------------------------- +# Tests whether TYPE exists after having included INCLUDES, setting cache +# variable VAR accordingly. +ac_fn_c_check_type () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5 +$as_echo_n "checking for $2... " >&6; } +if eval \${$3+:} false; then : + $as_echo_n "(cached) " >&6 +else + eval "$3=no" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof ($2)) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +if (sizeof (($2))) + return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + eval "$3=yes" +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +eval ac_res=\$$3 + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5 +$as_echo "$ac_res" >&6; } + eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno + +} # ac_fn_c_check_type + +# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES +# -------------------------------------------- +# Tries to find the compile-time value of EXPR in a program that includes +# INCLUDES, setting VAR accordingly. Returns whether the value could be +# computed +ac_fn_c_compute_int () +{ + as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + if test "$cross_compiling" = yes; then + # Depending upon the size, compute the lo and hi bounds. +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=0 ac_mid=0 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid; break +else + as_fn_arith $ac_mid + 1 && ac_lo=$as_val + if test $ac_lo -le $ac_mid; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) < 0)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=-1 ac_mid=-1 + while :; do + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) >= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_lo=$ac_mid; break +else + as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val + if test $ac_mid -le $ac_hi; then + ac_lo= ac_hi= + break + fi + as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done +else + ac_lo= ac_hi= +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +# Binary search between lo and hi bounds. +while test "x$ac_lo" != "x$ac_hi"; do + as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +int +main () +{ +static int test_array [1 - 2 * !(($2) <= $ac_mid)]; +test_array [0] = 0 + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_hi=$ac_mid +else + as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done +case $ac_lo in #(( +?*) eval "$3=\$ac_lo"; ac_retval=0 ;; +'') ac_retval=1 ;; +esac + else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$4 +static long int longval () { return $2; } +static unsigned long int ulongval () { return $2; } +#include +#include +int +main () +{ + + FILE *f = fopen ("conftest.val", "w"); + if (! f) + return 1; + if (($2) < 0) + { + long int i = longval (); + if (i != ($2)) + return 1; + fprintf (f, "%ld", i); + } + else + { + unsigned long int i = ulongval (); + if (i != ($2)) + return 1; + fprintf (f, "%lu", i); + } + /* Do not output a trailing newline, as this causes \r\n confusion + on some platforms. */ + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + echo >>conftest.val; read $3 config.log <<_ACEOF +This file contains any messages produced by compilers while +running configure, to aid debugging if configure makes a mistake. + +It was created by libffi $as_me 3.0.10, which was +generated by GNU Autoconf 2.68. Invocation command line was + + $ $0 $@ + +_ACEOF +exec 5>>config.log +{ +cat <<_ASUNAME +## --------- ## +## Platform. ## +## --------- ## + +hostname = `(hostname || uname -n) 2>/dev/null | sed 1q` +uname -m = `(uname -m) 2>/dev/null || echo unknown` +uname -r = `(uname -r) 2>/dev/null || echo unknown` +uname -s = `(uname -s) 2>/dev/null || echo unknown` +uname -v = `(uname -v) 2>/dev/null || echo unknown` + +/usr/bin/uname -p = `(/usr/bin/uname -p) 2>/dev/null || echo unknown` +/bin/uname -X = `(/bin/uname -X) 2>/dev/null || echo unknown` + +/bin/arch = `(/bin/arch) 2>/dev/null || echo unknown` +/usr/bin/arch -k = `(/usr/bin/arch -k) 2>/dev/null || echo unknown` +/usr/convex/getsysinfo = `(/usr/convex/getsysinfo) 2>/dev/null || echo unknown` +/usr/bin/hostinfo = `(/usr/bin/hostinfo) 2>/dev/null || echo unknown` +/bin/machine = `(/bin/machine) 2>/dev/null || echo unknown` +/usr/bin/oslevel = `(/usr/bin/oslevel) 2>/dev/null || echo unknown` +/bin/universe = `(/bin/universe) 2>/dev/null || echo unknown` + +_ASUNAME + +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + $as_echo "PATH: $as_dir" + done +IFS=$as_save_IFS + +} >&5 + +cat >&5 <<_ACEOF + + +## ----------- ## +## Core tests. ## +## ----------- ## + +_ACEOF + + +# Keep a trace of the command line. +# Strip out --no-create and --no-recursion so they do not pile up. +# Strip out --silent because we don't want to record it for future runs. +# Also quote any args containing shell meta-characters. +# Make two passes to allow for proper duplicate-argument suppression. +ac_configure_args= +ac_configure_args0= +ac_configure_args1= +ac_must_keep_next=false +for ac_pass in 1 2 +do + for ac_arg + do + case $ac_arg in + -no-create | --no-c* | -n | -no-recursion | --no-r*) continue ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil) + continue ;; + *\'*) + ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + case $ac_pass in + 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;; + 2) + as_fn_append ac_configure_args1 " '$ac_arg'" + if test $ac_must_keep_next = true; then + ac_must_keep_next=false # Got value, back to normal. + else + case $ac_arg in + *=* | --config-cache | -C | -disable-* | --disable-* \ + | -enable-* | --enable-* | -gas | --g* | -nfp | --nf* \ + | -q | -quiet | --q* | -silent | --sil* | -v | -verb* \ + | -with-* | --with-* | -without-* | --without-* | --x) + case "$ac_configure_args0 " in + "$ac_configure_args1"*" '$ac_arg' "* ) continue ;; + esac + ;; + -* ) ac_must_keep_next=true ;; + esac + fi + as_fn_append ac_configure_args " '$ac_arg'" + ;; + esac + done +done +{ ac_configure_args0=; unset ac_configure_args0;} +{ ac_configure_args1=; unset ac_configure_args1;} + +# When interrupted or exit'd, cleanup temporary files, and complete +# config.log. We remove comments because anyway the quotes in there +# would cause problems or look ugly. +# WARNING: Use '\'' to represent an apostrophe within the trap. +# WARNING: Do not start the trap code with a newline, due to a FreeBSD 4.0 bug. +trap 'exit_status=$? + # Save into config.log some information that might help in debugging. + { + echo + + $as_echo "## ---------------- ## +## Cache variables. ## +## ---------------- ##" + echo + # The following way of writing the cache mishandles newlines in values, +( + for ac_var in `(set) 2>&1 | sed -n '\''s/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'\''`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + (set) 2>&1 | + case $as_nl`(ac_space='\'' '\''; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + sed -n \ + "s/'\''/'\''\\\\'\'''\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\''\\2'\''/p" + ;; #( + *) + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) + echo + + $as_echo "## ----------------- ## +## Output variables. ## +## ----------------- ##" + echo + for ac_var in $ac_subst_vars + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + + if test -n "$ac_subst_files"; then + $as_echo "## ------------------- ## +## File substitutions. ## +## ------------------- ##" + echo + for ac_var in $ac_subst_files + do + eval ac_val=\$$ac_var + case $ac_val in + *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;; + esac + $as_echo "$ac_var='\''$ac_val'\''" + done | sort + echo + fi + + if test -s confdefs.h; then + $as_echo "## ----------- ## +## confdefs.h. ## +## ----------- ##" + echo + cat confdefs.h + echo + fi + test "$ac_signal" != 0 && + $as_echo "$as_me: caught signal $ac_signal" + $as_echo "$as_me: exit $exit_status" + } >&5 + rm -f core *.core core.conftest.* && + rm -f -r conftest* confdefs* conf$$* $ac_clean_files && + exit $exit_status +' 0 +for ac_signal in 1 2 13 15; do + trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal +done +ac_signal=0 + +# confdefs.h avoids OS command line length limits that DEFS can exceed. +rm -f -r conftest* confdefs.h + +$as_echo "/* confdefs.h */" > confdefs.h + +# Predefined preprocessor variables. + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_NAME "$PACKAGE_NAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_TARNAME "$PACKAGE_TARNAME" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_VERSION "$PACKAGE_VERSION" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_STRING "$PACKAGE_STRING" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT" +_ACEOF + +cat >>confdefs.h <<_ACEOF +#define PACKAGE_URL "$PACKAGE_URL" +_ACEOF + + +# Let the site file select an alternate cache file if it wants to. +# Prefer an explicitly selected file to automatically selected ones. +ac_site_file1=NONE +ac_site_file2=NONE +if test -n "$CONFIG_SITE"; then + # We do not want a PATH search for config.site. + case $CONFIG_SITE in #(( + -*) ac_site_file1=./$CONFIG_SITE;; + */*) ac_site_file1=$CONFIG_SITE;; + *) ac_site_file1=./$CONFIG_SITE;; + esac +elif test "x$prefix" != xNONE; then + ac_site_file1=$prefix/share/config.site + ac_site_file2=$prefix/etc/config.site +else + ac_site_file1=$ac_default_prefix/share/config.site + ac_site_file2=$ac_default_prefix/etc/config.site +fi +for ac_site_file in "$ac_site_file1" "$ac_site_file2" +do + test "x$ac_site_file" = xNONE && continue + if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5 +$as_echo "$as_me: loading site script $ac_site_file" >&6;} + sed 's/^/| /' "$ac_site_file" >&5 + . "$ac_site_file" \ + || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "failed to load site script $ac_site_file +See \`config.log' for more details" "$LINENO" 5; } + fi +done + +if test -r "$cache_file"; then + # Some versions of bash will fail to source /dev/null (special files + # actually), so we avoid doing that. DJGPP emulates it as a regular file. + if test /dev/null != "$cache_file" && test -f "$cache_file"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5 +$as_echo "$as_me: loading cache $cache_file" >&6;} + case $cache_file in + [\\/]* | ?:[\\/]* ) . "$cache_file";; + *) . "./$cache_file";; + esac + fi +else + { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5 +$as_echo "$as_me: creating cache $cache_file" >&6;} + >$cache_file +fi + +# Check that the precious variables saved in the cache have kept the same +# value. +ac_cache_corrupted=false +for ac_var in $ac_precious_vars; do + eval ac_old_set=\$ac_cv_env_${ac_var}_set + eval ac_new_set=\$ac_env_${ac_var}_set + eval ac_old_val=\$ac_cv_env_${ac_var}_value + eval ac_new_val=\$ac_env_${ac_var}_value + case $ac_old_set,$ac_new_set in + set,) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,set) + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5 +$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;} + ac_cache_corrupted=: ;; + ,);; + *) + if test "x$ac_old_val" != "x$ac_new_val"; then + # differences in whitespace do not lead to failure. + ac_old_val_w=`echo x $ac_old_val` + ac_new_val_w=`echo x $ac_new_val` + if test "$ac_old_val_w" != "$ac_new_val_w"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5 +$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;} + ac_cache_corrupted=: + else + { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5 +$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;} + eval $ac_var=\$ac_old_val + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5 +$as_echo "$as_me: former value: \`$ac_old_val'" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5 +$as_echo "$as_me: current value: \`$ac_new_val'" >&2;} + fi;; + esac + # Pass precious variables to config.status. + if test "$ac_new_set" = set; then + case $ac_new_val in + *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;; + *) ac_arg=$ac_var=$ac_new_val ;; + esac + case " $ac_configure_args " in + *" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy. + *) as_fn_append ac_configure_args " '$ac_arg'" ;; + esac + fi +done +if $ac_cache_corrupted; then + { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} + { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5 +$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;} + as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5 +fi +## -------------------- ## +## Main body of script. ## +## -------------------- ## + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +ac_config_headers="$ac_config_headers fficonfig.h" + + +ac_aux_dir= +for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do + if test -f "$ac_dir/install-sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install-sh -c" + break + elif test -f "$ac_dir/install.sh"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/install.sh -c" + break + elif test -f "$ac_dir/shtool"; then + ac_aux_dir=$ac_dir + ac_install_sh="$ac_aux_dir/shtool install -c" + break + fi +done +if test -z "$ac_aux_dir"; then + as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5 +fi + +# These three variables are undocumented and unsupported, +# and are intended to be withdrawn in a future Autoconf release. +# They can cause serious problems if a builder's source tree is in a directory +# whose full name contains unusual characters. +ac_config_guess="$SHELL $ac_aux_dir/config.guess" # Please don't use this var. +ac_config_sub="$SHELL $ac_aux_dir/config.sub" # Please don't use this var. +ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var. + + +# Make sure we can run config.sub. +$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 || + as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5 + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5 +$as_echo_n "checking build system type... " >&6; } +if ${ac_cv_build+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_build_alias=$build_alias +test "x$ac_build_alias" = x && + ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"` +test "x$ac_build_alias" = x && + as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5 +ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5 + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5 +$as_echo "$ac_cv_build" >&6; } +case $ac_cv_build in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;; +esac +build=$ac_cv_build +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_build +shift +build_cpu=$1 +build_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +build_os=$* +IFS=$ac_save_IFS +case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5 +$as_echo_n "checking host system type... " >&6; } +if ${ac_cv_host+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$host_alias" = x; then + ac_cv_host=$ac_cv_build +else + ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5 +$as_echo "$ac_cv_host" >&6; } +case $ac_cv_host in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;; +esac +host=$ac_cv_host +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_host +shift +host_cpu=$1 +host_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +host_os=$* +IFS=$ac_save_IFS +case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking target system type" >&5 +$as_echo_n "checking target system type... " >&6; } +if ${ac_cv_target+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "x$target_alias" = x; then + ac_cv_target=$ac_cv_host +else + ac_cv_target=`$SHELL "$ac_aux_dir/config.sub" $target_alias` || + as_fn_error $? "$SHELL $ac_aux_dir/config.sub $target_alias failed" "$LINENO" 5 +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_target" >&5 +$as_echo "$ac_cv_target" >&6; } +case $ac_cv_target in +*-*-*) ;; +*) as_fn_error $? "invalid value of canonical target" "$LINENO" 5;; +esac +target=$ac_cv_target +ac_save_IFS=$IFS; IFS='-' +set x $ac_cv_target +shift +target_cpu=$1 +target_vendor=$2 +shift; shift +# Remember, the first character of IFS is used to create $*, +# except with old shells: +target_os=$* +IFS=$ac_save_IFS +case $target_os in *\ *) target_os=`echo "$target_os" | sed 's/ /-/g'`;; esac + + +# The aliases save the names the user supplied, while $host etc. +# will get canonicalized. +test -n "$target_alias" && + test "$program_prefix$program_suffix$program_transform_name" = \ + NONENONEs,x,x, && + program_prefix=${target_alias}- + +target_alias=${target_alias-$host_alias} + +. ${srcdir}/configure.host + + + # [$]@ is unsable in 2.60+ but earlier autoconf had no ac_configure_args + if test "${ac_configure_args+set}" != "set" ; then + ac_configure_args= + for ac_arg in ${1+"$@"}; do + ac_configure_args="$ac_configure_args '$ac_arg'" + done + fi + +# expand $ac_aux_dir to an absolute path +am_aux_dir=`cd $ac_aux_dir && pwd` + + +ax_enable_builddir="." +# Check whether --enable-builddir was given. +if test "${enable_builddir+set}" = set; then : + enableval=$enable_builddir; ax_enable_builddir="$enableval" +else + ax_enable_builddir="auto" +fi + +if test ".$ac_srcdir_defaulted" != ".no" ; then +if test ".$srcdir" = ".." ; then + if test -f config.status ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: toplevel srcdir already configured... skipping subdir build" >&5 +$as_echo "$as_me: toplevel srcdir already configured... skipping subdir build" >&6;} + else + test ".$ax_enable_builddir" = "." && ax_enable_builddir="." + test ".$ax_enable_builddir" = ".no" && ax_enable_builddir="." + test ".$TARGET" = "." && TARGET="$target" + test ".$ax_enable_builddir" = ".auto" && ax_enable_builddir="$TARGET" + if test ".$ax_enable_builddir" != ".." ; then # we know where to go and + as_dir=$ax_enable_builddir; as_fn_mkdir_p + echo __.$ax_enable_builddir.__ > $ax_enable_builddir/conftest.tmp + cd $ax_enable_builddir + if grep __.$ax_enable_builddir.__ conftest.tmp >/dev/null 2>/dev/null ; then + rm conftest.tmp + { $as_echo "$as_me:${as_lineno-$LINENO}: result: continue configure in default builddir \"./$ax_enable_builddir\"" >&5 +$as_echo "continue configure in default builddir \"./$ax_enable_builddir\"" >&6; } + else + as_fn_error $? "could not change to default builddir \"./$ax_enable_builddir\"" "$LINENO" 5 + fi + srcdir=`echo "$ax_enable_builddir" | + sed -e 's,^\./,,;s,[^/]$,&/,;s,[^/]*/,../,g;s,[/]$,,;'` + # going to restart from subdirectory location + test -f $srcdir/config.log && mv $srcdir/config.log . + test -f $srcdir/confdefs.h && mv $srcdir/confdefs.h . + test -f $srcdir/conftest.log && mv $srcdir/conftest.log . + test -f $srcdir/$cache_file && mv $srcdir/$cache_file . + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ....exec $SHELL $srcdir/$0 \"--srcdir=$srcdir\" \"--enable-builddir=$ax_enable_builddir\" ${1+\"$@\"}" >&5 +$as_echo "....exec $SHELL $srcdir/$0 \"--srcdir=$srcdir\" \"--enable-builddir=$ax_enable_builddir\" ${1+\"$@\"}" >&6; } + case "$0" in # restart + /\\*) eval $SHELL "'$0'" "'--srcdir=$srcdir'" "'--enable-builddir=$ax_enable_builddir'" $ac_configure_args ;; + *) eval $SHELL "'$srcdir/$0'" "'--srcdir=$srcdir'" "'--enable-builddir=$ax_enable_builddir'" $ac_configure_args ;; + esac ; exit $? + fi + fi +fi fi +test ".$ax_enable_builddir" = ".auto" && ax_enable_builddir="." +# Extract the first word of "gsed sed", so it can be a program name with args. +set dummy gsed sed; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_ax_enable_builddir_sed+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $ax_enable_builddir_sed in + [\\/]* | ?:[\\/]*) + ac_cv_path_ax_enable_builddir_sed="$ax_enable_builddir_sed" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_ax_enable_builddir_sed="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_ax_enable_builddir_sed" && ac_cv_path_ax_enable_builddir_sed="sed" + ;; +esac +fi +ax_enable_builddir_sed=$ac_cv_path_ax_enable_builddir_sed +if test -n "$ax_enable_builddir_sed"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_enable_builddir_sed" >&5 +$as_echo "$ax_enable_builddir_sed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +ax_enable_builddir_auxdir="$am_aux_dir" +ac_config_commands="$ac_config_commands buildir" + + +am__api_version='1.11' + +# Find a good install program. We prefer a C program (faster), +# so one script is as good as another. But avoid the broken or +# incompatible versions: +# SysV /etc/install, /usr/sbin/install +# SunOS /usr/etc/install +# IRIX /sbin/install +# AIX /bin/install +# AmigaOS /C/install, which installs bootblocks on floppy discs +# AIX 4 /usr/bin/installbsd, which doesn't work without a -g flag +# AFS /usr/afsws/bin/install, which mishandles nonexistent args +# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff" +# OS/2's system install, which has a completely different semantic +# ./install, which can be erroneously created by make from ./install.sh. +# Reject install programs that cannot install multiple files. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5 +$as_echo_n "checking for a BSD-compatible install... " >&6; } +if test -z "$INSTALL"; then +if ${ac_cv_path_install+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + # Account for people who put trailing slashes in PATH elements. +case $as_dir/ in #(( + ./ | .// | /[cC]/* | \ + /etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \ + ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \ + /usr/ucb/* ) ;; + *) + # OSF1 and SCO ODT 3.0 have their own names for install. + # Don't use installbsd from OSF since it installs stuff as root + # by default. + for ac_prog in ginstall scoinst install; do + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then + if test $ac_prog = install && + grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # AIX install. It has an incompatible calling convention. + : + elif test $ac_prog = install && + grep pwplus "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then + # program-specific install script used by HP pwplus--don't use. + : + else + rm -rf conftest.one conftest.two conftest.dir + echo one > conftest.one + echo two > conftest.two + mkdir conftest.dir + if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" && + test -s conftest.one && test -s conftest.two && + test -s conftest.dir/conftest.one && + test -s conftest.dir/conftest.two + then + ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c" + break 3 + fi + fi + fi + done + done + ;; +esac + + done +IFS=$as_save_IFS + +rm -rf conftest.one conftest.two conftest.dir + +fi + if test "${ac_cv_path_install+set}" = set; then + INSTALL=$ac_cv_path_install + else + # As a last resort, use the slow shell script. Don't cache a + # value for INSTALL within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + INSTALL=$ac_install_sh + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5 +$as_echo "$INSTALL" >&6; } + +# Use test -z because SunOS4 sh mishandles braces in ${var-val}. +# It thinks the first close brace ends the variable substitution. +test -z "$INSTALL_PROGRAM" && INSTALL_PROGRAM='${INSTALL}' + +test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}' + +test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644' + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5 +$as_echo_n "checking whether build environment is sane... " >&6; } +# Just in case +sleep 1 +echo timestamp > conftest.file +# Reject unsafe characters in $srcdir or the absolute working directory +# name. Accept space and tab only in the latter. +am_lf=' +' +case `pwd` in + *[\\\"\#\$\&\'\`$am_lf]*) + as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;; +esac +case $srcdir in + *[\\\"\#\$\&\'\`$am_lf\ \ ]*) + as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;; +esac + +# Do `set' in a subshell so we don't clobber the current shell's +# arguments. Must try -L first in case configure is actually a +# symlink; some systems play weird games with the mod time of symlinks +# (eg FreeBSD returns the mod time of the symlink's containing +# directory). +if ( + set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` + if test "$*" = "X"; then + # -L didn't work. + set X `ls -t "$srcdir/configure" conftest.file` + fi + rm -f conftest.file + if test "$*" != "X $srcdir/configure conftest.file" \ + && test "$*" != "X conftest.file $srcdir/configure"; then + + # If neither matched, then we have a broken ls. This can happen + # if, for instance, CONFIG_SHELL is bash and it inherits a + # broken ls alias from the environment. This has actually + # happened. Such a system could not be considered "sane". + as_fn_error $? "ls -t appears to fail. Make sure there is not a broken +alias in your environment" "$LINENO" 5 + fi + + test "$2" = conftest.file + ) +then + # Ok. + : +else + as_fn_error $? "newly created file is older than distributed files! +Check your system clock" "$LINENO" 5 +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +test "$program_prefix" != NONE && + program_transform_name="s&^&$program_prefix&;$program_transform_name" +# Use a double $ so make ignores it. +test "$program_suffix" != NONE && + program_transform_name="s&\$&$program_suffix&;$program_transform_name" +# Double any \ or $. +# By default was `s,x,x', remove it if useless. +ac_script='s/[\\$]/&&/g;s/;s,x,x,$//' +program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"` + +if test x"${MISSING+set}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; + *) + MISSING="\${SHELL} $am_aux_dir/missing" ;; + esac +fi +# Use eval to expand $SHELL +if eval "$MISSING --run true"; then + am_missing_run="$MISSING --run " +else + am_missing_run= + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5 +$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;} +fi + +if test x"${install_sh}" != xset; then + case $am_aux_dir in + *\ * | *\ *) + install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; + *) + install_sh="\${SHELL} $am_aux_dir/install-sh" + esac +fi + +# Installed binaries are usually stripped using `strip' when the user +# run `make install-strip'. However `strip' might not be the right +# tool to use in cross-compilation environments, therefore Automake +# will honor the `STRIP' environment variable to overrule this program. +if test "$cross_compiling" != no; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +fi +INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5 +$as_echo_n "checking for a thread-safe mkdir -p... " >&6; } +if test -z "$MKDIR_P"; then + if ${ac_cv_path_mkdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in mkdir gmkdir; do + for ac_exec_ext in '' $ac_executable_extensions; do + { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; } || continue + case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #( + 'mkdir (GNU coreutils) '* | \ + 'mkdir (coreutils) '* | \ + 'mkdir (fileutils) '4.1*) + ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext + break 3;; + esac + done + done + done +IFS=$as_save_IFS + +fi + + test -d ./--version && rmdir ./--version + if test "${ac_cv_path_mkdir+set}" = set; then + MKDIR_P="$ac_cv_path_mkdir -p" + else + # As a last resort, use the slow shell script. Don't cache a + # value for MKDIR_P within a source directory, because that will + # break other packages using the cache if that directory is + # removed, or if the value is a relative name. + MKDIR_P="$ac_install_sh -d" + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5 +$as_echo "$MKDIR_P" >&6; } + +mkdir_p="$MKDIR_P" +case $mkdir_p in + [\\/$]* | ?:[\\/]*) ;; + */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;; +esac + +for ac_prog in gawk mawk nawk awk +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AWK+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AWK"; then + ac_cv_prog_AWK="$AWK" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AWK="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AWK=$ac_cv_prog_AWK +if test -n "$AWK"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5 +$as_echo "$AWK" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AWK" && break +done + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5 +$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; } +set x ${MAKE-make} +ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'` +if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat >conftest.make <<\_ACEOF +SHELL = /bin/sh +all: + @echo '@@@%%%=$(MAKE)=@@@%%%' +_ACEOF +# GNU make sometimes prints "make[1]: Entering ...", which would confuse us. +case `${MAKE-make} -f conftest.make 2>/dev/null` in + *@@@%%%=?*=@@@%%%*) + eval ac_cv_prog_make_${ac_make}_set=yes;; + *) + eval ac_cv_prog_make_${ac_make}_set=no;; +esac +rm -f conftest.make +fi +if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + SET_MAKE= +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + SET_MAKE="MAKE=${MAKE-make}" +fi + +rm -rf .tst 2>/dev/null +mkdir .tst 2>/dev/null +if test -d .tst; then + am__leading_dot=. +else + am__leading_dot=_ +fi +rmdir .tst 2>/dev/null + +if test "`cd $srcdir && pwd`" != "`pwd`"; then + # Use -I$(srcdir) only when $(srcdir) != ., so that make's output + # is not polluted with repeated "-I." + am__isrc=' -I$(srcdir)' + # test to see if srcdir already configured + if test -f $srcdir/config.status; then + as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5 + fi +fi + +# test whether we have cygpath +if test -z "$CYGPATH_W"; then + if (cygpath --version) >/dev/null 2>/dev/null; then + CYGPATH_W='cygpath -w' + else + CYGPATH_W=echo + fi +fi + + +# Define the identity of the package. + PACKAGE='libffi' + VERSION='3.0.10' + + +cat >>confdefs.h <<_ACEOF +#define PACKAGE "$PACKAGE" +_ACEOF + + +cat >>confdefs.h <<_ACEOF +#define VERSION "$VERSION" +_ACEOF + +# Some tools Automake needs. + +ACLOCAL=${ACLOCAL-"${am_missing_run}aclocal-${am__api_version}"} + + +AUTOCONF=${AUTOCONF-"${am_missing_run}autoconf"} + + +AUTOMAKE=${AUTOMAKE-"${am_missing_run}automake-${am__api_version}"} + + +AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"} + + +MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"} + +# We need awk for the "check" target. The system "awk" is bad on +# some platforms. +# Always define AMTAR for backward compatibility. + +AMTAR=${AMTAR-"${am_missing_run}tar"} + +am__tar='${AMTAR} chof - "$$tardir"'; am__untar='${AMTAR} xf -' + + + + + + +# The same as in boehm-gc and libstdc++. Have to borrow it from there. +# We must force CC to /not/ be precious variables; otherwise +# the wrong, non-multilib-adjusted value will be used in multilibs. +# As a side effect, we have to subst CFLAGS ourselves. +# Also save and restore CFLAGS, since AC_PROG_CC will come up with +# defaults of its own if none are provided. + + + +save_CFLAGS=$CFLAGS +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args. +set dummy ${ac_tool_prefix}gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_CC"; then + ac_ct_CC=$CC + # Extract the first word of "gcc", so it can be a program name with args. +set dummy gcc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="gcc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +else + CC="$ac_cv_prog_CC" +fi + +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args. +set dummy ${ac_tool_prefix}cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="${ac_tool_prefix}cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + fi +fi +if test -z "$CC"; then + # Extract the first word of "cc", so it can be a program name with args. +set dummy cc; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else + ac_prog_rejected=no +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then + ac_prog_rejected=yes + continue + fi + ac_cv_prog_CC="cc" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +if test $ac_prog_rejected = yes; then + # We found a bogon in the path, so make sure we never use it. + set dummy $ac_cv_prog_CC + shift + if test $# != 0; then + # We chose a different compiler from the bogus one. + # However, it has the same basename, so the bogon will be chosen + # first if we set CC to just the basename; use the full file name. + shift + ac_cv_prog_CC="$as_dir/$ac_word${1+' '}$@" + fi +fi +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$CC"; then + if test -n "$ac_tool_prefix"; then + for ac_prog in cl.exe + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$CC"; then + ac_cv_prog_CC="$CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_CC="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +CC=$ac_cv_prog_CC +if test -n "$CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5 +$as_echo "$CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$CC" && break + done +fi +if test -z "$CC"; then + ac_ct_CC=$CC + for ac_prog in cl.exe +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_CC+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_CC"; then + ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_CC="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_CC=$ac_cv_prog_ac_ct_CC +if test -n "$ac_ct_CC"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5 +$as_echo "$ac_ct_CC" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_CC" && break +done + + if test "x$ac_ct_CC" = x; then + CC="" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + CC=$ac_ct_CC + fi +fi + +fi + + +test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "no acceptable C compiler found in \$PATH +See \`config.log' for more details" "$LINENO" 5; } + +# Provide some information about the compiler. +$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5 +set X $ac_compile +ac_compiler=$2 +for ac_option in --version -v -V -qversion; do + { { ac_try="$ac_compiler $ac_option >&5" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compiler $ac_option >&5") 2>conftest.err + ac_status=$? + if test -s conftest.err; then + sed '10a\ +... rest of stderr output deleted ... + 10q' conftest.err >conftest.er1 + cat conftest.er1 >&5 + fi + rm -f conftest.er1 conftest.err + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } +done + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out" +# Try to create an executable without -o first, disregard a.out. +# It will help us diagnose broken compilers, and finding out an intuition +# of exeext. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5 +$as_echo_n "checking whether the C compiler works... " >&6; } +ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'` + +# The possible output files: +ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*" + +ac_rmfiles= +for ac_file in $ac_files +do + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + * ) ac_rmfiles="$ac_rmfiles $ac_file";; + esac +done +rm -f $ac_rmfiles + +if { { ac_try="$ac_link_default" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link_default") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # Autoconf-2.13 could set the ac_cv_exeext variable to `no'. +# So ignore a value of `no', otherwise this would lead to `EXEEXT = no' +# in a Makefile. We should not override ac_cv_exeext if it was cached, +# so that the user can short-circuit this test for compilers unknown to +# Autoconf. +for ac_file in $ac_files '' +do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) + ;; + [ab].out ) + # We found the default executable, but exeext='' is most + # certainly right. + break;; + *.* ) + if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no; + then :; else + ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + fi + # We set ac_cv_exeext here because the later test for it is not + # safe: cross compilers may not add the suffix if given an `-o' + # argument, so we may need to know it at that point already. + # Even if this section looks crufty: it has the advantage of + # actually working. + break;; + * ) + break;; + esac +done +test "$ac_cv_exeext" = no && ac_cv_exeext= + +else + ac_file='' +fi +if test -z "$ac_file"; then : + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +$as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "C compiler cannot create executables +See \`config.log' for more details" "$LINENO" 5; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5 +$as_echo_n "checking for C compiler default output file name... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5 +$as_echo "$ac_file" >&6; } +ac_exeext=$ac_cv_exeext + +rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5 +$as_echo_n "checking for suffix of executables... " >&6; } +if { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + # If both `conftest.exe' and `conftest' are `present' (well, observable) +# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will +# work properly (i.e., refer to `conftest.exe'), while it won't with +# `rm'. +for ac_file in conftest.exe conftest conftest.*; do + test -f "$ac_file" || continue + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;; + *.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'` + break;; + * ) break;; + esac +done +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of executables: cannot compile and link +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest conftest$ac_cv_exeext +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5 +$as_echo "$ac_cv_exeext" >&6; } + +rm -f conftest.$ac_ext +EXEEXT=$ac_cv_exeext +ac_exeext=$EXEEXT +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +FILE *f = fopen ("conftest.out", "w"); + return ferror (f) || fclose (f) != 0; + + ; + return 0; +} +_ACEOF +ac_clean_files="$ac_clean_files conftest.out" +# Check that the compiler produces executables we can run. If not, either +# the compiler is broken, or we cross compile. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5 +$as_echo_n "checking whether we are cross compiling... " >&6; } +if test "$cross_compiling" != yes; then + { { ac_try="$ac_link" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_link") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if { ac_try='./conftest$ac_cv_exeext' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + cross_compiling=no + else + if test "$cross_compiling" = maybe; then + cross_compiling=yes + else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot run C compiled programs. +If you meant to cross compile, use \`--host'. +See \`config.log' for more details" "$LINENO" 5; } + fi + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5 +$as_echo "$cross_compiling" >&6; } + +rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out +ac_clean_files=$ac_clean_files_save +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5 +$as_echo_n "checking for suffix of object files... " >&6; } +if ${ac_cv_objext+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +rm -f conftest.o conftest.obj +if { { ac_try="$ac_compile" +case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_compile") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then : + for ac_file in conftest.o conftest.obj conftest.*; do + test -f "$ac_file" || continue; + case $ac_file in + *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;; + *) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'` + break;; + esac +done +else + $as_echo "$as_me: failed program was:" >&5 +sed 's/^/| /' conftest.$ac_ext >&5 + +{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "cannot compute suffix of object files: cannot compile +See \`config.log' for more details" "$LINENO" 5; } +fi +rm -f conftest.$ac_cv_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5 +$as_echo "$ac_cv_objext" >&6; } +OBJEXT=$ac_cv_objext +ac_objext=$OBJEXT +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5 +$as_echo_n "checking whether we are using the GNU C compiler... " >&6; } +if ${ac_cv_c_compiler_gnu+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ +#ifndef __GNUC__ + choke me +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_compiler_gnu=yes +else + ac_compiler_gnu=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_cv_c_compiler_gnu=$ac_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5 +$as_echo "$ac_cv_c_compiler_gnu" >&6; } +if test $ac_compiler_gnu = yes; then + GCC=yes +else + GCC= +fi +ac_test_CFLAGS=${CFLAGS+set} +ac_save_CFLAGS=$CFLAGS +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5 +$as_echo_n "checking whether $CC accepts -g... " >&6; } +if ${ac_cv_prog_cc_g+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_save_c_werror_flag=$ac_c_werror_flag + ac_c_werror_flag=yes + ac_cv_prog_cc_g=no + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +else + CFLAGS="" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + +else + ac_c_werror_flag=$ac_save_c_werror_flag + CFLAGS="-g" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_g=yes +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + ac_c_werror_flag=$ac_save_c_werror_flag +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5 +$as_echo "$ac_cv_prog_cc_g" >&6; } +if test "$ac_test_CFLAGS" = set; then + CFLAGS=$ac_save_CFLAGS +elif test $ac_cv_prog_cc_g = yes; then + if test "$GCC" = yes; then + CFLAGS="-g -O2" + else + CFLAGS="-g" + fi +else + if test "$GCC" = yes; then + CFLAGS="-O2" + else + CFLAGS= + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5 +$as_echo_n "checking for $CC option to accept ISO C89... " >&6; } +if ${ac_cv_prog_cc_c89+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_prog_cc_c89=no +ac_save_CC=$CC +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include +/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */ +struct buf { int x; }; +FILE * (*rcsopen) (struct buf *, struct stat *, int); +static char *e (p, i) + char **p; + int i; +{ + return p[i]; +} +static char *f (char * (*g) (char **, int), char **p, ...) +{ + char *s; + va_list v; + va_start (v,p); + s = g (p, va_arg (v,int)); + va_end (v); + return s; +} + +/* OSF 4.0 Compaq cc is some sort of almost-ANSI by default. It has + function prototypes and stuff, but not '\xHH' hex character constants. + These don't provoke an error unfortunately, instead are silently treated + as 'x'. The following induces an error, until -std is added to get + proper ANSI mode. Curiously '\x00'!='x' always comes out true, for an + array size at least. It's necessary to write '\x00'==0 to get something + that's true only with -std. */ +int osf4_cc_array ['\x00' == 0 ? 1 : -1]; + +/* IBM C 6 for AIX is almost-ANSI by default, but it replaces macro parameters + inside strings and character constants. */ +#define FOO(x) 'x' +int xlc6_cc_array[FOO(a) == 'x' ? 1 : -1]; + +int test (int i, double x); +struct s1 {int (*f) (int a);}; +struct s2 {int (*f) (double a);}; +int pairnames (int, char **, FILE *(*)(struct buf *, struct stat *, int), int, int); +int argc; +char **argv; +int +main () +{ +return f (e, argv, 0) != argv[0] || f (e, argv, 1) != argv[1]; + ; + return 0; +} +_ACEOF +for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \ + -Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__" +do + CC="$ac_save_CC $ac_arg" + if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_prog_cc_c89=$ac_arg +fi +rm -f core conftest.err conftest.$ac_objext + test "x$ac_cv_prog_cc_c89" != "xno" && break +done +rm -f conftest.$ac_ext +CC=$ac_save_CC + +fi +# AC_CACHE_VAL +case "x$ac_cv_prog_cc_c89" in + x) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5 +$as_echo "none needed" >&6; } ;; + xno) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5 +$as_echo "unsupported" >&6; } ;; + *) + CC="$CC $ac_cv_prog_cc_c89" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5 +$as_echo "$ac_cv_prog_cc_c89" >&6; } ;; +esac +if test "x$ac_cv_prog_cc_c89" != xno; then : + +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +DEPDIR="${am__leading_dot}deps" + +ac_config_commands="$ac_config_commands depfiles" + + +am_make=${MAKE-make} +cat > confinc << 'END' +am__doit: + @echo this is the am__doit target +.PHONY: am__doit +END +# If we don't find an include directive, just comment out the code. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for style of include used by $am_make" >&5 +$as_echo_n "checking for style of include used by $am_make... " >&6; } +am__include="#" +am__quote= +_am_result=none +# First try GNU make style include. +echo "include confinc" > confmf +# Ignore all kinds of additional output from `make'. +case `$am_make -s -f confmf 2> /dev/null` in #( +*the\ am__doit\ target*) + am__include=include + am__quote= + _am_result=GNU + ;; +esac +# Now try BSD make style include. +if test "$am__include" = "#"; then + echo '.include "confinc"' > confmf + case `$am_make -s -f confmf 2> /dev/null` in #( + *the\ am__doit\ target*) + am__include=.include + am__quote="\"" + _am_result=BSD + ;; + esac +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $_am_result" >&5 +$as_echo "$_am_result" >&6; } +rm -f confinc confmf + +# Check whether --enable-dependency-tracking was given. +if test "${enable_dependency_tracking+set}" = set; then : + enableval=$enable_dependency_tracking; +fi + +if test "x$enable_dependency_tracking" != xno; then + am_depcomp="$ac_aux_dir/depcomp" + AMDEPBACKSLASH='\' +fi + if test "x$enable_dependency_tracking" != xno; then + AMDEP_TRUE= + AMDEP_FALSE='#' +else + AMDEP_TRUE='#' + AMDEP_FALSE= +fi + + + +depcc="$CC" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CC_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CC_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + case " $depcc " in #( + *\ -arch\ *\ -arch\ *) am__universal=true ;; + esac + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CC_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CC_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CC_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CC_dependencies_compiler_type" >&6; } +CCDEPMODE=depmode=$am_cv_CC_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CC_dependencies_compiler_type" = gcc3; then + am__fastdepCC_TRUE= + am__fastdepCC_FALSE='#' +else + am__fastdepCC_TRUE='#' + am__fastdepCC_FALSE= +fi + + +CFLAGS=$save_CFLAGS + + + + + +# By default we simply use the C compiler to build assembly code. + +test "${CCAS+set}" = set || CCAS=$CC +test "${CCASFLAGS+set}" = set || CCASFLAGS=$CFLAGS + + + +depcc="$CCAS" am_compiler_list= + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking dependency style of $depcc" >&5 +$as_echo_n "checking dependency style of $depcc... " >&6; } +if ${am_cv_CCAS_dependencies_compiler_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$AMDEP_TRUE" && test -f "$am_depcomp"; then + # We make a subdir and do the tests there. Otherwise we can end up + # making bogus files that we don't know about and never remove. For + # instance it was reported that on HP-UX the gcc test will end up + # making a dummy file named `D' -- because `-MD' means `put the output + # in D'. + mkdir conftest.dir + # Copy depcomp to subdir because otherwise we won't find it if we're + # using a relative directory. + cp "$am_depcomp" conftest.dir + cd conftest.dir + # We will build objects and dependencies in a subdirectory because + # it helps to detect inapplicable dependency modes. For instance + # both Tru64's cc and ICC support -MD to output dependencies as a + # side effect of compilation, but ICC will put the dependencies in + # the current directory while Tru64 will put them in the object + # directory. + mkdir sub + + am_cv_CCAS_dependencies_compiler_type=none + if test "$am_compiler_list" = ""; then + am_compiler_list=`sed -n 's/^#*\([a-zA-Z0-9]*\))$/\1/p' < ./depcomp` + fi + am__universal=false + + + for depmode in $am_compiler_list; do + # Setup a source with many dependencies, because some compilers + # like to wrap large dependency lists on column 80 (with \), and + # we should not choose a depcomp mode which is confused by this. + # + # We need to recreate these files for each test, as the compiler may + # overwrite some of them when testing with obscure command lines. + # This happens at least with the AIX C compiler. + : > sub/conftest.c + for i in 1 2 3 4 5 6; do + echo '#include "conftst'$i'.h"' >> sub/conftest.c + # Using `: > sub/conftst$i.h' creates only sub/conftst1.h with + # Solaris 8's {/usr,}/bin/sh. + touch sub/conftst$i.h + done + echo "${am__include} ${am__quote}sub/conftest.Po${am__quote}" > confmf + + # We check with `-c' and `-o' for the sake of the "dashmstdout" + # mode. It turns out that the SunPro C++ compiler does not properly + # handle `-M -o', and we need to detect this. Also, some Intel + # versions had trouble with output in subdirs + am__obj=sub/conftest.${OBJEXT-o} + am__minus_obj="-o $am__obj" + case $depmode in + gcc) + # This depmode causes a compiler race in universal mode. + test "$am__universal" = false || continue + ;; + nosideeffect) + # after this tag, mechanisms are not by side-effect, so they'll + # only be used when explicitly requested + if test "x$enable_dependency_tracking" = xyes; then + continue + else + break + fi + ;; + msvisualcpp | msvcmsys) + # This compiler won't grok `-c -o', but also, the minuso test has + # not run yet. These depmodes are late enough in the game, and + # so weak that their functioning should not be impacted. + am__obj=conftest.${OBJEXT-o} + am__minus_obj= + ;; + none) break ;; + esac + if depmode=$depmode \ + source=sub/conftest.c object=$am__obj \ + depfile=sub/conftest.Po tmpdepfile=sub/conftest.TPo \ + $SHELL ./depcomp $depcc -c $am__minus_obj sub/conftest.c \ + >/dev/null 2>conftest.err && + grep sub/conftst1.h sub/conftest.Po > /dev/null 2>&1 && + grep sub/conftst6.h sub/conftest.Po > /dev/null 2>&1 && + grep $am__obj sub/conftest.Po > /dev/null 2>&1 && + ${MAKE-make} -s -f confmf > /dev/null 2>&1; then + # icc doesn't choke on unknown options, it will just issue warnings + # or remarks (even with -Werror). So we grep stderr for any message + # that says an option was ignored or not supported. + # When given -MP, icc 7.0 and 7.1 complain thusly: + # icc: Command line warning: ignoring option '-M'; no argument required + # The diagnosis changed in icc 8.0: + # icc: Command line remark: option '-MP' not supported + if (grep 'ignoring option' conftest.err || + grep 'not supported' conftest.err) >/dev/null 2>&1; then :; else + am_cv_CCAS_dependencies_compiler_type=$depmode + break + fi + fi + done + + cd .. + rm -rf conftest.dir +else + am_cv_CCAS_dependencies_compiler_type=none +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $am_cv_CCAS_dependencies_compiler_type" >&5 +$as_echo "$am_cv_CCAS_dependencies_compiler_type" >&6; } +CCASDEPMODE=depmode=$am_cv_CCAS_dependencies_compiler_type + + if + test "x$enable_dependency_tracking" != xno \ + && test "$am_cv_CCAS_dependencies_compiler_type" = gcc3; then + am__fastdepCCAS_TRUE= + am__fastdepCCAS_FALSE='#' +else + am__fastdepCCAS_TRUE='#' + am__fastdepCCAS_FALSE= +fi + + +if test "x$CC" != xcc; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC and cc understand -c and -o together" >&5 +$as_echo_n "checking whether $CC and cc understand -c and -o together... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether cc understands -c and -o together" >&5 +$as_echo_n "checking whether cc understands -c and -o together... " >&6; } +fi +set dummy $CC; ac_cc=`$as_echo "$2" | + sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +if eval \${ac_cv_prog_cc_${ac_cc}_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +# Make sure it works both with $CC and with simple cc. +# We do the test twice because some compilers refuse to overwrite an +# existing .o file with -o, though they will create one. +ac_try='$CC -c conftest.$ac_ext -o conftest2.$ac_objext >&5' +rm -f conftest2.* +if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; +then + eval ac_cv_prog_cc_${ac_cc}_c_o=yes + if test "x$CC" != xcc; then + # Test first that cc exists at all. + if { ac_try='cc -c conftest.$ac_ext >&5' + { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + ac_try='cc -c conftest.$ac_ext -o conftest2.$ac_objext >&5' + rm -f conftest2.* + if { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && + test -f conftest2.$ac_objext && { { case "(($ac_try" in + *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;; + *) ac_try_echo=$ac_try;; +esac +eval ac_try_echo="\"\$as_me:${as_lineno-$LINENO}: $ac_try_echo\"" +$as_echo "$ac_try_echo"; } >&5 + (eval "$ac_try") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; + then + # cc works too. + : + else + # cc exists but doesn't like -o. + eval ac_cv_prog_cc_${ac_cc}_c_o=no + fi + fi + fi +else + eval ac_cv_prog_cc_${ac_cc}_c_o=no +fi +rm -f core conftest* + +fi +if eval test \$ac_cv_prog_cc_${ac_cc}_c_o = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + +$as_echo "#define NO_MINUS_C_MINUS_O 1" >>confdefs.h + +fi + +# FIXME: we rely on the cache variable name because +# there is no other way. +set dummy $CC +am_cc=`echo $2 | sed 's/[^a-zA-Z0-9_]/_/g;s/^[0-9]/_/'` +eval am_t=\$ac_cv_prog_cc_${am_cc}_c_o +if test "$am_t" != yes; then + # Losing compiler, so override with the script. + # FIXME: It is wrong to rewrite CC. + # But if we don't then we get into trouble of one sort or another. + # A longer-term fix would be to have automake use am__CC in this case, + # and then we could set am__CC="\$(top_srcdir)/compile \$(CC)" + CC="$am_aux_dir/compile $CC" +fi + + +case `pwd` in + *\ * | *\ *) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5 +$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;; +esac + + + +macro_version='2.4' +macro_revision='1.3293' + + + + + + + + + + + + + +ltmain="$ac_aux_dir/ltmain.sh" + +# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\(["`$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' + +ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5 +$as_echo_n "checking how to print strings... " >&6; } +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "" +} + +case "$ECHO" in + printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5 +$as_echo "printf" >&6; } ;; + print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5 +$as_echo "print -r" >&6; } ;; + *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5 +$as_echo "cat" >&6; } ;; +esac + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5 +$as_echo_n "checking for a sed that does not truncate output... " >&6; } +if ${ac_cv_path_SED+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/ + for ac_i in 1 2 3 4 5 6 7; do + ac_script="$ac_script$as_nl$ac_script" + done + echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed + { ac_script=; unset ac_script;} + if test -z "$SED"; then + ac_path_SED_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_SED="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_SED" && $as_test_x "$ac_path_SED"; } || continue +# Check for GNU ac_path_SED and select it if it is found. + # Check for GNU $ac_path_SED +case `"$ac_path_SED" --version 2>&1` in +*GNU*) + ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo '' >> "conftest.nl" + "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_SED_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_SED="$ac_path_SED" + ac_path_SED_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_SED_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_SED"; then + as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5 + fi +else + ac_cv_path_SED=$SED +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5 +$as_echo "$ac_cv_path_SED" >&6; } + SED="$ac_cv_path_SED" + rm -f conftest.sed + +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5 +$as_echo_n "checking for grep that handles long lines and -e... " >&6; } +if ${ac_cv_path_GREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$GREP"; then + ac_path_GREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in grep ggrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue +# Check for GNU ac_path_GREP and select it if it is found. + # Check for GNU $ac_path_GREP +case `"$ac_path_GREP" --version 2>&1` in +*GNU*) + ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'GREP' >> "conftest.nl" + "$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_GREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_GREP="$ac_path_GREP" + ac_path_GREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_GREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_GREP"; then + as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_GREP=$GREP +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5 +$as_echo "$ac_cv_path_GREP" >&6; } + GREP="$ac_cv_path_GREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5 +$as_echo_n "checking for egrep... " >&6; } +if ${ac_cv_path_EGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo a | $GREP -E '(a|b)' >/dev/null 2>&1 + then ac_cv_path_EGREP="$GREP -E" + else + if test -z "$EGREP"; then + ac_path_EGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in egrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue +# Check for GNU ac_path_EGREP and select it if it is found. + # Check for GNU $ac_path_EGREP +case `"$ac_path_EGREP" --version 2>&1` in +*GNU*) + ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'EGREP' >> "conftest.nl" + "$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_EGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_EGREP="$ac_path_EGREP" + ac_path_EGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_EGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_EGREP"; then + as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_EGREP=$EGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5 +$as_echo "$ac_cv_path_EGREP" >&6; } + EGREP="$ac_cv_path_EGREP" + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5 +$as_echo_n "checking for fgrep... " >&6; } +if ${ac_cv_path_FGREP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1 + then ac_cv_path_FGREP="$GREP -F" + else + if test -z "$FGREP"; then + ac_path_FGREP_found=false + # Loop through the user's path and test for each of PROGNAME-LIST + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_prog in fgrep; do + for ac_exec_ext in '' $ac_executable_extensions; do + ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext" + { test -f "$ac_path_FGREP" && $as_test_x "$ac_path_FGREP"; } || continue +# Check for GNU ac_path_FGREP and select it if it is found. + # Check for GNU $ac_path_FGREP +case `"$ac_path_FGREP" --version 2>&1` in +*GNU*) + ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;; +*) + ac_count=0 + $as_echo_n 0123456789 >"conftest.in" + while : + do + cat "conftest.in" "conftest.in" >"conftest.tmp" + mv "conftest.tmp" "conftest.in" + cp "conftest.in" "conftest.nl" + $as_echo 'FGREP' >> "conftest.nl" + "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break + diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break + as_fn_arith $ac_count + 1 && ac_count=$as_val + if test $ac_count -gt ${ac_path_FGREP_max-0}; then + # Best one so far, save it but keep looking for a better one + ac_cv_path_FGREP="$ac_path_FGREP" + ac_path_FGREP_max=$ac_count + fi + # 10*(2^10) chars as input seems more than enough + test $ac_count -gt 10 && break + done + rm -f conftest.in conftest.tmp conftest.nl conftest.out;; +esac + + $ac_path_FGREP_found && break 3 + done + done + done +IFS=$as_save_IFS + if test -z "$ac_cv_path_FGREP"; then + as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5 + fi +else + ac_cv_path_FGREP=$FGREP +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5 +$as_echo "$ac_cv_path_FGREP" >&6; } + FGREP="$ac_cv_path_FGREP" + + +test -z "$GREP" && GREP=grep + + + + + + + + + + + + + + + + + + + +# Check whether --with-gnu-ld was given. +if test "${with_gnu_ld+set}" = set; then : + withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes +else + with_gnu_ld=no +fi + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5 +$as_echo_n "checking for ld used by $CC... " >&6; } + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [\\/]* | ?:[\\/]*) + re_direlt='/[^/][^/]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5 +$as_echo_n "checking for GNU ld... " >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5 +$as_echo_n "checking for non-GNU ld... " >&6; } +fi +if ${lt_cv_path_LD+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &5 +$as_echo "$LD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi +test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5 +$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; } +if ${lt_cv_prog_gnu_ld+:} false; then : + $as_echo_n "(cached) " >&6 +else + # I'd rather use --version here, but apparently some GNU lds only accept -v. +case `$LD -v 2>&1 &5 +$as_echo "$lt_cv_prog_gnu_ld" >&6; } +with_gnu_ld=$lt_cv_prog_gnu_ld + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5 +$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; } +if ${lt_cv_path_NM+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5 +$as_echo "$lt_cv_path_NM" >&6; } +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + if test -n "$ac_tool_prefix"; then + for ac_prog in dumpbin "link -dump" + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DUMPBIN"; then + ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DUMPBIN=$ac_cv_prog_DUMPBIN +if test -n "$DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5 +$as_echo "$DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$DUMPBIN" && break + done +fi +if test -z "$DUMPBIN"; then + ac_ct_DUMPBIN=$DUMPBIN + for ac_prog in dumpbin "link -dump" +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DUMPBIN"; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DUMPBIN="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN +if test -n "$ac_ct_DUMPBIN"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5 +$as_echo "$ac_ct_DUMPBIN" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_DUMPBIN" && break +done + + if test "x$ac_ct_DUMPBIN" = x; then + DUMPBIN=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DUMPBIN=$ac_ct_DUMPBIN + fi +fi + + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi + + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5 +$as_echo_n "checking the name lister ($NM) interface... " >&6; } +if ${lt_cv_nm_interface+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&5 + (eval echo "\"\$as_me:$LINENO: output\"" >&5) + cat conftest.out >&5 + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5 +$as_echo "$lt_cv_nm_interface" >&6; } + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5 +$as_echo_n "checking whether ln -s works... " >&6; } +LN_S=$as_ln_s +if test "$LN_S" = "ln -s"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5 +$as_echo "no, using $LN_S" >&6; } +fi + +# find the maximum length of command line arguments +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5 +$as_echo_n "checking the maximum length of command line arguments... " >&6; } +if ${lt_cv_sys_max_cmd_len+:} false; then : + $as_echo_n "(cached) " >&6 +else + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac + +fi + +if test -n $lt_cv_sys_max_cmd_len ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5 +$as_echo "$lt_cv_sys_max_cmd_len" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5 +$as_echo "none" >&6; } +fi +max_cmd_len=$lt_cv_sys_max_cmd_len + + + + + + +: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5 +$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; } +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5 +$as_echo "$xsi_shell" >&6; } + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5 +$as_echo_n "checking whether the shell understands \"+=\"... " >&6; } +lt_shell_append=no +( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5 +$as_echo "$lt_shell_append" >&6; } + + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi + + + + + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5 +$as_echo_n "checking how to convert $build file names to $host format... " >&6; } +if ${lt_cv_to_host_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac + +fi + +to_host_file_cmd=$lt_cv_to_host_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5 +$as_echo "$lt_cv_to_host_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5 +$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; } +if ${lt_cv_to_tool_file_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + #assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac + +fi + +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5 +$as_echo "$lt_cv_to_tool_file_cmd" >&6; } + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5 +$as_echo_n "checking for $LD option to reload object files... " >&6; } +if ${lt_cv_ld_reload_flag+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_reload_flag='-r' +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5 +$as_echo "$lt_cv_ld_reload_flag" >&6; } +reload_flag=$lt_cv_ld_reload_flag +case $reload_flag in +"" | " "*) ;; +*) reload_flag=" $reload_flag" ;; +esac +reload_cmds='$LD$reload_flag -o $output$reload_objs' +case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + if test "$GCC" != yes; then + reload_cmds=false + fi + ;; + darwin*) + if test "$GCC" = yes; then + reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs' + else + reload_cmds='$LD$reload_flag -o $output$reload_objs' + fi + ;; +esac + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args. +set dummy ${ac_tool_prefix}objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OBJDUMP"; then + ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OBJDUMP=$ac_cv_prog_OBJDUMP +if test -n "$OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5 +$as_echo "$OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OBJDUMP"; then + ac_ct_OBJDUMP=$OBJDUMP + # Extract the first word of "objdump", so it can be a program name with args. +set dummy objdump; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OBJDUMP"; then + ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OBJDUMP="objdump" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP +if test -n "$ac_ct_OBJDUMP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5 +$as_echo "$ac_ct_OBJDUMP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OBJDUMP" = x; then + OBJDUMP="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OBJDUMP=$ac_ct_OBJDUMP + fi +else + OBJDUMP="$ac_cv_prog_OBJDUMP" +fi + +test -z "$OBJDUMP" && OBJDUMP=objdump + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5 +$as_echo_n "checking how to recognize dependent libraries... " >&6; } +if ${lt_cv_deplibs_check_method+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_file_magic_cmd='$MAGIC_CMD' +lt_cv_file_magic_test_file= +lt_cv_deplibs_check_method='unknown' +# Need to set the preceding variable on all platforms that support +# interlibrary dependencies. +# 'none' -- dependencies not supported. +# `unknown' -- same as none, but documents that we really don't know. +# 'pass_all' -- all dependencies passed with no checks. +# 'test_compile' -- check by making test program. +# 'file_magic [[regex]]' -- check by looking for files in library path +# which responds to the $file_magic_cmd with a given extended regex. +# If you have `file' or equivalent on your system and you're not sure +# whether `pass_all' will *always* work, you probably want this one. + +case $host_os in +aix[4-9]*) + lt_cv_deplibs_check_method=pass_all + ;; + +beos*) + lt_cv_deplibs_check_method=pass_all + ;; + +bsdi[45]*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib)' + lt_cv_file_magic_cmd='/usr/bin/file -L' + lt_cv_file_magic_test_file=/shlib/libc.so + ;; + +cygwin*) + # func_win32_libid is a shell function defined in ltmain.sh + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + ;; + +mingw* | pw32*) + # Base MSYS/MinGW do not provide the 'file' command needed by + # func_win32_libid shell function, so use a weaker test based on 'objdump', + # unless we find 'file', for example because we are cross-compiling. + # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin. + if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[3-9]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]' + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[3-9]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [ML]SB (shared object|dynamic lib) M[0-9][0-9]* Version [0-9]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [0-9][0-9]*-bit [LM]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [0-9][0-9]*-bit [LM]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5 +$as_echo "$lt_cv_deplibs_check_method" >&6; } + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + + + + + + + + + + + + + + + + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args. +set dummy ${ac_tool_prefix}dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DLLTOOL"; then + ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DLLTOOL=$ac_cv_prog_DLLTOOL +if test -n "$DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5 +$as_echo "$DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DLLTOOL"; then + ac_ct_DLLTOOL=$DLLTOOL + # Extract the first word of "dlltool", so it can be a program name with args. +set dummy dlltool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DLLTOOL"; then + ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DLLTOOL="dlltool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL +if test -n "$ac_ct_DLLTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5 +$as_echo "$ac_ct_DLLTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DLLTOOL" = x; then + DLLTOOL="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DLLTOOL=$ac_ct_DLLTOOL + fi +else + DLLTOOL="$ac_cv_prog_DLLTOOL" +fi + +test -z "$DLLTOOL" && DLLTOOL=dlltool + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5 +$as_echo_n "checking how to associate runtime and link libraries... " >&6; } +if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5 +$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; } +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + + + + + + + + +if test -n "$ac_tool_prefix"; then + for ac_prog in ar + do + # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args. +set dummy $ac_tool_prefix$ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$AR"; then + ac_cv_prog_AR="$AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_AR="$ac_tool_prefix$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +AR=$ac_cv_prog_AR +if test -n "$AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5 +$as_echo "$AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$AR" && break + done +fi +if test -z "$AR"; then + ac_ct_AR=$AR + for ac_prog in ar +do + # Extract the first word of "$ac_prog", so it can be a program name with args. +set dummy $ac_prog; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_AR+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_AR"; then + ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_AR="$ac_prog" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_AR=$ac_cv_prog_ac_ct_AR +if test -n "$ac_ct_AR"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5 +$as_echo "$ac_ct_AR" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + test -n "$ac_ct_AR" && break +done + + if test "x$ac_ct_AR" = x; then + AR="false" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + AR=$ac_ct_AR + fi +fi + +: ${AR=ar} +: ${AR_FLAGS=cru} + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5 +$as_echo_n "checking for archiver @FILE support... " >&6; } +if ${lt_cv_ar_at_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ar_at_file=no + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5 + (eval $lt_ar_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5 +$as_echo "$lt_cv_ar_at_file" >&6; } + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi + + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args. +set dummy ${ac_tool_prefix}strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$STRIP"; then + ac_cv_prog_STRIP="$STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_STRIP="${ac_tool_prefix}strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +STRIP=$ac_cv_prog_STRIP +if test -n "$STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5 +$as_echo "$STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_STRIP"; then + ac_ct_STRIP=$STRIP + # Extract the first word of "strip", so it can be a program name with args. +set dummy strip; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_STRIP+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_STRIP"; then + ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_STRIP="strip" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP +if test -n "$ac_ct_STRIP"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5 +$as_echo "$ac_ct_STRIP" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_STRIP" = x; then + STRIP=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + STRIP=$ac_ct_STRIP + fi +else + STRIP="$ac_cv_prog_STRIP" +fi + +test -z "$STRIP" && STRIP=: + + + + + + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args. +set dummy ${ac_tool_prefix}ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$RANLIB"; then + ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +RANLIB=$ac_cv_prog_RANLIB +if test -n "$RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5 +$as_echo "$RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_RANLIB"; then + ac_ct_RANLIB=$RANLIB + # Extract the first word of "ranlib", so it can be a program name with args. +set dummy ranlib; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_RANLIB+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_RANLIB"; then + ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_RANLIB="ranlib" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB +if test -n "$ac_ct_RANLIB"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5 +$as_echo "$ac_ct_RANLIB" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_RANLIB" = x; then + RANLIB=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + RANLIB=$ac_ct_RANLIB + fi +else + RANLIB="$ac_cv_prog_RANLIB" +fi + +test -z "$RANLIB" && RANLIB=: + + + + + + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + + +# Check for command to grab the raw symbol name followed by C symbol from nm. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5 +$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; } +if ${lt_cv_sys_global_symbol_pipe+:} false; then : + $as_echo_n "(cached) " >&6 +else + +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[BCDEGRST]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([_A-Za-z][_A-Za-z0-9]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[BCDT]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[ABCDGISTW]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[ABCDEGRST]' + fi + ;; +irix* | nonstopux*) + symcode='[BCDEGRST]' + ;; +osf*) + symcode='[BCDEGQRST]' + ;; +solaris*) + symcode='[BDRT]' + ;; +sco3.2v5*) + symcode='[DT]' + ;; +sysv4.2uw2*) + symcode='[DT]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[ABDT]' + ;; +sysv4) + symcode='[DFNSTU]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[ABCDGIRSTW]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK '"\ +" {last_section=section; section=\$ 3};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag" + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&5 + fi + else + echo "cannot find nm_test_var in $nlist" >&5 + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "$progname: failed program was:" >&5 + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done + +fi + +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5 +$as_echo "failed" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5 +$as_echo "ok" >&6; } +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5 +$as_echo_n "checking for sysroot... " >&6; } + +# Check whether --with-sysroot was given. +if test "${with_sysroot+set}" = set; then : + withval=$with_sysroot; +else + with_sysroot=no +fi + + +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5 +$as_echo "${with_sysroot}" >&6; } + as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5 + ;; +esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5 +$as_echo "${lt_sysroot:-no}" >&6; } + + + + + +# Check whether --enable-libtool-lock was given. +if test "${enable_libtool_lock+set}" = set; then : + enableval=$enable_libtool_lock; +fi + +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '#line '$LINENO' "configure"' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5 +$as_echo_n "checking whether the C compiler needs -belf... " >&6; } +if ${lt_cv_cc_needs_belf+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_cc_needs_belf=yes +else + lt_cv_cc_needs_belf=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5 +$as_echo "$lt_cv_cc_needs_belf" >&6; } + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" + +if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args. +set dummy ${ac_tool_prefix}mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$MANIFEST_TOOL"; then + ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL +if test -n "$MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5 +$as_echo "$MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_MANIFEST_TOOL"; then + ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL + # Extract the first word of "mt", so it can be a program name with args. +set dummy mt; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_MANIFEST_TOOL"; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_MANIFEST_TOOL="mt" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL +if test -n "$ac_ct_MANIFEST_TOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5 +$as_echo "$ac_ct_MANIFEST_TOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_MANIFEST_TOOL" = x; then + MANIFEST_TOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL + fi +else + MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL" +fi + +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5 +$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; } +if ${lt_cv_path_mainfest_tool+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5 + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&5 + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest* +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5 +$as_echo "$lt_cv_path_mainfest_tool" >&6; } +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi + + + + + + + case $host_os in + rhapsody* | darwin*) + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args. +set dummy ${ac_tool_prefix}dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$DSYMUTIL"; then + ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +DSYMUTIL=$ac_cv_prog_DSYMUTIL +if test -n "$DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5 +$as_echo "$DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_DSYMUTIL"; then + ac_ct_DSYMUTIL=$DSYMUTIL + # Extract the first word of "dsymutil", so it can be a program name with args. +set dummy dsymutil; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_DSYMUTIL"; then + ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_DSYMUTIL="dsymutil" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL +if test -n "$ac_ct_DSYMUTIL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5 +$as_echo "$ac_ct_DSYMUTIL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_DSYMUTIL" = x; then + DSYMUTIL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + DSYMUTIL=$ac_ct_DSYMUTIL + fi +else + DSYMUTIL="$ac_cv_prog_DSYMUTIL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args. +set dummy ${ac_tool_prefix}nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$NMEDIT"; then + ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +NMEDIT=$ac_cv_prog_NMEDIT +if test -n "$NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5 +$as_echo "$NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_NMEDIT"; then + ac_ct_NMEDIT=$NMEDIT + # Extract the first word of "nmedit", so it can be a program name with args. +set dummy nmedit; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_NMEDIT"; then + ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_NMEDIT="nmedit" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT +if test -n "$ac_ct_NMEDIT"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5 +$as_echo "$ac_ct_NMEDIT" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_NMEDIT" = x; then + NMEDIT=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + NMEDIT=$ac_ct_NMEDIT + fi +else + NMEDIT="$ac_cv_prog_NMEDIT" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args. +set dummy ${ac_tool_prefix}lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$LIPO"; then + ac_cv_prog_LIPO="$LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_LIPO="${ac_tool_prefix}lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +LIPO=$ac_cv_prog_LIPO +if test -n "$LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5 +$as_echo "$LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_LIPO"; then + ac_ct_LIPO=$LIPO + # Extract the first word of "lipo", so it can be a program name with args. +set dummy lipo; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_LIPO+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_LIPO"; then + ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_LIPO="lipo" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO +if test -n "$ac_ct_LIPO"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5 +$as_echo "$ac_ct_LIPO" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_LIPO" = x; then + LIPO=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + LIPO=$ac_ct_LIPO + fi +else + LIPO="$ac_cv_prog_LIPO" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL"; then + ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL="${ac_tool_prefix}otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL=$ac_cv_prog_OTOOL +if test -n "$OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5 +$as_echo "$OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL"; then + ac_ct_OTOOL=$OTOOL + # Extract the first word of "otool", so it can be a program name with args. +set dummy otool; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL"; then + ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL="otool" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL +if test -n "$ac_ct_OTOOL"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5 +$as_echo "$ac_ct_OTOOL" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL" = x; then + OTOOL=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL=$ac_ct_OTOOL + fi +else + OTOOL="$ac_cv_prog_OTOOL" +fi + + if test -n "$ac_tool_prefix"; then + # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args. +set dummy ${ac_tool_prefix}otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$OTOOL64"; then + ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +OTOOL64=$ac_cv_prog_OTOOL64 +if test -n "$OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5 +$as_echo "$OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + +fi +if test -z "$ac_cv_prog_OTOOL64"; then + ac_ct_OTOOL64=$OTOOL64 + # Extract the first word of "otool64", so it can be a program name with args. +set dummy otool64; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test -n "$ac_ct_OTOOL64"; then + ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test. +else +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_prog_ac_ct_OTOOL64="otool64" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + +fi +fi +ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64 +if test -n "$ac_ct_OTOOL64"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5 +$as_echo "$ac_ct_OTOOL64" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + if test "x$ac_ct_OTOOL64" = x; then + OTOOL64=":" + else + case $cross_compiling:$ac_tool_warned in +yes:) +{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5 +$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;} +ac_tool_warned=yes ;; +esac + OTOOL64=$ac_ct_OTOOL64 + fi +else + OTOOL64="$ac_cv_prog_OTOOL64" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5 +$as_echo_n "checking for -single_module linker flag... " >&6; } +if ${lt_cv_apple_cc_single_mod+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&5 + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5 +$as_echo "$lt_cv_apple_cc_single_mod" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5 +$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; } +if ${lt_cv_ld_exported_symbols_list+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_ld_exported_symbols_list=yes +else + lt_cv_ld_exported_symbols_list=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_exported_symbols_list" >&5 +$as_echo "$lt_cv_ld_exported_symbols_list" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5 +$as_echo_n "checking for -force_load linker flag... " >&6; } +if ${lt_cv_ld_force_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5 + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5 + echo "$AR cru libconftest.a conftest.o" >&5 + $AR cru libconftest.a conftest.o 2>&5 + echo "$RANLIB libconftest.a" >&5 + $RANLIB libconftest.a 2>&5 + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5 + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&5 + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5 +$as_echo "$lt_cv_ld_force_load" >&6; } + case $host_os in + rhapsody* | darwin1.[012]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[91]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[012]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5 +$as_echo_n "checking how to run the C preprocessor... " >&6; } +# On Suns, sometimes $CPP names a directory. +if test -n "$CPP" && test -d "$CPP"; then + CPP= +fi +if test -z "$CPP"; then + if ${ac_cv_prog_CPP+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Double quotes because CPP needs to be expanded + for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp" + do + ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + break +fi + + done + ac_cv_prog_CPP=$CPP + +fi + CPP=$ac_cv_prog_CPP +else + ac_cv_prog_CPP=$CPP +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5 +$as_echo "$CPP" >&6; } +ac_preproc_ok=false +for ac_c_preproc_warn_flag in '' yes +do + # Use a header file that comes with gcc, so configuring glibc + # with a fresh cross-compiler works. + # Prefer to if __STDC__ is defined, since + # exists even on freestanding compilers. + # On the NeXT, cc -E runs the code through the compiler's parser, + # not just through cpp. "Syntax error" is here to catch this case. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __STDC__ +# include +#else +# include +#endif + Syntax error +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + +else + # Broken: fails on valid input. +continue +fi +rm -f conftest.err conftest.i conftest.$ac_ext + + # OK, works on sane cases. Now check whether nonexistent headers + # can be detected and how. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +_ACEOF +if ac_fn_c_try_cpp "$LINENO"; then : + # Broken: success on invalid input. +continue +else + # Passes both tests. +ac_preproc_ok=: +break +fi +rm -f conftest.err conftest.i conftest.$ac_ext + +done +# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped. +rm -f conftest.i conftest.err conftest.$ac_ext +if $ac_preproc_ok; then : + +else + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error $? "C preprocessor \"$CPP\" fails sanity check +See \`config.log' for more details" "$LINENO" 5; } +fi + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +# On IRIX 5.3, sys/types and inttypes.h are conflicting. +for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \ + inttypes.h stdint.h unistd.h +do : + as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh` +ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default +" +if eval test \"x\$"$as_ac_Header"\" = x"yes"; then : + cat >>confdefs.h <<_ACEOF +#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1 +_ACEOF + +fi + +done + + +for ac_header in dlfcn.h +do : + ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default +" +if test "x$ac_cv_header_dlfcn_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_DLFCN_H 1 +_ACEOF + +fi + +done + + + + + +# Set options + + + + enable_dlopen=no + + + enable_win32_dll=no + + + # Check whether --enable-shared was given. +if test "${enable_shared+set}" = set; then : + enableval=$enable_shared; p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_shared=yes +fi + + + + + + + + + + # Check whether --enable-static was given. +if test "${enable_static+set}" = set; then : + enableval=$enable_static; p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_static=yes +fi + + + + + + + + + + +# Check whether --with-pic was given. +if test "${with_pic+set}" = set; then : + withval=$with_pic; pic_mode="$withval" +else + pic_mode=default +fi + + +test -z "$pic_mode" && pic_mode=default + + + + + + + + # Check whether --enable-fast-install was given. +if test "${enable_fast_install+set}" = set; then : + enableval=$enable_fast_install; p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac +else + enable_fast_install=yes +fi + + + + + + + + + + + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' + + + + + + + + + + + + + + + + + + + + + + + + + + +test -z "$LN_S" && LN_S="ln -s" + + + + + + + + + + + + + + +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5 +$as_echo_n "checking for objdir... " >&6; } +if ${lt_cv_objdir+:} false; then : + $as_echo_n "(cached) " >&6 +else + rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5 +$as_echo "$lt_cv_objdir" >&6; } +objdir=$lt_cv_objdir + + + + + +cat >>confdefs.h <<_ACEOF +#define LT_OBJDIR "$lt_cv_objdir/" +_ACEOF + + + + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +for cc_temp in $compiler""; do + case $cc_temp in + compile | *[\\/]compile | ccache | *[\\/]ccache ) ;; + distcc | *[\\/]distcc | purify | *[\\/]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` + + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5 +$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/${ac_tool_prefix}file; then + lt_cv_path_MAGIC_CMD="$ac_dir/${ac_tool_prefix}file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + + + +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5 +$as_echo_n "checking for file... " >&6; } +if ${lt_cv_path_MAGIC_CMD+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $MAGIC_CMD in +[\\/*] | ?:[\\/]*) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + ac_dummy="/usr/bin$PATH_SEPARATOR$PATH" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/file; then + lt_cv_path_MAGIC_CMD="$ac_dir/file" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac +fi + +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5 +$as_echo "$MAGIC_CMD" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + else + MAGIC_CMD=: + fi +fi + + fi + ;; +esac + +# Use C for the default configuration in the libtool script + +lt_save_CC="$CC" +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +objext=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + + + + + + + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC + +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* + +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* + + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + +lt_prog_compiler_no_builtin_flag= + +if test "$GCC" = yes; then + case $cc_basename in + nvcc*) + lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;; + *) + lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;; + esac + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5 +$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; } +if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_rtti_exceptions=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="-fno-rtti -fno-exceptions" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_rtti_exceptions=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5 +$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; } + +if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then + lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions" +else + : +fi + +fi + + + + + + + lt_prog_compiler_wl= +lt_prog_compiler_pic= +lt_prog_compiler_static= + + + if test "$GCC" = yes; then + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_static='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + lt_prog_compiler_pic='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + lt_prog_compiler_pic='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + lt_prog_compiler_pic='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + lt_prog_compiler_static= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + ;; + + interix[3-9]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + lt_prog_compiler_can_build_shared=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + lt_prog_compiler_pic=-Kconform_pic + fi + ;; + + *) + lt_prog_compiler_pic='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + lt_prog_compiler_wl='-Xlinker ' + lt_prog_compiler_pic='-Xcompiler -fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + lt_prog_compiler_wl='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + lt_prog_compiler_static='-Bstatic' + else + lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + lt_prog_compiler_pic='-DDLL_EXPORT' + ;; + + hpux9* | hpux10* | hpux11*) + lt_prog_compiler_wl='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + lt_prog_compiler_pic='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + lt_prog_compiler_static='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + lt_prog_compiler_wl='-Wl,' + # PIC (with -KPIC) is the default. + lt_prog_compiler_static='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fPIC' + lt_prog_compiler_static='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='--shared' + lt_prog_compiler_static='--static' + ;; + nagfor*) + # NAG Fortran compiler + lt_prog_compiler_wl='-Wl,-Wl,,' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-fpic' + lt_prog_compiler_static='-Bstatic' + ;; + ccc*) + lt_prog_compiler_wl='-Wl,' + # All Alpha code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-qpic' + lt_prog_compiler_static='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ F* | *Sun*Fortran*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='' + ;; + *Sun\ C*) + # Sun C 5.9 + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + lt_prog_compiler_wl='-Wl,' + ;; + esac + ;; + esac + ;; + + newsos6) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + lt_prog_compiler_pic='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + lt_prog_compiler_wl='-Wl,' + # All OSF/1 code is PIC. + lt_prog_compiler_static='-non_shared' + ;; + + rdos*) + lt_prog_compiler_static='-non_shared' + ;; + + solaris*) + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + lt_prog_compiler_wl='-Qoption ld ';; + *) + lt_prog_compiler_wl='-Wl,';; + esac + ;; + + sunos4*) + lt_prog_compiler_wl='-Qoption ld ' + lt_prog_compiler_pic='-PIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + lt_prog_compiler_pic='-Kconform_pic' + lt_prog_compiler_static='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_pic='-KPIC' + lt_prog_compiler_static='-Bstatic' + ;; + + unicos*) + lt_prog_compiler_wl='-Wl,' + lt_prog_compiler_can_build_shared=no + ;; + + uts4*) + lt_prog_compiler_pic='-pic' + lt_prog_compiler_static='-Bstatic' + ;; + + *) + lt_prog_compiler_can_build_shared=no + ;; + esac + fi + +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + lt_prog_compiler_pic= + ;; + *) + lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC" + ;; +esac + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $compiler option to produce PIC" >&5 +$as_echo_n "checking for $compiler option to produce PIC... " >&6; } +if ${lt_cv_prog_compiler_pic+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic=$lt_prog_compiler_pic +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5 +$as_echo "$lt_cv_prog_compiler_pic" >&6; } +lt_prog_compiler_pic=$lt_cv_prog_compiler_pic + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$lt_prog_compiler_pic"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5 +$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; } +if ${lt_cv_prog_compiler_pic_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_pic_works=no + ac_outfile=conftest.$ac_objext + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$lt_prog_compiler_pic -DPIC" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_pic_works=yes + fi + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5 +$as_echo "$lt_cv_prog_compiler_pic_works" >&6; } + +if test x"$lt_cv_prog_compiler_pic_works" = xyes; then + case $lt_prog_compiler_pic in + "" | " "*) ;; + *) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;; + esac +else + lt_prog_compiler_pic= + lt_prog_compiler_can_build_shared=no +fi + +fi + + + + + + + + + + + +# +# Check to make sure the static flag actually works. +# +wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\" +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler static flag $lt_tmp_static_flag works" >&5 +$as_echo_n "checking if $compiler static flag $lt_tmp_static_flag works... " >&6; } +if ${lt_cv_prog_compiler_static_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_static_works=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $lt_tmp_static_flag" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler_static_works=yes + fi + else + lt_cv_prog_compiler_static_works=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5 +$as_echo "$lt_cv_prog_compiler_static_works" >&6; } + +if test x"$lt_cv_prog_compiler_static_works" = xyes; then + : +else + lt_prog_compiler_static= +fi + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -c -o file.$ac_objext" >&5 +$as_echo_n "checking if $compiler supports -c -o file.$ac_objext... " >&6; } +if ${lt_cv_prog_compiler_c_o+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler_c_o=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [^ ]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&5) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&5 + echo "$as_me:$LINENO: \$? = $ac_status" >&5 + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + lt_cv_prog_compiler_c_o=yes + fi + fi + chmod u+w . 2>&5 + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5 +$as_echo "$lt_cv_prog_compiler_c_o" >&6; } + + + + +hard_links="nottested" +if test "$lt_cv_prog_compiler_c_o" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if we can lock with hard links" >&5 +$as_echo_n "checking if we can lock with hard links... " >&6; } + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $hard_links" >&5 +$as_echo "$hard_links" >&6; } + if test "$hard_links" = no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5 +$as_echo "$as_me: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&2;} + need_locks=warn + fi +else + need_locks=no +fi + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $compiler linker ($LD) supports shared libraries" >&5 +$as_echo_n "checking whether the $compiler linker ($LD) supports shared libraries... " >&6; } + + runpath_var= + allow_undefined_flag= + always_export_symbols=no + archive_cmds= + archive_expsym_cmds= + compiler_needs_object=no + enable_shared_with_static_runtimes=no + export_dynamic_flag_spec= + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + hardcode_automatic=no + hardcode_direct=no + hardcode_direct_absolute=no + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld= + hardcode_libdir_separator= + hardcode_minus_L=no + hardcode_shlibpath_var=unsupported + inherit_rpath=no + link_all_deplibs=unknown + module_cmds= + module_expsym_cmds= + old_archive_from_new_cmds= + old_archive_from_expsyms_cmds= + thread_safe_flag_spec= + whole_archive_flag_spec= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + include_expsyms= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + exclude_expsyms='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*' + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + ld_shlibs=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[2-9]*) ;; + *\ \(GNU\ Binutils\)\ [3-9]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + export_dynamic_flag_spec='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + whole_archive_flag_spec= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [01].* | *\ 2.[0-9].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[3-9]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + allow_undefined_flag=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + archive_cmds='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + ld_shlibs=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless, + # as there is no search path for DLLs. + hardcode_libdir_flag_spec='-L$libdir' + export_dynamic_flag_spec='${wl}--export-all-symbols' + allow_undefined_flag=unsupported + always_export_symbols=no + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.* //'\'' | sort | uniq > $export_symbols' + exclude_expsyms='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname' + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + ld_shlibs=no + fi + ;; + + haiku*) + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + link_all_deplibs=yes + ;; + + interix[3-9]*) + hardcode_direct=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + archive_expsym_cmds='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + whole_archive_flag_spec= + tmp_sharedflag='--shared' ;; + xl[cC]* | bgxl[cC]* | mpixl[cC]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + compiler_needs_object=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + archive_cmds='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + whole_archive_flag_spec='--whole-archive$convenience --no-whole-archive' + hardcode_libdir_flag_spec= + hardcode_libdir_flag_spec_ld='-rpath $libdir' + archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + archive_expsym_cmds='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + ld_shlibs=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*) + ld_shlibs=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + ;; + + sunos4*) + archive_cmds='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + ld_shlibs=no + fi + ;; + esac + + if test "$ld_shlibs" = no; then + runpath_var= + hardcode_libdir_flag_spec= + export_dynamic_flag_spec= + whole_archive_flag_spec= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + allow_undefined_flag=unsupported + always_export_symbols=yes + archive_expsym_cmds='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + hardcode_minus_L=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + hardcode_direct=unsupported + fi + ;; + + aix[4-9]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + archive_cmds='' + hardcode_direct=yes + hardcode_direct_absolute=yes + hardcode_libdir_separator=':' + link_all_deplibs=yes + file_list_spec='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[012]|aix4.[012].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + hardcode_direct=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + hardcode_minus_L=yes + hardcode_libdir_flag_spec='-L$libdir' + hardcode_libdir_separator= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + export_dynamic_flag_spec='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + always_export_symbols=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + allow_undefined_flag='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + archive_expsym_cmds='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib' + allow_undefined_flag="-z nodefs" + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + if ${lt_cv_aix_libpath_+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + + lt_aix_libpath_sed=' + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }' + lt_cv_aix_libpath_=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + if test -z "$lt_cv_aix_libpath_"; then + lt_cv_aix_libpath_="/usr/lib:/lib" + fi + +fi + + aix_libpath=$lt_cv_aix_libpath_ +fi + + hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + no_undefined_flag=' ${wl}-bernotok' + allow_undefined_flag=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + whole_archive_flag_spec='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + whole_archive_flag_spec='$convenience' + fi + archive_cmds_need_lc=yes + # This is similar to how AIX traditionally builds its shared libraries. + archive_expsym_cmds="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + archive_expsym_cmds='' + ;; + m68k) + archive_cmds='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + ;; + esac + ;; + + bsdi[45]*) + export_dynamic_flag_spec=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + always_export_symbols=yes + file_list_spec='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + archive_expsym_cmds='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, )='true' + enable_shared_with_static_runtimes=yes + export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1,DATA/'\'' | $SED -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + old_postinstall_cmds='chmod 644 $oldlib' + postlink_cmds='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + hardcode_libdir_flag_spec=' ' + allow_undefined_flag=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + old_archive_from_new_cmds='true' + # FIXME: Should let the user specify the lib program. + old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' + enable_shared_with_static_runtimes=yes + ;; + esac + ;; + + darwin* | rhapsody*) + + + archive_cmds_need_lc=no + hardcode_direct=no + hardcode_automatic=yes + hardcode_shlibpath_var=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + else + whole_archive_flag_spec='' + fi + link_all_deplibs=yes + allow_undefined_flag="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + archive_cmds="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + archive_expsym_cmds="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + module_expsym_cmds="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + + else + ld_shlibs=no + fi + + ;; + + dgux*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + freebsd1*) + ld_shlibs=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + hpux9*) + if test "$GCC" = yes; then + archive_cmds='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + archive_cmds='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + export_dynamic_flag_spec='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_flag_spec_ld='+b $libdir' + hardcode_libdir_separator=: + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5 +$as_echo_n "checking if $CC understands -b... " >&6; } +if ${lt_cv_prog_compiler__b+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_prog_compiler__b=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -b" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&5 + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + lt_cv_prog_compiler__b=yes + fi + else + lt_cv_prog_compiler__b=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5 +$as_echo "$lt_cv_prog_compiler__b" >&6; } + +if test x"$lt_cv_prog_compiler__b" = xyes; then + archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' +else + archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' +fi + + ;; + esac + fi + if test "$with_gnu_ld" = no; then + hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir' + hardcode_libdir_separator=: + + case $host_cpu in + hppa*64*|ia64*) + hardcode_direct=no + hardcode_shlibpath_var=no + ;; + *) + hardcode_direct=yes + hardcode_direct_absolute=yes + export_dynamic_flag_spec='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + hardcode_minus_L=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the $host_os linker accepts -exported_symbol" >&5 +$as_echo_n "checking whether the $host_os linker accepts -exported_symbol... " >&6; } +if ${lt_cv_irix_exported_symbol+:} false; then : + $as_echo_n "(cached) " >&6 +else + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int foo (void) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + lt_cv_irix_exported_symbol=yes +else + lt_cv_irix_exported_symbol=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS="$save_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_irix_exported_symbol" >&5 +$as_echo "$lt_cv_irix_exported_symbol" >&6; } + if test "$lt_cv_irix_exported_symbol" = yes; then + archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi + else + archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + inherit_rpath=yes + link_all_deplibs=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_direct=yes + hardcode_shlibpath_var=no + ;; + + newsos6) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + hardcode_shlibpath_var=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + hardcode_direct=yes + hardcode_shlibpath_var=no + hardcode_direct_absolute=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + export_dynamic_flag_spec='${wl}-E' + else + case $host_os in + openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*) + archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-R$libdir' + ;; + *) + archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + hardcode_libdir_flag_spec='${wl}-rpath,$libdir' + ;; + esac + fi + else + ld_shlibs=no + fi + ;; + + os2*) + hardcode_libdir_flag_spec='-L$libdir' + hardcode_minus_L=yes + allow_undefined_flag=unsupported + archive_cmds='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + old_archive_from_new_cmds='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + fi + archive_cmds_need_lc='no' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + hardcode_libdir_separator=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*' + archive_cmds='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir' + else + allow_undefined_flag=' -expect_unresolved \*' + archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + hardcode_libdir_flag_spec='-rpath $libdir' + fi + archive_cmds_need_lc='no' + hardcode_libdir_separator=: + ;; + + solaris*) + no_undefined_flag=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + archive_cmds='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + hardcode_libdir_flag_spec='-R$libdir' + hardcode_shlibpath_var=no + case $host_os in + solaris2.[0-5] | solaris2.[0-5].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + whole_archive_flag_spec='-z allextract$convenience -z defaultextract' + fi + ;; + esac + link_all_deplibs=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + archive_cmds='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + hardcode_libdir_flag_spec='-L$libdir' + hardcode_direct=yes + hardcode_minus_L=yes + hardcode_shlibpath_var=no + ;; + + sysv4) + case $host_vendor in + sni) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + archive_cmds='$LD -G -o $lib $libobjs $deplibs $linker_flags' + reload_cmds='$CC -r -o $output$reload_objs' + hardcode_direct=no + ;; + motorola) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_direct=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + hardcode_shlibpath_var=no + ;; + + sysv4.3*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + export_dynamic_flag_spec='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_shlibpath_var=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + ld_shlibs=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*) + no_undefined_flag='${wl}-z,text' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + no_undefined_flag='${wl}-z,text' + allow_undefined_flag='${wl}-z,nodefs' + archive_cmds_need_lc=no + hardcode_shlibpath_var=no + hardcode_libdir_flag_spec='${wl}-R,$libdir' + hardcode_libdir_separator=':' + link_all_deplibs=yes + export_dynamic_flag_spec='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + archive_cmds='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + hardcode_libdir_flag_spec='-L$libdir' + hardcode_shlibpath_var=no + ;; + + *) + ld_shlibs=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + export_dynamic_flag_spec='${wl}-Blargedynsym' + ;; + esac + fi + fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5 +$as_echo "$ld_shlibs" >&6; } +test "$ld_shlibs" = no && can_build_shared=no + +with_gnu_ld=$with_gnu_ld + + + + + + + + + + + + + + + +# +# Do we need to explicitly link libc? +# +case "x$archive_cmds_need_lc" in +x|xyes) + # Assume -lc should be added + archive_cmds_need_lc=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $archive_cmds in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether -lc should be explicitly linked in" >&5 +$as_echo_n "checking whether -lc should be explicitly linked in... " >&6; } +if ${lt_cv_archive_cmds_need_lc+:} false; then : + $as_echo_n "(cached) " >&6 +else + $RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$lt_prog_compiler_wl + pic_flag=$lt_prog_compiler_pic + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$allow_undefined_flag + allow_undefined_flag= + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5 + (eval $archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + then + lt_cv_archive_cmds_need_lc=no + else + lt_cv_archive_cmds_need_lc=yes + fi + allow_undefined_flag=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc" >&5 +$as_echo "$lt_cv_archive_cmds_need_lc" >&6; } + archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc + ;; + esac + fi + ;; +esac + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5 +$as_echo_n "checking dynamic linker characteristics... " >&6; } + +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[lt_foo]++; } + if (lt_freq[lt_foo] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([A-Za-z]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[4-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[01] | aix4.[01].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([^/]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[45]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api" + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([a-zA-Z]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | $GREP ';[c-zC-Z]:/' >/dev/null; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' + + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib" + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[123]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[01]* | freebsdelf3.[01]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[2-9]* | freebsdelf3.[2-9]* | \ + freebsd4.[0-5] | freebsdelf4.[0-5] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[3-9]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + if ${lt_cv_shlibpath_overrides_runpath+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$lt_prog_compiler_wl\"; \ + LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\"" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + if ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null; then : + lt_cv_shlibpath_overrides_runpath=yes +fi +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + +fi + + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \$2)); skip = 1; } { if (!skip) print \$0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[89] | openbsd2.[89].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5 +$as_echo "$dynamic_linker" >&6; } +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to hardcode library paths into programs" >&5 +$as_echo_n "checking how to hardcode library paths into programs... " >&6; } +hardcode_action= +if test -n "$hardcode_libdir_flag_spec" || + test -n "$runpath_var" || + test "X$hardcode_automatic" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$hardcode_direct" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, )" != no && + test "$hardcode_minus_L" != no; then + # Linking always hardcodes the temporary library directory. + hardcode_action=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + hardcode_action=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + hardcode_action=unsupported +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5 +$as_echo "$hardcode_action" >&6; } + +if test "$hardcode_action" = relink || + test "$inherit_rpath" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi + + + + + + + if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + +fi + + ;; + + *) + ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load" +if test "x$ac_cv_func_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5 +$as_echo_n "checking for shl_load in -ldld... " >&6; } +if ${ac_cv_lib_dld_shl_load+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char shl_load (); +int +main () +{ +return shl_load (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_shl_load=yes +else + ac_cv_lib_dld_shl_load=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5 +$as_echo "$ac_cv_lib_dld_shl_load" >&6; } +if test "x$ac_cv_lib_dld_shl_load" = xyes; then : + lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld" +else + ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen" +if test "x$ac_cv_func_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5 +$as_echo_n "checking for dlopen in -ldl... " >&6; } +if ${ac_cv_lib_dl_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldl $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dl_dlopen=yes +else + ac_cv_lib_dl_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5 +$as_echo "$ac_cv_lib_dl_dlopen" >&6; } +if test "x$ac_cv_lib_dl_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5 +$as_echo_n "checking for dlopen in -lsvld... " >&6; } +if ${ac_cv_lib_svld_dlopen+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-lsvld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dlopen (); +int +main () +{ +return dlopen (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_svld_dlopen=yes +else + ac_cv_lib_svld_dlopen=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5 +$as_echo "$ac_cv_lib_svld_dlopen" >&6; } +if test "x$ac_cv_lib_svld_dlopen" = xyes; then : + lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld" +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5 +$as_echo_n "checking for dld_link in -ldld... " >&6; } +if ${ac_cv_lib_dld_dld_link+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_check_lib_save_LIBS=$LIBS +LIBS="-ldld $LIBS" +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +/* Override any GCC internal prototype to avoid an error. + Use char because int might match the return type of a GCC + builtin and then its argument prototype would still apply. */ +#ifdef __cplusplus +extern "C" +#endif +char dld_link (); +int +main () +{ +return dld_link (); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_lib_dld_dld_link=yes +else + ac_cv_lib_dld_dld_link=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +LIBS=$ac_check_lib_save_LIBS +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5 +$as_echo "$ac_cv_lib_dld_dld_link" >&6; } +if test "x$ac_cv_lib_dld_dld_link" = xyes; then : + lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld" +fi + + +fi + + +fi + + +fi + + +fi + + +fi + + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5 +$as_echo_n "checking whether a program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5 +$as_echo "$lt_cv_dlopen_self" >&6; } + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5 +$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; } +if ${lt_cv_dlopen_self_static+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + lt_cv_dlopen_self_static=cross +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5 + (eval $ac_link) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&5 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlneed_uscore) lt_cv_dlopen_self_static=yes ;; + x$lt_dlunknown|x*) lt_cv_dlopen_self_static=no ;; + esac + else : + # compilation failed + lt_cv_dlopen_self_static=no + fi +fi +rm -fr conftest* + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5 +$as_echo "$lt_cv_dlopen_self_static" >&6; } + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi + + + + + + + + + + + + + + + + + +striplib= +old_striplib= +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5 +$as_echo_n "checking whether stripping libraries is possible... " >&6; } +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5 +$as_echo "yes" >&6; } + else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + fi + ;; + *) + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } + ;; + esac +fi + + + + + + + + + + + + + # Report which library types will actually be built + { $as_echo "$as_me:${as_lineno-$LINENO}: checking if libtool supports shared libraries" >&5 +$as_echo_n "checking if libtool supports shared libraries... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $can_build_shared" >&5 +$as_echo "$can_build_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build shared libraries" >&5 +$as_echo_n "checking whether to build shared libraries... " >&6; } + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[4-9]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_shared" >&5 +$as_echo "$enable_shared" >&6; } + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to build static libraries" >&5 +$as_echo_n "checking whether to build static libraries... " >&6; } + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $enable_static" >&5 +$as_echo "$enable_static" >&6; } + + + + +fi +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +CC="$lt_save_CC" + + + + + + + + + + + + + + ac_config_commands="$ac_config_commands libtool" + + + + +# Only expand once: + + + + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler vendor" >&5 +$as_echo_n "checking for C compiler vendor... " >&6; } +if ${ax_cv_c_compiler_vendor+:} false; then : + $as_echo_n "(cached) " >&6 +else + ax_cv_c_compiler_vendor=unknown + # note: don't check for gcc first since some other compilers define __GNUC__ + for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ pathscale:__PATHCC__,__PATHSCALE__ clang:__clang__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do + vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + +#if !($vencpp) + thisisanerror; +#endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ax_cv_c_compiler_vendor=`echo $ventest | cut -d: -f1`; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + done + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_c_compiler_vendor" >&5 +$as_echo "$ax_cv_c_compiler_vendor" >&6; } + + + + + + +# Check whether --enable-portable-binary was given. +if test "${enable_portable_binary+set}" = set; then : + enableval=$enable_portable_binary; acx_maxopt_portable=$withval +else + acx_maxopt_portable=no +fi + + +# Try to determine "good" native compiler flags if none specified via CFLAGS +if test "$ac_test_CFLAGS" != "set"; then + CFLAGS="" + case $ax_cv_c_compiler_vendor in + dec) CFLAGS="-newc -w0 -O5 -ansi_alias -ansi_args -fp_reorder -tune host" + if test "x$acx_maxopt_portable" = xno; then + CFLAGS="$CFLAGS -arch host" + fi;; + + sun) CFLAGS="-native -fast -xO5 -dalign" + if test "x$acx_maxopt_portable" = xyes; then + CFLAGS="$CFLAGS -xarch=generic" + fi;; + + hp) CFLAGS="+Oall +Optrs_ansi +DSnative" + if test "x$acx_maxopt_portable" = xyes; then + CFLAGS="$CFLAGS +DAportable" + fi;; + + ibm) if test "x$acx_maxopt_portable" = xno; then + xlc_opt="-qarch=auto -qtune=auto" + else + xlc_opt="-qtune=auto" + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $xlc_opt" >&5 +$as_echo_n "checking whether C compiler accepts $xlc_opt... " >&6; } +ax_save_FLAGS=$CFLAGS + CFLAGS="$xlc_opt" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval `$as_echo "ax_cv_c_flags_$xlc_opt" | $as_tr_sh`=yes +else + eval `$as_echo "ax_cv_c_flags_$xlc_opt" | $as_tr_sh`=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_save_FLAGS +eval ax_check_compiler_flags=$`$as_echo "ax_cv_c_flags_$xlc_opt" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_check_compiler_flags" >&5 +$as_echo "$ax_check_compiler_flags" >&6; } +if test "x$ax_check_compiler_flags" = xyes; then + CFLAGS="-O3 -qansialias -w $xlc_opt" +else + CFLAGS="-O3 -qansialias -w" + echo "******************************************************" + echo "* You seem to have the IBM C compiler. It is *" + echo "* recommended for best performance that you use: *" + echo "* *" + echo "* CFLAGS=-O3 -qarch=xxx -qtune=xxx -qansialias -w *" + echo "* ^^^ ^^^ *" + echo "* where xxx is pwr2, pwr3, 604, or whatever kind of *" + echo "* CPU you have. (Set the CFLAGS environment var. *" + echo "* and re-run configure.) For more info, man cc. *" + echo "******************************************************" +fi + + ;; + + intel) CFLAGS="-O3 -ansi_alias" + if test "x$acx_maxopt_portable" = xno; then + icc_archflag=unknown + icc_flags="" + case $host_cpu in + i686*|x86_64*) + # icc accepts gcc assembly syntax, so these should work: + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86 cpuid 0 output" >&5 +$as_echo_n "checking for x86 cpuid 0 output... " >&6; } +if ${ax_cv_gcc_x86_cpuid_0+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ax_cv_gcc_x86_cpuid_0=unknown +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + int op = 0, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ax_cv_gcc_x86_cpuid_0=`cat conftest_cpuid`; rm -f conftest_cpuid +else + ax_cv_gcc_x86_cpuid_0=unknown; rm -f conftest_cpuid +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_gcc_x86_cpuid_0" >&5 +$as_echo "$ax_cv_gcc_x86_cpuid_0" >&6; } +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86 cpuid 1 output" >&5 +$as_echo_n "checking for x86 cpuid 1 output... " >&6; } +if ${ax_cv_gcc_x86_cpuid_1+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ax_cv_gcc_x86_cpuid_1=unknown +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + int op = 1, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ax_cv_gcc_x86_cpuid_1=`cat conftest_cpuid`; rm -f conftest_cpuid +else + ax_cv_gcc_x86_cpuid_1=unknown; rm -f conftest_cpuid +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_gcc_x86_cpuid_1" >&5 +$as_echo "$ax_cv_gcc_x86_cpuid_1" >&6; } +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + case $ax_cv_gcc_x86_cpuid_0 in # see AX_GCC_ARCHFLAG + *:756e6547:*:*) # Intel + case $ax_cv_gcc_x86_cpuid_1 in + *6a?:*[234]:*:*|*6[789b]?:*:*:*) icc_flags="-xK";; + *f3[347]:*:*:*|*f41347:*:*:*) icc_flags="-xP -xN -xW -xK";; + *f??:*:*:*) icc_flags="-xN -xW -xK";; + esac ;; + esac ;; + esac + if test "x$icc_flags" != x; then + for flag in $icc_flags; do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 +$as_echo_n "checking whether C compiler accepts $flag... " >&6; } +ax_save_FLAGS=$CFLAGS + CFLAGS="$flag" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval `$as_echo "ax_cv_c_flags_$flag" | $as_tr_sh`=yes +else + eval `$as_echo "ax_cv_c_flags_$flag" | $as_tr_sh`=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_save_FLAGS +eval ax_check_compiler_flags=$`$as_echo "ax_cv_c_flags_$flag" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_check_compiler_flags" >&5 +$as_echo "$ax_check_compiler_flags" >&6; } +if test "x$ax_check_compiler_flags" = xyes; then + icc_archflag=$flag; break +else + : +fi + + done + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for icc architecture flag" >&5 +$as_echo_n "checking for icc architecture flag... " >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $icc_archflag" >&5 +$as_echo "$icc_archflag" >&6; } + if test "x$icc_archflag" != xunknown; then + CFLAGS="$CFLAGS $icc_archflag" + fi + fi + ;; + + gnu) + # default optimization flags for gcc on all systems + CFLAGS="-O3 -fomit-frame-pointer" + + # -fstrict-aliasing for gcc-2.95+ + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -fstrict-aliasing" >&5 +$as_echo_n "checking whether C compiler accepts -fstrict-aliasing... " >&6; } +if ${ax_cv_c_flags__fstrict_aliasing+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_save_FLAGS=$CFLAGS + CFLAGS="-fstrict-aliasing" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ax_cv_c_flags__fstrict_aliasing=yes +else + ax_cv_c_flags__fstrict_aliasing=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_save_FLAGS +fi + +eval ax_check_compiler_flags=$ax_cv_c_flags__fstrict_aliasing +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_check_compiler_flags" >&5 +$as_echo "$ax_check_compiler_flags" >&6; } +if test "x$ax_check_compiler_flags" = xyes; then + CFLAGS="$CFLAGS -fstrict-aliasing" +else + : +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts -ffast-math" >&5 +$as_echo_n "checking whether C compiler accepts -ffast-math... " >&6; } +if ${ax_cv_c_flags__ffast_math+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ax_save_FLAGS=$CFLAGS + CFLAGS="-ffast-math" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ax_cv_c_flags__ffast_math=yes +else + ax_cv_c_flags__ffast_math=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_save_FLAGS +fi + +eval ax_check_compiler_flags=$ax_cv_c_flags__ffast_math +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_check_compiler_flags" >&5 +$as_echo "$ax_check_compiler_flags" >&6; } +if test "x$ax_check_compiler_flags" = xyes; then + CFLAGS="$CFLAGS -ffast-math" +else + : +fi + + + + + + +# Check whether --with-gcc-arch was given. +if test "${with_gcc_arch+set}" = set; then : + withval=$with_gcc_arch; ax_gcc_arch=$withval +else + ax_gcc_arch=yes +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc architecture flag" >&5 +$as_echo_n "checking for gcc architecture flag... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: " >&5 +$as_echo "" >&6; } +if ${ax_cv_gcc_archflag+:} false; then : + $as_echo_n "(cached) " >&6 +else + +ax_cv_gcc_archflag="unknown" + +if test "$GCC" = yes; then + +if test "x$ax_gcc_arch" = xyes; then +ax_gcc_arch="" +if test "$cross_compiling" = no; then +case $host_cpu in + i[3456]86*|x86_64*) # use cpuid codes, in part from x86info-1.7 by D. Jones + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86 cpuid 0 output" >&5 +$as_echo_n "checking for x86 cpuid 0 output... " >&6; } +if ${ax_cv_gcc_x86_cpuid_0+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ax_cv_gcc_x86_cpuid_0=unknown +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + int op = 0, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ax_cv_gcc_x86_cpuid_0=`cat conftest_cpuid`; rm -f conftest_cpuid +else + ax_cv_gcc_x86_cpuid_0=unknown; rm -f conftest_cpuid +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_gcc_x86_cpuid_0" >&5 +$as_echo "$ax_cv_gcc_x86_cpuid_0" >&6; } +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86 cpuid 1 output" >&5 +$as_echo_n "checking for x86 cpuid 1 output... " >&6; } +if ${ax_cv_gcc_x86_cpuid_1+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ax_cv_gcc_x86_cpuid_1=unknown +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + int op = 1, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ax_cv_gcc_x86_cpuid_1=`cat conftest_cpuid`; rm -f conftest_cpuid +else + ax_cv_gcc_x86_cpuid_1=unknown; rm -f conftest_cpuid +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_gcc_x86_cpuid_1" >&5 +$as_echo "$ax_cv_gcc_x86_cpuid_1" >&6; } +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + + case $ax_cv_gcc_x86_cpuid_0 in + *:756e6547:*:*) # Intel + case $ax_cv_gcc_x86_cpuid_1 in + *5[48]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;; + *5??:*:*:*) ax_gcc_arch=pentium ;; + *6[3456]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *6a?:*[01]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *6a?:*[234]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *6[9d]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;; + *6[78b]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *6??:*:*:*) ax_gcc_arch=pentiumpro ;; + *f3[347]:*:*:*|*f41347:*:*:*) + case $host_cpu in + x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;; + *) ax_gcc_arch="prescott pentium4 pentiumpro" ;; + esac ;; + *f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";; + esac ;; + *:68747541:*:*) # AMD + case $ax_cv_gcc_x86_cpuid_1 in + *5[67]?:*:*:*) ax_gcc_arch=k6 ;; + *5[8d]?:*:*:*) ax_gcc_arch="k6-2 k6" ;; + *5[9]?:*:*:*) ax_gcc_arch="k6-3 k6" ;; + *60?:*:*:*) ax_gcc_arch=k7 ;; + *6[12]?:*:*:*) ax_gcc_arch="athlon k7" ;; + *6[34]?:*:*:*) ax_gcc_arch="athlon-tbird k7" ;; + *67?:*:*:*) ax_gcc_arch="athlon-4 athlon k7" ;; + *6[68a]?:*:*:*) + +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for x86 cpuid 0x80000006 output" >&5 +$as_echo_n "checking for x86 cpuid 0x80000006 output... " >&6; } +if ${ax_cv_gcc_x86_cpuid_0x80000006+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ax_cv_gcc_x86_cpuid_0x80000006=unknown +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ + + int op = 0x80000006, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ax_cv_gcc_x86_cpuid_0x80000006=`cat conftest_cpuid`; rm -f conftest_cpuid +else + ax_cv_gcc_x86_cpuid_0x80000006=unknown; rm -f conftest_cpuid +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_gcc_x86_cpuid_0x80000006" >&5 +$as_echo "$ax_cv_gcc_x86_cpuid_0x80000006" >&6; } +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + # L2 cache size + case $ax_cv_gcc_x86_cpuid_0x80000006 in + *:*:*[1-9a-f]??????:*) # (L2 = ecx >> 16) >= 256 + ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;; + *) ax_gcc_arch="athlon-4 athlon k7" ;; + esac ;; + *f[4cef8b]?:*:*:*) ax_gcc_arch="athlon64 k8" ;; + *f5?:*:*:*) ax_gcc_arch="opteron k8" ;; + *f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;; + *f??:*:*:*) ax_gcc_arch="k8" ;; + esac ;; + *:746e6543:*:*) # IDT + case $ax_cv_gcc_x86_cpuid_1 in + *54?:*:*:*) ax_gcc_arch=winchip-c6 ;; + *58?:*:*:*) ax_gcc_arch=winchip2 ;; + *6[78]?:*:*:*) ax_gcc_arch=c3 ;; + *69?:*:*:*) ax_gcc_arch="c3-2 c3" ;; + esac ;; + esac + if test x"$ax_gcc_arch" = x; then # fallback + case $host_cpu in + i586*) ax_gcc_arch=pentium ;; + i686*) ax_gcc_arch=pentiumpro ;; + esac + fi + ;; + + sparc*) + # Extract the first word of "prtdiag", so it can be a program name with args. +set dummy prtdiag; ac_word=$2 +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5 +$as_echo_n "checking for $ac_word... " >&6; } +if ${ac_cv_path_PRTDIAG+:} false; then : + $as_echo_n "(cached) " >&6 +else + case $PRTDIAG in + [\\/]* | ?:[\\/]*) + ac_cv_path_PRTDIAG="$PRTDIAG" # Let the user override the test with a path. + ;; + *) + as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +as_dummy="$PATH:/usr/platform/`uname -i`/sbin/:/usr/platform/`uname -m`/sbin/" +for as_dir in $as_dummy +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for ac_exec_ext in '' $ac_executable_extensions; do + if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then + ac_cv_path_PRTDIAG="$as_dir/$ac_word$ac_exec_ext" + $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5 + break 2 + fi +done + done +IFS=$as_save_IFS + + test -z "$ac_cv_path_PRTDIAG" && ac_cv_path_PRTDIAG="prtdiag" + ;; +esac +fi +PRTDIAG=$ac_cv_path_PRTDIAG +if test -n "$PRTDIAG"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $PRTDIAG" >&5 +$as_echo "$PRTDIAG" >&6; } +else + { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5 +$as_echo "no" >&6; } +fi + + + cputype=`(((grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null` + cputype=`echo "$cputype" | tr -d ' -' |tr $as_cr_LETTERS $as_cr_letters` + case $cputype in + *ultrasparciv*) ax_gcc_arch="ultrasparc4 ultrasparc3 ultrasparc v9" ;; + *ultrasparciii*) ax_gcc_arch="ultrasparc3 ultrasparc v9" ;; + *ultrasparc*) ax_gcc_arch="ultrasparc v9" ;; + *supersparc*|*tms390z5[05]*) ax_gcc_arch="supersparc v8" ;; + *hypersparc*|*rt62[056]*) ax_gcc_arch="hypersparc v8" ;; + *cypress*) ax_gcc_arch=cypress ;; + esac ;; + + alphaev5) ax_gcc_arch=ev5 ;; + alphaev56) ax_gcc_arch=ev56 ;; + alphapca56) ax_gcc_arch="pca56 ev56" ;; + alphapca57) ax_gcc_arch="pca57 pca56 ev56" ;; + alphaev6) ax_gcc_arch=ev6 ;; + alphaev67) ax_gcc_arch=ev67 ;; + alphaev68) ax_gcc_arch="ev68 ev67" ;; + alphaev69) ax_gcc_arch="ev69 ev68 ev67" ;; + alphaev7) ax_gcc_arch="ev7 ev69 ev68 ev67" ;; + alphaev79) ax_gcc_arch="ev79 ev7 ev69 ev68 ev67" ;; + + powerpc*) + cputype=`((grep cpu /proc/cpuinfo | head -n 1 | cut -d: -f2 | cut -d, -f1 | sed 's/ //g') ; /usr/bin/machine ; /bin/machine; grep CPU /var/run/dmesg.boot | head -n 1 | cut -d" " -f2) 2> /dev/null` + cputype=`echo $cputype | sed -e 's/ppc//g;s/ *//g'` + case $cputype in + *750*) ax_gcc_arch="750 G3" ;; + *740[0-9]*) ax_gcc_arch="$cputype 7400 G4" ;; + *74[4-5][0-9]*) ax_gcc_arch="$cputype 7450 G4" ;; + *74[0-9][0-9]*) ax_gcc_arch="$cputype G4" ;; + *970*) ax_gcc_arch="970 G5 power4";; + *POWER4*|*power4*|*gq*) ax_gcc_arch="power4 970";; + *POWER5*|*power5*|*gr*|*gs*) ax_gcc_arch="power5 power4 970";; + 603ev|8240) ax_gcc_arch="$cputype 603e 603";; + *) ax_gcc_arch=$cputype ;; + esac + ax_gcc_arch="$ax_gcc_arch powerpc" + ;; +esac +fi # not cross-compiling +fi # guess arch + +if test "x$ax_gcc_arch" != x -a "x$ax_gcc_arch" != xno; then +for arch in $ax_gcc_arch; do + if test "x$acx_maxopt_portable" = xyes; then # if we require portable code + flags="-mtune=$arch" + # -mcpu=$arch and m$arch generate nonportable code on every arch except + # x86. And some other arches (e.g. Alpha) don't accept -mtune. Grrr. + case $host_cpu in i*86|x86_64*) flags="$flags -mcpu=$arch -m$arch";; esac + else + flags="-march=$arch -mcpu=$arch -m$arch" + fi + for flag in $flags; do + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $flag" >&5 +$as_echo_n "checking whether C compiler accepts $flag... " >&6; } +ax_save_FLAGS=$CFLAGS + CFLAGS="$flag" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval `$as_echo "ax_cv_c_flags_$flag" | $as_tr_sh`=yes +else + eval `$as_echo "ax_cv_c_flags_$flag" | $as_tr_sh`=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_save_FLAGS +eval ax_check_compiler_flags=$`$as_echo "ax_cv_c_flags_$flag" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_check_compiler_flags" >&5 +$as_echo "$ax_check_compiler_flags" >&6; } +if test "x$ax_check_compiler_flags" = xyes; then + ax_cv_gcc_archflag=$flag; break +else + : +fi + + done + test "x$ax_cv_gcc_archflag" = xunknown || break +done +fi + +fi # $GCC=yes + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for gcc architecture flag" >&5 +$as_echo_n "checking for gcc architecture flag... " >&6; } +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_cv_gcc_archflag" >&5 +$as_echo "$ax_cv_gcc_archflag" >&6; } +if test "x$ax_cv_gcc_archflag" = xunknown; then + : +else + CFLAGS="$CFLAGS $ax_cv_gcc_archflag" +fi + + ;; + esac + + if test -z "$CFLAGS"; then + echo "" + echo "********************************************************" + echo "* WARNING: Don't know the best CFLAGS for this system *" + echo "* Use ./configure CFLAGS=... to specify your own flags *" + echo "* (otherwise, a default of CFLAGS=-O3 will be used) *" + echo "********************************************************" + echo "" + CFLAGS="-O3" + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether C compiler accepts $CFLAGS" >&5 +$as_echo_n "checking whether C compiler accepts $CFLAGS... " >&6; } +ax_save_FLAGS=$CFLAGS + CFLAGS="$CFLAGS" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + eval `$as_echo "ax_cv_c_flags_$CFLAGS" | $as_tr_sh`=yes +else + eval `$as_echo "ax_cv_c_flags_$CFLAGS" | $as_tr_sh`=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + CFLAGS=$ax_save_FLAGS +eval ax_check_compiler_flags=$`$as_echo "ax_cv_c_flags_$CFLAGS" | $as_tr_sh` +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ax_check_compiler_flags" >&5 +$as_echo "$ax_check_compiler_flags" >&6; } +if test "x$ax_check_compiler_flags" = xyes; then + : +else + + echo "" + echo "********************************************************" + echo "* WARNING: The guessed CFLAGS don't seem to work with *" + echo "* your compiler. *" + echo "* Use ./configure CFLAGS=... to specify your own flags *" + echo "********************************************************" + echo "" + CFLAGS="" + +fi + + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking CFLAGS for maximum warnings" >&5 +$as_echo_n "checking CFLAGS for maximum warnings... " >&6; } +if ${ac_cv_cflags_warn_all+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_cflags_warn_all="no, unknown" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + ac_save_CFLAGS="$CFLAGS" +for ac_arg in "-pedantic % -Wall" "-xstrconst % -v" "-std1 % -verbose -w0 -warnprotos" "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" "-ansi -ansiE % -fullwarn" "+ESlit % +w1" "-Xc % -pvctl,fullmsg" "-h conform % -h msglevel 2" # +do CFLAGS="$ac_save_CFLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_cflags_warn_all=`echo $ac_arg | sed -e 's,.*% *,,'` ; break +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +done + CFLAGS="$ac_save_CFLAGS" + ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags_warn_all" >&5 +$as_echo "$ac_cv_cflags_warn_all" >&6; } +case ".$ac_cv_cflags_warn_all" in + .ok|.ok,*) ;; + .|.no|.no,*) + ;; + *) + if echo " $CFLAGS " | grep " $ac_cv_cflags_warn_all " 2>&1 >/dev/null + then { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS does contain \$ac_cv_cflags_warn_all"; } >&5 + (: CFLAGS does contain $ac_cv_cflags_warn_all) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + else { { $as_echo "$as_me:${as_lineno-$LINENO}: : CFLAGS=\"\$CFLAGS \$ac_cv_cflags_warn_all\""; } >&5 + (: CFLAGS="$CFLAGS $ac_cv_cflags_warn_all") 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } + CFLAGS="$CFLAGS $ac_cv_cflags_warn_all" + fi + ;; +esac + +if test "x$GCC" = "xyes"; then + CFLAGS="$CFLAGS -fexceptions" +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5 +$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; } + # Check whether --enable-maintainer-mode was given. +if test "${enable_maintainer_mode+set}" = set; then : + enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval +else + USE_MAINTAINER_MODE=no +fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5 +$as_echo "$USE_MAINTAINER_MODE" >&6; } + if test $USE_MAINTAINER_MODE = yes; then + MAINTAINER_MODE_TRUE= + MAINTAINER_MODE_FALSE='#' +else + MAINTAINER_MODE_TRUE='#' + MAINTAINER_MODE_FALSE= +fi + + MAINT=$MAINTAINER_MODE_TRUE + + + +for ac_header in sys/mman.h +do : + ac_fn_c_check_header_mongrel "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_mman_h" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_SYS_MMAN_H 1 +_ACEOF + +fi + +done + +for ac_func in mmap +do : + ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_MMAP 1 +_ACEOF + +fi +done + + +ac_fn_c_check_header_mongrel "$LINENO" "sys/mman.h" "ac_cv_header_sys_mman_h" "$ac_includes_default" +if test "x$ac_cv_header_sys_mman_h" = xyes; then : + libffi_header_sys_mman_h=yes +else + libffi_header_sys_mman_h=no +fi + + +ac_fn_c_check_func "$LINENO" "mmap" "ac_cv_func_mmap" +if test "x$ac_cv_func_mmap" = xyes; then : + libffi_func_mmap=yes +else + libffi_func_mmap=no +fi + +if test "$libffi_header_sys_mman_h" != yes \ + || test "$libffi_func_mmap" != yes; then + ac_cv_func_mmap_file=no + ac_cv_func_mmap_dev_zero=no + ac_cv_func_mmap_anon=no +else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether read-only mmap of a plain file works" >&5 +$as_echo_n "checking whether read-only mmap of a plain file works... " >&6; } +if ${ac_cv_func_mmap_file+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Add a system to this blacklist if + # mmap(0, stat_size, PROT_READ, MAP_PRIVATE, fd, 0) doesn't return a + # memory area containing the same data that you'd get if you applied + # read() to the same fd. The only system known to have a problem here + # is VMS, where text files have record structure. + case "$host_os" in + vms* | ultrix*) + ac_cv_func_mmap_file=no ;; + *) + ac_cv_func_mmap_file=yes;; + esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_file" >&5 +$as_echo "$ac_cv_func_mmap_file" >&6; } + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mmap from /dev/zero works" >&5 +$as_echo_n "checking whether mmap from /dev/zero works... " >&6; } +if ${ac_cv_func_mmap_dev_zero+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Add a system to this blacklist if it has mmap() but /dev/zero + # does not exist, or if mmapping /dev/zero does not give anonymous + # zeroed pages with both the following properties: + # 1. If you map N consecutive pages in with one call, and then + # unmap any subset of those pages, the pages that were not + # explicitly unmapped remain accessible. + # 2. If you map two adjacent blocks of memory and then unmap them + # both at once, they must both go away. + # Systems known to be in this category are Windows (all variants), + # VMS, and Darwin. + case "$host_os" in + vms* | cygwin* | pe | mingw* | darwin* | ultrix* | hpux10* | hpux11.00) + ac_cv_func_mmap_dev_zero=no ;; + *) + ac_cv_func_mmap_dev_zero=yes;; + esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_dev_zero" >&5 +$as_echo "$ac_cv_func_mmap_dev_zero" >&6; } + + # Unlike /dev/zero, the MAP_ANON(YMOUS) defines can be probed for. + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for MAP_ANON(YMOUS)" >&5 +$as_echo_n "checking for MAP_ANON(YMOUS)... " >&6; } +if ${ac_cv_decl_map_anon+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include + +#ifndef MAP_ANONYMOUS +#define MAP_ANONYMOUS MAP_ANON +#endif + +int +main () +{ +int n = MAP_ANONYMOUS; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_decl_map_anon=yes +else + ac_cv_decl_map_anon=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_decl_map_anon" >&5 +$as_echo "$ac_cv_decl_map_anon" >&6; } + + if test $ac_cv_decl_map_anon = no; then + ac_cv_func_mmap_anon=no + else + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether mmap with MAP_ANON(YMOUS) works" >&5 +$as_echo_n "checking whether mmap with MAP_ANON(YMOUS) works... " >&6; } +if ${ac_cv_func_mmap_anon+:} false; then : + $as_echo_n "(cached) " >&6 +else + # Add a system to this blacklist if it has mmap() and MAP_ANON or + # MAP_ANONYMOUS, but using mmap(..., MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) + # doesn't give anonymous zeroed pages with the same properties listed + # above for use of /dev/zero. + # Systems known to be in this category are Windows, VMS, and SCO Unix. + case "$host_os" in + vms* | cygwin* | pe | mingw* | sco* | udk* ) + ac_cv_func_mmap_anon=no ;; + *) + ac_cv_func_mmap_anon=yes;; + esac +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_mmap_anon" >&5 +$as_echo "$ac_cv_func_mmap_anon" >&6; } + fi +fi + +if test $ac_cv_func_mmap_file = yes; then + +$as_echo "#define HAVE_MMAP_FILE 1" >>confdefs.h + +fi +if test $ac_cv_func_mmap_dev_zero = yes; then + +$as_echo "#define HAVE_MMAP_DEV_ZERO 1" >>confdefs.h + +fi +if test $ac_cv_func_mmap_anon = yes; then + +$as_echo "#define HAVE_MMAP_ANON 1" >>confdefs.h + +fi + + + if test -d $srcdir/testsuite; then + TESTSUBDIR_TRUE= + TESTSUBDIR_FALSE='#' +else + TESTSUBDIR_TRUE='#' + TESTSUBDIR_FALSE= +fi + + +TARGETDIR="unknown" +case "$host" in + alpha*-*-*) + TARGET=ALPHA; TARGETDIR=alpha; + # Support 128-bit long double, changeable via command-line switch. + HAVE_LONG_DOUBLE='defined(__LONG_DOUBLE_128__)' + ;; + + arm*-*-*) + TARGET=ARM; TARGETDIR=arm + ;; + + amd64-*-freebsd* | amd64-*-openbsd*) + TARGET=X86_64; TARGETDIR=x86 + ;; + + amd64-*-freebsd*) + TARGET=X86_64; TARGETDIR=x86 + ;; + + avr32*-*-*) + TARGET=AVR32; TARGETDIR=avr32 + ;; + + cris-*-*) + TARGET=LIBFFI_CRIS; TARGETDIR=cris + ;; + + frv-*-*) + TARGET=FRV; TARGETDIR=frv + ;; + + hppa*-*-linux* | parisc*-*-linux* | hppa*-*-openbsd*) + TARGET=PA_LINUX; TARGETDIR=pa + ;; + hppa*64-*-hpux*) + TARGET=PA64_HPUX; TARGETDIR=pa + ;; + hppa*-*-hpux*) + TARGET=PA_HPUX; TARGETDIR=pa + ;; + + i?86-*-freebsd* | i?86-*-openbsd*) + TARGET=X86_FREEBSD; TARGETDIR=x86 + ;; + i?86-win32* | i?86-*-cygwin* | i?86-*-mingw* | i?86-*-os2* | i?86-*-interix*) + TARGET=X86_WIN32; TARGETDIR=x86 + # All mingw/cygwin/win32 builds require -no-undefined for sharedlib. + # We must also check with_cross_host to decide if this is a native + # or cross-build and select where to install dlls appropriately. + if test -n "$with_cross_host" && + test x"$with_cross_host" != x"no"; then + AM_LTLDFLAGS='-no-undefined -bindir "$(toolexeclibdir)"'; + else + AM_LTLDFLAGS='-no-undefined -bindir "$(bindir)"'; + fi + ;; + i?86-*-darwin*) + TARGET=X86_DARWIN; TARGETDIR=x86 + ;; + i?86-*-solaris2.1[0-9]*) + TARGET=X86_64; TARGETDIR=x86 + ;; + i?86-*-*) + TARGET=X86; TARGETDIR=x86 + ;; + + ia64*-*-*) + TARGET=IA64; TARGETDIR=ia64 + ;; + + m32r*-*-*) + TARGET=M32R; TARGETDIR=m32r + ;; + + m68k-*-*) + TARGET=M68K; TARGETDIR=m68k + ;; + + mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*) + TARGET=MIPS; TARGETDIR=mips + ;; + mips*-*-linux* | mips*-*-openbsd*) + # Support 128-bit long double for NewABI. + HAVE_LONG_DOUBLE='defined(__mips64)' + TARGET=MIPS; TARGETDIR=mips + ;; + + powerpc*-*-linux* | powerpc-*-sysv*) + TARGET=POWERPC; TARGETDIR=powerpc + ;; + powerpc-*-beos*) + TARGET=POWERPC; TARGETDIR=powerpc + ;; + powerpc-*-darwin* | powerpc64-*-darwin*) + TARGET=POWERPC_DARWIN; TARGETDIR=powerpc + ;; + powerpc-*-aix* | rs6000-*-aix*) + TARGET=POWERPC_AIX; TARGETDIR=powerpc + ;; + powerpc-*-freebsd* | powerpc-*-openbsd*) + TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc + ;; + powerpc64-*-freebsd*) + TARGET=POWERPC; TARGETDIR=powerpc + ;; + powerpc*-*-rtems*) + TARGET=POWERPC; TARGETDIR=powerpc + ;; + + s390-*-* | s390x-*-*) + TARGET=S390; TARGETDIR=s390 + ;; + + sh-*-* | sh[34]*-*-*) + TARGET=SH; TARGETDIR=sh + ;; + sh64-*-* | sh5*-*-*) + TARGET=SH64; TARGETDIR=sh64 + ;; + + sparc*-*-*) + TARGET=SPARC; TARGETDIR=sparc + ;; + + x86_64-*-darwin*) + TARGET=X86_DARWIN; TARGETDIR=x86 + ;; + + x86_64-*-cygwin* | x86_64-*-mingw*) + TARGET=X86_WIN64; TARGETDIR=x86 + ;; + + x86_64-*-*) + TARGET=X86_64; TARGETDIR=x86 + ;; +esac + + + + +if test $TARGETDIR = unknown; then + as_fn_error $? "\"libffi has not been ported to $host.\"" "$LINENO" 5 +fi + + if test x$TARGET = xMIPS; then + MIPS_TRUE= + MIPS_FALSE='#' +else + MIPS_TRUE='#' + MIPS_FALSE= +fi + + if test x$TARGET = xSPARC; then + SPARC_TRUE= + SPARC_FALSE='#' +else + SPARC_TRUE='#' + SPARC_FALSE= +fi + + if test x$TARGET = xX86; then + X86_TRUE= + X86_FALSE='#' +else + X86_TRUE='#' + X86_FALSE= +fi + + if test x$TARGET = xX86_FREEBSD; then + X86_FREEBSD_TRUE= + X86_FREEBSD_FALSE='#' +else + X86_FREEBSD_TRUE='#' + X86_FREEBSD_FALSE= +fi + + if test x$TARGET = xX86_WIN32; then + X86_WIN32_TRUE= + X86_WIN32_FALSE='#' +else + X86_WIN32_TRUE='#' + X86_WIN32_FALSE= +fi + + if test x$TARGET = xX86_WIN64; then + X86_WIN64_TRUE= + X86_WIN64_FALSE='#' +else + X86_WIN64_TRUE='#' + X86_WIN64_FALSE= +fi + + if test x$TARGET = xX86_DARWIN; then + X86_DARWIN_TRUE= + X86_DARWIN_FALSE='#' +else + X86_DARWIN_TRUE='#' + X86_DARWIN_FALSE= +fi + + if test x$TARGET = xALPHA; then + ALPHA_TRUE= + ALPHA_FALSE='#' +else + ALPHA_TRUE='#' + ALPHA_FALSE= +fi + + if test x$TARGET = xIA64; then + IA64_TRUE= + IA64_FALSE='#' +else + IA64_TRUE='#' + IA64_FALSE= +fi + + if test x$TARGET = xM32R; then + M32R_TRUE= + M32R_FALSE='#' +else + M32R_TRUE='#' + M32R_FALSE= +fi + + if test x$TARGET = xM68K; then + M68K_TRUE= + M68K_FALSE='#' +else + M68K_TRUE='#' + M68K_FALSE= +fi + + if test x$TARGET = xMOXIE; then + MOXIE_TRUE= + MOXIE_FALSE='#' +else + MOXIE_TRUE='#' + MOXIE_FALSE= +fi + + if test x$TARGET = xPOWERPC; then + POWERPC_TRUE= + POWERPC_FALSE='#' +else + POWERPC_TRUE='#' + POWERPC_FALSE= +fi + + if test x$TARGET = xPOWERPC_AIX; then + POWERPC_AIX_TRUE= + POWERPC_AIX_FALSE='#' +else + POWERPC_AIX_TRUE='#' + POWERPC_AIX_FALSE= +fi + + if test x$TARGET = xPOWERPC_DARWIN; then + POWERPC_DARWIN_TRUE= + POWERPC_DARWIN_FALSE='#' +else + POWERPC_DARWIN_TRUE='#' + POWERPC_DARWIN_FALSE= +fi + + if test x$TARGET = xPOWERPC_FREEBSD; then + POWERPC_FREEBSD_TRUE= + POWERPC_FREEBSD_FALSE='#' +else + POWERPC_FREEBSD_TRUE='#' + POWERPC_FREEBSD_FALSE= +fi + + if test x$TARGET = xARM; then + ARM_TRUE= + ARM_FALSE='#' +else + ARM_TRUE='#' + ARM_FALSE= +fi + + if test x$TARGET = xAVR32; then + AVR32_TRUE= + AVR32_FALSE='#' +else + AVR32_TRUE='#' + AVR32_FALSE= +fi + + if test x$TARGET = xLIBFFI_CRIS; then + LIBFFI_CRIS_TRUE= + LIBFFI_CRIS_FALSE='#' +else + LIBFFI_CRIS_TRUE='#' + LIBFFI_CRIS_FALSE= +fi + + if test x$TARGET = xFRV; then + FRV_TRUE= + FRV_FALSE='#' +else + FRV_TRUE='#' + FRV_FALSE= +fi + + if test x$TARGET = xS390; then + S390_TRUE= + S390_FALSE='#' +else + S390_TRUE='#' + S390_FALSE= +fi + + if test x$TARGET = xX86_64; then + X86_64_TRUE= + X86_64_FALSE='#' +else + X86_64_TRUE='#' + X86_64_FALSE= +fi + + if test x$TARGET = xSH; then + SH_TRUE= + SH_FALSE='#' +else + SH_TRUE='#' + SH_FALSE= +fi + + if test x$TARGET = xSH64; then + SH64_TRUE= + SH64_FALSE='#' +else + SH64_TRUE='#' + SH64_FALSE= +fi + + if test x$TARGET = xPA_LINUX; then + PA_LINUX_TRUE= + PA_LINUX_FALSE='#' +else + PA_LINUX_TRUE='#' + PA_LINUX_FALSE= +fi + + if test x$TARGET = xPA_HPUX; then + PA_HPUX_TRUE= + PA_HPUX_FALSE='#' +else + PA_HPUX_TRUE='#' + PA_HPUX_FALSE= +fi + + if test x$TARGET = xPA64_HPUX; then + PA64_HPUX_TRUE= + PA64_HPUX_FALSE='#' +else + PA64_HPUX_TRUE='#' + PA64_HPUX_FALSE= +fi + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5 +$as_echo_n "checking for ANSI C header files... " >&6; } +if ${ac_cv_header_stdc+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#include +#include + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_header_stdc=yes +else + ac_cv_header_stdc=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +if test $ac_cv_header_stdc = yes; then + # SunOS 4.x string.h does not declare mem*, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "memchr" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "free" >/dev/null 2>&1; then : + +else + ac_cv_header_stdc=no +fi +rm -f conftest* + +fi + +if test $ac_cv_header_stdc = yes; then + # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi. + if test "$cross_compiling" = yes; then : + : +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +#include +#if ((' ' & 0x0FF) == 0x020) +# define ISLOWER(c) ('a' <= (c) && (c) <= 'z') +# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c)) +#else +# define ISLOWER(c) \ + (('a' <= (c) && (c) <= 'i') \ + || ('j' <= (c) && (c) <= 'r') \ + || ('s' <= (c) && (c) <= 'z')) +# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c)) +#endif + +#define XOR(e, f) (((e) && !(f)) || (!(e) && (f))) +int +main () +{ + int i; + for (i = 0; i < 256; i++) + if (XOR (islower (i), ISLOWER (i)) + || toupper (i) != TOUPPER (i)) + return 2; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + +else + ac_cv_header_stdc=no +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5 +$as_echo "$ac_cv_header_stdc" >&6; } +if test $ac_cv_header_stdc = yes; then + +$as_echo "#define STDC_HEADERS 1" >>confdefs.h + +fi + +for ac_func in memcpy +do : + ac_fn_c_check_func "$LINENO" "memcpy" "ac_cv_func_memcpy" +if test "x$ac_cv_func_memcpy" = xyes; then : + cat >>confdefs.h <<_ACEOF +#define HAVE_MEMCPY 1 +_ACEOF + +fi +done + +ac_fn_c_check_type "$LINENO" "size_t" "ac_cv_type_size_t" "$ac_includes_default" +if test "x$ac_cv_type_size_t" = xyes; then : + +else + +cat >>confdefs.h <<_ACEOF +#define size_t unsigned int +_ACEOF + +fi + +# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works +# for constant arguments. Useless! +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5 +$as_echo_n "checking for working alloca.h... " >&6; } +if ${ac_cv_working_alloca_h+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include +int +main () +{ +char *p = (char *) alloca (2 * sizeof (int)); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_working_alloca_h=yes +else + ac_cv_working_alloca_h=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_working_alloca_h" >&5 +$as_echo "$ac_cv_working_alloca_h" >&6; } +if test $ac_cv_working_alloca_h = yes; then + +$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h + +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca" >&5 +$as_echo_n "checking for alloca... " >&6; } +if ${ac_cv_func_alloca_works+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifdef __GNUC__ +# define alloca __builtin_alloca +#else +# ifdef _MSC_VER +# include +# define alloca _alloca +# else +# ifdef HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +void *alloca (size_t); +# endif +# endif +# endif +# endif +#endif + +int +main () +{ +char *p = (char *) alloca (1); + if (p) return 0; + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_func_alloca_works=yes +else + ac_cv_func_alloca_works=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_func_alloca_works" >&5 +$as_echo "$ac_cv_func_alloca_works" >&6; } + +if test $ac_cv_func_alloca_works = yes; then + +$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h + +else + # The SVR3 libPW and SVR4 libucb both contain incompatible functions +# that cause trouble. Some versions do not even contain alloca or +# contain a buggy version. If you still want to use their alloca, +# use ar to extract alloca.o from them instead of compiling alloca.c. + +ALLOCA=\${LIBOBJDIR}alloca.$ac_objext + +$as_echo "#define C_ALLOCA 1" >>confdefs.h + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether \`alloca.c' needs Cray hooks" >&5 +$as_echo_n "checking whether \`alloca.c' needs Cray hooks... " >&6; } +if ${ac_cv_os_cray+:} false; then : + $as_echo_n "(cached) " >&6 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#if defined CRAY && ! defined CRAY2 +webecray +#else +wenotbecray +#endif + +_ACEOF +if (eval "$ac_cpp conftest.$ac_ext") 2>&5 | + $EGREP "webecray" >/dev/null 2>&1; then : + ac_cv_os_cray=yes +else + ac_cv_os_cray=no +fi +rm -f conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_os_cray" >&5 +$as_echo "$ac_cv_os_cray" >&6; } +if test $ac_cv_os_cray = yes; then + for ac_func in _getb67 GETB67 getb67; do + as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh` +ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var" +if eval test \"x\$"$as_ac_var"\" = x"yes"; then : + +cat >>confdefs.h <<_ACEOF +#define CRAY_STACKSEG_END $ac_func +_ACEOF + + break +fi + + done +fi + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking stack direction for C alloca" >&5 +$as_echo_n "checking stack direction for C alloca... " >&6; } +if ${ac_cv_c_stack_direction+:} false; then : + $as_echo_n "(cached) " >&6 +else + if test "$cross_compiling" = yes; then : + ac_cv_c_stack_direction=0 +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +find_stack_direction () +{ + static char *addr = 0; + auto char dummy; + if (addr == 0) + { + addr = &dummy; + return find_stack_direction (); + } + else + return (&dummy > addr) ? 1 : -1; +} + +int +main () +{ + return find_stack_direction () < 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_c_stack_direction=1 +else + ac_cv_c_stack_direction=-1 +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stack_direction" >&5 +$as_echo "$ac_cv_c_stack_direction" >&6; } +cat >>confdefs.h <<_ACEOF +#define STACK_DIRECTION $ac_cv_c_stack_direction +_ACEOF + + +fi + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of double" >&5 +$as_echo_n "checking size of double... " >&6; } +if ${ac_cv_sizeof_double+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (double))" "ac_cv_sizeof_double" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_double" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (double) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_double=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_double" >&5 +$as_echo "$ac_cv_sizeof_double" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_DOUBLE $ac_cv_sizeof_double +_ACEOF + + +# The cast to long int works around a bug in the HP C Compiler +# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects +# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'. +# This bug is HP SR number 8606223364. +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of long double" >&5 +$as_echo_n "checking size of long double... " >&6; } +if ${ac_cv_sizeof_long_double+:} false; then : + $as_echo_n "(cached) " >&6 +else + if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (long double))" "ac_cv_sizeof_long_double" "$ac_includes_default"; then : + +else + if test "$ac_cv_type_long_double" = yes; then + { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5 +$as_echo "$as_me: error: in \`$ac_pwd':" >&2;} +as_fn_error 77 "cannot compute sizeof (long double) +See \`config.log' for more details" "$LINENO" 5; } + else + ac_cv_sizeof_long_double=0 + fi +fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_long_double" >&5 +$as_echo "$ac_cv_sizeof_long_double" >&6; } + + + +cat >>confdefs.h <<_ACEOF +#define SIZEOF_LONG_DOUBLE $ac_cv_sizeof_long_double +_ACEOF + + + +# Also AC_SUBST this variable for ffi.h. +if test -z "$HAVE_LONG_DOUBLE"; then + HAVE_LONG_DOUBLE=0 + if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then + if test $ac_cv_sizeof_long_double != 0; then + HAVE_LONG_DOUBLE=1 + +$as_echo "#define HAVE_LONG_DOUBLE 1" >>confdefs.h + + fi + fi +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5 +$as_echo_n "checking whether byte ordering is bigendian... " >&6; } +if ${ac_cv_c_bigendian+:} false; then : + $as_echo_n "(cached) " >&6 +else + ac_cv_c_bigendian=unknown + # See if we're dealing with a universal compiler. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#ifndef __APPLE_CC__ + not a universal capable compiler + #endif + typedef int dummy; + +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + + # Check for potential -arch flags. It is not universal unless + # there are at least two -arch flags with different values. + ac_arch= + ac_prev= + for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do + if test -n "$ac_prev"; then + case $ac_word in + i?86 | x86_64 | ppc | ppc64) + if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then + ac_arch=$ac_word + else + ac_cv_c_bigendian=universal + break + fi + ;; + esac + ac_prev= + elif test "x$ac_word" = "x-arch"; then + ac_prev=arch + fi + done +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + if test $ac_cv_c_bigendian = unknown; then + # See if sys/param.h defines the BYTE_ORDER macro. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main () +{ +#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \ + && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \ + && LITTLE_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + #include + +int +main () +{ +#if BYTE_ORDER != BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # See if defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris). + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN) + bogus endian macros + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + # It does; now see whether it defined to _BIG_ENDIAN or not. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +#include + +int +main () +{ +#ifndef _BIG_ENDIAN + not big endian + #endif + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + ac_cv_c_bigendian=yes +else + ac_cv_c_bigendian=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + fi + if test $ac_cv_c_bigendian = unknown; then + # Compile a test program. + if test "$cross_compiling" = yes; then : + # Try to guess by grepping values from an object file. + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +short int ascii_mm[] = + { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 }; + short int ascii_ii[] = + { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 }; + int use_ascii (int i) { + return ascii_mm[i] + ascii_ii[i]; + } + short int ebcdic_ii[] = + { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 }; + short int ebcdic_mm[] = + { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 }; + int use_ebcdic (int i) { + return ebcdic_mm[i] + ebcdic_ii[i]; + } + extern int foo; + +int +main () +{ +return use_ascii (foo) == use_ebcdic (foo); + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then + ac_cv_c_bigendian=yes + fi + if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then + if test "$ac_cv_c_bigendian" = unknown; then + ac_cv_c_bigendian=no + else + # finding both strings is unlikely to happen, but who knows? + ac_cv_c_bigendian=unknown + fi + fi +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +else + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +$ac_includes_default +int +main () +{ + + /* Are we little or big endian? From Harbison&Steele. */ + union + { + long int l; + char c[sizeof (long int)]; + } u; + u.l = 1; + return u.c[sizeof (long int) - 1] == 1; + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_run "$LINENO"; then : + ac_cv_c_bigendian=no +else + ac_cv_c_bigendian=yes +fi +rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \ + conftest.$ac_objext conftest.beam conftest.$ac_ext +fi + + fi +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5 +$as_echo "$ac_cv_c_bigendian" >&6; } + case $ac_cv_c_bigendian in #( + yes) + $as_echo "#define WORDS_BIGENDIAN 1" >>confdefs.h +;; #( + no) + ;; #( + universal) + +$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h + + ;; #( + *) + as_fn_error $? "unknown endianness + presetting ac_cv_c_bigendian=no (or yes) will help" "$LINENO" 5 ;; + esac + + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .cfi pseudo-op support" >&5 +$as_echo_n "checking assembler .cfi pseudo-op support... " >&6; } +if ${libffi_cv_as_cfi_pseudo_op+:} false; then : + $as_echo_n "(cached) " >&6 +else + + libffi_cv_as_cfi_pseudo_op=unknown + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +asm (".cfi_startproc\n\t.cfi_endproc"); +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libffi_cv_as_cfi_pseudo_op=yes +else + libffi_cv_as_cfi_pseudo_op=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_cfi_pseudo_op" >&5 +$as_echo "$libffi_cv_as_cfi_pseudo_op" >&6; } +if test "x$libffi_cv_as_cfi_pseudo_op" = xyes; then + +$as_echo "#define HAVE_AS_CFI_PSEUDO_OP 1" >>confdefs.h + +fi + +if test x$TARGET = xSPARC; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler and linker support unaligned pc related relocs" >&5 +$as_echo_n "checking assembler and linker support unaligned pc related relocs... " >&6; } +if ${libffi_cv_as_sparc_ua_pcrel+:} false; then : + $as_echo_n "(cached) " >&6 +else + + save_CFLAGS="$CFLAGS" + save_LDFLAGS="$LDFLAGS" + CFLAGS="$CFLAGS -fpic" + LDFLAGS="$LDFLAGS -shared" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +asm (".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo); .text"); +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + libffi_cv_as_sparc_ua_pcrel=yes +else + libffi_cv_as_sparc_ua_pcrel=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS="$save_CFLAGS" + LDFLAGS="$save_LDFLAGS" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_sparc_ua_pcrel" >&5 +$as_echo "$libffi_cv_as_sparc_ua_pcrel" >&6; } + if test "x$libffi_cv_as_sparc_ua_pcrel" = xyes; then + +$as_echo "#define HAVE_AS_SPARC_UA_PCREL 1" >>confdefs.h + + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .register pseudo-op support" >&5 +$as_echo_n "checking assembler .register pseudo-op support... " >&6; } +if ${libffi_cv_as_register_pseudo_op+:} false; then : + $as_echo_n "(cached) " >&6 +else + + libffi_cv_as_register_pseudo_op=unknown + # Check if we have .register + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +asm (".register %g2, #scratch"); +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libffi_cv_as_register_pseudo_op=yes +else + libffi_cv_as_register_pseudo_op=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_register_pseudo_op" >&5 +$as_echo "$libffi_cv_as_register_pseudo_op" >&6; } + if test "x$libffi_cv_as_register_pseudo_op" = xyes; then + +$as_echo "#define HAVE_AS_REGISTER_PSEUDO_OP 1" >>confdefs.h + + fi +fi + +if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler supports pc related relocs" >&5 +$as_echo_n "checking assembler supports pc related relocs... " >&6; } +if ${libffi_cv_as_x86_pcrel+:} false; then : + $as_echo_n "(cached) " >&6 +else + + libffi_cv_as_x86_pcrel=no + echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s + if $CC $CFLAGS -c conftest.s > /dev/null; then + libffi_cv_as_x86_pcrel=yes + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_x86_pcrel" >&5 +$as_echo "$libffi_cv_as_x86_pcrel" >&6; } + if test "x$libffi_cv_as_x86_pcrel" = xyes; then + +$as_echo "#define HAVE_AS_X86_PCREL 1" >>confdefs.h + + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .ascii pseudo-op support" >&5 +$as_echo_n "checking assembler .ascii pseudo-op support... " >&6; } +if ${libffi_cv_as_ascii_pseudo_op+:} false; then : + $as_echo_n "(cached) " >&6 +else + + libffi_cv_as_ascii_pseudo_op=unknown + # Check if we have .ascii + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +asm (".ascii \\"string\\""); +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libffi_cv_as_ascii_pseudo_op=yes +else + libffi_cv_as_ascii_pseudo_op=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_ascii_pseudo_op" >&5 +$as_echo "$libffi_cv_as_ascii_pseudo_op" >&6; } + if test "x$libffi_cv_as_ascii_pseudo_op" = xyes; then + +$as_echo "#define HAVE_AS_ASCII_PSEUDO_OP 1" >>confdefs.h + + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler .string pseudo-op support" >&5 +$as_echo_n "checking assembler .string pseudo-op support... " >&6; } +if ${libffi_cv_as_string_pseudo_op+:} false; then : + $as_echo_n "(cached) " >&6 +else + + libffi_cv_as_string_pseudo_op=unknown + # Check if we have .string + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +asm (".string \\"string\\""); +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + libffi_cv_as_string_pseudo_op=yes +else + libffi_cv_as_string_pseudo_op=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_string_pseudo_op" >&5 +$as_echo "$libffi_cv_as_string_pseudo_op" >&6; } + if test "x$libffi_cv_as_string_pseudo_op" = xyes; then + +$as_echo "#define HAVE_AS_STRING_PSEUDO_OP 1" >>confdefs.h + + fi +fi + +if test x$TARGET = xX86_WIN64; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _ prefix in compiled symbols" >&5 +$as_echo_n "checking for _ prefix in compiled symbols... " >&6; } +if ${lt_cv_sys_symbol_underscore+:} false; then : + $as_echo_n "(cached) " >&6 +else + lt_cv_sys_symbol_underscore=no + cat > conftest.$ac_ext <<_LT_EOF +void nm_test_func(){} +int main(){nm_test_func;return 0;} +_LT_EOF + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5 + (eval $ac_compile) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; then + # Now try to grab the symbols. + ac_nlist=conftest.nm + if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist\""; } >&5 + (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $ac_nlist) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; } && test -s "$ac_nlist"; then + # See whether the symbols have a leading underscore. + if grep '^. _nm_test_func' "$ac_nlist" >/dev/null; then + lt_cv_sys_symbol_underscore=yes + else + if grep '^. nm_test_func ' "$ac_nlist" >/dev/null; then + : + else + echo "configure: cannot find nm_test_func in $ac_nlist" >&5 + fi + fi + else + echo "configure: cannot run $lt_cv_sys_global_symbol_pipe" >&5 + fi + else + echo "configure: failed program was:" >&5 + cat conftest.c >&5 + fi + rm -rf conftest* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_symbol_underscore" >&5 +$as_echo "$lt_cv_sys_symbol_underscore" >&6; } + sys_symbol_underscore=$lt_cv_sys_symbol_underscore + + + if test "x$sys_symbol_underscore" = xyes; then + +$as_echo "#define SYMBOL_UNDERSCORE 1" >>confdefs.h + + fi +fi + + +FFI_EXEC_TRAMPOLINE_TABLE=0 +case "$target" in + *arm*-apple-darwin*) + FFI_EXEC_TRAMPOLINE_TABLE=1 + +$as_echo "#define FFI_EXEC_TRAMPOLINE_TABLE 1" >>confdefs.h + + ;; + *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*) + +$as_echo "#define FFI_MMAP_EXEC_WRIT 1" >>confdefs.h + + ;; +esac + if test x$FFI_EXEC_TRAMPOLINE_TABLE = x1; then + FFI_EXEC_TRAMPOLINE_TABLE_TRUE= + FFI_EXEC_TRAMPOLINE_TABLE_FALSE='#' +else + FFI_EXEC_TRAMPOLINE_TABLE_TRUE='#' + FFI_EXEC_TRAMPOLINE_TABLE_FALSE= +fi + + + +if test x$TARGET = xX86_64; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler supports unwind section type" >&5 +$as_echo_n "checking assembler supports unwind section type... " >&6; } +if ${libffi_cv_as_x86_64_unwind_section_type+:} false; then : + $as_echo_n "(cached) " >&6 +else + + libffi_cv_as_x86_64_unwind_section_type=yes + echo '.section .eh_frame,"a",@unwind' > conftest.s + if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then + libffi_cv_as_x86_64_unwind_section_type=no + fi + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_as_x86_64_unwind_section_type" >&5 +$as_echo "$libffi_cv_as_x86_64_unwind_section_type" >&6; } + if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then + +$as_echo "#define HAVE_AS_X86_64_UNWIND_SECTION_TYPE 1" >>confdefs.h + + fi +fi + +if test "x$GCC" = "xyes"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether .eh_frame section should be read-only" >&5 +$as_echo_n "checking whether .eh_frame section should be read-only... " >&6; } +if ${libffi_cv_ro_eh_frame+:} false; then : + $as_echo_n "(cached) " >&6 +else + + libffi_cv_ro_eh_frame=no + echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c + if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then + if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then + libffi_cv_ro_eh_frame=yes + elif grep '.section.*eh_frame.*#alloc' conftest.c \ + | grep -v '#write' > /dev/null; then + libffi_cv_ro_eh_frame=yes + fi + fi + rm -f conftest.* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_ro_eh_frame" >&5 +$as_echo "$libffi_cv_ro_eh_frame" >&6; } + if test "x$libffi_cv_ro_eh_frame" = xyes; then + +$as_echo "#define HAVE_RO_EH_FRAME 1" >>confdefs.h + + +$as_echo "#define EH_FRAME_FLAGS \"a\"" >>confdefs.h + + else + +$as_echo "#define EH_FRAME_FLAGS \"aw\"" >>confdefs.h + + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking for __attribute__((visibility(\"hidden\")))" >&5 +$as_echo_n "checking for __attribute__((visibility(\"hidden\")))... " >&6; } +if ${libffi_cv_hidden_visibility_attribute+:} false; then : + $as_echo_n "(cached) " >&6 +else + + echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1 ; }' > conftest.c + libffi_cv_hidden_visibility_attribute=no + if { ac_try='${CC-cc} -Werror -S conftest.c -o conftest.s 1>&5' + { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5 + (eval $ac_try) 2>&5 + ac_status=$? + $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5 + test $ac_status = 0; }; }; then + if grep '\.hidden.*foo' conftest.s >/dev/null; then + libffi_cv_hidden_visibility_attribute=yes + fi + fi + rm -f conftest.* + +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $libffi_cv_hidden_visibility_attribute" >&5 +$as_echo "$libffi_cv_hidden_visibility_attribute" >&6; } + if test $libffi_cv_hidden_visibility_attribute = yes; then + +$as_echo "#define HAVE_HIDDEN_VISIBILITY_ATTRIBUTE 1" >>confdefs.h + + fi +fi + + + + + + + + +# Check whether --enable-debug was given. +if test "${enable_debug+set}" = set; then : + enableval=$enable_debug; if test "$enable_debug" = "yes"; then + +$as_echo "#define FFI_DEBUG 1" >>confdefs.h + + fi +fi + + if test "$enable_debug" = "yes"; then + FFI_DEBUG_TRUE= + FFI_DEBUG_FALSE='#' +else + FFI_DEBUG_TRUE='#' + FFI_DEBUG_FALSE= +fi + + +# Check whether --enable-structs was given. +if test "${enable_structs+set}" = set; then : + enableval=$enable_structs; if test "$enable_structs" = "no"; then + +$as_echo "#define FFI_NO_STRUCTS 1" >>confdefs.h + + fi +fi + + +# Check whether --enable-raw-api was given. +if test "${enable_raw_api+set}" = set; then : + enableval=$enable_raw_api; if test "$enable_raw_api" = "no"; then + +$as_echo "#define FFI_NO_RAW_API 1" >>confdefs.h + + fi +fi + + +# Check whether --enable-purify-safety was given. +if test "${enable_purify_safety+set}" = set; then : + enableval=$enable_purify_safety; if test "$enable_purify_safety" = "yes"; then + +$as_echo "#define USING_PURIFY 1" >>confdefs.h + + fi +fi + + +# These variables are only ever used when we cross-build to X86_WIN32. +# And we only support this with GCC, so... +if test x"$GCC" != x"no"; then + if test -n "$with_cross_host" && + test x"$with_cross_host" != x"no"; then + toolexecdir='$(exec_prefix)/$(target_alias)' + toolexeclibdir='$(toolexecdir)/lib' + else + toolexecdir='$(libdir)/gcc-lib/$(target_alias)' + toolexeclibdir='$(libdir)' + fi + multi_os_directory=`$CC -print-multi-os-directory` + case $multi_os_directory in + .) ;; # Avoid trailing /. + *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; + esac + + +fi + +if test "${multilib}" = "yes"; then + multilib_arg="--enable-multilib" +else + multilib_arg= +fi + +ac_config_commands="$ac_config_commands include" + +ac_config_commands="$ac_config_commands src" + + +ac_config_links="$ac_config_links include/ffitarget.h:src/$TARGETDIR/ffitarget.h" + + +ac_config_files="$ac_config_files include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc" + + +cat >confcache <<\_ACEOF +# This file is a shell script that caches the results of configure +# tests run on this system so they can be shared between configure +# scripts and configure runs, see configure's option --config-cache. +# It is not useful on other systems. If it contains results you don't +# want to keep, you may remove or edit it. +# +# config.status only pays attention to the cache file if you give it +# the --recheck option to rerun configure. +# +# `ac_cv_env_foo' variables (set or unset) will be overridden when +# loading this file, other *unset* `ac_cv_foo' will be assigned the +# following values. + +_ACEOF + +# The following way of writing the cache mishandles newlines in values, +# but we know of no workaround that is simple, portable, and efficient. +# So, we kill variables containing newlines. +# Ultrix sh set writes to stderr and can't be redirected directly, +# and sets the high bit in the cache file unless we assign to the vars. +( + for ac_var in `(set) 2>&1 | sed -n 's/^\([a-zA-Z_][a-zA-Z0-9_]*\)=.*/\1/p'`; do + eval ac_val=\$$ac_var + case $ac_val in #( + *${as_nl}*) + case $ac_var in #( + *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5 +$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;; + esac + case $ac_var in #( + _ | IFS | as_nl) ;; #( + BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #( + *) { eval $ac_var=; unset $ac_var;} ;; + esac ;; + esac + done + + (set) 2>&1 | + case $as_nl`(ac_space=' '; set) 2>&1` in #( + *${as_nl}ac_space=\ *) + # `set' does not quote correctly, so add quotes: double-quote + # substitution turns \\\\ into \\, and sed turns \\ into \. + sed -n \ + "s/'/'\\\\''/g; + s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p" + ;; #( + *) + # `set' quotes correctly as required by POSIX, so do not add quotes. + sed -n "/^[_$as_cr_alnum]*_cv_[_$as_cr_alnum]*=/p" + ;; + esac | + sort +) | + sed ' + /^ac_cv_env_/b end + t clear + :clear + s/^\([^=]*\)=\(.*[{}].*\)$/test "${\1+set}" = set || &/ + t end + s/^\([^=]*\)=\(.*\)$/\1=${\1=\2}/ + :end' >>confcache +if diff "$cache_file" confcache >/dev/null 2>&1; then :; else + if test -w "$cache_file"; then + if test "x$cache_file" != "x/dev/null"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5 +$as_echo "$as_me: updating cache $cache_file" >&6;} + if test ! -f "$cache_file" || test -h "$cache_file"; then + cat confcache >"$cache_file" + else + case $cache_file in #( + */* | ?:*) + mv -f confcache "$cache_file"$$ && + mv -f "$cache_file"$$ "$cache_file" ;; #( + *) + mv -f confcache "$cache_file" ;; + esac + fi + fi + else + { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5 +$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;} + fi +fi +rm -f confcache + +test "x$prefix" = xNONE && prefix=$ac_default_prefix +# Let make expand exec_prefix. +test "x$exec_prefix" = xNONE && exec_prefix='${prefix}' + +DEFS=-DHAVE_CONFIG_H + +ac_libobjs= +ac_ltlibobjs= +U= +for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue + # 1. Remove the extension, and $U if already installed. + ac_script='s/\$U\././;s/\.o$//;s/\.obj$//' + ac_i=`$as_echo "$ac_i" | sed "$ac_script"` + # 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR + # will be set to the directory where LIBOBJS objects are built. + as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext" + as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo' +done +LIBOBJS=$ac_libobjs + +LTLIBOBJS=$ac_ltlibobjs + + + if test -n "$EXEEXT"; then + am__EXEEXT_TRUE= + am__EXEEXT_FALSE='#' +else + am__EXEEXT_TRUE='#' + am__EXEEXT_FALSE= +fi + +if test -z "${AMDEP_TRUE}" && test -z "${AMDEP_FALSE}"; then + as_fn_error $? "conditional \"AMDEP\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCC_TRUE}" && test -z "${am__fastdepCC_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${am__fastdepCCAS_TRUE}" && test -z "${am__fastdepCCAS_FALSE}"; then + as_fn_error $? "conditional \"am__fastdepCCAS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then + as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${TESTSUBDIR_TRUE}" && test -z "${TESTSUBDIR_FALSE}"; then + as_fn_error $? "conditional \"TESTSUBDIR\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${MIPS_TRUE}" && test -z "${MIPS_FALSE}"; then + as_fn_error $? "conditional \"MIPS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SPARC_TRUE}" && test -z "${SPARC_FALSE}"; then + as_fn_error $? "conditional \"SPARC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${X86_TRUE}" && test -z "${X86_FALSE}"; then + as_fn_error $? "conditional \"X86\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${X86_FREEBSD_TRUE}" && test -z "${X86_FREEBSD_FALSE}"; then + as_fn_error $? "conditional \"X86_FREEBSD\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${X86_WIN32_TRUE}" && test -z "${X86_WIN32_FALSE}"; then + as_fn_error $? "conditional \"X86_WIN32\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${X86_WIN64_TRUE}" && test -z "${X86_WIN64_FALSE}"; then + as_fn_error $? "conditional \"X86_WIN64\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${X86_DARWIN_TRUE}" && test -z "${X86_DARWIN_FALSE}"; then + as_fn_error $? "conditional \"X86_DARWIN\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ALPHA_TRUE}" && test -z "${ALPHA_FALSE}"; then + as_fn_error $? "conditional \"ALPHA\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${IA64_TRUE}" && test -z "${IA64_FALSE}"; then + as_fn_error $? "conditional \"IA64\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${M32R_TRUE}" && test -z "${M32R_FALSE}"; then + as_fn_error $? "conditional \"M32R\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${M68K_TRUE}" && test -z "${M68K_FALSE}"; then + as_fn_error $? "conditional \"M68K\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${MOXIE_TRUE}" && test -z "${MOXIE_FALSE}"; then + as_fn_error $? "conditional \"MOXIE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${POWERPC_TRUE}" && test -z "${POWERPC_FALSE}"; then + as_fn_error $? "conditional \"POWERPC\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${POWERPC_AIX_TRUE}" && test -z "${POWERPC_AIX_FALSE}"; then + as_fn_error $? "conditional \"POWERPC_AIX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${POWERPC_DARWIN_TRUE}" && test -z "${POWERPC_DARWIN_FALSE}"; then + as_fn_error $? "conditional \"POWERPC_DARWIN\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${POWERPC_FREEBSD_TRUE}" && test -z "${POWERPC_FREEBSD_FALSE}"; then + as_fn_error $? "conditional \"POWERPC_FREEBSD\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${ARM_TRUE}" && test -z "${ARM_FALSE}"; then + as_fn_error $? "conditional \"ARM\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${AVR32_TRUE}" && test -z "${AVR32_FALSE}"; then + as_fn_error $? "conditional \"AVR32\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${LIBFFI_CRIS_TRUE}" && test -z "${LIBFFI_CRIS_FALSE}"; then + as_fn_error $? "conditional \"LIBFFI_CRIS\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${FRV_TRUE}" && test -z "${FRV_FALSE}"; then + as_fn_error $? "conditional \"FRV\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${S390_TRUE}" && test -z "${S390_FALSE}"; then + as_fn_error $? "conditional \"S390\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${X86_64_TRUE}" && test -z "${X86_64_FALSE}"; then + as_fn_error $? "conditional \"X86_64\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SH_TRUE}" && test -z "${SH_FALSE}"; then + as_fn_error $? "conditional \"SH\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${SH64_TRUE}" && test -z "${SH64_FALSE}"; then + as_fn_error $? "conditional \"SH64\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${PA_LINUX_TRUE}" && test -z "${PA_LINUX_FALSE}"; then + as_fn_error $? "conditional \"PA_LINUX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${PA_HPUX_TRUE}" && test -z "${PA_HPUX_FALSE}"; then + as_fn_error $? "conditional \"PA_HPUX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${PA64_HPUX_TRUE}" && test -z "${PA64_HPUX_FALSE}"; then + as_fn_error $? "conditional \"PA64_HPUX\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +if test -z "${FFI_EXEC_TRAMPOLINE_TABLE_TRUE}" && test -z "${FFI_EXEC_TRAMPOLINE_TABLE_FALSE}"; then + as_fn_error $? "conditional \"FFI_EXEC_TRAMPOLINE_TABLE\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi +if test -z "${FFI_DEBUG_TRUE}" && test -z "${FFI_DEBUG_FALSE}"; then + as_fn_error $? "conditional \"FFI_DEBUG\" was never defined. +Usually this means the macro was only invoked conditionally." "$LINENO" 5 +fi + +: "${CONFIG_STATUS=./config.status}" +ac_write_fail=0 +ac_clean_files_save=$ac_clean_files +ac_clean_files="$ac_clean_files $CONFIG_STATUS" +{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5 +$as_echo "$as_me: creating $CONFIG_STATUS" >&6;} +as_write_fail=0 +cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1 +#! $SHELL +# Generated by $as_me. +# Run this file to recreate the current configuration. +# Compiler output produced by configure, useful for debugging +# configure, is in config.log if it exists. + +debug=false +ac_cs_recheck=false +ac_cs_silent=false + +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1 +## -------------------- ## +## M4sh Initialization. ## +## -------------------- ## + +# Be more Bourne compatible +DUALCASE=1; export DUALCASE # for MKS sh +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then : + emulate sh + NULLCMD=: + # Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in #( + *posix*) : + set -o posix ;; #( + *) : + ;; +esac +fi + + +as_nl=' +' +export as_nl +# Printing a long string crashes Solaris 7 /usr/bin/printf. +as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo +as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo +# Prefer a ksh shell builtin over an external printf program on Solaris, +# but without wasting forks for bash or zsh. +if test -z "$BASH_VERSION$ZSH_VERSION" \ + && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='print -r --' + as_echo_n='print -rn --' +elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then + as_echo='printf %s\n' + as_echo_n='printf %s' +else + if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then + as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"' + as_echo_n='/usr/ucb/echo -n' + else + as_echo_body='eval expr "X$1" : "X\\(.*\\)"' + as_echo_n_body='eval + arg=$1; + case $arg in #( + *"$as_nl"*) + expr "X$arg" : "X\\(.*\\)$as_nl"; + arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;; + esac; + expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl" + ' + export as_echo_n_body + as_echo_n='sh -c $as_echo_n_body as_echo' + fi + export as_echo_body + as_echo='sh -c $as_echo_body as_echo' +fi + +# The user is always right. +if test "${PATH_SEPARATOR+set}" != set; then + PATH_SEPARATOR=: + (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && { + (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 || + PATH_SEPARATOR=';' + } +fi + + +# IFS +# We need space, tab and new line, in precisely that order. Quoting is +# there to prevent editors from complaining about space-tab. +# (If _AS_PATH_WALK were called with IFS unset, it would disable word +# splitting by setting IFS to empty value.) +IFS=" "" $as_nl" + +# Find who we are. Look in the path if we contain no directory separator. +as_myself= +case $0 in #(( + *[\\/]* ) as_myself=$0 ;; + *) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break + done +IFS=$as_save_IFS + + ;; +esac +# We did not find ourselves, most probably we were run as `sh COMMAND' +# in which case we are not to be found in the path. +if test "x$as_myself" = x; then + as_myself=$0 +fi +if test ! -f "$as_myself"; then + $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2 + exit 1 +fi + +# Unset variables that we do not need and which cause bugs (e.g. in +# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1" +# suppresses any "Segmentation fault" message there. '((' could +# trigger a bug in pdksh 5.2.14. +for as_var in BASH_ENV ENV MAIL MAILPATH +do eval test x\${$as_var+set} = xset \ + && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || : +done +PS1='$ ' +PS2='> ' +PS4='+ ' + +# NLS nuisances. +LC_ALL=C +export LC_ALL +LANGUAGE=C +export LANGUAGE + +# CDPATH. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + + +# as_fn_error STATUS ERROR [LINENO LOG_FD] +# ---------------------------------------- +# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are +# provided, also output the error to LOG_FD, referencing LINENO. Then exit the +# script with STATUS, using 1 if that was 0. +as_fn_error () +{ + as_status=$1; test $as_status -eq 0 && as_status=1 + if test "$4"; then + as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack + $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4 + fi + $as_echo "$as_me: error: $2" >&2 + as_fn_exit $as_status +} # as_fn_error + + +# as_fn_set_status STATUS +# ----------------------- +# Set $? to STATUS, without forking. +as_fn_set_status () +{ + return $1 +} # as_fn_set_status + +# as_fn_exit STATUS +# ----------------- +# Exit the shell with STATUS, even in a "trap 0" or "set -e" context. +as_fn_exit () +{ + set +e + as_fn_set_status $1 + exit $1 +} # as_fn_exit + +# as_fn_unset VAR +# --------------- +# Portably unset VAR. +as_fn_unset () +{ + { eval $1=; unset $1;} +} +as_unset=as_fn_unset +# as_fn_append VAR VALUE +# ---------------------- +# Append the text in VALUE to the end of the definition contained in VAR. Take +# advantage of any shell optimizations that allow amortized linear growth over +# repeated appends, instead of the typical quadratic growth present in naive +# implementations. +if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then : + eval 'as_fn_append () + { + eval $1+=\$2 + }' +else + as_fn_append () + { + eval $1=\$$1\$2 + } +fi # as_fn_append + +# as_fn_arith ARG... +# ------------------ +# Perform arithmetic evaluation on the ARGs, and store the result in the +# global $as_val. Take advantage of shells that can avoid forks. The arguments +# must be portable across $(()) and expr. +if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then : + eval 'as_fn_arith () + { + as_val=$(( $* )) + }' +else + as_fn_arith () + { + as_val=`expr "$@" || test $? -eq 1` + } +fi # as_fn_arith + + +if expr a : '\(a\)' >/dev/null 2>&1 && + test "X`expr 00001 : '.*\(...\)'`" = X001; then + as_expr=expr +else + as_expr=false +fi + +if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then + as_basename=basename +else + as_basename=false +fi + +if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then + as_dirname=dirname +else + as_dirname=false +fi + +as_me=`$as_basename -- "$0" || +$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \ + X"$0" : 'X\(//\)$' \| \ + X"$0" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X/"$0" | + sed '/^.*\/\([^/][^/]*\)\/*$/{ + s//\1/ + q + } + /^X\/\(\/\/\)$/{ + s//\1/ + q + } + /^X\/\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + +# Avoid depending upon Character Ranges. +as_cr_letters='abcdefghijklmnopqrstuvwxyz' +as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ' +as_cr_Letters=$as_cr_letters$as_cr_LETTERS +as_cr_digits='0123456789' +as_cr_alnum=$as_cr_Letters$as_cr_digits + +ECHO_C= ECHO_N= ECHO_T= +case `echo -n x` in #((((( +-n*) + case `echo 'xy\c'` in + *c*) ECHO_T=' ';; # ECHO_T is single tab character. + xy) ECHO_C='\c';; + *) echo `echo ksh88 bug on AIX 6.1` > /dev/null + ECHO_T=' ';; + esac;; +*) + ECHO_N='-n';; +esac + +rm -f conf$$ conf$$.exe conf$$.file +if test -d conf$$.dir; then + rm -f conf$$.dir/conf$$.file +else + rm -f conf$$.dir + mkdir conf$$.dir 2>/dev/null +fi +if (echo >conf$$.file) 2>/dev/null; then + if ln -s conf$$.file conf$$ 2>/dev/null; then + as_ln_s='ln -s' + # ... but there are two gotchas: + # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail. + # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable. + # In both cases, we have to default to `cp -p'. + ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe || + as_ln_s='cp -p' + elif ln conf$$.file conf$$ 2>/dev/null; then + as_ln_s=ln + else + as_ln_s='cp -p' + fi +else + as_ln_s='cp -p' +fi +rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file +rmdir conf$$.dir 2>/dev/null + + +# as_fn_mkdir_p +# ------------- +# Create "$as_dir" as a directory, including parents if necessary. +as_fn_mkdir_p () +{ + + case $as_dir in #( + -*) as_dir=./$as_dir;; + esac + test -d "$as_dir" || eval $as_mkdir_p || { + as_dirs= + while :; do + case $as_dir in #( + *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'( + *) as_qdir=$as_dir;; + esac + as_dirs="'$as_qdir' $as_dirs" + as_dir=`$as_dirname -- "$as_dir" || +$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$as_dir" : 'X\(//\)[^/]' \| \ + X"$as_dir" : 'X\(//\)$' \| \ + X"$as_dir" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$as_dir" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + test -d "$as_dir" && break + done + test -z "$as_dirs" || eval "mkdir $as_dirs" + } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir" + + +} # as_fn_mkdir_p +if mkdir -p . 2>/dev/null; then + as_mkdir_p='mkdir -p "$as_dir"' +else + test -d ./-p && rmdir ./-p + as_mkdir_p=false +fi + +if test -x / >/dev/null 2>&1; then + as_test_x='test -x' +else + if ls -dL / >/dev/null 2>&1; then + as_ls_L_option=L + else + as_ls_L_option= + fi + as_test_x=' + eval sh -c '\'' + if test -d "$1"; then + test -d "$1/."; + else + case $1 in #( + -*)set "./$1";; + esac; + case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in #(( + ???[sx]*):;;*)false;;esac;fi + '\'' sh + ' +fi +as_executable_p=$as_test_x + +# Sed expression to map a string onto a valid CPP name. +as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'" + +# Sed expression to map a string onto a valid variable name. +as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'" + + +exec 6>&1 +## ----------------------------------- ## +## Main body of $CONFIG_STATUS script. ## +## ----------------------------------- ## +_ASEOF +test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# Save the log message, to keep $0 and so on meaningful, and to +# report actual input values of CONFIG_FILES etc. instead of their +# values after options handling. +ac_log=" +This file was extended by libffi $as_me 3.0.10, which was +generated by GNU Autoconf 2.68. Invocation command line was + + CONFIG_FILES = $CONFIG_FILES + CONFIG_HEADERS = $CONFIG_HEADERS + CONFIG_LINKS = $CONFIG_LINKS + CONFIG_COMMANDS = $CONFIG_COMMANDS + $ $0 $@ + +on `(hostname || uname -n) 2>/dev/null | sed 1q` +" + +_ACEOF + +case $ac_config_files in *" +"*) set x $ac_config_files; shift; ac_config_files=$*;; +esac + +case $ac_config_headers in *" +"*) set x $ac_config_headers; shift; ac_config_headers=$*;; +esac + + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# Files that config.status was made for. +config_files="$ac_config_files" +config_headers="$ac_config_headers" +config_links="$ac_config_links" +config_commands="$ac_config_commands" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +ac_cs_usage="\ +\`$as_me' instantiates files and other configuration actions +from templates according to the current configuration. Unless the files +and actions are specified as TAGs, all are instantiated by default. + +Usage: $0 [OPTION]... [TAG]... + + -h, --help print this help, then exit + -V, --version print version number and configuration settings, then exit + --config print configuration, then exit + -q, --quiet, --silent + do not print progress messages + -d, --debug don't remove temporary files + --recheck update $as_me by reconfiguring in the same conditions + --file=FILE[:TEMPLATE] + instantiate the configuration file FILE + --header=FILE[:TEMPLATE] + instantiate the configuration header FILE + +Configuration files: +$config_files + +Configuration headers: +$config_headers + +Configuration links: +$config_links + +Configuration commands: +$config_commands + +Report bugs to ." + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`" +ac_cs_version="\\ +libffi config.status 3.0.10 +configured by $0, generated by GNU Autoconf 2.68, + with options \\"\$ac_cs_config\\" + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.status script is free software; the Free Software Foundation +gives unlimited permission to copy, distribute and modify it." + +ac_pwd='$ac_pwd' +srcdir='$srcdir' +INSTALL='$INSTALL' +MKDIR_P='$MKDIR_P' +AWK='$AWK' +test -n "\$AWK" || AWK=awk +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# The default lists apply if the user does not specify any file. +ac_need_defaults=: +while test $# != 0 +do + case $1 in + --*=?*) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'` + ac_shift=: + ;; + --*=) + ac_option=`expr "X$1" : 'X\([^=]*\)='` + ac_optarg= + ac_shift=: + ;; + *) + ac_option=$1 + ac_optarg=$2 + ac_shift=shift + ;; + esac + + case $ac_option in + # Handling of the options. + -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r) + ac_cs_recheck=: ;; + --version | --versio | --versi | --vers | --ver | --ve | --v | -V ) + $as_echo "$ac_cs_version"; exit ;; + --config | --confi | --conf | --con | --co | --c ) + $as_echo "$ac_cs_config"; exit ;; + --debug | --debu | --deb | --de | --d | -d ) + debug=: ;; + --file | --fil | --fi | --f ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + '') as_fn_error $? "missing file argument" ;; + esac + as_fn_append CONFIG_FILES " '$ac_optarg'" + ac_need_defaults=false;; + --header | --heade | --head | --hea ) + $ac_shift + case $ac_optarg in + *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;; + esac + as_fn_append CONFIG_HEADERS " '$ac_optarg'" + ac_need_defaults=false;; + --he | --h) + # Conflict between --help and --header + as_fn_error $? "ambiguous option: \`$1' +Try \`$0 --help' for more information.";; + --help | --hel | -h ) + $as_echo "$ac_cs_usage"; exit ;; + -q | -quiet | --quiet | --quie | --qui | --qu | --q \ + | -silent | --silent | --silen | --sile | --sil | --si | --s) + ac_cs_silent=: ;; + + # This is an error. + -*) as_fn_error $? "unrecognized option: \`$1' +Try \`$0 --help' for more information." ;; + + *) as_fn_append ac_config_targets " $1" + ac_need_defaults=false ;; + + esac + shift +done + +ac_configure_extra_args= + +if $ac_cs_silent; then + exec 6>/dev/null + ac_configure_extra_args="$ac_configure_extra_args --silent" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +if \$ac_cs_recheck; then + set X '$SHELL' '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion + shift + \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6 + CONFIG_SHELL='$SHELL' + export CONFIG_SHELL + exec "\$@" +fi + +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +exec 5>>config.log +{ + echo + sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX +## Running $as_me. ## +_ASBOX + $as_echo "$ac_log" +} >&5 + +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +# +# INIT-COMMANDS +# +ax_enable_builddir_srcdir="$srcdir" # $srcdir +ax_enable_builddir_host="$HOST" # $HOST / $host +ax_enable_builddir_version="$VERSION" # $VERSION +ax_enable_builddir_package="$PACKAGE" # $PACKAGE +ax_enable_builddir_auxdir="$ax_enable_builddir_auxdir" # $AUX +ax_enable_builddir_sed="$ax_enable_builddir_sed" # $SED +ax_enable_builddir="$ax_enable_builddir" # $SUB + +AMDEP_TRUE="$AMDEP_TRUE" ac_aux_dir="$ac_aux_dir" + + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`' +macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`' +enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`' +enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`' +pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`' +enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`' +SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`' +ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`' +host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`' +host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`' +host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`' +build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`' +build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`' +build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`' +SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`' +Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`' +GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`' +EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`' +FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`' +LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`' +NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`' +LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`' +max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`' +ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`' +exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`' +lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`' +lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`' +lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`' +lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`' +lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`' +reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`' +reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`' +OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`' +deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`' +file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`' +file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`' +want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`' +DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`' +sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`' +AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`' +AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`' +archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`' +STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`' +RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`' +old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`' +old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`' +lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`' +CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`' +CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`' +compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`' +GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`' +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`' +nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`' +lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`' +objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`' +MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`' +lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`' +lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`' +need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`' +MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`' +DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`' +NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`' +LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`' +OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`' +OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`' +libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`' +shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`' +extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`' +enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`' +export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`' +whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`' +compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`' +old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`' +old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`' +archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`' +archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`' +module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`' +module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`' +with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`' +allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`' +no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_flag_spec_ld='`$ECHO "$hardcode_libdir_flag_spec_ld" | $SED "$delay_single_quote_subst"`' +hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`' +hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`' +hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`' +hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`' +hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`' +hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`' +inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`' +link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`' +always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`' +export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`' +exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`' +include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`' +prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`' +postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`' +file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`' +variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`' +need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`' +need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`' +version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`' +runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`' +shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`' +libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`' +library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`' +soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`' +install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`' +postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`' +postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`' +finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`' +finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`' +hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`' +sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`' +sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`' +hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`' +enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`' +enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`' +old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`' +striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`' + +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in SHELL \ +ECHO \ +SED \ +GREP \ +EGREP \ +FGREP \ +LD \ +NM \ +LN_S \ +lt_SP2NL \ +lt_NL2SP \ +reload_flag \ +OBJDUMP \ +deplibs_check_method \ +file_magic_cmd \ +file_magic_glob \ +want_nocaseglob \ +DLLTOOL \ +sharedlib_from_linklib_cmd \ +AR \ +AR_FLAGS \ +archiver_list_spec \ +STRIP \ +RANLIB \ +CC \ +CFLAGS \ +compiler \ +lt_cv_sys_global_symbol_pipe \ +lt_cv_sys_global_symbol_to_cdecl \ +lt_cv_sys_global_symbol_to_c_name_address \ +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \ +nm_file_list_spec \ +lt_prog_compiler_no_builtin_flag \ +lt_prog_compiler_pic \ +lt_prog_compiler_wl \ +lt_prog_compiler_static \ +lt_cv_prog_compiler_c_o \ +need_locks \ +MANIFEST_TOOL \ +DSYMUTIL \ +NMEDIT \ +LIPO \ +OTOOL \ +OTOOL64 \ +shrext_cmds \ +export_dynamic_flag_spec \ +whole_archive_flag_spec \ +compiler_needs_object \ +with_gnu_ld \ +allow_undefined_flag \ +no_undefined_flag \ +hardcode_libdir_flag_spec \ +hardcode_libdir_flag_spec_ld \ +hardcode_libdir_separator \ +exclude_expsyms \ +include_expsyms \ +file_list_spec \ +variables_saved_for_relink \ +libname_spec \ +library_names_spec \ +soname_spec \ +install_override_mode \ +finish_eval \ +old_striplib \ +striplib; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in reload_cmds \ +old_postinstall_cmds \ +old_postuninstall_cmds \ +old_archive_cmds \ +extract_expsyms_cmds \ +old_archive_from_new_cmds \ +old_archive_from_expsyms_cmds \ +archive_cmds \ +archive_expsym_cmds \ +module_cmds \ +module_expsym_cmds \ +export_symbols_cmds \ +prelink_cmds \ +postlink_cmds \ +postinstall_cmds \ +postuninstall_cmds \ +finish_cmds \ +sys_lib_search_path_spec \ +sys_lib_dlsearch_path_spec; do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[\\\\\\\`\\"\\\$]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +ac_aux_dir='$ac_aux_dir' +xsi_shell='$xsi_shell' +lt_shell_append='$lt_shell_append' + +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + + + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile' + + + +TARGETDIR="$TARGETDIR" + +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + +# Handling of arguments. +for ac_config_target in $ac_config_targets +do + case $ac_config_target in + "fficonfig.h") CONFIG_HEADERS="$CONFIG_HEADERS fficonfig.h" ;; + "buildir") CONFIG_COMMANDS="$CONFIG_COMMANDS buildir" ;; + "depfiles") CONFIG_COMMANDS="$CONFIG_COMMANDS depfiles" ;; + "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;; + "include") CONFIG_COMMANDS="$CONFIG_COMMANDS include" ;; + "src") CONFIG_COMMANDS="$CONFIG_COMMANDS src" ;; + "include/ffitarget.h") CONFIG_LINKS="$CONFIG_LINKS include/ffitarget.h:src/$TARGETDIR/ffitarget.h" ;; + "include/Makefile") CONFIG_FILES="$CONFIG_FILES include/Makefile" ;; + "include/ffi.h") CONFIG_FILES="$CONFIG_FILES include/ffi.h" ;; + "Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;; + "testsuite/Makefile") CONFIG_FILES="$CONFIG_FILES testsuite/Makefile" ;; + "man/Makefile") CONFIG_FILES="$CONFIG_FILES man/Makefile" ;; + "libffi.pc") CONFIG_FILES="$CONFIG_FILES libffi.pc" ;; + + *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;; + esac +done + + +# If the user did not use the arguments to specify the items to instantiate, +# then the envvar interface is used. Set only those that are not. +# We use the long form for the default assignment because of an extremely +# bizarre bug on SunOS 4.1.3. +if $ac_need_defaults; then + test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files + test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers + test "${CONFIG_LINKS+set}" = set || CONFIG_LINKS=$config_links + test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands +fi + +# Have a temporary directory for convenience. Make it in the build tree +# simply because there is no reason against having it here, and in addition, +# creating and moving files from /tmp can sometimes cause problems. +# Hook for its removal unless debugging. +# Note that there is a small window in which the directory will not be cleaned: +# after its creation but before its name has been assigned to `$tmp'. +$debug || +{ + tmp= ac_tmp= + trap 'exit_status=$? + : "${ac_tmp:=$tmp}" + { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status +' 0 + trap 'as_fn_exit 1' 1 2 13 15 +} +# Create a (secure) tmp directory for tmp files. + +{ + tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` && + test -d "$tmp" +} || +{ + tmp=./conf$$-$RANDOM + (umask 077 && mkdir "$tmp") +} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5 +ac_tmp=$tmp + +# Set up the scripts for CONFIG_FILES section. +# No need to generate them if there are no CONFIG_FILES. +# This happens for instance with `./config.status config.h'. +if test -n "$CONFIG_FILES"; then + + +ac_cr=`echo X | tr X '\015'` +# On cygwin, bash can eat \r inside `` if the user requested igncr. +# But we know of no other shell where ac_cr would be empty at this +# point, so we can use a bashism as a fallback. +if test "x$ac_cr" = x; then + eval ac_cr=\$\'\\r\' +fi +ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' /dev/null` +if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then + ac_cs_awk_cr='\\r' +else + ac_cs_awk_cr=$ac_cr +fi + +echo 'BEGIN {' >"$ac_tmp/subs1.awk" && +_ACEOF + + +{ + echo "cat >conf$$subs.awk <<_ACEOF" && + echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' && + echo "_ACEOF" +} >conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 +ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'` +ac_delim='%!_!# ' +for ac_last_try in false false false false false :; do + . ./conf$$subs.sh || + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + + ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X` + if test $ac_delim_n = $ac_delim_num; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done +rm -f conf$$subs.sh + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK && +_ACEOF +sed -n ' +h +s/^/S["/; s/!.*/"]=/ +p +g +s/^[^!]*!// +:repl +t repl +s/'"$ac_delim"'$// +t delim +:nl +h +s/\(.\{148\}\)..*/\1/ +t more1 +s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/ +p +n +b repl +:more1 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t nl +:delim +h +s/\(.\{148\}\)..*/\1/ +t more2 +s/["\\]/\\&/g; s/^/"/; s/$/"/ +p +b +:more2 +s/["\\]/\\&/g; s/^/"/; s/$/"\\/ +p +g +s/.\{148\}// +t delim +' >$CONFIG_STATUS || ac_write_fail=1 +rm -f conf$$subs.awk +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +_ACAWK +cat >>"\$ac_tmp/subs1.awk" <<_ACAWK && + for (key in S) S_is_set[key] = 1 + FS = "" + +} +{ + line = $ 0 + nfields = split(line, field, "@") + substed = 0 + len = length(field[1]) + for (i = 2; i < nfields; i++) { + key = field[i] + keylen = length(key) + if (S_is_set[key]) { + value = S[key] + line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3) + len += length(value) + length(field[++i]) + substed = 1 + } else + len += 1 + keylen + } + + print line +} + +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then + sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g" +else + cat +fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \ + || as_fn_error $? "could not setup config files machinery" "$LINENO" 5 +_ACEOF + +# VPATH may cause trouble with some makes, so we remove sole $(srcdir), +# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and +# trailing colons and then remove the whole line if VPATH becomes empty +# (actually we leave an empty line to preserve line numbers). +if test "x$srcdir" = x.; then + ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{ +h +s/// +s/^/:/ +s/[ ]*$/:/ +s/:\$(srcdir):/:/g +s/:\${srcdir}:/:/g +s/:@srcdir@:/:/g +s/^:*// +s/:*$// +x +s/\(=[ ]*\).*/\1/ +G +s/\n// +s/^[^=]*=[ ]*$// +}' +fi + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +fi # test -n "$CONFIG_FILES" + +# Set up the scripts for CONFIG_HEADERS section. +# No need to generate them if there are no CONFIG_HEADERS. +# This happens for instance with `./config.status Makefile'. +if test -n "$CONFIG_HEADERS"; then +cat >"$ac_tmp/defines.awk" <<\_ACAWK || +BEGIN { +_ACEOF + +# Transform confdefs.h into an awk script `defines.awk', embedded as +# here-document in config.status, that substitutes the proper values into +# config.h.in to produce config.h. + +# Create a delimiter string that does not exist in confdefs.h, to ease +# handling of long lines. +ac_delim='%!_!# ' +for ac_last_try in false false :; do + ac_tt=`sed -n "/$ac_delim/p" confdefs.h` + if test -z "$ac_tt"; then + break + elif $ac_last_try; then + as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5 + else + ac_delim="$ac_delim!$ac_delim _$ac_delim!! " + fi +done + +# For the awk script, D is an array of macro values keyed by name, +# likewise P contains macro parameters if any. Preserve backslash +# newline sequences. + +ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]* +sed -n ' +s/.\{148\}/&'"$ac_delim"'/g +t rset +:rset +s/^[ ]*#[ ]*define[ ][ ]*/ / +t def +d +:def +s/\\$// +t bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3"/p +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p +d +:bsnl +s/["\\]/\\&/g +s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\ +D["\1"]=" \3\\\\\\n"\\/p +t cont +s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p +t cont +d +:cont +n +s/.\{148\}/&'"$ac_delim"'/g +t clear +:clear +s/\\$// +t bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/"/p +d +:bsnlc +s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p +b cont +' >$CONFIG_STATUS || ac_write_fail=1 + +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + for (key in D) D_is_set[key] = 1 + FS = "" +} +/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ { + line = \$ 0 + split(line, arg, " ") + if (arg[1] == "#") { + defundef = arg[2] + mac1 = arg[3] + } else { + defundef = substr(arg[1], 2) + mac1 = arg[2] + } + split(mac1, mac2, "(") #) + macro = mac2[1] + prefix = substr(line, 1, index(line, defundef) - 1) + if (D_is_set[macro]) { + # Preserve the white space surrounding the "#". + print prefix "define", macro P[macro] D[macro] + next + } else { + # Replace #undef with comments. This is necessary, for example, + # in the case of _POSIX_SOURCE, which is predefined and required + # on some systems where configure will not decide to define it. + if (defundef == "undef") { + print "/*", prefix defundef, macro, "*/" + next + } + } +} +{ print } +_ACAWK +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 + as_fn_error $? "could not setup config headers machinery" "$LINENO" 5 +fi # test -n "$CONFIG_HEADERS" + + +eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :L $CONFIG_LINKS :C $CONFIG_COMMANDS" +shift +for ac_tag +do + case $ac_tag in + :[FHLC]) ac_mode=$ac_tag; continue;; + esac + case $ac_mode$ac_tag in + :[FHL]*:*);; + :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;; + :[FH]-) ac_tag=-:-;; + :[FH]*) ac_tag=$ac_tag:$ac_tag.in;; + esac + ac_save_IFS=$IFS + IFS=: + set x $ac_tag + IFS=$ac_save_IFS + shift + ac_file=$1 + shift + + case $ac_mode in + :L) ac_source=$1;; + :[FH]) + ac_file_inputs= + for ac_f + do + case $ac_f in + -) ac_f="$ac_tmp/stdin";; + *) # Look for the file first in the build tree, then in the source tree + # (if the path is not absolute). The absolute path cannot be DOS-style, + # because $ac_f cannot contain `:'. + test -f "$ac_f" || + case $ac_f in + [\\/$]*) false;; + *) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";; + esac || + as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;; + esac + case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac + as_fn_append ac_file_inputs " '$ac_f'" + done + + # Let's still pretend it is `configure' which instantiates (i.e., don't + # use $as_me), people would be surprised to read: + # /* config.h. Generated by config.status. */ + configure_input='Generated from '` + $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g' + `' by configure.' + if test x"$ac_file" != x-; then + configure_input="$ac_file. $configure_input" + { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5 +$as_echo "$as_me: creating $ac_file" >&6;} + fi + # Neutralize special characters interpreted by sed in replacement strings. + case $configure_input in #( + *\&* | *\|* | *\\* ) + ac_sed_conf_input=`$as_echo "$configure_input" | + sed 's/[\\\\&|]/\\\\&/g'`;; #( + *) ac_sed_conf_input=$configure_input;; + esac + + case $ac_tag in + *:-:* | *:-) cat >"$ac_tmp/stdin" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;; + esac + ;; + esac + + ac_dir=`$as_dirname -- "$ac_file" || +$as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$ac_file" : 'X\(//\)[^/]' \| \ + X"$ac_file" : 'X\(//\)$' \| \ + X"$ac_file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$ac_file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir="$ac_dir"; as_fn_mkdir_p + ac_builddir=. + +case "$ac_dir" in +.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;; +*) + ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'` + # A ".." for each directory in $ac_dir_suffix. + ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'` + case $ac_top_builddir_sub in + "") ac_top_builddir_sub=. ac_top_build_prefix= ;; + *) ac_top_build_prefix=$ac_top_builddir_sub/ ;; + esac ;; +esac +ac_abs_top_builddir=$ac_pwd +ac_abs_builddir=$ac_pwd$ac_dir_suffix +# for backward compatibility: +ac_top_builddir=$ac_top_build_prefix + +case $srcdir in + .) # We are building in place. + ac_srcdir=. + ac_top_srcdir=$ac_top_builddir_sub + ac_abs_top_srcdir=$ac_pwd ;; + [\\/]* | ?:[\\/]* ) # Absolute name. + ac_srcdir=$srcdir$ac_dir_suffix; + ac_top_srcdir=$srcdir + ac_abs_top_srcdir=$srcdir ;; + *) # Relative name. + ac_srcdir=$ac_top_build_prefix$srcdir$ac_dir_suffix + ac_top_srcdir=$ac_top_build_prefix$srcdir + ac_abs_top_srcdir=$ac_pwd/$srcdir ;; +esac +ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix + + + case $ac_mode in + :F) + # + # CONFIG_FILE + # + + case $INSTALL in + [\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;; + *) ac_INSTALL=$ac_top_build_prefix$INSTALL ;; + esac + ac_MKDIR_P=$MKDIR_P + case $MKDIR_P in + [\\/$]* | ?:[\\/]* ) ;; + */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;; + esac +_ACEOF + +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +# If the template does not know about datarootdir, expand it. +# FIXME: This hack should be removed a few years after 2.60. +ac_datarootdir_hack=; ac_datarootdir_seen= +ac_sed_dataroot=' +/datarootdir/ { + p + q +} +/@datadir@/p +/@docdir@/p +/@infodir@/p +/@localedir@/p +/@mandir@/p' +case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in +*datarootdir*) ac_datarootdir_seen=yes;; +*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*) + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5 +$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;} +_ACEOF +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 + ac_datarootdir_hack=' + s&@datadir@&$datadir&g + s&@docdir@&$docdir&g + s&@infodir@&$infodir&g + s&@localedir@&$localedir&g + s&@mandir@&$mandir&g + s&\\\${datarootdir}&$datarootdir&g' ;; +esac +_ACEOF + +# Neutralize VPATH when `$srcdir' = `.'. +# Shell code in configure.ac might set extrasub. +# FIXME: do we really want to maintain this feature? +cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 +ac_sed_extra="$ac_vpsub +$extrasub +_ACEOF +cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 +:t +/@[a-zA-Z_][a-zA-Z_0-9]*@/!b +s|@configure_input@|$ac_sed_conf_input|;t t +s&@top_builddir@&$ac_top_builddir_sub&;t t +s&@top_build_prefix@&$ac_top_build_prefix&;t t +s&@srcdir@&$ac_srcdir&;t t +s&@abs_srcdir@&$ac_abs_srcdir&;t t +s&@top_srcdir@&$ac_top_srcdir&;t t +s&@abs_top_srcdir@&$ac_abs_top_srcdir&;t t +s&@builddir@&$ac_builddir&;t t +s&@abs_builddir@&$ac_abs_builddir&;t t +s&@abs_top_builddir@&$ac_abs_top_builddir&;t t +s&@INSTALL@&$ac_INSTALL&;t t +s&@MKDIR_P@&$ac_MKDIR_P&;t t +$ac_datarootdir_hack +" +eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \ + >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + +test -z "$ac_datarootdir_hack$ac_datarootdir_seen" && + { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } && + { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \ + "$ac_tmp/out"`; test -z "$ac_out"; } && + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&5 +$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir' +which seems to be undefined. Please make sure it is defined" >&2;} + + rm -f "$ac_tmp/stdin" + case $ac_file in + -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";; + *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";; + esac \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + ;; + :H) + # + # CONFIG_HEADER + # + if test x"$ac_file" != x-; then + { + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" + } >"$ac_tmp/config.h" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then + { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5 +$as_echo "$as_me: $ac_file is unchanged" >&6;} + else + rm -f "$ac_file" + mv "$ac_tmp/config.h" "$ac_file" \ + || as_fn_error $? "could not create $ac_file" "$LINENO" 5 + fi + else + $as_echo "/* $configure_input */" \ + && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \ + || as_fn_error $? "could not create -" "$LINENO" 5 + fi +# Compute "$ac_file"'s index in $config_headers. +_am_arg="$ac_file" +_am_stamp_count=1 +for _am_header in $config_headers :; do + case $_am_header in + $_am_arg | $_am_arg:* ) + break ;; + * ) + _am_stamp_count=`expr $_am_stamp_count + 1` ;; + esac +done +echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" || +$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$_am_arg" : 'X\(//\)[^/]' \| \ + X"$_am_arg" : 'X\(//\)$' \| \ + X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$_am_arg" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'`/stamp-h$_am_stamp_count + ;; + :L) + # + # CONFIG_LINK + # + + if test "$ac_source" = "$ac_file" && test "$srcdir" = '.'; then + : + else + # Prefer the file from the source tree if names are identical. + if test "$ac_source" = "$ac_file" || test ! -r "$ac_source"; then + ac_source=$srcdir/$ac_source + fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: linking $ac_source to $ac_file" >&5 +$as_echo "$as_me: linking $ac_source to $ac_file" >&6;} + + if test ! -r "$ac_source"; then + as_fn_error $? "$ac_source: file not found" "$LINENO" 5 + fi + rm -f "$ac_file" + + # Try a relative symlink, then a hard link, then a copy. + case $ac_source in + [\\/$]* | ?:[\\/]* ) ac_rel_source=$ac_source ;; + *) ac_rel_source=$ac_top_build_prefix$ac_source ;; + esac + ln -s "$ac_rel_source" "$ac_file" 2>/dev/null || + ln "$ac_source" "$ac_file" 2>/dev/null || + cp -p "$ac_source" "$ac_file" || + as_fn_error $? "cannot link or copy $ac_source to $ac_file" "$LINENO" 5 + fi + ;; + :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5 +$as_echo "$as_me: executing $ac_file commands" >&6;} + ;; + esac + + + case $ac_file$ac_mode in + "buildir":C) ac_top_srcdir="$ax_enable_builddir_srcdir" + if test ".$ax_enable_builddir" = ".." ; then + if test -f "$top_srcdir/Makefile" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: skipping top_srcdir/Makefile - left untouched" >&5 +$as_echo "$as_me: skipping top_srcdir/Makefile - left untouched" >&6;} + else + { $as_echo "$as_me:${as_lineno-$LINENO}: skipping top_srcdir/Makefile - not created" >&5 +$as_echo "$as_me: skipping top_srcdir/Makefile - not created" >&6;} + fi + else + if test -f "$ac_top_srcdir/Makefile" ; then + a=`grep "^VERSION " "$ac_top_srcdir/Makefile"` ; b=`grep "^VERSION " Makefile` + test "$a" != "$b" && rm "$ac_top_srcdir/Makefile" + fi + if test -f "$ac_top_srcdir/Makefile" ; then + echo "$ac_top_srcdir/Makefile : $ac_top_srcdir/Makefile.in" > $tmp/conftemp.mk + echo " @ echo 'REMOVED,,,' >\$@" >> $tmp/conftemp.mk + eval "${MAKE-make} -f $tmp/conftemp.mk 2>/dev/null >/dev/null" + if grep '^REMOVED,,,' "$ac_top_srcdir/Makefile" >/dev/null + then rm $ac_top_srcdir/Makefile ; fi + cp $tmp/conftemp.mk $ac_top_srcdir/makefiles.mk~ ## DEBUGGING + fi + if test ! -f "$ac_top_srcdir/Makefile" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: create top_srcdir/Makefile guessed from local Makefile" >&5 +$as_echo "$as_me: create top_srcdir/Makefile guessed from local Makefile" >&6;} + x='`' ; cat >$tmp/conftemp.sed <<_EOF +/^\$/n +x +/^\$/bS +x +/\\\\\$/{H;d;} +{H;s/.*//;x;} +bM +:S +x +/\\\\\$/{h;d;} +{h;s/.*//;x;} +:M +s/\\(\\n\\) /\\1 /g +/^ /d +/^[ ]*[\\#]/d +/^VPATH *=/d +s/^srcdir *=.*/srcdir = ./ +s/^top_srcdir *=.*/top_srcdir = ./ +/[:=]/!d +/^\\./d +/ = /b +/ .= /b +/:/!b +s/:.*/:/ +s/ / /g +s/ \\([a-z][a-z-]*[a-zA-Z0-9]\\)\\([ :]\\)/ \\1 \\1-all\\2/g +s/^\\([a-z][a-z-]*[a-zA-Z0-9]\\)\\([ :]\\)/\\1 \\1-all\\2/ +s/ / /g +/^all all-all[ :]/i\\ +all-configured : all-all +s/ [a-zA-Z0-9-]*-all [a-zA-Z0-9-]*-all-all//g +/-all-all/d +a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh $ax_enable_builddir_auxdir/config.guess $x \\\\\\ + ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ + ; use=$x basename "\$\@" -all $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$n * \$\@"; if test "\$\$n" = "0" ; then : \\\\\\ + ; BUILD=$x grep "^####.*|" Makefile |tail -1| sed -e 's/.*|//' $x ; fi \\\\\\ + ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\ + ; test "\$\$use" = "\$\@" && BUILD=$x echo "\$\$BUILD" | tail -1 $x \\\\\\ + ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; (cd "\$\$i" && test ! -f configure && \$(MAKE) \$\$use) || exit; done +/dist-all *:/a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh $ax_enable_builddir_auxdir/config.guess $x \\\\\\ + ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ + ; found=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).tar.*" \\\\\\ + ; if test "\$\$found" = "0" ; then : \\\\\\ + ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\ + ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).tar.* \\\\\\ + ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done +/dist-[a-zA-Z0-9]*-all *:/a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh ./config.guess $x \\\\\\ + ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ + ; found=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).*" \\\\\\ + ; if test "\$\$found" = "0" ; then : \\\\\\ + ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\ + ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).* \\\\\\ + ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done +/distclean-all *:/a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh $ax_enable_builddir_auxdir/config.guess $x \\\\\\ + ; BUILD=$x grep "^#### .*|" Makefile | sed -e 's/.*|//' $x \\\\\\ + ; use=$x basename "\$\@" -all $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$n * \$\@ (all local builds)" \\\\\\ + ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\ + ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; echo "# rm -r \$\$i"; done ; echo "# (sleep 3)" ; sleep 3 \\\\\\ + ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; echo "\$\$i" | grep "^/" > /dev/null && continue \\\\\\ + ; echo "\$\$i" | grep "^../" > /dev/null && continue \\\\\\ + ; echo "rm -r \$\$i"; (rm -r "\$\$i") ; done ; rm Makefile +_EOF + cp "$tmp/conftemp.sed" "$ac_top_srcdir/makefile.sed~" ## DEBUGGING + $ax_enable_builddir_sed -f $tmp/conftemp.sed Makefile >$ac_top_srcdir/Makefile + if test -f "$ac_top_srcdir/Makefile.mk" ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: extend top_srcdir/Makefile with top_srcdir/Makefile.mk" >&5 +$as_echo "$as_me: extend top_srcdir/Makefile with top_srcdir/Makefile.mk" >&6;} + cat $ac_top_srcdir/Makefile.mk >>$ac_top_srcdir/Makefile + fi ; xxxx="####" + echo "$xxxx CONFIGURATIONS FOR TOPLEVEL MAKEFILE: " >>$ac_top_srcdir/Makefile + # sanity check + if grep '^; echo "MAKE ' $ac_top_srcdir/Makefile >/dev/null ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: buggy sed found - it deletes tab in \"a\" text parts" >&5 +$as_echo "$as_me: buggy sed found - it deletes tab in \"a\" text parts" >&6;} + $ax_enable_builddir_sed -e '/^@ HOST=/s/^/ /' -e '/^; /s/^/ /' $ac_top_srcdir/Makefile \ + >$ac_top_srcdir/Makefile~ + (test -s $ac_top_srcdir/Makefile~ && mv $ac_top_srcdir/Makefile~ $ac_top_srcdir/Makefile) 2>/dev/null + fi + else + xxxx="\\#\\#\\#\\#" + # echo "/^$xxxx *$ax_enable_builddir_host /d" >$tmp/conftemp.sed + echo "s!^$xxxx [^|]* | *$ax_enable_builddir *\$!$xxxx ...... $ax_enable_builddir!" >$tmp/conftemp.sed + $ax_enable_builddir_sed -f "$tmp/conftemp.sed" "$ac_top_srcdir/Makefile" >$tmp/mkfile.tmp + cp "$tmp/conftemp.sed" "$ac_top_srcdir/makefiles.sed~" ## DEBUGGING + cp "$tmp/mkfile.tmp" "$ac_top_srcdir/makefiles.out~" ## DEBUGGING + if cmp -s "$ac_top_srcdir/Makefile" "$tmp/mkfile.tmp" 2>/dev/null ; then + { $as_echo "$as_me:${as_lineno-$LINENO}: keeping top_srcdir/Makefile from earlier configure" >&5 +$as_echo "$as_me: keeping top_srcdir/Makefile from earlier configure" >&6;} + rm "$tmp/mkfile.tmp" + else + { $as_echo "$as_me:${as_lineno-$LINENO}: reusing top_srcdir/Makefile from earlier configure" >&5 +$as_echo "$as_me: reusing top_srcdir/Makefile from earlier configure" >&6;} + mv "$tmp/mkfile.tmp" "$ac_top_srcdir/Makefile" + fi + fi + { $as_echo "$as_me:${as_lineno-$LINENO}: build in $ax_enable_builddir (HOST=$ax_enable_builddir_host)" >&5 +$as_echo "$as_me: build in $ax_enable_builddir (HOST=$ax_enable_builddir_host)" >&6;} + xxxx="####" + echo "$xxxx" "$ax_enable_builddir_host" "|$ax_enable_builddir" >>$ac_top_srcdir/Makefile + fi + ;; + "depfiles":C) test x"$AMDEP_TRUE" != x"" || { + # Autoconf 2.62 quotes --file arguments for eval, but not when files + # are listed without --file. Let's play safe and only enable the eval + # if we detect the quoting. + case $CONFIG_FILES in + *\'*) eval set x "$CONFIG_FILES" ;; + *) set x $CONFIG_FILES ;; + esac + shift + for mf + do + # Strip MF so we end up with the name of the file. + mf=`echo "$mf" | sed -e 's/:.*$//'` + # Check whether this is an Automake generated Makefile or not. + # We used to match only the files named `Makefile.in', but + # some people rename them; so instead we look at the file content. + # Grep'ing the first line is not enough: some people post-process + # each Makefile.in and add a new line on top of each file to say so. + # Grep'ing the whole file is not good either: AIX grep has a line + # limit of 2048, but all sed's we know have understand at least 4000. + if sed -n 's,^#.*generated by automake.*,X,p' "$mf" | grep X >/dev/null 2>&1; then + dirpart=`$as_dirname -- "$mf" || +$as_expr X"$mf" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$mf" : 'X\(//\)[^/]' \| \ + X"$mf" : 'X\(//\)$' \| \ + X"$mf" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$mf" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + else + continue + fi + # Extract the definition of DEPDIR, am__include, and am__quote + # from the Makefile without running `make'. + DEPDIR=`sed -n 's/^DEPDIR = //p' < "$mf"` + test -z "$DEPDIR" && continue + am__include=`sed -n 's/^am__include = //p' < "$mf"` + test -z "am__include" && continue + am__quote=`sed -n 's/^am__quote = //p' < "$mf"` + # When using ansi2knr, U may be empty or an underscore; expand it + U=`sed -n 's/^U = //p' < "$mf"` + # Find all dependency output files, they are included files with + # $(DEPDIR) in their names. We invoke sed twice because it is the + # simplest approach to changing $(DEPDIR) to its actual value in the + # expansion. + for file in `sed -n " + s/^$am__include $am__quote\(.*(DEPDIR).*\)$am__quote"'$/\1/p' <"$mf" | \ + sed -e 's/\$(DEPDIR)/'"$DEPDIR"'/g' -e 's/\$U/'"$U"'/g'`; do + # Make sure the directory exists. + test -f "$dirpart/$file" && continue + fdir=`$as_dirname -- "$file" || +$as_expr X"$file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$file" : 'X\(//\)[^/]' \| \ + X"$file" : 'X\(//\)$' \| \ + X"$file" : 'X\(/\)' \| . 2>/dev/null || +$as_echo X"$file" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q'` + as_dir=$dirpart/$fdir; as_fn_mkdir_p + # echo "creating $dirpart/$file" + echo '# dummy' > "$dirpart/$file" + done + done +} + ;; + "libtool":C) + + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, +# Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + +# The names of the tagged configurations supported by this script. +available_tags="" + +# ### BEGIN LIBTOOL CONFIG + +# Which release of libtool.m4 was used? +macro_version=$macro_version +macro_revision=$macro_revision + +# Whether or not to build shared libraries. +build_libtool_libs=$enable_shared + +# Whether or not to build static libraries. +build_old_libs=$enable_static + +# What type of objects to build. +pic_mode=$pic_mode + +# Whether or not to optimize for fast installation. +fast_install=$enable_fast_install + +# Shell to use when invoking shell scripts. +SHELL=$lt_SHELL + +# An echo program that protects backslashes. +ECHO=$lt_ECHO + +# The host system. +host_alias=$host_alias +host=$host +host_os=$host_os + +# The build system. +build_alias=$build_alias +build=$build +build_os=$build_os + +# A sed program that does not truncate output. +SED=$lt_SED + +# Sed that helps us avoid accidentally triggering echo(1) options like -n. +Xsed="\$SED -e 1s/^X//" + +# A grep program that handles long lines. +GREP=$lt_GREP + +# An ERE matcher. +EGREP=$lt_EGREP + +# A literal string matcher. +FGREP=$lt_FGREP + +# A BSD- or MS-compatible name lister. +NM=$lt_NM + +# Whether we need soft or hard links. +LN_S=$lt_LN_S + +# What is the maximum length of a command? +max_cmd_len=$max_cmd_len + +# Object file suffix (normally "o"). +objext=$ac_objext + +# Executable file suffix (normally ""). +exeext=$exeext + +# whether the shell understands "unset". +lt_unset=$lt_unset + +# turn spaces into newlines. +SP2NL=$lt_lt_SP2NL + +# turn newlines into spaces. +NL2SP=$lt_lt_NL2SP + +# convert \$build file names to \$host format. +to_host_file_cmd=$lt_cv_to_host_file_cmd + +# convert \$build files to toolchain format. +to_tool_file_cmd=$lt_cv_to_tool_file_cmd + +# An object symbol dumper. +OBJDUMP=$lt_OBJDUMP + +# Method to check whether dependent libraries are shared objects. +deplibs_check_method=$lt_deplibs_check_method + +# Command to use when deplibs_check_method = "file_magic". +file_magic_cmd=$lt_file_magic_cmd + +# How to find potential files when deplibs_check_method = "file_magic". +file_magic_glob=$lt_file_magic_glob + +# Find potential files using nocaseglob when deplibs_check_method = "file_magic". +want_nocaseglob=$lt_want_nocaseglob + +# DLL creation program. +DLLTOOL=$lt_DLLTOOL + +# Command to associate shared and link libraries. +sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd + +# The archiver. +AR=$lt_AR + +# Flags to create an archive. +AR_FLAGS=$lt_AR_FLAGS + +# How to feed a file listing to the archiver. +archiver_list_spec=$lt_archiver_list_spec + +# A symbol stripping program. +STRIP=$lt_STRIP + +# Commands used to install an old-style archive. +RANLIB=$lt_RANLIB +old_postinstall_cmds=$lt_old_postinstall_cmds +old_postuninstall_cmds=$lt_old_postuninstall_cmds + +# Whether to use a lock for old archive extraction. +lock_old_archive_extraction=$lock_old_archive_extraction + +# A C compiler. +LTCC=$lt_CC + +# LTCC compiler flags. +LTCFLAGS=$lt_CFLAGS + +# Take the output of nm and produce a listing of raw symbols and C names. +global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe + +# Transform the output of nm in a proper C declaration. +global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl + +# Transform the output of nm in a C name address pair. +global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address + +# Transform the output of nm in a C name address pair when lib prefix is needed. +global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix + +# Specify filename containing input files for \$NM. +nm_file_list_spec=$lt_nm_file_list_spec + +# The root where to search for dependent libraries,and in which our libraries should be installed. +lt_sysroot=$lt_sysroot + +# The name of the directory that contains temporary libtool files. +objdir=$objdir + +# Used to examine libraries when file_magic_cmd begins with "file". +MAGIC_CMD=$MAGIC_CMD + +# Must we lock files when doing compilation? +need_locks=$lt_need_locks + +# Manifest tool. +MANIFEST_TOOL=$lt_MANIFEST_TOOL + +# Tool to manipulate archived DWARF debug symbol files on Mac OS X. +DSYMUTIL=$lt_DSYMUTIL + +# Tool to change global to local symbols on Mac OS X. +NMEDIT=$lt_NMEDIT + +# Tool to manipulate fat objects and archives on Mac OS X. +LIPO=$lt_LIPO + +# ldd/readelf like tool for Mach-O binaries on Mac OS X. +OTOOL=$lt_OTOOL + +# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4. +OTOOL64=$lt_OTOOL64 + +# Old archive suffix (normally "a"). +libext=$libext + +# Shared library suffix (normally ".so"). +shrext_cmds=$lt_shrext_cmds + +# The commands to extract the exported symbol list from a shared archive. +extract_expsyms_cmds=$lt_extract_expsyms_cmds + +# Variables whose values should be saved in libtool wrapper scripts and +# restored at link time. +variables_saved_for_relink=$lt_variables_saved_for_relink + +# Do we need the "lib" prefix for modules? +need_lib_prefix=$need_lib_prefix + +# Do we need a version for libraries? +need_version=$need_version + +# Library versioning type. +version_type=$version_type + +# Shared library runtime path variable. +runpath_var=$runpath_var + +# Shared library path variable. +shlibpath_var=$shlibpath_var + +# Is shlibpath searched before the hard-coded library search path? +shlibpath_overrides_runpath=$shlibpath_overrides_runpath + +# Format of library name prefix. +libname_spec=$lt_libname_spec + +# List of archive names. First name is the real one, the rest are links. +# The last name is the one that the linker finds with -lNAME +library_names_spec=$lt_library_names_spec + +# The coded name of the library, if different from the real name. +soname_spec=$lt_soname_spec + +# Permission mode override for installation of shared libraries. +install_override_mode=$lt_install_override_mode + +# Command to use after installation of a shared archive. +postinstall_cmds=$lt_postinstall_cmds + +# Command to use after uninstallation of a shared archive. +postuninstall_cmds=$lt_postuninstall_cmds + +# Commands used to finish a libtool library installation in a directory. +finish_cmds=$lt_finish_cmds + +# As "finish_cmds", except a single script fragment to be evaled but +# not shown. +finish_eval=$lt_finish_eval + +# Whether we should hardcode library paths into libraries. +hardcode_into_libs=$hardcode_into_libs + +# Compile-time system search path for libraries. +sys_lib_search_path_spec=$lt_sys_lib_search_path_spec + +# Run-time system search path for libraries. +sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec + +# Whether dlopen is supported. +dlopen_support=$enable_dlopen + +# Whether dlopen of programs is supported. +dlopen_self=$enable_dlopen_self + +# Whether dlopen of statically linked programs is supported. +dlopen_self_static=$enable_dlopen_self_static + +# Commands to strip libraries. +old_striplib=$lt_old_striplib +striplib=$lt_striplib + + +# The linker used to build libraries. +LD=$lt_LD + +# How to create reloadable object files. +reload_flag=$lt_reload_flag +reload_cmds=$lt_reload_cmds + +# Commands used to build an old-style archive. +old_archive_cmds=$lt_old_archive_cmds + +# A language specific compiler. +CC=$lt_compiler + +# Is the compiler the GNU compiler? +with_gcc=$GCC + +# Compiler flag to turn off builtin functions. +no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag + +# Additional compiler flags for building library objects. +pic_flag=$lt_lt_prog_compiler_pic + +# How to pass a linker flag through the compiler. +wl=$lt_lt_prog_compiler_wl + +# Compiler flag to prevent dynamic linking. +link_static_flag=$lt_lt_prog_compiler_static + +# Does compiler simultaneously support -c and -o options? +compiler_c_o=$lt_lt_cv_prog_compiler_c_o + +# Whether or not to add -lc for building shared libraries. +build_libtool_need_lc=$archive_cmds_need_lc + +# Whether or not to disallow shared libs when runtime libs are static. +allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes + +# Compiler flag to allow reflexive dlopens. +export_dynamic_flag_spec=$lt_export_dynamic_flag_spec + +# Compiler flag to generate shared objects directly from archives. +whole_archive_flag_spec=$lt_whole_archive_flag_spec + +# Whether the compiler copes with passing no objects directly. +compiler_needs_object=$lt_compiler_needs_object + +# Create an old-style archive from a shared archive. +old_archive_from_new_cmds=$lt_old_archive_from_new_cmds + +# Create a temporary old-style archive to link instead of a shared archive. +old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds + +# Commands used to build a shared archive. +archive_cmds=$lt_archive_cmds +archive_expsym_cmds=$lt_archive_expsym_cmds + +# Commands used to build a loadable module if different from building +# a shared archive. +module_cmds=$lt_module_cmds +module_expsym_cmds=$lt_module_expsym_cmds + +# Whether we are building with GNU ld or not. +with_gnu_ld=$lt_with_gnu_ld + +# Flag that allows shared libraries with undefined symbols to be built. +allow_undefined_flag=$lt_allow_undefined_flag + +# Flag that enforces no undefined symbols. +no_undefined_flag=$lt_no_undefined_flag + +# Flag to hardcode \$libdir into a binary during linking. +# This must work even if \$libdir does not exist +hardcode_libdir_flag_spec=$lt_hardcode_libdir_flag_spec + +# If ld is used when linking, flag to hardcode \$libdir into a binary +# during linking. This must work even if \$libdir does not exist. +hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld + +# Whether we need a single "-rpath" flag with a separated argument. +hardcode_libdir_separator=$lt_hardcode_libdir_separator + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary. +hardcode_direct=$hardcode_direct + +# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes +# DIR into the resulting binary and the resulting library dependency is +# "absolute",i.e impossible to change by setting \${shlibpath_var} if the +# library is relocated. +hardcode_direct_absolute=$hardcode_direct_absolute + +# Set to "yes" if using the -LDIR flag during linking hardcodes DIR +# into the resulting binary. +hardcode_minus_L=$hardcode_minus_L + +# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR +# into the resulting binary. +hardcode_shlibpath_var=$hardcode_shlibpath_var + +# Set to "yes" if building a shared library automatically hardcodes DIR +# into the library and all subsequent libraries and executables linked +# against it. +hardcode_automatic=$hardcode_automatic + +# Set to yes if linker adds runtime paths of dependent libraries +# to runtime path list. +inherit_rpath=$inherit_rpath + +# Whether libtool must link a program against all its dependency libraries. +link_all_deplibs=$link_all_deplibs + +# Set to "yes" if exported symbols are required. +always_export_symbols=$always_export_symbols + +# The commands to list exported symbols. +export_symbols_cmds=$lt_export_symbols_cmds + +# Symbols that should not be listed in the preloaded symbols. +exclude_expsyms=$lt_exclude_expsyms + +# Symbols that must always be exported. +include_expsyms=$lt_include_expsyms + +# Commands necessary for linking programs (against libraries) with templates. +prelink_cmds=$lt_prelink_cmds + +# Commands necessary for finishing linking programs. +postlink_cmds=$lt_postlink_cmds + +# Specify filename containing input files. +file_list_spec=$lt_file_list_spec + +# How to hardcode a shared library path into an executable. +hardcode_action=$hardcode_action + +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + +ltmain="$ac_aux_dir/ltmain.sh" + + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + if test x"$xsi_shell" = xyes; then + sed -e '/^func_dirname ()$/,/^} # func_dirname /c\ +func_dirname ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_basename ()$/,/^} # func_basename /c\ +func_basename ()\ +{\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\ +func_dirname_and_basename ()\ +{\ +\ case ${1} in\ +\ */*) func_dirname_result="${1%/*}${2}" ;;\ +\ * ) func_dirname_result="${3}" ;;\ +\ esac\ +\ func_basename_result="${1##*/}"\ +} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_stripname ()$/,/^} # func_stripname /c\ +func_stripname ()\ +{\ +\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\ +\ # positional parameters, so assign one to ordinary parameter first.\ +\ func_stripname_result=${3}\ +\ func_stripname_result=${func_stripname_result#"${1}"}\ +\ func_stripname_result=${func_stripname_result%"${2}"}\ +} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\ +func_split_long_opt ()\ +{\ +\ func_split_long_opt_name=${1%%=*}\ +\ func_split_long_opt_arg=${1#*=}\ +} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\ +func_split_short_opt ()\ +{\ +\ func_split_short_opt_arg=${1#??}\ +\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\ +} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\ +func_lo2o ()\ +{\ +\ case ${1} in\ +\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\ +\ *) func_lo2o_result=${1} ;;\ +\ esac\ +} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_xform ()$/,/^} # func_xform /c\ +func_xform ()\ +{\ + func_xform_result=${1%.*}.lo\ +} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_arith ()$/,/^} # func_arith /c\ +func_arith ()\ +{\ + func_arith_result=$(( $* ))\ +} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_len ()$/,/^} # func_len /c\ +func_len ()\ +{\ + func_len_result=${#1}\ +} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + +fi + +if test x"$lt_shell_append" = xyes; then + sed -e '/^func_append ()$/,/^} # func_append /c\ +func_append ()\ +{\ + eval "${1}+=\\${2}"\ +} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\ +func_append_quoted ()\ +{\ +\ func_quote_for_eval "${2}"\ +\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\ +} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: + + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5 +$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;} +fi + + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" + + ;; + "include":C) test -d include || mkdir include ;; + "src":C) +test -d src || mkdir src +test -d src/$TARGETDIR || mkdir src/$TARGETDIR + ;; + + esac +done # for ac_tag + + +as_fn_exit 0 +_ACEOF +ac_clean_files=$ac_clean_files_save + +test $ac_write_fail = 0 || + as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5 + + +# configure is writing to config.log, and then calls config.status. +# config.status does its own redirection, appending to config.log. +# Unfortunately, on DOS this fails, as config.log is still kept open +# by configure, so config.status won't be able to write to it; its +# output is simply discarded. So we exec the FD to /dev/null, +# effectively closing config.log, so it can be properly (re)opened and +# appended to by config.status. When coming back to configure, we +# need to make the FD available again. +if test "$no_create" != yes; then + ac_cs_success=: + ac_config_status_args= + test "$silent" = yes && + ac_config_status_args="$ac_config_status_args --quiet" + exec 5>/dev/null + $SHELL $CONFIG_STATUS $ac_config_status_args || ac_cs_success=false + exec 5>>config.log + # Use ||, not &&, to avoid exiting from the if with $? = 1, which + # would make configure fail if this is the last instruction. + $ac_cs_success || as_fn_exit 1 +fi +if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then + { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5 +$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;} +fi + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/configure.ac b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/configure.ac new file mode 100644 index 000000000..2d92d3376 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/configure.ac @@ -0,0 +1,496 @@ +dnl Process this with autoconf to create configure + +AC_PREREQ(2.63) + +AC_INIT([libffi], [3.0.10], [http://sourceware.org/libffi.html]) +AC_CONFIG_HEADERS([fficonfig.h]) + +AC_CANONICAL_SYSTEM +target_alias=${target_alias-$host_alias} + +. ${srcdir}/configure.host + +AX_ENABLE_BUILDDIR + +AM_INIT_AUTOMAKE + +# The same as in boehm-gc and libstdc++. Have to borrow it from there. +# We must force CC to /not/ be precious variables; otherwise +# the wrong, non-multilib-adjusted value will be used in multilibs. +# As a side effect, we have to subst CFLAGS ourselves. +# Also save and restore CFLAGS, since AC_PROG_CC will come up with +# defaults of its own if none are provided. + +m4_rename([_AC_ARG_VAR_PRECIOUS],[real_PRECIOUS]) +m4_define([_AC_ARG_VAR_PRECIOUS],[]) +save_CFLAGS=$CFLAGS +AC_PROG_CC +CFLAGS=$save_CFLAGS +m4_undefine([_AC_ARG_VAR_PRECIOUS]) +m4_rename([real_PRECIOUS],[_AC_ARG_VAR_PRECIOUS]) + +AC_SUBST(CFLAGS) + +AM_PROG_AS +AM_PROG_CC_C_O +AC_PROG_LIBTOOL +AC_CONFIG_MACRO_DIR([m4]) + +AX_CC_MAXOPT +AX_CFLAGS_WARN_ALL +if test "x$GCC" = "xyes"; then + CFLAGS="$CFLAGS -fexceptions" +fi + +AM_MAINTAINER_MODE + +AC_CHECK_HEADERS(sys/mman.h) +AC_CHECK_FUNCS(mmap) +AC_FUNC_MMAP_BLACKLIST + +dnl The -no-testsuite modules omit the test subdir. +AM_CONDITIONAL(TESTSUBDIR, test -d $srcdir/testsuite) + +TARGETDIR="unknown" +case "$host" in + alpha*-*-*) + TARGET=ALPHA; TARGETDIR=alpha; + # Support 128-bit long double, changeable via command-line switch. + HAVE_LONG_DOUBLE='defined(__LONG_DOUBLE_128__)' + ;; + + arm*-*-*) + TARGET=ARM; TARGETDIR=arm + ;; + + amd64-*-freebsd* | amd64-*-openbsd*) + TARGET=X86_64; TARGETDIR=x86 + ;; + + amd64-*-freebsd*) + TARGET=X86_64; TARGETDIR=x86 + ;; + + avr32*-*-*) + TARGET=AVR32; TARGETDIR=avr32 + ;; + + cris-*-*) + TARGET=LIBFFI_CRIS; TARGETDIR=cris + ;; + + frv-*-*) + TARGET=FRV; TARGETDIR=frv + ;; + + hppa*-*-linux* | parisc*-*-linux* | hppa*-*-openbsd*) + TARGET=PA_LINUX; TARGETDIR=pa + ;; + hppa*64-*-hpux*) + TARGET=PA64_HPUX; TARGETDIR=pa + ;; + hppa*-*-hpux*) + TARGET=PA_HPUX; TARGETDIR=pa + ;; + + i?86-*-freebsd* | i?86-*-openbsd*) + TARGET=X86_FREEBSD; TARGETDIR=x86 + ;; + i?86-win32* | i?86-*-cygwin* | i?86-*-mingw* | i?86-*-os2* | i?86-*-interix*) + TARGET=X86_WIN32; TARGETDIR=x86 + # All mingw/cygwin/win32 builds require -no-undefined for sharedlib. + # We must also check with_cross_host to decide if this is a native + # or cross-build and select where to install dlls appropriately. + if test -n "$with_cross_host" && + test x"$with_cross_host" != x"no"; then + AM_LTLDFLAGS='-no-undefined -bindir "$(toolexeclibdir)"'; + else + AM_LTLDFLAGS='-no-undefined -bindir "$(bindir)"'; + fi + ;; + i?86-*-darwin*) + TARGET=X86_DARWIN; TARGETDIR=x86 + ;; + i?86-*-solaris2.1[[0-9]]*) + TARGET=X86_64; TARGETDIR=x86 + ;; + i?86-*-*) + TARGET=X86; TARGETDIR=x86 + ;; + + ia64*-*-*) + TARGET=IA64; TARGETDIR=ia64 + ;; + + m32r*-*-*) + TARGET=M32R; TARGETDIR=m32r + ;; + + m68k-*-*) + TARGET=M68K; TARGETDIR=m68k + ;; + + mips-sgi-irix5.* | mips-sgi-irix6.* | mips*-*-rtems*) + TARGET=MIPS; TARGETDIR=mips + ;; + mips*-*-linux* | mips*-*-openbsd*) + # Support 128-bit long double for NewABI. + HAVE_LONG_DOUBLE='defined(__mips64)' + TARGET=MIPS; TARGETDIR=mips + ;; + + powerpc*-*-linux* | powerpc-*-sysv*) + TARGET=POWERPC; TARGETDIR=powerpc + ;; + powerpc-*-beos*) + TARGET=POWERPC; TARGETDIR=powerpc + ;; + powerpc-*-darwin* | powerpc64-*-darwin*) + TARGET=POWERPC_DARWIN; TARGETDIR=powerpc + ;; + powerpc-*-aix* | rs6000-*-aix*) + TARGET=POWERPC_AIX; TARGETDIR=powerpc + ;; + powerpc-*-freebsd* | powerpc-*-openbsd*) + TARGET=POWERPC_FREEBSD; TARGETDIR=powerpc + ;; + powerpc64-*-freebsd*) + TARGET=POWERPC; TARGETDIR=powerpc + ;; + powerpc*-*-rtems*) + TARGET=POWERPC; TARGETDIR=powerpc + ;; + + s390-*-* | s390x-*-*) + TARGET=S390; TARGETDIR=s390 + ;; + + sh-*-* | sh[[34]]*-*-*) + TARGET=SH; TARGETDIR=sh + ;; + sh64-*-* | sh5*-*-*) + TARGET=SH64; TARGETDIR=sh64 + ;; + + sparc*-*-*) + TARGET=SPARC; TARGETDIR=sparc + ;; + + x86_64-*-darwin*) + TARGET=X86_DARWIN; TARGETDIR=x86 + ;; + + x86_64-*-cygwin* | x86_64-*-mingw*) + TARGET=X86_WIN64; TARGETDIR=x86 + ;; + + x86_64-*-*) + TARGET=X86_64; TARGETDIR=x86 + ;; +esac + +AC_SUBST(AM_RUNTESTFLAGS) +AC_SUBST(AM_LTLDFLAGS) + +if test $TARGETDIR = unknown; then + AC_MSG_ERROR(["libffi has not been ported to $host."]) +fi + +AM_CONDITIONAL(MIPS, test x$TARGET = xMIPS) +AM_CONDITIONAL(SPARC, test x$TARGET = xSPARC) +AM_CONDITIONAL(X86, test x$TARGET = xX86) +AM_CONDITIONAL(X86_FREEBSD, test x$TARGET = xX86_FREEBSD) +AM_CONDITIONAL(X86_WIN32, test x$TARGET = xX86_WIN32) +AM_CONDITIONAL(X86_WIN64, test x$TARGET = xX86_WIN64) +AM_CONDITIONAL(X86_DARWIN, test x$TARGET = xX86_DARWIN) +AM_CONDITIONAL(ALPHA, test x$TARGET = xALPHA) +AM_CONDITIONAL(IA64, test x$TARGET = xIA64) +AM_CONDITIONAL(M32R, test x$TARGET = xM32R) +AM_CONDITIONAL(M68K, test x$TARGET = xM68K) +AM_CONDITIONAL(MOXIE, test x$TARGET = xMOXIE) +AM_CONDITIONAL(POWERPC, test x$TARGET = xPOWERPC) +AM_CONDITIONAL(POWERPC_AIX, test x$TARGET = xPOWERPC_AIX) +AM_CONDITIONAL(POWERPC_DARWIN, test x$TARGET = xPOWERPC_DARWIN) +AM_CONDITIONAL(POWERPC_FREEBSD, test x$TARGET = xPOWERPC_FREEBSD) +AM_CONDITIONAL(ARM, test x$TARGET = xARM) +AM_CONDITIONAL(AVR32, test x$TARGET = xAVR32) +AM_CONDITIONAL(LIBFFI_CRIS, test x$TARGET = xLIBFFI_CRIS) +AM_CONDITIONAL(FRV, test x$TARGET = xFRV) +AM_CONDITIONAL(S390, test x$TARGET = xS390) +AM_CONDITIONAL(X86_64, test x$TARGET = xX86_64) +AM_CONDITIONAL(SH, test x$TARGET = xSH) +AM_CONDITIONAL(SH64, test x$TARGET = xSH64) +AM_CONDITIONAL(PA_LINUX, test x$TARGET = xPA_LINUX) +AM_CONDITIONAL(PA_HPUX, test x$TARGET = xPA_HPUX) +AM_CONDITIONAL(PA64_HPUX, test x$TARGET = xPA64_HPUX) + +AC_HEADER_STDC +AC_CHECK_FUNCS(memcpy) +AC_FUNC_ALLOCA + +AC_CHECK_SIZEOF(double) +AC_CHECK_SIZEOF(long double) + +# Also AC_SUBST this variable for ffi.h. +if test -z "$HAVE_LONG_DOUBLE"; then + HAVE_LONG_DOUBLE=0 + if test $ac_cv_sizeof_double != $ac_cv_sizeof_long_double; then + if test $ac_cv_sizeof_long_double != 0; then + HAVE_LONG_DOUBLE=1 + AC_DEFINE(HAVE_LONG_DOUBLE, 1, [Define if you have the long double type and it is bigger than a double]) + fi + fi +fi +AC_SUBST(HAVE_LONG_DOUBLE) + +AC_C_BIGENDIAN + +AC_CACHE_CHECK([assembler .cfi pseudo-op support], + libffi_cv_as_cfi_pseudo_op, [ + libffi_cv_as_cfi_pseudo_op=unknown + AC_TRY_COMPILE([asm (".cfi_startproc\n\t.cfi_endproc");],, + [libffi_cv_as_cfi_pseudo_op=yes], + [libffi_cv_as_cfi_pseudo_op=no]) +]) +if test "x$libffi_cv_as_cfi_pseudo_op" = xyes; then + AC_DEFINE(HAVE_AS_CFI_PSEUDO_OP, 1, + [Define if your assembler supports .cfi_* directives.]) +fi + +if test x$TARGET = xSPARC; then + AC_CACHE_CHECK([assembler and linker support unaligned pc related relocs], + libffi_cv_as_sparc_ua_pcrel, [ + save_CFLAGS="$CFLAGS" + save_LDFLAGS="$LDFLAGS" + CFLAGS="$CFLAGS -fpic" + LDFLAGS="$LDFLAGS -shared" + AC_TRY_LINK([asm (".text; foo: nop; .data; .align 4; .byte 0; .uaword %r_disp32(foo); .text");],, + [libffi_cv_as_sparc_ua_pcrel=yes], + [libffi_cv_as_sparc_ua_pcrel=no]) + CFLAGS="$save_CFLAGS" + LDFLAGS="$save_LDFLAGS"]) + if test "x$libffi_cv_as_sparc_ua_pcrel" = xyes; then + AC_DEFINE(HAVE_AS_SPARC_UA_PCREL, 1, + [Define if your assembler and linker support unaligned PC relative relocs.]) + fi + + AC_CACHE_CHECK([assembler .register pseudo-op support], + libffi_cv_as_register_pseudo_op, [ + libffi_cv_as_register_pseudo_op=unknown + # Check if we have .register + AC_TRY_COMPILE([asm (".register %g2, #scratch");],, + [libffi_cv_as_register_pseudo_op=yes], + [libffi_cv_as_register_pseudo_op=no]) + ]) + if test "x$libffi_cv_as_register_pseudo_op" = xyes; then + AC_DEFINE(HAVE_AS_REGISTER_PSEUDO_OP, 1, + [Define if your assembler supports .register.]) + fi +fi + +if test x$TARGET = xX86 || test x$TARGET = xX86_WIN32 || test x$TARGET = xX86_64; then + AC_CACHE_CHECK([assembler supports pc related relocs], + libffi_cv_as_x86_pcrel, [ + libffi_cv_as_x86_pcrel=no + echo '.text; foo: nop; .data; .long foo-.; .text' > conftest.s + if $CC $CFLAGS -c conftest.s > /dev/null; then + libffi_cv_as_x86_pcrel=yes + fi + ]) + if test "x$libffi_cv_as_x86_pcrel" = xyes; then + AC_DEFINE(HAVE_AS_X86_PCREL, 1, + [Define if your assembler supports PC relative relocs.]) + fi + + AC_CACHE_CHECK([assembler .ascii pseudo-op support], + libffi_cv_as_ascii_pseudo_op, [ + libffi_cv_as_ascii_pseudo_op=unknown + # Check if we have .ascii + AC_TRY_COMPILE([asm (".ascii \\"string\\"");],, + [libffi_cv_as_ascii_pseudo_op=yes], + [libffi_cv_as_ascii_pseudo_op=no]) + ]) + if test "x$libffi_cv_as_ascii_pseudo_op" = xyes; then + AC_DEFINE(HAVE_AS_ASCII_PSEUDO_OP, 1, + [Define if your assembler supports .ascii.]) + fi + + AC_CACHE_CHECK([assembler .string pseudo-op support], + libffi_cv_as_string_pseudo_op, [ + libffi_cv_as_string_pseudo_op=unknown + # Check if we have .string + AC_TRY_COMPILE([asm (".string \\"string\\"");],, + [libffi_cv_as_string_pseudo_op=yes], + [libffi_cv_as_string_pseudo_op=no]) + ]) + if test "x$libffi_cv_as_string_pseudo_op" = xyes; then + AC_DEFINE(HAVE_AS_STRING_PSEUDO_OP, 1, + [Define if your assembler supports .string.]) + fi +fi + +if test x$TARGET = xX86_WIN64; then + LT_SYS_SYMBOL_USCORE + if test "x$sys_symbol_underscore" = xyes; then + AC_DEFINE(SYMBOL_UNDERSCORE, 1, [Define if symbols are underscored.]) + fi +fi + + +FFI_EXEC_TRAMPOLINE_TABLE=0 +case "$target" in + *arm*-apple-darwin*) + FFI_EXEC_TRAMPOLINE_TABLE=1 + AC_DEFINE(FFI_EXEC_TRAMPOLINE_TABLE, 1, + [Cannot use PROT_EXEC on this target, so, we revert to + alternative means]) + ;; + *-apple-darwin10* | *-*-freebsd* | *-*-openbsd* | *-pc-solaris*) + AC_DEFINE(FFI_MMAP_EXEC_WRIT, 1, + [Cannot use malloc on this target, so, we revert to + alternative means]) + ;; +esac +AM_CONDITIONAL(FFI_EXEC_TRAMPOLINE_TABLE, test x$FFI_EXEC_TRAMPOLINE_TABLE = x1) +AC_SUBST(FFI_EXEC_TRAMPOLINE_TABLE) + +if test x$TARGET = xX86_64; then + AC_CACHE_CHECK([assembler supports unwind section type], + libffi_cv_as_x86_64_unwind_section_type, [ + libffi_cv_as_x86_64_unwind_section_type=yes + echo '.section .eh_frame,"a",@unwind' > conftest.s + if $CC $CFLAGS -c conftest.s 2>&1 | grep -i warning > /dev/null; then + libffi_cv_as_x86_64_unwind_section_type=no + fi + ]) + if test "x$libffi_cv_as_x86_64_unwind_section_type" = xyes; then + AC_DEFINE(HAVE_AS_X86_64_UNWIND_SECTION_TYPE, 1, + [Define if your assembler supports unwind section type.]) + fi +fi + +if test "x$GCC" = "xyes"; then + AC_CACHE_CHECK([whether .eh_frame section should be read-only], + libffi_cv_ro_eh_frame, [ + libffi_cv_ro_eh_frame=no + echo 'extern void foo (void); void bar (void) { foo (); foo (); }' > conftest.c + if $CC $CFLAGS -S -fpic -fexceptions -o conftest.s conftest.c > /dev/null 2>&1; then + if grep '.section.*eh_frame.*"a"' conftest.s > /dev/null; then + libffi_cv_ro_eh_frame=yes + elif grep '.section.*eh_frame.*#alloc' conftest.c \ + | grep -v '#write' > /dev/null; then + libffi_cv_ro_eh_frame=yes + fi + fi + rm -f conftest.* + ]) + if test "x$libffi_cv_ro_eh_frame" = xyes; then + AC_DEFINE(HAVE_RO_EH_FRAME, 1, + [Define if .eh_frame sections should be read-only.]) + AC_DEFINE(EH_FRAME_FLAGS, "a", + [Define to the flags needed for the .section .eh_frame directive. ]) + else + AC_DEFINE(EH_FRAME_FLAGS, "aw", + [Define to the flags needed for the .section .eh_frame directive. ]) + fi + + AC_CACHE_CHECK([for __attribute__((visibility("hidden")))], + libffi_cv_hidden_visibility_attribute, [ + echo 'int __attribute__ ((visibility ("hidden"))) foo (void) { return 1 ; }' > conftest.c + libffi_cv_hidden_visibility_attribute=no + if AC_TRY_COMMAND(${CC-cc} -Werror -S conftest.c -o conftest.s 1>&AS_MESSAGE_LOG_FD); then + if grep '\.hidden.*foo' conftest.s >/dev/null; then + libffi_cv_hidden_visibility_attribute=yes + fi + fi + rm -f conftest.* + ]) + if test $libffi_cv_hidden_visibility_attribute = yes; then + AC_DEFINE(HAVE_HIDDEN_VISIBILITY_ATTRIBUTE, 1, + [Define if __attribute__((visibility("hidden"))) is supported.]) + fi +fi + +AH_BOTTOM([ +#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE +#ifdef LIBFFI_ASM +#define FFI_HIDDEN(name) .hidden name +#else +#define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) +#endif +#else +#ifdef LIBFFI_ASM +#define FFI_HIDDEN(name) +#else +#define FFI_HIDDEN +#endif +#endif +]) + +AC_SUBST(TARGET) +AC_SUBST(TARGETDIR) + +AC_SUBST(SHELL) + +AC_ARG_ENABLE(debug, +[ --enable-debug debugging mode], + if test "$enable_debug" = "yes"; then + AC_DEFINE(FFI_DEBUG, 1, [Define this if you want extra debugging.]) + fi) +AM_CONDITIONAL(FFI_DEBUG, test "$enable_debug" = "yes") + +AC_ARG_ENABLE(structs, +[ --disable-structs omit code for struct support], + if test "$enable_structs" = "no"; then + AC_DEFINE(FFI_NO_STRUCTS, 1, [Define this is you do not want support for aggregate types.]) + fi) + +AC_ARG_ENABLE(raw-api, +[ --disable-raw-api make the raw api unavailable], + if test "$enable_raw_api" = "no"; then + AC_DEFINE(FFI_NO_RAW_API, 1, [Define this is you do not want support for the raw API.]) + fi) + +AC_ARG_ENABLE(purify-safety, +[ --enable-purify-safety purify-safe mode], + if test "$enable_purify_safety" = "yes"; then + AC_DEFINE(USING_PURIFY, 1, [Define this if you are using Purify and want to suppress spurious messages.]) + fi) + +# These variables are only ever used when we cross-build to X86_WIN32. +# And we only support this with GCC, so... +if test x"$GCC" != x"no"; then + if test -n "$with_cross_host" && + test x"$with_cross_host" != x"no"; then + toolexecdir='$(exec_prefix)/$(target_alias)' + toolexeclibdir='$(toolexecdir)/lib' + else + toolexecdir='$(libdir)/gcc-lib/$(target_alias)' + toolexeclibdir='$(libdir)' + fi + multi_os_directory=`$CC -print-multi-os-directory` + case $multi_os_directory in + .) ;; # Avoid trailing /. + *) toolexeclibdir=$toolexeclibdir/$multi_os_directory ;; + esac + AC_SUBST(toolexecdir) + AC_SUBST(toolexeclibdir) +fi + +if test "${multilib}" = "yes"; then + multilib_arg="--enable-multilib" +else + multilib_arg= +fi + +AC_CONFIG_COMMANDS(include, [test -d include || mkdir include]) +AC_CONFIG_COMMANDS(src, [ +test -d src || mkdir src +test -d src/$TARGETDIR || mkdir src/$TARGETDIR +], [TARGETDIR="$TARGETDIR"]) + +AC_CONFIG_LINKS(include/ffitarget.h:src/$TARGETDIR/ffitarget.h) + +AC_CONFIG_FILES(include/Makefile include/ffi.h Makefile testsuite/Makefile man/Makefile libffi.pc) + +AC_OUTPUT diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/configure.host b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/configure.host new file mode 100644 index 000000000..f52457b39 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/configure.host @@ -0,0 +1,11 @@ +# configure.host +# +# This shell script handles all host based configuration for libffi. +# + +# THIS TABLE IS SORTED. KEEP IT THAT WAY. +case "${host}" in + frv*-elf) + LDFLAGS=`echo $LDFLAGS | sed "s/\-B[^ ]*libgloss\/frv\///"`\ -B`pwd`/../libgloss/frv/ + ;; +esac diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/depcomp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/depcomp new file mode 100755 index 000000000..df8eea7e4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/depcomp @@ -0,0 +1,630 @@ +#! /bin/sh +# depcomp - compile a program generating dependencies as side-effects + +scriptversion=2009-04-28.21; # UTC + +# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free +# Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# Originally written by Alexandre Oliva . + +case $1 in + '') + echo "$0: No command. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: depcomp [--help] [--version] PROGRAM [ARGS] + +Run PROGRAMS ARGS to compile a file, generating dependencies +as side-effects. + +Environment variables: + depmode Dependency tracking mode. + source Source file read by `PROGRAMS ARGS'. + object Object file output by `PROGRAMS ARGS'. + DEPDIR directory where to store dependencies. + depfile Dependency file to output. + tmpdepfile Temporary file to use when outputing dependencies. + libtool Whether libtool is used (yes/no). + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "depcomp $scriptversion" + exit $? + ;; +esac + +if test -z "$depmode" || test -z "$source" || test -z "$object"; then + echo "depcomp: Variables source, object and depmode must be set" 1>&2 + exit 1 +fi + +# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po. +depfile=${depfile-`echo "$object" | + sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`} +tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`} + +rm -f "$tmpdepfile" + +# Some modes work just like other modes, but use different flags. We +# parameterize here, but still list the modes in the big case below, +# to make depend.m4 easier to write. Note that we *cannot* use a case +# here, because this file can only contain one case statement. +if test "$depmode" = hp; then + # HP compiler uses -M and no extra arg. + gccflag=-M + depmode=gcc +fi + +if test "$depmode" = dashXmstdout; then + # This is just like dashmstdout with a different argument. + dashmflag=-xM + depmode=dashmstdout +fi + +cygpath_u="cygpath -u -f -" +if test "$depmode" = msvcmsys; then + # This is just like msvisualcpp but w/o cygpath translation. + # Just convert the backslash-escaped backslashes to single forward + # slashes to satisfy depend.m4 + cygpath_u="sed s,\\\\\\\\,/,g" + depmode=msvisualcpp +fi + +case "$depmode" in +gcc3) +## gcc 3 implements dependency tracking that does exactly what +## we want. Yay! Note: for some reason libtool 1.4 doesn't like +## it if -MD -MP comes after the -MF stuff. Hmm. +## Unfortunately, FreeBSD c89 acceptance of flags depends upon +## the command line argument order; so add the flags where they +## appear in depend2.am. Note that the slowdown incurred here +## affects only configure: in makefiles, %FASTDEP% shortcuts this. + for arg + do + case $arg in + -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;; + *) set fnord "$@" "$arg" ;; + esac + shift # fnord + shift # $arg + done + "$@" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + mv "$tmpdepfile" "$depfile" + ;; + +gcc) +## There are various ways to get dependency output from gcc. Here's +## why we pick this rather obscure method: +## - Don't want to use -MD because we'd like the dependencies to end +## up in a subdir. Having to rename by hand is ugly. +## (We might end up doing this anyway to support other compilers.) +## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like +## -MM, not -M (despite what the docs say). +## - Using -M directly means running the compiler twice (even worse +## than renaming). + if test -z "$gccflag"; then + gccflag=-MD, + fi + "$@" -Wp,"$gccflag$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + echo "$object : \\" > "$depfile" + alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz +## The second -e expression handles DOS-style file names with drive letters. + sed -e 's/^[^:]*: / /' \ + -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile" +## This next piece of magic avoids the `deleted header file' problem. +## The problem is that when a header file which appears in a .P file +## is deleted, the dependency causes make to die (because there is +## typically no way to rebuild the header). We avoid this by adding +## dummy dependencies for each header file. Too bad gcc doesn't do +## this for us directly. + tr ' ' ' +' < "$tmpdepfile" | +## Some versions of gcc put a space before the `:'. On the theory +## that the space means something, we add a space to the output as +## well. +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +sgi) + if test "$libtool" = yes; then + "$@" "-Wp,-MDupdate,$tmpdepfile" + else + "$@" -MDupdate "$tmpdepfile" + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + + if test -f "$tmpdepfile"; then # yes, the sourcefile depend on other files + echo "$object : \\" > "$depfile" + + # Clip off the initial element (the dependent). Don't try to be + # clever and replace this with sed code, as IRIX sed won't handle + # lines with more than a fixed number of characters (4096 in + # IRIX 6.2 sed, 8192 in IRIX 6.5). We also remove comment lines; + # the IRIX cc adds comments like `#:fec' to the end of the + # dependency line. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \ + tr ' +' ' ' >> "$depfile" + echo >> "$depfile" + + # The second pass generates a dummy entry for each header file. + tr ' ' ' +' < "$tmpdepfile" \ + | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \ + >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +aix) + # The C for AIX Compiler uses -M and outputs the dependencies + # in a .u file. In older versions, this file always lives in the + # current directory. Also, the AIX compiler puts `$object:' at the + # start of each line; $object doesn't have directory information. + # Version 6 uses the directory in both cases. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.u + tmpdepfile2=$base.u + tmpdepfile3=$dir.libs/$base.u + "$@" -Wc,-M + else + tmpdepfile1=$dir$base.u + tmpdepfile2=$dir$base.u + tmpdepfile3=$dir$base.u + "$@" -M + fi + stat=$? + + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + # Each line is of the form `foo.o: dependent.h'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + # The sourcefile does not contain any dependencies, so just + # store a dummy comment line, to avoid errors with the Makefile + # "include basename.Plo" scheme. + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +icc) + # Intel's C compiler understands `-MD -MF file'. However on + # icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c + # ICC 7.0 will fill foo.d with something like + # foo.o: sub/foo.c + # foo.o: sub/foo.h + # which is wrong. We want: + # sub/foo.o: sub/foo.c + # sub/foo.o: sub/foo.h + # sub/foo.c: + # sub/foo.h: + # ICC 7.1 will output + # foo.o: sub/foo.c sub/foo.h + # and will wrap long lines using \ : + # foo.o: sub/foo.c ... \ + # sub/foo.h ... \ + # ... + + "$@" -MD -MF "$tmpdepfile" + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile" + exit $stat + fi + rm -f "$depfile" + # Each line is of the form `foo.o: dependent.h', + # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'. + # Do two passes, one to just change these to + # `$object: dependent.h' and one to simply `dependent.h:'. + sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile" + # Some versions of the HPUX 10.20 sed can't process this invocation + # correctly. Breaking it into two sed invocations is a workaround. + sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" | + sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +hp2) + # The "hp" stanza above does not work with aCC (C++) and HP's ia64 + # compilers, which have integrated preprocessors. The correct option + # to use with these is +Maked; it writes dependencies to a file named + # 'foo.d', which lands next to the object file, wherever that + # happens to be. + # Much of this is similar to the tru64 case; see comments there. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + if test "$libtool" = yes; then + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir.libs/$base.d + "$@" -Wc,+Maked + else + tmpdepfile1=$dir$base.d + tmpdepfile2=$dir$base.d + "$@" +Maked + fi + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile" + # Add `dependent.h:' lines. + sed -ne '2,${ + s/^ *// + s/ \\*$// + s/$/:/ + p + }' "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" "$tmpdepfile2" + ;; + +tru64) + # The Tru64 compiler uses -MD to generate dependencies as a side + # effect. `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'. + # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put + # dependencies in `foo.d' instead, so we check for that too. + # Subdirectories are respected. + dir=`echo "$object" | sed -e 's|/[^/]*$|/|'` + test "x$dir" = "x$object" && dir= + base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'` + + if test "$libtool" = yes; then + # With Tru64 cc, shared objects can also be used to make a + # static library. This mechanism is used in libtool 1.4 series to + # handle both shared and static libraries in a single compilation. + # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d. + # + # With libtool 1.5 this exception was removed, and libtool now + # generates 2 separate objects for the 2 libraries. These two + # compilations output dependencies in $dir.libs/$base.o.d and + # in $dir$base.o.d. We have to check for both files, because + # one of the two compilations can be disabled. We should prefer + # $dir$base.o.d over $dir.libs/$base.o.d because the latter is + # automatically cleaned when .libs/ is deleted, while ignoring + # the former would cause a distcleancheck panic. + tmpdepfile1=$dir.libs/$base.lo.d # libtool 1.4 + tmpdepfile2=$dir$base.o.d # libtool 1.5 + tmpdepfile3=$dir.libs/$base.o.d # libtool 1.5 + tmpdepfile4=$dir.libs/$base.d # Compaq CCC V6.2-504 + "$@" -Wc,-MD + else + tmpdepfile1=$dir$base.o.d + tmpdepfile2=$dir$base.d + tmpdepfile3=$dir$base.d + tmpdepfile4=$dir$base.d + "$@" -MD + fi + + stat=$? + if test $stat -eq 0; then : + else + rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + exit $stat + fi + + for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4" + do + test -f "$tmpdepfile" && break + done + if test -f "$tmpdepfile"; then + sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile" + # That's a tab and a space in the []. + sed -e 's,^.*\.[a-z]*:[ ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile" + else + echo "#dummy" > "$depfile" + fi + rm -f "$tmpdepfile" + ;; + +#nosideeffect) + # This comment above is used by automake to tell side-effect + # dependency tracking mechanisms from slower ones. + +dashmstdout) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout, regardless of -o. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + test -z "$dashmflag" && dashmflag=-M + # Require at least two characters before searching for `:' + # in the target name. This is to cope with DOS-style filenames: + # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise. + "$@" $dashmflag | + sed 's:^[ ]*[^: ][^:][^:]*\:[ ]*:'"$object"'\: :' > "$tmpdepfile" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + tr ' ' ' +' < "$tmpdepfile" | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +dashXmstdout) + # This case only exists to satisfy depend.m4. It is never actually + # run, as this mode is specially recognized in the preamble. + exit 1 + ;; + +makedepend) + "$@" || exit $? + # Remove any Libtool call + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + # X makedepend + shift + cleared=no eat=no + for arg + do + case $cleared in + no) + set ""; shift + cleared=yes ;; + esac + if test $eat = yes; then + eat=no + continue + fi + case "$arg" in + -D*|-I*) + set fnord "$@" "$arg"; shift ;; + # Strip any option that makedepend may not understand. Remove + # the object too, otherwise makedepend will parse it as a source file. + -arch) + eat=yes ;; + -*|$object) + ;; + *) + set fnord "$@" "$arg"; shift ;; + esac + done + obj_suffix=`echo "$object" | sed 's/^.*\././'` + touch "$tmpdepfile" + ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@" + rm -f "$depfile" + cat < "$tmpdepfile" > "$depfile" + sed '1,2d' "$tmpdepfile" | tr ' ' ' +' | \ +## Some versions of the HPUX 10.20 sed can't process this invocation +## correctly. Breaking it into two sed invocations is a workaround. + sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" "$tmpdepfile".bak + ;; + +cpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + # Remove `-o $object'. + IFS=" " + for arg + do + case $arg in + -o) + shift + ;; + $object) + shift + ;; + *) + set fnord "$@" "$arg" + shift # fnord + shift # $arg + ;; + esac + done + + "$@" -E | + sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \ + -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' | + sed '$ s: \\$::' > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + cat < "$tmpdepfile" >> "$depfile" + sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvisualcpp) + # Important note: in order to support this mode, a compiler *must* + # always write the preprocessed file to stdout. + "$@" || exit $? + + # Remove the call to Libtool. + if test "$libtool" = yes; then + while test "X$1" != 'X--mode=compile'; do + shift + done + shift + fi + + IFS=" " + for arg + do + case "$arg" in + -o) + shift + ;; + $object) + shift + ;; + "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI") + set fnord "$@" + shift + shift + ;; + *) + set fnord "$@" "$arg" + shift + shift + ;; + esac + done + "$@" -E 2>/dev/null | + sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile" + rm -f "$depfile" + echo "$object : \\" > "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s:: \1 \\:p' >> "$depfile" + echo " " >> "$depfile" + sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile" + rm -f "$tmpdepfile" + ;; + +msvcmsys) + # This case exists only to let depend.m4 do its work. It works by + # looking at the text of this script. This case will never be run, + # since it is checked for above. + exit 1 + ;; + +none) + exec "$@" + ;; + +*) + echo "Unknown depmode $depmode" 1>&2 + exit 1 + ;; +esac + +exit 0 + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/doc/libffi.info b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/doc/libffi.info new file mode 100644 index 000000000..449320c06 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/doc/libffi.info @@ -0,0 +1,593 @@ +This is ../libffi/doc/libffi.info, produced by makeinfo version 4.13 +from ../libffi/doc/libffi.texi. + +This manual is for Libffi, a portable foreign-function interface +library. + + Copyright (C) 2008, 2010 Red Hat, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or + (at your option) any later version. A copy of the license is + included in the section entitled "GNU General Public License". + + +INFO-DIR-SECTION Development +START-INFO-DIR-ENTRY +* libffi: (libffi). Portable foreign-function interface library. +END-INFO-DIR-ENTRY + + +File: libffi.info, Node: Top, Next: Introduction, Up: (dir) + +libffi +****** + +This manual is for Libffi, a portable foreign-function interface +library. + + Copyright (C) 2008, 2010 Red Hat, Inc. + + Permission is granted to copy, distribute and/or modify this + document under the terms of the GNU General Public License as + published by the Free Software Foundation; either version 2, or + (at your option) any later version. A copy of the license is + included in the section entitled "GNU General Public License". + + +* Menu: + +* Introduction:: What is libffi? +* Using libffi:: How to use libffi. +* Missing Features:: Things libffi can't do. +* Index:: Index. + + +File: libffi.info, Node: Introduction, Next: Using libffi, Prev: Top, Up: Top + +1 What is libffi? +***************** + +Compilers for high level languages generate code that follow certain +conventions. These conventions are necessary, in part, for separate +compilation to work. One such convention is the "calling convention". +The calling convention is a set of assumptions made by the compiler +about where function arguments will be found on entry to a function. A +calling convention also specifies where the return value for a function +is found. The calling convention is also sometimes called the "ABI" or +"Application Binary Interface". + + Some programs may not know at the time of compilation what arguments +are to be passed to a function. For instance, an interpreter may be +told at run-time about the number and types of arguments used to call a +given function. `Libffi' can be used in such programs to provide a +bridge from the interpreter program to compiled code. + + The `libffi' library provides a portable, high level programming +interface to various calling conventions. This allows a programmer to +call any function specified by a call interface description at run time. + + FFI stands for Foreign Function Interface. A foreign function +interface is the popular name for the interface that allows code +written in one language to call code written in another language. The +`libffi' library really only provides the lowest, machine dependent +layer of a fully featured foreign function interface. A layer must +exist above `libffi' that handles type conversions for values passed +between the two languages. + + +File: libffi.info, Node: Using libffi, Next: Missing Features, Prev: Introduction, Up: Top + +2 Using libffi +************** + +* Menu: + +* The Basics:: The basic libffi API. +* Simple Example:: A simple example. +* Types:: libffi type descriptions. +* Multiple ABIs:: Different passing styles on one platform. +* The Closure API:: Writing a generic function. +* Closure Example:: A closure example. + + +File: libffi.info, Node: The Basics, Next: Simple Example, Up: Using libffi + +2.1 The Basics +============== + +`Libffi' assumes that you have a pointer to the function you wish to +call and that you know the number and types of arguments to pass it, as +well as the return type of the function. + + The first thing you must do is create an `ffi_cif' object that +matches the signature of the function you wish to call. This is a +separate step because it is common to make multiple calls using a +single `ffi_cif'. The "cif" in `ffi_cif' stands for Call InterFace. +To prepare a call interface object, use the function `ffi_prep_cif'. + + -- Function: ffi_status ffi_prep_cif (ffi_cif *CIF, ffi_abi ABI, + unsigned int NARGS, ffi_type *RTYPE, ffi_type **ARGTYPES) + This initializes CIF according to the given parameters. + + ABI is the ABI to use; normally `FFI_DEFAULT_ABI' is what you + want. *note Multiple ABIs:: for more information. + + NARGS is the number of arguments that this function accepts. + `libffi' does not yet handle varargs functions; see *note Missing + Features:: for more information. + + RTYPE is a pointer to an `ffi_type' structure that describes the + return type of the function. *Note Types::. + + ARGTYPES is a vector of `ffi_type' pointers. ARGTYPES must have + NARGS elements. If NARGS is 0, this argument is ignored. + + `ffi_prep_cif' returns a `libffi' status code, of type + `ffi_status'. This will be either `FFI_OK' if everything worked + properly; `FFI_BAD_TYPEDEF' if one of the `ffi_type' objects is + incorrect; or `FFI_BAD_ABI' if the ABI parameter is invalid. + + To call a function using an initialized `ffi_cif', use the +`ffi_call' function: + + -- Function: void ffi_call (ffi_cif *CIF, void *FN, void *RVALUE, void + **AVALUES) + This calls the function FN according to the description given in + CIF. CIF must have already been prepared using `ffi_prep_cif'. + + RVALUE is a pointer to a chunk of memory that will hold the result + of the function call. This must be large enough to hold the + result and must be suitably aligned; it is the caller's + responsibility to ensure this. If CIF declares that the function + returns `void' (using `ffi_type_void'), then RVALUE is ignored. + If RVALUE is `NULL', then the return value is discarded. + + AVALUES is a vector of `void *' pointers that point to the memory + locations holding the argument values for a call. If CIF declares + that the function has no arguments (i.e., NARGS was 0), then + AVALUES is ignored. Note that argument values may be modified by + the callee (for instance, structs passed by value); the burden of + copying pass-by-value arguments is placed on the caller. + + +File: libffi.info, Node: Simple Example, Next: Types, Prev: The Basics, Up: Using libffi + +2.2 Simple Example +================== + +Here is a trivial example that calls `puts' a few times. + + #include + #include + + int main() + { + ffi_cif cif; + ffi_type *args[1]; + void *values[1]; + char *s; + int rc; + + /* Initialize the argument info vectors */ + args[0] = &ffi_type_pointer; + values[0] = &s; + + /* Initialize the cif */ + if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_uint, args) == FFI_OK) + { + s = "Hello World!"; + ffi_call(&cif, puts, &rc, values); + /* rc now holds the result of the call to puts */ + + /* values holds a pointer to the function's arg, so to + call puts() again all we need to do is change the + value of s */ + s = "This is cool!"; + ffi_call(&cif, puts, &rc, values); + } + + return 0; + } + + +File: libffi.info, Node: Types, Next: Multiple ABIs, Prev: Simple Example, Up: Using libffi + +2.3 Types +========= + +* Menu: + +* Primitive Types:: Built-in types. +* Structures:: Structure types. +* Type Example:: Structure type example. + + +File: libffi.info, Node: Primitive Types, Next: Structures, Up: Types + +2.3.1 Primitive Types +--------------------- + +`Libffi' provides a number of built-in type descriptors that can be +used to describe argument and return types: + +`ffi_type_void' + The type `void'. This cannot be used for argument types, only for + return values. + +`ffi_type_uint8' + An unsigned, 8-bit integer type. + +`ffi_type_sint8' + A signed, 8-bit integer type. + +`ffi_type_uint16' + An unsigned, 16-bit integer type. + +`ffi_type_sint16' + A signed, 16-bit integer type. + +`ffi_type_uint32' + An unsigned, 32-bit integer type. + +`ffi_type_sint32' + A signed, 32-bit integer type. + +`ffi_type_uint64' + An unsigned, 64-bit integer type. + +`ffi_type_sint64' + A signed, 64-bit integer type. + +`ffi_type_float' + The C `float' type. + +`ffi_type_double' + The C `double' type. + +`ffi_type_uchar' + The C `unsigned char' type. + +`ffi_type_schar' + The C `signed char' type. (Note that there is not an exact + equivalent to the C `char' type in `libffi'; ordinarily you should + either use `ffi_type_schar' or `ffi_type_uchar' depending on + whether `char' is signed.) + +`ffi_type_ushort' + The C `unsigned short' type. + +`ffi_type_sshort' + The C `short' type. + +`ffi_type_uint' + The C `unsigned int' type. + +`ffi_type_sint' + The C `int' type. + +`ffi_type_ulong' + The C `unsigned long' type. + +`ffi_type_slong' + The C `long' type. + +`ffi_type_longdouble' + On platforms that have a C `long double' type, this is defined. + On other platforms, it is not. + +`ffi_type_pointer' + A generic `void *' pointer. You should use this for all pointers, + regardless of their real type. + + Each of these is of type `ffi_type', so you must take the address +when passing to `ffi_prep_cif'. + + +File: libffi.info, Node: Structures, Next: Type Example, Prev: Primitive Types, Up: Types + +2.3.2 Structures +---------------- + +Although `libffi' has no special support for unions or bit-fields, it +is perfectly happy passing structures back and forth. You must first +describe the structure to `libffi' by creating a new `ffi_type' object +for it. + + -- ffi_type: + The `ffi_type' has the following members: + `size_t size' + This is set by `libffi'; you should initialize it to zero. + + `unsigned short alignment' + This is set by `libffi'; you should initialize it to zero. + + `unsigned short type' + For a structure, this should be set to `FFI_TYPE_STRUCT'. + + `ffi_type **elements' + This is a `NULL'-terminated array of pointers to `ffi_type' + objects. There is one element per field of the struct. + + +File: libffi.info, Node: Type Example, Prev: Structures, Up: Types + +2.3.3 Type Example +------------------ + +The following example initializes a `ffi_type' object representing the +`tm' struct from Linux's `time.h'. + + Here is how the struct is defined: + + struct tm { + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + /* Those are for future use. */ + long int __tm_gmtoff__; + __const char *__tm_zone__; + }; + + Here is the corresponding code to describe this struct to `libffi': + + { + ffi_type tm_type; + ffi_type *tm_type_elements[12]; + int i; + + tm_type.size = tm_type.alignment = 0; + tm_type.elements = &tm_type_elements; + + for (i = 0; i < 9; i++) + tm_type_elements[i] = &ffi_type_sint; + + tm_type_elements[9] = &ffi_type_slong; + tm_type_elements[10] = &ffi_type_pointer; + tm_type_elements[11] = NULL; + + /* tm_type can now be used to represent tm argument types and + return types for ffi_prep_cif() */ + } + + +File: libffi.info, Node: Multiple ABIs, Next: The Closure API, Prev: Types, Up: Using libffi + +2.4 Multiple ABIs +================= + +A given platform may provide multiple different ABIs at once. For +instance, the x86 platform has both `stdcall' and `fastcall' functions. + + `libffi' provides some support for this. However, this is +necessarily platform-specific. + + +File: libffi.info, Node: The Closure API, Next: Closure Example, Prev: Multiple ABIs, Up: Using libffi + +2.5 The Closure API +=================== + +`libffi' also provides a way to write a generic function - a function +that can accept and decode any combination of arguments. This can be +useful when writing an interpreter, or to provide wrappers for +arbitrary functions. + + This facility is called the "closure API". Closures are not +supported on all platforms; you can check the `FFI_CLOSURES' define to +determine whether they are supported on the current platform. + + Because closures work by assembling a tiny function at runtime, they +require special allocation on platforms that have a non-executable +heap. Memory management for closures is handled by a pair of functions: + + -- Function: void *ffi_closure_alloc (size_t SIZE, void **CODE) + Allocate a chunk of memory holding SIZE bytes. This returns a + pointer to the writable address, and sets *CODE to the + corresponding executable address. + + SIZE should be sufficient to hold a `ffi_closure' object. + + -- Function: void ffi_closure_free (void *WRITABLE) + Free memory allocated using `ffi_closure_alloc'. The argument is + the writable address that was returned. + + Once you have allocated the memory for a closure, you must construct +a `ffi_cif' describing the function call. Finally you can prepare the +closure function: + + -- Function: ffi_status ffi_prep_closure_loc (ffi_closure *CLOSURE, + ffi_cif *CIF, void (*FUN) (ffi_cif *CIF, void *RET, void + **ARGS, void *USER_DATA), void *USER_DATA, void *CODELOC) + Prepare a closure function. + + CLOSURE is the address of a `ffi_closure' object; this is the + writable address returned by `ffi_closure_alloc'. + + CIF is the `ffi_cif' describing the function parameters. + + USER_DATA is an arbitrary datum that is passed, uninterpreted, to + your closure function. + + CODELOC is the executable address returned by `ffi_closure_alloc'. + + FUN is the function which will be called when the closure is + invoked. It is called with the arguments: + CIF + The `ffi_cif' passed to `ffi_prep_closure_loc'. + + RET + A pointer to the memory used for the function's return value. + FUN must fill this, unless the function is declared as + returning `void'. + + ARGS + A vector of pointers to memory holding the arguments to the + function. + + USER_DATA + The same USER_DATA that was passed to `ffi_prep_closure_loc'. + + `ffi_prep_closure_loc' will return `FFI_OK' if everything went ok, + and something else on error. + + After calling `ffi_prep_closure_loc', you can cast CODELOC to the + appropriate pointer-to-function type. + + You may see old code referring to `ffi_prep_closure'. This function +is deprecated, as it cannot handle the need for separate writable and +executable addresses. + + +File: libffi.info, Node: Closure Example, Prev: The Closure API, Up: Using libffi + +2.6 Closure Example +=================== + +A trivial example that creates a new `puts' by binding `fputs' with +`stdin'. + + #include + #include + + /* Acts like puts with the file given at time of enclosure. */ + void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[], + FILE *stream) + { + *ret = fputs(*(char **)args[0], stream); + } + + int main() + { + ffi_cif cif; + ffi_type *args[1]; + ffi_closure *closure; + + int (*bound_puts)(char *); + int rc; + + /* Allocate closure and bound_puts */ + closure = ffi_closure_alloc(sizeof(ffi_closure), &bound_puts); + + if (closure) + { + /* Initialize the argument info vectors */ + args[0] = &ffi_type_pointer; + + /* Initialize the cif */ + if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_uint, args) == FFI_OK) + { + /* Initialize the closure, setting stream to stdout */ + if (ffi_prep_closure_loc(closure, &cif, puts_binding, + stdout, bound_puts) == FFI_OK) + { + rc = bound_puts("Hello World!"); + /* rc now holds the result of the call to fputs */ + } + } + } + + /* Deallocate both closure, and bound_puts */ + ffi_closure_free(closure); + + return 0; + } + + +File: libffi.info, Node: Missing Features, Next: Index, Prev: Using libffi, Up: Top + +3 Missing Features +****************** + +`libffi' is missing a few features. We welcome patches to add support +for these. + + * There is no support for calling varargs functions. This may work + on some platforms, depending on how the ABI is defined, but it is + not reliable. + + * There is no support for bit fields in structures. + + * The closure API is + + * The "raw" API is undocumented. + + +File: libffi.info, Node: Index, Prev: Missing Features, Up: Top + +Index +***** + +[index] +* Menu: + +* : Structures. (line 12) +* ABI: Introduction. (line 13) +* Application Binary Interface: Introduction. (line 13) +* calling convention: Introduction. (line 13) +* cif: The Basics. (line 14) +* closure API: The Closure API. (line 13) +* closures: The Closure API. (line 13) +* FFI: Introduction. (line 31) +* ffi_call: The Basics. (line 41) +* ffi_closure_alloc: The Closure API. (line 19) +* ffi_closure_free: The Closure API. (line 26) +* FFI_CLOSURES: The Closure API. (line 13) +* ffi_prep_cif: The Basics. (line 16) +* ffi_prep_closure_loc: The Closure API. (line 34) +* ffi_status <1>: The Closure API. (line 37) +* ffi_status: The Basics. (line 18) +* ffi_type: Structures. (line 11) +* ffi_type_double: Primitive Types. (line 41) +* ffi_type_float: Primitive Types. (line 38) +* ffi_type_longdouble: Primitive Types. (line 71) +* ffi_type_pointer: Primitive Types. (line 75) +* ffi_type_schar: Primitive Types. (line 47) +* ffi_type_sint: Primitive Types. (line 62) +* ffi_type_sint16: Primitive Types. (line 23) +* ffi_type_sint32: Primitive Types. (line 29) +* ffi_type_sint64: Primitive Types. (line 35) +* ffi_type_sint8: Primitive Types. (line 17) +* ffi_type_slong: Primitive Types. (line 68) +* ffi_type_sshort: Primitive Types. (line 56) +* ffi_type_uchar: Primitive Types. (line 44) +* ffi_type_uint: Primitive Types. (line 59) +* ffi_type_uint16: Primitive Types. (line 20) +* ffi_type_uint32: Primitive Types. (line 26) +* ffi_type_uint64: Primitive Types. (line 32) +* ffi_type_uint8: Primitive Types. (line 14) +* ffi_type_ulong: Primitive Types. (line 65) +* ffi_type_ushort: Primitive Types. (line 53) +* ffi_type_void: Primitive Types. (line 10) +* Foreign Function Interface: Introduction. (line 31) +* void <1>: The Closure API. (line 20) +* void: The Basics. (line 43) + + + +Tag Table: +Node: Top706 +Node: Introduction1448 +Node: Using libffi3084 +Node: The Basics3570 +Node: Simple Example6356 +Node: Types7383 +Node: Primitive Types7666 +Node: Structures9486 +Node: Type Example10346 +Node: Multiple ABIs11569 +Node: The Closure API11940 +Node: Closure Example14884 +Node: Missing Features16443 +Node: Index16936 + +End Tag Table diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/doc/libffi.texi b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/doc/libffi.texi new file mode 100644 index 000000000..5cdd66797 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/doc/libffi.texi @@ -0,0 +1,600 @@ +\input texinfo @c -*-texinfo-*- +@c %**start of header +@setfilename libffi.info +@settitle libffi +@setchapternewpage off +@c %**end of header + +@c Merge the standard indexes into a single one. +@syncodeindex fn cp +@syncodeindex vr cp +@syncodeindex ky cp +@syncodeindex pg cp +@syncodeindex tp cp + +@include version.texi + +@copying + +This manual is for Libffi, a portable foreign-function interface +library. + +Copyright @copyright{} 2008, 2010 Red Hat, Inc. + +@quotation +Permission is granted to copy, distribute and/or modify this document +under the terms of the GNU General Public License as published by the +Free Software Foundation; either version 2, or (at your option) any +later version. A copy of the license is included in the +section entitled ``GNU General Public License''. + +@end quotation +@end copying + +@dircategory Development +@direntry +* libffi: (libffi). Portable foreign-function interface library. +@end direntry + +@titlepage +@title Libffi +@page +@vskip 0pt plus 1filll +@insertcopying +@end titlepage + + +@ifnottex +@node Top +@top libffi + +@insertcopying + +@menu +* Introduction:: What is libffi? +* Using libffi:: How to use libffi. +* Missing Features:: Things libffi can't do. +* Index:: Index. +@end menu + +@end ifnottex + + +@node Introduction +@chapter What is libffi? + +Compilers for high level languages generate code that follow certain +conventions. These conventions are necessary, in part, for separate +compilation to work. One such convention is the @dfn{calling +convention}. The calling convention is a set of assumptions made by +the compiler about where function arguments will be found on entry to +a function. A calling convention also specifies where the return +value for a function is found. The calling convention is also +sometimes called the @dfn{ABI} or @dfn{Application Binary Interface}. +@cindex calling convention +@cindex ABI +@cindex Application Binary Interface + +Some programs may not know at the time of compilation what arguments +are to be passed to a function. For instance, an interpreter may be +told at run-time about the number and types of arguments used to call +a given function. @samp{Libffi} can be used in such programs to +provide a bridge from the interpreter program to compiled code. + +The @samp{libffi} library provides a portable, high level programming +interface to various calling conventions. This allows a programmer to +call any function specified by a call interface description at run +time. + +@acronym{FFI} stands for Foreign Function Interface. A foreign +function interface is the popular name for the interface that allows +code written in one language to call code written in another language. +The @samp{libffi} library really only provides the lowest, machine +dependent layer of a fully featured foreign function interface. A +layer must exist above @samp{libffi} that handles type conversions for +values passed between the two languages. +@cindex FFI +@cindex Foreign Function Interface + + +@node Using libffi +@chapter Using libffi + +@menu +* The Basics:: The basic libffi API. +* Simple Example:: A simple example. +* Types:: libffi type descriptions. +* Multiple ABIs:: Different passing styles on one platform. +* The Closure API:: Writing a generic function. +* Closure Example:: A closure example. +@end menu + + +@node The Basics +@section The Basics + +@samp{Libffi} assumes that you have a pointer to the function you wish +to call and that you know the number and types of arguments to pass +it, as well as the return type of the function. + +The first thing you must do is create an @code{ffi_cif} object that +matches the signature of the function you wish to call. This is a +separate step because it is common to make multiple calls using a +single @code{ffi_cif}. The @dfn{cif} in @code{ffi_cif} stands for +Call InterFace. To prepare a call interface object, use the function +@code{ffi_prep_cif}. +@cindex cif + +@findex ffi_prep_cif +@defun ffi_status ffi_prep_cif (ffi_cif *@var{cif}, ffi_abi @var{abi}, unsigned int @var{nargs}, ffi_type *@var{rtype}, ffi_type **@var{argtypes}) +This initializes @var{cif} according to the given parameters. + +@var{abi} is the ABI to use; normally @code{FFI_DEFAULT_ABI} is what +you want. @ref{Multiple ABIs} for more information. + +@var{nargs} is the number of arguments that this function accepts. +@samp{libffi} does not yet handle varargs functions; see @ref{Missing +Features} for more information. + +@var{rtype} is a pointer to an @code{ffi_type} structure that +describes the return type of the function. @xref{Types}. + +@var{argtypes} is a vector of @code{ffi_type} pointers. +@var{argtypes} must have @var{nargs} elements. If @var{nargs} is 0, +this argument is ignored. + +@code{ffi_prep_cif} returns a @code{libffi} status code, of type +@code{ffi_status}. This will be either @code{FFI_OK} if everything +worked properly; @code{FFI_BAD_TYPEDEF} if one of the @code{ffi_type} +objects is incorrect; or @code{FFI_BAD_ABI} if the @var{abi} parameter +is invalid. +@end defun + + +To call a function using an initialized @code{ffi_cif}, use the +@code{ffi_call} function: + +@findex ffi_call +@defun void ffi_call (ffi_cif *@var{cif}, void *@var{fn}, void *@var{rvalue}, void **@var{avalues}) +This calls the function @var{fn} according to the description given in +@var{cif}. @var{cif} must have already been prepared using +@code{ffi_prep_cif}. + +@var{rvalue} is a pointer to a chunk of memory that will hold the +result of the function call. This must be large enough to hold the +result and must be suitably aligned; it is the caller's responsibility +to ensure this. If @var{cif} declares that the function returns +@code{void} (using @code{ffi_type_void}), then @var{rvalue} is +ignored. If @var{rvalue} is @samp{NULL}, then the return value is +discarded. + +@var{avalues} is a vector of @code{void *} pointers that point to the +memory locations holding the argument values for a call. If @var{cif} +declares that the function has no arguments (i.e., @var{nargs} was 0), +then @var{avalues} is ignored. Note that argument values may be +modified by the callee (for instance, structs passed by value); the +burden of copying pass-by-value arguments is placed on the caller. +@end defun + + +@node Simple Example +@section Simple Example + +Here is a trivial example that calls @code{puts} a few times. + +@example +#include +#include + +int main() +@{ + ffi_cif cif; + ffi_type *args[1]; + void *values[1]; + char *s; + int rc; + + /* Initialize the argument info vectors */ + args[0] = &ffi_type_pointer; + values[0] = &s; + + /* Initialize the cif */ + if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_uint, args) == FFI_OK) + @{ + s = "Hello World!"; + ffi_call(&cif, puts, &rc, values); + /* rc now holds the result of the call to puts */ + + /* values holds a pointer to the function's arg, so to + call puts() again all we need to do is change the + value of s */ + s = "This is cool!"; + ffi_call(&cif, puts, &rc, values); + @} + + return 0; +@} +@end example + + +@node Types +@section Types + +@menu +* Primitive Types:: Built-in types. +* Structures:: Structure types. +* Type Example:: Structure type example. +@end menu + +@node Primitive Types +@subsection Primitive Types + +@code{Libffi} provides a number of built-in type descriptors that can +be used to describe argument and return types: + +@table @code +@item ffi_type_void +@tindex ffi_type_void +The type @code{void}. This cannot be used for argument types, only +for return values. + +@item ffi_type_uint8 +@tindex ffi_type_uint8 +An unsigned, 8-bit integer type. + +@item ffi_type_sint8 +@tindex ffi_type_sint8 +A signed, 8-bit integer type. + +@item ffi_type_uint16 +@tindex ffi_type_uint16 +An unsigned, 16-bit integer type. + +@item ffi_type_sint16 +@tindex ffi_type_sint16 +A signed, 16-bit integer type. + +@item ffi_type_uint32 +@tindex ffi_type_uint32 +An unsigned, 32-bit integer type. + +@item ffi_type_sint32 +@tindex ffi_type_sint32 +A signed, 32-bit integer type. + +@item ffi_type_uint64 +@tindex ffi_type_uint64 +An unsigned, 64-bit integer type. + +@item ffi_type_sint64 +@tindex ffi_type_sint64 +A signed, 64-bit integer type. + +@item ffi_type_float +@tindex ffi_type_float +The C @code{float} type. + +@item ffi_type_double +@tindex ffi_type_double +The C @code{double} type. + +@item ffi_type_uchar +@tindex ffi_type_uchar +The C @code{unsigned char} type. + +@item ffi_type_schar +@tindex ffi_type_schar +The C @code{signed char} type. (Note that there is not an exact +equivalent to the C @code{char} type in @code{libffi}; ordinarily you +should either use @code{ffi_type_schar} or @code{ffi_type_uchar} +depending on whether @code{char} is signed.) + +@item ffi_type_ushort +@tindex ffi_type_ushort +The C @code{unsigned short} type. + +@item ffi_type_sshort +@tindex ffi_type_sshort +The C @code{short} type. + +@item ffi_type_uint +@tindex ffi_type_uint +The C @code{unsigned int} type. + +@item ffi_type_sint +@tindex ffi_type_sint +The C @code{int} type. + +@item ffi_type_ulong +@tindex ffi_type_ulong +The C @code{unsigned long} type. + +@item ffi_type_slong +@tindex ffi_type_slong +The C @code{long} type. + +@item ffi_type_longdouble +@tindex ffi_type_longdouble +On platforms that have a C @code{long double} type, this is defined. +On other platforms, it is not. + +@item ffi_type_pointer +@tindex ffi_type_pointer +A generic @code{void *} pointer. You should use this for all +pointers, regardless of their real type. +@end table + +Each of these is of type @code{ffi_type}, so you must take the address +when passing to @code{ffi_prep_cif}. + + +@node Structures +@subsection Structures + +Although @samp{libffi} has no special support for unions or +bit-fields, it is perfectly happy passing structures back and forth. +You must first describe the structure to @samp{libffi} by creating a +new @code{ffi_type} object for it. + +@tindex ffi_type +@deftp ffi_type +The @code{ffi_type} has the following members: +@table @code +@item size_t size +This is set by @code{libffi}; you should initialize it to zero. + +@item unsigned short alignment +This is set by @code{libffi}; you should initialize it to zero. + +@item unsigned short type +For a structure, this should be set to @code{FFI_TYPE_STRUCT}. + +@item ffi_type **elements +This is a @samp{NULL}-terminated array of pointers to @code{ffi_type} +objects. There is one element per field of the struct. +@end table +@end deftp + + +@node Type Example +@subsection Type Example + +The following example initializes a @code{ffi_type} object +representing the @code{tm} struct from Linux's @file{time.h}. + +Here is how the struct is defined: + +@example +struct tm @{ + int tm_sec; + int tm_min; + int tm_hour; + int tm_mday; + int tm_mon; + int tm_year; + int tm_wday; + int tm_yday; + int tm_isdst; + /* Those are for future use. */ + long int __tm_gmtoff__; + __const char *__tm_zone__; +@}; +@end example + +Here is the corresponding code to describe this struct to +@code{libffi}: + +@example + @{ + ffi_type tm_type; + ffi_type *tm_type_elements[12]; + int i; + + tm_type.size = tm_type.alignment = 0; + tm_type.elements = &tm_type_elements; + + for (i = 0; i < 9; i++) + tm_type_elements[i] = &ffi_type_sint; + + tm_type_elements[9] = &ffi_type_slong; + tm_type_elements[10] = &ffi_type_pointer; + tm_type_elements[11] = NULL; + + /* tm_type can now be used to represent tm argument types and + return types for ffi_prep_cif() */ + @} +@end example + + +@node Multiple ABIs +@section Multiple ABIs + +A given platform may provide multiple different ABIs at once. For +instance, the x86 platform has both @samp{stdcall} and @samp{fastcall} +functions. + +@code{libffi} provides some support for this. However, this is +necessarily platform-specific. + +@c FIXME: document the platforms + +@node The Closure API +@section The Closure API + +@code{libffi} also provides a way to write a generic function -- a +function that can accept and decode any combination of arguments. +This can be useful when writing an interpreter, or to provide wrappers +for arbitrary functions. + +This facility is called the @dfn{closure API}. Closures are not +supported on all platforms; you can check the @code{FFI_CLOSURES} +define to determine whether they are supported on the current +platform. +@cindex closures +@cindex closure API +@findex FFI_CLOSURES + +Because closures work by assembling a tiny function at runtime, they +require special allocation on platforms that have a non-executable +heap. Memory management for closures is handled by a pair of +functions: + +@findex ffi_closure_alloc +@defun void *ffi_closure_alloc (size_t @var{size}, void **@var{code}) +Allocate a chunk of memory holding @var{size} bytes. This returns a +pointer to the writable address, and sets *@var{code} to the +corresponding executable address. + +@var{size} should be sufficient to hold a @code{ffi_closure} object. +@end defun + +@findex ffi_closure_free +@defun void ffi_closure_free (void *@var{writable}) +Free memory allocated using @code{ffi_closure_alloc}. The argument is +the writable address that was returned. +@end defun + + +Once you have allocated the memory for a closure, you must construct a +@code{ffi_cif} describing the function call. Finally you can prepare +the closure function: + +@findex ffi_prep_closure_loc +@defun ffi_status ffi_prep_closure_loc (ffi_closure *@var{closure}, ffi_cif *@var{cif}, void (*@var{fun}) (ffi_cif *@var{cif}, void *@var{ret}, void **@var{args}, void *@var{user_data}), void *@var{user_data}, void *@var{codeloc}) +Prepare a closure function. + +@var{closure} is the address of a @code{ffi_closure} object; this is +the writable address returned by @code{ffi_closure_alloc}. + +@var{cif} is the @code{ffi_cif} describing the function parameters. + +@var{user_data} is an arbitrary datum that is passed, uninterpreted, +to your closure function. + +@var{codeloc} is the executable address returned by +@code{ffi_closure_alloc}. + +@var{fun} is the function which will be called when the closure is +invoked. It is called with the arguments: +@table @var +@item cif +The @code{ffi_cif} passed to @code{ffi_prep_closure_loc}. + +@item ret +A pointer to the memory used for the function's return value. +@var{fun} must fill this, unless the function is declared as returning +@code{void}. +@c FIXME: is this NULL for void-returning functions? + +@item args +A vector of pointers to memory holding the arguments to the function. + +@item user_data +The same @var{user_data} that was passed to +@code{ffi_prep_closure_loc}. +@end table + +@code{ffi_prep_closure_loc} will return @code{FFI_OK} if everything +went ok, and something else on error. +@c FIXME: what? + +After calling @code{ffi_prep_closure_loc}, you can cast @var{codeloc} +to the appropriate pointer-to-function type. +@end defun + +You may see old code referring to @code{ffi_prep_closure}. This +function is deprecated, as it cannot handle the need for separate +writable and executable addresses. + +@node Closure Example +@section Closure Example + +A trivial example that creates a new @code{puts} by binding +@code{fputs} with @code{stdin}. + +@example +#include +#include + +/* Acts like puts with the file given at time of enclosure. */ +void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[], + FILE *stream) +@{ + *ret = fputs(*(char **)args[0], stream); +@} + +int main() +@{ + ffi_cif cif; + ffi_type *args[1]; + ffi_closure *closure; + + int (*bound_puts)(char *); + int rc; + + /* Allocate closure and bound_puts */ + closure = ffi_closure_alloc(sizeof(ffi_closure), &bound_puts); + + if (closure) + @{ + /* Initialize the argument info vectors */ + args[0] = &ffi_type_pointer; + + /* Initialize the cif */ + if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_uint, args) == FFI_OK) + @{ + /* Initialize the closure, setting stream to stdout */ + if (ffi_prep_closure_loc(closure, &cif, puts_binding, + stdout, bound_puts) == FFI_OK) + @{ + rc = bound_puts("Hello World!"); + /* rc now holds the result of the call to fputs */ + @} + @} + @} + + /* Deallocate both closure, and bound_puts */ + ffi_closure_free(closure); + + return 0; +@} + +@end example + + +@node Missing Features +@chapter Missing Features + +@code{libffi} is missing a few features. We welcome patches to add +support for these. + +@itemize @bullet +@item +There is no support for calling varargs functions. This may work on +some platforms, depending on how the ABI is defined, but it is not +reliable. + +@item +There is no support for bit fields in structures. + +@item +The closure API is + +@c FIXME: ... + +@item +The ``raw'' API is undocumented. +@c argument promotion? +@c unions? +@c anything else? +@end itemize + + +@node Index +@unnumbered Index + +@printindex cp + +@bye diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/doc/stamp-vti b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/doc/stamp-vti new file mode 100644 index 000000000..5377bb85f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/doc/stamp-vti @@ -0,0 +1,4 @@ +@set UPDATED 23 August 2011 +@set UPDATED-MONTH August 2011 +@set EDITION 3.0.10 +@set VERSION 3.0.10 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/doc/version.texi b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/doc/version.texi new file mode 100644 index 000000000..5377bb85f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/doc/version.texi @@ -0,0 +1,4 @@ +@set UPDATED 23 August 2011 +@set UPDATED-MONTH August 2011 +@set EDITION 3.0.10 +@set VERSION 3.0.10 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/fficonfig.h.in b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/fficonfig.h.in new file mode 100644 index 000000000..6c92c56cd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/fficonfig.h.in @@ -0,0 +1,199 @@ +/* fficonfig.h.in. Generated from configure.ac by autoheader. */ + +/* Define if building universal (internal helper macro) */ +#undef AC_APPLE_UNIVERSAL_BUILD + +/* Define to one of `_getb67', `GETB67', `getb67' for Cray-2 and Cray-YMP + systems. This function is required for `alloca.c' support on those systems. + */ +#undef CRAY_STACKSEG_END + +/* Define to 1 if using `alloca.c'. */ +#undef C_ALLOCA + +/* Define to the flags needed for the .section .eh_frame directive. */ +#undef EH_FRAME_FLAGS + +/* Define this if you want extra debugging. */ +#undef FFI_DEBUG + +/* Cannot use PROT_EXEC on this target, so, we revert to alternative means */ +#undef FFI_EXEC_TRAMPOLINE_TABLE + +/* Cannot use malloc on this target, so, we revert to alternative means */ +#undef FFI_MMAP_EXEC_WRIT + +/* Define this is you do not want support for the raw API. */ +#undef FFI_NO_RAW_API + +/* Define this is you do not want support for aggregate types. */ +#undef FFI_NO_STRUCTS + +/* Define to 1 if you have `alloca', as a function or macro. */ +#undef HAVE_ALLOCA + +/* Define to 1 if you have and it should be used (not on Ultrix). + */ +#undef HAVE_ALLOCA_H + +/* Define if your assembler supports .ascii. */ +#undef HAVE_AS_ASCII_PSEUDO_OP + +/* Define if your assembler supports .cfi_* directives. */ +#undef HAVE_AS_CFI_PSEUDO_OP + +/* Define if your assembler supports .register. */ +#undef HAVE_AS_REGISTER_PSEUDO_OP + +/* Define if your assembler and linker support unaligned PC relative relocs. + */ +#undef HAVE_AS_SPARC_UA_PCREL + +/* Define if your assembler supports .string. */ +#undef HAVE_AS_STRING_PSEUDO_OP + +/* Define if your assembler supports unwind section type. */ +#undef HAVE_AS_X86_64_UNWIND_SECTION_TYPE + +/* Define if your assembler supports PC relative relocs. */ +#undef HAVE_AS_X86_PCREL + +/* Define to 1 if you have the header file. */ +#undef HAVE_DLFCN_H + +/* Define if __attribute__((visibility("hidden"))) is supported. */ +#undef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE + +/* Define to 1 if you have the header file. */ +#undef HAVE_INTTYPES_H + +/* Define if you have the long double type and it is bigger than a double */ +#undef HAVE_LONG_DOUBLE + +/* Define to 1 if you have the `memcpy' function. */ +#undef HAVE_MEMCPY + +/* Define to 1 if you have the header file. */ +#undef HAVE_MEMORY_H + +/* Define to 1 if you have the `mmap' function. */ +#undef HAVE_MMAP + +/* Define if mmap with MAP_ANON(YMOUS) works. */ +#undef HAVE_MMAP_ANON + +/* Define if mmap of /dev/zero works. */ +#undef HAVE_MMAP_DEV_ZERO + +/* Define if read-only mmap of a plain file works. */ +#undef HAVE_MMAP_FILE + +/* Define if .eh_frame sections should be read-only. */ +#undef HAVE_RO_EH_FRAME + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDINT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STDLIB_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRINGS_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_STRING_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_MMAN_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_STAT_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_SYS_TYPES_H + +/* Define to 1 if you have the header file. */ +#undef HAVE_UNISTD_H + +/* Define to the sub-directory in which libtool stores uninstalled libraries. + */ +#undef LT_OBJDIR + +/* Define to 1 if your C compiler doesn't accept -c and -o together. */ +#undef NO_MINUS_C_MINUS_O + +/* Name of package */ +#undef PACKAGE + +/* Define to the address where bug reports for this package should be sent. */ +#undef PACKAGE_BUGREPORT + +/* Define to the full name of this package. */ +#undef PACKAGE_NAME + +/* Define to the full name and version of this package. */ +#undef PACKAGE_STRING + +/* Define to the one symbol short name of this package. */ +#undef PACKAGE_TARNAME + +/* Define to the home page for this package. */ +#undef PACKAGE_URL + +/* Define to the version of this package. */ +#undef PACKAGE_VERSION + +/* The size of `double', as computed by sizeof. */ +#undef SIZEOF_DOUBLE + +/* The size of `long double', as computed by sizeof. */ +#undef SIZEOF_LONG_DOUBLE + +/* If using the C implementation of alloca, define if you know the + direction of stack growth for your system; otherwise it will be + automatically deduced at runtime. + STACK_DIRECTION > 0 => grows toward higher addresses + STACK_DIRECTION < 0 => grows toward lower addresses + STACK_DIRECTION = 0 => direction of growth unknown */ +#undef STACK_DIRECTION + +/* Define to 1 if you have the ANSI C header files. */ +#undef STDC_HEADERS + +/* Define this if you are using Purify and want to suppress spurious messages. + */ +#undef USING_PURIFY + +/* Version number of package */ +#undef VERSION + +/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most + significant byte first (like Motorola and SPARC, unlike Intel). */ +#if defined AC_APPLE_UNIVERSAL_BUILD +# if defined __BIG_ENDIAN__ +# define WORDS_BIGENDIAN 1 +# endif +#else +# ifndef WORDS_BIGENDIAN +# undef WORDS_BIGENDIAN +# endif +#endif + +/* Define to `unsigned int' if does not define. */ +#undef size_t + + +#ifdef HAVE_HIDDEN_VISIBILITY_ATTRIBUTE +#ifdef LIBFFI_ASM +#define FFI_HIDDEN(name) .hidden name +#else +#define FFI_HIDDEN __attribute__ ((visibility ("hidden"))) +#endif +#else +#ifdef LIBFFI_ASM +#define FFI_HIDDEN(name) +#else +#define FFI_HIDDEN +#endif +#endif + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/fficonfig.hw b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/fficonfig.hw new file mode 100644 index 000000000..4d7506ac1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/fficonfig.hw @@ -0,0 +1,57 @@ +/* -----------------------------------------------------------------*-C-*- + libffi - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +/* ------------------------------------------------------------------- + + -------------------------------------------------------------------- */ + +#ifndef LIBFFICONFIG_H +#define LIBFFICONFIG_H + +#define HAVE_ALLOCA 1 +#define HAVE_MEMCPY 1 +#define HAVE_MEMORY_H 1 +#define HAVE_STDLIB_H 1 +#define HAVE_STRING_H 1 +#define HAVE_SYS_STAT_H 1 +#define HAVE_SYS_TYPES_H 1 +#define STDC_HEADERS 1 + +#if defined(X86_WIN64) +#define SIZEOF_DOUBLE 8 +#define SIZEOF_LONG_DOUBLE 0 +#else +#define SIZEOF_DOUBLE 8 +#define SIZEOF_LONG_DOUBLE 0 +#endif + +#ifdef LIBFFI_ASM +#define FFI_HIDDEN(name) +#else +#define FFI_HIDDEN +#endif + +#endif /* LIBFFICONFIG_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/include/Makefile.am b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/include/Makefile.am new file mode 100644 index 000000000..fd2802497 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/include/Makefile.am @@ -0,0 +1,9 @@ +## Process this with automake to create Makefile.in + +AUTOMAKE_OPTIONS=foreign + +DISTCLEANFILES=ffitarget.h +EXTRA_DIST=ffi.h.in ffi_common.h + +includesdir = $(libdir)/@PACKAGE_NAME@-@PACKAGE_VERSION@/include +nodist_includes_HEADERS = ffi.h ffitarget.h diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/include/Makefile.in b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/include/Makefile.in new file mode 100644 index 000000000..f3d3ef2d1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/include/Makefile.in @@ -0,0 +1,487 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ + +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = include +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \ + $(srcdir)/ffi.h.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cc_maxopt.m4 \ + $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ + $(top_srcdir)/m4/ax_check_compiler_flags.m4 \ + $(top_srcdir)/m4/ax_compiler_vendor.m4 \ + $(top_srcdir)/m4/ax_configure_args.m4 \ + $(top_srcdir)/m4/ax_enable_builddir.m4 \ + $(top_srcdir)/m4/ax_gcc_archflag.m4 \ + $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/fficonfig.h +CONFIG_CLEAN_FILES = ffi.h ffitarget.h +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +am__installdirs = "$(DESTDIR)$(includesdir)" +HEADERS = $(nodist_includes_HEADERS) +ETAGS = etags +CTAGS = ctags +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_LTLDFLAGS = @AM_LTLDFLAGS@ +AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PRTDIAG = @PRTDIAG@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TARGET = @TARGET@ +TARGETDIR = @TARGETDIR@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_enable_builddir_sed = @ax_enable_builddir_sed@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sys_symbol_underscore = @sys_symbol_underscore@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +toolexecdir = @toolexecdir@ +toolexeclibdir = @toolexeclibdir@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = foreign +DISTCLEANFILES = ffitarget.h +EXTRA_DIST = ffi.h.in ffi_common.h +includesdir = $(libdir)/@PACKAGE_NAME@-@PACKAGE_VERSION@/include +nodist_includes_HEADERS = ffi.h ffitarget.h +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign include/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign include/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): +ffi.h: $(top_builddir)/config.status $(srcdir)/ffi.h.in + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-nodist_includesHEADERS: $(nodist_includes_HEADERS) + @$(NORMAL_INSTALL) + test -z "$(includesdir)" || $(MKDIR_P) "$(DESTDIR)$(includesdir)" + @list='$(nodist_includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + for p in $$list; do \ + if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; \ + done | $(am__base_list) | \ + while read files; do \ + echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includesdir)'"; \ + $(INSTALL_HEADER) $$files "$(DESTDIR)$(includesdir)" || exit $$?; \ + done + +uninstall-nodist_includesHEADERS: + @$(NORMAL_UNINSTALL) + @list='$(nodist_includes_HEADERS)'; test -n "$(includesdir)" || list=; \ + files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \ + test -n "$$files" || exit 0; \ + echo " ( cd '$(DESTDIR)$(includesdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(includesdir)" && rm -f $$files + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique +tags: TAGS + +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi +ctags: CTAGS +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(HEADERS) +installdirs: + for dir in "$(DESTDIR)$(includesdir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + -test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic distclean-tags + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-nodist_includesHEADERS + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-nodist_includesHEADERS + +.MAKE: install-am install-strip + +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool ctags distclean distclean-generic \ + distclean-libtool distclean-tags distdir dvi dvi-am html \ + html-am info info-am install install-am install-data \ + install-data-am install-dvi install-dvi-am install-exec \ + install-exec-am install-html install-html-am install-info \ + install-info-am install-man install-nodist_includesHEADERS \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + tags uninstall uninstall-am uninstall-nodist_includesHEADERS + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/include/ffi.h.in b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/include/ffi.h.in new file mode 100644 index 000000000..f5a29b02f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/include/ffi.h.in @@ -0,0 +1,427 @@ +/* -----------------------------------------------------------------*-C-*- + libffi @VERSION@ - Copyright (c) 2011 Anthony Green + - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the ``Software''), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +/* ------------------------------------------------------------------- + The basic API is described in the README file. + + The raw API is designed to bypass some of the argument packing + and unpacking on architectures for which it can be avoided. + + The closure API allows interpreted functions to be packaged up + inside a C function pointer, so that they can be called as C functions, + with no understanding on the client side that they are interpreted. + It can also be used in other cases in which it is necessary to package + up a user specified parameter and a function pointer as a single + function pointer. + + The closure API must be implemented in order to get its functionality, + e.g. for use by gij. Routines are provided to emulate the raw API + if the underlying platform doesn't allow faster implementation. + + More details on the raw and cloure API can be found in: + + http://gcc.gnu.org/ml/java/1999-q3/msg00138.html + + and + + http://gcc.gnu.org/ml/java/1999-q3/msg00174.html + -------------------------------------------------------------------- */ + +#ifndef LIBFFI_H +#define LIBFFI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Specify which architecture libffi is configured for. */ +#ifndef @TARGET@ +#define @TARGET@ +#endif + +/* ---- System configuration information --------------------------------- */ + +#include + +#ifndef LIBFFI_ASM + +#ifdef _MSC_VER +#define __attribute__(X) +#endif + +#include +#include + +/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). + But we can find it either under the correct ANSI name, or under GNU + C's internal name. */ + +#define FFI_64_BIT_MAX 9223372036854775807 + +#ifdef LONG_LONG_MAX +# define FFI_LONG_LONG_MAX LONG_LONG_MAX +#else +# ifdef LLONG_MAX +# define FFI_LONG_LONG_MAX LLONG_MAX +# ifdef _AIX52 /* or newer has C99 LLONG_MAX */ +# undef FFI_64_BIT_MAX +# define FFI_64_BIT_MAX 9223372036854775807LL +# endif /* _AIX52 or newer */ +# else +# ifdef __GNUC__ +# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ +# endif +# ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */ +# ifndef __PPC64__ +# if defined (__IBMC__) || defined (__IBMCPP__) +# define FFI_LONG_LONG_MAX LONGLONG_MAX +# endif +# endif /* __PPC64__ */ +# undef FFI_64_BIT_MAX +# define FFI_64_BIT_MAX 9223372036854775807LL +# endif +# endif +#endif + +/* The closure code assumes that this works on pointers, i.e. a size_t */ +/* can hold a pointer. */ + +typedef struct _ffi_type +{ + size_t size; + unsigned short alignment; + unsigned short type; + struct _ffi_type **elements; +} ffi_type; + +#ifndef LIBFFI_HIDE_BASIC_TYPES +#if SCHAR_MAX == 127 +# define ffi_type_uchar ffi_type_uint8 +# define ffi_type_schar ffi_type_sint8 +#else + #error "char size not supported" +#endif + +#if SHRT_MAX == 32767 +# define ffi_type_ushort ffi_type_uint16 +# define ffi_type_sshort ffi_type_sint16 +#elif SHRT_MAX == 2147483647 +# define ffi_type_ushort ffi_type_uint32 +# define ffi_type_sshort ffi_type_sint32 +#else + #error "short size not supported" +#endif + +#if INT_MAX == 32767 +# define ffi_type_uint ffi_type_uint16 +# define ffi_type_sint ffi_type_sint16 +#elif INT_MAX == 2147483647 +# define ffi_type_uint ffi_type_uint32 +# define ffi_type_sint ffi_type_sint32 +#elif INT_MAX == 9223372036854775807 +# define ffi_type_uint ffi_type_uint64 +# define ffi_type_sint ffi_type_sint64 +#else + #error "int size not supported" +#endif + +#if LONG_MAX == 2147483647 +# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX + #error "no 64-bit data type supported" +# endif +#elif LONG_MAX != FFI_64_BIT_MAX + #error "long size not supported" +#endif + +#if LONG_MAX == 2147483647 +# define ffi_type_ulong ffi_type_uint32 +# define ffi_type_slong ffi_type_sint32 +#elif LONG_MAX == FFI_64_BIT_MAX +# define ffi_type_ulong ffi_type_uint64 +# define ffi_type_slong ffi_type_sint64 +#else + #error "long size not supported" +#endif + +/* These are defined in types.c */ +extern ffi_type ffi_type_void; +extern ffi_type ffi_type_uint8; +extern ffi_type ffi_type_sint8; +extern ffi_type ffi_type_uint16; +extern ffi_type ffi_type_sint16; +extern ffi_type ffi_type_uint32; +extern ffi_type ffi_type_sint32; +extern ffi_type ffi_type_uint64; +extern ffi_type ffi_type_sint64; +extern ffi_type ffi_type_float; +extern ffi_type ffi_type_double; +extern ffi_type ffi_type_pointer; + +#if @HAVE_LONG_DOUBLE@ +extern ffi_type ffi_type_longdouble; +#else +#define ffi_type_longdouble ffi_type_double +#endif +#endif /* LIBFFI_HIDE_BASIC_TYPES */ + +typedef enum { + FFI_OK = 0, + FFI_BAD_TYPEDEF, + FFI_BAD_ABI +} ffi_status; + +typedef unsigned FFI_TYPE; + +typedef struct { + ffi_abi abi; + unsigned nargs; + ffi_type **arg_types; + ffi_type *rtype; + unsigned bytes; + unsigned flags; +#ifdef FFI_EXTRA_CIF_FIELDS + FFI_EXTRA_CIF_FIELDS; +#endif +} ffi_cif; + +/* ---- Definitions for the raw API -------------------------------------- */ + +#ifndef FFI_SIZEOF_ARG +# if LONG_MAX == 2147483647 +# define FFI_SIZEOF_ARG 4 +# elif LONG_MAX == FFI_64_BIT_MAX +# define FFI_SIZEOF_ARG 8 +# endif +#endif + +#ifndef FFI_SIZEOF_JAVA_RAW +# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG +#endif + +typedef union { + ffi_sarg sint; + ffi_arg uint; + float flt; + char data[FFI_SIZEOF_ARG]; + void* ptr; +} ffi_raw; + +#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8 +/* This is a special case for mips64/n32 ABI (and perhaps others) where + sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */ +typedef union { + signed int sint; + unsigned int uint; + float flt; + char data[FFI_SIZEOF_JAVA_RAW]; + void* ptr; +} ffi_java_raw; +#else +typedef ffi_raw ffi_java_raw; +#endif + + +void ffi_raw_call (ffi_cif *cif, + void (*fn)(void), + void *rvalue, + ffi_raw *avalue); + +void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); +void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); +size_t ffi_raw_size (ffi_cif *cif); + +/* This is analogous to the raw API, except it uses Java parameter */ +/* packing, even on 64-bit machines. I.e. on 64-bit machines */ +/* longs and doubles are followed by an empty 64-bit word. */ + +void ffi_java_raw_call (ffi_cif *cif, + void (*fn)(void), + void *rvalue, + ffi_java_raw *avalue); + +void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); +void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); +size_t ffi_java_raw_size (ffi_cif *cif); + +/* ---- Definitions for closures ----------------------------------------- */ + +#if FFI_CLOSURES + +#ifdef _MSC_VER +__declspec(align(8)) +#endif +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + ffi_cif *cif; + void (*fun)(ffi_cif*,void*,void**,void*); + void *user_data; +#ifdef __GNUC__ +} ffi_closure __attribute__((aligned (8))); +#else +} ffi_closure; +# ifdef __sgi +# pragma pack 0 +# endif +#endif + +void *ffi_closure_alloc (size_t size, void **code); +void ffi_closure_free (void *); + +ffi_status +ffi_prep_closure (ffi_closure*, + ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data); + +ffi_status +ffi_prep_closure_loc (ffi_closure*, + ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void*codeloc); + +#ifdef __sgi +# pragma pack 8 +#endif +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + + ffi_cif *cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*,void*,void**,void*); + void *this_closure; + +#endif + + void (*fun)(ffi_cif*,void*,ffi_raw*,void*); + void *user_data; + +} ffi_raw_closure; + +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + + ffi_cif *cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*,void*,void**,void*); + void *this_closure; + +#endif + + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*); + void *user_data; + +} ffi_java_raw_closure; + +ffi_status +ffi_prep_raw_closure (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data); + +ffi_status +ffi_prep_raw_closure_loc (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data, + void *codeloc); + +ffi_status +ffi_prep_java_raw_closure (ffi_java_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), + void *user_data); + +ffi_status +ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), + void *user_data, + void *codeloc); + +#endif /* FFI_CLOSURES */ + +/* ---- Public interface definition -------------------------------------- */ + +ffi_status ffi_prep_cif(ffi_cif *cif, + ffi_abi abi, + unsigned int nargs, + ffi_type *rtype, + ffi_type **atypes); + +void ffi_call(ffi_cif *cif, + void (*fn)(void), + void *rvalue, + void **avalue); + +/* Useful for eliminating compiler warnings */ +#define FFI_FN(f) ((void (*)(void))f) + +/* ---- Definitions shared with assembly code ---------------------------- */ + +#endif + +/* If these change, update src/mips/ffitarget.h. */ +#define FFI_TYPE_VOID 0 +#define FFI_TYPE_INT 1 +#define FFI_TYPE_FLOAT 2 +#define FFI_TYPE_DOUBLE 3 +#if @HAVE_LONG_DOUBLE@ +#define FFI_TYPE_LONGDOUBLE 4 +#else +#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE +#endif +#define FFI_TYPE_UINT8 5 +#define FFI_TYPE_SINT8 6 +#define FFI_TYPE_UINT16 7 +#define FFI_TYPE_SINT16 8 +#define FFI_TYPE_UINT32 9 +#define FFI_TYPE_SINT32 10 +#define FFI_TYPE_UINT64 11 +#define FFI_TYPE_SINT64 12 +#define FFI_TYPE_STRUCT 13 +#define FFI_TYPE_POINTER 14 + +/* This should always refer to the last type code (for sanity checks) */ +#define FFI_TYPE_LAST FFI_TYPE_POINTER + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/include/ffi.h.vc b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/include/ffi.h.vc new file mode 100644 index 000000000..7ba954ce7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/include/ffi.h.vc @@ -0,0 +1,427 @@ +/* -----------------------------------------------------------------*-C-*- + libffi 3.0.10 - Copyright (c) 2011 Anthony Green + - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the ``Software''), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +/* ------------------------------------------------------------------- + The basic API is described in the README file. + + The raw API is designed to bypass some of the argument packing + and unpacking on architectures for which it can be avoided. + + The closure API allows interpreted functions to be packaged up + inside a C function pointer, so that they can be called as C functions, + with no understanding on the client side that they are interpreted. + It can also be used in other cases in which it is necessary to package + up a user specified parameter and a function pointer as a single + function pointer. + + The closure API must be implemented in order to get its functionality, + e.g. for use by gij. Routines are provided to emulate the raw API + if the underlying platform doesn't allow faster implementation. + + More details on the raw and cloure API can be found in: + + http://gcc.gnu.org/ml/java/1999-q3/msg00138.html + + and + + http://gcc.gnu.org/ml/java/1999-q3/msg00174.html + -------------------------------------------------------------------- */ + +#ifndef LIBFFI_H +#define LIBFFI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Specify which architecture libffi is configured for. */ +#ifndef X86_WIN32 +#define X86_WIN32 +#endif + +/* ---- System configuration information --------------------------------- */ + +#include + +#ifndef LIBFFI_ASM + +#ifdef _MSC_VER +#define __attribute__(X) +#endif + +#include +#include + +/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). + But we can find it either under the correct ANSI name, or under GNU + C's internal name. */ + +#define FFI_64_BIT_MAX 9223372036854775807 + +#ifdef LONG_LONG_MAX +# define FFI_LONG_LONG_MAX LONG_LONG_MAX +#else +# ifdef LLONG_MAX +# define FFI_LONG_LONG_MAX LLONG_MAX +# ifdef _AIX52 /* or newer has C99 LLONG_MAX */ +# undef FFI_64_BIT_MAX +# define FFI_64_BIT_MAX 9223372036854775807LL +# endif /* _AIX52 or newer */ +# else +# ifdef __GNUC__ +# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ +# endif +# ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */ +# ifndef __PPC64__ +# if defined (__IBMC__) || defined (__IBMCPP__) +# define FFI_LONG_LONG_MAX LONGLONG_MAX +# endif +# endif /* __PPC64__ */ +# undef FFI_64_BIT_MAX +# define FFI_64_BIT_MAX 9223372036854775807LL +# endif +# endif +#endif + +/* The closure code assumes that this works on pointers, i.e. a size_t */ +/* can hold a pointer. */ + +typedef struct _ffi_type +{ + size_t size; + unsigned short alignment; + unsigned short type; + struct _ffi_type **elements; +} ffi_type; + +#ifndef LIBFFI_HIDE_BASIC_TYPES +#if SCHAR_MAX == 127 +# define ffi_type_uchar ffi_type_uint8 +# define ffi_type_schar ffi_type_sint8 +#else + #error "char size not supported" +#endif + +#if SHRT_MAX == 32767 +# define ffi_type_ushort ffi_type_uint16 +# define ffi_type_sshort ffi_type_sint16 +#elif SHRT_MAX == 2147483647 +# define ffi_type_ushort ffi_type_uint32 +# define ffi_type_sshort ffi_type_sint32 +#else + #error "short size not supported" +#endif + +#if INT_MAX == 32767 +# define ffi_type_uint ffi_type_uint16 +# define ffi_type_sint ffi_type_sint16 +#elif INT_MAX == 2147483647 +# define ffi_type_uint ffi_type_uint32 +# define ffi_type_sint ffi_type_sint32 +#elif INT_MAX == 9223372036854775807 +# define ffi_type_uint ffi_type_uint64 +# define ffi_type_sint ffi_type_sint64 +#else + #error "int size not supported" +#endif + +#if LONG_MAX == 2147483647 +# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX + #error "no 64-bit data type supported" +# endif +#elif LONG_MAX != FFI_64_BIT_MAX + #error "long size not supported" +#endif + +#if LONG_MAX == 2147483647 +# define ffi_type_ulong ffi_type_uint32 +# define ffi_type_slong ffi_type_sint32 +#elif LONG_MAX == FFI_64_BIT_MAX +# define ffi_type_ulong ffi_type_uint64 +# define ffi_type_slong ffi_type_sint64 +#else + #error "long size not supported" +#endif + +/* These are defined in types.c */ +extern ffi_type ffi_type_void; +extern ffi_type ffi_type_uint8; +extern ffi_type ffi_type_sint8; +extern ffi_type ffi_type_uint16; +extern ffi_type ffi_type_sint16; +extern ffi_type ffi_type_uint32; +extern ffi_type ffi_type_sint32; +extern ffi_type ffi_type_uint64; +extern ffi_type ffi_type_sint64; +extern ffi_type ffi_type_float; +extern ffi_type ffi_type_double; +extern ffi_type ffi_type_pointer; + +#if 0 +extern ffi_type ffi_type_longdouble; +#else +#define ffi_type_longdouble ffi_type_double +#endif +#endif /* LIBFFI_HIDE_BASIC_TYPES */ + +typedef enum { + FFI_OK = 0, + FFI_BAD_TYPEDEF, + FFI_BAD_ABI +} ffi_status; + +typedef unsigned FFI_TYPE; + +typedef struct { + ffi_abi abi; + unsigned nargs; + ffi_type **arg_types; + ffi_type *rtype; + unsigned bytes; + unsigned flags; +#ifdef FFI_EXTRA_CIF_FIELDS + FFI_EXTRA_CIF_FIELDS; +#endif +} ffi_cif; + +/* ---- Definitions for the raw API -------------------------------------- */ + +#ifndef FFI_SIZEOF_ARG +# if LONG_MAX == 2147483647 +# define FFI_SIZEOF_ARG 4 +# elif LONG_MAX == FFI_64_BIT_MAX +# define FFI_SIZEOF_ARG 8 +# endif +#endif + +#ifndef FFI_SIZEOF_JAVA_RAW +# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG +#endif + +typedef union { + ffi_sarg sint; + ffi_arg uint; + float flt; + char data[FFI_SIZEOF_ARG]; + void* ptr; +} ffi_raw; + +#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8 +/* This is a special case for mips64/n32 ABI (and perhaps others) where + sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */ +typedef union { + signed int sint; + unsigned int uint; + float flt; + char data[FFI_SIZEOF_JAVA_RAW]; + void* ptr; +} ffi_java_raw; +#else +typedef ffi_raw ffi_java_raw; +#endif + + +void ffi_raw_call (ffi_cif *cif, + void (*fn)(void), + void *rvalue, + ffi_raw *avalue); + +void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); +void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); +size_t ffi_raw_size (ffi_cif *cif); + +/* This is analogous to the raw API, except it uses Java parameter */ +/* packing, even on 64-bit machines. I.e. on 64-bit machines */ +/* longs and doubles are followed by an empty 64-bit word. */ + +void ffi_java_raw_call (ffi_cif *cif, + void (*fn)(void), + void *rvalue, + ffi_java_raw *avalue); + +void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); +void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); +size_t ffi_java_raw_size (ffi_cif *cif); + +/* ---- Definitions for closures ----------------------------------------- */ + +#if FFI_CLOSURES + +#ifdef _MSC_VER +__declspec(align(8)) +#endif +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + ffi_cif *cif; + void (*fun)(ffi_cif*,void*,void**,void*); + void *user_data; +#ifdef __GNUC__ +} ffi_closure __attribute__((aligned (8))); +#else +} ffi_closure; +# ifdef __sgi +# pragma pack 0 +# endif +#endif + +void *ffi_closure_alloc (size_t size, void **code); +void ffi_closure_free (void *); + +ffi_status +ffi_prep_closure (ffi_closure*, + ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data); + +ffi_status +ffi_prep_closure_loc (ffi_closure*, + ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void*codeloc); + +#ifdef __sgi +# pragma pack 8 +#endif +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + + ffi_cif *cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*,void*,void**,void*); + void *this_closure; + +#endif + + void (*fun)(ffi_cif*,void*,ffi_raw*,void*); + void *user_data; + +} ffi_raw_closure; + +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + + ffi_cif *cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*,void*,void**,void*); + void *this_closure; + +#endif + + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*); + void *user_data; + +} ffi_java_raw_closure; + +ffi_status +ffi_prep_raw_closure (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data); + +ffi_status +ffi_prep_raw_closure_loc (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data, + void *codeloc); + +ffi_status +ffi_prep_java_raw_closure (ffi_java_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), + void *user_data); + +ffi_status +ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), + void *user_data, + void *codeloc); + +#endif /* FFI_CLOSURES */ + +/* ---- Public interface definition -------------------------------------- */ + +ffi_status ffi_prep_cif(ffi_cif *cif, + ffi_abi abi, + unsigned int nargs, + ffi_type *rtype, + ffi_type **atypes); + +void ffi_call(ffi_cif *cif, + void (*fn)(void), + void *rvalue, + void **avalue); + +/* Useful for eliminating compiler warnings */ +#define FFI_FN(f) ((void (*)(void))f) + +/* ---- Definitions shared with assembly code ---------------------------- */ + +#endif + +/* If these change, update src/mips/ffitarget.h. */ +#define FFI_TYPE_VOID 0 +#define FFI_TYPE_INT 1 +#define FFI_TYPE_FLOAT 2 +#define FFI_TYPE_DOUBLE 3 +#if 0 +#define FFI_TYPE_LONGDOUBLE 4 +#else +#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE +#endif +#define FFI_TYPE_UINT8 5 +#define FFI_TYPE_SINT8 6 +#define FFI_TYPE_UINT16 7 +#define FFI_TYPE_SINT16 8 +#define FFI_TYPE_UINT32 9 +#define FFI_TYPE_SINT32 10 +#define FFI_TYPE_UINT64 11 +#define FFI_TYPE_SINT64 12 +#define FFI_TYPE_STRUCT 13 +#define FFI_TYPE_POINTER 14 + +/* This should always refer to the last type code (for sanity checks) */ +#define FFI_TYPE_LAST FFI_TYPE_POINTER + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/include/ffi.h.vc64 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/include/ffi.h.vc64 new file mode 100644 index 000000000..6489c9fc2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/include/ffi.h.vc64 @@ -0,0 +1,427 @@ +/* -----------------------------------------------------------------*-C-*- + libffi 3.0.10 - Copyright (c) 2011 Anthony Green + - Copyright (c) 1996-2003, 2007, 2008 Red Hat, Inc. + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the ``Software''), to deal in the Software without + restriction, including without limitation the rights to use, copy, + modify, merge, publish, distribute, sublicense, and/or sell copies + of the Software, and to permit persons to whom the Software is + furnished to do so, subject to the following conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +/* ------------------------------------------------------------------- + The basic API is described in the README file. + + The raw API is designed to bypass some of the argument packing + and unpacking on architectures for which it can be avoided. + + The closure API allows interpreted functions to be packaged up + inside a C function pointer, so that they can be called as C functions, + with no understanding on the client side that they are interpreted. + It can also be used in other cases in which it is necessary to package + up a user specified parameter and a function pointer as a single + function pointer. + + The closure API must be implemented in order to get its functionality, + e.g. for use by gij. Routines are provided to emulate the raw API + if the underlying platform doesn't allow faster implementation. + + More details on the raw and cloure API can be found in: + + http://gcc.gnu.org/ml/java/1999-q3/msg00138.html + + and + + http://gcc.gnu.org/ml/java/1999-q3/msg00174.html + -------------------------------------------------------------------- */ + +#ifndef LIBFFI_H +#define LIBFFI_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* Specify which architecture libffi is configured for. */ +#ifndef X86_WIN64 +#define X86_WIN64 +#endif + +/* ---- System configuration information --------------------------------- */ + +#include + +#ifndef LIBFFI_ASM + +#ifdef _MSC_VER +#define __attribute__(X) +#endif + +#include +#include + +/* LONG_LONG_MAX is not always defined (not if STRICT_ANSI, for example). + But we can find it either under the correct ANSI name, or under GNU + C's internal name. */ + +#define FFI_64_BIT_MAX 9223372036854775807 + +#ifdef LONG_LONG_MAX +# define FFI_LONG_LONG_MAX LONG_LONG_MAX +#else +# ifdef LLONG_MAX +# define FFI_LONG_LONG_MAX LLONG_MAX +# ifdef _AIX52 /* or newer has C99 LLONG_MAX */ +# undef FFI_64_BIT_MAX +# define FFI_64_BIT_MAX 9223372036854775807LL +# endif /* _AIX52 or newer */ +# else +# ifdef __GNUC__ +# define FFI_LONG_LONG_MAX __LONG_LONG_MAX__ +# endif +# ifdef _AIX /* AIX 5.1 and earlier have LONGLONG_MAX */ +# ifndef __PPC64__ +# if defined (__IBMC__) || defined (__IBMCPP__) +# define FFI_LONG_LONG_MAX LONGLONG_MAX +# endif +# endif /* __PPC64__ */ +# undef FFI_64_BIT_MAX +# define FFI_64_BIT_MAX 9223372036854775807LL +# endif +# endif +#endif + +/* The closure code assumes that this works on pointers, i.e. a size_t */ +/* can hold a pointer. */ + +typedef struct _ffi_type +{ + size_t size; + unsigned short alignment; + unsigned short type; + struct _ffi_type **elements; +} ffi_type; + +#ifndef LIBFFI_HIDE_BASIC_TYPES +#if SCHAR_MAX == 127 +# define ffi_type_uchar ffi_type_uint8 +# define ffi_type_schar ffi_type_sint8 +#else + #error "char size not supported" +#endif + +#if SHRT_MAX == 32767 +# define ffi_type_ushort ffi_type_uint16 +# define ffi_type_sshort ffi_type_sint16 +#elif SHRT_MAX == 2147483647 +# define ffi_type_ushort ffi_type_uint32 +# define ffi_type_sshort ffi_type_sint32 +#else + #error "short size not supported" +#endif + +#if INT_MAX == 32767 +# define ffi_type_uint ffi_type_uint16 +# define ffi_type_sint ffi_type_sint16 +#elif INT_MAX == 2147483647 +# define ffi_type_uint ffi_type_uint32 +# define ffi_type_sint ffi_type_sint32 +#elif INT_MAX == 9223372036854775807 +# define ffi_type_uint ffi_type_uint64 +# define ffi_type_sint ffi_type_sint64 +#else + #error "int size not supported" +#endif + +#if LONG_MAX == 2147483647 +# if FFI_LONG_LONG_MAX != FFI_64_BIT_MAX + #error "no 64-bit data type supported" +# endif +#elif LONG_MAX != FFI_64_BIT_MAX + #error "long size not supported" +#endif + +#if LONG_MAX == 2147483647 +# define ffi_type_ulong ffi_type_uint32 +# define ffi_type_slong ffi_type_sint32 +#elif LONG_MAX == FFI_64_BIT_MAX +# define ffi_type_ulong ffi_type_uint64 +# define ffi_type_slong ffi_type_sint64 +#else + #error "long size not supported" +#endif + +/* These are defined in types.c */ +extern ffi_type ffi_type_void; +extern ffi_type ffi_type_uint8; +extern ffi_type ffi_type_sint8; +extern ffi_type ffi_type_uint16; +extern ffi_type ffi_type_sint16; +extern ffi_type ffi_type_uint32; +extern ffi_type ffi_type_sint32; +extern ffi_type ffi_type_uint64; +extern ffi_type ffi_type_sint64; +extern ffi_type ffi_type_float; +extern ffi_type ffi_type_double; +extern ffi_type ffi_type_pointer; + +#if 0 +extern ffi_type ffi_type_longdouble; +#else +#define ffi_type_longdouble ffi_type_double +#endif +#endif /* LIBFFI_HIDE_BASIC_TYPES */ + +typedef enum { + FFI_OK = 0, + FFI_BAD_TYPEDEF, + FFI_BAD_ABI +} ffi_status; + +typedef unsigned FFI_TYPE; + +typedef struct { + ffi_abi abi; + unsigned nargs; + ffi_type **arg_types; + ffi_type *rtype; + unsigned bytes; + unsigned flags; +#ifdef FFI_EXTRA_CIF_FIELDS + FFI_EXTRA_CIF_FIELDS; +#endif +} ffi_cif; + +/* ---- Definitions for the raw API -------------------------------------- */ + +#ifndef FFI_SIZEOF_ARG +# if LONG_MAX == 2147483647 +# define FFI_SIZEOF_ARG 4 +# elif LONG_MAX == FFI_64_BIT_MAX +# define FFI_SIZEOF_ARG 8 +# endif +#endif + +#ifndef FFI_SIZEOF_JAVA_RAW +# define FFI_SIZEOF_JAVA_RAW FFI_SIZEOF_ARG +#endif + +typedef union { + ffi_sarg sint; + ffi_arg uint; + float flt; + char data[FFI_SIZEOF_ARG]; + void* ptr; +} ffi_raw; + +#if FFI_SIZEOF_JAVA_RAW == 4 && FFI_SIZEOF_ARG == 8 +/* This is a special case for mips64/n32 ABI (and perhaps others) where + sizeof(void *) is 4 and FFI_SIZEOF_ARG is 8. */ +typedef union { + signed int sint; + unsigned int uint; + float flt; + char data[FFI_SIZEOF_JAVA_RAW]; + void* ptr; +} ffi_java_raw; +#else +typedef ffi_raw ffi_java_raw; +#endif + + +void ffi_raw_call (ffi_cif *cif, + void (*fn)(void), + void *rvalue, + ffi_raw *avalue); + +void ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw); +void ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args); +size_t ffi_raw_size (ffi_cif *cif); + +/* This is analogous to the raw API, except it uses Java parameter */ +/* packing, even on 64-bit machines. I.e. on 64-bit machines */ +/* longs and doubles are followed by an empty 64-bit word. */ + +void ffi_java_raw_call (ffi_cif *cif, + void (*fn)(void), + void *rvalue, + ffi_java_raw *avalue); + +void ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw); +void ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args); +size_t ffi_java_raw_size (ffi_cif *cif); + +/* ---- Definitions for closures ----------------------------------------- */ + +#if FFI_CLOSURES + +#ifdef _MSC_VER +__declspec(align(8)) +#endif +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + ffi_cif *cif; + void (*fun)(ffi_cif*,void*,void**,void*); + void *user_data; +#ifdef __GNUC__ +} ffi_closure __attribute__((aligned (8))); +#else +} ffi_closure; +# ifdef __sgi +# pragma pack 0 +# endif +#endif + +void *ffi_closure_alloc (size_t size, void **code); +void ffi_closure_free (void *); + +ffi_status +ffi_prep_closure (ffi_closure*, + ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data); + +ffi_status +ffi_prep_closure_loc (ffi_closure*, + ffi_cif *, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void*codeloc); + +#ifdef __sgi +# pragma pack 8 +#endif +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + + ffi_cif *cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*,void*,void**,void*); + void *this_closure; + +#endif + + void (*fun)(ffi_cif*,void*,ffi_raw*,void*); + void *user_data; + +} ffi_raw_closure; + +typedef struct { + char tramp[FFI_TRAMPOLINE_SIZE]; + + ffi_cif *cif; + +#if !FFI_NATIVE_RAW_API + + /* if this is enabled, then a raw closure has the same layout + as a regular closure. We use this to install an intermediate + handler to do the transaltion, void** -> ffi_raw*. */ + + void (*translate_args)(ffi_cif*,void*,void**,void*); + void *this_closure; + +#endif + + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*); + void *user_data; + +} ffi_java_raw_closure; + +ffi_status +ffi_prep_raw_closure (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data); + +ffi_status +ffi_prep_raw_closure_loc (ffi_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data, + void *codeloc); + +ffi_status +ffi_prep_java_raw_closure (ffi_java_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), + void *user_data); + +ffi_status +ffi_prep_java_raw_closure_loc (ffi_java_raw_closure*, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), + void *user_data, + void *codeloc); + +#endif /* FFI_CLOSURES */ + +/* ---- Public interface definition -------------------------------------- */ + +ffi_status ffi_prep_cif(ffi_cif *cif, + ffi_abi abi, + unsigned int nargs, + ffi_type *rtype, + ffi_type **atypes); + +void ffi_call(ffi_cif *cif, + void (*fn)(void), + void *rvalue, + void **avalue); + +/* Useful for eliminating compiler warnings */ +#define FFI_FN(f) ((void (*)(void))f) + +/* ---- Definitions shared with assembly code ---------------------------- */ + +#endif + +/* If these change, update src/mips/ffitarget.h. */ +#define FFI_TYPE_VOID 0 +#define FFI_TYPE_INT 1 +#define FFI_TYPE_FLOAT 2 +#define FFI_TYPE_DOUBLE 3 +#if 0 +#define FFI_TYPE_LONGDOUBLE 4 +#else +#define FFI_TYPE_LONGDOUBLE FFI_TYPE_DOUBLE +#endif +#define FFI_TYPE_UINT8 5 +#define FFI_TYPE_SINT8 6 +#define FFI_TYPE_UINT16 7 +#define FFI_TYPE_SINT16 8 +#define FFI_TYPE_UINT32 9 +#define FFI_TYPE_SINT32 10 +#define FFI_TYPE_UINT64 11 +#define FFI_TYPE_SINT64 12 +#define FFI_TYPE_STRUCT 13 +#define FFI_TYPE_POINTER 14 + +/* This should always refer to the last type code (for sanity checks) */ +#define FFI_TYPE_LAST FFI_TYPE_POINTER + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/include/ffi_common.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/include/ffi_common.h new file mode 100644 index 000000000..d95376277 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/include/ffi_common.h @@ -0,0 +1,126 @@ +/* ----------------------------------------------------------------------- + ffi_common.h - Copyright (C) 2011 Anthony Green + Copyright (C) 2007 Free Software Foundation, Inc + Copyright (c) 1996 Red Hat, Inc. + + Common internal definitions and macros. Only necessary for building + libffi. + ----------------------------------------------------------------------- */ + +#ifndef FFI_COMMON_H +#define FFI_COMMON_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +/* Do not move this. Some versions of AIX are very picky about where + this is positioned. */ +#ifdef __GNUC__ +/* mingw64 defines this already in malloc.h. */ +#ifndef alloca +# define alloca __builtin_alloca +#endif +# define MAYBE_UNUSED __attribute__((__unused__)) +#else +# define MAYBE_UNUSED +# if HAVE_ALLOCA_H +# include +# else +# ifdef _AIX + #pragma alloca +# else +# ifndef alloca /* predefined by HP cc +Olibcalls */ +# ifdef _MSC_VER +# define alloca _alloca +# else +char *alloca (); +# endif +# endif +# endif +# endif +#endif + +/* Check for the existence of memcpy. */ +#if STDC_HEADERS +# include +#else +# ifndef HAVE_MEMCPY +# define memcpy(d, s, n) bcopy ((s), (d), (n)) +# endif +#endif + +#if defined(FFI_DEBUG) +#include +#endif + +#ifdef FFI_DEBUG +void ffi_assert(char *expr, char *file, int line); +void ffi_stop_here(void); +void ffi_type_test(ffi_type *a, char *file, int line); + +#define FFI_ASSERT(x) ((x) ? (void)0 : ffi_assert(#x, __FILE__,__LINE__)) +#define FFI_ASSERT_AT(x, f, l) ((x) ? 0 : ffi_assert(#x, (f), (l))) +#define FFI_ASSERT_VALID_TYPE(x) ffi_type_test (x, __FILE__, __LINE__) +#else +#define FFI_ASSERT(x) +#define FFI_ASSERT_AT(x, f, l) +#define FFI_ASSERT_VALID_TYPE(x) +#endif + +#define ALIGN(v, a) (((((size_t) (v))-1) | ((a)-1))+1) +#define ALIGN_DOWN(v, a) (((size_t) (v)) & -a) + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif); + +/* Extended cif, used in callback from assembly routine */ +typedef struct +{ + ffi_cif *cif; + void *rvalue; + void **avalue; +} extended_cif; + +/* Terse sized type definitions. */ +#if defined(_MSC_VER) || defined(__sgi) +typedef unsigned char UINT8; +typedef signed char SINT8; +typedef unsigned short UINT16; +typedef signed short SINT16; +typedef unsigned int UINT32; +typedef signed int SINT32; +# ifdef _MSC_VER +typedef unsigned __int64 UINT64; +typedef signed __int64 SINT64; +# else +# include +typedef uint64_t UINT64; +typedef int64_t SINT64; +# endif +#else +typedef unsigned int UINT8 __attribute__((__mode__(__QI__))); +typedef signed int SINT8 __attribute__((__mode__(__QI__))); +typedef unsigned int UINT16 __attribute__((__mode__(__HI__))); +typedef signed int SINT16 __attribute__((__mode__(__HI__))); +typedef unsigned int UINT32 __attribute__((__mode__(__SI__))); +typedef signed int SINT32 __attribute__((__mode__(__SI__))); +typedef unsigned int UINT64 __attribute__((__mode__(__DI__))); +typedef signed int SINT64 __attribute__((__mode__(__DI__))); +#endif + +typedef float FLOAT32; + +#ifndef __GNUC__ +#define __builtin_expect(x, expected_value) (x) +#endif +#define LIKELY(x) __builtin_expect((x),1) +#define UNLIKELY(x) __builtin_expect((x),1) + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/install-sh b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/install-sh new file mode 100755 index 000000000..6781b987b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/install-sh @@ -0,0 +1,520 @@ +#!/bin/sh +# install - install a program, script, or datafile + +scriptversion=2009-04-28.21; # UTC + +# This originates from X11R5 (mit/util/scripts/install.sh), which was +# later released in X11R6 (xc/config/util/install.sh) with the +# following copyright and license. +# +# Copyright (C) 1994 X Consortium +# +# Permission is hereby granted, free of charge, to any person obtaining a copy +# of this software and associated documentation files (the "Software"), to +# deal in the Software without restriction, including without limitation the +# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or +# sell copies of the Software, and to permit persons to whom the Software is +# furnished to do so, subject to the following conditions: +# +# The above copyright notice and this permission notice shall be included in +# all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- +# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +# +# Except as contained in this notice, the name of the X Consortium shall not +# be used in advertising or otherwise to promote the sale, use or other deal- +# ings in this Software without prior written authorization from the X Consor- +# tium. +# +# +# FSF changes to this file are in the public domain. +# +# Calling this script install-sh is preferred over install.sh, to prevent +# `make' implicit rules from creating a file called install from it +# when there is no Makefile. +# +# This script is compatible with the BSD install script, but was written +# from scratch. + +nl=' +' +IFS=" "" $nl" + +# set DOITPROG to echo to test this script + +# Don't use :- since 4.3BSD and earlier shells don't like it. +doit=${DOITPROG-} +if test -z "$doit"; then + doit_exec=exec +else + doit_exec=$doit +fi + +# Put in absolute file names if you don't have them in your path; +# or use environment vars. + +chgrpprog=${CHGRPPROG-chgrp} +chmodprog=${CHMODPROG-chmod} +chownprog=${CHOWNPROG-chown} +cmpprog=${CMPPROG-cmp} +cpprog=${CPPROG-cp} +mkdirprog=${MKDIRPROG-mkdir} +mvprog=${MVPROG-mv} +rmprog=${RMPROG-rm} +stripprog=${STRIPPROG-strip} + +posix_glob='?' +initialize_posix_glob=' + test "$posix_glob" != "?" || { + if (set -f) 2>/dev/null; then + posix_glob= + else + posix_glob=: + fi + } +' + +posix_mkdir= + +# Desired mode of installed file. +mode=0755 + +chgrpcmd= +chmodcmd=$chmodprog +chowncmd= +mvcmd=$mvprog +rmcmd="$rmprog -f" +stripcmd= + +src= +dst= +dir_arg= +dst_arg= + +copy_on_change=false +no_target_directory= + +usage="\ +Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE + or: $0 [OPTION]... SRCFILES... DIRECTORY + or: $0 [OPTION]... -t DIRECTORY SRCFILES... + or: $0 [OPTION]... -d DIRECTORIES... + +In the 1st form, copy SRCFILE to DSTFILE. +In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. +In the 4th, create DIRECTORIES. + +Options: + --help display this help and exit. + --version display version info and exit. + + -c (ignored) + -C install only if different (preserve the last data modification time) + -d create directories instead of installing files. + -g GROUP $chgrpprog installed files to GROUP. + -m MODE $chmodprog installed files to MODE. + -o USER $chownprog installed files to USER. + -s $stripprog installed files. + -t DIRECTORY install into DIRECTORY. + -T report an error if DSTFILE is a directory. + +Environment variables override the default commands: + CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG + RMPROG STRIPPROG +" + +while test $# -ne 0; do + case $1 in + -c) ;; + + -C) copy_on_change=true;; + + -d) dir_arg=true;; + + -g) chgrpcmd="$chgrpprog $2" + shift;; + + --help) echo "$usage"; exit $?;; + + -m) mode=$2 + case $mode in + *' '* | *' '* | *' +'* | *'*'* | *'?'* | *'['*) + echo "$0: invalid mode: $mode" >&2 + exit 1;; + esac + shift;; + + -o) chowncmd="$chownprog $2" + shift;; + + -s) stripcmd=$stripprog;; + + -t) dst_arg=$2 + shift;; + + -T) no_target_directory=true;; + + --version) echo "$0 $scriptversion"; exit $?;; + + --) shift + break;; + + -*) echo "$0: invalid option: $1" >&2 + exit 1;; + + *) break;; + esac + shift +done + +if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then + # When -d is used, all remaining arguments are directories to create. + # When -t is used, the destination is already specified. + # Otherwise, the last argument is the destination. Remove it from $@. + for arg + do + if test -n "$dst_arg"; then + # $@ is not empty: it contains at least $arg. + set fnord "$@" "$dst_arg" + shift # fnord + fi + shift # arg + dst_arg=$arg + done +fi + +if test $# -eq 0; then + if test -z "$dir_arg"; then + echo "$0: no input file specified." >&2 + exit 1 + fi + # It's OK to call `install-sh -d' without argument. + # This can happen when creating conditional directories. + exit 0 +fi + +if test -z "$dir_arg"; then + trap '(exit $?); exit' 1 2 13 15 + + # Set umask so as not to create temps with too-generous modes. + # However, 'strip' requires both read and write access to temps. + case $mode in + # Optimize common cases. + *644) cp_umask=133;; + *755) cp_umask=22;; + + *[0-7]) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw='% 200' + fi + cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; + *) + if test -z "$stripcmd"; then + u_plus_rw= + else + u_plus_rw=,u+rw + fi + cp_umask=$mode$u_plus_rw;; + esac +fi + +for src +do + # Protect names starting with `-'. + case $src in + -*) src=./$src;; + esac + + if test -n "$dir_arg"; then + dst=$src + dstdir=$dst + test -d "$dstdir" + dstdir_status=$? + else + + # Waiting for this to be detected by the "$cpprog $src $dsttmp" command + # might cause directories to be created, which would be especially bad + # if $src (and thus $dsttmp) contains '*'. + if test ! -f "$src" && test ! -d "$src"; then + echo "$0: $src does not exist." >&2 + exit 1 + fi + + if test -z "$dst_arg"; then + echo "$0: no destination specified." >&2 + exit 1 + fi + + dst=$dst_arg + # Protect names starting with `-'. + case $dst in + -*) dst=./$dst;; + esac + + # If destination is a directory, append the input filename; won't work + # if double slashes aren't ignored. + if test -d "$dst"; then + if test -n "$no_target_directory"; then + echo "$0: $dst_arg: Is a directory" >&2 + exit 1 + fi + dstdir=$dst + dst=$dstdir/`basename "$src"` + dstdir_status=0 + else + # Prefer dirname, but fall back on a substitute if dirname fails. + dstdir=` + (dirname "$dst") 2>/dev/null || + expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ + X"$dst" : 'X\(//\)[^/]' \| \ + X"$dst" : 'X\(//\)$' \| \ + X"$dst" : 'X\(/\)' \| . 2>/dev/null || + echo X"$dst" | + sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ + s//\1/ + q + } + /^X\(\/\/\)[^/].*/{ + s//\1/ + q + } + /^X\(\/\/\)$/{ + s//\1/ + q + } + /^X\(\/\).*/{ + s//\1/ + q + } + s/.*/./; q' + ` + + test -d "$dstdir" + dstdir_status=$? + fi + fi + + obsolete_mkdir_used=false + + if test $dstdir_status != 0; then + case $posix_mkdir in + '') + # Create intermediate dirs using mode 755 as modified by the umask. + # This is like FreeBSD 'install' as of 1997-10-28. + umask=`umask` + case $stripcmd.$umask in + # Optimize common cases. + *[2367][2367]) mkdir_umask=$umask;; + .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; + + *[0-7]) + mkdir_umask=`expr $umask + 22 \ + - $umask % 100 % 40 + $umask % 20 \ + - $umask % 10 % 4 + $umask % 2 + `;; + *) mkdir_umask=$umask,go-w;; + esac + + # With -d, create the new directory with the user-specified mode. + # Otherwise, rely on $mkdir_umask. + if test -n "$dir_arg"; then + mkdir_mode=-m$mode + else + mkdir_mode= + fi + + posix_mkdir=false + case $umask in + *[123567][0-7][0-7]) + # POSIX mkdir -p sets u+wx bits regardless of umask, which + # is incompatible with FreeBSD 'install' when (umask & 300) != 0. + ;; + *) + tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ + trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 + + if (umask $mkdir_umask && + exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 + then + if test -z "$dir_arg" || { + # Check for POSIX incompatibilities with -m. + # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or + # other-writeable bit of parent directory when it shouldn't. + # FreeBSD 6.1 mkdir -m -p sets mode of existing directory. + ls_ld_tmpdir=`ls -ld "$tmpdir"` + case $ls_ld_tmpdir in + d????-?r-*) different_mode=700;; + d????-?--*) different_mode=755;; + *) false;; + esac && + $mkdirprog -m$different_mode -p -- "$tmpdir" && { + ls_ld_tmpdir_1=`ls -ld "$tmpdir"` + test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" + } + } + then posix_mkdir=: + fi + rmdir "$tmpdir/d" "$tmpdir" + else + # Remove any dirs left behind by ancient mkdir implementations. + rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null + fi + trap '' 0;; + esac;; + esac + + if + $posix_mkdir && ( + umask $mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" + ) + then : + else + + # The umask is ridiculous, or mkdir does not conform to POSIX, + # or it failed possibly due to a race condition. Create the + # directory the slow way, step by step, checking for races as we go. + + case $dstdir in + /*) prefix='/';; + -*) prefix='./';; + *) prefix='';; + esac + + eval "$initialize_posix_glob" + + oIFS=$IFS + IFS=/ + $posix_glob set -f + set fnord $dstdir + shift + $posix_glob set +f + IFS=$oIFS + + prefixes= + + for d + do + test -z "$d" && continue + + prefix=$prefix$d + if test -d "$prefix"; then + prefixes= + else + if $posix_mkdir; then + (umask=$mkdir_umask && + $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break + # Don't fail if two instances are running concurrently. + test -d "$prefix" || exit 1 + else + case $prefix in + *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; + *) qprefix=$prefix;; + esac + prefixes="$prefixes '$qprefix'" + fi + fi + prefix=$prefix/ + done + + if test -n "$prefixes"; then + # Don't fail if two instances are running concurrently. + (umask $mkdir_umask && + eval "\$doit_exec \$mkdirprog $prefixes") || + test -d "$dstdir" || exit 1 + obsolete_mkdir_used=true + fi + fi + fi + + if test -n "$dir_arg"; then + { test -z "$chowncmd" || $doit $chowncmd "$dst"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && + { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || + test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 + else + + # Make a couple of temp file names in the proper directory. + dsttmp=$dstdir/_inst.$$_ + rmtmp=$dstdir/_rm.$$_ + + # Trap to clean up those temp files at exit. + trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 + + # Copy the file name to the temp name. + (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && + + # and set any options; do chmod last to preserve setuid bits. + # + # If any of these fail, we abort the whole thing. If we want to + # ignore errors from any of these, just make sure not to ignore + # errors from the above "$doit $cpprog $src $dsttmp" command. + # + { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && + { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && + { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && + { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && + + # If -C, don't bother to copy if it wouldn't change the file. + if $copy_on_change && + old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && + new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && + + eval "$initialize_posix_glob" && + $posix_glob set -f && + set X $old && old=:$2:$4:$5:$6 && + set X $new && new=:$2:$4:$5:$6 && + $posix_glob set +f && + + test "$old" = "$new" && + $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 + then + rm -f "$dsttmp" + else + # Rename the file to the real destination. + $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || + + # The rename failed, perhaps because mv can't rename something else + # to itself, or perhaps because mv is so ancient that it does not + # support -f. + { + # Now remove or move aside any old file at destination location. + # We try this two ways since rm can't unlink itself on some + # systems and the destination file might be busy for other + # reasons. In this case, the final cleanup might fail but the new + # file should still install successfully. + { + test ! -f "$dst" || + $doit $rmcmd -f "$dst" 2>/dev/null || + { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && + { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } + } || + { echo "$0: cannot unlink or rename $dst" >&2 + (exit 1); exit 1 + } + } && + + # Now rename the file to the real destination. + $doit $mvcmd "$dsttmp" "$dst" + } + fi || exit 1 + + trap '' 0 + fi +done + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/libffi.pc.in b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/libffi.pc.in new file mode 100644 index 000000000..c2e1c7b33 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/libffi.pc.in @@ -0,0 +1,10 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=${libdir}/@PACKAGE_NAME@-@PACKAGE_VERSION@/include + +Name: @PACKAGE_NAME@ +Description: Library supporting Foreign Function Interfaces +Version: @PACKAGE_VERSION@ +Libs: -L${libdir} -lffi +Cflags: -I${includedir} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/libtool-version b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/libtool-version new file mode 100644 index 000000000..b8b80e09a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/libtool-version @@ -0,0 +1,29 @@ +# This file is used to maintain libtool version info for libffi. See +# the libtool manual to understand the meaning of the fields. This is +# a separate file so that version updates don't involve re-running +# automake. +# +# Here are a set of rules to help you update your library version +# information: +# +# 1. Start with version information of `0:0:0' for each libtool library. +# +# 2. Update the version information only immediately before a public +# release of your software. More frequent updates are unnecessary, +# and only guarantee that the current interface number gets larger +# faster. +# +# 3. If the library source code has changed at all since the last +# update, then increment revision (`c:r:a' becomes `c:r+1:a'). +# +# 4. If any interfaces have been added, removed, or changed since the +# last update, increment current, and set revision to 0. +# +# 5. If any interfaces have been added since the last public release, +# then increment age. +# +# 6. If any interfaces have been removed since the last public +# release, then set age to 0. +# +# CURRENT:REVISION:AGE +5:10:0 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/ltmain.sh b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/ltmain.sh new file mode 100755 index 000000000..aa5624c81 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/ltmain.sh @@ -0,0 +1,9636 @@ + +# libtool (GNU libtool) 2.4 +# Written by Gordon Matzigkeit , 1996 + +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006, +# 2007, 2008, 2009, 2010 Free Software Foundation, Inc. +# This is free software; see the source for copying conditions. There is NO +# warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + +# GNU Libtool is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +# General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, +# or obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# Usage: $progname [OPTION]... [MODE-ARG]... +# +# Provide generalized library-building support services. +# +# --config show all configuration variables +# --debug enable verbose shell tracing +# -n, --dry-run display commands without modifying any files +# --features display basic configuration information and exit +# --mode=MODE use operation mode MODE +# --preserve-dup-deps don't remove duplicate dependency libraries +# --quiet, --silent don't print informational messages +# --no-quiet, --no-silent +# print informational messages (default) +# --tag=TAG use configuration variables from tag TAG +# -v, --verbose print more informational messages than default +# --no-verbose don't print the extra informational messages +# --version print version information +# -h, --help, --help-all print short, long, or detailed help message +# +# MODE must be one of the following: +# +# clean remove files from the build directory +# compile compile a source file into a libtool object +# execute automatically set library path, then run a program +# finish complete the installation of libtool libraries +# install install libraries or executables +# link create a library or an executable +# uninstall remove libraries from an installed directory +# +# MODE-ARGS vary depending on the MODE. When passed as first option, +# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that. +# Try `$progname --help --mode=MODE' for a more detailed description of MODE. +# +# When reporting a bug, please describe a test case to reproduce it and +# include the following information: +# +# host-triplet: $host +# shell: $SHELL +# compiler: $LTCC +# compiler flags: $LTCFLAGS +# linker: $LD (gnu? $with_gnu_ld) +# $progname: (GNU libtool) 2.4 +# automake: $automake_version +# autoconf: $autoconf_version +# +# Report bugs to . +# GNU libtool home page: . +# General help using GNU software: . + +PROGRAM=libtool +PACKAGE=libtool +VERSION=2.4 +TIMESTAMP="" +package_revision=1.3293 + +# Be Bourne compatible +if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which + # is contrary to our usage. Disable this feature. + alias -g '${1+"$@"}'='"$@"' + setopt NO_GLOB_SUBST +else + case `(set -o) 2>/dev/null` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +$1 +_LTECHO_EOF' +} + +# NLS nuisances: We save the old values to restore during execute mode. +lt_user_locale= +lt_safe_locale= +for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES +do + eval "if test \"\${$lt_var+set}\" = set; then + save_$lt_var=\$$lt_var + $lt_var=C + export $lt_var + lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\" + lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\" + fi" +done +LC_ALL=C +LANGUAGE=C +export LANGUAGE LC_ALL + +$lt_unset CDPATH + + +# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh +# is ksh but when the shell is invoked as "sh" and the current value of +# the _XPG environment variable is not equal to 1 (one), the special +# positional parameter $0, within a function call, is the name of the +# function. +progpath="$0" + + + +: ${CP="cp -f"} +test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'} +: ${EGREP="/bin/grep -E"} +: ${FGREP="/bin/grep -F"} +: ${GREP="/bin/grep"} +: ${LN_S="ln -s"} +: ${MAKE="make"} +: ${MKDIR="mkdir"} +: ${MV="mv -f"} +: ${RM="rm -f"} +: ${SED="/bin/sed"} +: ${SHELL="${CONFIG_SHELL-/bin/sh}"} +: ${Xsed="$SED -e 1s/^X//"} + +# Global variables: +EXIT_SUCCESS=0 +EXIT_FAILURE=1 +EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing. +EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake. + +exit_status=$EXIT_SUCCESS + +# Make sure IFS has a sensible default +lt_nl=' +' +IFS=" $lt_nl" + +dirname="s,/[^/]*$,," +basename="s,^.*/,," + +# func_dirname file append nondir_replacement +# Compute the dirname of FILE. If nonempty, add APPEND to the result, +# otherwise set result to NONDIR_REPLACEMENT. +func_dirname () +{ + func_dirname_result=`$ECHO "${1}" | $SED "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi +} # func_dirname may be replaced by extended shell implementation + + +# func_basename file +func_basename () +{ + func_basename_result=`$ECHO "${1}" | $SED "$basename"` +} # func_basename may be replaced by extended shell implementation + + +# func_dirname_and_basename file append nondir_replacement +# perform func_basename and func_dirname in a single function +# call: +# dirname: Compute the dirname of FILE. If nonempty, +# add APPEND to the result, otherwise set result +# to NONDIR_REPLACEMENT. +# value returned in "$func_dirname_result" +# basename: Compute filename of FILE. +# value retuned in "$func_basename_result" +# Implementation must be kept synchronized with func_dirname +# and func_basename. For efficiency, we do not delegate to +# those functions but instead duplicate the functionality here. +func_dirname_and_basename () +{ + # Extract subdirectory from the argument. + func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"` + if test "X$func_dirname_result" = "X${1}"; then + func_dirname_result="${3}" + else + func_dirname_result="$func_dirname_result${2}" + fi + func_basename_result=`$ECHO "${1}" | $SED -e "$basename"` +} # func_dirname_and_basename may be replaced by extended shell implementation + + +# func_stripname prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# func_strip_suffix prefix name +func_stripname () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname may be replaced by extended shell implementation + + +# These SED scripts presuppose an absolute path with a trailing slash. +pathcar='s,^/\([^/]*\).*$,\1,' +pathcdr='s,^/[^/]*,,' +removedotparts=':dotsl + s@/\./@/@g + t dotsl + s,/\.$,/,' +collapseslashes='s@/\{1,\}@/@g' +finalslash='s,/*$,/,' + +# func_normal_abspath PATH +# Remove doubled-up and trailing slashes, "." path components, +# and cancel out any ".." path components in PATH after making +# it an absolute path. +# value returned in "$func_normal_abspath_result" +func_normal_abspath () +{ + # Start from root dir and reassemble the path. + func_normal_abspath_result= + func_normal_abspath_tpath=$1 + func_normal_abspath_altnamespace= + case $func_normal_abspath_tpath in + "") + # Empty path, that just means $cwd. + func_stripname '' '/' "`pwd`" + func_normal_abspath_result=$func_stripname_result + return + ;; + # The next three entries are used to spot a run of precisely + # two leading slashes without using negated character classes; + # we take advantage of case's first-match behaviour. + ///*) + # Unusual form of absolute path, do nothing. + ;; + //*) + # Not necessarily an ordinary path; POSIX reserves leading '//' + # and for example Cygwin uses it to access remote file shares + # over CIFS/SMB, so we conserve a leading double slash if found. + func_normal_abspath_altnamespace=/ + ;; + /*) + # Absolute path, do nothing. + ;; + *) + # Relative path, prepend $cwd. + func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath + ;; + esac + # Cancel out all the simple stuff to save iterations. We also want + # the path to end with a slash for ease of parsing, so make sure + # there is one (and only one) here. + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"` + while :; do + # Processed it all yet? + if test "$func_normal_abspath_tpath" = / ; then + # If we ascended to the root using ".." the result may be empty now. + if test -z "$func_normal_abspath_result" ; then + func_normal_abspath_result=/ + fi + break + fi + func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcar"` + func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \ + -e "$pathcdr"` + # Figure out what to do with it + case $func_normal_abspath_tcomponent in + "") + # Trailing empty path component, ignore it. + ;; + ..) + # Parent dir; strip last assembled component from result. + func_dirname "$func_normal_abspath_result" + func_normal_abspath_result=$func_dirname_result + ;; + *) + # Actual path component, append it. + func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent + ;; + esac + done + # Restore leading double-slash if one was found on entry. + func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result +} + +# func_relative_path SRCDIR DSTDIR +# generates a relative path from SRCDIR to DSTDIR, with a trailing +# slash if non-empty, suitable for immediately appending a filename +# without needing to append a separator. +# value returned in "$func_relative_path_result" +func_relative_path () +{ + func_relative_path_result= + func_normal_abspath "$1" + func_relative_path_tlibdir=$func_normal_abspath_result + func_normal_abspath "$2" + func_relative_path_tbindir=$func_normal_abspath_result + + # Ascend the tree starting from libdir + while :; do + # check if we have found a prefix of bindir + case $func_relative_path_tbindir in + $func_relative_path_tlibdir) + # found an exact match + func_relative_path_tcancelled= + break + ;; + $func_relative_path_tlibdir*) + # found a matching prefix + func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir" + func_relative_path_tcancelled=$func_stripname_result + if test -z "$func_relative_path_result"; then + func_relative_path_result=. + fi + break + ;; + *) + func_dirname $func_relative_path_tlibdir + func_relative_path_tlibdir=${func_dirname_result} + if test "x$func_relative_path_tlibdir" = x ; then + # Have to descend all the way to the root! + func_relative_path_result=../$func_relative_path_result + func_relative_path_tcancelled=$func_relative_path_tbindir + break + fi + func_relative_path_result=../$func_relative_path_result + ;; + esac + done + + # Now calculate path; take care to avoid doubling-up slashes. + func_stripname '' '/' "$func_relative_path_result" + func_relative_path_result=$func_stripname_result + func_stripname '/' '/' "$func_relative_path_tcancelled" + if test "x$func_stripname_result" != x ; then + func_relative_path_result=${func_relative_path_result}/${func_stripname_result} + fi + + # Normalisation. If bindir is libdir, return empty string, + # else relative path ending with a slash; either way, target + # file name can be directly appended. + if test ! -z "$func_relative_path_result"; then + func_stripname './' '' "$func_relative_path_result/" + func_relative_path_result=$func_stripname_result + fi +} + +# The name of this program: +func_dirname_and_basename "$progpath" +progname=$func_basename_result + +# Make sure we have an absolute path for reexecution: +case $progpath in + [\\/]*|[A-Za-z]:\\*) ;; + *[\\/]*) + progdir=$func_dirname_result + progdir=`cd "$progdir" && pwd` + progpath="$progdir/$progname" + ;; + *) + save_IFS="$IFS" + IFS=: + for progdir in $PATH; do + IFS="$save_IFS" + test -x "$progdir/$progname" && break + done + IFS="$save_IFS" + test -n "$progdir" || progdir=`pwd` + progpath="$progdir/$progname" + ;; +esac + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +Xsed="${SED}"' -e 1s/^X//' +sed_quote_subst='s/\([`"$\\]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\(["`\\]\)/\\\1/g' + +# Sed substitution that turns a string into a regex matching for the +# string literally. +sed_make_literal_regex='s,[].[^$\\*\/],\\&,g' + +# Sed substitution that converts a w32 file name or path +# which contains forward slashes, into one that contains +# (escaped) backslashes. A very naive implementation. +lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g' + +# Re-`\' parameter expansions in output of double_quote_subst that were +# `\'-ed in input to the same. If an odd number of `\' preceded a '$' +# in input to double_quote_subst, that '$' was protected from expansion. +# Since each input `\' is now two `\'s, look for any number of runs of +# four `\'s followed by two `\'s and then a '$'. `\' that '$'. +bs='\\' +bs2='\\\\' +bs4='\\\\\\\\' +dollar='\$' +sed_double_backslash="\ + s/$bs4/&\\ +/g + s/^$bs2$dollar/$bs&/ + s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g + s/\n//g" + +# Standard options: +opt_dry_run=false +opt_help=false +opt_quiet=false +opt_verbose=false +opt_warning=: + +# func_echo arg... +# Echo program name prefixed message, along with the current mode +# name if it has been set yet. +func_echo () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }$*" +} + +# func_verbose arg... +# Echo program name prefixed message in verbose mode only. +func_verbose () +{ + $opt_verbose && func_echo ${1+"$@"} + + # A bug in bash halts the script if the last line of a function + # fails when set -e is in force, so we need another command to + # work around that: + : +} + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +# func_error arg... +# Echo program name prefixed message to standard error. +func_error () +{ + $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2 +} + +# func_warning arg... +# Echo program name prefixed warning message to standard error. +func_warning () +{ + $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2 + + # bash bug again: + : +} + +# func_fatal_error arg... +# Echo program name prefixed message to standard error, and exit. +func_fatal_error () +{ + func_error ${1+"$@"} + exit $EXIT_FAILURE +} + +# func_fatal_help arg... +# Echo program name prefixed message to standard error, followed by +# a help hint, and exit. +func_fatal_help () +{ + func_error ${1+"$@"} + func_fatal_error "$help" +} +help="Try \`$progname --help' for more information." ## default + + +# func_grep expression filename +# Check whether EXPRESSION matches any line of FILENAME, without output. +func_grep () +{ + $GREP "$1" "$2" >/dev/null 2>&1 +} + + +# func_mkdir_p directory-path +# Make sure the entire path to DIRECTORY-PATH is available. +func_mkdir_p () +{ + my_directory_path="$1" + my_dir_list= + + if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then + + # Protect directory names starting with `-' + case $my_directory_path in + -*) my_directory_path="./$my_directory_path" ;; + esac + + # While some portion of DIR does not yet exist... + while test ! -d "$my_directory_path"; do + # ...make a list in topmost first order. Use a colon delimited + # list incase some portion of path contains whitespace. + my_dir_list="$my_directory_path:$my_dir_list" + + # If the last portion added has no slash in it, the list is done + case $my_directory_path in */*) ;; *) break ;; esac + + # ...otherwise throw away the child directory and loop + my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"` + done + my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'` + + save_mkdir_p_IFS="$IFS"; IFS=':' + for my_dir in $my_dir_list; do + IFS="$save_mkdir_p_IFS" + # mkdir can fail with a `File exist' error if two processes + # try to create one of the directories concurrently. Don't + # stop in that case! + $MKDIR "$my_dir" 2>/dev/null || : + done + IFS="$save_mkdir_p_IFS" + + # Bail out if we (or some other process) failed to create a directory. + test -d "$my_directory_path" || \ + func_fatal_error "Failed to create \`$1'" + fi +} + + +# func_mktempdir [string] +# Make a temporary directory that won't clash with other running +# libtool processes, and avoids race conditions if possible. If +# given, STRING is the basename for that directory. +func_mktempdir () +{ + my_template="${TMPDIR-/tmp}/${1-$progname}" + + if test "$opt_dry_run" = ":"; then + # Return a directory name, but don't create it in dry-run mode + my_tmpdir="${my_template}-$$" + else + + # If mktemp works, use that first and foremost + my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null` + + if test ! -d "$my_tmpdir"; then + # Failing that, at least try and use $RANDOM to avoid a race + my_tmpdir="${my_template}-${RANDOM-0}$$" + + save_mktempdir_umask=`umask` + umask 0077 + $MKDIR "$my_tmpdir" + umask $save_mktempdir_umask + fi + + # If we're not in dry-run mode, bomb out on failure + test -d "$my_tmpdir" || \ + func_fatal_error "cannot create temporary directory \`$my_tmpdir'" + fi + + $ECHO "$my_tmpdir" +} + + +# func_quote_for_eval arg +# Aesthetically quote ARG to be evaled later. +# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT +# is double-quoted, suitable for a subsequent eval, whereas +# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters +# which are still active within double quotes backslashified. +func_quote_for_eval () +{ + case $1 in + *[\\\`\"\$]*) + func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;; + *) + func_quote_for_eval_unquoted_result="$1" ;; + esac + + case $func_quote_for_eval_unquoted_result in + # Double-quote args containing shell metacharacters to delay + # word splitting, command substitution and and variable + # expansion for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\"" + ;; + *) + func_quote_for_eval_result="$func_quote_for_eval_unquoted_result" + esac +} + + +# func_quote_for_expand arg +# Aesthetically quote ARG to be evaled later; same as above, +# but do not quote variable references. +func_quote_for_expand () +{ + case $1 in + *[\\\`\"]*) + my_arg=`$ECHO "$1" | $SED \ + -e "$double_quote_subst" -e "$sed_double_backslash"` ;; + *) + my_arg="$1" ;; + esac + + case $my_arg in + # Double-quote args containing shell metacharacters to delay + # word splitting and command substitution for a subsequent eval. + # Many Bourne shells cannot handle close brackets correctly + # in scan sets, so we specify it separately. + *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"") + my_arg="\"$my_arg\"" + ;; + esac + + func_quote_for_expand_result="$my_arg" +} + + +# func_show_eval cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. +func_show_eval () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$my_cmd" + my_status=$? + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + + +# func_show_eval_locale cmd [fail_exp] +# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is +# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP +# is given, then evaluate it. Use the saved locale for evaluation. +func_show_eval_locale () +{ + my_cmd="$1" + my_fail_exp="${2-:}" + + ${opt_silent-false} || { + func_quote_for_expand "$my_cmd" + eval "func_echo $func_quote_for_expand_result" + } + + if ${opt_dry_run-false}; then :; else + eval "$lt_user_locale + $my_cmd" + my_status=$? + eval "$lt_safe_locale" + if test "$my_status" -eq 0; then :; else + eval "(exit $my_status); $my_fail_exp" + fi + fi +} + +# func_tr_sh +# Turn $1 into a string suitable for a shell variable name. +# Result is stored in $func_tr_sh_result. All characters +# not in the set a-zA-Z0-9_ are replaced with '_'. Further, +# if $1 begins with a digit, a '_' is prepended as well. +func_tr_sh () +{ + case $1 in + [0-9]* | *[!a-zA-Z0-9_]*) + func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'` + ;; + * ) + func_tr_sh_result=$1 + ;; + esac +} + + +# func_version +# Echo version message to standard output and exit. +func_version () +{ + $opt_debug + + $SED -n '/(C)/!b go + :more + /\./!{ + N + s/\n# / / + b more + } + :go + /^# '$PROGRAM' (GNU /,/# warranty; / { + s/^# // + s/^# *$// + s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/ + p + }' < "$progpath" + exit $? +} + +# func_usage +# Echo short help message to standard output and exit. +func_usage () +{ + $opt_debug + + $SED -n '/^# Usage:/,/^# *.*--help/ { + s/^# // + s/^# *$// + s/\$progname/'$progname'/ + p + }' < "$progpath" + echo + $ECHO "run \`$progname --help | more' for full usage" + exit $? +} + +# func_help [NOEXIT] +# Echo long help message to standard output and exit, +# unless 'noexit' is passed as argument. +func_help () +{ + $opt_debug + + $SED -n '/^# Usage:/,/# Report bugs to/ { + :print + s/^# // + s/^# *$// + s*\$progname*'$progname'* + s*\$host*'"$host"'* + s*\$SHELL*'"$SHELL"'* + s*\$LTCC*'"$LTCC"'* + s*\$LTCFLAGS*'"$LTCFLAGS"'* + s*\$LD*'"$LD"'* + s/\$with_gnu_ld/'"$with_gnu_ld"'/ + s/\$automake_version/'"`(automake --version) 2>/dev/null |$SED 1q`"'/ + s/\$autoconf_version/'"`(autoconf --version) 2>/dev/null |$SED 1q`"'/ + p + d + } + /^# .* home page:/b print + /^# General help using/b print + ' < "$progpath" + ret=$? + if test -z "$1"; then + exit $ret + fi +} + +# func_missing_arg argname +# Echo program name prefixed message to standard error and set global +# exit_cmd. +func_missing_arg () +{ + $opt_debug + + func_error "missing argument for $1." + exit_cmd=exit +} + + +# func_split_short_opt shortopt +# Set func_split_short_opt_name and func_split_short_opt_arg shell +# variables after splitting SHORTOPT after the 2nd character. +func_split_short_opt () +{ + my_sed_short_opt='1s/^\(..\).*$/\1/;q' + my_sed_short_rest='1s/^..\(.*\)$/\1/;q' + + func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"` + func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"` +} # func_split_short_opt may be replaced by extended shell implementation + + +# func_split_long_opt longopt +# Set func_split_long_opt_name and func_split_long_opt_arg shell +# variables after splitting LONGOPT at the `=' sign. +func_split_long_opt () +{ + my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q' + my_sed_long_arg='1s/^--[^=]*=//' + + func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"` + func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"` +} # func_split_long_opt may be replaced by extended shell implementation + +exit_cmd=: + + + + + +magic="%%%MAGIC variable%%%" +magic_exe="%%%MAGIC EXE variable%%%" + +# Global variables. +nonopt= +preserve_args= +lo2o="s/\\.lo\$/.${objext}/" +o2lo="s/\\.${objext}\$/.lo/" +extracted_archives= +extracted_serial=0 + +# If this variable is set in any of the actions, the command in it +# will be execed at the end. This prevents here-documents from being +# left over by shells. +exec_cmd= + +# func_append var value +# Append VALUE to the end of shell variable VAR. +func_append () +{ + eval "${1}=\$${1}\${2}" +} # func_append may be replaced by extended shell implementation + +# func_append_quoted var value +# Quote VALUE and append to the end of shell variable VAR, separated +# by a space. +func_append_quoted () +{ + func_quote_for_eval "${2}" + eval "${1}=\$${1}\\ \$func_quote_for_eval_result" +} # func_append_quoted may be replaced by extended shell implementation + + +# func_arith arithmetic-term... +func_arith () +{ + func_arith_result=`expr "${@}"` +} # func_arith may be replaced by extended shell implementation + + +# func_len string +# STRING may not start with a hyphen. +func_len () +{ + func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len` +} # func_len may be replaced by extended shell implementation + + +# func_lo2o object +func_lo2o () +{ + func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"` +} # func_lo2o may be replaced by extended shell implementation + + +# func_xform libobj-or-source +func_xform () +{ + func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'` +} # func_xform may be replaced by extended shell implementation + + +# func_fatal_configuration arg... +# Echo program name prefixed message to standard error, followed by +# a configuration failure hint, and exit. +func_fatal_configuration () +{ + func_error ${1+"$@"} + func_error "See the $PACKAGE documentation for more information." + func_fatal_error "Fatal configuration error." +} + + +# func_config +# Display the configuration for all the tags in this script. +func_config () +{ + re_begincf='^# ### BEGIN LIBTOOL' + re_endcf='^# ### END LIBTOOL' + + # Default configuration. + $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath" + + # Now print the configurations for the tags. + for tagname in $taglist; do + $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath" + done + + exit $? +} + +# func_features +# Display the features supported by this script. +func_features () +{ + echo "host: $host" + if test "$build_libtool_libs" = yes; then + echo "enable shared libraries" + else + echo "disable shared libraries" + fi + if test "$build_old_libs" = yes; then + echo "enable static libraries" + else + echo "disable static libraries" + fi + + exit $? +} + +# func_enable_tag tagname +# Verify that TAGNAME is valid, and either flag an error and exit, or +# enable the TAGNAME tag. We also add TAGNAME to the global $taglist +# variable here. +func_enable_tag () +{ + # Global variable: + tagname="$1" + + re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$" + re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$" + sed_extractcf="/$re_begincf/,/$re_endcf/p" + + # Validate tagname. + case $tagname in + *[!-_A-Za-z0-9,/]*) + func_fatal_error "invalid tag name: $tagname" + ;; + esac + + # Don't test for the "default" C tag, as we know it's + # there but not specially marked. + case $tagname in + CC) ;; + *) + if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then + taglist="$taglist $tagname" + + # Evaluate the configuration. Be careful to quote the path + # and the sed script, to avoid splitting on whitespace, but + # also don't use non-portable quotes within backquotes within + # quotes we have to do it in 2 steps: + extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"` + eval "$extractedcf" + else + func_error "ignoring unknown tag $tagname" + fi + ;; + esac +} + +# func_check_version_match +# Ensure that we are using m4 macros, and libtool script from the same +# release of libtool. +func_check_version_match () +{ + if test "$package_revision" != "$macro_revision"; then + if test "$VERSION" != "$macro_version"; then + if test -z "$macro_version"; then + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from an older release. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, but the +$progname: definition of this LT_INIT comes from $PACKAGE $macro_version. +$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION +$progname: and run autoconf again. +_LT_EOF + fi + else + cat >&2 <<_LT_EOF +$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision, +$progname: but the definition of this LT_INIT comes from revision $macro_revision. +$progname: You should recreate aclocal.m4 with macros from revision $package_revision +$progname: of $PACKAGE $VERSION and run autoconf again. +_LT_EOF + fi + + exit $EXIT_MISMATCH + fi +} + + +# Shorthand for --mode=foo, only valid as the first argument +case $1 in +clean|clea|cle|cl) + shift; set dummy --mode clean ${1+"$@"}; shift + ;; +compile|compil|compi|comp|com|co|c) + shift; set dummy --mode compile ${1+"$@"}; shift + ;; +execute|execut|execu|exec|exe|ex|e) + shift; set dummy --mode execute ${1+"$@"}; shift + ;; +finish|finis|fini|fin|fi|f) + shift; set dummy --mode finish ${1+"$@"}; shift + ;; +install|instal|insta|inst|ins|in|i) + shift; set dummy --mode install ${1+"$@"}; shift + ;; +link|lin|li|l) + shift; set dummy --mode link ${1+"$@"}; shift + ;; +uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u) + shift; set dummy --mode uninstall ${1+"$@"}; shift + ;; +esac + + + +# Option defaults: +opt_debug=: +opt_dry_run=false +opt_config=false +opt_preserve_dup_deps=false +opt_features=false +opt_finish=false +opt_help=false +opt_help_all=false +opt_silent=: +opt_verbose=: +opt_silent=false +opt_verbose=false + + +# Parse options once, thoroughly. This comes as soon as possible in the +# script to make things like `--version' happen as quickly as we can. +{ + # this just eases exit handling + while test $# -gt 0; do + opt="$1" + shift + case $opt in + --debug|-x) opt_debug='set -x' + func_echo "enabling shell trace mode" + $opt_debug + ;; + --dry-run|--dryrun|-n) + opt_dry_run=: + ;; + --config) + opt_config=: +func_config + ;; + --dlopen|-dlopen) + optarg="$1" + opt_dlopen="${opt_dlopen+$opt_dlopen +}$optarg" + shift + ;; + --preserve-dup-deps) + opt_preserve_dup_deps=: + ;; + --features) + opt_features=: +func_features + ;; + --finish) + opt_finish=: +set dummy --mode finish ${1+"$@"}; shift + ;; + --help) + opt_help=: + ;; + --help-all) + opt_help_all=: +opt_help=': help-all' + ;; + --mode) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_mode="$optarg" +case $optarg in + # Valid mode arguments: + clean|compile|execute|finish|install|link|relink|uninstall) ;; + + # Catch anything else as an error + *) func_error "invalid argument for $opt" + exit_cmd=exit + break + ;; +esac + shift + ;; + --no-silent|--no-quiet) + opt_silent=false +func_append preserve_args " $opt" + ;; + --no-verbose) + opt_verbose=false +func_append preserve_args " $opt" + ;; + --silent|--quiet) + opt_silent=: +func_append preserve_args " $opt" + opt_verbose=false + ;; + --verbose|-v) + opt_verbose=: +func_append preserve_args " $opt" +opt_silent=false + ;; + --tag) + test $# = 0 && func_missing_arg $opt && break + optarg="$1" + opt_tag="$optarg" +func_append preserve_args " $opt $optarg" +func_enable_tag "$optarg" + shift + ;; + + -\?|-h) func_usage ;; + --help) func_help ;; + --version) func_version ;; + + # Separate optargs to long options: + --*=*) + func_split_long_opt "$opt" + set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"} + shift + ;; + + # Separate non-argument short options: + -\?*|-h*|-n*|-v*) + func_split_short_opt "$opt" + set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"} + shift + ;; + + --) break ;; + -*) func_fatal_help "unrecognized option \`$opt'" ;; + *) set dummy "$opt" ${1+"$@"}; shift; break ;; + esac + done + + # Validate options: + + # save first non-option argument + if test "$#" -gt 0; then + nonopt="$opt" + shift + fi + + # preserve --debug + test "$opt_debug" = : || func_append preserve_args " --debug" + + case $host in + *cygwin* | *mingw* | *pw32* | *cegcc*) + # don't eliminate duplications in $postdeps and $predeps + opt_duplicate_compiler_generated_deps=: + ;; + *) + opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps + ;; + esac + + $opt_help || { + # Sanity checks first: + func_check_version_match + + if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then + func_fatal_configuration "not configured to build any kind of library" + fi + + # Darwin sucks + eval std_shrext=\"$shrext_cmds\" + + # Only execute mode is allowed to have -dlopen flags. + if test -n "$opt_dlopen" && test "$opt_mode" != execute; then + func_error "unrecognized option \`-dlopen'" + $ECHO "$help" 1>&2 + exit $EXIT_FAILURE + fi + + # Change the help message to a mode-specific one. + generic_help="$help" + help="Try \`$progname --help --mode=$opt_mode' for more information." + } + + + # Bail if the options were screwed + $exit_cmd $EXIT_FAILURE +} + + + + +## ----------- ## +## Main. ## +## ----------- ## + +# func_lalib_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_lalib_p () +{ + test -f "$1" && + $SED -e 4q "$1" 2>/dev/null \ + | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1 +} + +# func_lalib_unsafe_p file +# True iff FILE is a libtool `.la' library or `.lo' object file. +# This function implements the same check as func_lalib_p without +# resorting to external programs. To this end, it redirects stdin and +# closes it afterwards, without saving the original file descriptor. +# As a safety measure, use it only where a negative result would be +# fatal anyway. Works if `file' does not exist. +func_lalib_unsafe_p () +{ + lalib_p=no + if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then + for lalib_p_l in 1 2 3 4 + do + read lalib_p_line + case "$lalib_p_line" in + \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;; + esac + done + exec 0<&5 5<&- + fi + test "$lalib_p" = yes +} + +# func_ltwrapper_script_p file +# True iff FILE is a libtool wrapper script +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_script_p () +{ + func_lalib_p "$1" +} + +# func_ltwrapper_executable_p file +# True iff FILE is a libtool wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_executable_p () +{ + func_ltwrapper_exec_suffix= + case $1 in + *.exe) ;; + *) func_ltwrapper_exec_suffix=.exe ;; + esac + $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1 +} + +# func_ltwrapper_scriptname file +# Assumes file is an ltwrapper_executable +# uses $file to determine the appropriate filename for a +# temporary ltwrapper_script. +func_ltwrapper_scriptname () +{ + func_dirname_and_basename "$1" "" "." + func_stripname '' '.exe' "$func_basename_result" + func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper" +} + +# func_ltwrapper_p file +# True iff FILE is a libtool wrapper script or wrapper executable +# This function is only a basic sanity check; it will hardly flush out +# determined imposters. +func_ltwrapper_p () +{ + func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1" +} + + +# func_execute_cmds commands fail_cmd +# Execute tilde-delimited COMMANDS. +# If FAIL_CMD is given, eval that upon failure. +# FAIL_CMD may read-access the current command in variable CMD! +func_execute_cmds () +{ + $opt_debug + save_ifs=$IFS; IFS='~' + for cmd in $1; do + IFS=$save_ifs + eval cmd=\"$cmd\" + func_show_eval "$cmd" "${2-:}" + done + IFS=$save_ifs +} + + +# func_source file +# Source FILE, adding directory component if necessary. +# Note that it is not necessary on cygwin/mingw to append a dot to +# FILE even if both FILE and FILE.exe exist: automatic-append-.exe +# behavior happens only for exec(3), not for open(2)! Also, sourcing +# `FILE.' does not work on cygwin managed mounts. +func_source () +{ + $opt_debug + case $1 in + */* | *\\*) . "$1" ;; + *) . "./$1" ;; + esac +} + + +# func_resolve_sysroot PATH +# Replace a leading = in PATH with a sysroot. Store the result into +# func_resolve_sysroot_result +func_resolve_sysroot () +{ + func_resolve_sysroot_result=$1 + case $func_resolve_sysroot_result in + =*) + func_stripname '=' '' "$func_resolve_sysroot_result" + func_resolve_sysroot_result=$lt_sysroot$func_stripname_result + ;; + esac +} + +# func_replace_sysroot PATH +# If PATH begins with the sysroot, replace it with = and +# store the result into func_replace_sysroot_result. +func_replace_sysroot () +{ + case "$lt_sysroot:$1" in + ?*:"$lt_sysroot"*) + func_stripname "$lt_sysroot" '' "$1" + func_replace_sysroot_result="=$func_stripname_result" + ;; + *) + # Including no sysroot. + func_replace_sysroot_result=$1 + ;; + esac +} + +# func_infer_tag arg +# Infer tagged configuration to use if any are available and +# if one wasn't chosen via the "--tag" command line option. +# Only attempt this if the compiler in the base compile +# command doesn't match the default compiler. +# arg is usually of the form 'gcc ...' +func_infer_tag () +{ + $opt_debug + if test -n "$available_tags" && test -z "$tagname"; then + CC_quoted= + for arg in $CC; do + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case $@ in + # Blanks in the command may have been stripped by the calling shell, + # but not from the CC environment variable when configure was run. + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;; + # Blanks at the start of $base_compile will cause this to fail + # if we don't check for them as well. + *) + for z in $available_tags; do + if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then + # Evaluate the configuration. + eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`" + CC_quoted= + for arg in $CC; do + # Double-quote args containing other shell metacharacters. + func_append_quoted CC_quoted "$arg" + done + CC_expanded=`func_echo_all $CC` + CC_quoted_expanded=`func_echo_all $CC_quoted` + case "$@ " in + " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \ + " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) + # The compiler in the base compile command matches + # the one in the tagged configuration. + # Assume this is the tagged configuration we want. + tagname=$z + break + ;; + esac + fi + done + # If $tagname still isn't set, then no tagged configuration + # was found and let the user know that the "--tag" command + # line option must be used. + if test -z "$tagname"; then + func_echo "unable to infer tagged configuration" + func_fatal_error "specify a tag with \`--tag'" +# else +# func_verbose "using $tagname tagged configuration" + fi + ;; + esac + fi +} + + + +# func_write_libtool_object output_name pic_name nonpic_name +# Create a libtool object file (analogous to a ".la" file), +# but don't create it if we're doing a dry run. +func_write_libtool_object () +{ + write_libobj=${1} + if test "$build_libtool_libs" = yes; then + write_lobj=\'${2}\' + else + write_lobj=none + fi + + if test "$build_old_libs" = yes; then + write_oldobj=\'${3}\' + else + write_oldobj=none + fi + + $opt_dry_run || { + cat >${write_libobj}T </dev/null` + if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then + func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" | + $SED -e "$lt_sed_naive_backslashify"` + else + func_convert_core_file_wine_to_w32_result= + fi + fi +} +# end: func_convert_core_file_wine_to_w32 + + +# func_convert_core_path_wine_to_w32 ARG +# Helper function used by path conversion functions when $build is *nix, and +# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly +# configured wine environment available, with the winepath program in $build's +# $PATH. Assumes ARG has no leading or trailing path separator characters. +# +# ARG is path to be converted from $build format to win32. +# Result is available in $func_convert_core_path_wine_to_w32_result. +# Unconvertible file (directory) names in ARG are skipped; if no directory names +# are convertible, then the result may be empty. +func_convert_core_path_wine_to_w32 () +{ + $opt_debug + # unfortunately, winepath doesn't convert paths, only file names + func_convert_core_path_wine_to_w32_result="" + if test -n "$1"; then + oldIFS=$IFS + IFS=: + for func_convert_core_path_wine_to_w32_f in $1; do + IFS=$oldIFS + func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f" + if test -n "$func_convert_core_file_wine_to_w32_result" ; then + if test -z "$func_convert_core_path_wine_to_w32_result"; then + func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result" + else + func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result" + fi + fi + done + IFS=$oldIFS + fi +} +# end: func_convert_core_path_wine_to_w32 + + +# func_cygpath ARGS... +# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when +# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2) +# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or +# (2), returns the Cygwin file name or path in func_cygpath_result (input +# file name or path is assumed to be in w32 format, as previously converted +# from $build's *nix or MSYS format). In case (3), returns the w32 file name +# or path in func_cygpath_result (input file name or path is assumed to be in +# Cygwin format). Returns an empty string on error. +# +# ARGS are passed to cygpath, with the last one being the file name or path to +# be converted. +# +# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH +# environment variable; do not put it in $PATH. +func_cygpath () +{ + $opt_debug + if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then + func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null` + if test "$?" -ne 0; then + # on failure, ensure result is empty + func_cygpath_result= + fi + else + func_cygpath_result= + func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'" + fi +} +#end: func_cygpath + + +# func_convert_core_msys_to_w32 ARG +# Convert file name or path ARG from MSYS format to w32 format. Return +# result in func_convert_core_msys_to_w32_result. +func_convert_core_msys_to_w32 () +{ + $opt_debug + # awkward: cmd appends spaces to result + func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null | + $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"` +} +#end: func_convert_core_msys_to_w32 + + +# func_convert_file_check ARG1 ARG2 +# Verify that ARG1 (a file name in $build format) was converted to $host +# format in ARG2. Otherwise, emit an error message, but continue (resetting +# func_to_host_file_result to ARG1). +func_convert_file_check () +{ + $opt_debug + if test -z "$2" && test -n "$1" ; then + func_error "Could not determine host file name corresponding to" + func_error " \`$1'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback: + func_to_host_file_result="$1" + fi +} +# end func_convert_file_check + + +# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH +# Verify that FROM_PATH (a path in $build format) was converted to $host +# format in TO_PATH. Otherwise, emit an error message, but continue, resetting +# func_to_host_file_result to a simplistic fallback value (see below). +func_convert_path_check () +{ + $opt_debug + if test -z "$4" && test -n "$3"; then + func_error "Could not determine the host path corresponding to" + func_error " \`$3'" + func_error "Continuing, but uninstalled executables may not work." + # Fallback. This is a deliberately simplistic "conversion" and + # should not be "improved". See libtool.info. + if test "x$1" != "x$2"; then + lt_replace_pathsep_chars="s|$1|$2|g" + func_to_host_path_result=`echo "$3" | + $SED -e "$lt_replace_pathsep_chars"` + else + func_to_host_path_result="$3" + fi + fi +} +# end func_convert_path_check + + +# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG +# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT +# and appending REPL if ORIG matches BACKPAT. +func_convert_path_front_back_pathsep () +{ + $opt_debug + case $4 in + $1 ) func_to_host_path_result="$3$func_to_host_path_result" + ;; + esac + case $4 in + $2 ) func_append func_to_host_path_result "$3" + ;; + esac +} +# end func_convert_path_front_back_pathsep + + +################################################## +# $build to $host FILE NAME CONVERSION FUNCTIONS # +################################################## +# invoked via `$to_host_file_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# Result will be available in $func_to_host_file_result. + + +# func_to_host_file ARG +# Converts the file name ARG from $build format to $host format. Return result +# in func_to_host_file_result. +func_to_host_file () +{ + $opt_debug + $to_host_file_cmd "$1" +} +# end func_to_host_file + + +# func_to_tool_file ARG LAZY +# converts the file name ARG from $build format to toolchain format. Return +# result in func_to_tool_file_result. If the conversion in use is listed +# in (the comma separated) LAZY, no conversion takes place. +func_to_tool_file () +{ + $opt_debug + case ,$2, in + *,"$to_tool_file_cmd",*) + func_to_tool_file_result=$1 + ;; + *) + $to_tool_file_cmd "$1" + func_to_tool_file_result=$func_to_host_file_result + ;; + esac +} +# end func_to_tool_file + + +# func_convert_file_noop ARG +# Copy ARG to func_to_host_file_result. +func_convert_file_noop () +{ + func_to_host_file_result="$1" +} +# end func_convert_file_noop + + +# func_convert_file_msys_to_w32 ARG +# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_file_result. +func_convert_file_msys_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_to_host_file_result="$func_convert_core_msys_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_w32 + + +# func_convert_file_cygwin_to_w32 ARG +# Convert file name ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_file_cygwin_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # because $build is cygwin, we call "the" cygpath in $PATH; no need to use + # LT_CYGPATH in this case. + func_to_host_file_result=`cygpath -m "$1"` + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_cygwin_to_w32 + + +# func_convert_file_nix_to_w32 ARG +# Convert file name ARG from *nix to w32 format. Requires a wine environment +# and a working winepath. Returns result in func_to_host_file_result. +func_convert_file_nix_to_w32 () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_file_wine_to_w32 "$1" + func_to_host_file_result="$func_convert_core_file_wine_to_w32_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_w32 + + +# func_convert_file_msys_to_cygwin ARG +# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_file_msys_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + func_convert_core_msys_to_w32 "$1" + func_cygpath -u "$func_convert_core_msys_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_msys_to_cygwin + + +# func_convert_file_nix_to_cygwin ARG +# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed +# in a wine environment, working winepath, and LT_CYGPATH set. Returns result +# in func_to_host_file_result. +func_convert_file_nix_to_cygwin () +{ + $opt_debug + func_to_host_file_result="$1" + if test -n "$1"; then + # convert from *nix to w32, then use cygpath to convert from w32 to cygwin. + func_convert_core_file_wine_to_w32 "$1" + func_cygpath -u "$func_convert_core_file_wine_to_w32_result" + func_to_host_file_result="$func_cygpath_result" + fi + func_convert_file_check "$1" "$func_to_host_file_result" +} +# end func_convert_file_nix_to_cygwin + + +############################################# +# $build to $host PATH CONVERSION FUNCTIONS # +############################################# +# invoked via `$to_host_path_cmd ARG' +# +# In each case, ARG is the path to be converted from $build to $host format. +# The result will be available in $func_to_host_path_result. +# +# Path separators are also converted from $build format to $host format. If +# ARG begins or ends with a path separator character, it is preserved (but +# converted to $host format) on output. +# +# All path conversion functions are named using the following convention: +# file name conversion function : func_convert_file_X_to_Y () +# path conversion function : func_convert_path_X_to_Y () +# where, for any given $build/$host combination the 'X_to_Y' value is the +# same. If conversion functions are added for new $build/$host combinations, +# the two new functions must follow this pattern, or func_init_to_host_path_cmd +# will break. + + +# func_init_to_host_path_cmd +# Ensures that function "pointer" variable $to_host_path_cmd is set to the +# appropriate value, based on the value of $to_host_file_cmd. +to_host_path_cmd= +func_init_to_host_path_cmd () +{ + $opt_debug + if test -z "$to_host_path_cmd"; then + func_stripname 'func_convert_file_' '' "$to_host_file_cmd" + to_host_path_cmd="func_convert_path_${func_stripname_result}" + fi +} + + +# func_to_host_path ARG +# Converts the path ARG from $build format to $host format. Return result +# in func_to_host_path_result. +func_to_host_path () +{ + $opt_debug + func_init_to_host_path_cmd + $to_host_path_cmd "$1" +} +# end func_to_host_path + + +# func_convert_path_noop ARG +# Copy ARG to func_to_host_path_result. +func_convert_path_noop () +{ + func_to_host_path_result="$1" +} +# end func_convert_path_noop + + +# func_convert_path_msys_to_w32 ARG +# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic +# conversion to w32 is not available inside the cwrapper. Returns result in +# func_to_host_path_result. +func_convert_path_msys_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from ARG. MSYS + # behavior is inconsistent here; cygpath turns them into '.;' and ';.'; + # and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_msys_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_msys_to_w32 + + +# func_convert_path_cygwin_to_w32 ARG +# Convert path ARG from Cygwin to w32 format. Returns result in +# func_to_host_file_result. +func_convert_path_cygwin_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"` + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_cygwin_to_w32 + + +# func_convert_path_nix_to_w32 ARG +# Convert path ARG from *nix to w32 format. Requires a wine environment and +# a working winepath. Returns result in func_to_host_file_result. +func_convert_path_nix_to_w32 () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_to_host_path_result="$func_convert_core_path_wine_to_w32_result" + func_convert_path_check : ";" \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" ";" "$1" + fi +} +# end func_convert_path_nix_to_w32 + + +# func_convert_path_msys_to_cygwin ARG +# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set. +# Returns result in func_to_host_file_result. +func_convert_path_msys_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # See func_convert_path_msys_to_w32: + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_msys_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_msys_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_msys_to_cygwin + + +# func_convert_path_nix_to_cygwin ARG +# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a +# a wine environment, working winepath, and LT_CYGPATH set. Returns result in +# func_to_host_file_result. +func_convert_path_nix_to_cygwin () +{ + $opt_debug + func_to_host_path_result="$1" + if test -n "$1"; then + # Remove leading and trailing path separator characters from + # ARG. msys behavior is inconsistent here, cygpath turns them + # into '.;' and ';.', and winepath ignores them completely. + func_stripname : : "$1" + func_to_host_path_tmp1=$func_stripname_result + func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1" + func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result" + func_to_host_path_result="$func_cygpath_result" + func_convert_path_check : : \ + "$func_to_host_path_tmp1" "$func_to_host_path_result" + func_convert_path_front_back_pathsep ":*" "*:" : "$1" + fi +} +# end func_convert_path_nix_to_cygwin + + +# func_mode_compile arg... +func_mode_compile () +{ + $opt_debug + # Get the compilation command and the source file. + base_compile= + srcfile="$nonopt" # always keep a non-empty value in "srcfile" + suppress_opt=yes + suppress_output= + arg_mode=normal + libobj= + later= + pie_flag= + + for arg + do + case $arg_mode in + arg ) + # do not "continue". Instead, add this to base_compile + lastarg="$arg" + arg_mode=normal + ;; + + target ) + libobj="$arg" + arg_mode=normal + continue + ;; + + normal ) + # Accept any command-line options. + case $arg in + -o) + test -n "$libobj" && \ + func_fatal_error "you cannot specify \`-o' more than once" + arg_mode=target + continue + ;; + + -pie | -fpie | -fPIE) + func_append pie_flag " $arg" + continue + ;; + + -shared | -static | -prefer-pic | -prefer-non-pic) + func_append later " $arg" + continue + ;; + + -no-suppress) + suppress_opt=no + continue + ;; + + -Xcompiler) + arg_mode=arg # the next one goes into the "base_compile" arg list + continue # The current "srcfile" will either be retained or + ;; # replaced later. I would guess that would be a bug. + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + lastarg= + save_ifs="$IFS"; IFS=',' + for arg in $args; do + IFS="$save_ifs" + func_append_quoted lastarg "$arg" + done + IFS="$save_ifs" + func_stripname ' ' '' "$lastarg" + lastarg=$func_stripname_result + + # Add the arguments to base_compile. + func_append base_compile " $lastarg" + continue + ;; + + *) + # Accept the current argument as the source file. + # The previous "srcfile" becomes the current argument. + # + lastarg="$srcfile" + srcfile="$arg" + ;; + esac # case $arg + ;; + esac # case $arg_mode + + # Aesthetically quote the previous argument. + func_append_quoted base_compile "$lastarg" + done # for arg + + case $arg_mode in + arg) + func_fatal_error "you must specify an argument for -Xcompile" + ;; + target) + func_fatal_error "you must specify a target with \`-o'" + ;; + *) + # Get the name of the library object. + test -z "$libobj" && { + func_basename "$srcfile" + libobj="$func_basename_result" + } + ;; + esac + + # Recognize several different file suffixes. + # If the user specifies -o file.o, it is replaced with file.lo + case $libobj in + *.[cCFSifmso] | \ + *.ada | *.adb | *.ads | *.asm | \ + *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \ + *.[fF][09]? | *.for | *.java | *.obj | *.sx | *.cu | *.cup) + func_xform "$libobj" + libobj=$func_xform_result + ;; + esac + + case $libobj in + *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;; + *) + func_fatal_error "cannot determine name of library object from \`$libobj'" + ;; + esac + + func_infer_tag $base_compile + + for arg in $later; do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + continue + ;; + + -static) + build_libtool_libs=no + build_old_libs=yes + continue + ;; + + -prefer-pic) + pic_mode=yes + continue + ;; + + -prefer-non-pic) + pic_mode=no + continue + ;; + esac + done + + func_quote_for_eval "$libobj" + test "X$libobj" != "X$func_quote_for_eval_result" \ + && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \ + && func_warning "libobj name \`$libobj' may not contain shell special characters." + func_dirname_and_basename "$obj" "/" "" + objname="$func_basename_result" + xdir="$func_dirname_result" + lobj=${xdir}$objdir/$objname + + test -z "$base_compile" && \ + func_fatal_help "you must specify a compilation command" + + # Delete any leftover library objects. + if test "$build_old_libs" = yes; then + removelist="$obj $lobj $libobj ${libobj}T" + else + removelist="$lobj $libobj ${libobj}T" + fi + + # On Cygwin there's no "real" PIC flag so we must build both object types + case $host_os in + cygwin* | mingw* | pw32* | os2* | cegcc*) + pic_mode=default + ;; + esac + if test "$pic_mode" = no && test "$deplibs_check_method" != pass_all; then + # non-PIC code in shared libraries is not supported + pic_mode=default + fi + + # Calculate the filename of the output object if compiler does + # not support -o with -c + if test "$compiler_c_o" = no; then + output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext} + lockfile="$output_obj.lock" + else + output_obj= + need_locks=no + lockfile= + fi + + # Lock this critical section if it is needed + # We use this script file to make the link, it avoids creating a new file + if test "$need_locks" = yes; then + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + elif test "$need_locks" = warn; then + if test -f "$lockfile"; then + $ECHO "\ +*** ERROR, $lockfile exists and contains: +`cat $lockfile 2>/dev/null` + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + func_append removelist " $output_obj" + $ECHO "$srcfile" > "$lockfile" + fi + + $opt_dry_run || $RM $removelist + func_append removelist " $lockfile" + trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15 + + func_to_tool_file "$srcfile" func_convert_file_msys_to_w32 + srcfile=$func_to_tool_file_result + func_quote_for_eval "$srcfile" + qsrcfile=$func_quote_for_eval_result + + # Only build a PIC object if we are building libtool libraries. + if test "$build_libtool_libs" = yes; then + # Without this assignment, base_compile gets emptied. + fbsd_hideous_sh_bug=$base_compile + + if test "$pic_mode" != no; then + command="$base_compile $qsrcfile $pic_flag" + else + # Don't build PIC code + command="$base_compile $qsrcfile" + fi + + func_mkdir_p "$xdir$objdir" + + if test -z "$output_obj"; then + # Place PIC objects in $objdir + func_append command " -o $lobj" + fi + + func_show_eval_locale "$command" \ + 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed, then go on to compile the next one + if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then + func_show_eval '$MV "$output_obj" "$lobj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + + # Allow error messages only from the first compilation. + if test "$suppress_opt" = yes; then + suppress_output=' >/dev/null 2>&1' + fi + fi + + # Only build a position-dependent object if we build old libraries. + if test "$build_old_libs" = yes; then + if test "$pic_mode" != yes; then + # Don't build PIC code + command="$base_compile $qsrcfile$pie_flag" + else + command="$base_compile $qsrcfile $pic_flag" + fi + if test "$compiler_c_o" = yes; then + func_append command " -o $obj" + fi + + # Suppress compiler output if we already did a PIC compilation. + func_append command "$suppress_output" + func_show_eval_locale "$command" \ + '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' + + if test "$need_locks" = warn && + test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then + $ECHO "\ +*** ERROR, $lockfile contains: +`cat $lockfile 2>/dev/null` + +but it should contain: +$srcfile + +This indicates that another process is trying to use the same +temporary object file, and libtool could not work around it because +your compiler does not support \`-c' and \`-o' together. If you +repeat this compilation, it may succeed, by chance, but you had better +avoid parallel builds (make -j) in this platform, or get a better +compiler." + + $opt_dry_run || $RM $removelist + exit $EXIT_FAILURE + fi + + # Just move the object if needed + if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then + func_show_eval '$MV "$output_obj" "$obj"' \ + 'error=$?; $opt_dry_run || $RM $removelist; exit $error' + fi + fi + + $opt_dry_run || { + func_write_libtool_object "$libobj" "$objdir/$objname" "$objname" + + # Unlock the critical section if it was locked + if test "$need_locks" != no; then + removelist=$lockfile + $RM "$lockfile" + fi + } + + exit $EXIT_SUCCESS +} + +$opt_help || { + test "$opt_mode" = compile && func_mode_compile ${1+"$@"} +} + +func_mode_help () +{ + # We need to display help for each of the modes. + case $opt_mode in + "") + # Generic help is extracted from the usage comments + # at the start of this file. + func_help + ;; + + clean) + $ECHO \ +"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE... + +Remove files from the build directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, object or program, all the files associated +with it are deleted. Otherwise, only FILE itself is deleted using RM." + ;; + + compile) + $ECHO \ +"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE + +Compile a source file into a libtool library object. + +This mode accepts the following additional options: + + -o OUTPUT-FILE set the output file name to OUTPUT-FILE + -no-suppress do not suppress compiler output for multiple passes + -prefer-pic try to build PIC objects only + -prefer-non-pic try to build non-PIC objects only + -shared do not build a \`.o' file suitable for static linking + -static only build a \`.o' file suitable for static linking + -Wc,FLAG pass FLAG directly to the compiler + +COMPILE-COMMAND is a command to be used in creating a \`standard' object file +from the given SOURCEFILE. + +The output file name is determined by removing the directory component from +SOURCEFILE, then substituting the C source code suffix \`.c' with the +library object suffix, \`.lo'." + ;; + + execute) + $ECHO \ +"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]... + +Automatically set library path, then run a program. + +This mode accepts the following additional options: + + -dlopen FILE add the directory containing FILE to the library path + +This mode sets the library path environment variable according to \`-dlopen' +flags. + +If any of the ARGS are libtool executable wrappers, then they are translated +into their corresponding uninstalled binary, and any of their required library +directories are added to the library path. + +Then, COMMAND is executed, with ARGS as arguments." + ;; + + finish) + $ECHO \ +"Usage: $progname [OPTION]... --mode=finish [LIBDIR]... + +Complete the installation of libtool libraries. + +Each LIBDIR is a directory that contains libtool libraries. + +The commands that this mode executes may require superuser privileges. Use +the \`--dry-run' option if you just want to see what would be executed." + ;; + + install) + $ECHO \ +"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND... + +Install executables or libraries. + +INSTALL-COMMAND is the installation command. The first component should be +either the \`install' or \`cp' program. + +The following components of INSTALL-COMMAND are treated specially: + + -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation + +The rest of the components are interpreted as arguments to that command (only +BSD-compatible install options are recognized)." + ;; + + link) + $ECHO \ +"Usage: $progname [OPTION]... --mode=link LINK-COMMAND... + +Link object files or libraries together to form another library, or to +create an executable program. + +LINK-COMMAND is a command using the C compiler that you would use to create +a program from several object files. + +The following components of LINK-COMMAND are treated specially: + + -all-static do not do any dynamic linking at all + -avoid-version do not add a version suffix if possible + -bindir BINDIR specify path to binaries directory (for systems where + libraries must be found in the PATH setting at runtime) + -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime + -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols + -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3) + -export-symbols SYMFILE + try to export only the symbols listed in SYMFILE + -export-symbols-regex REGEX + try to export only the symbols matching REGEX + -LLIBDIR search LIBDIR for required installed libraries + -lNAME OUTPUT-FILE requires the installed library libNAME + -module build a library that can dlopened + -no-fast-install disable the fast-install mode + -no-install link a not-installable executable + -no-undefined declare that a library does not refer to external symbols + -o OUTPUT-FILE create OUTPUT-FILE from the specified objects + -objectlist FILE Use a list of object files found in FILE to specify objects + -precious-files-regex REGEX + don't remove output files matching REGEX + -release RELEASE specify package release information + -rpath LIBDIR the created library will eventually be installed in LIBDIR + -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries + -shared only do dynamic linking of libtool libraries + -shrext SUFFIX override the standard shared library file extension + -static do not do any dynamic linking of uninstalled libtool libraries + -static-libtool-libs + do not do any dynamic linking of libtool libraries + -version-info CURRENT[:REVISION[:AGE]] + specify library version info [each variable defaults to 0] + -weak LIBNAME declare that the target provides the LIBNAME interface + -Wc,FLAG + -Xcompiler FLAG pass linker-specific FLAG directly to the compiler + -Wl,FLAG + -Xlinker FLAG pass linker-specific FLAG directly to the linker + -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC) + +All other options (arguments beginning with \`-') are ignored. + +Every other argument is treated as a filename. Files ending in \`.la' are +treated as uninstalled libtool libraries, other files are standard or library +object files. + +If the OUTPUT-FILE ends in \`.la', then a libtool library is created, +only library objects (\`.lo' files) may be specified, and \`-rpath' is +required, except when creating a convenience library. + +If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created +using \`ar' and \`ranlib', or on Windows using \`lib'. + +If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file +is created, otherwise an executable program is created." + ;; + + uninstall) + $ECHO \ +"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE... + +Remove libraries from an installation directory. + +RM is the name of the program to use to delete files associated with each FILE +(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed +to RM. + +If FILE is a libtool library, all the files associated with it are deleted. +Otherwise, only FILE itself is deleted using RM." + ;; + + *) + func_fatal_help "invalid operation mode \`$opt_mode'" + ;; + esac + + echo + $ECHO "Try \`$progname --help' for more information about other modes." +} + +# Now that we've collected a possible --mode arg, show help if necessary +if $opt_help; then + if test "$opt_help" = :; then + func_mode_help + else + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + func_mode_help + done + } | sed -n '1p; 2,$s/^Usage:/ or: /p' + { + func_help noexit + for opt_mode in compile link execute install finish uninstall clean; do + echo + func_mode_help + done + } | + sed '1d + /^When reporting/,/^Report/{ + H + d + } + $x + /information about other modes/d + /more detailed .*MODE/d + s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/' + fi + exit $? +fi + + +# func_mode_execute arg... +func_mode_execute () +{ + $opt_debug + # The first argument is the command name. + cmd="$nonopt" + test -z "$cmd" && \ + func_fatal_help "you must specify a COMMAND" + + # Handle -dlopen flags immediately. + for file in $opt_dlopen; do + test -f "$file" \ + || func_fatal_help "\`$file' is not a file" + + dir= + case $file in + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$lib' is not a valid libtool archive" + + # Read the libtool library. + dlname= + library_names= + func_source "$file" + + # Skip this library if it cannot be dlopened. + if test -z "$dlname"; then + # Warn if it was a shared library. + test -n "$library_names" && \ + func_warning "\`$file' was not linked with \`-export-dynamic'" + continue + fi + + func_dirname "$file" "" "." + dir="$func_dirname_result" + + if test -f "$dir/$objdir/$dlname"; then + func_append dir "/$objdir" + else + if test ! -f "$dir/$dlname"; then + func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" + fi + fi + ;; + + *.lo) + # Just add the directory containing the .lo file. + func_dirname "$file" "" "." + dir="$func_dirname_result" + ;; + + *) + func_warning "\`-dlopen' is ignored for non-libtool libraries and objects" + continue + ;; + esac + + # Get the absolute pathname. + absdir=`cd "$dir" && pwd` + test -n "$absdir" && dir="$absdir" + + # Now add the directory to shlibpath_var. + if eval "test -z \"\$$shlibpath_var\""; then + eval "$shlibpath_var=\"\$dir\"" + else + eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\"" + fi + done + + # This variable tells wrapper scripts just to set shlibpath_var + # rather than running their programs. + libtool_execute_magic="$magic" + + # Check if any of the arguments is a wrapper script. + args= + for file + do + case $file in + -* | *.la | *.lo ) ;; + *) + # Do a test to see if this is really a libtool program. + if func_ltwrapper_script_p "$file"; then + func_source "$file" + # Transform arg to wrapped name. + file="$progdir/$program" + elif func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + func_source "$func_ltwrapper_scriptname_result" + # Transform arg to wrapped name. + file="$progdir/$program" + fi + ;; + esac + # Quote arguments (to preserve shell metacharacters). + func_append_quoted args "$file" + done + + if test "X$opt_dry_run" = Xfalse; then + if test -n "$shlibpath_var"; then + # Export the shlibpath_var. + eval "export $shlibpath_var" + fi + + # Restore saved environment variables + for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES + do + eval "if test \"\${save_$lt_var+set}\" = set; then + $lt_var=\$save_$lt_var; export $lt_var + else + $lt_unset $lt_var + fi" + done + + # Now prepare to actually exec the command. + exec_cmd="\$cmd$args" + else + # Display what would be done. + if test -n "$shlibpath_var"; then + eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\"" + echo "export $shlibpath_var" + fi + $ECHO "$cmd$args" + exit $EXIT_SUCCESS + fi +} + +test "$opt_mode" = execute && func_mode_execute ${1+"$@"} + + +# func_mode_finish arg... +func_mode_finish () +{ + $opt_debug + libs= + libdirs= + admincmds= + + for opt in "$nonopt" ${1+"$@"} + do + if test -d "$opt"; then + func_append libdirs " $opt" + + elif test -f "$opt"; then + if func_lalib_unsafe_p "$opt"; then + func_append libs " $opt" + else + func_warning "\`$opt' is not a valid libtool archive" + fi + + else + func_fatal_error "invalid argument \`$opt'" + fi + done + + if test -n "$libs"; then + if test -n "$lt_sysroot"; then + sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"` + sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;" + else + sysroot_cmd= + fi + + # Remove sysroot references + if $opt_dry_run; then + for lib in $libs; do + echo "removing references to $lt_sysroot and \`=' prefixes from $lib" + done + else + tmpdir=`func_mktempdir` + for lib in $libs; do + sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \ + > $tmpdir/tmp-la + mv -f $tmpdir/tmp-la $lib + done + ${RM}r "$tmpdir" + fi + fi + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + for libdir in $libdirs; do + if test -n "$finish_cmds"; then + # Do each command in the finish commands. + func_execute_cmds "$finish_cmds" 'admincmds="$admincmds +'"$cmd"'"' + fi + if test -n "$finish_eval"; then + # Do the single finish_eval. + eval cmds=\"$finish_eval\" + $opt_dry_run || eval "$cmds" || func_append admincmds " + $cmds" + fi + done + fi + + # Exit here if they wanted silent mode. + $opt_silent && exit $EXIT_SUCCESS + + if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then + echo "----------------------------------------------------------------------" + echo "Libraries have been installed in:" + for libdir in $libdirs; do + $ECHO " $libdir" + done + echo + echo "If you ever happen to want to link against installed libraries" + echo "in a given directory, LIBDIR, you must either use libtool, and" + echo "specify the full pathname of the library, or use the \`-LLIBDIR'" + echo "flag during linking and do at least one of the following:" + if test -n "$shlibpath_var"; then + echo " - add LIBDIR to the \`$shlibpath_var' environment variable" + echo " during execution" + fi + if test -n "$runpath_var"; then + echo " - add LIBDIR to the \`$runpath_var' environment variable" + echo " during linking" + fi + if test -n "$hardcode_libdir_flag_spec"; then + libdir=LIBDIR + eval flag=\"$hardcode_libdir_flag_spec\" + + $ECHO " - use the \`$flag' linker flag" + fi + if test -n "$admincmds"; then + $ECHO " - have your system administrator run these commands:$admincmds" + fi + if test -f /etc/ld.so.conf; then + echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'" + fi + echo + + echo "See any operating system documentation about shared libraries for" + case $host in + solaris2.[6789]|solaris2.1[0-9]) + echo "more information, such as the ld(1), crle(1) and ld.so(8) manual" + echo "pages." + ;; + *) + echo "more information, such as the ld(1) and ld.so(8) manual pages." + ;; + esac + echo "----------------------------------------------------------------------" + fi + exit $EXIT_SUCCESS +} + +test "$opt_mode" = finish && func_mode_finish ${1+"$@"} + + +# func_mode_install arg... +func_mode_install () +{ + $opt_debug + # There may be an optional sh(1) argument at the beginning of + # install_prog (especially on Windows NT). + if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh || + # Allow the use of GNU shtool's install command. + case $nonopt in *shtool*) :;; *) false;; esac; then + # Aesthetically quote it. + func_quote_for_eval "$nonopt" + install_prog="$func_quote_for_eval_result " + arg=$1 + shift + else + install_prog= + arg=$nonopt + fi + + # The real first argument should be the name of the installation program. + # Aesthetically quote it. + func_quote_for_eval "$arg" + func_append install_prog "$func_quote_for_eval_result" + install_shared_prog=$install_prog + case " $install_prog " in + *[\\\ /]cp\ *) install_cp=: ;; + *) install_cp=false ;; + esac + + # We need to accept at least all the BSD install flags. + dest= + files= + opts= + prev= + install_type= + isdir=no + stripme= + no_mode=: + for arg + do + arg2= + if test -n "$dest"; then + func_append files " $dest" + dest=$arg + continue + fi + + case $arg in + -d) isdir=yes ;; + -f) + if $install_cp; then :; else + prev=$arg + fi + ;; + -g | -m | -o) + prev=$arg + ;; + -s) + stripme=" -s" + continue + ;; + -*) + ;; + *) + # If the previous option needed an argument, then skip it. + if test -n "$prev"; then + if test "x$prev" = x-m && test -n "$install_override_mode"; then + arg2=$install_override_mode + no_mode=false + fi + prev= + else + dest=$arg + continue + fi + ;; + esac + + # Aesthetically quote the argument. + func_quote_for_eval "$arg" + func_append install_prog " $func_quote_for_eval_result" + if test -n "$arg2"; then + func_quote_for_eval "$arg2" + fi + func_append install_shared_prog " $func_quote_for_eval_result" + done + + test -z "$install_prog" && \ + func_fatal_help "you must specify an install program" + + test -n "$prev" && \ + func_fatal_help "the \`$prev' option requires an argument" + + if test -n "$install_override_mode" && $no_mode; then + if $install_cp; then :; else + func_quote_for_eval "$install_override_mode" + func_append install_shared_prog " -m $func_quote_for_eval_result" + fi + fi + + if test -z "$files"; then + if test -z "$dest"; then + func_fatal_help "no file or destination specified" + else + func_fatal_help "you must specify a destination" + fi + fi + + # Strip any trailing slash from the destination. + func_stripname '' '/' "$dest" + dest=$func_stripname_result + + # Check to see that the destination is a directory. + test -d "$dest" && isdir=yes + if test "$isdir" = yes; then + destdir="$dest" + destname= + else + func_dirname_and_basename "$dest" "" "." + destdir="$func_dirname_result" + destname="$func_basename_result" + + # Not a directory, so check to see that there is only one file specified. + set dummy $files; shift + test "$#" -gt 1 && \ + func_fatal_help "\`$dest' is not a directory" + fi + case $destdir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + for file in $files; do + case $file in + *.lo) ;; + *) + func_fatal_help "\`$destdir' must be an absolute directory name" + ;; + esac + done + ;; + esac + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + staticlibs= + future_libdirs= + current_libdirs= + for file in $files; do + + # Do each installation. + case $file in + *.$libext) + # Do the static libraries later. + func_append staticlibs " $file" + ;; + + *.la) + func_resolve_sysroot "$file" + file=$func_resolve_sysroot_result + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$file" \ + || func_fatal_help "\`$file' is not a valid libtool archive" + + library_names= + old_library= + relink_command= + func_source "$file" + + # Add the libdir to current_libdirs if it is the destination. + if test "X$destdir" = "X$libdir"; then + case "$current_libdirs " in + *" $libdir "*) ;; + *) func_append current_libdirs " $libdir" ;; + esac + else + # Note the libdir as a future libdir. + case "$future_libdirs " in + *" $libdir "*) ;; + *) func_append future_libdirs " $libdir" ;; + esac + fi + + func_dirname "$file" "/" "" + dir="$func_dirname_result" + func_append dir "$objdir" + + if test -n "$relink_command"; then + # Determine the prefix the user has applied to our future dir. + inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"` + + # Don't allow the user to place us outside of our expected + # location b/c this prevents finding dependent libraries that + # are installed to the same prefix. + # At present, this check doesn't affect windows .dll's that + # are installed into $libdir/../bin (currently, that works fine) + # but it's something to keep an eye on. + test "$inst_prefix_dir" = "$destdir" && \ + func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir" + + if test -n "$inst_prefix_dir"; then + # Stick the inst_prefix_dir data into the link command. + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"` + else + relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"` + fi + + func_warning "relinking \`$file'" + func_show_eval "$relink_command" \ + 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"' + fi + + # See the names of the shared library. + set dummy $library_names; shift + if test -n "$1"; then + realname="$1" + shift + + srcname="$realname" + test -n "$relink_command" && srcname="$realname"T + + # Install the shared library and build the symlinks. + func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \ + 'exit $?' + tstripme="$stripme" + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + case $realname in + *.dll.a) + tstripme="" + ;; + esac + ;; + esac + if test -n "$tstripme" && test -n "$striplib"; then + func_show_eval "$striplib $destdir/$realname" 'exit $?' + fi + + if test "$#" -gt 0; then + # Delete the old symlinks, and create new ones. + # Try `ln -sf' first, because the `ln' binary might depend on + # the symlink we replace! Solaris /bin/ln does not understand -f, + # so we also need to try rm && ln -s. + for linkname + do + test "$linkname" != "$realname" \ + && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })" + done + fi + + # Do each command in the postinstall commands. + lib="$destdir/$realname" + func_execute_cmds "$postinstall_cmds" 'exit $?' + fi + + # Install the pseudo-library for information purposes. + func_basename "$file" + name="$func_basename_result" + instname="$dir/$name"i + func_show_eval "$install_prog $instname $destdir/$name" 'exit $?' + + # Maybe install the static library, too. + test -n "$old_library" && func_append staticlibs " $dir/$old_library" + ;; + + *.lo) + # Install (i.e. copy) a libtool object. + + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # Deduce the name of the destination old-style object file. + case $destfile in + *.lo) + func_lo2o "$destfile" + staticdest=$func_lo2o_result + ;; + *.$objext) + staticdest="$destfile" + destfile= + ;; + *) + func_fatal_help "cannot copy a libtool object to \`$destfile'" + ;; + esac + + # Install the libtool object if requested. + test -n "$destfile" && \ + func_show_eval "$install_prog $file $destfile" 'exit $?' + + # Install the old object if enabled. + if test "$build_old_libs" = yes; then + # Deduce the name of the old-style object file. + func_lo2o "$file" + staticobj=$func_lo2o_result + func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?' + fi + exit $EXIT_SUCCESS + ;; + + *) + # Figure out destination file name, if it wasn't already specified. + if test -n "$destname"; then + destfile="$destdir/$destname" + else + func_basename "$file" + destfile="$func_basename_result" + destfile="$destdir/$destfile" + fi + + # If the file is missing, and there is a .exe on the end, strip it + # because it is most likely a libtool script we actually want to + # install + stripped_ext="" + case $file in + *.exe) + if test ! -f "$file"; then + func_stripname '' '.exe' "$file" + file=$func_stripname_result + stripped_ext=".exe" + fi + ;; + esac + + # Do a test to see if this is really a libtool program. + case $host in + *cygwin* | *mingw*) + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + wrapper=$func_ltwrapper_scriptname_result + else + func_stripname '' '.exe' "$file" + wrapper=$func_stripname_result + fi + ;; + *) + wrapper=$file + ;; + esac + if func_ltwrapper_script_p "$wrapper"; then + notinst_deplibs= + relink_command= + + func_source "$wrapper" + + # Check the variables that should have been set. + test -z "$generated_by_libtool_version" && \ + func_fatal_error "invalid libtool wrapper script \`$wrapper'" + + finalize=yes + for lib in $notinst_deplibs; do + # Check to see that each library is installed. + libdir= + if test -f "$lib"; then + func_source "$lib" + fi + libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test + if test -n "$libdir" && test ! -f "$libfile"; then + func_warning "\`$lib' has not been installed in \`$libdir'" + finalize=no + fi + done + + relink_command= + func_source "$wrapper" + + outputname= + if test "$fast_install" = no && test -n "$relink_command"; then + $opt_dry_run || { + if test "$finalize" = yes; then + tmpdir=`func_mktempdir` + func_basename "$file$stripped_ext" + file="$func_basename_result" + outputname="$tmpdir/$file" + # Replace the output file specification. + relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'` + + $opt_silent || { + func_quote_for_expand "$relink_command" + eval "func_echo $func_quote_for_expand_result" + } + if eval "$relink_command"; then : + else + func_error "error: relink \`$file' with the above command before installing it" + $opt_dry_run || ${RM}r "$tmpdir" + continue + fi + file="$outputname" + else + func_warning "cannot relink \`$file'" + fi + } + else + # Install the binary that we compiled earlier. + file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"` + fi + fi + + # remove .exe since cygwin /usr/bin/install will append another + # one anyway + case $install_prog,$host in + */usr/bin/install*,*cygwin*) + case $file:$destfile in + *.exe:*.exe) + # this is ok + ;; + *.exe:*) + destfile=$destfile.exe + ;; + *:*.exe) + func_stripname '' '.exe' "$destfile" + destfile=$func_stripname_result + ;; + esac + ;; + esac + func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?' + $opt_dry_run || if test -n "$outputname"; then + ${RM}r "$tmpdir" + fi + ;; + esac + done + + for file in $staticlibs; do + func_basename "$file" + name="$func_basename_result" + + # Set up the ranlib parameters. + oldlib="$destdir/$name" + + func_show_eval "$install_prog \$file \$oldlib" 'exit $?' + + if test -n "$stripme" && test -n "$old_striplib"; then + func_show_eval "$old_striplib $oldlib" 'exit $?' + fi + + # Do each command in the postinstall commands. + func_execute_cmds "$old_postinstall_cmds" 'exit $?' + done + + test -n "$future_libdirs" && \ + func_warning "remember to run \`$progname --finish$future_libdirs'" + + if test -n "$current_libdirs"; then + # Maybe just do a dry run. + $opt_dry_run && current_libdirs=" -n$current_libdirs" + exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs' + else + exit $EXIT_SUCCESS + fi +} + +test "$opt_mode" = install && func_mode_install ${1+"$@"} + + +# func_generate_dlsyms outputname originator pic_p +# Extract symbols from dlprefiles and create ${outputname}S.o with +# a dlpreopen symbol table. +func_generate_dlsyms () +{ + $opt_debug + my_outputname="$1" + my_originator="$2" + my_pic_p="${3-no}" + my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'` + my_dlsyms= + + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + if test -n "$NM" && test -n "$global_symbol_pipe"; then + my_dlsyms="${my_outputname}S.c" + else + func_error "not configured to extract global symbols from dlpreopened files" + fi + fi + + if test -n "$my_dlsyms"; then + case $my_dlsyms in + "") ;; + *.c) + # Discover the nlist of each of the dlfiles. + nlist="$output_objdir/${my_outputname}.nm" + + func_show_eval "$RM $nlist ${nlist}S ${nlist}T" + + # Parse the name list into a source file. + func_verbose "creating $output_objdir/$my_dlsyms" + + $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\ +/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */ +/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */ + +#ifdef __cplusplus +extern \"C\" { +#endif + +#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4)) +#pragma GCC diagnostic ignored \"-Wstrict-prototypes\" +#endif + +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT_DLSYM_CONST +#else +# define LT_DLSYM_CONST const +#endif + +/* External symbol declarations for the compiler. */\ +" + + if test "$dlself" = yes; then + func_verbose "generating symbol list for \`$output'" + + $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist" + + # Add our own program objects to the symbol list. + progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP` + for progfile in $progfiles; do + func_to_tool_file "$progfile" func_convert_file_msys_to_w32 + func_verbose "extracting global C symbols from \`$func_to_tool_file_result'" + $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'" + done + + if test -n "$exclude_expsyms"; then + $opt_dry_run || { + eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + if test -n "$export_symbols_regex"; then + $opt_dry_run || { + eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + } + fi + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + export_symbols="$output_objdir/$outputname.exp" + $opt_dry_run || { + $RM $export_symbols + eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"' + ;; + esac + } + else + $opt_dry_run || { + eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"' + eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T' + eval '$MV "$nlist"T "$nlist"' + case $host in + *cygwin* | *mingw* | *cegcc* ) + eval "echo EXPORTS "'> "$output_objdir/$outputname.def"' + eval 'cat "$nlist" >> "$output_objdir/$outputname.def"' + ;; + esac + } + fi + fi + + for dlprefile in $dlprefiles; do + func_verbose "extracting global C symbols from \`$dlprefile'" + func_basename "$dlprefile" + name="$func_basename_result" + case $host in + *cygwin* | *mingw* | *cegcc* ) + # if an import library, we need to obtain dlname + if func_win32_import_lib_p "$dlprefile"; then + func_tr_sh "$dlprefile" + eval "curr_lafile=\$libfile_$func_tr_sh_result" + dlprefile_dlbasename="" + if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then + # Use subshell, to avoid clobbering current variable values + dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"` + if test -n "$dlprefile_dlname" ; then + func_basename "$dlprefile_dlname" + dlprefile_dlbasename="$func_basename_result" + else + # no lafile. user explicitly requested -dlpreopen . + $sharedlib_from_linklib_cmd "$dlprefile" + dlprefile_dlbasename=$sharedlib_from_linklib_result + fi + fi + $opt_dry_run || { + if test -n "$dlprefile_dlbasename" ; then + eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"' + else + func_warning "Could not compute DLL name from $name" + eval '$ECHO ": $name " >> "$nlist"' + fi + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe | + $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'" + } + else # not an import lib + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + fi + ;; + *) + $opt_dry_run || { + eval '$ECHO ": $name " >> "$nlist"' + func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32 + eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'" + } + ;; + esac + done + + $opt_dry_run || { + # Make sure we have at least an empty file. + test -f "$nlist" || : > "$nlist" + + if test -n "$exclude_expsyms"; then + $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T + $MV "$nlist"T "$nlist" + fi + + # Try sorting and uniquifying the output. + if $GREP -v "^: " < "$nlist" | + if sort -k 3 /dev/null 2>&1; then + sort -k 3 + else + sort +2 + fi | + uniq > "$nlist"S; then + : + else + $GREP -v "^: " < "$nlist" > "$nlist"S + fi + + if test -f "$nlist"S; then + eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"' + else + echo '/* NONE */' >> "$output_objdir/$my_dlsyms" + fi + + echo >> "$output_objdir/$my_dlsyms" "\ + +/* The mapping between symbol names and symbols. */ +typedef struct { + const char *name; + void *address; +} lt_dlsymlist; +extern LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[]; +LT_DLSYM_CONST lt_dlsymlist +lt_${my_prefix}_LTX_preloaded_symbols[] = +{\ + { \"$my_originator\", (void *) 0 }," + + case $need_lib_prefix in + no) + eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + *) + eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms" + ;; + esac + echo >> "$output_objdir/$my_dlsyms" "\ + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt_${my_prefix}_LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif\ +" + } # !$opt_dry_run + + pic_flag_for_symtable= + case "$compile_command " in + *" -static "*) ;; + *) + case $host in + # compiling the symbol table file with pic_flag works around + # a FreeBSD bug that causes programs to crash when -lm is + # linked before any other PIC object. But we must not use + # pic_flag when linking with -static. The problem exists in + # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1. + *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*) + pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;; + *-*-hpux*) + pic_flag_for_symtable=" $pic_flag" ;; + *) + if test "X$my_pic_p" != Xno; then + pic_flag_for_symtable=" $pic_flag" + fi + ;; + esac + ;; + esac + symtab_cflags= + for arg in $LTCFLAGS; do + case $arg in + -pie | -fpie | -fPIE) ;; + *) func_append symtab_cflags " $arg" ;; + esac + done + + # Now compile the dynamic symbol file. + func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?' + + # Clean up the generated files. + func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"' + + # Transform the symbol file into the correct name. + symfileobj="$output_objdir/${my_outputname}S.$objext" + case $host in + *cygwin* | *mingw* | *cegcc* ) + if test -f "$output_objdir/$my_outputname.def"; then + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"` + else + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + fi + ;; + *) + compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"` + ;; + esac + ;; + *) + func_fatal_error "unknown suffix for \`$my_dlsyms'" + ;; + esac + else + # We keep going just in case the user didn't refer to + # lt_preloaded_symbols. The linker will fail if global_symbol_pipe + # really was required. + + # Nullify the symbol file. + compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"` + finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"` + fi +} + +# func_win32_libid arg +# return the library type of file 'arg' +# +# Need a lot of goo to handle *both* DLLs and import libs +# Has to be a shell function in order to 'eat' the argument +# that is supplied when $file_magic_command is called. +# Despite the name, also deal with 64 bit binaries. +func_win32_libid () +{ + $opt_debug + win32_libid_type="unknown" + win32_fileres=`file -L $1 2>/dev/null` + case $win32_fileres in + *ar\ archive\ import\ library*) # definitely import + win32_libid_type="x86 archive import" + ;; + *ar\ archive*) # could be an import, or static + # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD. + if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | + $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then + func_to_tool_file "$1" func_convert_file_msys_to_w32 + win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" | + $SED -n -e ' + 1,100{ + / I /{ + s,.*,import, + p + q + } + }'` + case $win32_nmres in + import*) win32_libid_type="x86 archive import";; + *) win32_libid_type="x86 archive static";; + esac + fi + ;; + *DLL*) + win32_libid_type="x86 DLL" + ;; + *executable*) # but shell scripts are "executable" too... + case $win32_fileres in + *MS\ Windows\ PE\ Intel*) + win32_libid_type="x86 DLL" + ;; + esac + ;; + esac + $ECHO "$win32_libid_type" +} + +# func_cygming_dll_for_implib ARG +# +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib () +{ + $opt_debug + sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"` +} + +# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs +# +# The is the core of a fallback implementation of a +# platform-specific function to extract the name of the +# DLL associated with the specified import library LIBNAME. +# +# SECTION_NAME is either .idata$6 or .idata$7, depending +# on the platform and compiler that created the implib. +# +# Echos the name of the DLL associated with the +# specified import library. +func_cygming_dll_for_implib_fallback_core () +{ + $opt_debug + match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"` + $OBJDUMP -s --section "$1" "$2" 2>/dev/null | + $SED '/^Contents of section '"$match_literal"':/{ + # Place marker at beginning of archive member dllname section + s/.*/====MARK====/ + p + d + } + # These lines can sometimes be longer than 43 characters, but + # are always uninteresting + /:[ ]*file format pe[i]\{,1\}-/d + /^In archive [^:]*:/d + # Ensure marker is printed + /^====MARK====/p + # Remove all lines with less than 43 characters + /^.\{43\}/!d + # From remaining lines, remove first 43 characters + s/^.\{43\}//' | + $SED -n ' + # Join marker and all lines until next marker into a single line + /^====MARK====/ b para + H + $ b para + b + :para + x + s/\n//g + # Remove the marker + s/^====MARK====// + # Remove trailing dots and whitespace + s/[\. \t]*$// + # Print + /./p' | + # we now have a list, one entry per line, of the stringified + # contents of the appropriate section of all members of the + # archive which possess that section. Heuristic: eliminate + # all those which have a first or second character that is + # a '.' (that is, objdump's representation of an unprintable + # character.) This should work for all archives with less than + # 0x302f exports -- but will fail for DLLs whose name actually + # begins with a literal '.' or a single character followed by + # a '.'. + # + # Of those that remain, print the first one. + $SED -e '/^\./d;/^.\./d;q' +} + +# func_cygming_gnu_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is a GNU/binutils-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_gnu_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'` + test -n "$func_cygming_gnu_implib_tmp" +} + +# func_cygming_ms_implib_p ARG +# This predicate returns with zero status (TRUE) if +# ARG is an MS-style import library. Returns +# with nonzero status (FALSE) otherwise. +func_cygming_ms_implib_p () +{ + $opt_debug + func_to_tool_file "$1" func_convert_file_msys_to_w32 + func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'` + test -n "$func_cygming_ms_implib_tmp" +} + +# func_cygming_dll_for_implib_fallback ARG +# Platform-specific function to extract the +# name of the DLL associated with the specified +# import library ARG. +# +# This fallback implementation is for use when $DLLTOOL +# does not support the --identify-strict option. +# Invoked by eval'ing the libtool variable +# $sharedlib_from_linklib_cmd +# Result is available in the variable +# $sharedlib_from_linklib_result +func_cygming_dll_for_implib_fallback () +{ + $opt_debug + if func_cygming_gnu_implib_p "$1" ; then + # binutils import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"` + elif func_cygming_ms_implib_p "$1" ; then + # ms-generated import library + sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"` + else + # unknown + sharedlib_from_linklib_result="" + fi +} + + +# func_extract_an_archive dir oldlib +func_extract_an_archive () +{ + $opt_debug + f_ex_an_ar_dir="$1"; shift + f_ex_an_ar_oldlib="$1" + if test "$lock_old_archive_extraction" = yes; then + lockfile=$f_ex_an_ar_oldlib.lock + until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do + func_echo "Waiting for $lockfile to be removed" + sleep 2 + done + fi + func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \ + 'stat=$?; rm -f "$lockfile"; exit $stat' + if test "$lock_old_archive_extraction" = yes; then + $opt_dry_run || rm -f "$lockfile" + fi + if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then + : + else + func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" + fi +} + + +# func_extract_archives gentop oldlib ... +func_extract_archives () +{ + $opt_debug + my_gentop="$1"; shift + my_oldlibs=${1+"$@"} + my_oldobjs="" + my_xlib="" + my_xabs="" + my_xdir="" + + for my_xlib in $my_oldlibs; do + # Extract the objects. + case $my_xlib in + [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;; + *) my_xabs=`pwd`"/$my_xlib" ;; + esac + func_basename "$my_xlib" + my_xlib="$func_basename_result" + my_xlib_u=$my_xlib + while :; do + case " $extracted_archives " in + *" $my_xlib_u "*) + func_arith $extracted_serial + 1 + extracted_serial=$func_arith_result + my_xlib_u=lt$extracted_serial-$my_xlib ;; + *) break ;; + esac + done + extracted_archives="$extracted_archives $my_xlib_u" + my_xdir="$my_gentop/$my_xlib_u" + + func_mkdir_p "$my_xdir" + + case $host in + *-darwin*) + func_verbose "Extracting $my_xabs" + # Do not bother doing anything if just a dry run + $opt_dry_run || { + darwin_orig_dir=`pwd` + cd $my_xdir || exit $? + darwin_archive=$my_xabs + darwin_curdir=`pwd` + darwin_base_archive=`basename "$darwin_archive"` + darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true` + if test -n "$darwin_arches"; then + darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'` + darwin_arch= + func_verbose "$darwin_base_archive has multiple architectures $darwin_arches" + for darwin_arch in $darwin_arches ; do + func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}" + $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}" + cd "unfat-$$/${darwin_base_archive}-${darwin_arch}" + func_extract_an_archive "`pwd`" "${darwin_base_archive}" + cd "$darwin_curdir" + $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" + done # $darwin_arches + ## Okay now we've a bunch of thin objects, gotta fatten them up :) + darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u` + darwin_file= + darwin_files= + for darwin_file in $darwin_filelist; do + darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP` + $LIPO -create -output "$darwin_file" $darwin_files + done # $darwin_filelist + $RM -rf unfat-$$ + cd "$darwin_orig_dir" + else + cd $darwin_orig_dir + func_extract_an_archive "$my_xdir" "$my_xabs" + fi # $darwin_arches + } # !$opt_dry_run + ;; + *) + func_extract_an_archive "$my_xdir" "$my_xabs" + ;; + esac + my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP` + done + + func_extract_archives_result="$my_oldobjs" +} + + +# func_emit_wrapper [arg=no] +# +# Emit a libtool wrapper script on stdout. +# Don't directly open a file because we may want to +# incorporate the script contents within a cygwin/mingw +# wrapper executable. Must ONLY be called from within +# func_mode_link because it depends on a number of variables +# set therein. +# +# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR +# variable will take. If 'yes', then the emitted script +# will assume that the directory in which it is stored is +# the $objdir directory. This is a cygwin/mingw-specific +# behavior. +func_emit_wrapper () +{ + func_emit_wrapper_arg1=${1-no} + + $ECHO "\ +#! $SHELL + +# $output - temporary wrapper script for $objdir/$outputname +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# The $output program cannot be directly executed until all the libtool +# libraries that it depends on are installed. +# +# This wrapper script should never be moved out of the build directory. +# If it is, it will not operate correctly. + +# Sed substitution that helps us do robust quoting. It backslashifies +# metacharacters that are still active within double-quoted strings. +sed_quote_subst='$sed_quote_subst' + +# Be Bourne compatible +if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then + emulate sh + NULLCMD=: + # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which + # is contrary to our usage. Disable this feature. + alias -g '\${1+\"\$@\"}'='\"\$@\"' + setopt NO_GLOB_SUBST +else + case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac +fi +BIN_SH=xpg4; export BIN_SH # for Tru64 +DUALCASE=1; export DUALCASE # for MKS sh + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +relink_command=\"$relink_command\" + +# This environment variable determines our operation mode. +if test \"\$libtool_install_magic\" = \"$magic\"; then + # install mode needs the following variables: + generated_by_libtool_version='$macro_version' + notinst_deplibs='$notinst_deplibs' +else + # When we are sourced in execute mode, \$file and \$ECHO are already set. + if test \"\$libtool_execute_magic\" != \"$magic\"; then + file=\"\$0\"" + + qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"` + $ECHO "\ + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$1 +_LTECHO_EOF' +} + ECHO=\"$qECHO\" + fi + +# Very basic option parsing. These options are (a) specific to +# the libtool wrapper, (b) are identical between the wrapper +# /script/ and the wrapper /executable/ which is used only on +# windows platforms, and (c) all begin with the string "--lt-" +# (application programs are unlikely to have options which match +# this pattern). +# +# There are only two supported options: --lt-debug and +# --lt-dump-script. There is, deliberately, no --lt-help. +# +# The first argument to this parsing function should be the +# script's $0 value, followed by "$@". +lt_option_debug= +func_parse_lt_options () +{ + lt_script_arg0=\$0 + shift + for lt_opt + do + case \"\$lt_opt\" in + --lt-debug) lt_option_debug=1 ;; + --lt-dump-script) + lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\` + test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=. + lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\` + cat \"\$lt_dump_D/\$lt_dump_F\" + exit 0 + ;; + --lt-*) + \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2 + exit 1 + ;; + esac + done + + # Print the debug banner immediately: + if test -n \"\$lt_option_debug\"; then + echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2 + fi +} + +# Used when --lt-debug. Prints its arguments to stdout +# (redirection is the responsibility of the caller) +func_lt_dump_args () +{ + lt_dump_args_N=1; + for lt_arg + do + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\" + lt_dump_args_N=\`expr \$lt_dump_args_N + 1\` + done +} + +# Core function for launching the target application +func_exec_program_core () +{ +" + case $host in + # Backslashes separate directories on plain windows + *-*-mingw | *-*-os2* | *-cegcc*) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir\\\\\$program\" \${1+\"\$@\"} +" + ;; + + *) + $ECHO "\ + if test -n \"\$lt_option_debug\"; then + \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2 + func_lt_dump_args \${1+\"\$@\"} 1>&2 + fi + exec \"\$progdir/\$program\" \${1+\"\$@\"} +" + ;; + esac + $ECHO "\ + \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2 + exit 1 +} + +# A function to encapsulate launching the target application +# Strips options in the --lt-* namespace from \$@ and +# launches target application with the remaining arguments. +func_exec_program () +{ + for lt_wr_arg + do + case \$lt_wr_arg in + --lt-*) ;; + *) set x \"\$@\" \"\$lt_wr_arg\"; shift;; + esac + shift + done + func_exec_program_core \${1+\"\$@\"} +} + + # Parse options + func_parse_lt_options \"\$0\" \${1+\"\$@\"} + + # Find the directory that this script lives in. + thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\` + test \"x\$thisdir\" = \"x\$file\" && thisdir=. + + # Follow symbolic links until we get to the real thisdir. + file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\` + while test -n \"\$file\"; do + destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\` + + # If there was a directory component, then change thisdir. + if test \"x\$destdir\" != \"x\$file\"; then + case \"\$destdir\" in + [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;; + *) thisdir=\"\$thisdir/\$destdir\" ;; + esac + fi + + file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\` + file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\` + done + + # Usually 'no', except on cygwin/mingw when embedded into + # the cwrapper. + WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1 + if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then + # special case for '.' + if test \"\$thisdir\" = \".\"; then + thisdir=\`pwd\` + fi + # remove .libs from thisdir + case \"\$thisdir\" in + *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;; + $objdir ) thisdir=. ;; + esac + fi + + # Try to get the absolute directory name. + absdir=\`cd \"\$thisdir\" && pwd\` + test -n \"\$absdir\" && thisdir=\"\$absdir\" +" + + if test "$fast_install" = yes; then + $ECHO "\ + program=lt-'$outputname'$exeext + progdir=\"\$thisdir/$objdir\" + + if test ! -f \"\$progdir/\$program\" || + { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\ + test \"X\$file\" != \"X\$progdir/\$program\"; }; then + + file=\"\$\$-\$program\" + + if test ! -d \"\$progdir\"; then + $MKDIR \"\$progdir\" + else + $RM \"\$progdir/\$file\" + fi" + + $ECHO "\ + + # relink executable if necessary + if test -n \"\$relink_command\"; then + if relink_command_output=\`eval \$relink_command 2>&1\`; then : + else + $ECHO \"\$relink_command_output\" >&2 + $RM \"\$progdir/\$file\" + exit 1 + fi + fi + + $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null || + { $RM \"\$progdir/\$program\"; + $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; } + $RM \"\$progdir/\$file\" + fi" + else + $ECHO "\ + program='$outputname' + progdir=\"\$thisdir/$objdir\" +" + fi + + $ECHO "\ + + if test -f \"\$progdir/\$program\"; then" + + # fixup the dll searchpath if we need to. + # + # Fix the DLL searchpath if we need to. Do this before prepending + # to shlibpath, because on Windows, both are PATH and uninstalled + # libraries must come first. + if test -n "$dllsearchpath"; then + $ECHO "\ + # Add the dll search path components to the executable PATH + PATH=$dllsearchpath:\$PATH +" + fi + + # Export our shlibpath_var if we have one. + if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then + $ECHO "\ + # Add our own library path to $shlibpath_var + $shlibpath_var=\"$temp_rpath\$$shlibpath_var\" + + # Some systems cannot cope with colon-terminated $shlibpath_var + # The second colon is a workaround for a bug in BeOS R4 sed + $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\` + + export $shlibpath_var +" + fi + + $ECHO "\ + if test \"\$libtool_execute_magic\" != \"$magic\"; then + # Run the actual program with our arguments. + func_exec_program \${1+\"\$@\"} + fi + else + # The program doesn't exist. + \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2 + \$ECHO \"This script is just a wrapper for \$program.\" 1>&2 + \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2 + exit 1 + fi +fi\ +" +} + + +# func_emit_cwrapperexe_src +# emit the source code for a wrapper executable on stdout +# Must ONLY be called from within func_mode_link because +# it depends on a number of variable set therein. +func_emit_cwrapperexe_src () +{ + cat < +#include +#ifdef _MSC_VER +# include +# include +# include +#else +# include +# include +# ifdef __CYGWIN__ +# include +# endif +#endif +#include +#include +#include +#include +#include +#include +#include +#include + +/* declarations of non-ANSI functions */ +#if defined(__MINGW32__) +# ifdef __STRICT_ANSI__ +int _putenv (const char *); +# endif +#elif defined(__CYGWIN__) +# ifdef __STRICT_ANSI__ +char *realpath (const char *, char *); +int putenv (char *); +int setenv (const char *, const char *, int); +# endif +/* #elif defined (other platforms) ... */ +#endif + +/* portability defines, excluding path handling macros */ +#if defined(_MSC_VER) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +# define S_IXUSR _S_IEXEC +# ifndef _INTPTR_T_DEFINED +# define _INTPTR_T_DEFINED +# define intptr_t int +# endif +#elif defined(__MINGW32__) +# define setmode _setmode +# define stat _stat +# define chmod _chmod +# define getcwd _getcwd +# define putenv _putenv +#elif defined(__CYGWIN__) +# define HAVE_SETENV +# define FOPEN_WB "wb" +/* #elif defined (other platforms) ... */ +#endif + +#if defined(PATH_MAX) +# define LT_PATHMAX PATH_MAX +#elif defined(MAXPATHLEN) +# define LT_PATHMAX MAXPATHLEN +#else +# define LT_PATHMAX 1024 +#endif + +#ifndef S_IXOTH +# define S_IXOTH 0 +#endif +#ifndef S_IXGRP +# define S_IXGRP 0 +#endif + +/* path handling portability macros */ +#ifndef DIR_SEPARATOR +# define DIR_SEPARATOR '/' +# define PATH_SEPARATOR ':' +#endif + +#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \ + defined (__OS2__) +# define HAVE_DOS_BASED_FILE_SYSTEM +# define FOPEN_WB "wb" +# ifndef DIR_SEPARATOR_2 +# define DIR_SEPARATOR_2 '\\' +# endif +# ifndef PATH_SEPARATOR_2 +# define PATH_SEPARATOR_2 ';' +# endif +#endif + +#ifndef DIR_SEPARATOR_2 +# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR) +#else /* DIR_SEPARATOR_2 */ +# define IS_DIR_SEPARATOR(ch) \ + (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2)) +#endif /* DIR_SEPARATOR_2 */ + +#ifndef PATH_SEPARATOR_2 +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR) +#else /* PATH_SEPARATOR_2 */ +# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2) +#endif /* PATH_SEPARATOR_2 */ + +#ifndef FOPEN_WB +# define FOPEN_WB "w" +#endif +#ifndef _O_BINARY +# define _O_BINARY 0 +#endif + +#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type))) +#define XFREE(stale) do { \ + if (stale) { free ((void *) stale); stale = 0; } \ +} while (0) + +#if defined(LT_DEBUGWRAPPER) +static int lt_debug = 1; +#else +static int lt_debug = 0; +#endif + +const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */ + +void *xmalloc (size_t num); +char *xstrdup (const char *string); +const char *base_name (const char *name); +char *find_executable (const char *wrapper); +char *chase_symlinks (const char *pathspec); +int make_executable (const char *path); +int check_executable (const char *path); +char *strendzap (char *str, const char *pat); +void lt_debugprintf (const char *file, int line, const char *fmt, ...); +void lt_fatal (const char *file, int line, const char *message, ...); +static const char *nonnull (const char *s); +static const char *nonempty (const char *s); +void lt_setenv (const char *name, const char *value); +char *lt_extend_str (const char *orig_value, const char *add, int to_end); +void lt_update_exe_path (const char *name, const char *value); +void lt_update_lib_path (const char *name, const char *value); +char **prepare_spawn (char **argv); +void lt_dump_script (FILE *f); +EOF + + cat <= 0) + && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH))) + return 1; + else + return 0; +} + +int +make_executable (const char *path) +{ + int rval = 0; + struct stat st; + + lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n", + nonempty (path)); + if ((!path) || (!*path)) + return 0; + + if (stat (path, &st) >= 0) + { + rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR); + } + return rval; +} + +/* Searches for the full path of the wrapper. Returns + newly allocated full path name if found, NULL otherwise + Does not chase symlinks, even on platforms that support them. +*/ +char * +find_executable (const char *wrapper) +{ + int has_slash = 0; + const char *p; + const char *p_next; + /* static buffer for getcwd */ + char tmp[LT_PATHMAX + 1]; + int tmp_len; + char *concat_name; + + lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n", + nonempty (wrapper)); + + if ((wrapper == NULL) || (*wrapper == '\0')) + return NULL; + + /* Absolute path? */ +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':') + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + else + { +#endif + if (IS_DIR_SEPARATOR (wrapper[0])) + { + concat_name = xstrdup (wrapper); + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } +#if defined (HAVE_DOS_BASED_FILE_SYSTEM) + } +#endif + + for (p = wrapper; *p; p++) + if (*p == '/') + { + has_slash = 1; + break; + } + if (!has_slash) + { + /* no slashes; search PATH */ + const char *path = getenv ("PATH"); + if (path != NULL) + { + for (p = path; *p; p = p_next) + { + const char *q; + size_t p_len; + for (q = p; *q; q++) + if (IS_PATH_SEPARATOR (*q)) + break; + p_len = q - p; + p_next = (*q == '\0' ? q : q + 1); + if (p_len == 0) + { + /* empty path: current directory */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = + XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + } + else + { + concat_name = + XMALLOC (char, p_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, p, p_len); + concat_name[p_len] = '/'; + strcpy (concat_name + p_len + 1, wrapper); + } + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + } + } + /* not found in PATH; assume curdir */ + } + /* Relative path | not found in path: prepend cwd */ + if (getcwd (tmp, LT_PATHMAX) == NULL) + lt_fatal (__FILE__, __LINE__, "getcwd failed: %s", + nonnull (strerror (errno))); + tmp_len = strlen (tmp); + concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1); + memcpy (concat_name, tmp, tmp_len); + concat_name[tmp_len] = '/'; + strcpy (concat_name + tmp_len + 1, wrapper); + + if (check_executable (concat_name)) + return concat_name; + XFREE (concat_name); + return NULL; +} + +char * +chase_symlinks (const char *pathspec) +{ +#ifndef S_ISLNK + return xstrdup (pathspec); +#else + char buf[LT_PATHMAX]; + struct stat s; + char *tmp_pathspec = xstrdup (pathspec); + char *p; + int has_symlinks = 0; + while (strlen (tmp_pathspec) && !has_symlinks) + { + lt_debugprintf (__FILE__, __LINE__, + "checking path component for symlinks: %s\n", + tmp_pathspec); + if (lstat (tmp_pathspec, &s) == 0) + { + if (S_ISLNK (s.st_mode) != 0) + { + has_symlinks = 1; + break; + } + + /* search backwards for last DIR_SEPARATOR */ + p = tmp_pathspec + strlen (tmp_pathspec) - 1; + while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + p--; + if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p))) + { + /* no more DIR_SEPARATORS left */ + break; + } + *p = '\0'; + } + else + { + lt_fatal (__FILE__, __LINE__, + "error accessing file \"%s\": %s", + tmp_pathspec, nonnull (strerror (errno))); + } + } + XFREE (tmp_pathspec); + + if (!has_symlinks) + { + return xstrdup (pathspec); + } + + tmp_pathspec = realpath (pathspec, buf); + if (tmp_pathspec == 0) + { + lt_fatal (__FILE__, __LINE__, + "could not follow symlinks for %s", pathspec); + } + return xstrdup (tmp_pathspec); +#endif +} + +char * +strendzap (char *str, const char *pat) +{ + size_t len, patlen; + + assert (str != NULL); + assert (pat != NULL); + + len = strlen (str); + patlen = strlen (pat); + + if (patlen <= len) + { + str += len - patlen; + if (strcmp (str, pat) == 0) + *str = '\0'; + } + return str; +} + +void +lt_debugprintf (const char *file, int line, const char *fmt, ...) +{ + va_list args; + if (lt_debug) + { + (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line); + va_start (args, fmt); + (void) vfprintf (stderr, fmt, args); + va_end (args); + } +} + +static void +lt_error_core (int exit_status, const char *file, + int line, const char *mode, + const char *message, va_list ap) +{ + fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode); + vfprintf (stderr, message, ap); + fprintf (stderr, ".\n"); + + if (exit_status >= 0) + exit (exit_status); +} + +void +lt_fatal (const char *file, int line, const char *message, ...) +{ + va_list ap; + va_start (ap, message); + lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap); + va_end (ap); +} + +static const char * +nonnull (const char *s) +{ + return s ? s : "(null)"; +} + +static const char * +nonempty (const char *s) +{ + return (s && !*s) ? "(empty)" : nonnull (s); +} + +void +lt_setenv (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_setenv) setting '%s' to '%s'\n", + nonnull (name), nonnull (value)); + { +#ifdef HAVE_SETENV + /* always make a copy, for consistency with !HAVE_SETENV */ + char *str = xstrdup (value); + setenv (name, str, 1); +#else + int len = strlen (name) + 1 + strlen (value) + 1; + char *str = XMALLOC (char, len); + sprintf (str, "%s=%s", name, value); + if (putenv (str) != EXIT_SUCCESS) + { + XFREE (str); + } +#endif + } +} + +char * +lt_extend_str (const char *orig_value, const char *add, int to_end) +{ + char *new_value; + if (orig_value && *orig_value) + { + int orig_value_len = strlen (orig_value); + int add_len = strlen (add); + new_value = XMALLOC (char, add_len + orig_value_len + 1); + if (to_end) + { + strcpy (new_value, orig_value); + strcpy (new_value + orig_value_len, add); + } + else + { + strcpy (new_value, add); + strcpy (new_value + add_len, orig_value); + } + } + else + { + new_value = xstrdup (add); + } + return new_value; +} + +void +lt_update_exe_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_exe_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + /* some systems can't cope with a ':'-terminated path #' */ + int len = strlen (new_value); + while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1])) + { + new_value[len-1] = '\0'; + } + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +void +lt_update_lib_path (const char *name, const char *value) +{ + lt_debugprintf (__FILE__, __LINE__, + "(lt_update_lib_path) modifying '%s' by prepending '%s'\n", + nonnull (name), nonnull (value)); + + if (name && *name && value && *value) + { + char *new_value = lt_extend_str (getenv (name), value, 0); + lt_setenv (name, new_value); + XFREE (new_value); + } +} + +EOF + case $host_os in + mingw*) + cat <<"EOF" + +/* Prepares an argument vector before calling spawn(). + Note that spawn() does not by itself call the command interpreter + (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") : + ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&v); + v.dwPlatformId == VER_PLATFORM_WIN32_NT; + }) ? "cmd.exe" : "command.com"). + Instead it simply concatenates the arguments, separated by ' ', and calls + CreateProcess(). We must quote the arguments since Win32 CreateProcess() + interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a + special way: + - Space and tab are interpreted as delimiters. They are not treated as + delimiters if they are surrounded by double quotes: "...". + - Unescaped double quotes are removed from the input. Their only effect is + that within double quotes, space and tab are treated like normal + characters. + - Backslashes not followed by double quotes are not special. + - But 2*n+1 backslashes followed by a double quote become + n backslashes followed by a double quote (n >= 0): + \" -> " + \\\" -> \" + \\\\\" -> \\" + */ +#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037" +char ** +prepare_spawn (char **argv) +{ + size_t argc; + char **new_argv; + size_t i; + + /* Count number of arguments. */ + for (argc = 0; argv[argc] != NULL; argc++) + ; + + /* Allocate new argument vector. */ + new_argv = XMALLOC (char *, argc + 1); + + /* Put quoted arguments into the new argument vector. */ + for (i = 0; i < argc; i++) + { + const char *string = argv[i]; + + if (string[0] == '\0') + new_argv[i] = xstrdup ("\"\""); + else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL) + { + int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL); + size_t length; + unsigned int backslashes; + const char *s; + char *quoted_string; + char *p; + + length = 0; + backslashes = 0; + if (quote_around) + length++; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + length += backslashes + 1; + length++; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + length += backslashes + 1; + + quoted_string = XMALLOC (char, length + 1); + + p = quoted_string; + backslashes = 0; + if (quote_around) + *p++ = '"'; + for (s = string; *s != '\0'; s++) + { + char c = *s; + if (c == '"') + { + unsigned int j; + for (j = backslashes + 1; j > 0; j--) + *p++ = '\\'; + } + *p++ = c; + if (c == '\\') + backslashes++; + else + backslashes = 0; + } + if (quote_around) + { + unsigned int j; + for (j = backslashes; j > 0; j--) + *p++ = '\\'; + *p++ = '"'; + } + *p = '\0'; + + new_argv[i] = quoted_string; + } + else + new_argv[i] = (char *) string; + } + new_argv[argc] = NULL; + + return new_argv; +} +EOF + ;; + esac + + cat <<"EOF" +void lt_dump_script (FILE* f) +{ +EOF + func_emit_wrapper yes | + $SED -e 's/\([\\"]\)/\\\1/g' \ + -e 's/^/ fputs ("/' -e 's/$/\\n", f);/' + + cat <<"EOF" +} +EOF +} +# end: func_emit_cwrapperexe_src + +# func_win32_import_lib_p ARG +# True if ARG is an import lib, as indicated by $file_magic_cmd +func_win32_import_lib_p () +{ + $opt_debug + case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in + *import*) : ;; + *) false ;; + esac +} + +# func_mode_link arg... +func_mode_link () +{ + $opt_debug + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + # It is impossible to link a dll without this setting, and + # we shouldn't force the makefile maintainer to figure out + # which system we are compiling for in order to pass an extra + # flag for every libtool invocation. + # allow_undefined=no + + # FIXME: Unfortunately, there are problems with the above when trying + # to make a dll which has undefined symbols, in which case not + # even a static library is built. For now, we need to specify + # -no-undefined on the libtool link line when we can be certain + # that all symbols are satisfied, otherwise we get a static library. + allow_undefined=yes + ;; + *) + allow_undefined=yes + ;; + esac + libtool_args=$nonopt + base_compile="$nonopt $@" + compile_command=$nonopt + finalize_command=$nonopt + + compile_rpath= + finalize_rpath= + compile_shlibpath= + finalize_shlibpath= + convenience= + old_convenience= + deplibs= + old_deplibs= + compiler_flags= + linker_flags= + dllsearchpath= + lib_search_path=`pwd` + inst_prefix_dir= + new_inherited_linker_flags= + + avoid_version=no + bindir= + dlfiles= + dlprefiles= + dlself=no + export_dynamic=no + export_symbols= + export_symbols_regex= + generated= + libobjs= + ltlibs= + module=no + no_install=no + objs= + non_pic_objects= + precious_files_regex= + prefer_static_libs=no + preload=no + prev= + prevarg= + release= + rpath= + xrpath= + perm_rpath= + temp_rpath= + thread_safe=no + vinfo= + vinfo_number=no + weak_libs= + single_module="${wl}-single_module" + func_infer_tag $base_compile + + # We need to know -static, to get the right output filenames. + for arg + do + case $arg in + -shared) + test "$build_libtool_libs" != yes && \ + func_fatal_configuration "can not build a shared library" + build_old_libs=no + break + ;; + -all-static | -static | -static-libtool-libs) + case $arg in + -all-static) + if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then + func_warning "complete static linking is impossible in this configuration" + fi + if test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + -static) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=built + ;; + -static-libtool-libs) + if test -z "$pic_flag" && test -n "$link_static_flag"; then + dlopen_self=$dlopen_self_static + fi + prefer_static_libs=yes + ;; + esac + build_libtool_libs=no + build_old_libs=yes + break + ;; + esac + done + + # See if our shared archives depend on static archives. + test -n "$old_archive_from_new_cmds" && build_old_libs=yes + + # Go through the arguments, transforming them on the way. + while test "$#" -gt 0; do + arg="$1" + shift + func_quote_for_eval "$arg" + qarg=$func_quote_for_eval_unquoted_result + func_append libtool_args " $func_quote_for_eval_result" + + # If the previous option needs an argument, assign it. + if test -n "$prev"; then + case $prev in + output) + func_append compile_command " @OUTPUT@" + func_append finalize_command " @OUTPUT@" + ;; + esac + + case $prev in + bindir) + bindir="$arg" + prev= + continue + ;; + dlfiles|dlprefiles) + if test "$preload" = no; then + # Add the symbol object into the linking commands. + func_append compile_command " @SYMFILE@" + func_append finalize_command " @SYMFILE@" + preload=yes + fi + case $arg in + *.la | *.lo) ;; # We handle these cases below. + force) + if test "$dlself" = no; then + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + self) + if test "$prev" = dlprefiles; then + dlself=yes + elif test "$prev" = dlfiles && test "$dlopen_self" != yes; then + dlself=yes + else + dlself=needless + export_dynamic=yes + fi + prev= + continue + ;; + *) + if test "$prev" = dlfiles; then + func_append dlfiles " $arg" + else + func_append dlprefiles " $arg" + fi + prev= + continue + ;; + esac + ;; + expsyms) + export_symbols="$arg" + test -f "$arg" \ + || func_fatal_error "symbol file \`$arg' does not exist" + prev= + continue + ;; + expsyms_regex) + export_symbols_regex="$arg" + prev= + continue + ;; + framework) + case $host in + *-*-darwin*) + case "$deplibs " in + *" $qarg.ltframework "*) ;; + *) func_append deplibs " $qarg.ltframework" # this is fixed later + ;; + esac + ;; + esac + prev= + continue + ;; + inst_prefix) + inst_prefix_dir="$arg" + prev= + continue + ;; + objectlist) + if test -f "$arg"; then + save_arg=$arg + moreargs= + for fil in `cat "$save_arg"` + do +# func_append moreargs " $fil" + arg=$fil + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + done + else + func_fatal_error "link input file \`$arg' does not exist" + fi + arg=$save_arg + prev= + continue + ;; + precious_regex) + precious_files_regex="$arg" + prev= + continue + ;; + release) + release="-$arg" + prev= + continue + ;; + rpath | xrpath) + # We need an absolute path. + case $arg in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + if test "$prev" = rpath; then + case "$rpath " in + *" $arg "*) ;; + *) func_append rpath " $arg" ;; + esac + else + case "$xrpath " in + *" $arg "*) ;; + *) func_append xrpath " $arg" ;; + esac + fi + prev= + continue + ;; + shrext) + shrext_cmds="$arg" + prev= + continue + ;; + weak) + func_append weak_libs " $arg" + prev= + continue + ;; + xcclinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xcompiler) + func_append compiler_flags " $qarg" + prev= + func_append compile_command " $qarg" + func_append finalize_command " $qarg" + continue + ;; + xlinker) + func_append linker_flags " $qarg" + func_append compiler_flags " $wl$qarg" + prev= + func_append compile_command " $wl$qarg" + func_append finalize_command " $wl$qarg" + continue + ;; + *) + eval "$prev=\"\$arg\"" + prev= + continue + ;; + esac + fi # test -n "$prev" + + prevarg="$arg" + + case $arg in + -all-static) + if test -n "$link_static_flag"; then + # See comment for -static flag below, for more details. + func_append compile_command " $link_static_flag" + func_append finalize_command " $link_static_flag" + fi + continue + ;; + + -allow-undefined) + # FIXME: remove this flag sometime in the future. + func_fatal_error "\`-allow-undefined' must not be used because it is the default" + ;; + + -avoid-version) + avoid_version=yes + continue + ;; + + -bindir) + prev=bindir + continue + ;; + + -dlopen) + prev=dlfiles + continue + ;; + + -dlpreopen) + prev=dlprefiles + continue + ;; + + -export-dynamic) + export_dynamic=yes + continue + ;; + + -export-symbols | -export-symbols-regex) + if test -n "$export_symbols" || test -n "$export_symbols_regex"; then + func_fatal_error "more than one -exported-symbols argument is not allowed" + fi + if test "X$arg" = "X-export-symbols"; then + prev=expsyms + else + prev=expsyms_regex + fi + continue + ;; + + -framework) + prev=framework + continue + ;; + + -inst-prefix-dir) + prev=inst_prefix + continue + ;; + + # The native IRIX linker understands -LANG:*, -LIST:* and -LNO:* + # so, if we see these flags be careful not to treat them like -L + -L[A-Z][A-Z]*:*) + case $with_gcc/$host in + no/*-*-irix* | /*-*-irix*) + func_append compile_command " $arg" + func_append finalize_command " $arg" + ;; + esac + continue + ;; + + -L*) + func_stripname "-L" '' "$arg" + if test -z "$func_stripname_result"; then + if test "$#" -gt 0; then + func_fatal_error "require no space between \`-L' and \`$1'" + else + func_fatal_error "need path for \`-L' option" + fi + fi + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + *) + absdir=`cd "$dir" && pwd` + test -z "$absdir" && \ + func_fatal_error "cannot determine absolute directory name of \`$dir'" + dir="$absdir" + ;; + esac + case "$deplibs " in + *" -L$dir "* | *" $arg "*) + # Will only happen for absolute or sysroot arguments + ;; + *) + # Preserve sysroot, but never include relative directories + case $dir in + [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;; + *) func_append deplibs " -L$dir" ;; + esac + func_append lib_search_path " $dir" + ;; + esac + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$dir:"*) ;; + ::) dllsearchpath=$dir;; + *) func_append dllsearchpath ":$dir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + continue + ;; + + -l*) + if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*) + # These systems don't actually have a C or math library (as such) + continue + ;; + *-*-os2*) + # These systems don't actually have a C library (as such) + test "X$arg" = "X-lc" && continue + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + test "X$arg" = "X-lc" && continue + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C and math libraries are in the System framework + func_append deplibs " System.ltframework" + continue + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + test "X$arg" = "X-lc" && continue + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + test "X$arg" = "X-lc" && continue + ;; + esac + elif test "X$arg" = "X-lc_r"; then + case $host in + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc_r directly, use -pthread flag. + continue + ;; + esac + fi + func_append deplibs " $arg" + continue + ;; + + -module) + module=yes + continue + ;; + + # Tru64 UNIX uses -model [arg] to determine the layout of C++ + # classes, name mangling, and exception handling. + # Darwin uses the -arch flag to determine output architecture. + -model|-arch|-isysroot|--sysroot) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + prev=xcompiler + continue + ;; + + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + func_append compiler_flags " $arg" + func_append compile_command " $arg" + func_append finalize_command " $arg" + case "$new_inherited_linker_flags " in + *" $arg "*) ;; + * ) func_append new_inherited_linker_flags " $arg" ;; + esac + continue + ;; + + -multi_module) + single_module="${wl}-multi_module" + continue + ;; + + -no-fast-install) + fast_install=no + continue + ;; + + -no-install) + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*) + # The PATH hackery in wrapper scripts is required on Windows + # and Darwin in order for the loader to find any dlls it needs. + func_warning "\`-no-install' is ignored for $host" + func_warning "assuming \`-no-fast-install' instead" + fast_install=no + ;; + *) no_install=yes ;; + esac + continue + ;; + + -no-undefined) + allow_undefined=no + continue + ;; + + -objectlist) + prev=objectlist + continue + ;; + + -o) prev=output ;; + + -precious-files-regex) + prev=precious_regex + continue + ;; + + -release) + prev=release + continue + ;; + + -rpath) + prev=rpath + continue + ;; + + -R) + prev=xrpath + continue + ;; + + -R*) + func_stripname '-R' '' "$arg" + dir=$func_stripname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) ;; + =*) + func_stripname '=' '' "$dir" + dir=$lt_sysroot$func_stripname_result + ;; + *) + func_fatal_error "only absolute run-paths are allowed" + ;; + esac + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + continue + ;; + + -shared) + # The effects of -shared are defined in a previous loop. + continue + ;; + + -shrext) + prev=shrext + continue + ;; + + -static | -static-libtool-libs) + # The effects of -static are defined in a previous loop. + # We used to do the same as -all-static on platforms that + # didn't have a PIC flag, but the assumption that the effects + # would be equivalent was wrong. It would break on at least + # Digital Unix and AIX. + continue + ;; + + -thread-safe) + thread_safe=yes + continue + ;; + + -version-info) + prev=vinfo + continue + ;; + + -version-number) + prev=vinfo + vinfo_number=yes + continue + ;; + + -weak) + prev=weak + continue + ;; + + -Wc,*) + func_stripname '-Wc,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + func_append arg " $func_quote_for_eval_result" + func_append compiler_flags " $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Wl,*) + func_stripname '-Wl,' '' "$arg" + args=$func_stripname_result + arg= + save_ifs="$IFS"; IFS=',' + for flag in $args; do + IFS="$save_ifs" + func_quote_for_eval "$flag" + func_append arg " $wl$func_quote_for_eval_result" + func_append compiler_flags " $wl$func_quote_for_eval_result" + func_append linker_flags " $func_quote_for_eval_result" + done + IFS="$save_ifs" + func_stripname ' ' '' "$arg" + arg=$func_stripname_result + ;; + + -Xcompiler) + prev=xcompiler + continue + ;; + + -Xlinker) + prev=xlinker + continue + ;; + + -XCClinker) + prev=xcclinker + continue + ;; + + # -msg_* for osf cc + -msg_*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + # Flags to be passed through unchanged, with rationale: + # -64, -mips[0-9] enable 64-bit mode for the SGI compiler + # -r[0-9][0-9]* specify processor for the SGI compiler + # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler + # +DA*, +DD* enable 64-bit mode for the HP compiler + # -q* compiler args for the IBM compiler + # -m*, -t[45]*, -txscale* architecture-specific flags for GCC + # -F/path path to uninstalled frameworks, gcc on darwin + # -p, -pg, --coverage, -fprofile-* profiling flags for GCC + # @file GCC response files + # -tp=* Portland pgcc target processor selection + # --sysroot=* for sysroot support + # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization + -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \ + -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \ + -O*|-flto*|-fwhopr*|-fuse-linker-plugin) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + func_append compile_command " $arg" + func_append finalize_command " $arg" + func_append compiler_flags " $arg" + continue + ;; + + # Some other compiler flag. + -* | +*) + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + + *.$objext) + # A standard object. + func_append objs " $arg" + ;; + + *.lo) + # A libtool-controlled object. + + # Check to see that this really is a libtool object. + if func_lalib_unsafe_p "$arg"; then + pic_object= + non_pic_object= + + # Read the .lo file + func_source "$arg" + + if test -z "$pic_object" || + test -z "$non_pic_object" || + test "$pic_object" = none && + test "$non_pic_object" = none; then + func_fatal_error "cannot find name of object for \`$arg'" + fi + + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + if test "$pic_object" != none; then + # Prepend the subdirectory the object is found in. + pic_object="$xdir$pic_object" + + if test "$prev" = dlfiles; then + if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then + func_append dlfiles " $pic_object" + prev= + continue + else + # If libtool objects are unsupported, then we need to preload. + prev=dlprefiles + fi + fi + + # CHECK ME: I think I busted this. -Ossama + if test "$prev" = dlprefiles; then + # Preload the old-style object. + func_append dlprefiles " $pic_object" + prev= + fi + + # A PIC object. + func_append libobjs " $pic_object" + arg="$pic_object" + fi + + # Non-PIC object. + if test "$non_pic_object" != none; then + # Prepend the subdirectory the object is found in. + non_pic_object="$xdir$non_pic_object" + + # A standard non-PIC object + func_append non_pic_objects " $non_pic_object" + if test -z "$pic_object" || test "$pic_object" = none ; then + arg="$non_pic_object" + fi + else + # If the PIC object exists, use it instead. + # $xdir was prepended to $pic_object above. + non_pic_object="$pic_object" + func_append non_pic_objects " $non_pic_object" + fi + else + # Only an error if not doing a dry-run. + if $opt_dry_run; then + # Extract subdirectory from the argument. + func_dirname "$arg" "/" "" + xdir="$func_dirname_result" + + func_lo2o "$arg" + pic_object=$xdir$objdir/$func_lo2o_result + non_pic_object=$xdir$func_lo2o_result + func_append libobjs " $pic_object" + func_append non_pic_objects " $non_pic_object" + else + func_fatal_error "\`$arg' is not a valid libtool object" + fi + fi + ;; + + *.$libext) + # An archive. + func_append deplibs " $arg" + func_append old_deplibs " $arg" + continue + ;; + + *.la) + # A libtool-controlled library. + + func_resolve_sysroot "$arg" + if test "$prev" = dlfiles; then + # This library was specified with -dlopen. + func_append dlfiles " $func_resolve_sysroot_result" + prev= + elif test "$prev" = dlprefiles; then + # The library was specified with -dlpreopen. + func_append dlprefiles " $func_resolve_sysroot_result" + prev= + else + func_append deplibs " $func_resolve_sysroot_result" + fi + continue + ;; + + # Some other compiler argument. + *) + # Unknown arguments in both finalize_command and compile_command need + # to be aesthetically quoted because they are evaled later. + func_quote_for_eval "$arg" + arg="$func_quote_for_eval_result" + ;; + esac # arg + + # Now actually substitute the argument into the commands. + if test -n "$arg"; then + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + done # argument parsing loop + + test -n "$prev" && \ + func_fatal_help "the \`$prevarg' option requires an argument" + + if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then + eval arg=\"$export_dynamic_flag_spec\" + func_append compile_command " $arg" + func_append finalize_command " $arg" + fi + + oldlibs= + # calculate the name of the file, without its directory + func_basename "$output" + outputname="$func_basename_result" + libobjs_save="$libobjs" + + if test -n "$shlibpath_var"; then + # get the directories listed in $shlibpath_var + eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\` + else + shlib_search_path= + fi + eval sys_lib_search_path=\"$sys_lib_search_path_spec\" + eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\" + + func_dirname "$output" "/" "" + output_objdir="$func_dirname_result$objdir" + func_to_tool_file "$output_objdir/" + tool_output_objdir=$func_to_tool_file_result + # Create the object directory. + func_mkdir_p "$output_objdir" + + # Determine the type of output + case $output in + "") + func_fatal_help "you must specify an output file" + ;; + *.$libext) linkmode=oldlib ;; + *.lo | *.$objext) linkmode=obj ;; + *.la) linkmode=lib ;; + *) linkmode=prog ;; # Anything else should be a program. + esac + + specialdeplibs= + + libs= + # Find all interdependent deplibs by searching for libraries + # that are linked more than once (e.g. -la -lb -la) + for deplib in $deplibs; do + if $opt_preserve_dup_deps ; then + case "$libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append libs " $deplib" + done + + if test "$linkmode" = lib; then + libs="$predeps $libs $compiler_lib_search_path $postdeps" + + # Compute libraries that are listed more than once in $predeps + # $postdeps and mark them as special (i.e., whose duplicates are + # not to be eliminated). + pre_post_deps= + if $opt_duplicate_compiler_generated_deps; then + for pre_post_dep in $predeps $postdeps; do + case "$pre_post_deps " in + *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;; + esac + func_append pre_post_deps " $pre_post_dep" + done + fi + pre_post_deps= + fi + + deplibs= + newdependency_libs= + newlib_search_path= + need_relink=no # whether we're linking any uninstalled libtool libraries + notinst_deplibs= # not-installed libtool libraries + notinst_path= # paths that contain not-installed libtool libraries + + case $linkmode in + lib) + passes="conv dlpreopen link" + for file in $dlfiles $dlprefiles; do + case $file in + *.la) ;; + *) + func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file" + ;; + esac + done + ;; + prog) + compile_deplibs= + finalize_deplibs= + alldeplibs=no + newdlfiles= + newdlprefiles= + passes="conv scan dlopen dlpreopen link" + ;; + *) passes="conv" + ;; + esac + + for pass in $passes; do + # The preopen pass in lib mode reverses $deplibs; put it back here + # so that -L comes before libs that need it for instance... + if test "$linkmode,$pass" = "lib,link"; then + ## FIXME: Find the place where the list is rebuilt in the wrong + ## order, and fix it there properly + tmp_deplibs= + for deplib in $deplibs; do + tmp_deplibs="$deplib $tmp_deplibs" + done + deplibs="$tmp_deplibs" + fi + + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan"; then + libs="$deplibs" + deplibs= + fi + if test "$linkmode" = prog; then + case $pass in + dlopen) libs="$dlfiles" ;; + dlpreopen) libs="$dlprefiles" ;; + link) libs="$deplibs %DEPLIBS% $dependency_libs" ;; + esac + fi + if test "$linkmode,$pass" = "lib,dlpreopen"; then + # Collect and forward deplibs of preopened libtool libs + for lib in $dlprefiles; do + # Ignore non-libtool-libs + dependency_libs= + func_resolve_sysroot "$lib" + case $lib in + *.la) func_source "$func_resolve_sysroot_result" ;; + esac + + # Collect preopened libtool deplibs, except any this library + # has declared as weak libs + for deplib in $dependency_libs; do + func_basename "$deplib" + deplib_base=$func_basename_result + case " $weak_libs " in + *" $deplib_base "*) ;; + *) func_append deplibs " $deplib" ;; + esac + done + done + libs="$dlprefiles" + fi + if test "$pass" = dlopen; then + # Collect dlpreopened libraries + save_deplibs="$deplibs" + deplibs= + fi + + for deplib in $libs; do + lib= + found=no + case $deplib in + -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append compiler_flags " $deplib" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -l*) + if test "$linkmode" != lib && test "$linkmode" != prog; then + func_warning "\`-l' is ignored for archives/objects" + continue + fi + func_stripname '-l' '' "$deplib" + name=$func_stripname_result + if test "$linkmode" = lib; then + searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path" + else + searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path" + fi + for searchdir in $searchdirs; do + for search_ext in .la $std_shrext .so .a; do + # Search the libtool library + lib="$searchdir/lib${name}${search_ext}" + if test -f "$lib"; then + if test "$search_ext" = ".la"; then + found=yes + else + found=no + fi + break 2 + fi + done + done + if test "$found" != yes; then + # deplib doesn't seem to be a libtool library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + else # deplib is a libtool library + # If $allow_libtool_libs_with_static_runtimes && $deplib is a stdlib, + # We need to do some special things here, and not later. + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $deplib "*) + if func_lalib_p "$lib"; then + library_names= + old_library= + func_source "$lib" + for l in $old_library $library_names; do + ll="$l" + done + if test "X$ll" = "X$old_library" ; then # only static version available + found=no + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + lib=$ladir/$old_library + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + test "$linkmode" = lib && newdependency_libs="$deplib $newdependency_libs" + fi + continue + fi + fi + ;; + *) ;; + esac + fi + fi + ;; # -l + *.ltframework) + if test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + deplibs="$deplib $deplibs" + if test "$linkmode" = lib ; then + case "$new_inherited_linker_flags " in + *" $deplib "*) ;; + * ) func_append new_inherited_linker_flags " $deplib" ;; + esac + fi + fi + continue + ;; + -L*) + case $linkmode in + lib) + deplibs="$deplib $deplibs" + test "$pass" = conv && continue + newdependency_libs="$deplib $newdependency_libs" + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + prog) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + if test "$pass" = scan; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + *) + func_warning "\`-L' is ignored for archives/objects" + ;; + esac # linkmode + continue + ;; # -L + -R*) + if test "$pass" = link; then + func_stripname '-R' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + dir=$func_resolve_sysroot_result + # Make sure the xrpath contains only unique directories. + case "$xrpath " in + *" $dir "*) ;; + *) func_append xrpath " $dir" ;; + esac + fi + deplibs="$deplib $deplibs" + continue + ;; + *.la) + func_resolve_sysroot "$deplib" + lib=$func_resolve_sysroot_result + ;; + *.$libext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + continue + fi + case $linkmode in + lib) + # Linking convenience modules into shared libraries is allowed, + # but linking other static libraries is non-portable. + case " $dlpreconveniencelibs " in + *" $deplib "*) ;; + *) + valid_a_lib=no + case $deplibs_check_method in + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \ + | $EGREP "$match_pattern_regex" > /dev/null; then + valid_a_lib=yes + fi + ;; + pass_all) + valid_a_lib=yes + ;; + esac + if test "$valid_a_lib" != yes; then + echo + $ECHO "*** Warning: Trying to link with static lib archive $deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because the file extensions .$libext of this argument makes me believe" + echo "*** that it is just a static archive that I should not use here." + else + echo + $ECHO "*** Warning: Linking the shared library $output against the" + $ECHO "*** static library $deplib is not portable!" + deplibs="$deplib $deplibs" + fi + ;; + esac + continue + ;; + prog) + if test "$pass" != link; then + deplibs="$deplib $deplibs" + else + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + fi + continue + ;; + esac # linkmode + ;; # *.$libext + *.lo | *.$objext) + if test "$pass" = conv; then + deplibs="$deplib $deplibs" + elif test "$linkmode" = prog; then + if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then + # If there is no dlopen support or we're linking statically, + # we need to preload. + func_append newdlprefiles " $deplib" + compile_deplibs="$deplib $compile_deplibs" + finalize_deplibs="$deplib $finalize_deplibs" + else + func_append newdlfiles " $deplib" + fi + fi + continue + ;; + %DEPLIBS%) + alldeplibs=yes + continue + ;; + esac # case $deplib + + if test "$found" = yes || test -f "$lib"; then : + else + func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'" + fi + + # Check to see that this really is a libtool archive. + func_lalib_unsafe_p "$lib" \ + || func_fatal_error "\`$lib' is not a valid libtool archive" + + func_dirname "$lib" "" "." + ladir="$func_dirname_result" + + dlname= + dlopen= + dlpreopen= + libdir= + library_names= + old_library= + inherited_linker_flags= + # If the library was installed with an old release of libtool, + # it will not redefine variables installed, or shouldnotlink + installed=yes + shouldnotlink=no + avoidtemprpath= + + + # Read the .la file + func_source "$lib" + + # Convert "-framework foo" to "foo.ltframework" + if test -n "$inherited_linker_flags"; then + tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'` + for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do + case " $new_inherited_linker_flags " in + *" $tmp_inherited_linker_flag "*) ;; + *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";; + esac + done + fi + dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + if test "$linkmode,$pass" = "lib,link" || + test "$linkmode,$pass" = "prog,scan" || + { test "$linkmode" != prog && test "$linkmode" != lib; }; then + test -n "$dlopen" && func_append dlfiles " $dlopen" + test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen" + fi + + if test "$pass" = conv; then + # Only check for convenience libraries + deplibs="$lib $deplibs" + if test -z "$libdir"; then + if test -z "$old_library"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + # It is a libtool convenience library, so add in its objects. + func_append convenience " $ladir/$objdir/$old_library" + func_append old_convenience " $ladir/$objdir/$old_library" + elif test "$linkmode" != prog && test "$linkmode" != lib; then + func_fatal_error "\`$lib' is not a convenience library" + fi + tmp_libs= + for deplib in $dependency_libs; do + deplibs="$deplib $deplibs" + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done + continue + fi # $pass = conv + + + # Get the name of the library we link against. + linklib= + if test -n "$old_library" && + { test "$prefer_static_libs" = yes || + test "$prefer_static_libs,$installed" = "built,no"; }; then + linklib=$old_library + else + for l in $old_library $library_names; do + linklib="$l" + done + fi + if test -z "$linklib"; then + func_fatal_error "cannot find name of link library for \`$lib'" + fi + + # This library was specified with -dlopen. + if test "$pass" = dlopen; then + if test -z "$libdir"; then + func_fatal_error "cannot -dlopen a convenience library: \`$lib'" + fi + if test -z "$dlname" || + test "$dlopen_support" != yes || + test "$build_libtool_libs" = no; then + # If there is no dlname, no dlopen support or we're linking + # statically, we need to preload. We also need to preload any + # dependent libraries so libltdl's deplib preloader doesn't + # bomb out in the load deplibs phase. + func_append dlprefiles " $lib $dependency_libs" + else + func_append newdlfiles " $lib" + fi + continue + fi # $pass = dlopen + + # We need an absolute path. + case $ladir in + [\\/]* | [A-Za-z]:[\\/]*) abs_ladir="$ladir" ;; + *) + abs_ladir=`cd "$ladir" && pwd` + if test -z "$abs_ladir"; then + func_warning "cannot determine absolute directory name of \`$ladir'" + func_warning "passing it literally to the linker, although it might fail" + abs_ladir="$ladir" + fi + ;; + esac + func_basename "$lib" + laname="$func_basename_result" + + # Find the relevant object directory and library name. + if test "X$installed" = Xyes; then + if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then + func_warning "library \`$lib' was moved." + dir="$ladir" + absdir="$abs_ladir" + libdir="$abs_ladir" + else + dir="$lt_sysroot$libdir" + absdir="$lt_sysroot$libdir" + fi + test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes + else + if test ! -f "$ladir/$objdir/$linklib" && test -f "$abs_ladir/$linklib"; then + dir="$ladir" + absdir="$abs_ladir" + # Remove this search path later + func_append notinst_path " $abs_ladir" + else + dir="$ladir/$objdir" + absdir="$abs_ladir/$objdir" + # Remove this search path later + func_append notinst_path " $abs_ladir" + fi + fi # $installed = yes + func_stripname 'lib' '.la' "$laname" + name=$func_stripname_result + + # This library was specified with -dlpreopen. + if test "$pass" = dlpreopen; then + if test -z "$libdir" && test "$linkmode" = prog; then + func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'" + fi + case "$host" in + # special handling for platforms with PE-DLLs. + *cygwin* | *mingw* | *cegcc* ) + # Linker will automatically link against shared library if both + # static and shared are present. Therefore, ensure we extract + # symbols from the import library if a shared library is present + # (otherwise, the dlopen module name will be incorrect). We do + # this by putting the import library name into $newdlprefiles. + # We recover the dlopen module name by 'saving' the la file + # name in a special purpose variable, and (later) extracting the + # dlname from the la file. + if test -n "$dlname"; then + func_tr_sh "$dir/$linklib" + eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname" + func_append newdlprefiles " $dir/$linklib" + else + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + fi + ;; + * ) + # Prefer using a static library (so that no silly _DYNAMIC symbols + # are required to link). + if test -n "$old_library"; then + func_append newdlprefiles " $dir/$old_library" + # Keep a list of preopened convenience libraries to check + # that they are being used correctly in the link pass. + test -z "$libdir" && \ + func_append dlpreconveniencelibs " $dir/$old_library" + # Otherwise, use the dlname, so that lt_dlopen finds it. + elif test -n "$dlname"; then + func_append newdlprefiles " $dir/$dlname" + else + func_append newdlprefiles " $dir/$linklib" + fi + ;; + esac + fi # $pass = dlpreopen + + if test -z "$libdir"; then + # Link the convenience library + if test "$linkmode" = lib; then + deplibs="$dir/$old_library $deplibs" + elif test "$linkmode,$pass" = "prog,link"; then + compile_deplibs="$dir/$old_library $compile_deplibs" + finalize_deplibs="$dir/$old_library $finalize_deplibs" + else + deplibs="$lib $deplibs" # used for prog,scan pass + fi + continue + fi + + + if test "$linkmode" = prog && test "$pass" != link; then + func_append newlib_search_path " $ladir" + deplibs="$lib $deplibs" + + linkalldeplibs=no + if test "$link_all_deplibs" != no || test -z "$library_names" || + test "$build_libtool_libs" = no; then + linkalldeplibs=yes + fi + + tmp_libs= + for deplib in $dependency_libs; do + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result" + func_append newlib_search_path " $func_resolve_sysroot_result" + ;; + esac + # Need to link against all dependency_libs? + if test "$linkalldeplibs" = yes; then + deplibs="$deplib $deplibs" + else + # Need to hardcode shared library paths + # or/and link against static libraries + newdependency_libs="$deplib $newdependency_libs" + fi + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $deplib "*) func_append specialdeplibs " $deplib" ;; + esac + fi + func_append tmp_libs " $deplib" + done # for deplib + continue + fi # $linkmode = prog... + + if test "$linkmode,$pass" = "prog,link"; then + if test -n "$library_names" && + { { test "$prefer_static_libs" = no || + test "$prefer_static_libs,$installed" = "built,yes"; } || + test -z "$old_library"; }; then + # We need to hardcode the library path + if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then + # Make sure the rpath contains only unique directories. + case "$temp_rpath:" in + *"$absdir:"*) ;; + *) func_append temp_rpath "$absdir:" ;; + esac + fi + + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi # $linkmode,$pass = prog,link... + + if test "$alldeplibs" = yes && + { test "$deplibs_check_method" = pass_all || + { test "$build_libtool_libs" = yes && + test -n "$library_names"; }; }; then + # We only need to search for static libraries + continue + fi + fi + + link_static=no # Whether the deplib will be linked statically + use_static_libs=$prefer_static_libs + if test "$use_static_libs" = built && test "$installed" = yes; then + use_static_libs=no + fi + if test -n "$library_names" && + { test "$use_static_libs" = no || test -z "$old_library"; }; then + case $host in + *cygwin* | *mingw* | *cegcc*) + # No point in relinking DLLs because paths are not encoded + func_append notinst_deplibs " $lib" + need_relink=no + ;; + *) + if test "$installed" = no; then + func_append notinst_deplibs " $lib" + need_relink=yes + fi + ;; + esac + # This is a shared library + + # Warn about portability, can't link against -module's on some + # systems (darwin). Don't bleat about dlopened modules though! + dlopenmodule="" + for dlpremoduletest in $dlprefiles; do + if test "X$dlpremoduletest" = "X$lib"; then + dlopenmodule="$dlpremoduletest" + break + fi + done + if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then + echo + if test "$linkmode" = prog; then + $ECHO "*** Warning: Linking the executable $output against the loadable module" + else + $ECHO "*** Warning: Linking the shared library $output against the loadable module" + fi + $ECHO "*** $linklib is not portable!" + fi + if test "$linkmode" = lib && + test "$hardcode_into_libs" = yes; then + # Hardcode the library path. + # Skip directories that are in the system default run-time + # search path. + case " $sys_lib_dlsearch_path " in + *" $absdir "*) ;; + *) + case "$compile_rpath " in + *" $absdir "*) ;; + *) func_append compile_rpath " $absdir" ;; + esac + ;; + esac + case " $sys_lib_dlsearch_path " in + *" $libdir "*) ;; + *) + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + ;; + esac + fi + + if test -n "$old_archive_from_expsyms_cmds"; then + # figure out the soname + set dummy $library_names + shift + realname="$1" + shift + libname=`eval "\\$ECHO \"$libname_spec\""` + # use dlname if we got it. it's perfectly good, no? + if test -n "$dlname"; then + soname="$dlname" + elif test -n "$soname_spec"; then + # bleh windows + case $host in + *cygwin* | mingw* | *cegcc*) + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + esac + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + + # Make a new name for the extract_expsyms_cmds to use + soroot="$soname" + func_basename "$soroot" + soname="$func_basename_result" + func_stripname 'lib' '.dll' "$soname" + newlib=libimp-$func_stripname_result.a + + # If the library has no export list, then create one now + if test -f "$output_objdir/$soname-def"; then : + else + func_verbose "extracting exported symbol list from \`$soname'" + func_execute_cmds "$extract_expsyms_cmds" 'exit $?' + fi + + # Create $newlib + if test -f "$output_objdir/$newlib"; then :; else + func_verbose "generating import library for \`$soname'" + func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?' + fi + # make sure the library variables are pointing to the new library + dir=$output_objdir + linklib=$newlib + fi # test -n "$old_archive_from_expsyms_cmds" + + if test "$linkmode" = prog || test "$opt_mode" != relink; then + add_shlibpath= + add_dir= + add= + lib_linked=yes + case $hardcode_action in + immediate | unsupported) + if test "$hardcode_direct" = no; then + add="$dir/$linklib" + case $host in + *-*-sco3.2v5.0.[024]*) add_dir="-L$dir" ;; + *-*-sysv4*uw2*) add_dir="-L$dir" ;; + *-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \ + *-*-unixware7*) add_dir="-L$dir" ;; + *-*-darwin* ) + # if the lib is a (non-dlopened) module then we can not + # link against it, someone is ignoring the earlier warnings + if /usr/bin/file -L $add 2> /dev/null | + $GREP ": [^:]* bundle" >/dev/null ; then + if test "X$dlopenmodule" != "X$lib"; then + $ECHO "*** Warning: lib $linklib is a module, not a shared library" + if test -z "$old_library" ; then + echo + echo "*** And there doesn't seem to be a static archive available" + echo "*** The link will probably fail, sorry" + else + add="$dir/$old_library" + fi + elif test -n "$old_library"; then + add="$dir/$old_library" + fi + fi + esac + elif test "$hardcode_minus_L" = no; then + case $host in + *-*-sunos*) add_shlibpath="$dir" ;; + esac + add_dir="-L$dir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = no; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + relink) + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$dir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$dir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + add_shlibpath="$dir" + add="-l$name" + else + lib_linked=no + fi + ;; + *) lib_linked=no ;; + esac + + if test "$lib_linked" != yes; then + func_fatal_configuration "unsupported hardcode properties" + fi + + if test -n "$add_shlibpath"; then + case :$compile_shlibpath: in + *":$add_shlibpath:"*) ;; + *) func_append compile_shlibpath "$add_shlibpath:" ;; + esac + fi + if test "$linkmode" = prog; then + test -n "$add_dir" && compile_deplibs="$add_dir $compile_deplibs" + test -n "$add" && compile_deplibs="$add $compile_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + if test "$hardcode_direct" != yes && + test "$hardcode_minus_L" != yes && + test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + fi + fi + fi + + if test "$linkmode" = prog || test "$opt_mode" = relink; then + add_shlibpath= + add_dir= + add= + # Finalize command for both is simple: just hardcode it. + if test "$hardcode_direct" = yes && + test "$hardcode_direct_absolute" = no; then + add="$libdir/$linklib" + elif test "$hardcode_minus_L" = yes; then + add_dir="-L$libdir" + add="-l$name" + elif test "$hardcode_shlibpath_var" = yes; then + case :$finalize_shlibpath: in + *":$libdir:"*) ;; + *) func_append finalize_shlibpath "$libdir:" ;; + esac + add="-l$name" + elif test "$hardcode_automatic" = yes; then + if test -n "$inst_prefix_dir" && + test -f "$inst_prefix_dir$libdir/$linklib" ; then + add="$inst_prefix_dir$libdir/$linklib" + else + add="$libdir/$linklib" + fi + else + # We cannot seem to hardcode it, guess we'll fake it. + add_dir="-L$libdir" + # Try looking first in the location we're being installed to. + if test -n "$inst_prefix_dir"; then + case $libdir in + [\\/]*) + func_append add_dir " -L$inst_prefix_dir$libdir" + ;; + esac + fi + add="-l$name" + fi + + if test "$linkmode" = prog; then + test -n "$add_dir" && finalize_deplibs="$add_dir $finalize_deplibs" + test -n "$add" && finalize_deplibs="$add $finalize_deplibs" + else + test -n "$add_dir" && deplibs="$add_dir $deplibs" + test -n "$add" && deplibs="$add $deplibs" + fi + fi + elif test "$linkmode" = prog; then + # Here we assume that one of hardcode_direct or hardcode_minus_L + # is not unsupported. This is valid on all known static and + # shared platforms. + if test "$hardcode_direct" != unsupported; then + test -n "$old_library" && linklib="$old_library" + compile_deplibs="$dir/$linklib $compile_deplibs" + finalize_deplibs="$dir/$linklib $finalize_deplibs" + else + compile_deplibs="-l$name -L$dir $compile_deplibs" + finalize_deplibs="-l$name -L$dir $finalize_deplibs" + fi + elif test "$build_libtool_libs" = yes; then + # Not a shared library + if test "$deplibs_check_method" != pass_all; then + # We're trying link a shared library against a static one + # but the system doesn't support it. + + # Just print a warning and add the library to dependency_libs so + # that the program can be linked against the static library. + echo + $ECHO "*** Warning: This system can not link to static lib archive $lib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have." + if test "$module" = yes; then + echo "*** But as you try to build a module library, libtool will still create " + echo "*** a static module, that should work as long as the dlopening application" + echo "*** is linked with the -dlopen flag to resolve symbols at runtime." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + else + deplibs="$dir/$old_library $deplibs" + link_static=yes + fi + fi # link shared/static library? + + if test "$linkmode" = lib; then + if test -n "$dependency_libs" && + { test "$hardcode_into_libs" != yes || + test "$build_old_libs" = yes || + test "$link_static" = yes; }; then + # Extract -R from dependency_libs + temp_deplibs= + for libdir in $dependency_libs; do + case $libdir in + -R*) func_stripname '-R' '' "$libdir" + temp_xrpath=$func_stripname_result + case " $xrpath " in + *" $temp_xrpath "*) ;; + *) func_append xrpath " $temp_xrpath";; + esac;; + *) func_append temp_deplibs " $libdir";; + esac + done + dependency_libs="$temp_deplibs" + fi + + func_append newlib_search_path " $absdir" + # Link against this library + test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs" + # ... and its dependency_libs + tmp_libs= + for deplib in $dependency_libs; do + newdependency_libs="$deplib $newdependency_libs" + case $deplib in + -L*) func_stripname '-L' '' "$deplib" + func_resolve_sysroot "$func_stripname_result";; + *) func_resolve_sysroot "$deplib" ;; + esac + if $opt_preserve_dup_deps ; then + case "$tmp_libs " in + *" $func_resolve_sysroot_result "*) + func_append specialdeplibs " $func_resolve_sysroot_result" ;; + esac + fi + func_append tmp_libs " $func_resolve_sysroot_result" + done + + if test "$link_all_deplibs" != no; then + # Add the search paths of all dependency libraries + for deplib in $dependency_libs; do + path= + case $deplib in + -L*) path="$deplib" ;; + *.la) + func_resolve_sysroot "$deplib" + deplib=$func_resolve_sysroot_result + func_dirname "$deplib" "" "." + dir=$func_dirname_result + # We need an absolute path. + case $dir in + [\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;; + *) + absdir=`cd "$dir" && pwd` + if test -z "$absdir"; then + func_warning "cannot determine absolute directory name of \`$dir'" + absdir="$dir" + fi + ;; + esac + if $GREP "^installed=no" $deplib > /dev/null; then + case $host in + *-*-darwin*) + depdepl= + eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib` + if test -n "$deplibrary_names" ; then + for tmp in $deplibrary_names ; do + depdepl=$tmp + done + if test -f "$absdir/$objdir/$depdepl" ; then + depdepl="$absdir/$objdir/$depdepl" + darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + if test -z "$darwin_install_name"; then + darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'` + fi + func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}" + func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}" + path= + fi + fi + ;; + *) + path="-L$absdir/$objdir" + ;; + esac + else + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + test "$absdir" != "$libdir" && \ + func_warning "\`$deplib' seems to be moved" + + path="-L$absdir" + fi + ;; + esac + case " $deplibs " in + *" $path "*) ;; + *) deplibs="$path $deplibs" ;; + esac + done + fi # link_all_deplibs != no + fi # linkmode = lib + done # for deplib in $libs + if test "$pass" = link; then + if test "$linkmode" = "prog"; then + compile_deplibs="$new_inherited_linker_flags $compile_deplibs" + finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs" + else + compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + fi + fi + dependency_libs="$newdependency_libs" + if test "$pass" = dlpreopen; then + # Link the dlpreopened libraries before other libraries + for deplib in $save_deplibs; do + deplibs="$deplib $deplibs" + done + fi + if test "$pass" != dlopen; then + if test "$pass" != conv; then + # Make sure lib_search_path contains only unique directories. + lib_search_path= + for dir in $newlib_search_path; do + case "$lib_search_path " in + *" $dir "*) ;; + *) func_append lib_search_path " $dir" ;; + esac + done + newlib_search_path= + fi + + if test "$linkmode,$pass" != "prog,link"; then + vars="deplibs" + else + vars="compile_deplibs finalize_deplibs" + fi + for var in $vars dependency_libs; do + # Add libraries to $var in reverse order + eval tmp_libs=\"\$$var\" + new_libs= + for deplib in $tmp_libs; do + # FIXME: Pedantically, this is the right thing to do, so + # that some nasty dependency loop isn't accidentally + # broken: + #new_libs="$deplib $new_libs" + # Pragmatically, this seems to cause very few problems in + # practice: + case $deplib in + -L*) new_libs="$deplib $new_libs" ;; + -R*) ;; + *) + # And here is the reason: when a library appears more + # than once as an explicit dependence of a library, or + # is implicitly linked in more than once by the + # compiler, it is considered special, and multiple + # occurrences thereof are not removed. Compare this + # with having the same library being listed as a + # dependency of multiple other libraries: in this case, + # we know (pedantically, we assume) the library does not + # need to be listed more than once, so we keep only the + # last copy. This is not always right, but it is rare + # enough that we require users that really mean to play + # such unportable linking tricks to link the library + # using -Wl,-lname, so that libtool does not consider it + # for duplicate removal. + case " $specialdeplibs " in + *" $deplib "*) new_libs="$deplib $new_libs" ;; + *) + case " $new_libs " in + *" $deplib "*) ;; + *) new_libs="$deplib $new_libs" ;; + esac + ;; + esac + ;; + esac + done + tmp_libs= + for deplib in $new_libs; do + case $deplib in + -L*) + case " $tmp_libs " in + *" $deplib "*) ;; + *) func_append tmp_libs " $deplib" ;; + esac + ;; + *) func_append tmp_libs " $deplib" ;; + esac + done + eval $var=\"$tmp_libs\" + done # for var + fi + # Last step: remove runtime libs from dependency_libs + # (they stay in deplibs) + tmp_libs= + for i in $dependency_libs ; do + case " $predeps $postdeps $compiler_lib_search_path " in + *" $i "*) + i="" + ;; + esac + if test -n "$i" ; then + func_append tmp_libs " $i" + fi + done + dependency_libs=$tmp_libs + done # for pass + if test "$linkmode" = prog; then + dlfiles="$newdlfiles" + fi + if test "$linkmode" = prog || test "$linkmode" = lib; then + dlprefiles="$newdlprefiles" + fi + + case $linkmode in + oldlib) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for archives" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for archives" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for archives" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for archives" + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for archives" + + test -n "$release" && \ + func_warning "\`-release' is ignored for archives" + + test -n "$export_symbols$export_symbols_regex" && \ + func_warning "\`-export-symbols' is ignored for archives" + + # Now set the variables for building old libraries. + build_libtool_libs=no + oldlibs="$output" + func_append objs "$old_deplibs" + ;; + + lib) + # Make sure we only generate libraries of the form `libNAME.la'. + case $outputname in + lib*) + func_stripname 'lib' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + ;; + *) + test "$module" = no && \ + func_fatal_help "libtool library \`$output' must begin with \`lib'" + + if test "$need_lib_prefix" != no; then + # Add the "lib" prefix for modules if required + func_stripname '' '.la' "$outputname" + name=$func_stripname_result + eval shared_ext=\"$shrext_cmds\" + eval libname=\"$libname_spec\" + else + func_stripname '' '.la' "$outputname" + libname=$func_stripname_result + fi + ;; + esac + + if test -n "$objs"; then + if test "$deplibs_check_method" != pass_all; then + func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs" + else + echo + $ECHO "*** Warning: Linking the shared library $output against the non-libtool" + $ECHO "*** objects $objs is not portable!" + func_append libobjs " $objs" + fi + fi + + test "$dlself" != no && \ + func_warning "\`-dlopen self' is ignored for libtool libraries" + + set dummy $rpath + shift + test "$#" -gt 1 && \ + func_warning "ignoring multiple \`-rpath's for a libtool library" + + install_libdir="$1" + + oldlibs= + if test -z "$rpath"; then + if test "$build_libtool_libs" = yes; then + # Building a libtool convenience library. + # Some compilers have problems with a `.al' extension so + # convenience libraries should have the same extension an + # archive normally would. + oldlibs="$output_objdir/$libname.$libext $oldlibs" + build_libtool_libs=convenience + build_old_libs=yes + fi + + test -n "$vinfo" && \ + func_warning "\`-version-info/-version-number' is ignored for convenience libraries" + + test -n "$release" && \ + func_warning "\`-release' is ignored for convenience libraries" + else + + # Parse the version information argument. + save_ifs="$IFS"; IFS=':' + set dummy $vinfo 0 0 0 + shift + IFS="$save_ifs" + + test -n "$7" && \ + func_fatal_help "too many parameters to \`-version-info'" + + # convert absolute version numbers to libtool ages + # this retains compatibility with .la files and attempts + # to make the code below a bit more comprehensible + + case $vinfo_number in + yes) + number_major="$1" + number_minor="$2" + number_revision="$3" + # + # There are really only two kinds -- those that + # use the current revision as the major version + # and those that subtract age and use age as + # a minor version. But, then there is irix + # which has an extra 1 added just for fun + # + case $version_type in + darwin|linux|osf|windows|none) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_revision" + ;; + freebsd-aout|freebsd-elf|qnx|sunos) + current="$number_major" + revision="$number_minor" + age="0" + ;; + irix|nonstopux) + func_arith $number_major + $number_minor + current=$func_arith_result + age="$number_minor" + revision="$number_minor" + lt_irix_increment=no + ;; + esac + ;; + no) + current="$1" + revision="$2" + age="$3" + ;; + esac + + # Check that each of the things are valid numbers. + case $current in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "CURRENT \`$current' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $revision in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "REVISION \`$revision' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + case $age in + 0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;; + *) + func_error "AGE \`$age' must be a nonnegative integer" + func_fatal_error "\`$vinfo' is not valid version information" + ;; + esac + + if test "$age" -gt "$current"; then + func_error "AGE \`$age' is greater than the current interface number \`$current'" + func_fatal_error "\`$vinfo' is not valid version information" + fi + + # Calculate the version variables. + major= + versuffix= + verstring= + case $version_type in + none) ;; + + darwin) + # Like Linux, but with the current version available in + # verstring for coding it into the library header + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + # Darwin ld doesn't like 0 for these options... + func_arith $current + 1 + minor_current=$func_arith_result + xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision" + verstring="-compatibility_version $minor_current -current_version $minor_current.$revision" + ;; + + freebsd-aout) + major=".$current" + versuffix=".$current.$revision"; + ;; + + freebsd-elf) + major=".$current" + versuffix=".$current" + ;; + + irix | nonstopux) + if test "X$lt_irix_increment" = "Xno"; then + func_arith $current - $age + else + func_arith $current - $age + 1 + fi + major=$func_arith_result + + case $version_type in + nonstopux) verstring_prefix=nonstopux ;; + *) verstring_prefix=sgi ;; + esac + verstring="$verstring_prefix$major.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$revision + while test "$loop" -ne 0; do + func_arith $revision - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring_prefix$major.$iface:$verstring" + done + + # Before this point, $major must not contain `.'. + major=.$major + versuffix="$major.$revision" + ;; + + linux) + func_arith $current - $age + major=.$func_arith_result + versuffix="$major.$age.$revision" + ;; + + osf) + func_arith $current - $age + major=.$func_arith_result + versuffix=".$current.$age.$revision" + verstring="$current.$age.$revision" + + # Add in all the interfaces that we are compatible with. + loop=$age + while test "$loop" -ne 0; do + func_arith $current - $loop + iface=$func_arith_result + func_arith $loop - 1 + loop=$func_arith_result + verstring="$verstring:${iface}.0" + done + + # Make executables depend on our current version. + func_append verstring ":${current}.0" + ;; + + qnx) + major=".$current" + versuffix=".$current" + ;; + + sunos) + major=".$current" + versuffix=".$current.$revision" + ;; + + windows) + # Use '-' rather than '.', since we only want one + # extension on DOS 8.3 filesystems. + func_arith $current - $age + major=$func_arith_result + versuffix="-$major" + ;; + + *) + func_fatal_configuration "unknown library version type \`$version_type'" + ;; + esac + + # Clear the version info if we defaulted, and they specified a release. + if test -z "$vinfo" && test -n "$release"; then + major= + case $version_type in + darwin) + # we can't check for "0.0" in archive_cmds due to quoting + # problems, so we reset it completely + verstring= + ;; + *) + verstring="0.0" + ;; + esac + if test "$need_version" = no; then + versuffix= + else + versuffix=".0.0" + fi + fi + + # Remove version info from name if versioning should be avoided + if test "$avoid_version" = yes && test "$need_version" = no; then + major= + versuffix= + verstring="" + fi + + # Check to see if the archive will have undefined symbols. + if test "$allow_undefined" = yes; then + if test "$allow_undefined_flag" = unsupported; then + func_warning "undefined symbols not allowed in $host shared libraries" + build_libtool_libs=no + build_old_libs=yes + fi + else + # Don't allow undefined symbols. + allow_undefined_flag="$no_undefined_flag" + fi + + fi + + func_generate_dlsyms "$libname" "$libname" "yes" + func_append libobjs " $symfileobj" + test "X$libobjs" = "X " && libobjs= + + if test "$opt_mode" != relink; then + # Remove our outputs, but don't remove object files since they + # may have been created when compiling PIC objects. + removelist= + tempremovelist=`$ECHO "$output_objdir/*"` + for p in $tempremovelist; do + case $p in + *.$objext | *.gcno) + ;; + $output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*) + if test "X$precious_files_regex" != "X"; then + if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1 + then + continue + fi + fi + func_append removelist " $p" + ;; + *) ;; + esac + done + test -n "$removelist" && \ + func_show_eval "${RM}r \$removelist" + fi + + # Now set the variables for building old libraries. + if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then + func_append oldlibs " $output_objdir/$libname.$libext" + + # Transform .lo files to .o files. + oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP` + fi + + # Eliminate all temporary directories. + #for path in $notinst_path; do + # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"` + # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"` + # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"` + #done + + if test -n "$xrpath"; then + # If the user specified any rpath flags, then add them. + temp_xrpath= + for libdir in $xrpath; do + func_replace_sysroot "$libdir" + func_append temp_xrpath " -R$func_replace_sysroot_result" + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then + dependency_libs="$temp_xrpath $dependency_libs" + fi + fi + + # Make sure dlfiles contains only unique files that won't be dlpreopened + old_dlfiles="$dlfiles" + dlfiles= + for lib in $old_dlfiles; do + case " $dlprefiles $dlfiles " in + *" $lib "*) ;; + *) func_append dlfiles " $lib" ;; + esac + done + + # Make sure dlprefiles contains only unique files + old_dlprefiles="$dlprefiles" + dlprefiles= + for lib in $old_dlprefiles; do + case "$dlprefiles " in + *" $lib "*) ;; + *) func_append dlprefiles " $lib" ;; + esac + done + + if test "$build_libtool_libs" = yes; then + if test -n "$rpath"; then + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*) + # these systems don't actually have a c library (as such)! + ;; + *-*-rhapsody* | *-*-darwin1.[012]) + # Rhapsody C library is in the System framework + func_append deplibs " System.ltframework" + ;; + *-*-netbsd*) + # Don't link with libc until the a.out ld.so is fixed. + ;; + *-*-openbsd* | *-*-freebsd* | *-*-dragonfly*) + # Do not include libc due to us having libc/libc_r. + ;; + *-*-sco3.2v5* | *-*-sco5v6*) + # Causes problems with __ctype + ;; + *-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*) + # Compiler inserts libc in the correct place for threads to work + ;; + *) + # Add libc to deplibs on all other systems if necessary. + if test "$build_libtool_need_lc" = "yes"; then + func_append deplibs " -lc" + fi + ;; + esac + fi + + # Transform deplibs into only deplibs that can be linked in shared. + name_save=$name + libname_save=$libname + release_save=$release + versuffix_save=$versuffix + major_save=$major + # I'm not sure if I'm treating the release correctly. I think + # release should show up in the -l (ie -lgmp5) so we don't want to + # add it in twice. Is that correct? + release="" + versuffix="" + major="" + newdeplibs= + droppeddeps=no + case $deplibs_check_method in + pass_all) + # Don't check for shared/static. Everything works. + # This might be a little naive. We might want to check + # whether the library exists or not. But this is on + # osf3 & osf4 and I'm not really sure... Just + # implementing what was already the behavior. + newdeplibs=$deplibs + ;; + test_compile) + # This code stresses the "libraries are programs" paradigm to its + # limits. Maybe even breaks it. We compile a program, linking it + # against the deplibs as a proxy for the library. Then we can check + # whether they linked in statically or dynamically with ldd. + $opt_dry_run || $RM conftest.c + cat > conftest.c </dev/null` + $nocaseglob + else + potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null` + fi + for potent_lib in $potential_libs; do + # Follow soft links. + if ls -lLd "$potent_lib" 2>/dev/null | + $GREP " -> " >/dev/null; then + continue + fi + # The statement above tries to avoid entering an + # endless loop below, in case of cyclic links. + # We might still enter an endless loop, since a link + # loop can be closed while we follow links, + # but so what? + potlib="$potent_lib" + while test -h "$potlib" 2>/dev/null; do + potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'` + case $potliblink in + [\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";; + *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";; + esac + done + if eval $file_magic_cmd \"\$potlib\" 2>/dev/null | + $SED -e 10q | + $EGREP "$file_magic_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for file magic test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a file magic. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + match_pattern*) + set dummy $deplibs_check_method; shift + match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"` + for a_deplib in $deplibs; do + case $a_deplib in + -l*) + func_stripname -l '' "$a_deplib" + name=$func_stripname_result + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + case " $predeps $postdeps " in + *" $a_deplib "*) + func_append newdeplibs " $a_deplib" + a_deplib="" + ;; + esac + fi + if test -n "$a_deplib" ; then + libname=`eval "\\$ECHO \"$libname_spec\""` + for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do + potential_libs=`ls $i/$libname[.-]* 2>/dev/null` + for potent_lib in $potential_libs; do + potlib="$potent_lib" # see symlink-check above in file_magic test + if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \ + $EGREP "$match_pattern_regex" > /dev/null; then + func_append newdeplibs " $a_deplib" + a_deplib="" + break 2 + fi + done + done + fi + if test -n "$a_deplib" ; then + droppeddeps=yes + echo + $ECHO "*** Warning: linker path does not have real file for library $a_deplib." + echo "*** I have the capability to make that library automatically link in when" + echo "*** you link to this library. But I can only do this if you have a" + echo "*** shared version of the library, which you do not appear to have" + echo "*** because I did check the linker path looking for a file starting" + if test -z "$potlib" ; then + $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)" + else + $ECHO "*** with $libname and none of the candidates passed a file format test" + $ECHO "*** using a regex pattern. Last file checked: $potlib" + fi + fi + ;; + *) + # Add a -L argument. + func_append newdeplibs " $a_deplib" + ;; + esac + done # Gone through all deplibs. + ;; + none | unknown | *) + newdeplibs="" + tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'` + if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then + for i in $predeps $postdeps ; do + # can't use Xsed below, because $i might contain '/' + tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"` + done + fi + case $tmp_deplibs in + *[!\ \ ]*) + echo + if test "X$deplibs_check_method" = "Xnone"; then + echo "*** Warning: inter-library dependencies are not supported in this platform." + else + echo "*** Warning: inter-library dependencies are not known to be supported." + fi + echo "*** All declared inter-library dependencies are being dropped." + droppeddeps=yes + ;; + esac + ;; + esac + versuffix=$versuffix_save + major=$major_save + release=$release_save + libname=$libname_save + name=$name_save + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library with the System framework + newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + if test "$droppeddeps" = yes; then + if test "$module" = yes; then + echo + echo "*** Warning: libtool could not satisfy all declared inter-library" + $ECHO "*** dependencies of module $libname. Therefore, libtool will create" + echo "*** a static module, that should work as long as the dlopening" + echo "*** application is linked with the -dlopen flag." + if test -z "$global_symbol_pipe"; then + echo + echo "*** However, this would only work if libtool was able to extract symbol" + echo "*** lists from a program, using \`nm' or equivalent, but libtool could" + echo "*** not find such a program. So, this module is probably useless." + echo "*** \`nm' from GNU binutils and a full rebuild may help." + fi + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + else + echo "*** The inter-library dependencies that have been dropped here will be" + echo "*** automatically added whenever a program is linked with this library" + echo "*** or is declared to -dlopen it." + + if test "$allow_undefined" = no; then + echo + echo "*** Since this library must not contain undefined symbols," + echo "*** because either the platform does not support them or" + echo "*** it was explicitly requested with -no-undefined," + echo "*** libtool will only create a static version of it." + if test "$build_old_libs" = no; then + oldlibs="$output_objdir/$libname.$libext" + build_libtool_libs=module + build_old_libs=yes + else + build_libtool_libs=no + fi + fi + fi + fi + # Done checking deplibs! + deplibs=$newdeplibs + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + case $host in + *-*-darwin*) + newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + deplibs="$new_libs" + + # All the library-specific variables (install_libdir is set above). + library_names= + old_library= + dlname= + + # Test again, we may have decided not to build it any more + if test "$build_libtool_libs" = yes; then + if test "$hardcode_into_libs" = yes; then + # Hardcode the library paths + hardcode_libdirs= + dep_rpath= + rpath="$finalize_rpath" + test "$opt_mode" != relink && rpath="$compile_rpath$rpath" + for libdir in $rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + func_replace_sysroot "$libdir" + libdir=$func_replace_sysroot_result + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append dep_rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_apped perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + if test -n "$hardcode_libdir_flag_spec_ld"; then + eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" + else + eval dep_rpath=\"$hardcode_libdir_flag_spec\" + fi + fi + if test -n "$runpath_var" && test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var" + fi + test -n "$dep_rpath" && deplibs="$dep_rpath $deplibs" + fi + + shlibpath="$finalize_shlibpath" + test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath" + if test -n "$shlibpath"; then + eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var" + fi + + # Get the real and link names of the library. + eval shared_ext=\"$shrext_cmds\" + eval library_names=\"$library_names_spec\" + set dummy $library_names + shift + realname="$1" + shift + + if test -n "$soname_spec"; then + eval soname=\"$soname_spec\" + else + soname="$realname" + fi + if test -z "$dlname"; then + dlname=$soname + fi + + lib="$output_objdir/$realname" + linknames= + for link + do + func_append linknames " $link" + done + + # Use standard objects if they are pic + test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP` + test "X$libobjs" = "X " && libobjs= + + delfiles= + if test -n "$export_symbols" && test -n "$include_expsyms"; then + $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp" + export_symbols="$output_objdir/$libname.uexp" + func_append delfiles " $export_symbols" + fi + + orig_export_symbols= + case $host_os in + cygwin* | mingw* | cegcc*) + if test -n "$export_symbols" && test -z "$export_symbols_regex"; then + # exporting using user supplied symfile + if test "x`$SED 1q $export_symbols`" != xEXPORTS; then + # and it's NOT already a .def file. Must figure out + # which of the given symbols are data symbols and tag + # them as such. So, trigger use of export_symbols_cmds. + # export_symbols gets reassigned inside the "prepare + # the list of exported symbols" if statement, so the + # include_expsyms logic still works. + orig_export_symbols="$export_symbols" + export_symbols= + always_export_symbols=yes + fi + fi + ;; + esac + + # Prepare the list of exported symbols + if test -z "$export_symbols"; then + if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + cmds=$export_symbols_cmds + save_ifs="$IFS"; IFS='~' + for cmd1 in $cmds; do + IFS="$save_ifs" + # Take the normal branch if the nm_file_list_spec branch + # doesn't work or if tool conversion is not needed. + case $nm_file_list_spec~$to_tool_file_cmd in + *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*) + try_normal_branch=yes + eval cmd=\"$cmd1\" + func_len " $cmd" + len=$func_len_result + ;; + *) + try_normal_branch=no + ;; + esac + if test "$try_normal_branch" = yes \ + && { test "$len" -lt "$max_cmd_len" \ + || test "$max_cmd_len" -le -1; } + then + func_show_eval "$cmd" 'exit $?' + skipped_export=false + elif test -n "$nm_file_list_spec"; then + func_basename "$output" + output_la=$func_basename_result + save_libobjs=$libobjs + save_output=$output + output=${output_objdir}/${output_la}.nm + func_to_tool_file "$output" + libobjs=$nm_file_list_spec$func_to_tool_file_result + func_append delfiles " $output" + func_verbose "creating $NM input file list: $output" + for obj in $save_libobjs; do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > "$output" + eval cmd=\"$cmd1\" + func_show_eval "$cmd" 'exit $?' + output=$save_output + libobjs=$save_libobjs + skipped_export=false + else + # The command line is too long to execute in one step. + func_verbose "using reloadable object file for export list..." + skipped_export=: + # Break out early, otherwise skipped_export may be + # set to false by a later but shorter cmd. + break + fi + done + IFS="$save_ifs" + if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + fi + + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + + tmp_deplibs= + for test_deplib in $deplibs; do + case " $convenience " in + *" $test_deplib "*) ;; + *) + func_append tmp_deplibs " $test_deplib" + ;; + esac + done + deplibs="$tmp_deplibs" + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec" && + test "$compiler_needs_object" = yes && + test -z "$libobjs"; then + # extract the archives, so we have objects to list. + # TODO: could optimize this to just extract one archive. + whole_archive_flag_spec= + fi + if test -n "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + else + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + fi + + if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then + eval flag=\"$thread_safe_flag_spec\" + func_append linker_flags " $flag" + fi + + # Make a backup of the uninstalled library when relinking + if test "$opt_mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $? + fi + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + eval test_cmds=\"$module_expsym_cmds\" + cmds=$module_expsym_cmds + else + eval test_cmds=\"$module_cmds\" + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + eval test_cmds=\"$archive_expsym_cmds\" + cmds=$archive_expsym_cmds + else + eval test_cmds=\"$archive_cmds\" + cmds=$archive_cmds + fi + fi + + if test "X$skipped_export" != "X:" && + func_len " $test_cmds" && + len=$func_len_result && + test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + : + else + # The command line is too long to link in one step, link piecewise + # or, if using GNU ld and skipped_export is not :, use a linker + # script. + + # Save the value of $output and $libobjs because we want to + # use them later. If we have whole_archive_flag_spec, we + # want to use save_libobjs as it was before + # whole_archive_flag_spec was expanded, because we can't + # assume the linker understands whole_archive_flag_spec. + # This may have to be revisited, in case too many + # convenience libraries get linked in and end up exceeding + # the spec. + if test -z "$convenience" || test -z "$whole_archive_flag_spec"; then + save_libobjs=$libobjs + fi + save_output=$output + func_basename "$output" + output_la=$func_basename_result + + # Clear the reloadable object creation command queue and + # initialize k to one. + test_cmds= + concat_cmds= + objlist= + last_robj= + k=1 + + if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then + output=${output_objdir}/${output_la}.lnkscript + func_verbose "creating GNU ld script: $output" + echo 'INPUT (' > $output + for obj in $save_libobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + echo ')' >> $output + func_append delfiles " $output" + func_to_tool_file "$output" + output=$func_to_tool_file_result + elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then + output=${output_objdir}/${output_la}.lnk + func_verbose "creating linker input file list: $output" + : > $output + set x $save_libobjs + shift + firstobj= + if test "$compiler_needs_object" = yes; then + firstobj="$1 " + shift + fi + for obj + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" >> $output + done + func_append delfiles " $output" + func_to_tool_file "$output" + output=$firstobj\"$file_list_spec$func_to_tool_file_result\" + else + if test -n "$save_libobjs"; then + func_verbose "creating reloadable object files..." + output=$output_objdir/$output_la-${k}.$objext + eval test_cmds=\"$reload_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + + # Loop over the list of objects to be linked. + for obj in $save_libobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + if test "X$objlist" = X || + test "$len" -lt "$max_cmd_len"; then + func_append objlist " $obj" + else + # The command $test_cmds is almost too long, add a + # command to the queue. + if test "$k" -eq 1 ; then + # The first file doesn't have a previous command to add. + reload_objs=$objlist + eval concat_cmds=\"$reload_cmds\" + else + # All subsequent reloadable object files will link in + # the last one created. + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\" + fi + last_robj=$output_objdir/$output_la-${k}.$objext + func_arith $k + 1 + k=$func_arith_result + output=$output_objdir/$output_la-${k}.$objext + objlist=" $obj" + func_len " $last_robj" + func_arith $len0 + $func_len_result + len=$func_arith_result + fi + done + # Handle the remaining objects by creating one last + # reloadable object file. All subsequent reloadable object + # files will link in the last one created. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + reload_objs="$objlist $last_robj" + eval concat_cmds=\"\${concat_cmds}$reload_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\" + fi + func_append delfiles " $output" + + else + output= + fi + + if ${skipped_export-false}; then + func_verbose "generating symbol list for \`$libname.la'" + export_symbols="$output_objdir/$libname.exp" + $opt_dry_run || $RM $export_symbols + libobjs=$output + # Append the command to create the export file. + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\" + if test -n "$last_robj"; then + eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\" + fi + fi + + test -n "$save_libobjs" && + func_verbose "creating a temporary reloadable object file: $output" + + # Loop through the commands generated above and execute them. + save_ifs="$IFS"; IFS='~' + for cmd in $concat_cmds; do + IFS="$save_ifs" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + if test -n "$export_symbols_regex" && ${skipped_export-false}; then + func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"' + func_show_eval '$MV "${export_symbols}T" "$export_symbols"' + fi + fi + + if ${skipped_export-false}; then + if test -n "$export_symbols" && test -n "$include_expsyms"; then + tmp_export_symbols="$export_symbols" + test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols" + $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"' + fi + + if test -n "$orig_export_symbols"; then + # The given exports_symbols file has to be filtered, so filter it. + func_verbose "filter symbol list for \`$libname.la' to tag DATA exports" + # FIXME: $output_objdir/$libname.filter potentially contains lots of + # 's' commands which not all seds can handle. GNU sed should be fine + # though. Also, the filter scales superlinearly with the number of + # global variables. join(1) would be nice here, but unfortunately + # isn't a blessed tool. + $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter + func_append delfiles " $export_symbols $output_objdir/$libname.filter" + export_symbols=$output_objdir/$libname.def + $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols + fi + fi + + libobjs=$output + # Restore the value of output. + output=$save_output + + if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then + eval libobjs=\"\$libobjs $whole_archive_flag_spec\" + test "X$libobjs" = "X " && libobjs= + fi + # Expand the library linking commands again to reset the + # value of $libobjs for piecewise linking. + + # Do each of the archive commands. + if test "$module" = yes && test -n "$module_cmds" ; then + if test -n "$export_symbols" && test -n "$module_expsym_cmds"; then + cmds=$module_expsym_cmds + else + cmds=$module_cmds + fi + else + if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then + cmds=$archive_expsym_cmds + else + cmds=$archive_cmds + fi + fi + fi + + if test -n "$delfiles"; then + # Append the command to remove temporary files to $cmds. + eval cmds=\"\$cmds~\$RM $delfiles\" + fi + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append libobjs " $func_extract_archives_result" + test "X$libobjs" = "X " && libobjs= + fi + + save_ifs="$IFS"; IFS='~' + for cmd in $cmds; do + IFS="$save_ifs" + eval cmd=\"$cmd\" + $opt_silent || { + func_quote_for_expand "$cmd" + eval "func_echo $func_quote_for_expand_result" + } + $opt_dry_run || eval "$cmd" || { + lt_exit=$? + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + ( cd "$output_objdir" && \ + $RM "${realname}T" && \ + $MV "${realname}U" "$realname" ) + fi + + exit $lt_exit + } + done + IFS="$save_ifs" + + # Restore the uninstalled library and exit + if test "$opt_mode" = relink; then + $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $? + + if test -n "$convenience"; then + if test -z "$whole_archive_flag_spec"; then + func_show_eval '${RM}r "$gentop"' + fi + fi + + exit $EXIT_SUCCESS + fi + + # Create links to the real library. + for linkname in $linknames; do + if test "$realname" != "$linkname"; then + func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?' + fi + done + + # If -module or -export-dynamic was specified, set the dlname. + if test "$module" = yes || test "$export_dynamic" = yes; then + # On all known operating systems, these are identical. + dlname="$soname" + fi + fi + ;; + + obj) + if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then + func_warning "\`-dlopen' is ignored for objects" + fi + + case " $deplibs" in + *\ -l* | *\ -L*) + func_warning "\`-l' and \`-L' are ignored for objects" ;; + esac + + test -n "$rpath" && \ + func_warning "\`-rpath' is ignored for objects" + + test -n "$xrpath" && \ + func_warning "\`-R' is ignored for objects" + + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for objects" + + test -n "$release" && \ + func_warning "\`-release' is ignored for objects" + + case $output in + *.lo) + test -n "$objs$old_deplibs" && \ + func_fatal_error "cannot build library object \`$output' from non-libtool objects" + + libobj=$output + func_lo2o "$libobj" + obj=$func_lo2o_result + ;; + *) + libobj= + obj="$output" + ;; + esac + + # Delete the old objects. + $opt_dry_run || $RM $obj $libobj + + # Objects from convenience libraries. This assumes + # single-version convenience libraries. Whenever we create + # different ones for PIC/non-PIC, this we'll have to duplicate + # the extraction. + reload_conv_objs= + gentop= + # reload_cmds runs $LD directly, so let us get rid of + # -Wl from whole_archive_flag_spec and hope we can get by with + # turning comma into space.. + wl= + + if test -n "$convenience"; then + if test -n "$whole_archive_flag_spec"; then + eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\" + reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'` + else + gentop="$output_objdir/${obj}x" + func_append generated " $gentop" + + func_extract_archives $gentop $convenience + reload_conv_objs="$reload_objs $func_extract_archives_result" + fi + fi + + # If we're not building shared, we need to use non_pic_objs + test "$build_libtool_libs" != yes && libobjs="$non_pic_objects" + + # Create the old-style object. + reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test + + output="$obj" + func_execute_cmds "$reload_cmds" 'exit $?' + + # Exit if we aren't doing a library object file. + if test -z "$libobj"; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + fi + + if test "$build_libtool_libs" != yes; then + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + # Create an invalid libtool object if no PIC, so that we don't + # accidentally link it into a program. + # $show "echo timestamp > $libobj" + # $opt_dry_run || eval "echo timestamp > $libobj" || exit $? + exit $EXIT_SUCCESS + fi + + if test -n "$pic_flag" || test "$pic_mode" != default; then + # Only do commands if we really have different PIC objects. + reload_objs="$libobjs $reload_conv_objs" + output="$libobj" + func_execute_cmds "$reload_cmds" 'exit $?' + fi + + if test -n "$gentop"; then + func_show_eval '${RM}r "$gentop"' + fi + + exit $EXIT_SUCCESS + ;; + + prog) + case $host in + *cygwin*) func_stripname '' '.exe' "$output" + output=$func_stripname_result.exe;; + esac + test -n "$vinfo" && \ + func_warning "\`-version-info' is ignored for programs" + + test -n "$release" && \ + func_warning "\`-release' is ignored for programs" + + test "$preload" = yes \ + && test "$dlopen_support" = unknown \ + && test "$dlopen_self" = unknown \ + && test "$dlopen_self_static" = unknown && \ + func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support." + + case $host in + *-*-rhapsody* | *-*-darwin1.[012]) + # On Rhapsody replace the C library is the System framework + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'` + ;; + esac + + case $host in + *-*-darwin*) + # Don't allow lazy linking, it breaks C++ global constructors + # But is supposedly fixed on 10.4 or later (yay!). + if test "$tagname" = CXX ; then + case ${MACOSX_DEPLOYMENT_TARGET-10.0} in + 10.[0123]) + func_append compile_command " ${wl}-bind_at_load" + func_append finalize_command " ${wl}-bind_at_load" + ;; + esac + fi + # Time to change all our "foo.ltframework" stuff back to "-framework foo" + compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'` + ;; + esac + + + # move library search paths that coincide with paths to not yet + # installed libraries to the beginning of the library search list + new_libs= + for path in $notinst_path; do + case " $new_libs " in + *" -L$path/$objdir "*) ;; + *) + case " $compile_deplibs " in + *" -L$path/$objdir "*) + func_append new_libs " -L$path/$objdir" ;; + esac + ;; + esac + done + for deplib in $compile_deplibs; do + case $deplib in + -L*) + case " $new_libs " in + *" $deplib "*) ;; + *) func_append new_libs " $deplib" ;; + esac + ;; + *) func_append new_libs " $deplib" ;; + esac + done + compile_deplibs="$new_libs" + + + func_append compile_command " $compile_deplibs" + func_append finalize_command " $finalize_deplibs" + + if test -n "$rpath$xrpath"; then + # If the user specified any rpath flags, then add them. + for libdir in $rpath $xrpath; do + # This is the magic to use -rpath. + case "$finalize_rpath " in + *" $libdir "*) ;; + *) func_append finalize_rpath " $libdir" ;; + esac + done + fi + + # Now hardcode the library paths + rpath= + hardcode_libdirs= + for libdir in $compile_rpath $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$perm_rpath " in + *" $libdir "*) ;; + *) func_append perm_rpath " $libdir" ;; + esac + fi + case $host in + *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*) + testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'` + case :$dllsearchpath: in + *":$libdir:"*) ;; + ::) dllsearchpath=$libdir;; + *) func_append dllsearchpath ":$libdir";; + esac + case :$dllsearchpath: in + *":$testbindir:"*) ;; + ::) dllsearchpath=$testbindir;; + *) func_append dllsearchpath ":$testbindir";; + esac + ;; + esac + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + compile_rpath="$rpath" + + rpath= + hardcode_libdirs= + for libdir in $finalize_rpath; do + if test -n "$hardcode_libdir_flag_spec"; then + if test -n "$hardcode_libdir_separator"; then + if test -z "$hardcode_libdirs"; then + hardcode_libdirs="$libdir" + else + # Just accumulate the unique libdirs. + case $hardcode_libdir_separator$hardcode_libdirs$hardcode_libdir_separator in + *"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*) + ;; + *) + func_append hardcode_libdirs "$hardcode_libdir_separator$libdir" + ;; + esac + fi + else + eval flag=\"$hardcode_libdir_flag_spec\" + func_append rpath " $flag" + fi + elif test -n "$runpath_var"; then + case "$finalize_perm_rpath " in + *" $libdir "*) ;; + *) func_append finalize_perm_rpath " $libdir" ;; + esac + fi + done + # Substitute the hardcoded libdirs into the rpath. + if test -n "$hardcode_libdir_separator" && + test -n "$hardcode_libdirs"; then + libdir="$hardcode_libdirs" + eval rpath=\" $hardcode_libdir_flag_spec\" + fi + finalize_rpath="$rpath" + + if test -n "$libobjs" && test "$build_old_libs" = yes; then + # Transform all the library objects into standard objects. + compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP` + fi + + func_generate_dlsyms "$outputname" "@PROGRAM@" "no" + + # template prelinking step + if test -n "$prelink_cmds"; then + func_execute_cmds "$prelink_cmds" 'exit $?' + fi + + wrappers_required=yes + case $host in + *cegcc* | *mingw32ce*) + # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway. + wrappers_required=no + ;; + *cygwin* | *mingw* ) + if test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + *) + if test "$need_relink" = no || test "$build_libtool_libs" != yes; then + wrappers_required=no + fi + ;; + esac + if test "$wrappers_required" = no; then + # Replace the output file specification. + compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + link_command="$compile_command$compile_rpath" + + # We have no uninstalled library dependencies, so finalize right now. + exit_status=0 + func_show_eval "$link_command" 'exit_status=$?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Delete the generated files. + if test -f "$output_objdir/${outputname}S.${objext}"; then + func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"' + fi + + exit $exit_status + fi + + if test -n "$compile_shlibpath$finalize_shlibpath"; then + compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command" + fi + if test -n "$finalize_shlibpath"; then + finalize_command="$shlibpath_var=\"$finalize_shlibpath\$$shlibpath_var\" $finalize_command" + fi + + compile_var= + finalize_var= + if test -n "$runpath_var"; then + if test -n "$perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $perm_rpath; do + func_append rpath "$dir:" + done + compile_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + if test -n "$finalize_perm_rpath"; then + # We should set the runpath_var. + rpath= + for dir in $finalize_perm_rpath; do + func_append rpath "$dir:" + done + finalize_var="$runpath_var=\"$rpath\$$runpath_var\" " + fi + fi + + if test "$no_install" = yes; then + # We don't need to create a wrapper script. + link_command="$compile_var$compile_command$compile_rpath" + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'` + # Delete the old output file. + $opt_dry_run || $RM $output + # Link the executable and exit + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + exit $EXIT_SUCCESS + fi + + if test "$hardcode_action" = relink; then + # Fast installation is not supported + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + + func_warning "this platform does not like uninstalled shared libraries" + func_warning "\`$output' will be relinked during installation" + else + if test "$fast_install" != no; then + link_command="$finalize_var$compile_command$finalize_rpath" + if test "$fast_install" = yes; then + relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'` + else + # fast_install is set to needless + relink_command= + fi + else + link_command="$compile_var$compile_command$compile_rpath" + relink_command="$finalize_var$finalize_command$finalize_rpath" + fi + fi + + # Replace the output file specification. + link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'` + + # Delete the old output files. + $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname + + func_show_eval "$link_command" 'exit $?' + + if test -n "$postlink_cmds"; then + func_to_tool_file "$output_objdir/$outputname" + postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'` + func_execute_cmds "$postlink_cmds" 'exit $?' + fi + + # Now create the wrapper script. + func_verbose "creating $output" + + # Quote the relink command for shipping. + if test -n "$relink_command"; then + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + relink_command="(cd `pwd`; $relink_command)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + fi + + # Only actually do things if not in dry run mode. + $opt_dry_run || { + # win32 will think the script is a binary if it has + # a .exe suffix, so we strip it off here. + case $output in + *.exe) func_stripname '' '.exe' "$output" + output=$func_stripname_result ;; + esac + # test for cygwin because mv fails w/o .exe extensions + case $host in + *cygwin*) + exeext=.exe + func_stripname '' '.exe' "$outputname" + outputname=$func_stripname_result ;; + *) exeext= ;; + esac + case $host in + *cygwin* | *mingw* ) + func_dirname_and_basename "$output" "" "." + output_name=$func_basename_result + output_path=$func_dirname_result + cwrappersource="$output_path/$objdir/lt-$output_name.c" + cwrapper="$output_path/$output_name.exe" + $RM $cwrappersource $cwrapper + trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15 + + func_emit_cwrapperexe_src > $cwrappersource + + # The wrapper executable is built using the $host compiler, + # because it contains $host paths and files. If cross- + # compiling, it, like the target executable, must be + # executed on the $host or under an emulation environment. + $opt_dry_run || { + $LTCC $LTCFLAGS -o $cwrapper $cwrappersource + $STRIP $cwrapper + } + + # Now, create the wrapper script for func_source use: + func_ltwrapper_scriptname $cwrapper + $RM $func_ltwrapper_scriptname_result + trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15 + $opt_dry_run || { + # note: this script will not be executed, so do not chmod. + if test "x$build" = "x$host" ; then + $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result + else + func_emit_wrapper no > $func_ltwrapper_scriptname_result + fi + } + ;; + * ) + $RM $output + trap "$RM $output; exit $EXIT_FAILURE" 1 2 15 + + func_emit_wrapper no > $output + chmod +x $output + ;; + esac + } + exit $EXIT_SUCCESS + ;; + esac + + # See if we need to build an old-fashioned archive. + for oldlib in $oldlibs; do + + if test "$build_libtool_libs" = convenience; then + oldobjs="$libobjs_save $symfileobj" + addlibs="$convenience" + build_libtool_libs=no + else + if test "$build_libtool_libs" = module; then + oldobjs="$libobjs_save" + build_libtool_libs=no + else + oldobjs="$old_deplibs $non_pic_objects" + if test "$preload" = yes && test -f "$symfileobj"; then + func_append oldobjs " $symfileobj" + fi + fi + addlibs="$old_convenience" + fi + + if test -n "$addlibs"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $addlibs + func_append oldobjs " $func_extract_archives_result" + fi + + # Do each command in the archive commands. + if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then + cmds=$old_archive_from_new_cmds + else + + # Add any objects from preloaded convenience libraries + if test -n "$dlprefiles"; then + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + + func_extract_archives $gentop $dlprefiles + func_append oldobjs " $func_extract_archives_result" + fi + + # POSIX demands no paths to be encoded in archives. We have + # to avoid creating archives with duplicate basenames if we + # might have to extract them afterwards, e.g., when creating a + # static archive out of a convenience library, or when linking + # the entirety of a libtool archive into another (currently + # not supported by libtool). + if (for obj in $oldobjs + do + func_basename "$obj" + $ECHO "$func_basename_result" + done | sort | sort -uc >/dev/null 2>&1); then + : + else + echo "copying selected object files to avoid basename conflicts..." + gentop="$output_objdir/${outputname}x" + func_append generated " $gentop" + func_mkdir_p "$gentop" + save_oldobjs=$oldobjs + oldobjs= + counter=1 + for obj in $save_oldobjs + do + func_basename "$obj" + objbase="$func_basename_result" + case " $oldobjs " in + " ") oldobjs=$obj ;; + *[\ /]"$objbase "*) + while :; do + # Make sure we don't pick an alternate name that also + # overlaps. + newobj=lt$counter-$objbase + func_arith $counter + 1 + counter=$func_arith_result + case " $oldobjs " in + *[\ /]"$newobj "*) ;; + *) if test ! -f "$gentop/$newobj"; then break; fi ;; + esac + done + func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj" + func_append oldobjs " $gentop/$newobj" + ;; + *) func_append oldobjs " $obj" ;; + esac + done + fi + eval cmds=\"$old_archive_cmds\" + + func_len " $cmds" + len=$func_len_result + if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then + cmds=$old_archive_cmds + elif test -n "$archiver_list_spec"; then + func_verbose "using command file archive linking..." + for obj in $oldobjs + do + func_to_tool_file "$obj" + $ECHO "$func_to_tool_file_result" + done > $output_objdir/$libname.libcmd + func_to_tool_file "$output_objdir/$libname.libcmd" + oldobjs=" $archiver_list_spec$func_to_tool_file_result" + cmds=$old_archive_cmds + else + # the command line is too long to link in one step, link in parts + func_verbose "using piecewise archive linking..." + save_RANLIB=$RANLIB + RANLIB=: + objlist= + concat_cmds= + save_oldobjs=$oldobjs + oldobjs= + # Is there a better way of finding the last object in the list? + for obj in $save_oldobjs + do + last_oldobj=$obj + done + eval test_cmds=\"$old_archive_cmds\" + func_len " $test_cmds" + len0=$func_len_result + len=$len0 + for obj in $save_oldobjs + do + func_len " $obj" + func_arith $len + $func_len_result + len=$func_arith_result + func_append objlist " $obj" + if test "$len" -lt "$max_cmd_len"; then + : + else + # the above command should be used before it gets too long + oldobjs=$objlist + if test "$obj" = "$last_oldobj" ; then + RANLIB=$save_RANLIB + fi + test -z "$concat_cmds" || concat_cmds=$concat_cmds~ + eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\" + objlist= + len=$len0 + fi + done + RANLIB=$save_RANLIB + oldobjs=$objlist + if test "X$oldobjs" = "X" ; then + eval cmds=\"\$concat_cmds\" + else + eval cmds=\"\$concat_cmds~\$old_archive_cmds\" + fi + fi + fi + func_execute_cmds "$cmds" 'exit $?' + done + + test -n "$generated" && \ + func_show_eval "${RM}r$generated" + + # Now create the libtool archive. + case $output in + *.la) + old_library= + test "$build_old_libs" = yes && old_library="$libname.$libext" + func_verbose "creating $output" + + # Preserve any variables that may affect compiler behavior + for var in $variables_saved_for_relink; do + if eval test -z \"\${$var+set}\"; then + relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command" + elif eval var_value=\$$var; test -z "$var_value"; then + relink_command="$var=; export $var; $relink_command" + else + func_quote_for_eval "$var_value" + relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command" + fi + done + # Quote the link command for shipping. + relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)" + relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"` + if test "$hardcode_automatic" = yes ; then + relink_command= + fi + + # Only create the output if not a dry run. + $opt_dry_run || { + for installed in no yes; do + if test "$installed" = yes; then + if test -z "$install_libdir"; then + break + fi + output="$output_objdir/$outputname"i + # Replace all uninstalled libtool libraries with the installed ones + newdependency_libs= + for deplib in $dependency_libs; do + case $deplib in + *.la) + func_basename "$deplib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib` + test -z "$libdir" && \ + func_fatal_error "\`$deplib' is not a valid libtool archive" + func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name" + ;; + -L*) + func_stripname -L '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -L$func_replace_sysroot_result" + ;; + -R*) + func_stripname -R '' "$deplib" + func_replace_sysroot "$func_stripname_result" + func_append newdependency_libs " -R$func_replace_sysroot_result" + ;; + *) func_append newdependency_libs " $deplib" ;; + esac + done + dependency_libs="$newdependency_libs" + newdlfiles= + + for lib in $dlfiles; do + case $lib in + *.la) + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name" + ;; + *) func_append newdlfiles " $lib" ;; + esac + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + *.la) + # Only pass preopened files to the pseudo-archive (for + # eventual linking with the app. that links it) if we + # didn't already link the preopened objects directly into + # the library: + func_basename "$lib" + name="$func_basename_result" + eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib` + test -z "$libdir" && \ + func_fatal_error "\`$lib' is not a valid libtool archive" + func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name" + ;; + esac + done + dlprefiles="$newdlprefiles" + else + newdlfiles= + for lib in $dlfiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlfiles " $abs" + done + dlfiles="$newdlfiles" + newdlprefiles= + for lib in $dlprefiles; do + case $lib in + [\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;; + *) abs=`pwd`"/$lib" ;; + esac + func_append newdlprefiles " $abs" + done + dlprefiles="$newdlprefiles" + fi + $RM $output + # place dlname in correct position for cygwin + # In fact, it would be nice if we could use this code for all target + # systems that can't hard-code library paths into their executables + # and that have no shared library path variable independent of PATH, + # but it turns out we can't easily determine that from inspecting + # libtool variables, so we have to hard-code the OSs to which it + # applies here; at the moment, that means platforms that use the PE + # object format with DLL files. See the long comment at the top of + # tests/bindir.at for full details. + tdlname=$dlname + case $host,$output,$installed,$module,$dlname in + *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll) + # If a -bindir argument was supplied, place the dll there. + if test "x$bindir" != x ; + then + func_relative_path "$install_libdir" "$bindir" + tdlname=$func_relative_path_result$dlname + else + # Otherwise fall back on heuristic. + tdlname=../bin/$dlname + fi + ;; + esac + $ECHO > $output "\ +# $outputname - a libtool library file +# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION +# +# Please DO NOT delete this file! +# It is necessary for linking the library. + +# The name that we can dlopen(3). +dlname='$tdlname' + +# Names of this library. +library_names='$library_names' + +# The name of the static archive. +old_library='$old_library' + +# Linker flags that can not go in dependency_libs. +inherited_linker_flags='$new_inherited_linker_flags' + +# Libraries that this one depends upon. +dependency_libs='$dependency_libs' + +# Names of additional weak libraries provided by this library +weak_library_names='$weak_libs' + +# Version information for $libname. +current=$current +age=$age +revision=$revision + +# Is this an already installed library? +installed=$installed + +# Should we warn about portability when linking against -modules? +shouldnotlink=$module + +# Files to dlopen/dlpreopen +dlopen='$dlfiles' +dlpreopen='$dlprefiles' + +# Directory that this library needs to be installed in: +libdir='$install_libdir'" + if test "$installed" = no && test "$need_relink" = yes; then + $ECHO >> $output "\ +relink_command=\"$relink_command\"" + fi + done + } + + # Do a symbolic link so that the libtool archive can be found in + # LD_LIBRARY_PATH before the program is installed. + func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?' + ;; + esac + exit $EXIT_SUCCESS +} + +{ test "$opt_mode" = link || test "$opt_mode" = relink; } && + func_mode_link ${1+"$@"} + + +# func_mode_uninstall arg... +func_mode_uninstall () +{ + $opt_debug + RM="$nonopt" + files= + rmforce= + exit_status=0 + + # This variable tells wrapper scripts just to set variables rather + # than running their programs. + libtool_install_magic="$magic" + + for arg + do + case $arg in + -f) func_append RM " $arg"; rmforce=yes ;; + -*) func_append RM " $arg" ;; + *) func_append files " $arg" ;; + esac + done + + test -z "$RM" && \ + func_fatal_help "you must specify an RM program" + + rmdirs= + + for file in $files; do + func_dirname "$file" "" "." + dir="$func_dirname_result" + if test "X$dir" = X.; then + odir="$objdir" + else + odir="$dir/$objdir" + fi + func_basename "$file" + name="$func_basename_result" + test "$opt_mode" = uninstall && odir="$dir" + + # Remember odir for removal later, being careful to avoid duplicates + if test "$opt_mode" = clean; then + case " $rmdirs " in + *" $odir "*) ;; + *) func_append rmdirs " $odir" ;; + esac + fi + + # Don't error if the file doesn't exist and rm -f was used. + if { test -L "$file"; } >/dev/null 2>&1 || + { test -h "$file"; } >/dev/null 2>&1 || + test -f "$file"; then + : + elif test -d "$file"; then + exit_status=1 + continue + elif test "$rmforce" = yes; then + continue + fi + + rmfiles="$file" + + case $name in + *.la) + # Possibly a libtool archive, so verify it. + if func_lalib_p "$file"; then + func_source $dir/$name + + # Delete the libtool libraries and symlinks. + for n in $library_names; do + func_append rmfiles " $odir/$n" + done + test -n "$old_library" && func_append rmfiles " $odir/$old_library" + + case "$opt_mode" in + clean) + case " $library_names " in + *" $dlname "*) ;; + *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;; + esac + test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i" + ;; + uninstall) + if test -n "$library_names"; then + # Do each command in the postuninstall commands. + func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + + if test -n "$old_library"; then + # Do each command in the old_postuninstall commands. + func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1' + fi + # FIXME: should reinstall the best remaining shared library. + ;; + esac + fi + ;; + + *.lo) + # Possibly a libtool object, so verify it. + if func_lalib_p "$file"; then + + # Read the .lo file + func_source $dir/$name + + # Add PIC object to the list of files to remove. + if test -n "$pic_object" && + test "$pic_object" != none; then + func_append rmfiles " $dir/$pic_object" + fi + + # Add non-PIC object to the list of files to remove. + if test -n "$non_pic_object" && + test "$non_pic_object" != none; then + func_append rmfiles " $dir/$non_pic_object" + fi + fi + ;; + + *) + if test "$opt_mode" = clean ; then + noexename=$name + case $file in + *.exe) + func_stripname '' '.exe' "$file" + file=$func_stripname_result + func_stripname '' '.exe' "$name" + noexename=$func_stripname_result + # $file with .exe has already been added to rmfiles, + # add $file without .exe + func_append rmfiles " $file" + ;; + esac + # Do a test to see if this is a libtool program. + if func_ltwrapper_p "$file"; then + if func_ltwrapper_executable_p "$file"; then + func_ltwrapper_scriptname "$file" + relink_command= + func_source $func_ltwrapper_scriptname_result + func_append rmfiles " $func_ltwrapper_scriptname_result" + else + relink_command= + func_source $dir/$noexename + fi + + # note $name still contains .exe if it was in $file originally + # as does the version of $file that was added into $rmfiles + func_append rmfiles " $odir/$name $odir/${name}S.${objext}" + if test "$fast_install" = yes && test -n "$relink_command"; then + func_append rmfiles " $odir/lt-$name" + fi + if test "X$noexename" != "X$name" ; then + func_append rmfiles " $odir/lt-${noexename}.c" + fi + fi + fi + ;; + esac + func_show_eval "$RM $rmfiles" 'exit_status=1' + done + + # Try to remove the ${objdir}s in the directories where we deleted files + for dir in $rmdirs; do + if test -d "$dir"; then + func_show_eval "rmdir $dir >/dev/null 2>&1" + fi + done + + exit $exit_status +} + +{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } && + func_mode_uninstall ${1+"$@"} + +test -z "$opt_mode" && { + help="$generic_help" + func_fatal_help "you must specify a MODE" +} + +test -z "$exec_cmd" && \ + func_fatal_help "invalid operation mode \`$opt_mode'" + +if test -n "$exec_cmd"; then + eval exec "$exec_cmd" + exit $EXIT_FAILURE +fi + +exit $exit_status + + +# The TAGs below are defined such that we never get into a situation +# in which we disable both kinds of libraries. Given conflicting +# choices, we go for a static library, that is the most portable, +# since we can't tell whether shared libraries were disabled because +# the user asked for that or because the platform doesn't support +# them. This is particularly important on AIX, because we don't +# support having both static and shared libraries enabled at the same +# time on that platform, so we default to a shared-only configuration. +# If a disable-shared tag is given, we'll fallback to a static-only +# configuration. But we'll never go from static-only to shared-only. + +# ### BEGIN LIBTOOL TAG CONFIG: disable-shared +build_libtool_libs=no +build_old_libs=yes +# ### END LIBTOOL TAG CONFIG: disable-shared + +# ### BEGIN LIBTOOL TAG CONFIG: disable-static +build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac` +# ### END LIBTOOL TAG CONFIG: disable-static + +# Local Variables: +# mode:shell-script +# sh-indentation:2 +# End: +# vi:sw=2 + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 new file mode 100644 index 000000000..2957da743 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_cc_maxopt.m4 @@ -0,0 +1,176 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_cc_maxopt.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CC_MAXOPT +# +# DESCRIPTION +# +# Try to turn on "good" C optimization flags for various compilers and +# architectures, for some definition of "good". (In our case, good for +# FFTW and hopefully for other scientific codes. Modify as needed.) +# +# The user can override the flags by setting the CFLAGS environment +# variable. The user can also specify --enable-portable-binary in order to +# disable any optimization flags that might result in a binary that only +# runs on the host architecture. +# +# Note also that the flags assume that ANSI C aliasing rules are followed +# by the code (e.g. for gcc's -fstrict-aliasing), and that floating-point +# computations can be re-ordered as needed. +# +# Requires macros: AX_CHECK_COMPILER_FLAGS, AX_COMPILER_VENDOR, +# AX_GCC_ARCHFLAG, AX_GCC_X86_CPUID. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 11 + +AC_DEFUN([AX_CC_MAXOPT], +[ +AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AX_COMPILER_VENDOR]) +AC_REQUIRE([AC_CANONICAL_HOST]) + +AC_ARG_ENABLE(portable-binary, [AS_HELP_STRING([--enable-portable-binary], [disable compiler optimizations that would produce unportable binaries])], + acx_maxopt_portable=$withval, acx_maxopt_portable=no) + +# Try to determine "good" native compiler flags if none specified via CFLAGS +if test "$ac_test_CFLAGS" != "set"; then + CFLAGS="" + case $ax_cv_c_compiler_vendor in + dec) CFLAGS="-newc -w0 -O5 -ansi_alias -ansi_args -fp_reorder -tune host" + if test "x$acx_maxopt_portable" = xno; then + CFLAGS="$CFLAGS -arch host" + fi;; + + sun) CFLAGS="-native -fast -xO5 -dalign" + if test "x$acx_maxopt_portable" = xyes; then + CFLAGS="$CFLAGS -xarch=generic" + fi;; + + hp) CFLAGS="+Oall +Optrs_ansi +DSnative" + if test "x$acx_maxopt_portable" = xyes; then + CFLAGS="$CFLAGS +DAportable" + fi;; + + ibm) if test "x$acx_maxopt_portable" = xno; then + xlc_opt="-qarch=auto -qtune=auto" + else + xlc_opt="-qtune=auto" + fi + AX_CHECK_COMPILER_FLAGS($xlc_opt, + CFLAGS="-O3 -qansialias -w $xlc_opt", + [CFLAGS="-O3 -qansialias -w" + echo "******************************************************" + echo "* You seem to have the IBM C compiler. It is *" + echo "* recommended for best performance that you use: *" + echo "* *" + echo "* CFLAGS=-O3 -qarch=xxx -qtune=xxx -qansialias -w *" + echo "* ^^^ ^^^ *" + echo "* where xxx is pwr2, pwr3, 604, or whatever kind of *" + echo "* CPU you have. (Set the CFLAGS environment var. *" + echo "* and re-run configure.) For more info, man cc. *" + echo "******************************************************"]) + ;; + + intel) CFLAGS="-O3 -ansi_alias" + if test "x$acx_maxopt_portable" = xno; then + icc_archflag=unknown + icc_flags="" + case $host_cpu in + i686*|x86_64*) + # icc accepts gcc assembly syntax, so these should work: + AX_GCC_X86_CPUID(0) + AX_GCC_X86_CPUID(1) + case $ax_cv_gcc_x86_cpuid_0 in # see AX_GCC_ARCHFLAG + *:756e6547:*:*) # Intel + case $ax_cv_gcc_x86_cpuid_1 in + *6a?:*[[234]]:*:*|*6[[789b]]?:*:*:*) icc_flags="-xK";; + *f3[[347]]:*:*:*|*f4[1347]:*:*:*) icc_flags="-xP -xN -xW -xK";; + *f??:*:*:*) icc_flags="-xN -xW -xK";; + esac ;; + esac ;; + esac + if test "x$icc_flags" != x; then + for flag in $icc_flags; do + AX_CHECK_COMPILER_FLAGS($flag, [icc_archflag=$flag; break]) + done + fi + AC_MSG_CHECKING([for icc architecture flag]) + AC_MSG_RESULT($icc_archflag) + if test "x$icc_archflag" != xunknown; then + CFLAGS="$CFLAGS $icc_archflag" + fi + fi + ;; + + gnu) + # default optimization flags for gcc on all systems + CFLAGS="-O3 -fomit-frame-pointer" + + # -fstrict-aliasing for gcc-2.95+ + AX_CHECK_COMPILER_FLAGS(-fstrict-aliasing, + CFLAGS="$CFLAGS -fstrict-aliasing") + + AX_CHECK_COMPILER_FLAGS(-ffast-math, CFLAGS="$CFLAGS -ffast-math") + + AX_GCC_ARCHFLAG($acx_maxopt_portable) + ;; + esac + + if test -z "$CFLAGS"; then + echo "" + echo "********************************************************" + echo "* WARNING: Don't know the best CFLAGS for this system *" + echo "* Use ./configure CFLAGS=... to specify your own flags *" + echo "* (otherwise, a default of CFLAGS=-O3 will be used) *" + echo "********************************************************" + echo "" + CFLAGS="-O3" + fi + + AX_CHECK_COMPILER_FLAGS($CFLAGS, [], [ + echo "" + echo "********************************************************" + echo "* WARNING: The guessed CFLAGS don't seem to work with *" + echo "* your compiler. *" + echo "* Use ./configure CFLAGS=... to specify your own flags *" + echo "********************************************************" + echo "" + CFLAGS="" + ]) + +fi +]) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 new file mode 100644 index 000000000..762558097 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4 @@ -0,0 +1,195 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_cflags_warn_all.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] +# AX_CXXFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] +# AX_FCFLAGS_WARN_ALL [(shellvar [,default, [A/NA]])] +# +# DESCRIPTION +# +# Try to find a compiler option that enables most reasonable warnings. +# +# For the GNU compiler it will be -Wall (and -ansi -pedantic) The result +# is added to the shellvar being CFLAGS, CXXFLAGS, or FCFLAGS by default. +# +# Currently this macro knows about the GCC, Solaris, Digital Unix, AIX, +# HP-UX, IRIX, NEC SX-5 (Super-UX 10), Cray J90 (Unicos 10.0.0.8), and +# Intel compilers. For a given compiler, the Fortran flags are much more +# experimental than their C equivalents. +# +# - $1 shell-variable-to-add-to : CFLAGS, CXXFLAGS, or FCFLAGS +# - $2 add-value-if-not-found : nothing +# - $3 action-if-found : add value to shellvariable +# - $4 action-if-not-found : nothing +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2010 Rhys Ulerich +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 10 + +AC_DEFUN([AX_CFLAGS_WARN_ALL],[dnl +AS_VAR_PUSHDEF([FLAGS],[CFLAGS])dnl +AS_VAR_PUSHDEF([VAR],[ac_cv_cflags_warn_all])dnl +AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], +VAR,[VAR="no, unknown" + AC_LANG_PUSH([C]) + ac_save_[]FLAGS="$[]FLAGS" +for ac_arg dnl +in "-pedantic % -Wall" dnl GCC + "-xstrconst % -v" dnl Solaris C + "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix + "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX + "-ansi -ansiE % -fullwarn" dnl IRIX + "+ESlit % +w1" dnl HP-UX C + "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) + "-h conform % -h msglevel 2" dnl Cray C (Unicos) + # +do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) +done + FLAGS="$ac_save_[]FLAGS" + AC_LANG_POP([C]) +]) +case ".$VAR" in + .ok|.ok,*) m4_ifvaln($3,$3) ;; + .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ + AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) + m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; + *) m4_ifvaln($3,$3,[ + if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null + then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) + else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) + m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" + fi ]) ;; +esac +AS_VAR_POPDEF([VAR])dnl +AS_VAR_POPDEF([FLAGS])dnl +]) + +dnl the only difference - the LANG selection... and the default FLAGS + +AC_DEFUN([AX_CXXFLAGS_WARN_ALL],[dnl +AS_VAR_PUSHDEF([FLAGS],[CXXFLAGS])dnl +AS_VAR_PUSHDEF([VAR],[ax_cv_cxxflags_warn_all])dnl +AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], +VAR,[VAR="no, unknown" + AC_LANG_PUSH([C++]) + ac_save_[]FLAGS="$[]FLAGS" +for ac_arg dnl +in "-pedantic % -Wall" dnl GCC + "-xstrconst % -v" dnl Solaris C + "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix + "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX + "-ansi -ansiE % -fullwarn" dnl IRIX + "+ESlit % +w1" dnl HP-UX C + "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) + "-h conform % -h msglevel 2" dnl Cray C (Unicos) + # +do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) +done + FLAGS="$ac_save_[]FLAGS" + AC_LANG_POP([C++]) +]) +case ".$VAR" in + .ok|.ok,*) m4_ifvaln($3,$3) ;; + .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ + AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) + m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; + *) m4_ifvaln($3,$3,[ + if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null + then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) + else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) + m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" + fi ]) ;; +esac +AS_VAR_POPDEF([VAR])dnl +AS_VAR_POPDEF([FLAGS])dnl +]) + +dnl the only difference - the LANG selection... and the default FLAGS + +AC_DEFUN([AX_FCFLAGS_WARN_ALL],[dnl +AS_VAR_PUSHDEF([FLAGS],[FCFLAGS])dnl +AS_VAR_PUSHDEF([VAR],[ax_cv_fcflags_warn_all])dnl +AC_CACHE_CHECK([m4_ifval($1,$1,FLAGS) for maximum warnings], +VAR,[VAR="no, unknown" + AC_LANG_PUSH([Fortran]) + ac_save_[]FLAGS="$[]FLAGS" +for ac_arg dnl +in "-warn all % -warn all" dnl Intel + "-pedantic % -Wall" dnl GCC + "-xstrconst % -v" dnl Solaris C + "-std1 % -verbose -w0 -warnprotos" dnl Digital Unix + "-qlanglvl=ansi % -qsrcmsg -qinfo=all:noppt:noppc:noobs:nocnd" dnl AIX + "-ansi -ansiE % -fullwarn" dnl IRIX + "+ESlit % +w1" dnl HP-UX C + "-Xc % -pvctl[,]fullmsg" dnl NEC SX-5 (Super-UX 10) + "-h conform % -h msglevel 2" dnl Cray C (Unicos) + # +do FLAGS="$ac_save_[]FLAGS "`echo $ac_arg | sed -e 's,%%.*,,' -e 's,%,,'` + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [VAR=`echo $ac_arg | sed -e 's,.*% *,,'` ; break]) +done + FLAGS="$ac_save_[]FLAGS" + AC_LANG_POP([Fortran]) +]) +case ".$VAR" in + .ok|.ok,*) m4_ifvaln($3,$3) ;; + .|.no|.no,*) m4_ifvaln($4,$4,[m4_ifval($2,[ + AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"]) + m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $2"])]) ;; + *) m4_ifvaln($3,$3,[ + if echo " $[]m4_ifval($1,$1,FLAGS) " | grep " $VAR " 2>&1 >/dev/null + then AC_RUN_LOG([: m4_ifval($1,$1,FLAGS) does contain $VAR]) + else AC_RUN_LOG([: m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR"]) + m4_ifval($1,$1,FLAGS)="$m4_ifval($1,$1,FLAGS) $VAR" + fi ]) ;; +esac +AS_VAR_POPDEF([VAR])dnl +AS_VAR_POPDEF([FLAGS])dnl +]) + +dnl implementation tactics: +dnl the for-argument contains a list of options. The first part of +dnl these does only exist to detect the compiler - usually it is +dnl a global option to enable -ansi or -extrawarnings. All other +dnl compilers will fail about it. That was needed since a lot of +dnl compilers will give false positives for some option-syntax +dnl like -Woption or -Xoption as they think of it is a pass-through +dnl to later compile stages or something. The "%" is used as a +dnl delimiter. A non-option comment can be given after "%%" marks +dnl which will be shown but not added to the respective C/CXXFLAGS. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_check_compiler_flags.m4 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_check_compiler_flags.m4 new file mode 100644 index 000000000..35bfd2a5a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_check_compiler_flags.m4 @@ -0,0 +1,76 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_check_compiler_flags.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CHECK_COMPILER_FLAGS(FLAGS, [ACTION-SUCCESS], [ACTION-FAILURE]) +# +# DESCRIPTION +# +# Check whether the given compiler FLAGS work with the current language's +# compiler, or whether they give an error. (Warnings, however, are +# ignored.) +# +# ACTION-SUCCESS/ACTION-FAILURE are shell commands to execute on +# success/failure. +# +# LICENSE +# +# Copyright (c) 2009 Steven G. Johnson +# Copyright (c) 2009 Matteo Frigo +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 9 + +AC_DEFUN([AX_CHECK_COMPILER_FLAGS], +[AC_PREREQ(2.59) dnl for _AC_LANG_PREFIX +AC_MSG_CHECKING([whether _AC_LANG compiler accepts $1]) +dnl Some hackery here since AC_CACHE_VAL can't handle a non-literal varname: +AS_LITERAL_IF([$1], + [AC_CACHE_VAL(AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1]), [ + ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$1" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=yes, + AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=no) + _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS])], + [ax_save_FLAGS=$[]_AC_LANG_PREFIX[]FLAGS + _AC_LANG_PREFIX[]FLAGS="$1" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM()], + eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=yes, + eval AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1])=no) + _AC_LANG_PREFIX[]FLAGS=$ax_save_FLAGS]) +eval ax_check_compiler_flags=$AS_TR_SH(ax_cv_[]_AC_LANG_ABBREV[]_flags_[$1]) +AC_MSG_RESULT($ax_check_compiler_flags) +if test "x$ax_check_compiler_flags" = xyes; then + m4_default([$2], :) +else + m4_default([$3], :) +fi +])dnl AX_CHECK_COMPILER_FLAGS diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 new file mode 100644 index 000000000..321470697 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_compiler_vendor.m4 @@ -0,0 +1,63 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_compiler_vendor.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_COMPILER_VENDOR +# +# DESCRIPTION +# +# Determine the vendor of the C/C++ compiler, e.g., gnu, intel, ibm, sun, +# hp, borland, comeau, dec, cray, kai, lcc, metrowerks, sgi, microsoft, +# watcom, etc. The vendor is returned in the cache variable +# $ax_cv_c_compiler_vendor for C and $ax_cv_cxx_compiler_vendor for C++. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 9 + +AC_DEFUN([AX_COMPILER_VENDOR], +[ +AC_CACHE_CHECK([for _AC_LANG compiler vendor], ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor, + [ax_cv_[]_AC_LANG_ABBREV[]_compiler_vendor=unknown + # note: don't check for gcc first since some other compilers define __GNUC__ + for ventest in intel:__ICC,__ECC,__INTEL_COMPILER ibm:__xlc__,__xlC__,__IBMC__,__IBMCPP__ pathscale:__PATHCC__,__PATHSCALE__ clang:__clang__ gnu:__GNUC__ sun:__SUNPRO_C,__SUNPRO_CC hp:__HP_cc,__HP_aCC dec:__DECC,__DECCXX,__DECC_VER,__DECCXX_VER borland:__BORLANDC__,__TURBOC__ comeau:__COMO__ cray:_CRAYC kai:__KCC lcc:__LCC__ metrowerks:__MWERKS__ sgi:__sgi,sgi microsoft:_MSC_VER watcom:__WATCOMC__ portland:__PGI; do + vencpp="defined("`echo $ventest | cut -d: -f2 | sed 's/,/) || defined(/g'`")" + AC_COMPILE_IFELSE([AC_LANG_PROGRAM(,[ +#if !($vencpp) + thisisanerror; +#endif +])], [ax_cv_]_AC_LANG_ABBREV[_compiler_vendor=`echo $ventest | cut -d: -f1`; break]) + done + ]) +]) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_configure_args.m4 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_configure_args.m4 new file mode 100644 index 000000000..0726b1bc8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_configure_args.m4 @@ -0,0 +1,70 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_configure_args.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_CONFIGURE_ARGS +# +# DESCRIPTION +# +# Helper macro for AX_ENABLE_BUILDDIR. +# +# The traditional way of starting a subdir-configure is running the script +# with ${1+"$@"} but since autoconf 2.60 this is broken. Instead we have +# to rely on eval'ing $ac_configure_args however some old autoconf +# versions do not provide that. To ensure maximum portability of autoconf +# extension macros this helper can be AC_REQUIRE'd so that +# $ac_configure_args will alsways be present. +# +# Sadly, the traditional "exec $SHELL" of the enable_builddir macros is +# spoiled now and must be replaced by "eval + exit $?". +# +# Example: +# +# AC_DEFUN([AX_ENABLE_SUBDIR],[dnl +# AC_REQUIRE([AX_CONFIGURE_ARGS])dnl +# eval $SHELL $ac_configure_args || exit $? +# ...]) +# +# LICENSE +# +# Copyright (c) 2008 Guido U. Draheim +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 9 + +AC_DEFUN([AX_CONFIGURE_ARGS],[ + # [$]@ is unsable in 2.60+ but earlier autoconf had no ac_configure_args + if test "${ac_configure_args+set}" != "set" ; then + ac_configure_args= + for ac_arg in ${1+"[$]@"}; do + ac_configure_args="$ac_configure_args '$ac_arg'" + done + fi +]) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 new file mode 100644 index 000000000..959dec3de --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_enable_builddir.m4 @@ -0,0 +1,300 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_enable_builddir.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_ENABLE_BUILDDIR [(dirstring-or-command [,Makefile.mk [,-all]])] +# +# DESCRIPTION +# +# If the current configure was run within the srcdir then we move all +# configure-files into a subdir and let the configure steps continue +# there. We provide an option --disable-builddir to suppress the move into +# a separate builddir. +# +# Defaults: +# +# $1 = $host (overridden with $HOST) +# $2 = Makefile.mk +# $3 = -all +# +# This macro must be called before AM_INIT_AUTOMAKE. It creates a default +# toplevel srcdir Makefile from the information found in the created +# toplevel builddir Makefile. It just copies the variables and +# rule-targets, each extended with a default rule-execution that recurses +# into the build directory of the current "HOST". You can override the +# auto-dection through `config.guess` and build-time of course, as in +# +# make HOST=i386-mingw-cross +# +# which can of course set at configure time as well using +# +# configure --host=i386-mingw-cross +# +# After the default has been created, additional rules can be appended +# that will not just recurse into the subdirectories and only ever exist +# in the srcdir toplevel makefile - these parts are read from the $2 = +# Makefile.mk file +# +# The automatic rules are usually scanning the toplevel Makefile for lines +# like '#### $host |$builddir' to recognize the place where to recurse +# into. Usually, the last one is the only one used. However, almost all +# targets have an additional "*-all" rule which makes the script to +# recurse into _all_ variants of the current HOST (!!) setting. The "-all" +# suffix can be overriden for the macro as well. +# +# a special rule is only given for things like "dist" that will copy the +# tarball from the builddir to the sourcedir (or $(PUB)) for reason of +# convenience. +# +# LICENSE +# +# Copyright (c) 2009 Guido U. Draheim +# Copyright (c) 2009 Alan Jenkins +# +# This program is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation; either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 22 + +AC_DEFUN([AX_ENABLE_BUILDDIR],[ +AC_REQUIRE([AC_CANONICAL_HOST])[]dnl +AC_REQUIRE([AX_CONFIGURE_ARGS])[]dnl +AC_REQUIRE([AM_AUX_DIR_EXPAND])[]dnl +AC_BEFORE([$0],[AM_INIT_AUTOMAKE])dnl +AS_VAR_PUSHDEF([SUB],[ax_enable_builddir])dnl +AS_VAR_PUSHDEF([AUX],[ax_enable_builddir_auxdir])dnl +AS_VAR_PUSHDEF([SED],[ax_enable_builddir_sed])dnl +SUB="." +AC_ARG_ENABLE([builddir], AS_HELP_STRING( + [--disable-builddir],[disable automatic build in subdir of sources]) + ,[SUB="$enableval"], [SUB="auto"]) +if test ".$ac_srcdir_defaulted" != ".no" ; then +if test ".$srcdir" = ".." ; then + if test -f config.status ; then + AC_MSG_NOTICE(toplevel srcdir already configured... skipping subdir build) + else + test ".$SUB" = "." && SUB="." + test ".$SUB" = ".no" && SUB="." + test ".$TARGET" = "." && TARGET="$target" + test ".$SUB" = ".auto" && SUB="m4_ifval([$1], [$1],[$TARGET])" + if test ".$SUB" != ".." ; then # we know where to go and + AS_MKDIR_P([$SUB]) + echo __.$SUB.__ > $SUB/conftest.tmp + cd $SUB + if grep __.$SUB.__ conftest.tmp >/dev/null 2>/dev/null ; then + rm conftest.tmp + AC_MSG_RESULT([continue configure in default builddir "./$SUB"]) + else + AC_MSG_ERROR([could not change to default builddir "./$SUB"]) + fi + srcdir=`echo "$SUB" | + sed -e 's,^\./,,;s,[[^/]]$,&/,;s,[[^/]]*/,../,g;s,[[/]]$,,;'` + # going to restart from subdirectory location + test -f $srcdir/config.log && mv $srcdir/config.log . + test -f $srcdir/confdefs.h && mv $srcdir/confdefs.h . + test -f $srcdir/conftest.log && mv $srcdir/conftest.log . + test -f $srcdir/$cache_file && mv $srcdir/$cache_file . + AC_MSG_RESULT(....exec $SHELL $srcdir/[$]0 "--srcdir=$srcdir" "--enable-builddir=$SUB" ${1+"[$]@"}) + case "[$]0" in # restart + [/\\]*) eval $SHELL "'[$]0'" "'--srcdir=$srcdir'" "'--enable-builddir=$SUB'" $ac_configure_args ;; + *) eval $SHELL "'$srcdir/[$]0'" "'--srcdir=$srcdir'" "'--enable-builddir=$SUB'" $ac_configure_args ;; + esac ; exit $? + fi + fi +fi fi +test ".$SUB" = ".auto" && SUB="." +dnl ac_path_prog uses "set dummy" to override $@ which would defeat the "exec" +AC_PATH_PROG(SED,gsed sed, sed) +AUX="$am_aux_dir" +AS_VAR_POPDEF([SED])dnl +AS_VAR_POPDEF([AUX])dnl +AS_VAR_POPDEF([SUB])dnl +AC_CONFIG_COMMANDS([buildir],[dnl .............. config.status .............. +AS_VAR_PUSHDEF([SUB],[ax_enable_builddir])dnl +AS_VAR_PUSHDEF([TOP],[top_srcdir])dnl +AS_VAR_PUSHDEF([SRC],[ac_top_srcdir])dnl +AS_VAR_PUSHDEF([AUX],[ax_enable_builddir_auxdir])dnl +AS_VAR_PUSHDEF([SED],[ax_enable_builddir_sed])dnl +pushdef([END],[Makefile.mk])dnl +pushdef([_ALL],[ifelse([$3],,[-all],[$3])])dnl + SRC="$ax_enable_builddir_srcdir" + if test ".$SUB" = ".." ; then + if test -f "$TOP/Makefile" ; then + AC_MSG_NOTICE([skipping TOP/Makefile - left untouched]) + else + AC_MSG_NOTICE([skipping TOP/Makefile - not created]) + fi + else + if test -f "$SRC/Makefile" ; then + a=`grep "^VERSION " "$SRC/Makefile"` ; b=`grep "^VERSION " Makefile` + test "$a" != "$b" && rm "$SRC/Makefile" + fi + if test -f "$SRC/Makefile" ; then + echo "$SRC/Makefile : $SRC/Makefile.in" > $tmp/conftemp.mk + echo " []@ echo 'REMOVED,,,' >\$[]@" >> $tmp/conftemp.mk + eval "${MAKE-make} -f $tmp/conftemp.mk 2>/dev/null >/dev/null" + if grep '^REMOVED,,,' "$SRC/Makefile" >/dev/null + then rm $SRC/Makefile ; fi + cp $tmp/conftemp.mk $SRC/makefiles.mk~ ## DEBUGGING + fi + if test ! -f "$SRC/Makefile" ; then + AC_MSG_NOTICE([create TOP/Makefile guessed from local Makefile]) + x='`' ; cat >$tmp/conftemp.sed <<_EOF +/^\$/n +x +/^\$/bS +x +/\\\\\$/{H;d;} +{H;s/.*//;x;} +bM +:S +x +/\\\\\$/{h;d;} +{h;s/.*//;x;} +:M +s/\\(\\n\\) /\\1 /g +/^ /d +/^[[ ]]*[[\\#]]/d +/^VPATH *=/d +s/^srcdir *=.*/srcdir = ./ +s/^top_srcdir *=.*/top_srcdir = ./ +/[[:=]]/!d +/^\\./d +dnl Now handle rules (i.e. lines containing ":" but not " = "). +/ = /b +/ .= /b +/:/!b +s/:.*/:/ +s/ / /g +s/ \\([[a-z]][[a-z-]]*[[a-zA-Z0-9]]\\)\\([[ :]]\\)/ \\1 \\1[]_ALL\\2/g +s/^\\([[a-z]][[a-z-]]*[[a-zA-Z0-9]]\\)\\([[ :]]\\)/\\1 \\1[]_ALL\\2/ +s/ / /g +/^all all[]_ALL[[ :]]/i\\ +all-configured : all[]_ALL +dnl dist-all exists... and would make for dist-all-all +s/ [[a-zA-Z0-9-]]*[]_ALL [[a-zA-Z0-9-]]*[]_ALL[]_ALL//g +/[]_ALL[]_ALL/d +a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\ + ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ + ; use=$x basename "\$\@" _ALL $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$n * \$\@"; if test "\$\$n" = "0" ; then : \\\\\\ + ; BUILD=$x grep "^####.*|" Makefile |tail -1| sed -e 's/.*|//' $x ; fi \\\\\\ + ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\ + ; test "\$\$use" = "\$\@" && BUILD=$x echo "\$\$BUILD" | tail -1 $x \\\\\\ + ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; (cd "\$\$i" && test ! -f configure && \$(MAKE) \$\$use) || exit; done +dnl special rule add-on: "dist" copies the tarball to $(PUB). (source tree) +/dist[]_ALL *:/a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\ + ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ + ; found=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).tar.*" \\\\\\ + ; if test "\$\$found" = "0" ; then : \\\\\\ + ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\ + ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).tar.* \\\\\\ + ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done +dnl special rule add-on: "dist-foo" copies all the archives to $(PUB). (source tree) +/dist-[[a-zA-Z0-9]]*[]_ALL *:/a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh ./config.guess $x \\\\\\ + ; BUILD=$x grep "^#### \$\$HOST " Makefile | sed -e 's/.*|//' $x \\\\\\ + ; found=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$found \$(PACKAGE)-\$(VERSION).*" \\\\\\ + ; if test "\$\$found" = "0" ; then : \\\\\\ + ; BUILD=$x grep "^#### .*|" Makefile |tail -1| sed -e 's/.*|//' $x \\\\\\ + ; fi ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; for f in \$\$i/\$(PACKAGE)-\$(VERSION).* \\\\\\ + ; do test -f "\$\$f" && mv "\$\$f" \$(PUB). ; done ; break ; done +dnl special rule add-on: "distclean" removes all local builddirs completely +/distclean[]_ALL *:/a\\ + @ HOST="\$(HOST)\" \\\\\\ + ; test ".\$\$HOST" = "." && HOST=$x sh $AUX/config.guess $x \\\\\\ + ; BUILD=$x grep "^#### .*|" Makefile | sed -e 's/.*|//' $x \\\\\\ + ; use=$x basename "\$\@" _ALL $x; n=$x echo \$\$BUILD | wc -w $x \\\\\\ + ; echo "MAKE \$\$HOST : \$\$n * \$\@ (all local builds)" \\\\\\ + ; test ".\$\$BUILD" = "." && BUILD="." \\\\\\ + ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; echo "# rm -r \$\$i"; done ; echo "# (sleep 3)" ; sleep 3 \\\\\\ + ; for i in \$\$BUILD ; do test ".\$\$i" = "." && continue \\\\\\ + ; echo "\$\$i" | grep "^/" > /dev/null && continue \\\\\\ + ; echo "\$\$i" | grep "^../" > /dev/null && continue \\\\\\ + ; echo "rm -r \$\$i"; (rm -r "\$\$i") ; done ; rm Makefile +_EOF + cp "$tmp/conftemp.sed" "$SRC/makefile.sed~" ## DEBUGGING + $SED -f $tmp/conftemp.sed Makefile >$SRC/Makefile + if test -f "$SRC/m4_ifval([$2],[$2],[END])" ; then + AC_MSG_NOTICE([extend TOP/Makefile with TOP/m4_ifval([$2],[$2],[END])]) + cat $SRC/END >>$SRC/Makefile + fi ; xxxx="####" + echo "$xxxx CONFIGURATIONS FOR TOPLEVEL MAKEFILE: " >>$SRC/Makefile + # sanity check + if grep '^; echo "MAKE ' $SRC/Makefile >/dev/null ; then + AC_MSG_NOTICE([buggy sed found - it deletes tab in "a" text parts]) + $SED -e '/^@ HOST=/s/^/ /' -e '/^; /s/^/ /' $SRC/Makefile \ + >$SRC/Makefile~ + (test -s $SRC/Makefile~ && mv $SRC/Makefile~ $SRC/Makefile) 2>/dev/null + fi + else + xxxx="\\#\\#\\#\\#" + # echo "/^$xxxx *$ax_enable_builddir_host /d" >$tmp/conftemp.sed + echo "s!^$xxxx [[^|]]* | *$SUB *\$!$xxxx ...... $SUB!" >$tmp/conftemp.sed + $SED -f "$tmp/conftemp.sed" "$SRC/Makefile" >$tmp/mkfile.tmp + cp "$tmp/conftemp.sed" "$SRC/makefiles.sed~" ## DEBUGGING + cp "$tmp/mkfile.tmp" "$SRC/makefiles.out~" ## DEBUGGING + if cmp -s "$SRC/Makefile" "$tmp/mkfile.tmp" 2>/dev/null ; then + AC_MSG_NOTICE([keeping TOP/Makefile from earlier configure]) + rm "$tmp/mkfile.tmp" + else + AC_MSG_NOTICE([reusing TOP/Makefile from earlier configure]) + mv "$tmp/mkfile.tmp" "$SRC/Makefile" + fi + fi + AC_MSG_NOTICE([build in $SUB (HOST=$ax_enable_builddir_host)]) + xxxx="####" + echo "$xxxx" "$ax_enable_builddir_host" "|$SUB" >>$SRC/Makefile + fi +popdef([END])dnl +AS_VAR_POPDEF([SED])dnl +AS_VAR_POPDEF([AUX])dnl +AS_VAR_POPDEF([SRC])dnl +AS_VAR_POPDEF([TOP])dnl +AS_VAR_POPDEF([SUB])dnl +],[dnl +ax_enable_builddir_srcdir="$srcdir" # $srcdir +ax_enable_builddir_host="$HOST" # $HOST / $host +ax_enable_builddir_version="$VERSION" # $VERSION +ax_enable_builddir_package="$PACKAGE" # $PACKAGE +ax_enable_builddir_auxdir="$ax_enable_builddir_auxdir" # $AUX +ax_enable_builddir_sed="$ax_enable_builddir_sed" # $SED +ax_enable_builddir="$ax_enable_builddir" # $SUB +])dnl +]) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 new file mode 100644 index 000000000..d37a9134c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_gcc_archflag.m4 @@ -0,0 +1,215 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_gcc_archflag.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_GCC_ARCHFLAG([PORTABLE?], [ACTION-SUCCESS], [ACTION-FAILURE]) +# +# DESCRIPTION +# +# This macro tries to guess the "native" arch corresponding to the target +# architecture for use with gcc's -march=arch or -mtune=arch flags. If +# found, the cache variable $ax_cv_gcc_archflag is set to this flag and +# ACTION-SUCCESS is executed; otherwise $ax_cv_gcc_archflag is is set to +# "unknown" and ACTION-FAILURE is executed. The default ACTION-SUCCESS is +# to add $ax_cv_gcc_archflag to the end of $CFLAGS. +# +# PORTABLE? should be either [yes] (default) or [no]. In the former case, +# the flag is set to -mtune (or equivalent) so that the architecture is +# only used for tuning, but the instruction set used is still portable. In +# the latter case, the flag is set to -march (or equivalent) so that +# architecture-specific instructions are enabled. +# +# The user can specify --with-gcc-arch= in order to override the +# macro's choice of architecture, or --without-gcc-arch to disable this. +# +# When cross-compiling, or if $CC is not gcc, then ACTION-FAILURE is +# called unless the user specified --with-gcc-arch manually. +# +# Requires macros: AX_CHECK_COMPILER_FLAGS, AX_GCC_X86_CPUID +# +# (The main emphasis here is on recent CPUs, on the principle that doing +# high-performance computing on old hardware is uncommon.) +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 8 + +AC_DEFUN([AX_GCC_ARCHFLAG], +[AC_REQUIRE([AC_PROG_CC]) +AC_REQUIRE([AC_CANONICAL_HOST]) + +AC_ARG_WITH(gcc-arch, [AS_HELP_STRING([--with-gcc-arch=], [use architecture for gcc -march/-mtune, instead of guessing])], + ax_gcc_arch=$withval, ax_gcc_arch=yes) + +AC_MSG_CHECKING([for gcc architecture flag]) +AC_MSG_RESULT([]) +AC_CACHE_VAL(ax_cv_gcc_archflag, +[ +ax_cv_gcc_archflag="unknown" + +if test "$GCC" = yes; then + +if test "x$ax_gcc_arch" = xyes; then +ax_gcc_arch="" +if test "$cross_compiling" = no; then +case $host_cpu in + i[[3456]]86*|x86_64*) # use cpuid codes, in part from x86info-1.7 by D. Jones + AX_GCC_X86_CPUID(0) + AX_GCC_X86_CPUID(1) + case $ax_cv_gcc_x86_cpuid_0 in + *:756e6547:*:*) # Intel + case $ax_cv_gcc_x86_cpuid_1 in + *5[[48]]?:*:*:*) ax_gcc_arch="pentium-mmx pentium" ;; + *5??:*:*:*) ax_gcc_arch=pentium ;; + *6[[3456]]?:*:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *6a?:*[[01]]:*:*) ax_gcc_arch="pentium2 pentiumpro" ;; + *6a?:*[[234]]:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *6[[9d]]?:*:*:*) ax_gcc_arch="pentium-m pentium3 pentiumpro" ;; + *6[[78b]]?:*:*:*) ax_gcc_arch="pentium3 pentiumpro" ;; + *6??:*:*:*) ax_gcc_arch=pentiumpro ;; + *f3[[347]]:*:*:*|*f4[1347]:*:*:*) + case $host_cpu in + x86_64*) ax_gcc_arch="nocona pentium4 pentiumpro" ;; + *) ax_gcc_arch="prescott pentium4 pentiumpro" ;; + esac ;; + *f??:*:*:*) ax_gcc_arch="pentium4 pentiumpro";; + esac ;; + *:68747541:*:*) # AMD + case $ax_cv_gcc_x86_cpuid_1 in + *5[[67]]?:*:*:*) ax_gcc_arch=k6 ;; + *5[[8d]]?:*:*:*) ax_gcc_arch="k6-2 k6" ;; + *5[[9]]?:*:*:*) ax_gcc_arch="k6-3 k6" ;; + *60?:*:*:*) ax_gcc_arch=k7 ;; + *6[[12]]?:*:*:*) ax_gcc_arch="athlon k7" ;; + *6[[34]]?:*:*:*) ax_gcc_arch="athlon-tbird k7" ;; + *67?:*:*:*) ax_gcc_arch="athlon-4 athlon k7" ;; + *6[[68a]]?:*:*:*) + AX_GCC_X86_CPUID(0x80000006) # L2 cache size + case $ax_cv_gcc_x86_cpuid_0x80000006 in + *:*:*[[1-9a-f]]??????:*) # (L2 = ecx >> 16) >= 256 + ax_gcc_arch="athlon-xp athlon-4 athlon k7" ;; + *) ax_gcc_arch="athlon-4 athlon k7" ;; + esac ;; + *f[[4cef8b]]?:*:*:*) ax_gcc_arch="athlon64 k8" ;; + *f5?:*:*:*) ax_gcc_arch="opteron k8" ;; + *f7?:*:*:*) ax_gcc_arch="athlon-fx opteron k8" ;; + *f??:*:*:*) ax_gcc_arch="k8" ;; + esac ;; + *:746e6543:*:*) # IDT + case $ax_cv_gcc_x86_cpuid_1 in + *54?:*:*:*) ax_gcc_arch=winchip-c6 ;; + *58?:*:*:*) ax_gcc_arch=winchip2 ;; + *6[[78]]?:*:*:*) ax_gcc_arch=c3 ;; + *69?:*:*:*) ax_gcc_arch="c3-2 c3" ;; + esac ;; + esac + if test x"$ax_gcc_arch" = x; then # fallback + case $host_cpu in + i586*) ax_gcc_arch=pentium ;; + i686*) ax_gcc_arch=pentiumpro ;; + esac + fi + ;; + + sparc*) + AC_PATH_PROG([PRTDIAG], [prtdiag], [prtdiag], [$PATH:/usr/platform/`uname -i`/sbin/:/usr/platform/`uname -m`/sbin/]) + cputype=`(((grep cpu /proc/cpuinfo | cut -d: -f2) ; ($PRTDIAG -v |grep -i sparc) ; grep -i cpu /var/run/dmesg.boot ) | head -n 1) 2> /dev/null` + cputype=`echo "$cputype" | tr -d ' -' |tr $as_cr_LETTERS $as_cr_letters` + case $cputype in + *ultrasparciv*) ax_gcc_arch="ultrasparc4 ultrasparc3 ultrasparc v9" ;; + *ultrasparciii*) ax_gcc_arch="ultrasparc3 ultrasparc v9" ;; + *ultrasparc*) ax_gcc_arch="ultrasparc v9" ;; + *supersparc*|*tms390z5[[05]]*) ax_gcc_arch="supersparc v8" ;; + *hypersparc*|*rt62[[056]]*) ax_gcc_arch="hypersparc v8" ;; + *cypress*) ax_gcc_arch=cypress ;; + esac ;; + + alphaev5) ax_gcc_arch=ev5 ;; + alphaev56) ax_gcc_arch=ev56 ;; + alphapca56) ax_gcc_arch="pca56 ev56" ;; + alphapca57) ax_gcc_arch="pca57 pca56 ev56" ;; + alphaev6) ax_gcc_arch=ev6 ;; + alphaev67) ax_gcc_arch=ev67 ;; + alphaev68) ax_gcc_arch="ev68 ev67" ;; + alphaev69) ax_gcc_arch="ev69 ev68 ev67" ;; + alphaev7) ax_gcc_arch="ev7 ev69 ev68 ev67" ;; + alphaev79) ax_gcc_arch="ev79 ev7 ev69 ev68 ev67" ;; + + powerpc*) + cputype=`((grep cpu /proc/cpuinfo | head -n 1 | cut -d: -f2 | cut -d, -f1 | sed 's/ //g') ; /usr/bin/machine ; /bin/machine; grep CPU /var/run/dmesg.boot | head -n 1 | cut -d" " -f2) 2> /dev/null` + cputype=`echo $cputype | sed -e 's/ppc//g;s/ *//g'` + case $cputype in + *750*) ax_gcc_arch="750 G3" ;; + *740[[0-9]]*) ax_gcc_arch="$cputype 7400 G4" ;; + *74[[4-5]][[0-9]]*) ax_gcc_arch="$cputype 7450 G4" ;; + *74[[0-9]][[0-9]]*) ax_gcc_arch="$cputype G4" ;; + *970*) ax_gcc_arch="970 G5 power4";; + *POWER4*|*power4*|*gq*) ax_gcc_arch="power4 970";; + *POWER5*|*power5*|*gr*|*gs*) ax_gcc_arch="power5 power4 970";; + 603ev|8240) ax_gcc_arch="$cputype 603e 603";; + *) ax_gcc_arch=$cputype ;; + esac + ax_gcc_arch="$ax_gcc_arch powerpc" + ;; +esac +fi # not cross-compiling +fi # guess arch + +if test "x$ax_gcc_arch" != x -a "x$ax_gcc_arch" != xno; then +for arch in $ax_gcc_arch; do + if test "x[]m4_default([$1],yes)" = xyes; then # if we require portable code + flags="-mtune=$arch" + # -mcpu=$arch and m$arch generate nonportable code on every arch except + # x86. And some other arches (e.g. Alpha) don't accept -mtune. Grrr. + case $host_cpu in i*86|x86_64*) flags="$flags -mcpu=$arch -m$arch";; esac + else + flags="-march=$arch -mcpu=$arch -m$arch" + fi + for flag in $flags; do + AX_CHECK_COMPILER_FLAGS($flag, [ax_cv_gcc_archflag=$flag; break]) + done + test "x$ax_cv_gcc_archflag" = xunknown || break +done +fi + +fi # $GCC=yes +]) +AC_MSG_CHECKING([for gcc architecture flag]) +AC_MSG_RESULT($ax_cv_gcc_archflag) +if test "x$ax_cv_gcc_archflag" = xunknown; then + m4_default([$3],:) +else + m4_default([$2], [CFLAGS="$CFLAGS $ax_cv_gcc_archflag"]) +fi +]) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 new file mode 100644 index 000000000..7d46fee02 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4 @@ -0,0 +1,79 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_gcc_x86_cpuid.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_GCC_X86_CPUID(OP) +# +# DESCRIPTION +# +# On Pentium and later x86 processors, with gcc or a compiler that has a +# compatible syntax for inline assembly instructions, run a small program +# that executes the cpuid instruction with input OP. This can be used to +# detect the CPU type. +# +# On output, the values of the eax, ebx, ecx, and edx registers are stored +# as hexadecimal strings as "eax:ebx:ecx:edx" in the cache variable +# ax_cv_gcc_x86_cpuid_OP. +# +# If the cpuid instruction fails (because you are running a +# cross-compiler, or because you are not using gcc, or because you are on +# a processor that doesn't have this instruction), ax_cv_gcc_x86_cpuid_OP +# is set to the string "unknown". +# +# This macro mainly exists to be used in AX_GCC_ARCHFLAG. +# +# LICENSE +# +# Copyright (c) 2008 Steven G. Johnson +# Copyright (c) 2008 Matteo Frigo +# +# This program is free software: you can redistribute it and/or modify it +# under the terms of the GNU General Public License as published by the +# Free Software Foundation, either version 3 of the License, or (at your +# option) any later version. +# +# This program is distributed in the hope that it will be useful, but +# WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General +# Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program. If not, see . +# +# As a special exception, the respective Autoconf Macro's copyright owner +# gives unlimited permission to copy, distribute and modify the configure +# scripts that are the output of Autoconf when processing the Macro. You +# need not follow the terms of the GNU General Public License when using +# or distributing such scripts, even though portions of the text of the +# Macro appear in them. The GNU General Public License (GPL) does govern +# all other use of the material that constitutes the Autoconf Macro. +# +# This special exception to the GPL applies to versions of the Autoconf +# Macro released by the Autoconf Archive. When you make and distribute a +# modified version of the Autoconf Macro, you may extend this special +# exception to the GPL to apply to your modified version as well. + +#serial 7 + +AC_DEFUN([AX_GCC_X86_CPUID], +[AC_REQUIRE([AC_PROG_CC]) +AC_LANG_PUSH([C]) +AC_CACHE_CHECK(for x86 cpuid $1 output, ax_cv_gcc_x86_cpuid_$1, + [AC_RUN_IFELSE([AC_LANG_PROGRAM([#include ], [ + int op = $1, eax, ebx, ecx, edx; + FILE *f; + __asm__("cpuid" + : "=a" (eax), "=b" (ebx), "=c" (ecx), "=d" (edx) + : "a" (op)); + f = fopen("conftest_cpuid", "w"); if (!f) return 1; + fprintf(f, "%x:%x:%x:%x\n", eax, ebx, ecx, edx); + fclose(f); + return 0; +])], + [ax_cv_gcc_x86_cpuid_$1=`cat conftest_cpuid`; rm -f conftest_cpuid], + [ax_cv_gcc_x86_cpuid_$1=unknown; rm -f conftest_cpuid], + [ax_cv_gcc_x86_cpuid_$1=unknown])]) +AC_LANG_POP([C]) +]) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/libtool.m4 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/libtool.m4 new file mode 100644 index 000000000..d8125842f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/libtool.m4 @@ -0,0 +1,7831 @@ +# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*- +# +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, +# Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +m4_define([_LT_COPYING], [dnl +# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, +# 2006, 2007, 2008, 2009, 2010 Free Software Foundation, +# Inc. +# Written by Gordon Matzigkeit, 1996 +# +# This file is part of GNU Libtool. +# +# GNU Libtool is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# As a special exception to the GNU General Public License, +# if you distribute this file as part of a program or library that +# is built using GNU Libtool, you may include this file under the +# same distribution terms that you use for the rest of that program. +# +# GNU Libtool is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GNU Libtool; see the file COPYING. If not, a copy +# can be downloaded from http://www.gnu.org/licenses/gpl.html, or +# obtained by writing to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. +]) + +# serial 57 LT_INIT + + +# LT_PREREQ(VERSION) +# ------------------ +# Complain and exit if this libtool version is less that VERSION. +m4_defun([LT_PREREQ], +[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1, + [m4_default([$3], + [m4_fatal([Libtool version $1 or higher is required], + 63)])], + [$2])]) + + +# _LT_CHECK_BUILDDIR +# ------------------ +# Complain if the absolute build directory name contains unusual characters +m4_defun([_LT_CHECK_BUILDDIR], +[case `pwd` in + *\ * | *\ *) + AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;; +esac +]) + + +# LT_INIT([OPTIONS]) +# ------------------ +AC_DEFUN([LT_INIT], +[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT +AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl +AC_BEFORE([$0], [LT_LANG])dnl +AC_BEFORE([$0], [LT_OUTPUT])dnl +AC_BEFORE([$0], [LTDL_INIT])dnl +m4_require([_LT_CHECK_BUILDDIR])dnl + +dnl Autoconf doesn't catch unexpanded LT_ macros by default: +m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl +m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl +dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4 +dnl unless we require an AC_DEFUNed macro: +AC_REQUIRE([LTOPTIONS_VERSION])dnl +AC_REQUIRE([LTSUGAR_VERSION])dnl +AC_REQUIRE([LTVERSION_VERSION])dnl +AC_REQUIRE([LTOBSOLETE_VERSION])dnl +m4_require([_LT_PROG_LTMAIN])dnl + +_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}]) + +dnl Parse OPTIONS +_LT_SET_OPTIONS([$0], [$1]) + +# This can be used to rebuild libtool when needed +LIBTOOL_DEPS="$ltmain" + +# Always use our own libtool. +LIBTOOL='$(SHELL) $(top_builddir)/libtool' +AC_SUBST(LIBTOOL)dnl + +_LT_SETUP + +# Only expand once: +m4_define([LT_INIT]) +])# LT_INIT + +# Old names: +AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT]) +AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PROG_LIBTOOL], []) +dnl AC_DEFUN([AM_PROG_LIBTOOL], []) + + +# _LT_CC_BASENAME(CC) +# ------------------- +# Calculate cc_basename. Skip known compiler wrappers and cross-prefix. +m4_defun([_LT_CC_BASENAME], +[for cc_temp in $1""; do + case $cc_temp in + compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;; + distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;; + \-*) ;; + *) break;; + esac +done +cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"` +]) + + +# _LT_FILEUTILS_DEFAULTS +# ---------------------- +# It is okay to use these file commands and assume they have been set +# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'. +m4_defun([_LT_FILEUTILS_DEFAULTS], +[: ${CP="cp -f"} +: ${MV="mv -f"} +: ${RM="rm -f"} +])# _LT_FILEUTILS_DEFAULTS + + +# _LT_SETUP +# --------- +m4_defun([_LT_SETUP], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl + +_LT_DECL([], [host_alias], [0], [The host system])dnl +_LT_DECL([], [host], [0])dnl +_LT_DECL([], [host_os], [0])dnl +dnl +_LT_DECL([], [build_alias], [0], [The build system])dnl +_LT_DECL([], [build], [0])dnl +_LT_DECL([], [build_os], [0])dnl +dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +dnl +AC_REQUIRE([AC_PROG_LN_S])dnl +test -z "$LN_S" && LN_S="ln -s" +_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl +dnl +AC_REQUIRE([LT_CMD_MAX_LEN])dnl +_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl +_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl +dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl +m4_require([_LT_CMD_RELOAD])dnl +m4_require([_LT_CHECK_MAGIC_METHOD])dnl +m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl +m4_require([_LT_CMD_OLD_ARCHIVE])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_WITH_SYSROOT])dnl + +_LT_CONFIG_LIBTOOL_INIT([ +# See if we are running on zsh, and set the options which allow our +# commands through without removal of \ escapes INIT. +if test -n "\${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi +]) +if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST +fi + +_LT_CHECK_OBJDIR + +m4_require([_LT_TAG_COMPILER])dnl + +case $host_os in +aix3*) + # AIX sometimes has problems with the GCC collect2 program. For some + # reason, if we set the COLLECT_NAMES environment variable, the problems + # vanish in a puff of smoke. + if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES + fi + ;; +esac + +# Global variables: +ofile=libtool +can_build_shared=yes + +# All known linkers require a `.a' archive for static linking (except MSVC, +# which needs '.lib'). +libext=a + +with_gnu_ld="$lt_cv_prog_gnu_ld" + +old_CC="$CC" +old_CFLAGS="$CFLAGS" + +# Set sane defaults for various variables +test -z "$CC" && CC=cc +test -z "$LTCC" && LTCC=$CC +test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS +test -z "$LD" && LD=ld +test -z "$ac_objext" && ac_objext=o + +_LT_CC_BASENAME([$compiler]) + +# Only perform the check for file, if the check method requires it +test -z "$MAGIC_CMD" && MAGIC_CMD=file +case $deplibs_check_method in +file_magic*) + if test "$file_magic_cmd" = '$MAGIC_CMD'; then + _LT_PATH_MAGIC + fi + ;; +esac + +# Use C for the default configuration in the libtool script +LT_SUPPORTED_TAG([CC]) +_LT_LANG_C_CONFIG +_LT_LANG_DEFAULT_CONFIG +_LT_CONFIG_COMMANDS +])# _LT_SETUP + + +# _LT_PREPARE_SED_QUOTE_VARS +# -------------------------- +# Define a few sed substitution that help us do robust quoting. +m4_defun([_LT_PREPARE_SED_QUOTE_VARS], +[# Backslashify metacharacters that are still active within +# double-quoted strings. +sed_quote_subst='s/\([["`$\\]]\)/\\\1/g' + +# Same as above, but do not quote variable references. +double_quote_subst='s/\([["`\\]]\)/\\\1/g' + +# Sed substitution to delay expansion of an escaped shell variable in a +# double_quote_subst'ed string. +delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g' + +# Sed substitution to delay expansion of an escaped single quote. +delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g' + +# Sed substitution to avoid accidental globbing in evaled expressions +no_glob_subst='s/\*/\\\*/g' +]) + +# _LT_PROG_LTMAIN +# --------------- +# Note that this code is called both from `configure', and `config.status' +# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably, +# `config.status' has no value for ac_aux_dir unless we are using Automake, +# so we pass a copy along to make sure it has a sensible value anyway. +m4_defun([_LT_PROG_LTMAIN], +[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl +_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir']) +ltmain="$ac_aux_dir/ltmain.sh" +])# _LT_PROG_LTMAIN + + +## ------------------------------------- ## +## Accumulate code for creating libtool. ## +## ------------------------------------- ## + +# So that we can recreate a full libtool script including additional +# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS +# in macros and then make a single call at the end using the `libtool' +# label. + + +# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS]) +# ---------------------------------------- +# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL_INIT], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_INIT], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_INIT]) + + +# _LT_CONFIG_LIBTOOL([COMMANDS]) +# ------------------------------ +# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later. +m4_define([_LT_CONFIG_LIBTOOL], +[m4_ifval([$1], + [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS], + [$1 +])])]) + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS]) + + +# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS]) +# ----------------------------------------------------- +m4_defun([_LT_CONFIG_SAVE_COMMANDS], +[_LT_CONFIG_LIBTOOL([$1]) +_LT_CONFIG_LIBTOOL_INIT([$2]) +]) + + +# _LT_FORMAT_COMMENT([COMMENT]) +# ----------------------------- +# Add leading comment marks to the start of each line, and a trailing +# full-stop to the whole comment if one is not present already. +m4_define([_LT_FORMAT_COMMENT], +[m4_ifval([$1], [ +m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])], + [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.]) +)]) + + + +## ------------------------ ## +## FIXME: Eliminate VARNAME ## +## ------------------------ ## + + +# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?]) +# ------------------------------------------------------------------- +# CONFIGNAME is the name given to the value in the libtool script. +# VARNAME is the (base) name used in the configure script. +# VALUE may be 0, 1 or 2 for a computed quote escaped value based on +# VARNAME. Any other value will be used directly. +m4_define([_LT_DECL], +[lt_if_append_uniq([lt_decl_varnames], [$2], [, ], + [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name], + [m4_ifval([$1], [$1], [$2])]) + lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3]) + m4_ifval([$4], + [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])]) + lt_dict_add_subkey([lt_decl_dict], [$2], + [tagged?], [m4_ifval([$5], [yes], [no])])]) +]) + + +# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION]) +# -------------------------------------------------------- +m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])]) + + +# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_tag_varnames], +[_lt_decl_filter([tagged?], [yes], $@)]) + + +# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..]) +# --------------------------------------------------------- +m4_define([_lt_decl_filter], +[m4_case([$#], + [0], [m4_fatal([$0: too few arguments: $#])], + [1], [m4_fatal([$0: too few arguments: $#: $1])], + [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)], + [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)], + [lt_dict_filter([lt_decl_dict], $@)])[]dnl +]) + + +# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...]) +# -------------------------------------------------- +m4_define([lt_decl_quote_varnames], +[_lt_decl_filter([value], [1], $@)]) + + +# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_dquote_varnames], +[_lt_decl_filter([value], [2], $@)]) + + +# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...]) +# --------------------------------------------------- +m4_define([lt_decl_varnames_tagged], +[m4_assert([$# <= 2])dnl +_$0(m4_quote(m4_default([$1], [[, ]])), + m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]), + m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))]) +m4_define([_lt_decl_varnames_tagged], +[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])]) + + +# lt_decl_all_varnames([SEPARATOR], [VARNAME1...]) +# ------------------------------------------------ +m4_define([lt_decl_all_varnames], +[_$0(m4_quote(m4_default([$1], [[, ]])), + m4_if([$2], [], + m4_quote(lt_decl_varnames), + m4_quote(m4_shift($@))))[]dnl +]) +m4_define([_lt_decl_all_varnames], +[lt_join($@, lt_decl_varnames_tagged([$1], + lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl +]) + + +# _LT_CONFIG_STATUS_DECLARE([VARNAME]) +# ------------------------------------ +# Quote a variable value, and forward it to `config.status' so that its +# declaration there will have the same value as in `configure'. VARNAME +# must have a single quote delimited value for this to work. +m4_define([_LT_CONFIG_STATUS_DECLARE], +[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`']) + + +# _LT_CONFIG_STATUS_DECLARATIONS +# ------------------------------ +# We delimit libtool config variables with single quotes, so when +# we write them to config.status, we have to be sure to quote all +# embedded single quotes properly. In configure, this macro expands +# each variable declared with _LT_DECL (and _LT_TAGDECL) into: +# +# ='`$ECHO "$" | $SED "$delay_single_quote_subst"`' +m4_defun([_LT_CONFIG_STATUS_DECLARATIONS], +[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames), + [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAGS +# ---------------- +# Output comment and list of tags supported by the script +m4_defun([_LT_LIBTOOL_TAGS], +[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl +available_tags="_LT_TAGS"dnl +]) + + +# _LT_LIBTOOL_DECLARE(VARNAME, [TAG]) +# ----------------------------------- +# Extract the dictionary values for VARNAME (optionally with TAG) and +# expand to a commented shell variable setting: +# +# # Some comment about what VAR is for. +# visible_name=$lt_internal_name +m4_define([_LT_LIBTOOL_DECLARE], +[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], + [description])))[]dnl +m4_pushdef([_libtool_name], + m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl +m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])), + [0], [_libtool_name=[$]$1], + [1], [_libtool_name=$lt_[]$1], + [2], [_libtool_name=$lt_[]$1], + [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl +m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl +]) + + +# _LT_LIBTOOL_CONFIG_VARS +# ----------------------- +# Produce commented declarations of non-tagged libtool config variables +# suitable for insertion in the LIBTOOL CONFIG section of the `libtool' +# script. Tagged libtool config variables (even for the LIBTOOL CONFIG +# section) are produced by _LT_LIBTOOL_TAG_VARS. +m4_defun([_LT_LIBTOOL_CONFIG_VARS], +[m4_foreach([_lt_var], + m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])]) + + +# _LT_LIBTOOL_TAG_VARS(TAG) +# ------------------------- +m4_define([_LT_LIBTOOL_TAG_VARS], +[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames), + [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])]) + + +# _LT_TAGVAR(VARNAME, [TAGNAME]) +# ------------------------------ +m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])]) + + +# _LT_CONFIG_COMMANDS +# ------------------- +# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of +# variables for single and double quote escaping we saved from calls +# to _LT_DECL, we can put quote escaped variables declarations +# into `config.status', and then the shell code to quote escape them in +# for loops in `config.status'. Finally, any additional code accumulated +# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded. +m4_defun([_LT_CONFIG_COMMANDS], +[AC_PROVIDE_IFELSE([LT_OUTPUT], + dnl If the libtool generation code has been placed in $CONFIG_LT, + dnl instead of duplicating it all over again into config.status, + dnl then we will have config.status run $CONFIG_LT later, so it + dnl needs to know what name is stored there: + [AC_CONFIG_COMMANDS([libtool], + [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])], + dnl If the libtool generation code is destined for config.status, + dnl expand the accumulated commands and init code now: + [AC_CONFIG_COMMANDS([libtool], + [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])]) +])#_LT_CONFIG_COMMANDS + + +# Initialize. +m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT], +[ + +# The HP-UX ksh and POSIX shell print the target directory to stdout +# if CDPATH is set. +(unset CDPATH) >/dev/null 2>&1 && unset CDPATH + +sed_quote_subst='$sed_quote_subst' +double_quote_subst='$double_quote_subst' +delay_variable_subst='$delay_variable_subst' +_LT_CONFIG_STATUS_DECLARATIONS +LTCC='$LTCC' +LTCFLAGS='$LTCFLAGS' +compiler='$compiler_DEFAULT' + +# A function that is used when there is no print builtin or printf. +func_fallback_echo () +{ + eval 'cat <<_LTECHO_EOF +\$[]1 +_LTECHO_EOF' +} + +# Quote evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_quote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +# Double-quote double-evaled strings. +for var in lt_decl_all_varnames([[ \ +]], lt_decl_dquote_varnames); do + case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in + *[[\\\\\\\`\\"\\\$]]*) + eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\"" + ;; + *) + eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\"" + ;; + esac +done + +_LT_OUTPUT_LIBTOOL_INIT +]) + +# _LT_GENERATED_FILE_INIT(FILE, [COMMENT]) +# ------------------------------------ +# Generate a child script FILE with all initialization necessary to +# reuse the environment learned by the parent script, and make the +# file executable. If COMMENT is supplied, it is inserted after the +# `#!' sequence but before initialization text begins. After this +# macro, additional text can be appended to FILE to form the body of +# the child script. The macro ends with non-zero status if the +# file could not be fully written (such as if the disk is full). +m4_ifdef([AS_INIT_GENERATED], +[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])], +[m4_defun([_LT_GENERATED_FILE_INIT], +[m4_require([AS_PREPARE])]dnl +[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl +[lt_write_fail=0 +cat >$1 <<_ASEOF || lt_write_fail=1 +#! $SHELL +# Generated by $as_me. +$2 +SHELL=\${CONFIG_SHELL-$SHELL} +export SHELL +_ASEOF +cat >>$1 <<\_ASEOF || lt_write_fail=1 +AS_SHELL_SANITIZE +_AS_PREPARE +exec AS_MESSAGE_FD>&1 +_ASEOF +test $lt_write_fail = 0 && chmod +x $1[]dnl +m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT + +# LT_OUTPUT +# --------- +# This macro allows early generation of the libtool script (before +# AC_OUTPUT is called), incase it is used in configure for compilation +# tests. +AC_DEFUN([LT_OUTPUT], +[: ${CONFIG_LT=./config.lt} +AC_MSG_NOTICE([creating $CONFIG_LT]) +_LT_GENERATED_FILE_INIT(["$CONFIG_LT"], +[# Run this file to recreate a libtool stub with the current configuration.]) + +cat >>"$CONFIG_LT" <<\_LTEOF +lt_cl_silent=false +exec AS_MESSAGE_LOG_FD>>config.log +{ + echo + AS_BOX([Running $as_me.]) +} >&AS_MESSAGE_LOG_FD + +lt_cl_help="\ +\`$as_me' creates a local libtool stub from the current configuration, +for use in further configure time tests before the real libtool is +generated. + +Usage: $[0] [[OPTIONS]] + + -h, --help print this help, then exit + -V, --version print version number, then exit + -q, --quiet do not print progress messages + -d, --debug don't remove temporary files + +Report bugs to ." + +lt_cl_version="\ +m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl +m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION]) +configured by $[0], generated by m4_PACKAGE_STRING. + +Copyright (C) 2010 Free Software Foundation, Inc. +This config.lt script is free software; the Free Software Foundation +gives unlimited permision to copy, distribute and modify it." + +while test $[#] != 0 +do + case $[1] in + --version | --v* | -V ) + echo "$lt_cl_version"; exit 0 ;; + --help | --h* | -h ) + echo "$lt_cl_help"; exit 0 ;; + --debug | --d* | -d ) + debug=: ;; + --quiet | --q* | --silent | --s* | -q ) + lt_cl_silent=: ;; + + -*) AC_MSG_ERROR([unrecognized option: $[1] +Try \`$[0] --help' for more information.]) ;; + + *) AC_MSG_ERROR([unrecognized argument: $[1] +Try \`$[0] --help' for more information.]) ;; + esac + shift +done + +if $lt_cl_silent; then + exec AS_MESSAGE_FD>/dev/null +fi +_LTEOF + +cat >>"$CONFIG_LT" <<_LTEOF +_LT_OUTPUT_LIBTOOL_COMMANDS_INIT +_LTEOF + +cat >>"$CONFIG_LT" <<\_LTEOF +AC_MSG_NOTICE([creating $ofile]) +_LT_OUTPUT_LIBTOOL_COMMANDS +AS_EXIT(0) +_LTEOF +chmod +x "$CONFIG_LT" + +# configure is writing to config.log, but config.lt does its own redirection, +# appending to config.log, which fails on DOS, as config.log is still kept +# open by configure. Here we exec the FD to /dev/null, effectively closing +# config.log, so it can be properly (re)opened and appended to by config.lt. +lt_cl_success=: +test "$silent" = yes && + lt_config_lt_args="$lt_config_lt_args --quiet" +exec AS_MESSAGE_LOG_FD>/dev/null +$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false +exec AS_MESSAGE_LOG_FD>>config.log +$lt_cl_success || AS_EXIT(1) +])# LT_OUTPUT + + +# _LT_CONFIG(TAG) +# --------------- +# If TAG is the built-in tag, create an initial libtool script with a +# default configuration from the untagged config vars. Otherwise add code +# to config.status for appending the configuration named by TAG from the +# matching tagged config vars. +m4_defun([_LT_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_CONFIG_SAVE_COMMANDS([ + m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl + m4_if(_LT_TAG, [C], [ + # See if we are running on zsh, and set the options which allow our + # commands through without removal of \ escapes. + if test -n "${ZSH_VERSION+set}" ; then + setopt NO_GLOB_SUBST + fi + + cfgfile="${ofile}T" + trap "$RM \"$cfgfile\"; exit 1" 1 2 15 + $RM "$cfgfile" + + cat <<_LT_EOF >> "$cfgfile" +#! $SHELL + +# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services. +# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION +# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`: +# NOTE: Changes made to this file will be lost: look at ltmain.sh. +# +_LT_COPYING +_LT_LIBTOOL_TAGS + +# ### BEGIN LIBTOOL CONFIG +_LT_LIBTOOL_CONFIG_VARS +_LT_LIBTOOL_TAG_VARS +# ### END LIBTOOL CONFIG + +_LT_EOF + + case $host_os in + aix3*) + cat <<\_LT_EOF >> "$cfgfile" +# AIX sometimes has problems with the GCC collect2 program. For some +# reason, if we set the COLLECT_NAMES environment variable, the problems +# vanish in a puff of smoke. +if test "X${COLLECT_NAMES+set}" != Xset; then + COLLECT_NAMES= + export COLLECT_NAMES +fi +_LT_EOF + ;; + esac + + _LT_PROG_LTMAIN + + # We use sed instead of cat because bash on DJGPP gets confused if + # if finds mixed CR/LF and LF-only lines. Since sed operates in + # text mode, it properly converts lines to CR/LF. This bash problem + # is reportedly fixed, but why not run on old versions too? + sed '$q' "$ltmain" >> "$cfgfile" \ + || (rm -f "$cfgfile"; exit 1) + + _LT_PROG_REPLACE_SHELLFNS + + mv -f "$cfgfile" "$ofile" || + (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile") + chmod +x "$ofile" +], +[cat <<_LT_EOF >> "$ofile" + +dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded +dnl in a comment (ie after a #). +# ### BEGIN LIBTOOL TAG CONFIG: $1 +_LT_LIBTOOL_TAG_VARS(_LT_TAG) +# ### END LIBTOOL TAG CONFIG: $1 +_LT_EOF +])dnl /m4_if +], +[m4_if([$1], [], [ + PACKAGE='$PACKAGE' + VERSION='$VERSION' + TIMESTAMP='$TIMESTAMP' + RM='$RM' + ofile='$ofile'], []) +])dnl /_LT_CONFIG_SAVE_COMMANDS +])# _LT_CONFIG + + +# LT_SUPPORTED_TAG(TAG) +# --------------------- +# Trace this macro to discover what tags are supported by the libtool +# --tag option, using: +# autoconf --trace 'LT_SUPPORTED_TAG:$1' +AC_DEFUN([LT_SUPPORTED_TAG], []) + + +# C support is built-in for now +m4_define([_LT_LANG_C_enabled], []) +m4_define([_LT_TAGS], []) + + +# LT_LANG(LANG) +# ------------- +# Enable libtool support for the given language if not already enabled. +AC_DEFUN([LT_LANG], +[AC_BEFORE([$0], [LT_OUTPUT])dnl +m4_case([$1], + [C], [_LT_LANG(C)], + [C++], [_LT_LANG(CXX)], + [Java], [_LT_LANG(GCJ)], + [Fortran 77], [_LT_LANG(F77)], + [Fortran], [_LT_LANG(FC)], + [Windows Resource], [_LT_LANG(RC)], + [m4_ifdef([_LT_LANG_]$1[_CONFIG], + [_LT_LANG($1)], + [m4_fatal([$0: unsupported language: "$1"])])])dnl +])# LT_LANG + + +# _LT_LANG(LANGNAME) +# ------------------ +m4_defun([_LT_LANG], +[m4_ifdef([_LT_LANG_]$1[_enabled], [], + [LT_SUPPORTED_TAG([$1])dnl + m4_append([_LT_TAGS], [$1 ])dnl + m4_define([_LT_LANG_]$1[_enabled], [])dnl + _LT_LANG_$1_CONFIG($1)])dnl +])# _LT_LANG + + +# _LT_LANG_DEFAULT_CONFIG +# ----------------------- +m4_defun([_LT_LANG_DEFAULT_CONFIG], +[AC_PROVIDE_IFELSE([AC_PROG_CXX], + [LT_LANG(CXX)], + [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])]) + +AC_PROVIDE_IFELSE([AC_PROG_F77], + [LT_LANG(F77)], + [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])]) + +AC_PROVIDE_IFELSE([AC_PROG_FC], + [LT_LANG(FC)], + [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])]) + +dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal +dnl pulling things in needlessly. +AC_PROVIDE_IFELSE([AC_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([A][M_PROG_GCJ], + [LT_LANG(GCJ)], + [AC_PROVIDE_IFELSE([LT_PROG_GCJ], + [LT_LANG(GCJ)], + [m4_ifdef([AC_PROG_GCJ], + [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([A][M_PROG_GCJ], + [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])]) + m4_ifdef([LT_PROG_GCJ], + [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])]) + +AC_PROVIDE_IFELSE([LT_PROG_RC], + [LT_LANG(RC)], + [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])]) +])# _LT_LANG_DEFAULT_CONFIG + +# Obsolete macros: +AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)]) +AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)]) +AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)]) +AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)]) +AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_CXX], []) +dnl AC_DEFUN([AC_LIBTOOL_F77], []) +dnl AC_DEFUN([AC_LIBTOOL_FC], []) +dnl AC_DEFUN([AC_LIBTOOL_GCJ], []) +dnl AC_DEFUN([AC_LIBTOOL_RC], []) + + +# _LT_TAG_COMPILER +# ---------------- +m4_defun([_LT_TAG_COMPILER], +[AC_REQUIRE([AC_PROG_CC])dnl + +_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl +_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl +_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl +_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl + +# If no C compiler was specified, use CC. +LTCC=${LTCC-"$CC"} + +# If no C compiler flags were specified, use CFLAGS. +LTCFLAGS=${LTCFLAGS-"$CFLAGS"} + +# Allow CC to be a program name with arguments. +compiler=$CC +])# _LT_TAG_COMPILER + + +# _LT_COMPILER_BOILERPLATE +# ------------------------ +# Check for compiler boilerplate output or warnings with +# the simple compiler test code. +m4_defun([_LT_COMPILER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_compile_test_code" >conftest.$ac_ext +eval "$ac_compile" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_compiler_boilerplate=`cat conftest.err` +$RM conftest* +])# _LT_COMPILER_BOILERPLATE + + +# _LT_LINKER_BOILERPLATE +# ---------------------- +# Check for linker boilerplate output or warnings with +# the simple link test code. +m4_defun([_LT_LINKER_BOILERPLATE], +[m4_require([_LT_DECL_SED])dnl +ac_outfile=conftest.$ac_objext +echo "$lt_simple_link_test_code" >conftest.$ac_ext +eval "$ac_link" 2>&1 >/dev/null | $SED '/^$/d; /^ *+/d' >conftest.err +_lt_linker_boilerplate=`cat conftest.err` +$RM -r conftest* +])# _LT_LINKER_BOILERPLATE + +# _LT_REQUIRED_DARWIN_CHECKS +# ------------------------- +m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[ + case $host_os in + rhapsody* | darwin*) + AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:]) + AC_CHECK_TOOL([NMEDIT], [nmedit], [:]) + AC_CHECK_TOOL([LIPO], [lipo], [:]) + AC_CHECK_TOOL([OTOOL], [otool], [:]) + AC_CHECK_TOOL([OTOOL64], [otool64], [:]) + _LT_DECL([], [DSYMUTIL], [1], + [Tool to manipulate archived DWARF debug symbol files on Mac OS X]) + _LT_DECL([], [NMEDIT], [1], + [Tool to change global to local symbols on Mac OS X]) + _LT_DECL([], [LIPO], [1], + [Tool to manipulate fat objects and archives on Mac OS X]) + _LT_DECL([], [OTOOL], [1], + [ldd/readelf like tool for Mach-O binaries on Mac OS X]) + _LT_DECL([], [OTOOL64], [1], + [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4]) + + AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod], + [lt_cv_apple_cc_single_mod=no + if test -z "${LT_MULTI_MODULE}"; then + # By default we will add the -single_module flag. You can override + # by either setting the environment variable LT_MULTI_MODULE + # non-empty at configure time, or by adding -multi_module to the + # link flags. + rm -rf libconftest.dylib* + echo "int foo(void){return 1;}" > conftest.c + echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ +-dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \ + -dynamiclib -Wl,-single_module conftest.c 2>conftest.err + _lt_result=$? + if test -f libconftest.dylib && test ! -s conftest.err && test $_lt_result = 0; then + lt_cv_apple_cc_single_mod=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -rf libconftest.dylib* + rm -f conftest.* + fi]) + AC_CACHE_CHECK([for -exported_symbols_list linker flag], + [lt_cv_ld_exported_symbols_list], + [lt_cv_ld_exported_symbols_list=no + save_LDFLAGS=$LDFLAGS + echo "_main" > conftest.sym + LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [lt_cv_ld_exported_symbols_list=yes], + [lt_cv_ld_exported_symbols_list=no]) + LDFLAGS="$save_LDFLAGS" + ]) + AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load], + [lt_cv_ld_force_load=no + cat > conftest.c << _LT_EOF +int forced_loaded() { return 2;} +_LT_EOF + echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD + echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD + $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD + echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD + $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD + cat > conftest.c << _LT_EOF +int main() { return 0;} +_LT_EOF + echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD + $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err + _lt_result=$? + if test -f conftest && test ! -s conftest.err && test $_lt_result = 0 && $GREP forced_load conftest 2>&1 >/dev/null; then + lt_cv_ld_force_load=yes + else + cat conftest.err >&AS_MESSAGE_LOG_FD + fi + rm -f conftest.err libconftest.a conftest conftest.c + rm -rf conftest.dSYM + ]) + case $host_os in + rhapsody* | darwin1.[[012]]) + _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;; + darwin1.*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + darwin*) # darwin 5.x on + # if running on 10.5 or later, the deployment target defaults + # to the OS version, if on x86, and 10.4, the deployment + # target defaults to 10.4. Don't you love it? + case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in + 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + 10.[[012]]*) + _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;; + 10.*) + _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;; + esac + ;; + esac + if test "$lt_cv_apple_cc_single_mod" = "yes"; then + _lt_dar_single_mod='$single_module' + fi + if test "$lt_cv_ld_exported_symbols_list" = "yes"; then + _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym' + else + _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}' + fi + if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then + _lt_dsymutil='~$DSYMUTIL $lib || :' + else + _lt_dsymutil= + fi + ;; + esac +]) + + +# _LT_DARWIN_LINKER_FEATURES +# -------------------------- +# Checks for linker and compiler features on darwin +m4_defun([_LT_DARWIN_LINKER_FEATURES], +[ + m4_require([_LT_REQUIRED_DARWIN_CHECKS]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_automatic, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + if test "$lt_cv_ld_force_load" = "yes"; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='' + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)="$_lt_dar_allow_undefined" + case $cc_basename in + ifort*) _lt_dar_can_shared=yes ;; + *) _lt_dar_can_shared=$GCC ;; + esac + if test "$_lt_dar_can_shared" = "yes"; then + output_verbose_link_cmd=func_echo_all + _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}" + _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring ${_lt_dar_single_mod}${_lt_dar_export_syms}${_lt_dsymutil}" + _LT_TAGVAR(module_expsym_cmds, $1)="sed -e 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dar_export_syms}${_lt_dsymutil}" + m4_if([$1], [CXX], +[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then + _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}" + _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}" + fi +],[]) + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi +]) + +# _LT_SYS_MODULE_PATH_AIX([TAGNAME]) +# ---------------------------------- +# Links a minimal program and checks the executable +# for the system default hardcoded library path. In most cases, +# this is /usr/lib:/lib, but when the MPI compilers are used +# the location of the communication and MPI libs are included too. +# If we don't find anything, use the default library path according +# to the aix ld manual. +# Store the results from the different compilers for each TAGNAME. +# Allow to override them for all tags through lt_cv_aix_libpath. +m4_defun([_LT_SYS_MODULE_PATH_AIX], +[m4_require([_LT_DECL_SED])dnl +if test "${lt_cv_aix_libpath+set}" = set; then + aix_libpath=$lt_cv_aix_libpath +else + AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])], + [AC_LINK_IFELSE([AC_LANG_PROGRAM],[ + lt_aix_libpath_sed='[ + /Import File Strings/,/^$/ { + /^0/ { + s/^0 *\([^ ]*\) *$/\1/ + p + } + }]' + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -H conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + # Check for a 64-bit object if we didn't find anything. + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"` + fi],[]) + if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then + _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib" + fi + ]) + aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1]) +fi +])# _LT_SYS_MODULE_PATH_AIX + + +# _LT_SHELL_INIT(ARG) +# ------------------- +m4_define([_LT_SHELL_INIT], +[m4_divert_text([M4SH-INIT], [$1 +])])# _LT_SHELL_INIT + + + +# _LT_PROG_ECHO_BACKSLASH +# ----------------------- +# Find how we can fake an echo command that does not interpret backslash. +# In particular, with Autoconf 2.60 or later we add some code to the start +# of the generated configure script which will find a shell with a builtin +# printf (which we can use as an echo command). +m4_defun([_LT_PROG_ECHO_BACKSLASH], +[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO +ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + +AC_MSG_CHECKING([how to print strings]) +# Test print first, because it will be a builtin if present. +if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \ + test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='print -r --' +elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then + ECHO='printf %s\n' +else + # Use this function as a fallback that always works. + func_fallback_echo () + { + eval 'cat <<_LTECHO_EOF +$[]1 +_LTECHO_EOF' + } + ECHO='func_fallback_echo' +fi + +# func_echo_all arg... +# Invoke $ECHO with all args, space-separated. +func_echo_all () +{ + $ECHO "$*" +} + +case "$ECHO" in + printf*) AC_MSG_RESULT([printf]) ;; + print*) AC_MSG_RESULT([print -r]) ;; + *) AC_MSG_RESULT([cat]) ;; +esac + +m4_ifdef([_AS_DETECT_SUGGESTED], +[_AS_DETECT_SUGGESTED([ + test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || ( + ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\' + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO + ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO + PATH=/empty FPATH=/empty; export PATH FPATH + test "X`printf %s $ECHO`" = "X$ECHO" \ + || test "X`print -r -- $ECHO`" = "X$ECHO" )])]) + +_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts]) +_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes]) +])# _LT_PROG_ECHO_BACKSLASH + + +# _LT_WITH_SYSROOT +# ---------------- +AC_DEFUN([_LT_WITH_SYSROOT], +[AC_MSG_CHECKING([for sysroot]) +AC_ARG_WITH([sysroot], +[ --with-sysroot[=DIR] Search for dependent libraries within DIR + (or the compiler's sysroot if not specified).], +[], [with_sysroot=no]) + +dnl lt_sysroot will always be passed unquoted. We quote it here +dnl in case the user passed a directory name. +lt_sysroot= +case ${with_sysroot} in #( + yes) + if test "$GCC" = yes; then + lt_sysroot=`$CC --print-sysroot 2>/dev/null` + fi + ;; #( + /*) + lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"` + ;; #( + no|'') + ;; #( + *) + AC_MSG_RESULT([${with_sysroot}]) + AC_MSG_ERROR([The sysroot must be an absolute path.]) + ;; +esac + + AC_MSG_RESULT([${lt_sysroot:-no}]) +_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl +[dependent libraries, and in which our libraries should be installed.])]) + +# _LT_ENABLE_LOCK +# --------------- +m4_defun([_LT_ENABLE_LOCK], +[AC_ARG_ENABLE([libtool-lock], + [AS_HELP_STRING([--disable-libtool-lock], + [avoid locking (might break parallel builds)])]) +test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes + +# Some flags need to be propagated to the compiler or linker for good +# libtool support. +case $host in +ia64-*-hpux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.$ac_objext` in + *ELF-32*) + HPUX_IA64_MODE="32" + ;; + *ELF-64*) + HPUX_IA64_MODE="64" + ;; + esac + fi + rm -rf conftest* + ;; +*-*-irix6*) + # Find out which ABI we are using. + echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + if test "$lt_cv_prog_gnu_ld" = yes; then + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -melf32bsmip" + ;; + *N32*) + LD="${LD-ld} -melf32bmipn32" + ;; + *64-bit*) + LD="${LD-ld} -melf64bmip" + ;; + esac + else + case `/usr/bin/file conftest.$ac_objext` in + *32-bit*) + LD="${LD-ld} -32" + ;; + *N32*) + LD="${LD-ld} -n32" + ;; + *64-bit*) + LD="${LD-ld} -64" + ;; + esac + fi + fi + rm -rf conftest* + ;; + +x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \ +s390*-*linux*|s390*-*tpf*|sparc*-*linux*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *32-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_i386_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_i386" + ;; + ppc64-*linux*|powerpc64-*linux*) + LD="${LD-ld} -m elf32ppclinux" + ;; + s390x-*linux*) + LD="${LD-ld} -m elf_s390" + ;; + sparc64-*linux*) + LD="${LD-ld} -m elf32_sparc" + ;; + esac + ;; + *64-bit*) + case $host in + x86_64-*kfreebsd*-gnu) + LD="${LD-ld} -m elf_x86_64_fbsd" + ;; + x86_64-*linux*) + LD="${LD-ld} -m elf_x86_64" + ;; + ppc*-*linux*|powerpc*-*linux*) + LD="${LD-ld} -m elf64ppc" + ;; + s390*-*linux*|s390*-*tpf*) + LD="${LD-ld} -m elf64_s390" + ;; + sparc*-*linux*) + LD="${LD-ld} -m elf64_sparc" + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; + +*-*-sco3.2v5*) + # On SCO OpenServer 5, we need -belf to get full-featured binaries. + SAVE_CFLAGS="$CFLAGS" + CFLAGS="$CFLAGS -belf" + AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf, + [AC_LANG_PUSH(C) + AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no]) + AC_LANG_POP]) + if test x"$lt_cv_cc_needs_belf" != x"yes"; then + # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf + CFLAGS="$SAVE_CFLAGS" + fi + ;; +sparc*-*solaris*) + # Find out which ABI we are using. + echo 'int i;' > conftest.$ac_ext + if AC_TRY_EVAL(ac_compile); then + case `/usr/bin/file conftest.o` in + *64-bit*) + case $lt_cv_prog_gnu_ld in + yes*) LD="${LD-ld} -m elf64_sparc" ;; + *) + if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then + LD="${LD-ld} -64" + fi + ;; + esac + ;; + esac + fi + rm -rf conftest* + ;; +esac + +need_locks="$enable_libtool_lock" +])# _LT_ENABLE_LOCK + + +# _LT_PROG_AR +# ----------- +m4_defun([_LT_PROG_AR], +[AC_CHECK_TOOLS(AR, [ar], false) +: ${AR=ar} +: ${AR_FLAGS=cru} +_LT_DECL([], [AR], [1], [The archiver]) +_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive]) + +AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file], + [lt_cv_ar_at_file=no + AC_COMPILE_IFELSE([AC_LANG_PROGRAM], + [echo conftest.$ac_objext > conftest.lst + lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD' + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -eq 0; then + # Ensure the archiver fails upon bogus file names. + rm -f conftest.$ac_objext libconftest.a + AC_TRY_EVAL([lt_ar_try]) + if test "$ac_status" -ne 0; then + lt_cv_ar_at_file=@ + fi + fi + rm -f conftest.* libconftest.a + ]) + ]) + +if test "x$lt_cv_ar_at_file" = xno; then + archiver_list_spec= +else + archiver_list_spec=$lt_cv_ar_at_file +fi +_LT_DECL([], [archiver_list_spec], [1], + [How to feed a file listing to the archiver]) +])# _LT_PROG_AR + + +# _LT_CMD_OLD_ARCHIVE +# ------------------- +m4_defun([_LT_CMD_OLD_ARCHIVE], +[_LT_PROG_AR + +AC_CHECK_TOOL(STRIP, strip, :) +test -z "$STRIP" && STRIP=: +_LT_DECL([], [STRIP], [1], [A symbol stripping program]) + +AC_CHECK_TOOL(RANLIB, ranlib, :) +test -z "$RANLIB" && RANLIB=: +_LT_DECL([], [RANLIB], [1], + [Commands used to install an old-style archive]) + +# Determine commands to create old-style static archives. +old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs' +old_postinstall_cmds='chmod 644 $oldlib' +old_postuninstall_cmds= + +if test -n "$RANLIB"; then + case $host_os in + openbsd*) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib" + ;; + *) + old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib" + ;; + esac + old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib" +fi + +case $host_os in + darwin*) + lock_old_archive_extraction=yes ;; + *) + lock_old_archive_extraction=no ;; +esac +_LT_DECL([], [old_postinstall_cmds], [2]) +_LT_DECL([], [old_postuninstall_cmds], [2]) +_LT_TAGDECL([], [old_archive_cmds], [2], + [Commands used to build an old-style archive]) +_LT_DECL([], [lock_old_archive_extraction], [0], + [Whether to use a lock for old archive extraction]) +])# _LT_CMD_OLD_ARCHIVE + + +# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------------------- +# Check whether the given compiler option works +AC_DEFUN([_LT_COMPILER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4]) + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + lt_compiler_flag="$3" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + # The option is referenced via a variable to avoid confusing sed. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>conftest.err) + ac_status=$? + cat conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s "$ac_outfile"; then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings other than the usual output. + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' >conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + fi + $RM conftest* +]) + +if test x"[$]$2" = xyes; then + m4_if([$5], , :, [$5]) +else + m4_if([$6], , :, [$6]) +fi +])# _LT_COMPILER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], []) + + +# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS, +# [ACTION-SUCCESS], [ACTION-FAILURE]) +# ---------------------------------------------------- +# Check whether the given linker option works +AC_DEFUN([_LT_LINKER_OPTION], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_SED])dnl +AC_CACHE_CHECK([$1], [$2], + [$2=no + save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS $3" + echo "$lt_simple_link_test_code" > conftest.$ac_ext + if (eval $ac_link 2>conftest.err) && test -s conftest$ac_exeext; then + # The linker can only warn and ignore the option if not recognized + # So say no if there are warnings + if test -s conftest.err; then + # Append any errors to the config.log. + cat conftest.err 1>&AS_MESSAGE_LOG_FD + $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp + $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2 + if diff conftest.exp conftest.er2 >/dev/null; then + $2=yes + fi + else + $2=yes + fi + fi + $RM -r conftest* + LDFLAGS="$save_LDFLAGS" +]) + +if test x"[$]$2" = xyes; then + m4_if([$4], , :, [$4]) +else + m4_if([$5], , :, [$5]) +fi +])# _LT_LINKER_OPTION + +# Old name: +AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], []) + + +# LT_CMD_MAX_LEN +#--------------- +AC_DEFUN([LT_CMD_MAX_LEN], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +# find the maximum length of command line arguments +AC_MSG_CHECKING([the maximum length of command line arguments]) +AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl + i=0 + teststring="ABCD" + + case $build_os in + msdosdjgpp*) + # On DJGPP, this test can blow up pretty badly due to problems in libc + # (any single argument exceeding 2000 bytes causes a buffer overrun + # during glob expansion). Even if it were fixed, the result of this + # check would be larger than it should be. + lt_cv_sys_max_cmd_len=12288; # 12K is about right + ;; + + gnu*) + # Under GNU Hurd, this test is not required because there is + # no limit to the length of command line arguments. + # Libtool will interpret -1 as no limit whatsoever + lt_cv_sys_max_cmd_len=-1; + ;; + + cygwin* | mingw* | cegcc*) + # On Win9x/ME, this test blows up -- it succeeds, but takes + # about 5 minutes as the teststring grows exponentially. + # Worse, since 9x/ME are not pre-emptively multitasking, + # you end up with a "frozen" computer, even though with patience + # the test eventually succeeds (with a max line length of 256k). + # Instead, let's just punt: use the minimum linelength reported by + # all of the supported platforms: 8192 (on NT/2K/XP). + lt_cv_sys_max_cmd_len=8192; + ;; + + mint*) + # On MiNT this can take a long time and run out of memory. + lt_cv_sys_max_cmd_len=8192; + ;; + + amigaos*) + # On AmigaOS with pdksh, this test takes hours, literally. + # So we just punt and use a minimum line length of 8192. + lt_cv_sys_max_cmd_len=8192; + ;; + + netbsd* | freebsd* | openbsd* | darwin* | dragonfly*) + # This has been around since 386BSD, at least. Likely further. + if test -x /sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax` + elif test -x /usr/sbin/sysctl; then + lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax` + else + lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs + fi + # And add a safety zone + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + ;; + + interix*) + # We know the value 262144 and hardcode it with a safety zone (like BSD) + lt_cv_sys_max_cmd_len=196608 + ;; + + osf*) + # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure + # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not + # nice to cause kernel panics so lets avoid the loop below. + # First set a reasonable default. + lt_cv_sys_max_cmd_len=16384 + # + if test -x /sbin/sysconfig; then + case `/sbin/sysconfig -q proc exec_disable_arg_limit` in + *1*) lt_cv_sys_max_cmd_len=-1 ;; + esac + fi + ;; + sco3.2v5*) + lt_cv_sys_max_cmd_len=102400 + ;; + sysv5* | sco5v6* | sysv4.2uw2*) + kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null` + if test -n "$kargmax"; then + lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'` + else + lt_cv_sys_max_cmd_len=32768 + fi + ;; + *) + lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null` + if test -n "$lt_cv_sys_max_cmd_len"; then + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4` + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3` + else + # Make teststring a little bigger before we do anything with it. + # a 1K string should be a reasonable start. + for i in 1 2 3 4 5 6 7 8 ; do + teststring=$teststring$teststring + done + SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}} + # If test is not a shell built-in, we'll probably end up computing a + # maximum length that is only half of the actual maximum length, but + # we can't tell. + while { test "X"`func_fallback_echo "$teststring$teststring" 2>/dev/null` \ + = "X$teststring$teststring"; } >/dev/null 2>&1 && + test $i != 17 # 1/2 MB should be enough + do + i=`expr $i + 1` + teststring=$teststring$teststring + done + # Only check the string length outside the loop. + lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1` + teststring= + # Add a significant safety factor because C++ compilers can tack on + # massive amounts of additional arguments before passing them to the + # linker. It appears as though 1/2 is a usable value. + lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2` + fi + ;; + esac +]) +if test -n $lt_cv_sys_max_cmd_len ; then + AC_MSG_RESULT($lt_cv_sys_max_cmd_len) +else + AC_MSG_RESULT(none) +fi +max_cmd_len=$lt_cv_sys_max_cmd_len +_LT_DECL([], [max_cmd_len], [0], + [What is the maximum length of a command?]) +])# LT_CMD_MAX_LEN + +# Old name: +AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], []) + + +# _LT_HEADER_DLFCN +# ---------------- +m4_defun([_LT_HEADER_DLFCN], +[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl +])# _LT_HEADER_DLFCN + + +# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE, +# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING) +# ---------------------------------------------------------------- +m4_defun([_LT_TRY_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "$cross_compiling" = yes; then : + [$4] +else + lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2 + lt_status=$lt_dlunknown + cat > conftest.$ac_ext <<_LT_EOF +[#line $LINENO "configure" +#include "confdefs.h" + +#if HAVE_DLFCN_H +#include +#endif + +#include + +#ifdef RTLD_GLOBAL +# define LT_DLGLOBAL RTLD_GLOBAL +#else +# ifdef DL_GLOBAL +# define LT_DLGLOBAL DL_GLOBAL +# else +# define LT_DLGLOBAL 0 +# endif +#endif + +/* We may have to define LT_DLLAZY_OR_NOW in the command line if we + find out it does not work in some platform. */ +#ifndef LT_DLLAZY_OR_NOW +# ifdef RTLD_LAZY +# define LT_DLLAZY_OR_NOW RTLD_LAZY +# else +# ifdef DL_LAZY +# define LT_DLLAZY_OR_NOW DL_LAZY +# else +# ifdef RTLD_NOW +# define LT_DLLAZY_OR_NOW RTLD_NOW +# else +# ifdef DL_NOW +# define LT_DLLAZY_OR_NOW DL_NOW +# else +# define LT_DLLAZY_OR_NOW 0 +# endif +# endif +# endif +# endif +#endif + +/* When -fvisbility=hidden is used, assume the code has been annotated + correspondingly for the symbols needed. */ +#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3)) +int fnord () __attribute__((visibility("default"))); +#endif + +int fnord () { return 42; } +int main () +{ + void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW); + int status = $lt_dlunknown; + + if (self) + { + if (dlsym (self,"fnord")) status = $lt_dlno_uscore; + else + { + if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore; + else puts (dlerror ()); + } + /* dlclose (self); */ + } + else + puts (dlerror ()); + + return status; +}] +_LT_EOF + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then + (./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null + lt_status=$? + case x$lt_status in + x$lt_dlno_uscore) $1 ;; + x$lt_dlneed_uscore) $2 ;; + x$lt_dlunknown|x*) $3 ;; + esac + else : + # compilation failed + $3 + fi +fi +rm -fr conftest* +])# _LT_TRY_DLOPEN_SELF + + +# LT_SYS_DLOPEN_SELF +# ------------------ +AC_DEFUN([LT_SYS_DLOPEN_SELF], +[m4_require([_LT_HEADER_DLFCN])dnl +if test "x$enable_dlopen" != xyes; then + enable_dlopen=unknown + enable_dlopen_self=unknown + enable_dlopen_self_static=unknown +else + lt_cv_dlopen=no + lt_cv_dlopen_libs= + + case $host_os in + beos*) + lt_cv_dlopen="load_add_on" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ;; + + mingw* | pw32* | cegcc*) + lt_cv_dlopen="LoadLibrary" + lt_cv_dlopen_libs= + ;; + + cygwin*) + lt_cv_dlopen="dlopen" + lt_cv_dlopen_libs= + ;; + + darwin*) + # if libdl is installed we need to link against it + AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"],[ + lt_cv_dlopen="dyld" + lt_cv_dlopen_libs= + lt_cv_dlopen_self=yes + ]) + ;; + + *) + AC_CHECK_FUNC([shl_load], + [lt_cv_dlopen="shl_load"], + [AC_CHECK_LIB([dld], [shl_load], + [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"], + [AC_CHECK_FUNC([dlopen], + [lt_cv_dlopen="dlopen"], + [AC_CHECK_LIB([dl], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"], + [AC_CHECK_LIB([svld], [dlopen], + [lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"], + [AC_CHECK_LIB([dld], [dld_link], + [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"]) + ]) + ]) + ]) + ]) + ]) + ;; + esac + + if test "x$lt_cv_dlopen" != xno; then + enable_dlopen=yes + else + enable_dlopen=no + fi + + case $lt_cv_dlopen in + dlopen) + save_CPPFLAGS="$CPPFLAGS" + test "x$ac_cv_header_dlfcn_h" = xyes && CPPFLAGS="$CPPFLAGS -DHAVE_DLFCN_H" + + save_LDFLAGS="$LDFLAGS" + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $export_dynamic_flag_spec\" + + save_LIBS="$LIBS" + LIBS="$lt_cv_dlopen_libs $LIBS" + + AC_CACHE_CHECK([whether a program can dlopen itself], + lt_cv_dlopen_self, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes, + lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross) + ]) + + if test "x$lt_cv_dlopen_self" = xyes; then + wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\" + AC_CACHE_CHECK([whether a statically linked program can dlopen itself], + lt_cv_dlopen_self_static, [dnl + _LT_TRY_DLOPEN_SELF( + lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes, + lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross) + ]) + fi + + CPPFLAGS="$save_CPPFLAGS" + LDFLAGS="$save_LDFLAGS" + LIBS="$save_LIBS" + ;; + esac + + case $lt_cv_dlopen_self in + yes|no) enable_dlopen_self=$lt_cv_dlopen_self ;; + *) enable_dlopen_self=unknown ;; + esac + + case $lt_cv_dlopen_self_static in + yes|no) enable_dlopen_self_static=$lt_cv_dlopen_self_static ;; + *) enable_dlopen_self_static=unknown ;; + esac +fi +_LT_DECL([dlopen_support], [enable_dlopen], [0], + [Whether dlopen is supported]) +_LT_DECL([dlopen_self], [enable_dlopen_self], [0], + [Whether dlopen of programs is supported]) +_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0], + [Whether dlopen of statically linked programs is supported]) +])# LT_SYS_DLOPEN_SELF + +# Old name: +AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], []) + + +# _LT_COMPILER_C_O([TAGNAME]) +# --------------------------- +# Check to see if options -c and -o are simultaneously supported by compiler. +# This macro does not hard code the compiler like AC_PROG_CC_C_O. +m4_defun([_LT_COMPILER_C_O], +[m4_require([_LT_DECL_SED])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no + $RM -r conftest 2>/dev/null + mkdir conftest + cd conftest + mkdir out + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + lt_compiler_flag="-o out/conftest2.$ac_objext" + # Insert the option either (1) after the last *FLAGS variable, or + # (2) before a word containing "conftest.", or (3) at the end. + # Note that $ac_compile itself does not contain backslashes and begins + # with a dollar sign (not a hyphen), so the echo should work correctly. + lt_compile=`echo "$ac_compile" | $SED \ + -e 's:.*FLAGS}\{0,1\} :&$lt_compiler_flag :; t' \ + -e 's: [[^ ]]*conftest\.: $lt_compiler_flag&:; t' \ + -e 's:$: $lt_compiler_flag:'` + (eval echo "\"\$as_me:$LINENO: $lt_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$lt_compile" 2>out/conftest.err) + ac_status=$? + cat out/conftest.err >&AS_MESSAGE_LOG_FD + echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD + if (exit $ac_status) && test -s out/conftest2.$ac_objext + then + # The compiler can only warn and ignore the option if not recognized + # So say no if there are warnings + $ECHO "$_lt_compiler_boilerplate" | $SED '/^$/d' > out/conftest.exp + $SED '/^$/d; /^ *+/d' out/conftest.err >out/conftest.er2 + if test ! -s out/conftest.er2 || diff out/conftest.exp out/conftest.er2 >/dev/null; then + _LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + fi + fi + chmod u+w . 2>&AS_MESSAGE_LOG_FD + $RM conftest* + # SGI C++ compiler will create directory out/ii_files/ for + # template instantiation + test -d out/ii_files && $RM out/ii_files/* && rmdir out/ii_files + $RM out/* && rmdir out + cd .. + $RM -r conftest + $RM conftest* +]) +_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1], + [Does compiler simultaneously support -c and -o options?]) +])# _LT_COMPILER_C_O + + +# _LT_COMPILER_FILE_LOCKS([TAGNAME]) +# ---------------------------------- +# Check to see if we can do hard links to lock some files if needed +m4_defun([_LT_COMPILER_FILE_LOCKS], +[m4_require([_LT_ENABLE_LOCK])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +_LT_COMPILER_C_O([$1]) + +hard_links="nottested" +if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then + # do not overwrite the value of need_locks provided by the user + AC_MSG_CHECKING([if we can lock with hard links]) + hard_links=yes + $RM conftest* + ln conftest.a conftest.b 2>/dev/null && hard_links=no + touch conftest.a + ln conftest.a conftest.b 2>&5 || hard_links=no + ln conftest.a conftest.b 2>/dev/null && hard_links=no + AC_MSG_RESULT([$hard_links]) + if test "$hard_links" = no; then + AC_MSG_WARN([`$CC' does not support `-c -o', so `make -j' may be unsafe]) + need_locks=warn + fi +else + need_locks=no +fi +_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?]) +])# _LT_COMPILER_FILE_LOCKS + + +# _LT_CHECK_OBJDIR +# ---------------- +m4_defun([_LT_CHECK_OBJDIR], +[AC_CACHE_CHECK([for objdir], [lt_cv_objdir], +[rm -f .libs 2>/dev/null +mkdir .libs 2>/dev/null +if test -d .libs; then + lt_cv_objdir=.libs +else + # MS-DOS does not allow filenames that begin with a dot. + lt_cv_objdir=_libs +fi +rmdir .libs 2>/dev/null]) +objdir=$lt_cv_objdir +_LT_DECL([], [objdir], [0], + [The name of the directory that contains temporary libtool files])dnl +m4_pattern_allow([LT_OBJDIR])dnl +AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/", + [Define to the sub-directory in which libtool stores uninstalled libraries.]) +])# _LT_CHECK_OBJDIR + + +# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME]) +# -------------------------------------- +# Check hardcoding attributes. +m4_defun([_LT_LINKER_HARDCODE_LIBPATH], +[AC_MSG_CHECKING([how to hardcode library paths into programs]) +_LT_TAGVAR(hardcode_action, $1)= +if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" || + test -n "$_LT_TAGVAR(runpath_var, $1)" || + test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then + + # We can hardcode non-existent directories. + if test "$_LT_TAGVAR(hardcode_direct, $1)" != no && + # If the only mechanism to avoid hardcoding is shlibpath_var, we + # have to relink, otherwise we might link with an installed library + # when we should be linking with a yet-to-be-installed one + ## test "$_LT_TAGVAR(hardcode_shlibpath_var, $1)" != no && + test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then + # Linking always hardcodes the temporary library directory. + _LT_TAGVAR(hardcode_action, $1)=relink + else + # We can link without hardcoding, and we can hardcode nonexisting dirs. + _LT_TAGVAR(hardcode_action, $1)=immediate + fi +else + # We cannot hardcode anything, or else we can only hardcode existing + # directories. + _LT_TAGVAR(hardcode_action, $1)=unsupported +fi +AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)]) + +if test "$_LT_TAGVAR(hardcode_action, $1)" = relink || + test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then + # Fast installation is not supported + enable_fast_install=no +elif test "$shlibpath_overrides_runpath" = yes || + test "$enable_shared" = no; then + # Fast installation is not necessary + enable_fast_install=needless +fi +_LT_TAGDECL([], [hardcode_action], [0], + [How to hardcode a shared library path into an executable]) +])# _LT_LINKER_HARDCODE_LIBPATH + + +# _LT_CMD_STRIPLIB +# ---------------- +m4_defun([_LT_CMD_STRIPLIB], +[m4_require([_LT_DECL_EGREP]) +striplib= +old_striplib= +AC_MSG_CHECKING([whether stripping libraries is possible]) +if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then + test -z "$old_striplib" && old_striplib="$STRIP --strip-debug" + test -z "$striplib" && striplib="$STRIP --strip-unneeded" + AC_MSG_RESULT([yes]) +else +# FIXME - insert some real tests, host_os isn't really good enough + case $host_os in + darwin*) + if test -n "$STRIP" ; then + striplib="$STRIP -x" + old_striplib="$STRIP -S" + AC_MSG_RESULT([yes]) + else + AC_MSG_RESULT([no]) + fi + ;; + *) + AC_MSG_RESULT([no]) + ;; + esac +fi +_LT_DECL([], [old_striplib], [1], [Commands to strip libraries]) +_LT_DECL([], [striplib], [1]) +])# _LT_CMD_STRIPLIB + + +# _LT_SYS_DYNAMIC_LINKER([TAG]) +# ----------------------------- +# PORTME Fill in your ld.so characteristics +m4_defun([_LT_SYS_DYNAMIC_LINKER], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_OBJDUMP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CHECK_SHELL_FEATURES])dnl +AC_MSG_CHECKING([dynamic linker characteristics]) +m4_if([$1], + [], [ +if test "$GCC" = yes; then + case $host_os in + darwin*) lt_awk_arg="/^libraries:/,/LR/" ;; + *) lt_awk_arg="/^libraries:/" ;; + esac + case $host_os in + mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;; + *) lt_sed_strip_eq="s,=/,/,g" ;; + esac + lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq` + case $lt_search_path_spec in + *\;*) + # if the path contains ";" then we assume it to be the separator + # otherwise default to the standard path separator (i.e. ":") - it is + # assumed that no part of a normal pathname contains ";" but that should + # okay in the real world where ";" in dirpaths is itself problematic. + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'` + ;; + *) + lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"` + ;; + esac + # Ok, now we have the path, separated by spaces, we can step through it + # and add multilib dir if necessary. + lt_tmp_lt_search_path_spec= + lt_multi_os_dir=`$CC $CPPFLAGS $CFLAGS $LDFLAGS -print-multi-os-directory 2>/dev/null` + for lt_sys_path in $lt_search_path_spec; do + if test -d "$lt_sys_path/$lt_multi_os_dir"; then + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path/$lt_multi_os_dir" + else + test -d "$lt_sys_path" && \ + lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path" + fi + done + lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk ' +BEGIN {RS=" "; FS="/|\n";} { + lt_foo=""; + lt_count=0; + for (lt_i = NF; lt_i > 0; lt_i--) { + if ($lt_i != "" && $lt_i != ".") { + if ($lt_i == "..") { + lt_count++; + } else { + if (lt_count == 0) { + lt_foo="/" $lt_i lt_foo; + } else { + lt_count--; + } + } + } + } + if (lt_foo != "") { lt_freq[[lt_foo]]++; } + if (lt_freq[[lt_foo]] == 1) { print lt_foo; } +}'` + # AWK program above erroneously prepends '/' to C:/dos/paths + # for these hosts. + case $host_os in + mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\ + $SED 's,/\([[A-Za-z]]:\),\1,g'` ;; + esac + sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP` +else + sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib" +fi]) +library_names_spec= +libname_spec='lib$name' +soname_spec= +shrext_cmds=".so" +postinstall_cmds= +postuninstall_cmds= +finish_cmds= +finish_eval= +shlibpath_var= +shlibpath_overrides_runpath=unknown +version_type=none +dynamic_linker="$host_os ld.so" +sys_lib_dlsearch_path_spec="/lib /usr/lib" +need_lib_prefix=unknown +hardcode_into_libs=no + +# when you set need_version to no, make sure it does not cause -set_version +# flags to be left without arguments +need_version=unknown + +case $host_os in +aix3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a' + shlibpath_var=LIBPATH + + # AIX 3 has no versioning support, so we append a major version to the name. + soname_spec='${libname}${release}${shared_ext}$major' + ;; + +aix[[4-9]]*) + version_type=linux + need_lib_prefix=no + need_version=no + hardcode_into_libs=yes + if test "$host_cpu" = ia64; then + # AIX 5 supports IA64 + library_names_spec='${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext}$versuffix $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + else + # With GCC up to 2.95.x, collect2 would create an import file + # for dependence libraries. The import file would start with + # the line `#! .'. This would cause the generated library to + # depend on `.', always an invalid library. This was fixed in + # development snapshots of GCC prior to 3.0. + case $host_os in + aix4 | aix4.[[01]] | aix4.[[01]].*) + if { echo '#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 97)' + echo ' yes ' + echo '#endif'; } | ${CC} -E - | $GREP yes > /dev/null; then + : + else + can_build_shared=no + fi + ;; + esac + # AIX (on Power*) has no versioning support, so currently we can not hardcode correct + # soname into executable. Probably we can add versioning support to + # collect2, so additional links can be useful in future. + if test "$aix_use_runtimelinking" = yes; then + # If using run time linking (on AIX 4.2 or later) use lib.so + # instead of lib.a to let people know that these are not + # typical AIX shared libraries. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + else + # We preserve .a as extension for shared libraries through AIX4.2 + # and later when we are not doing run time linking. + library_names_spec='${libname}${release}.a $libname.a' + soname_spec='${libname}${release}${shared_ext}$major' + fi + shlibpath_var=LIBPATH + fi + ;; + +amigaos*) + case $host_cpu in + powerpc) + # Since July 2007 AmigaOS4 officially supports .so libraries. + # When compiling the executable, add -use-dynld -Lsobjs: to the compileline. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + ;; + m68k) + library_names_spec='$libname.ixlibrary $libname.a' + # Create ${libname}_ixlibrary.a entries in /sys/libs. + finish_eval='for lib in `ls $libdir/*.ixlibrary 2>/dev/null`; do libname=`func_echo_all "$lib" | $SED '\''s%^.*/\([[^/]]*\)\.ixlibrary$%\1%'\''`; test $RM /sys/libs/${libname}_ixlibrary.a; $show "cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a"; cd /sys/libs && $LN_S $lib ${libname}_ixlibrary.a || exit 1; done' + ;; + esac + ;; + +beos*) + library_names_spec='${libname}${shared_ext}' + dynamic_linker="$host_os ld.so" + shlibpath_var=LIBRARY_PATH + ;; + +bsdi[[45]]*) + version_type=linux + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/shlib /usr/lib /usr/X11/lib /usr/contrib/lib /lib /usr/local/lib" + sys_lib_dlsearch_path_spec="/shlib /usr/lib /usr/local/lib" + # the default ld.so.conf also contains /usr/contrib/lib and + # /usr/X11R6/lib (/usr/X11 is a link to /usr/X11R6), but let us allow + # libtool to hard-code these into programs + ;; + +cygwin* | mingw* | pw32* | cegcc*) + version_type=windows + shrext_cmds=".dll" + need_version=no + need_lib_prefix=no + + case $GCC,$cc_basename in + yes,*) + # gcc + library_names_spec='$libname.dll.a' + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname~ + chmod a+x \$dldir/$dlname~ + if test -n '\''$stripme'\'' && test -n '\''$striplib'\''; then + eval '\''$striplib \$dldir/$dlname'\'' || exit \$?; + fi' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + + case $host_os in + cygwin*) + # Cygwin DLLs use 'cyg' prefix rather than 'lib' + soname_spec='`echo ${libname} | sed -e 's/^lib/cyg/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"]) + ;; + mingw* | cegcc*) + # MinGW DLLs use traditional 'lib' prefix + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + pw32*) + # pw32 DLLs use 'pw' prefix rather than 'lib' + library_names_spec='`echo ${libname} | sed -e 's/^lib/pw/'``echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + ;; + esac + dynamic_linker='Win32 ld.exe' + ;; + + *,cl*) + # Native MSVC + libname_spec='$name' + soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}' + library_names_spec='${libname}.dll.lib' + + case $build_os in + mingw*) + sys_lib_search_path_spec= + lt_save_ifs=$IFS + IFS=';' + for lt_path in $LIB + do + IFS=$lt_save_ifs + # Let DOS variable expansion print the short 8.3 style file name. + lt_path=`cd "$lt_path" 2>/dev/null && cmd //C "for %i in (".") do @echo %~si"` + sys_lib_search_path_spec="$sys_lib_search_path_spec $lt_path" + done + IFS=$lt_save_ifs + # Convert to MSYS style. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | sed -e 's|\\\\|/|g' -e 's| \\([[a-zA-Z]]\\):| /\\1|g' -e 's|^ ||'` + ;; + cygwin*) + # Convert to unix form, then to dos form, then back to unix form + # but this time dos style (no spaces!) so that the unix form looks + # like /cygdrive/c/PROGRA~1:/cygdr... + sys_lib_search_path_spec=`cygpath --path --unix "$LIB"` + sys_lib_search_path_spec=`cygpath --path --dos "$sys_lib_search_path_spec" 2>/dev/null` + sys_lib_search_path_spec=`cygpath --path --unix "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + ;; + *) + sys_lib_search_path_spec="$LIB" + if $ECHO "$sys_lib_search_path_spec" | [$GREP ';[c-zC-Z]:/' >/dev/null]; then + # It is most probably a Windows format PATH. + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e 's/;/ /g'` + else + sys_lib_search_path_spec=`$ECHO "$sys_lib_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"` + fi + # FIXME: find the short name or the path components, as spaces are + # common. (e.g. "Program Files" -> "PROGRA~1") + ;; + esac + + # DLL is installed to $(libdir)/../bin by postinstall_cmds + postinstall_cmds='base_file=`basename \${file}`~ + dlpath=`$SHELL 2>&1 -c '\''. $dir/'\''\${base_file}'\''i; echo \$dlname'\''`~ + dldir=$destdir/`dirname \$dlpath`~ + test -d \$dldir || mkdir -p \$dldir~ + $install_prog $dir/$dlname \$dldir/$dlname' + postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~ + dlpath=$dir/\$dldll~ + $RM \$dlpath' + shlibpath_overrides_runpath=yes + dynamic_linker='Win32 link.exe' + ;; + + *) + # Assume MSVC wrapper + library_names_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext} $libname.lib' + dynamic_linker='Win32 ld.exe' + ;; + esac + # FIXME: first we should search . and the directory the executable is in + shlibpath_var=PATH + ;; + +darwin* | rhapsody*) + dynamic_linker="$host_os dyld" + version_type=darwin + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext' + soname_spec='${libname}${release}${major}$shared_ext' + shlibpath_overrides_runpath=yes + shlibpath_var=DYLD_LIBRARY_PATH + shrext_cmds='`test .$module = .yes && echo .so || echo .dylib`' +m4_if([$1], [],[ + sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"]) + sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib' + ;; + +dgux*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +freebsd1*) + dynamic_linker=no + ;; + +freebsd* | dragonfly*) + # DragonFly does not have aout. When/if they implement a new + # versioning mechanism, adjust this. + if test -x /usr/bin/objformat; then + objformat=`/usr/bin/objformat` + else + case $host_os in + freebsd[[123]]*) objformat=aout ;; + *) objformat=elf ;; + esac + fi + version_type=freebsd-$objformat + case $version_type in + freebsd-elf*) + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + need_version=no + need_lib_prefix=no + ;; + freebsd-*) + library_names_spec='${libname}${release}${shared_ext}$versuffix $libname${shared_ext}$versuffix' + need_version=yes + ;; + esac + shlibpath_var=LD_LIBRARY_PATH + case $host_os in + freebsd2*) + shlibpath_overrides_runpath=yes + ;; + freebsd3.[[01]]* | freebsdelf3.[[01]]*) + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + freebsd3.[[2-9]]* | freebsdelf3.[[2-9]]* | \ + freebsd4.[[0-5]] | freebsdelf4.[[0-5]] | freebsd4.1.1 | freebsdelf4.1.1) + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + *) # from 4.6 on, and DragonFly + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + esac + ;; + +gnu*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + hardcode_into_libs=yes + ;; + +haiku*) + version_type=linux + need_lib_prefix=no + need_version=no + dynamic_linker="$host_os runtime_loader" + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}${major} ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LIBRARY_PATH + shlibpath_overrides_runpath=yes + sys_lib_dlsearch_path_spec='/boot/home/config/lib /boot/common/lib /boot/system/lib' + hardcode_into_libs=yes + ;; + +hpux9* | hpux10* | hpux11*) + # Give a soname corresponding to the major version so that dld.sl refuses to + # link against other versions. + version_type=sunos + need_lib_prefix=no + need_version=no + case $host_cpu in + ia64*) + shrext_cmds='.so' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.so" + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + if test "X$HPUX_IA64_MODE" = X32; then + sys_lib_search_path_spec="/usr/lib/hpux32 /usr/local/lib/hpux32 /usr/local/lib" + else + sys_lib_search_path_spec="/usr/lib/hpux64 /usr/local/lib/hpux64" + fi + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + hppa*64*) + shrext_cmds='.sl' + hardcode_into_libs=yes + dynamic_linker="$host_os dld.sl" + shlibpath_var=LD_LIBRARY_PATH # How should we handle SHLIB_PATH + shlibpath_overrides_runpath=yes # Unless +noenvvar is specified. + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + sys_lib_search_path_spec="/usr/lib/pa20_64 /usr/ccs/lib/pa20_64" + sys_lib_dlsearch_path_spec=$sys_lib_search_path_spec + ;; + *) + shrext_cmds='.sl' + dynamic_linker="$host_os dld.sl" + shlibpath_var=SHLIB_PATH + shlibpath_overrides_runpath=no # +s is required to enable SHLIB_PATH + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + ;; + esac + # HP-UX runs *really* slowly unless shared libraries are mode 555, ... + postinstall_cmds='chmod 555 $lib' + # or fails outright, so override atomically: + install_override_mode=555 + ;; + +interix[[3-9]]*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='Interix 3.x ld.so.1 (PE, like ELF)' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +irix5* | irix6* | nonstopux*) + case $host_os in + nonstopux*) version_type=nonstopux ;; + *) + if test "$lt_cv_prog_gnu_ld" = yes; then + version_type=linux + else + version_type=irix + fi ;; + esac + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${release}${shared_ext} $libname${shared_ext}' + case $host_os in + irix5* | nonstopux*) + libsuff= shlibsuff= + ;; + *) + case $LD in # libtool.m4 will add one of these switches to LD + *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") + libsuff= shlibsuff= libmagic=32-bit;; + *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") + libsuff=32 shlibsuff=N32 libmagic=N32;; + *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") + libsuff=64 shlibsuff=64 libmagic=64-bit;; + *) libsuff= shlibsuff= libmagic=never-match;; + esac + ;; + esac + shlibpath_var=LD_LIBRARY${shlibsuff}_PATH + shlibpath_overrides_runpath=no + sys_lib_search_path_spec="/usr/lib${libsuff} /lib${libsuff} /usr/local/lib${libsuff}" + sys_lib_dlsearch_path_spec="/usr/lib${libsuff} /lib${libsuff}" + hardcode_into_libs=yes + ;; + +# No shared lib support for Linux oldld, aout, or coff. +linux*oldld* | linux*aout* | linux*coff*) + dynamic_linker=no + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -n $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + + # Some binutils ld are patched to set DT_RUNPATH + AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath], + [lt_cv_shlibpath_overrides_runpath=no + save_LDFLAGS=$LDFLAGS + save_libdir=$libdir + eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \ + LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\"" + AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])], + [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null], + [lt_cv_shlibpath_overrides_runpath=yes])]) + LDFLAGS=$save_LDFLAGS + libdir=$save_libdir + ]) + shlibpath_overrides_runpath=$lt_cv_shlibpath_overrides_runpath + + # This implies no fast_install, which is unacceptable. + # Some rework will be needed to allow for fast_install + # before this can be enabled. + hardcode_into_libs=yes + + # Append ld.so.conf contents to the search path + if test -f /etc/ld.so.conf; then + lt_ld_extra=`awk '/^include / { system(sprintf("cd /etc; cat %s 2>/dev/null", \[$]2)); skip = 1; } { if (!skip) print \[$]0; skip = 0; }' < /etc/ld.so.conf | $SED -e 's/#.*//;/^[ ]*hwcap[ ]/d;s/[:, ]/ /g;s/=[^=]*$//;s/=[^= ]* / /g;s/"//g;/^$/d' | tr '\n' ' '` + sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra" + fi + + # We used to test for /lib/ld.so.1 and disable shared libraries on + # powerpc, because MkLinux only supported shared libraries with the + # GNU dynamic linker. Since this was broken with cross compilers, + # most powerpc-linux boxes support dynamic linking these days and + # people can always --disable-shared, the test was removed, and we + # assume the GNU/Linux dynamic linker is in use. + dynamic_linker='GNU/Linux ld.so' + ;; + +netbsd*) + version_type=sunos + need_lib_prefix=no + need_version=no + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + dynamic_linker='NetBSD (a.out) ld.so' + else + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + dynamic_linker='NetBSD ld.elf_so' + fi + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + ;; + +newsos6) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + ;; + +*nto* | *qnx*) + version_type=qnx + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + dynamic_linker='ldqnx.so' + ;; + +openbsd*) + version_type=sunos + sys_lib_dlsearch_path_spec="/usr/lib" + need_lib_prefix=no + # Some older versions of OpenBSD (3.3 at least) *do* need versioned libs. + case $host_os in + openbsd3.3 | openbsd3.3.*) need_version=yes ;; + *) need_version=no ;; + esac + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/sbin" ldconfig -m $libdir' + shlibpath_var=LD_LIBRARY_PATH + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + case $host_os in + openbsd2.[[89]] | openbsd2.[[89]].*) + shlibpath_overrides_runpath=no + ;; + *) + shlibpath_overrides_runpath=yes + ;; + esac + else + shlibpath_overrides_runpath=yes + fi + ;; + +os2*) + libname_spec='$name' + shrext_cmds=".dll" + need_lib_prefix=no + library_names_spec='$libname${shared_ext} $libname.a' + dynamic_linker='OS/2 ld.exe' + shlibpath_var=LIBPATH + ;; + +osf3* | osf4* | osf5*) + version_type=osf + need_lib_prefix=no + need_version=no + soname_spec='${libname}${release}${shared_ext}$major' + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + sys_lib_search_path_spec="/usr/shlib /usr/ccs/lib /usr/lib/cmplrs/cc /usr/lib /usr/local/lib /var/shlib" + sys_lib_dlsearch_path_spec="$sys_lib_search_path_spec" + ;; + +rdos*) + dynamic_linker=no + ;; + +solaris*) + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + # ldd complains unless libraries are executable + postinstall_cmds='chmod +x $lib' + ;; + +sunos4*) + version_type=sunos + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${shared_ext}$versuffix' + finish_cmds='PATH="\$PATH:/usr/etc" ldconfig $libdir' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + if test "$with_gnu_ld" = yes; then + need_lib_prefix=no + fi + need_version=yes + ;; + +sysv4 | sysv4.3*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + case $host_vendor in + sni) + shlibpath_overrides_runpath=no + need_lib_prefix=no + runpath_var=LD_RUN_PATH + ;; + siemens) + need_lib_prefix=no + ;; + motorola) + need_lib_prefix=no + need_version=no + shlibpath_overrides_runpath=no + sys_lib_search_path_spec='/lib /usr/lib /usr/ccs/lib' + ;; + esac + ;; + +sysv4*MP*) + if test -d /usr/nec ;then + version_type=linux + library_names_spec='$libname${shared_ext}.$versuffix $libname${shared_ext}.$major $libname${shared_ext}' + soname_spec='$libname${shared_ext}.$major' + shlibpath_var=LD_LIBRARY_PATH + fi + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + version_type=freebsd-elf + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext} $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=yes + hardcode_into_libs=yes + if test "$with_gnu_ld" = yes; then + sys_lib_search_path_spec='/usr/local/lib /usr/gnu/lib /usr/ccs/lib /usr/lib /lib' + else + sys_lib_search_path_spec='/usr/ccs/lib /usr/lib' + case $host_os in + sco3.2v5*) + sys_lib_search_path_spec="$sys_lib_search_path_spec /lib" + ;; + esac + fi + sys_lib_dlsearch_path_spec='/usr/lib' + ;; + +tpf*) + # TPF is a cross-target only. Preferred cross-host = GNU/Linux. + version_type=linux + need_lib_prefix=no + need_version=no + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + shlibpath_var=LD_LIBRARY_PATH + shlibpath_overrides_runpath=no + hardcode_into_libs=yes + ;; + +uts4*) + version_type=linux + library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}' + soname_spec='${libname}${release}${shared_ext}$major' + shlibpath_var=LD_LIBRARY_PATH + ;; + +*) + dynamic_linker=no + ;; +esac +AC_MSG_RESULT([$dynamic_linker]) +test "$dynamic_linker" = no && can_build_shared=no + +variables_saved_for_relink="PATH $shlibpath_var $runpath_var" +if test "$GCC" = yes; then + variables_saved_for_relink="$variables_saved_for_relink GCC_EXEC_PREFIX COMPILER_PATH LIBRARY_PATH" +fi + +if test "${lt_cv_sys_lib_search_path_spec+set}" = set; then + sys_lib_search_path_spec="$lt_cv_sys_lib_search_path_spec" +fi +if test "${lt_cv_sys_lib_dlsearch_path_spec+set}" = set; then + sys_lib_dlsearch_path_spec="$lt_cv_sys_lib_dlsearch_path_spec" +fi + +_LT_DECL([], [variables_saved_for_relink], [1], + [Variables whose values should be saved in libtool wrapper scripts and + restored at link time]) +_LT_DECL([], [need_lib_prefix], [0], + [Do we need the "lib" prefix for modules?]) +_LT_DECL([], [need_version], [0], [Do we need a version for libraries?]) +_LT_DECL([], [version_type], [0], [Library versioning type]) +_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable]) +_LT_DECL([], [shlibpath_var], [0],[Shared library path variable]) +_LT_DECL([], [shlibpath_overrides_runpath], [0], + [Is shlibpath searched before the hard-coded library search path?]) +_LT_DECL([], [libname_spec], [1], [Format of library name prefix]) +_LT_DECL([], [library_names_spec], [1], + [[List of archive names. First name is the real one, the rest are links. + The last name is the one that the linker finds with -lNAME]]) +_LT_DECL([], [soname_spec], [1], + [[The coded name of the library, if different from the real name]]) +_LT_DECL([], [install_override_mode], [1], + [Permission mode override for installation of shared libraries]) +_LT_DECL([], [postinstall_cmds], [2], + [Command to use after installation of a shared archive]) +_LT_DECL([], [postuninstall_cmds], [2], + [Command to use after uninstallation of a shared archive]) +_LT_DECL([], [finish_cmds], [2], + [Commands used to finish a libtool library installation in a directory]) +_LT_DECL([], [finish_eval], [1], + [[As "finish_cmds", except a single script fragment to be evaled but + not shown]]) +_LT_DECL([], [hardcode_into_libs], [0], + [Whether we should hardcode library paths into libraries]) +_LT_DECL([], [sys_lib_search_path_spec], [2], + [Compile-time system search path for libraries]) +_LT_DECL([], [sys_lib_dlsearch_path_spec], [2], + [Run-time system search path for libraries]) +])# _LT_SYS_DYNAMIC_LINKER + + +# _LT_PATH_TOOL_PREFIX(TOOL) +# -------------------------- +# find a file program which can recognize shared library +AC_DEFUN([_LT_PATH_TOOL_PREFIX], +[m4_require([_LT_DECL_EGREP])dnl +AC_MSG_CHECKING([for $1]) +AC_CACHE_VAL(lt_cv_path_MAGIC_CMD, +[case $MAGIC_CMD in +[[\\/*] | ?:[\\/]*]) + lt_cv_path_MAGIC_CMD="$MAGIC_CMD" # Let the user override the test with a path. + ;; +*) + lt_save_MAGIC_CMD="$MAGIC_CMD" + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR +dnl $ac_dummy forces splitting on constant user-supplied paths. +dnl POSIX.2 word splitting is done only on the output of word expansions, +dnl not every word. This closes a longstanding sh security hole. + ac_dummy="m4_if([$2], , $PATH, [$2])" + for ac_dir in $ac_dummy; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f $ac_dir/$1; then + lt_cv_path_MAGIC_CMD="$ac_dir/$1" + if test -n "$file_magic_test_file"; then + case $deplibs_check_method in + "file_magic "*) + file_magic_regex=`expr "$deplibs_check_method" : "file_magic \(.*\)"` + MAGIC_CMD="$lt_cv_path_MAGIC_CMD" + if eval $file_magic_cmd \$file_magic_test_file 2> /dev/null | + $EGREP "$file_magic_regex" > /dev/null; then + : + else + cat <<_LT_EOF 1>&2 + +*** Warning: the command libtool uses to detect shared libraries, +*** $file_magic_cmd, produces output that libtool cannot recognize. +*** The result is that libtool may fail to recognize shared libraries +*** as such. This will affect the creation of libtool libraries that +*** depend on shared libraries, but programs linked with such libtool +*** libraries will work regardless of this problem. Nevertheless, you +*** may want to report the problem to your system manager and/or to +*** bug-libtool@gnu.org + +_LT_EOF + fi ;; + esac + fi + break + fi + done + IFS="$lt_save_ifs" + MAGIC_CMD="$lt_save_MAGIC_CMD" + ;; +esac]) +MAGIC_CMD="$lt_cv_path_MAGIC_CMD" +if test -n "$MAGIC_CMD"; then + AC_MSG_RESULT($MAGIC_CMD) +else + AC_MSG_RESULT(no) +fi +_LT_DECL([], [MAGIC_CMD], [0], + [Used to examine libraries when file_magic_cmd begins with "file"])dnl +])# _LT_PATH_TOOL_PREFIX + +# Old name: +AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], []) + + +# _LT_PATH_MAGIC +# -------------- +# find a file program which can recognize a shared library +m4_defun([_LT_PATH_MAGIC], +[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH) +if test -z "$lt_cv_path_MAGIC_CMD"; then + if test -n "$ac_tool_prefix"; then + _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH) + else + MAGIC_CMD=: + fi +fi +])# _LT_PATH_MAGIC + + +# LT_PATH_LD +# ---------- +# find the pathname to the GNU or non-GNU linker +AC_DEFUN([LT_PATH_LD], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PROG_ECHO_BACKSLASH])dnl + +AC_ARG_WITH([gnu-ld], + [AS_HELP_STRING([--with-gnu-ld], + [assume the C compiler uses GNU ld @<:@default=no@:>@])], + [test "$withval" = no || with_gnu_ld=yes], + [with_gnu_ld=no])dnl + +ac_prog=ld +if test "$GCC" = yes; then + # Check if gcc -print-prog-name=ld gives a path. + AC_MSG_CHECKING([for ld used by $CC]) + case $host in + *-*-mingw*) + # gcc leaves a trailing carriage return which upsets mingw + ac_prog=`($CC -print-prog-name=ld) 2>&5 | tr -d '\015'` ;; + *) + ac_prog=`($CC -print-prog-name=ld) 2>&5` ;; + esac + case $ac_prog in + # Accept absolute paths. + [[\\/]]* | ?:[[\\/]]*) + re_direlt='/[[^/]][[^/]]*/\.\./' + # Canonicalize the pathname of ld + ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'` + while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do + ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"` + done + test -z "$LD" && LD="$ac_prog" + ;; + "") + # If it fails, then pretend we aren't using GCC. + ac_prog=ld + ;; + *) + # If it is relative, then search for the first ld in PATH. + with_gnu_ld=unknown + ;; + esac +elif test "$with_gnu_ld" = yes; then + AC_MSG_CHECKING([for GNU ld]) +else + AC_MSG_CHECKING([for non-GNU ld]) +fi +AC_CACHE_VAL(lt_cv_path_LD, +[if test -z "$LD"; then + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + if test -f "$ac_dir/$ac_prog" || test -f "$ac_dir/$ac_prog$ac_exeext"; then + lt_cv_path_LD="$ac_dir/$ac_prog" + # Check to see if the program is GNU ld. I'd rather use --version, + # but apparently some variants of GNU ld only accept -v. + # Break only if it was the GNU/non-GNU ld that we prefer. + case `"$lt_cv_path_LD" -v 2>&1 &1 /dev/null 2>&1; then + lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL' + lt_cv_file_magic_cmd='func_win32_libid' + else + # Keep this pattern in sync with the one in func_win32_libid. + lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' + lt_cv_file_magic_cmd='$OBJDUMP -f' + fi + ;; + +cegcc*) + # use the weaker test based on 'objdump'. See mingw*. + lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?' + lt_cv_file_magic_cmd='$OBJDUMP -f' + ;; + +darwin* | rhapsody*) + lt_cv_deplibs_check_method=pass_all + ;; + +freebsd* | dragonfly*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + case $host_cpu in + i*86 ) + # Not sure whether the presence of OpenBSD here was a mistake. + # Let's accept both of them until this is cleared up. + lt_cv_deplibs_check_method='file_magic (FreeBSD|OpenBSD|DragonFly)/i[[3-9]]86 (compact )?demand paged shared library' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so.*` + ;; + esac + else + lt_cv_deplibs_check_method=pass_all + fi + ;; + +gnu*) + lt_cv_deplibs_check_method=pass_all + ;; + +haiku*) + lt_cv_deplibs_check_method=pass_all + ;; + +hpux10.20* | hpux11*) + lt_cv_file_magic_cmd=/usr/bin/file + case $host_cpu in + ia64*) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|ELF-[[0-9]][[0-9]]) shared object file - IA64' + lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so + ;; + hppa*64*) + [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'] + lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl + ;; + *) + lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library' + lt_cv_file_magic_test_file=/usr/lib/libc.sl + ;; + esac + ;; + +interix[[3-9]]*) + # PIC code is broken on Interix 3.x, that's why |\.a not |_pic\.a here + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|\.a)$' + ;; + +irix5* | irix6* | nonstopux*) + case $LD in + *-32|*"-32 ") libmagic=32-bit;; + *-n32|*"-n32 ") libmagic=N32;; + *-64|*"-64 ") libmagic=64-bit;; + *) libmagic=never-match;; + esac + lt_cv_deplibs_check_method=pass_all + ;; + +# This must be Linux ELF. +linux* | k*bsd*-gnu | kopensolaris*-gnu) + lt_cv_deplibs_check_method=pass_all + ;; + +netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$' + fi + ;; + +newos6*) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (executable|dynamic lib)' + lt_cv_file_magic_cmd=/usr/bin/file + lt_cv_file_magic_test_file=/usr/lib/libnls.so + ;; + +*nto* | *qnx*) + lt_cv_deplibs_check_method=pass_all + ;; + +openbsd*) + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$' + else + lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$' + fi + ;; + +osf3* | osf4* | osf5*) + lt_cv_deplibs_check_method=pass_all + ;; + +rdos*) + lt_cv_deplibs_check_method=pass_all + ;; + +solaris*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*) + lt_cv_deplibs_check_method=pass_all + ;; + +sysv4 | sysv4.3*) + case $host_vendor in + motorola) + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[ML]]SB (shared object|dynamic lib) M[[0-9]][[0-9]]* Version [[0-9]]' + lt_cv_file_magic_test_file=`echo /usr/lib/libc.so*` + ;; + ncr) + lt_cv_deplibs_check_method=pass_all + ;; + sequent) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method='file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB (shared object|dynamic lib )' + ;; + sni) + lt_cv_file_magic_cmd='/bin/file' + lt_cv_deplibs_check_method="file_magic ELF [[0-9]][[0-9]]*-bit [[LM]]SB dynamic lib" + lt_cv_file_magic_test_file=/lib/libc.so + ;; + siemens) + lt_cv_deplibs_check_method=pass_all + ;; + pc) + lt_cv_deplibs_check_method=pass_all + ;; + esac + ;; + +tpf*) + lt_cv_deplibs_check_method=pass_all + ;; +esac +]) + +file_magic_glob= +want_nocaseglob=no +if test "$build" = "$host"; then + case $host_os in + mingw* | pw32*) + if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then + want_nocaseglob=yes + else + file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"` + fi + ;; + esac +fi + +file_magic_cmd=$lt_cv_file_magic_cmd +deplibs_check_method=$lt_cv_deplibs_check_method +test -z "$deplibs_check_method" && deplibs_check_method=unknown + +_LT_DECL([], [deplibs_check_method], [1], + [Method to check whether dependent libraries are shared objects]) +_LT_DECL([], [file_magic_cmd], [1], + [Command to use when deplibs_check_method = "file_magic"]) +_LT_DECL([], [file_magic_glob], [1], + [How to find potential files when deplibs_check_method = "file_magic"]) +_LT_DECL([], [want_nocaseglob], [1], + [Find potential files using nocaseglob when deplibs_check_method = "file_magic"]) +])# _LT_CHECK_MAGIC_METHOD + + +# LT_PATH_NM +# ---------- +# find the pathname to a BSD- or MS-compatible name lister +AC_DEFUN([LT_PATH_NM], +[AC_REQUIRE([AC_PROG_CC])dnl +AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM, +[if test -n "$NM"; then + # Let the user override the test. + lt_cv_path_NM="$NM" +else + lt_nm_to_check="${ac_tool_prefix}nm" + if test -n "$ac_tool_prefix" && test "$build" = "$host"; then + lt_nm_to_check="$lt_nm_to_check nm" + fi + for lt_tmp_nm in $lt_nm_to_check; do + lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR + for ac_dir in $PATH /usr/ccs/bin/elf /usr/ccs/bin /usr/ucb /bin; do + IFS="$lt_save_ifs" + test -z "$ac_dir" && ac_dir=. + tmp_nm="$ac_dir/$lt_tmp_nm" + if test -f "$tmp_nm" || test -f "$tmp_nm$ac_exeext" ; then + # Check to see if the nm accepts a BSD-compat flag. + # Adding the `sed 1q' prevents false positives on HP-UX, which says: + # nm: unknown option "B" ignored + # Tru64's nm complains that /dev/null is an invalid object file + case `"$tmp_nm" -B /dev/null 2>&1 | sed '1q'` in + */dev/null* | *'Invalid file or object type'*) + lt_cv_path_NM="$tmp_nm -B" + break + ;; + *) + case `"$tmp_nm" -p /dev/null 2>&1 | sed '1q'` in + */dev/null*) + lt_cv_path_NM="$tmp_nm -p" + break + ;; + *) + lt_cv_path_NM=${lt_cv_path_NM="$tmp_nm"} # keep the first match, but + continue # so that we can try to find one that supports BSD flags + ;; + esac + ;; + esac + fi + done + IFS="$lt_save_ifs" + done + : ${lt_cv_path_NM=no} +fi]) +if test "$lt_cv_path_NM" != "no"; then + NM="$lt_cv_path_NM" +else + # Didn't find any BSD compatible name lister, look for dumpbin. + if test -n "$DUMPBIN"; then : + # Let the user override the test. + else + AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :) + case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in + *COFF*) + DUMPBIN="$DUMPBIN -symbols" + ;; + *) + DUMPBIN=: + ;; + esac + fi + AC_SUBST([DUMPBIN]) + if test "$DUMPBIN" != ":"; then + NM="$DUMPBIN" + fi +fi +test -z "$NM" && NM=nm +AC_SUBST([NM]) +_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl + +AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface], + [lt_cv_nm_interface="BSD nm" + echo "int some_variable = 0;" > conftest.$ac_ext + (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD) + (eval "$ac_compile" 2>conftest.err) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD) + (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out) + cat conftest.err >&AS_MESSAGE_LOG_FD + (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD) + cat conftest.out >&AS_MESSAGE_LOG_FD + if $GREP 'External.*some_variable' conftest.out > /dev/null; then + lt_cv_nm_interface="MS dumpbin" + fi + rm -f conftest*]) +])# LT_PATH_NM + +# Old names: +AU_ALIAS([AM_PROG_NM], [LT_PATH_NM]) +AU_ALIAS([AC_PROG_NM], [LT_PATH_NM]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_PROG_NM], []) +dnl AC_DEFUN([AC_PROG_NM], []) + +# _LT_CHECK_SHAREDLIB_FROM_LINKLIB +# -------------------------------- +# how to determine the name of the shared library +# associated with a specific link library. +# -- PORTME fill in with the dynamic library characteristics +m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB], +[m4_require([_LT_DECL_EGREP]) +m4_require([_LT_DECL_OBJDUMP]) +m4_require([_LT_DECL_DLLTOOL]) +AC_CACHE_CHECK([how to associate runtime and link libraries], +lt_cv_sharedlib_from_linklib_cmd, +[lt_cv_sharedlib_from_linklib_cmd='unknown' + +case $host_os in +cygwin* | mingw* | pw32* | cegcc*) + # two different shell functions defined in ltmain.sh + # decide which to use based on capabilities of $DLLTOOL + case `$DLLTOOL --help 2>&1` in + *--identify-strict*) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib + ;; + *) + lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback + ;; + esac + ;; +*) + # fallback: assume linklib IS sharedlib + lt_cv_sharedlib_from_linklib_cmd="$ECHO" + ;; +esac +]) +sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd +test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO + +_LT_DECL([], [sharedlib_from_linklib_cmd], [1], + [Command to associate shared and link libraries]) +])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB + + +# _LT_PATH_MANIFEST_TOOL +# ---------------------- +# locate the manifest tool +m4_defun([_LT_PATH_MANIFEST_TOOL], +[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :) +test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt +AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool], + [lt_cv_path_mainfest_tool=no + echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD + $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out + cat conftest.err >&AS_MESSAGE_LOG_FD + if $GREP 'Manifest Tool' conftest.out > /dev/null; then + lt_cv_path_mainfest_tool=yes + fi + rm -f conftest*]) +if test "x$lt_cv_path_mainfest_tool" != xyes; then + MANIFEST_TOOL=: +fi +_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl +])# _LT_PATH_MANIFEST_TOOL + + +# LT_LIB_M +# -------- +# check for math library +AC_DEFUN([LT_LIB_M], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +LIBM= +case $host in +*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*) + # These system don't have libm, or don't need it + ;; +*-ncr-sysv4.3*) + AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw") + AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm") + ;; +*) + AC_CHECK_LIB(m, cos, LIBM="-lm") + ;; +esac +AC_SUBST([LIBM]) +])# LT_LIB_M + +# Old name: +AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_CHECK_LIBM], []) + + +# _LT_COMPILER_NO_RTTI([TAGNAME]) +# ------------------------------- +m4_defun([_LT_COMPILER_NO_RTTI], +[m4_require([_LT_TAG_COMPILER])dnl + +_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + +if test "$GCC" = yes; then + case $cc_basename in + nvcc*) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;; + *) + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;; + esac + + _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions], + lt_cv_prog_compiler_rtti_exceptions, + [-fno-rtti -fno-exceptions], [], + [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"]) +fi +_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1], + [Compiler flag to turn off builtin functions]) +])# _LT_COMPILER_NO_RTTI + + +# _LT_CMD_GLOBAL_SYMBOLS +# ---------------------- +m4_defun([_LT_CMD_GLOBAL_SYMBOLS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_PROG_CC])dnl +AC_REQUIRE([AC_PROG_AWK])dnl +AC_REQUIRE([LT_PATH_NM])dnl +AC_REQUIRE([LT_PATH_LD])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_TAG_COMPILER])dnl + +# Check for command to grab the raw symbol name followed by C symbol from nm. +AC_MSG_CHECKING([command to parse $NM output from $compiler object]) +AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe], +[ +# These are sane defaults that work on at least a few old systems. +# [They come from Ultrix. What could be older than Ultrix?!! ;)] + +# Character class describing NM global symbol codes. +symcode='[[BCDEGRST]]' + +# Regexp to match symbols that can be accessed directly from C. +sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)' + +# Define system-specific variables. +case $host_os in +aix*) + symcode='[[BCDT]]' + ;; +cygwin* | mingw* | pw32* | cegcc*) + symcode='[[ABCDGISTW]]' + ;; +hpux*) + if test "$host_cpu" = ia64; then + symcode='[[ABCDEGRST]]' + fi + ;; +irix* | nonstopux*) + symcode='[[BCDEGRST]]' + ;; +osf*) + symcode='[[BCDEGQRST]]' + ;; +solaris*) + symcode='[[BDRT]]' + ;; +sco3.2v5*) + symcode='[[DT]]' + ;; +sysv4.2uw2*) + symcode='[[DT]]' + ;; +sysv5* | sco5v6* | unixware* | OpenUNIX*) + symcode='[[ABDT]]' + ;; +sysv4) + symcode='[[DFNSTU]]' + ;; +esac + +# If we're using GNU nm, then use its standard symbol codes. +case `$NM -V 2>&1` in +*GNU* | *'with BFD'*) + symcode='[[ABCDGIRSTW]]' ;; +esac + +# Transform an extracted symbol line into a proper C declaration. +# Some systems (esp. on ia64) link data and code symbols differently, +# so use this general approach. +lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'" + +# Transform an extracted symbol line into symbol name and symbol address +lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'" +lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'" + +# Handle CRLF in mingw tool chain +opt_cr= +case $build_os in +mingw*) + opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp + ;; +esac + +# Try without a prefix underscore, then with it. +for ac_symprfx in "" "_"; do + + # Transform symcode, sympat, and symprfx into a raw symbol and a C symbol. + symxfrm="\\1 $ac_symprfx\\2 \\2" + + # Write the raw and C identifiers. + if test "$lt_cv_nm_interface" = "MS dumpbin"; then + # Fake it for dumpbin and say T for any non-static function + # and D for any global variable. + # Also find C++ and __fastcall symbols from MSVC++, + # which start with @ or ?. + lt_cv_sys_global_symbol_pipe="$AWK ['"\ +" {last_section=section; section=\$ 3};"\ +" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\ +" \$ 0!~/External *\|/{next};"\ +" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\ +" {if(hide[section]) next};"\ +" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\ +" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\ +" s[1]~/^[@?]/{print s[1], s[1]; next};"\ +" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\ +" ' prfx=^$ac_symprfx]" + else + lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'" + fi + lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'" + + # Check to see that the pipe works correctly. + pipe_works=no + + rm -f conftest* + cat > conftest.$ac_ext <<_LT_EOF +#ifdef __cplusplus +extern "C" { +#endif +char nm_test_var; +void nm_test_func(void); +void nm_test_func(void){} +#ifdef __cplusplus +} +#endif +int main(){nm_test_var='a';nm_test_func();return(0);} +_LT_EOF + + if AC_TRY_EVAL(ac_compile); then + # Now try to grab the symbols. + nlist=conftest.nm + if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then + # Try sorting and uniquifying the output. + if sort "$nlist" | uniq > "$nlist"T; then + mv -f "$nlist"T "$nlist" + else + rm -f "$nlist"T + fi + + # Make sure that we snagged all the symbols we need. + if $GREP ' nm_test_var$' "$nlist" >/dev/null; then + if $GREP ' nm_test_func$' "$nlist" >/dev/null; then + cat <<_LT_EOF > conftest.$ac_ext +/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */ +#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE) +/* DATA imports from DLLs on WIN32 con't be const, because runtime + relocations are performed -- see ld's documentation on pseudo-relocs. */ +# define LT@&t@_DLSYM_CONST +#elif defined(__osf__) +/* This system does not cope well with relocations in const data. */ +# define LT@&t@_DLSYM_CONST +#else +# define LT@&t@_DLSYM_CONST const +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +_LT_EOF + # Now generate the symbol file. + eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext' + + cat <<_LT_EOF >> conftest.$ac_ext + +/* The mapping between symbol names and symbols. */ +LT@&t@_DLSYM_CONST struct { + const char *name; + void *address; +} +lt__PROGRAM__LTX_preloaded_symbols[[]] = +{ + { "@PROGRAM@", (void *) 0 }, +_LT_EOF + $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext + cat <<\_LT_EOF >> conftest.$ac_ext + {0, (void *) 0} +}; + +/* This works around a problem in FreeBSD linker */ +#ifdef FREEBSD_WORKAROUND +static const void *lt_preloaded_setup() { + return lt__PROGRAM__LTX_preloaded_symbols; +} +#endif + +#ifdef __cplusplus +} +#endif +_LT_EOF + # Now try linking the two files. + mv conftest.$ac_objext conftstm.$ac_objext + lt_globsym_save_LIBS=$LIBS + lt_globsym_save_CFLAGS=$CFLAGS + LIBS="conftstm.$ac_objext" + CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)" + if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then + pipe_works=yes + fi + LIBS=$lt_globsym_save_LIBS + CFLAGS=$lt_globsym_save_CFLAGS + else + echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot find nm_test_var in $nlist" >&AS_MESSAGE_LOG_FD + fi + else + echo "cannot run $lt_cv_sys_global_symbol_pipe" >&AS_MESSAGE_LOG_FD + fi + else + echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD + cat conftest.$ac_ext >&5 + fi + rm -rf conftest* conftst* + + # Do not use the global_symbol_pipe unless it works. + if test "$pipe_works" = yes; then + break + else + lt_cv_sys_global_symbol_pipe= + fi +done +]) +if test -z "$lt_cv_sys_global_symbol_pipe"; then + lt_cv_sys_global_symbol_to_cdecl= +fi +if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then + AC_MSG_RESULT(failed) +else + AC_MSG_RESULT(ok) +fi + +# Response file support. +if test "$lt_cv_nm_interface" = "MS dumpbin"; then + nm_file_list_spec='@' +elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then + nm_file_list_spec='@' +fi + +_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1], + [Take the output of nm and produce a listing of raw symbols and C names]) +_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1], + [Transform the output of nm in a proper C declaration]) +_LT_DECL([global_symbol_to_c_name_address], + [lt_cv_sys_global_symbol_to_c_name_address], [1], + [Transform the output of nm in a C name address pair]) +_LT_DECL([global_symbol_to_c_name_address_lib_prefix], + [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1], + [Transform the output of nm in a C name address pair when lib prefix is needed]) +_LT_DECL([], [nm_file_list_spec], [1], + [Specify filename containing input files for $NM]) +]) # _LT_CMD_GLOBAL_SYMBOLS + + +# _LT_COMPILER_PIC([TAGNAME]) +# --------------------------- +m4_defun([_LT_COMPILER_PIC], +[m4_require([_LT_TAG_COMPILER])dnl +_LT_TAGVAR(lt_prog_compiler_wl, $1)= +_LT_TAGVAR(lt_prog_compiler_pic, $1)= +_LT_TAGVAR(lt_prog_compiler_static, $1)= + +m4_if([$1], [CXX], [ + # C++ specific cases for pic, static, wl, etc. + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + *djgpp*) + # DJGPP does not support shared libraries at all + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + else + case $host_os in + aix[[4-9]]*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + chorus*) + case $cc_basename in + cxch68*) + # Green Hills C++ Compiler + # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a" + ;; + esac + ;; + mingw* | cygwin* | os2* | pw32* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + dgux*) + case $cc_basename in + ec++*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + ghcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + freebsd* | dragonfly*) + # FreeBSD uses GNU C++ + ;; + hpux9* | hpux10* | hpux11*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + if test "$host_cpu" != ia64; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + fi + ;; + aCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + ;; + *) + ;; + esac + ;; + interix*) + # This is c89, which is MS Visual C++ (no shared libs) + # Anyone wants to do a port? + ;; + irix5* | irix6* | nonstopux*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + # CC pic flag -KPIC is the default. + ;; + *) + ;; + esac + ;; + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # KAI C++ Compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + ecpc* ) + # old Intel C++ for x86_64 which still supported -KPIC. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + icpc* ) + # Intel C++, used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + cxx*) + # Compaq C++ + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*) + # IBM XL 8.0, 9.0 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + esac + ;; + esac + ;; + lynxos*) + ;; + m88k*) + ;; + mvs*) + case $cc_basename in + cxx*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall' + ;; + *) + ;; + esac + ;; + netbsd*) + ;; + *qnx* | *nto*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,' + ;; + RCC*) + # Rational C++ 2.4.1 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + cxx*) + # Digital/Compaq C++ + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # Make sure the PIC flag is empty. It appears that all Alpha + # Linux and Compaq Tru64 Unix objects are PIC. + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + *) + ;; + esac + ;; + psos*) + ;; + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + ;; + *) + ;; + esac + ;; + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + lcc*) + # Lucid + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + ;; + *) + ;; + esac + ;; + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + case $cc_basename in + CC*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + esac + ;; + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + ;; + *) + ;; + esac + ;; + vxworks*) + ;; + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +], +[ + if test "$GCC" = yes; then + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + + case $host_os in + aix*) + # All AIX code is PIC. + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + m68k) + # FIXME: we need at least 68020 code to build shared libraries, but + # adding the `-m68020' flag to GCC prevents building anything better, + # like `-m68040'. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4' + ;; + esac + ;; + + beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*) + # PIC is the default for these OSes. + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + # Although the cygwin gcc ignores -fPIC, still need this for old-style + # (--disable-auto-import) libraries + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + darwin* | rhapsody*) + # PIC is the default on this platform + # Common symbols not allowed in MH_DYLIB files + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common' + ;; + + haiku*) + # PIC is the default for Haiku. + # The "-static" flag exists, but is broken. + _LT_TAGVAR(lt_prog_compiler_static, $1)= + ;; + + hpux*) + # PIC is the default for 64-bit PA HP-UX, but not for 32-bit + # PA HP-UX. On IA64 HP-UX, PIC is the default but the pic flag + # sets the default TLS model and affects inlining. + case $host_cpu in + hppa*64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + ;; + + interix[[3-9]]*) + # Interix 3.x gcc -fpic/-fPIC options generate broken code. + # Instead, we relocate shared libraries at runtime. + ;; + + msdosdjgpp*) + # Just because we use GCC doesn't mean we suddenly get shared libraries + # on systems that don't support them. + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + enable_shared=no + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic + fi + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + ;; + esac + + case $cc_basename in + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Xcompiler -fPIC' + ;; + esac + else + # PORTME Check for flag to pass linker flags through the system compiler. + case $host_os in + aix*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + if test "$host_cpu" = ia64; then + # AIX 5 now supports IA64 processor + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + else + _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp' + fi + ;; + + mingw* | cygwin* | pw32* | os2* | cegcc*) + # This hack is so that the source file can tell whether it is being + # built for inclusion in a dll (and should export symbols for example). + m4_if([$1], [GCJ], [], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT']) + ;; + + hpux9* | hpux10* | hpux11*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC is the default for IA64 HP-UX and 64-bit HP-UX, but + # not for PA HP-UX. + case $host_cpu in + hppa*64*|ia64*) + # +Z the default + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z' + ;; + esac + # Is there a better lt_prog_compiler_static that works with the bundled CC? + _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive' + ;; + + irix5* | irix6* | nonstopux*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # PIC (with -KPIC) is the default. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + # old Intel for x86_64 which still supported -KPIC. + ecc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # icc used to be incompatible with GCC. + # ICC 10 doesn't accept -KPIC any more. + icc* | ifort*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-static' + ;; + # Lahey Fortran 8.1. + lf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared' + _LT_TAGVAR(lt_prog_compiler_static, $1)='--static' + ;; + nagfor*) + # NAG Fortran compiler + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group compilers (*not* the Pentium gcc compiler, + # which looks to be a dead project) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + ccc*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All Alpha code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + xl* | bgxl* | bgf* | mpixl*) + # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink' + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ F* | *Sun*Fortran*) + # Sun Fortran 8.3 passes all unrecognized flags to the linker + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='' + ;; + *Sun\ C*) + # Sun C 5.9 + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + ;; + esac + ;; + esac + ;; + + newsos6) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *nto* | *qnx*) + # QNX uses GNU C++, but need to define -shared option too, otherwise + # it will coredump. + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared' + ;; + + osf3* | osf4* | osf5*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + # All OSF/1 code is PIC. + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + rdos*) + _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared' + ;; + + solaris*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + case $cc_basename in + f77* | f90* | f95* | sunf77* | sunf90* | sunf95*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';; + *) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';; + esac + ;; + + sunos4*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4 | sysv4.2uw2* | sysv4.3*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + sysv4*MP*) + if test -d /usr/nec ;then + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + fi + ;; + + sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + unicos*) + _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,' + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + + uts4*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic' + _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic' + ;; + + *) + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no + ;; + esac + fi +]) +case $host_os in + # For platforms which do not support PIC, -DPIC is meaningless: + *djgpp*) + _LT_TAGVAR(lt_prog_compiler_pic, $1)= + ;; + *) + _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])" + ;; +esac + +AC_CACHE_CHECK([for $compiler option to produce PIC], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)], + [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)]) +_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1) + +# +# Check to make sure the PIC flag actually works. +# +if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then + _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works], + [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)], + [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [], + [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in + "" | " "*) ;; + *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;; + esac], + [_LT_TAGVAR(lt_prog_compiler_pic, $1)= + _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no]) +fi +_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1], + [Additional compiler flags for building library objects]) + +_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1], + [How to pass a linker flag through the compiler]) +# +# Check to make sure the static flag actually works. +# +wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\" +_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works], + _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1), + $lt_tmp_static_flag, + [], + [_LT_TAGVAR(lt_prog_compiler_static, $1)=]) +_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1], + [Compiler flag to prevent dynamic linking]) +])# _LT_COMPILER_PIC + + +# _LT_LINKER_SHLIBS([TAGNAME]) +# ---------------------------- +# See if the linker supports building shared libraries. +m4_defun([_LT_LINKER_SHLIBS], +[AC_REQUIRE([LT_PATH_LD])dnl +AC_REQUIRE([LT_PATH_NM])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_DECL_SED])dnl +m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl +m4_require([_LT_TAG_COMPILER])dnl +AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) +m4_if([$1], [CXX], [ + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + case $host_os in + aix[[4-9]]*) + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global defined + # symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + ;; + pw32*) + _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds" + ;; + cygwin* | mingw* | cegcc*) + case $cc_basename in + cl*) ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + ;; + esac + ;; + *) + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + ;; + esac +], [ + runpath_var= + _LT_TAGVAR(allow_undefined_flag, $1)= + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(archive_cmds, $1)= + _LT_TAGVAR(archive_expsym_cmds, $1)= + _LT_TAGVAR(compiler_needs_object, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(hardcode_automatic, $1)=no + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= + _LT_TAGVAR(hardcode_libdir_separator, $1)= + _LT_TAGVAR(hardcode_minus_L, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported + _LT_TAGVAR(inherit_rpath, $1)=no + _LT_TAGVAR(link_all_deplibs, $1)=unknown + _LT_TAGVAR(module_cmds, $1)= + _LT_TAGVAR(module_expsym_cmds, $1)= + _LT_TAGVAR(old_archive_from_new_cmds, $1)= + _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)= + _LT_TAGVAR(thread_safe_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + # include_expsyms should be a list of space-separated symbols to be *always* + # included in the symbol list + _LT_TAGVAR(include_expsyms, $1)= + # exclude_expsyms can be an extended regexp of symbols to exclude + # it will be wrapped by ` (' and `)$', so one must not match beginning or + # end of line. Example: `a|bc|.*d.*' will exclude the symbols `a' and `bc', + # as well as any symbol that contains `d'. + _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'] + # Although _GLOBAL_OFFSET_TABLE_ is a valid symbol C name, most a.out + # platforms (ab)use it in PIC code, but their linkers get confused if + # the symbol is explicitly referenced. Since portable code cannot + # rely on this symbol name, it's probably fine to never include it in + # preloaded symbol tables. + # Exclude shared library initialization/finalization symbols. +dnl Note also adjust exclude_expsyms for C++ above. + extract_expsyms_cmds= + + case $host_os in + cygwin* | mingw* | pw32* | cegcc*) + # FIXME: the MSVC++ port hasn't been tested in a loooong time + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + if test "$GCC" != yes; then + with_gnu_ld=no + fi + ;; + interix*) + # we just hope/assume this is gcc and not c89 (= MSVC++) + with_gnu_ld=yes + ;; + openbsd*) + with_gnu_ld=no + ;; + esac + + _LT_TAGVAR(ld_shlibs, $1)=yes + + # On some targets, GNU ld is compatible enough with the native linker + # that we're better off using the native interface for both. + lt_use_gnu_ld_interface=no + if test "$with_gnu_ld" = yes; then + case $host_os in + aix*) + # The AIX port of GNU ld has always aspired to compatibility + # with the native linker. However, as the warning in the GNU ld + # block says, versions before 2.19.5* couldn't really create working + # shared libraries, regardless of the interface used. + case `$LD -v 2>&1` in + *\ \(GNU\ Binutils\)\ 2.19.5*) ;; + *\ \(GNU\ Binutils\)\ 2.[[2-9]]*) ;; + *\ \(GNU\ Binutils\)\ [[3-9]]*) ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + ;; + *) + lt_use_gnu_ld_interface=yes + ;; + esac + fi + + if test "$lt_use_gnu_ld_interface" = yes; then + # If archive_cmds runs LD, not CC, wlarc should be empty + wlarc='${wl}' + + # Set some defaults for GNU ld with shared library support. These + # are reset later if shared libraries are not supported. Putting them + # here allows them to be overridden if necessary. + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + # ancient GNU ld didn't support --whole-archive et. al. + if $LD --help 2>&1 | $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + supports_anon_versioning=no + case `$LD -v 2>&1` in + *GNU\ gold*) supports_anon_versioning=yes ;; + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.10.*) ;; # catch versions < 2.11 + *\ 2.11.93.0.2\ *) supports_anon_versioning=yes ;; # RH7.3 ... + *\ 2.11.92.0.12\ *) supports_anon_versioning=yes ;; # Mandrake 8.2 ... + *\ 2.11.*) ;; # other 2.11 versions + *) supports_anon_versioning=yes ;; + esac + + # See if GNU ld supports shared libraries. + case $host_os in + aix[[3-9]]*) + # On AIX/PPC, the GNU linker is very broken + if test "$host_cpu" != ia64; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: the GNU linker, at least up to release 2.19, is reported +*** to be unable to reliably create shared libraries on AIX. +*** Therefore, libtool is disabling shared libraries support. If you +*** really care for shared libraries, you may want to install binutils +*** 2.20 or above, or modify your PATH so that a non-GNU linker is found. +*** You will then need to restart the configuration process. + +_LT_EOF + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols' + _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'] + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared $output_objdir/$soname.def $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + + gnu* | linux* | tpf* | k*bsd*-gnu | kopensolaris*-gnu) + tmp_diet=no + if test "$host_os" = linux-dietlibc; then + case $cc_basename in + diet\ *) tmp_diet=yes;; # linux-dietlibc with static linking (!diet-dyn) + esac + fi + if $LD --help 2>&1 | $EGREP ': supported targets:.* elf' > /dev/null \ + && test "$tmp_diet" = no + then + tmp_addflag=' $pic_flag' + tmp_sharedflag='-shared' + case $cc_basename,$host_cpu in + pgcc*) # Portland Group C compiler + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag' + ;; + pgf77* | pgf90* | pgf95* | pgfortran*) + # Portland Group f77 and f90 compilers + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + tmp_addflag=' $pic_flag -Mnomain' ;; + ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64 + tmp_addflag=' -i_dynamic' ;; + efc*,ia64* | ifort*,ia64*) # Intel Fortran compiler on ia64 + tmp_addflag=' -i_dynamic -nofor_main' ;; + ifc* | ifort*) # Intel Fortran compiler + tmp_addflag=' -nofor_main' ;; + lf95*) # Lahey Fortran 8.1 + _LT_TAGVAR(whole_archive_flag_spec, $1)= + tmp_sharedflag='--shared' ;; + xl[[cC]]* | bgxl[[cC]]* | mpixl[[cC]]*) # IBM XL C 8.0 on PPC (deal with xlf below) + tmp_sharedflag='-qmkshrobj' + tmp_addflag= ;; + nvcc*) # Cuda Compiler Driver 2.2 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + ;; + esac + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) # Sun C 5.9 + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + tmp_sharedflag='-G' ;; + *Sun\ F*) # Sun Fortran 8.3 + tmp_sharedflag='-G' ;; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + + case $cc_basename in + xlf* | bgf* | bgxlf* | mpixlf*) + # IBM XL Fortran 10.1 on PPC cannot create shared libs itself + _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir' + _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $LD -shared $libobjs $deplibs $linker_flags -soname $soname -version-script $output_objdir/$libname.ver -o $lib' + fi + ;; + esac + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib' + wlarc= + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + fi + ;; + + solaris*) + if $LD -v 2>&1 | $GREP 'BFD 2\.8' > /dev/null; then + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: The releases 2.8.* of the GNU linker cannot reliably +*** create shared libraries on Solaris systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.9.1 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + elif $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*) + case `$LD -v 2>&1` in + *\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*) + _LT_TAGVAR(ld_shlibs, $1)=no + cat <<_LT_EOF 1>&2 + +*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not +*** reliably create shared libraries on SCO systems. Therefore, libtool +*** is disabling shared libraries support. We urge you to upgrade GNU +*** binutils to release 2.16.91.0.3 or newer. Another option is to modify +*** your PATH or compiler configuration so that the native linker is +*** used, and then restart. + +_LT_EOF + ;; + *) + # For security reasons, it is highly recommended that you always + # use absolute paths for naming shared libraries, and exclude the + # DT_RUNPATH tag from executables and libraries. But doing so + # requires that you compile everything twice, which is a pain. + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + sunos4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + + if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then + runpath_var= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)= + _LT_TAGVAR(export_dynamic_flag_spec, $1)= + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + # PORTME fill in a description of your system's linker (not GNU ld) + case $host_os in + aix3*) + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname' + # Note: this linker hardcodes the directories in LIBPATH if there + # are no directories specified by -L. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then + # Neither direct hardcoding nor static linking is supported with a + # broken collect2. + _LT_TAGVAR(hardcode_direct, $1)=unsupported + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + # If we're using GNU nm, then we don't want the "-C" option. + # -C means demangle to AIX nm, but means don't demangle with GNU nm + # Also, AIX nm treats weak defined symbols like other global + # defined symbols, whereas GNU nm marks them as "W". + if $NM -V 2>&1 | $GREP 'GNU' > /dev/null; then + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + else + _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols' + fi + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then + aix_use_runtimelinking=yes + break + fi + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GCC" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + ;; + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + amigaos*) + case $host_cpu in + powerpc) + # see comment about AmigaOS4 .so support + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='' + ;; + m68k) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/a2ixlibrary.data~$ECHO "#define NAME $libname" > $output_objdir/a2ixlibrary.data~$ECHO "#define LIBRARY_ID 1" >> $output_objdir/a2ixlibrary.data~$ECHO "#define VERSION $major" >> $output_objdir/a2ixlibrary.data~$ECHO "#define REVISION $revision" >> $output_objdir/a2ixlibrary.data~$AR $AR_FLAGS $lib $libobjs~$RANLIB $lib~(cd $output_objdir && a2ixlibrary -32)' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + ;; + + bsdi[[45]]*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic + ;; + + cygwin* | mingw* | pw32* | cegcc*) + # When not using gcc, we currently assume that we are using + # Microsoft Visual C++. + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + case $cc_basename in + cl*) + # Native MSVC + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + sed -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + sed -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols' + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # Assume MSVC wrapper + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames=' + # The linker will automatically build a .lib file if we build a DLL. + _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + # FIXME: Should let the user specify the lib program. + _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + ;; + esac + ;; + + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + freebsd1*) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + # FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor + # support. Future versions do this automatically, but an explicit c++rt0.o + # does not break anything, and helps significantly (at the cost of a little + # extra space). + freebsd2.2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # Unfortunately, older versions of FreeBSD 2 do not have this feature. + freebsd2*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + # FreeBSD 3 and greater uses gcc -shared to do shared libraries. + freebsd* | dragonfly*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + hpux9*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$LD -b +b $install_libdir -o $output_objdir/$soname $libobjs $deplibs $linker_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + + hpux10*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags' + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + fi + ;; + + hpux11*) + if test "$GCC" = yes && test "$with_gnu_ld" = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + else + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + m4_if($1, [], [ + # Older versions of the 11.00 compiler do not understand -b yet + # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does) + _LT_LINKER_OPTION([if $CC understands -b], + _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'], + [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])], + [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags']) + ;; + esac + fi + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + + # hardcode_minus_L: Not really in the search PATH, + # but as the default location of the library. + _LT_TAGVAR(hardcode_minus_L, $1)=yes + ;; + esac + fi + ;; + + irix5* | irix6* | nonstopux*) + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + # Try to use the -exported_symbol ld option, if it does not + # work, assume that -exports_file does not work either and + # implicitly export all symbols. + # This should be the same for all languages, so no per-tag cache variable. + AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol], + [lt_cv_irix_exported_symbol], + [save_LDFLAGS="$LDFLAGS" + LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null" + AC_LINK_IFELSE( + [AC_LANG_SOURCE( + [AC_LANG_CASE([C], [[int foo (void) { return 0; }]], + [C++], [[int foo (void) { return 0; }]], + [Fortran 77], [[ + subroutine foo + end]], + [Fortran], [[ + subroutine foo + end]])])], + [lt_cv_irix_exported_symbol=yes], + [lt_cv_irix_exported_symbol=no]) + LDFLAGS="$save_LDFLAGS"]) + if test "$lt_cv_irix_exported_symbol" = yes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations ${wl}-exports_file ${wl}$export_symbols -o $lib' + fi + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -exports_file $export_symbols -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out + else + _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + newsos6) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *nto* | *qnx*) + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + else + case $host_os in + openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*) + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + ;; + esac + fi + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + os2*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(archive_cmds, $1)='$ECHO "LIBRARY $libname INITINSTANCE" > $output_objdir/$libname.def~$ECHO "DESCRIPTION \"$libname\"" >> $output_objdir/$libname.def~echo DATA >> $output_objdir/$libname.def~echo " SINGLE NONSHARED" >> $output_objdir/$libname.def~echo EXPORTS >> $output_objdir/$libname.def~emxexp $libobjs >> $output_objdir/$libname.def~$CC -Zdll -Zcrtdll -o $lib $libobjs $deplibs $compiler_flags $output_objdir/$libname.def' + _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def' + ;; + + osf3*) + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + osf4* | osf5*) # as osf3* with the addition of -msym flag + if test "$GCC" = yes; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $pic_flag $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + else + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; printf "%s\\n" "-hidden">> $lib.exp~ + $CC -shared${allow_undefined_flag} ${wl}-input ${wl}$lib.exp $compiler_flags $libobjs $deplibs -soname $soname `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~$RM $lib.exp' + + # Both c and cxx compiler support -rpath directly + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)='no' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + ;; + + solaris*) + _LT_TAGVAR(no_undefined_flag, $1)=' -z defs' + if test "$GCC" = yes; then + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + else + case `$CC -V 2>&1` in + *"Compilers 5.0"*) + wlarc='' + _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $LD -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $linker_flags~$RM $lib.exp' + ;; + *) + wlarc='${wl}' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} -M $lib.exp -h $soname -o $lib $libobjs $deplibs $compiler_flags~$RM $lib.exp' + ;; + esac + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. GCC discards it without `$wl', + # but is careful enough not to reorder. + # Supported since Solaris 2.6 (maybe 2.5.1?) + if test "$GCC" = yes; then + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + fi + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + sunos4*) + if test "x$host_vendor" = xsequent; then + # Use $CC to link under sequent, because it throws in some extra .o + # files that make .init and .fini sections work. + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags' + fi + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4) + case $host_vendor in + sni) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true??? + ;; + siemens) + ## LD is ld it makes a PLAMLIB + ## CC just makes a GrossModule. + _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs' + _LT_TAGVAR(hardcode_direct, $1)=no + ;; + motorola) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie + ;; + esac + runpath_var='LD_RUN_PATH' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + sysv4.3*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport' + ;; + + sysv4*MP*) + if test -d /usr/nec; then + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var=LD_RUN_PATH + hardcode_runpath_var=yes + _LT_TAGVAR(ld_shlibs, $1)=yes + fi + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + if test "$GCC" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + fi + ;; + + uts4*) + _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + + *) + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + if test x$host_vendor = xsni; then + case $host in + sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym' + ;; + esac + fi + fi +]) +AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) +test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + +_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld + +_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl +_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl +_LT_DECL([], [extract_expsyms_cmds], [2], + [The commands to extract the exported symbol list from a shared archive]) + +# +# Do we need to explicitly link libc? +# +case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in +x|xyes) + # Assume -lc should be added + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + + if test "$enable_shared" = yes && test "$GCC" = yes; then + case $_LT_TAGVAR(archive_cmds, $1) in + *'~'*) + # FIXME: we may have to deal with multi-command sequences. + ;; + '$CC '*) + # Test whether the compiler implicitly links with -lc since on some + # systems, -lgcc has to come before -lc. If gcc already passes -lc + # to ld, don't add -lc before -lgcc. + AC_CACHE_CHECK([whether -lc should be explicitly linked in], + [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1), + [$RM conftest* + echo "$lt_simple_compile_test_code" > conftest.$ac_ext + + if AC_TRY_EVAL(ac_compile) 2>conftest.err; then + soname=conftest + lib=conftest + libobjs=conftest.$ac_objext + deplibs= + wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) + pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1) + compiler_flags=-v + linker_flags=-v + verstring= + output_objdir=. + libname=conftest + lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1) + _LT_TAGVAR(allow_undefined_flag, $1)= + if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1) + then + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no + else + lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes + fi + _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag + else + cat conftest.err 1>&5 + fi + $RM conftest* + ]) + _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1) + ;; + esac + fi + ;; +esac + +_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0], + [Whether or not to add -lc for building shared libraries]) +_LT_TAGDECL([allow_libtool_libs_with_static_runtimes], + [enable_shared_with_static_runtimes], [0], + [Whether or not to disallow shared libs when runtime libs are static]) +_LT_TAGDECL([], [export_dynamic_flag_spec], [1], + [Compiler flag to allow reflexive dlopens]) +_LT_TAGDECL([], [whole_archive_flag_spec], [1], + [Compiler flag to generate shared objects directly from archives]) +_LT_TAGDECL([], [compiler_needs_object], [1], + [Whether the compiler copes with passing no objects directly]) +_LT_TAGDECL([], [old_archive_from_new_cmds], [2], + [Create an old-style archive from a shared archive]) +_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2], + [Create a temporary old-style archive to link instead of a shared archive]) +_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive]) +_LT_TAGDECL([], [archive_expsym_cmds], [2]) +_LT_TAGDECL([], [module_cmds], [2], + [Commands used to build a loadable module if different from building + a shared archive.]) +_LT_TAGDECL([], [module_expsym_cmds], [2]) +_LT_TAGDECL([], [with_gnu_ld], [1], + [Whether we are building with GNU ld or not]) +_LT_TAGDECL([], [allow_undefined_flag], [1], + [Flag that allows shared libraries with undefined symbols to be built]) +_LT_TAGDECL([], [no_undefined_flag], [1], + [Flag that enforces no undefined symbols]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1], + [Flag to hardcode $libdir into a binary during linking. + This must work even if $libdir does not exist]) +_LT_TAGDECL([], [hardcode_libdir_flag_spec_ld], [1], + [[If ld is used when linking, flag to hardcode $libdir into a binary + during linking. This must work even if $libdir does not exist]]) +_LT_TAGDECL([], [hardcode_libdir_separator], [1], + [Whether we need a single "-rpath" flag with a separated argument]) +_LT_TAGDECL([], [hardcode_direct], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary]) +_LT_TAGDECL([], [hardcode_direct_absolute], [0], + [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes + DIR into the resulting binary and the resulting library dependency is + "absolute", i.e impossible to change by setting ${shlibpath_var} if the + library is relocated]) +_LT_TAGDECL([], [hardcode_minus_L], [0], + [Set to "yes" if using the -LDIR flag during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_shlibpath_var], [0], + [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR + into the resulting binary]) +_LT_TAGDECL([], [hardcode_automatic], [0], + [Set to "yes" if building a shared library automatically hardcodes DIR + into the library and all subsequent libraries and executables linked + against it]) +_LT_TAGDECL([], [inherit_rpath], [0], + [Set to yes if linker adds runtime paths of dependent libraries + to runtime path list]) +_LT_TAGDECL([], [link_all_deplibs], [0], + [Whether libtool must link a program against all its dependency libraries]) +_LT_TAGDECL([], [always_export_symbols], [0], + [Set to "yes" if exported symbols are required]) +_LT_TAGDECL([], [export_symbols_cmds], [2], + [The commands to list exported symbols]) +_LT_TAGDECL([], [exclude_expsyms], [1], + [Symbols that should not be listed in the preloaded symbols]) +_LT_TAGDECL([], [include_expsyms], [1], + [Symbols that must always be exported]) +_LT_TAGDECL([], [prelink_cmds], [2], + [Commands necessary for linking programs (against libraries) with templates]) +_LT_TAGDECL([], [postlink_cmds], [2], + [Commands necessary for finishing linking programs]) +_LT_TAGDECL([], [file_list_spec], [1], + [Specify filename containing input files]) +dnl FIXME: Not yet implemented +dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1], +dnl [Compiler flag to generate thread safe objects]) +])# _LT_LINKER_SHLIBS + + +# _LT_LANG_C_CONFIG([TAG]) +# ------------------------ +# Ensure that the configuration variables for a C compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_C_CONFIG], +[m4_require([_LT_DECL_EGREP])dnl +lt_save_CC="$CC" +AC_LANG_PUSH(C) + +# Source file extension for C test sources. +ac_ext=c + +# Object file extension for compiled C test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="int some_variable = 0;" + +# Code to be used in simple link tests +lt_simple_link_test_code='int main(){return(0);}' + +_LT_TAG_COMPILER +# Save the default compiler, since it gets overwritten when the other +# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP. +compiler_DEFAULT=$CC + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + LT_SYS_DLOPEN_SELF + _LT_CMD_STRIPLIB + + # Report which library types will actually be built + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_CONFIG($1) +fi +AC_LANG_POP +CC="$lt_save_CC" +])# _LT_LANG_C_CONFIG + + +# _LT_LANG_CXX_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a C++ compiler are suitably +# defined. These variables are subsequently used by _LT_CONFIG to write +# the compiler configuration to `libtool'. +m4_defun([_LT_LANG_CXX_CONFIG], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +m4_require([_LT_DECL_EGREP])dnl +m4_require([_LT_PATH_MANIFEST_TOOL])dnl +if test -n "$CXX" && ( test "X$CXX" != "Xno" && + ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) || + (test "X$CXX" != "Xg++"))) ; then + AC_PROG_CXXCPP +else + _lt_caught_CXX_error=yes +fi + +AC_LANG_PUSH(C++) +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(compiler_needs_object, $1)=no +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for C++ test sources. +ac_ext=cpp + +# Object file extension for compiled C++ test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the CXX compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_caught_CXX_error" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="int some_variable = 0;" + + # Code to be used in simple link tests + lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }' + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC=$CC + lt_save_CFLAGS=$CFLAGS + lt_save_LD=$LD + lt_save_GCC=$GCC + GCC=$GXX + lt_save_with_gnu_ld=$with_gnu_ld + lt_save_path_LD=$lt_cv_path_LD + if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then + lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx + else + $as_unset lt_cv_prog_gnu_ld + fi + if test -n "${lt_cv_path_LDCXX+set}"; then + lt_cv_path_LD=$lt_cv_path_LDCXX + else + $as_unset lt_cv_path_LD + fi + test -z "${LDCXX+set}" || LD=$LDCXX + CC=${CXX-"c++"} + CFLAGS=$CXXFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + # We don't want -fno-exception when compiling C++ code, so set the + # no_builtin_flag separately + if test "$GXX" = yes; then + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' + else + _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)= + fi + + if test "$GXX" = yes; then + # Set up default GNU C++ configuration + + LT_PATH_LD + + # Check if GNU C++ uses GNU ld as the underlying linker, since the + # archiving commands below assume that GNU ld is being used. + if test "$with_gnu_ld" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # If archive_cmds runs LD, not CC, wlarc should be empty + # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to + # investigate it a little bit more. (MM) + wlarc='${wl}' + + # ancient GNU ld didn't support --whole-archive et. al. + if eval "`$CC -print-prog-name=ld` --help 2>&1" | + $GREP 'no-whole-archive' > /dev/null; then + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + else + _LT_TAGVAR(whole_archive_flag_spec, $1)= + fi + else + with_gnu_ld=no + wlarc= + + # A generic and very simple default shared library creation + # command for GNU C++ for the case where it uses the native + # linker, instead of GNU ld. If possible, this setting should + # overridden to take advantage of the native linker features on + # the platform it is being used on. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + fi + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + GXX=no + with_gnu_ld=no + wlarc= + fi + + # PORTME: fill in a description of your system's C++ link characteristics + AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries]) + _LT_TAGVAR(ld_shlibs, $1)=yes + case $host_os in + aix3*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aix[[4-9]]*) + if test "$host_cpu" = ia64; then + # On IA64, the linker does run time linking by default, so we don't + # have to do anything special. + aix_use_runtimelinking=no + exp_sym_flag='-Bexport' + no_entry_flag="" + else + aix_use_runtimelinking=no + + # Test if we are trying to use run time linking or normal + # AIX style linking. If -brtl is somewhere in LDFLAGS, we + # need to do runtime linking. + case $host_os in aix4.[[23]]|aix4.[[23]].*|aix[[5-9]]*) + for ld_flag in $LDFLAGS; do + case $ld_flag in + *-brtl*) + aix_use_runtimelinking=yes + break + ;; + esac + done + ;; + esac + + exp_sym_flag='-bexport' + no_entry_flag='-bnoentry' + fi + + # When large executables or shared objects are built, AIX ld can + # have problems creating the table of contents. If linking a library + # or program results in "error TOC overflow" add -mminimal-toc to + # CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not + # enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS. + + _LT_TAGVAR(archive_cmds, $1)='' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='${wl}-f,' + + if test "$GXX" = yes; then + case $host_os in aix4.[[012]]|aix4.[[012]].*) + # We only want to do this on AIX 4.2 and lower, the check + # below for broken collect2 doesn't work under 4.3+ + collect2name=`${CC} -print-prog-name=collect2` + if test -f "$collect2name" && + strings "$collect2name" | $GREP resolve_lib_name >/dev/null + then + # We have reworked collect2 + : + else + # We have old collect2 + _LT_TAGVAR(hardcode_direct, $1)=unsupported + # It fails to find uninstalled libraries when the uninstalled + # path is not listed in the libpath. Setting hardcode_minus_L + # to unsupported forces relinking + _LT_TAGVAR(hardcode_minus_L, $1)=yes + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)= + fi + esac + shared_flag='-shared' + if test "$aix_use_runtimelinking" = yes; then + shared_flag="$shared_flag "'${wl}-G' + fi + else + # not using gcc + if test "$host_cpu" = ia64; then + # VisualAge C++, Version 5.5 for AIX 5L for IA-64, Beta 3 Release + # chokes on -Wl,-G. The following line is correct: + shared_flag='-G' + else + if test "$aix_use_runtimelinking" = yes; then + shared_flag='${wl}-G' + else + shared_flag='${wl}-bM:SRE' + fi + fi + fi + + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-bexpall' + # It seems that -bexpall does not export symbols beginning with + # underscore (_), so it is better to generate a list of symbols to + # export. + _LT_TAGVAR(always_export_symbols, $1)=yes + if test "$aix_use_runtimelinking" = yes; then + # Warning - without using the other runtime loading flags (-brtl), + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(allow_undefined_flag, $1)='-berok' + # Determine the default libpath from the value encoded in an empty + # executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then func_echo_all "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag" + else + if test "$host_cpu" = ia64; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib' + _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs" + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags ${wl}${allow_undefined_flag} '"\${wl}$exp_sym_flag:\$export_symbols" + else + # Determine the default libpath from the value encoded in an + # empty executable. + _LT_SYS_MODULE_PATH_AIX([$1]) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath" + # Warning - without using the other run time loading flags, + # -berok will link without error, but may produce a broken library. + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok' + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok' + if test "$with_gnu_ld" = yes; then + # We only use this code for GNU lds that support --whole-archive. + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + else + # Exported symbols can be pulled into shared objects from archives + _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience' + fi + _LT_TAGVAR(archive_cmds_need_lc, $1)=yes + # This is similar to how AIX traditionally builds its shared + # libraries. + _LT_TAGVAR(archive_expsym_cmds, $1)="\$CC $shared_flag"' -o $output_objdir/$soname $libobjs $deplibs ${wl}-bnoentry $compiler_flags ${wl}-bE:$export_symbols${allow_undefined_flag}~$AR $AR_FLAGS $output_objdir/$libname$release.a $output_objdir/$soname' + fi + fi + ;; + + beos*) + if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + # Joseph Beckenbach says some releases of gcc + # support --undefined. This deserves some investigation. FIXME + _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + chorus*) + case $cc_basename in + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + cygwin* | mingw* | pw32* | cegcc*) + case $GXX,$cc_basename in + ,cl* | no,cl*) + # Native MSVC + # hardcode_libdir_flag_spec is actually meaningless, as there is + # no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' ' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=yes + _LT_TAGVAR(file_list_spec, $1)='@' + # Tell ltmain to make .lib files, not .a files. + libext=lib + # Tell ltmain to make .dll files, not .so files. + shrext_cmds=".dll" + # FIXME: Setting linknames here is a bad hack. + _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames=' + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + $SED -n -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' -e '1\\\!p' < $export_symbols > $output_objdir/$soname.exp; + else + $SED -e 's/\\\\\\\(.*\\\\\\\)/-link\\\ -EXPORT:\\\\\\\1/' < $export_symbols > $output_objdir/$soname.exp; + fi~ + $CC -o $tool_output_objdir$soname $libobjs $compiler_flags $deplibs "@$tool_output_objdir$soname.exp" -Wl,-DLL,-IMPLIB:"$tool_output_objdir$libname.dll.lib"~ + linknames=' + # The linker will not automatically build a static lib if we build a DLL. + # _LT_TAGVAR(old_archive_from_new_cmds, $1)='true' + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + # Don't use ranlib + _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib' + _LT_TAGVAR(postlink_cmds, $1)='lt_outputfile="@OUTPUT@"~ + lt_tool_outputfile="@TOOL_OUTPUT@"~ + case $lt_outputfile in + *.exe|*.EXE) ;; + *) + lt_outputfile="$lt_outputfile.exe" + lt_tool_outputfile="$lt_tool_outputfile.exe" + ;; + esac~ + func_to_tool_file "$lt_outputfile"~ + if test "$MANIFEST_TOOL" != ":" && test -f "$lt_outputfile.manifest"; then + $MANIFEST_TOOL -manifest "$lt_tool_outputfile.manifest" -outputresource:"$lt_tool_outputfile" || exit 1; + $RM "$lt_outputfile.manifest"; + fi' + ;; + *) + # g++ + # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless, + # as there is no search path for DLLs. + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols' + _LT_TAGVAR(allow_undefined_flag, $1)=unsupported + _LT_TAGVAR(always_export_symbols, $1)=no + _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes + + if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + # If the export-symbols file already is a .def file (1st line + # is EXPORTS), use it as is; otherwise, prepend... + _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then + cp $export_symbols $output_objdir/$soname.def; + else + echo EXPORTS > $output_objdir/$soname.def; + cat $export_symbols >> $output_objdir/$soname.def; + fi~ + $CC -shared -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib' + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + darwin* | rhapsody*) + _LT_DARWIN_LINKER_FEATURES($1) + ;; + + dgux*) + case $cc_basename in + ec++*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + ghcx*) + # Green Hills C++ Compiler + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + freebsd[[12]]*) + # C++ shared libraries reported to be fairly broken before + # switch to ELF + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + freebsd-elf*) + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + ;; + + freebsd* | dragonfly*) + # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF + # conventions + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + gnu*) + ;; + + haiku*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + + hpux9*) + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib' + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + hpux10*|hpux11*) + if test $with_gnu_ld = no; then + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + case $host_cpu in + hppa*64*|ia64*) + ;; + *) + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + ;; + esac + fi + case $host_cpu in + hppa*64*|ia64*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + ;; + *) + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH, + # but as the default + # location of the library. + ;; + esac + + case $cc_basename in + CC*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + aCC*) + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes; then + if test $with_gnu_ld = no; then + case $host_cpu in + hppa*64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + ia64*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + ;; + esac + fi + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + interix[[3-9]]*) + _LT_TAGVAR(hardcode_direct, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + # Hack: On Interix 3.x, we cannot compile PIC because of a broken gcc. + # Instead, shared libraries are loaded at an image base (0x10000000 by + # default) and relocated if they conflict, which is a slow very memory + # consuming and fragmenting process. To avoid this, we pick a random, + # 256 KiB-aligned image base between 0x50000000 and 0x6FFC0000 at link + # time. Moving up from 0x10000000 also allows more sbrk(2) space. + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='sed "s,^,_," $export_symbols >$output_objdir/$soname.expsym~$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--retain-symbols-file,$output_objdir/$soname.expsym ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib' + ;; + irix5* | irix6*) + case $cc_basename in + CC*) + # SGI C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + + # Archives containing C++ object files must be created using + # "CC -ar", where "CC" is the IRIX C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs' + ;; + *) + if test "$GXX" = yes; then + if test "$with_gnu_ld" = no; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + else + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib' + fi + fi + _LT_TAGVAR(link_all_deplibs, $1)=yes + ;; + esac + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + _LT_TAGVAR(inherit_rpath, $1)=yes + ;; + + linux* | k*bsd*-gnu | kopensolaris*-gnu) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib' + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + + # Archives containing C++ object files must be created using + # "CC -Bstatic", where "CC" is the KAI C++ compiler. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' + ;; + icpc* | ecpc* ) + # Intel C++ + with_gnu_ld=yes + # version 8.0 and above of icpc choke on multiply defined symbols + # if we add $predep_objects and $postdep_objects, however 7.1 and + # earlier do not add the objects themselves. + case `$CC -V 2>&1` in + *"Version 7."*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + *) # Version 8.0 or newer + tmp_idyn= + case $host_cpu in + ia64*) tmp_idyn=' -i_dynamic';; + esac + _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib' + ;; + esac + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive' + ;; + pgCC* | pgcpp*) + # Portland Group C++ compiler + case `$CC -V` in + *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*) + _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~ + compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"' + _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~ + $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~ + $RANLIB $oldlib' + _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~ + rm -rf $tpldir~ + $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~ + $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + *) # Version 6 and above use weak symbols + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + ;; + cxx*) + # Compaq C++ + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols' + + runpath_var=LD_RUN_PATH + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed' + ;; + xl* | mpixl* | bgxl*) + # IBM XL 8.0 on PPC, with GNU ld + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic' + _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib' + if test "x$supports_anon_versioning" = xyes; then + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~ + cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~ + echo "local: *; };" >> $output_objdir/$libname.ver~ + $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib' + fi + ;; + *) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; func_echo_all \"$new_convenience\"` ${wl}--no-whole-archive' + _LT_TAGVAR(compiler_needs_object, $1)=yes + + # Not sure whether something based on + # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 + # would be better. + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + esac + ;; + esac + ;; + + lynxos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + m88k*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + mvs*) + case $cc_basename in + cxx*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + netbsd*) + if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags' + wlarc= + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + fi + # Workaround some broken pre-1.5 toolchains + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"' + ;; + + *nto* | *qnx*) + _LT_TAGVAR(ld_shlibs, $1)=yes + ;; + + openbsd2*) + # C++ shared libraries are fairly broken + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + openbsd*) + if test -f /usr/libexec/ld.so; then + _LT_TAGVAR(hardcode_direct, $1)=yes + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_direct_absolute, $1)=yes + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib' + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E' + _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive' + fi + output_verbose_link_cmd=func_echo_all + else + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + + osf3* | osf4* | osf5*) + case $cc_basename in + KCC*) + # Kuck and Associates, Inc. (KAI) C++ Compiler + + # KCC will only create a shared library if the output file + # ends with ".so" (or ".sl" for HP-UX), so rename the library + # to its proper name (with version) after linking. + _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Archives containing C++ object files must be created using + # the KAI C++ compiler. + case $host in + osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;; + *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;; + esac + ;; + RCC*) + # Rational C++ 2.4.1 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + cxx*) + case $host in + osf3*) + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + ;; + *) + _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*' + _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~ + echo "-hidden">> $lib.exp~ + $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~ + $RM $lib.exp' + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + # + # There doesn't appear to be a way to prevent this compiler from + # explicitly linking system object files so we need to strip them + # from the output so that they don't get included in the library + # dependencies. + output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"' + ;; + *) + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*' + case $host in + osf3*) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib' + ;; + esac + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=: + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + + else + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + fi + ;; + esac + ;; + + psos*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + sunos4*) + case $cc_basename in + CC*) + # Sun C++ 4.x + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + lcc*) + # Lucid + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + solaris*) + case $cc_basename in + CC* | sunCC*) + # Sun C++ 4.2, 5.x and Centerline C++ + _LT_TAGVAR(archive_cmds_need_lc,$1)=yes + _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs' + _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir' + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + # The compiler driver will combine and reorder linker options, + # but understands `-z linker_flag'. + # Supported since Solaris 2.6 (maybe 2.5.1?) + _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract' + ;; + esac + _LT_TAGVAR(link_all_deplibs, $1)=yes + + output_verbose_link_cmd='func_echo_all' + + # Archives containing C++ object files must be created using + # "CC -xar", where "CC" is the Sun C++ compiler. This is + # necessary to make sure instantiated templates are included + # in the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs' + ;; + gcx*) + # Green Hills C++ Compiler + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + + # The C++ compiler must be used to create the archive. + _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs' + ;; + *) + # GNU C++ compiler with Solaris linker + if test "$GXX" = yes && test "$with_gnu_ld" = no; then + _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs' + if $CC --version | $GREP -v '^2\.7' > /dev/null; then + _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + else + # g++ 2.7 appears to require `-G' NOT `-shared' on this + # platform. + _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib' + _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~ + $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp' + + # Commands to make compiler produce verbose output that lists + # what "hidden" libraries, object files and flags are used when + # linking a shared library. + output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"' + fi + + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir' + case $host_os in + solaris2.[[0-5]] | solaris2.[[0-5]].*) ;; + *) + _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract' + ;; + esac + fi + ;; + esac + ;; + + sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*) + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + sysv5* | sco3.2v5* | sco5v6*) + # Note: We can NOT use -z defs as we might desire, because we do not + # link with -lc, and that would cause any symbols used from libc to + # always be unresolved, which means just about no library would + # ever link correctly. If we're not using GNU ld we use -z text + # though, which does catch some bad symbols but isn't as heavy-handed + # as -z defs. + _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text' + _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs' + _LT_TAGVAR(archive_cmds_need_lc, $1)=no + _LT_TAGVAR(hardcode_shlibpath_var, $1)=no + _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir' + _LT_TAGVAR(hardcode_libdir_separator, $1)=':' + _LT_TAGVAR(link_all_deplibs, $1)=yes + _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport' + runpath_var='LD_RUN_PATH' + + case $cc_basename in + CC*) + _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~ + '"$_LT_TAGVAR(old_archive_cmds, $1)" + _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~ + '"$_LT_TAGVAR(reload_cmds, $1)" + ;; + *) + _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags' + ;; + esac + ;; + + tandem*) + case $cc_basename in + NCC*) + # NonStop-UX NCC 3.20 + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + ;; + + vxworks*) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + + *) + # FIXME: insert proper C++ library support + _LT_TAGVAR(ld_shlibs, $1)=no + ;; + esac + + AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)]) + test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no + + _LT_TAGVAR(GCC, $1)="$GXX" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS + LDCXX=$LD + LD=$lt_save_LD + GCC=$lt_save_GCC + with_gnu_ld=$lt_save_with_gnu_ld + lt_cv_path_LDCXX=$lt_cv_path_LD + lt_cv_path_LD=$lt_save_path_LD + lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld + lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld +fi # test "$_lt_caught_CXX_error" != yes + +AC_LANG_POP +])# _LT_LANG_CXX_CONFIG + + +# _LT_FUNC_STRIPNAME_CNF +# ---------------------- +# func_stripname_cnf prefix suffix name +# strip PREFIX and SUFFIX off of NAME. +# PREFIX and SUFFIX must not contain globbing or regex special +# characters, hashes, percent signs, but SUFFIX may contain a leading +# dot (in which case that matches only a dot). +# +# This function is identical to the (non-XSI) version of func_stripname, +# except this one can be used by m4 code that may be executed by configure, +# rather than the libtool script. +m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl +AC_REQUIRE([_LT_DECL_SED]) +AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH]) +func_stripname_cnf () +{ + case ${2} in + .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;; + *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;; + esac +} # func_stripname_cnf +])# _LT_FUNC_STRIPNAME_CNF + +# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME]) +# --------------------------------- +# Figure out "hidden" library dependencies from verbose +# compiler output when linking a shared library. +# Parse the compiler output and extract the necessary +# objects, libraries and library flags. +m4_defun([_LT_SYS_HIDDEN_LIBDEPS], +[m4_require([_LT_FILEUTILS_DEFAULTS])dnl +AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl +# Dependencies to place before and after the object being linked: +_LT_TAGVAR(predep_objects, $1)= +_LT_TAGVAR(postdep_objects, $1)= +_LT_TAGVAR(predeps, $1)= +_LT_TAGVAR(postdeps, $1)= +_LT_TAGVAR(compiler_lib_search_path, $1)= + +dnl we can't use the lt_simple_compile_test_code here, +dnl because it contains code intended for an executable, +dnl not a library. It's possible we should let each +dnl tag define a new lt_????_link_test_code variable, +dnl but it's only used here... +m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF +int a; +void foo (void) { a = 0; } +_LT_EOF +], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF +class Foo +{ +public: + Foo (void) { a = 0; } +private: + int a; +}; +_LT_EOF +], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer*4 a + a=0 + return + end +_LT_EOF +], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF + subroutine foo + implicit none + integer a + a=0 + return + end +_LT_EOF +], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF +public class foo { + private int a; + public void bar (void) { + a = 0; + } +}; +_LT_EOF +]) + +_lt_libdeps_save_CFLAGS=$CFLAGS +case "$CC $CFLAGS " in #( +*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;; +*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;; +esac + +dnl Parse the compiler output and extract the necessary +dnl objects, libraries and library flags. +if AC_TRY_EVAL(ac_compile); then + # Parse the compiler output and extract the necessary + # objects, libraries and library flags. + + # Sentinel used to keep track of whether or not we are before + # the conftest object file. + pre_test_object_deps_done=no + + for p in `eval "$output_verbose_link_cmd"`; do + case ${prev}${p} in + + -L* | -R* | -l*) + # Some compilers place space between "-{L,R}" and the path. + # Remove the space. + if test $p = "-L" || + test $p = "-R"; then + prev=$p + continue + fi + + # Expand the sysroot to ease extracting the directories later. + if test -z "$prev"; then + case $p in + -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;; + -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;; + -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;; + esac + fi + case $p in + =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;; + esac + if test "$pre_test_object_deps_done" = no; then + case ${prev} in + -L | -R) + # Internal compiler library paths should come after those + # provided the user. The postdeps already come after the + # user supplied libs so there is no need to process them. + if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then + _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}" + else + _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}" + fi + ;; + # The "-l" case would never come before the object being + # linked, so don't bother handling this case. + esac + else + if test -z "$_LT_TAGVAR(postdeps, $1)"; then + _LT_TAGVAR(postdeps, $1)="${prev}${p}" + else + _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}" + fi + fi + prev= + ;; + + *.lto.$objext) ;; # Ignore GCC LTO objects + *.$objext) + # This assumes that the test object file only shows up + # once in the compiler output. + if test "$p" = "conftest.$objext"; then + pre_test_object_deps_done=yes + continue + fi + + if test "$pre_test_object_deps_done" = no; then + if test -z "$_LT_TAGVAR(predep_objects, $1)"; then + _LT_TAGVAR(predep_objects, $1)="$p" + else + _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p" + fi + else + if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then + _LT_TAGVAR(postdep_objects, $1)="$p" + else + _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p" + fi + fi + ;; + + *) ;; # Ignore the rest. + + esac + done + + # Clean up. + rm -f a.out a.exe +else + echo "libtool.m4: error: problem compiling $1 test program" +fi + +$RM -f confest.$objext +CFLAGS=$_lt_libdeps_save_CFLAGS + +# PORTME: override above test on systems where it is broken +m4_if([$1], [CXX], +[case $host_os in +interix[[3-9]]*) + # Interix 3.5 installs completely hosed .la files for C++, so rather than + # hack all around it, let's just trust "g++" to DTRT. + _LT_TAGVAR(predep_objects,$1)= + _LT_TAGVAR(postdep_objects,$1)= + _LT_TAGVAR(postdeps,$1)= + ;; + +linux*) + case `$CC -V 2>&1 | sed 5q` in + *Sun\ C*) + # Sun C++ 5.9 + + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; + +solaris*) + case $cc_basename in + CC* | sunCC*) + # The more standards-conforming stlport4 library is + # incompatible with the Cstd library. Avoid specifying + # it if it's in CXXFLAGS. Ignore libCrun as + # -library=stlport4 depends on it. + case " $CXX $CXXFLAGS " in + *" -library=stlport4 "*) + solaris_use_stlport4=yes + ;; + esac + + # Adding this requires a known-good setup of shared libraries for + # Sun compiler versions before 5.6, else PIC objects from an old + # archive will be linked into the output, leading to subtle bugs. + if test "$solaris_use_stlport4" != yes; then + _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun' + fi + ;; + esac + ;; +esac +]) + +case " $_LT_TAGVAR(postdeps, $1) " in +*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;; +esac + _LT_TAGVAR(compiler_lib_search_dirs, $1)= +if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then + _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'` +fi +_LT_TAGDECL([], [compiler_lib_search_dirs], [1], + [The directories searched by this compiler when creating a shared library]) +_LT_TAGDECL([], [predep_objects], [1], + [Dependencies to place before and after the objects being linked to + create a shared library]) +_LT_TAGDECL([], [postdep_objects], [1]) +_LT_TAGDECL([], [predeps], [1]) +_LT_TAGDECL([], [postdeps], [1]) +_LT_TAGDECL([], [compiler_lib_search_path], [1], + [The library search path used internally by the compiler when linking + a shared library]) +])# _LT_SYS_HIDDEN_LIBDEPS + + +# _LT_LANG_F77_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for a Fortran 77 compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_F77_CONFIG], +[AC_LANG_PUSH(Fortran 77) +if test -z "$F77" || test "X$F77" = "Xno"; then + _lt_disable_F77=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for f77 test sources. +ac_ext=f + +# Object file extension for compiled f77 test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the F77 compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_F77" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${F77-"f77"} + CFLAGS=$FFLAGS + compiler=$CC + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + GCC=$G77 + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$G77" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC="$lt_save_CC" + CFLAGS="$lt_save_CFLAGS" +fi # test "$_lt_disable_F77" != yes + +AC_LANG_POP +])# _LT_LANG_F77_CONFIG + + +# _LT_LANG_FC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for a Fortran compiler are +# suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_FC_CONFIG], +[AC_LANG_PUSH(Fortran) + +if test -z "$FC" || test "X$FC" = "Xno"; then + _lt_disable_FC=yes +fi + +_LT_TAGVAR(archive_cmds_need_lc, $1)=no +_LT_TAGVAR(allow_undefined_flag, $1)= +_LT_TAGVAR(always_export_symbols, $1)=no +_LT_TAGVAR(archive_expsym_cmds, $1)= +_LT_TAGVAR(export_dynamic_flag_spec, $1)= +_LT_TAGVAR(hardcode_direct, $1)=no +_LT_TAGVAR(hardcode_direct_absolute, $1)=no +_LT_TAGVAR(hardcode_libdir_flag_spec, $1)= +_LT_TAGVAR(hardcode_libdir_flag_spec_ld, $1)= +_LT_TAGVAR(hardcode_libdir_separator, $1)= +_LT_TAGVAR(hardcode_minus_L, $1)=no +_LT_TAGVAR(hardcode_automatic, $1)=no +_LT_TAGVAR(inherit_rpath, $1)=no +_LT_TAGVAR(module_cmds, $1)= +_LT_TAGVAR(module_expsym_cmds, $1)= +_LT_TAGVAR(link_all_deplibs, $1)=unknown +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds +_LT_TAGVAR(no_undefined_flag, $1)= +_LT_TAGVAR(whole_archive_flag_spec, $1)= +_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no + +# Source file extension for fc test sources. +ac_ext=${ac_fc_srcext-f} + +# Object file extension for compiled fc test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# No sense in running all these tests if we already determined that +# the FC compiler isn't working. Some variables (like enable_shared) +# are currently assumed to apply to all compilers on this platform, +# and will be corrupted by setting them based on a non-working compiler. +if test "$_lt_disable_FC" != yes; then + # Code to be used in simple compile tests + lt_simple_compile_test_code="\ + subroutine t + return + end +" + + # Code to be used in simple link tests + lt_simple_link_test_code="\ + program t + end +" + + # ltmain only uses $CC for tagged configurations so make sure $CC is set. + _LT_TAG_COMPILER + + # save warnings/boilerplate of simple test code + _LT_COMPILER_BOILERPLATE + _LT_LINKER_BOILERPLATE + + # Allow CC to be a program name with arguments. + lt_save_CC="$CC" + lt_save_GCC=$GCC + lt_save_CFLAGS=$CFLAGS + CC=${FC-"f95"} + CFLAGS=$FCFLAGS + compiler=$CC + GCC=$ac_cv_fc_compiler_gnu + + _LT_TAGVAR(compiler, $1)=$CC + _LT_CC_BASENAME([$compiler]) + + if test -n "$compiler"; then + AC_MSG_CHECKING([if libtool supports shared libraries]) + AC_MSG_RESULT([$can_build_shared]) + + AC_MSG_CHECKING([whether to build shared libraries]) + test "$can_build_shared" = "no" && enable_shared=no + + # On AIX, shared libraries and static libraries use the same namespace, and + # are all built from PIC. + case $host_os in + aix3*) + test "$enable_shared" = yes && enable_static=no + if test -n "$RANLIB"; then + archive_cmds="$archive_cmds~\$RANLIB \$lib" + postinstall_cmds='$RANLIB $lib' + fi + ;; + aix[[4-9]]*) + if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then + test "$enable_shared" = yes && enable_static=no + fi + ;; + esac + AC_MSG_RESULT([$enable_shared]) + + AC_MSG_CHECKING([whether to build static libraries]) + # Make sure either enable_shared or enable_static is yes. + test "$enable_shared" = yes || enable_static=yes + AC_MSG_RESULT([$enable_static]) + + _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu" + _LT_TAGVAR(LD, $1)="$LD" + + ## CAVEAT EMPTOR: + ## There is no encapsulation within the following macros, do not change + ## the running order or otherwise move them around unless you know exactly + ## what you are doing... + _LT_SYS_HIDDEN_LIBDEPS($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_SYS_DYNAMIC_LINKER($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) + fi # test -n "$compiler" + + GCC=$lt_save_GCC + CC=$lt_save_CC + CFLAGS=$lt_save_CFLAGS +fi # test "$_lt_disable_FC" != yes + +AC_LANG_POP +])# _LT_LANG_FC_CONFIG + + +# _LT_LANG_GCJ_CONFIG([TAG]) +# -------------------------- +# Ensure that the configuration variables for the GNU Java Compiler compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_GCJ_CONFIG], +[AC_REQUIRE([LT_PROG_GCJ])dnl +AC_LANG_SAVE + +# Source file extension for Java test sources. +ac_ext=java + +# Object file extension for compiled Java test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code="class foo {}" + +# Code to be used in simple link tests +lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }' + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC=$CC +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC=yes +CC=${GCJ-"gcj"} +CFLAGS=$GCJFLAGS +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_TAGVAR(LD, $1)="$LD" +_LT_CC_BASENAME([$compiler]) + +# GCJ did not exist at the time GCC didn't implicitly link libc in. +_LT_TAGVAR(archive_cmds_need_lc, $1)=no + +_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds +_LT_TAGVAR(reload_flag, $1)=$reload_flag +_LT_TAGVAR(reload_cmds, $1)=$reload_cmds + +## CAVEAT EMPTOR: +## There is no encapsulation within the following macros, do not change +## the running order or otherwise move them around unless you know exactly +## what you are doing... +if test -n "$compiler"; then + _LT_COMPILER_NO_RTTI($1) + _LT_COMPILER_PIC($1) + _LT_COMPILER_C_O($1) + _LT_COMPILER_FILE_LOCKS($1) + _LT_LINKER_SHLIBS($1) + _LT_LINKER_HARDCODE_LIBPATH($1) + + _LT_CONFIG($1) +fi + +AC_LANG_RESTORE + +GCC=$lt_save_GCC +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_GCJ_CONFIG + + +# _LT_LANG_RC_CONFIG([TAG]) +# ------------------------- +# Ensure that the configuration variables for the Windows resource compiler +# are suitably defined. These variables are subsequently used by _LT_CONFIG +# to write the compiler configuration to `libtool'. +m4_defun([_LT_LANG_RC_CONFIG], +[AC_REQUIRE([LT_PROG_RC])dnl +AC_LANG_SAVE + +# Source file extension for RC test sources. +ac_ext=rc + +# Object file extension for compiled RC test sources. +objext=o +_LT_TAGVAR(objext, $1)=$objext + +# Code to be used in simple compile tests +lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }' + +# Code to be used in simple link tests +lt_simple_link_test_code="$lt_simple_compile_test_code" + +# ltmain only uses $CC for tagged configurations so make sure $CC is set. +_LT_TAG_COMPILER + +# save warnings/boilerplate of simple test code +_LT_COMPILER_BOILERPLATE +_LT_LINKER_BOILERPLATE + +# Allow CC to be a program name with arguments. +lt_save_CC="$CC" +lt_save_CFLAGS=$CFLAGS +lt_save_GCC=$GCC +GCC= +CC=${RC-"windres"} +CFLAGS= +compiler=$CC +_LT_TAGVAR(compiler, $1)=$CC +_LT_CC_BASENAME([$compiler]) +_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes + +if test -n "$compiler"; then + : + _LT_CONFIG($1) +fi + +GCC=$lt_save_GCC +AC_LANG_RESTORE +CC=$lt_save_CC +CFLAGS=$lt_save_CFLAGS +])# _LT_LANG_RC_CONFIG + + +# LT_PROG_GCJ +# ----------- +AC_DEFUN([LT_PROG_GCJ], +[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ], + [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ], + [AC_CHECK_TOOL(GCJ, gcj,) + test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2" + AC_SUBST(GCJFLAGS)])])[]dnl +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_GCJ], []) + + +# LT_PROG_RC +# ---------- +AC_DEFUN([LT_PROG_RC], +[AC_CHECK_TOOL(RC, windres,) +]) + +# Old name: +AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_RC], []) + + +# _LT_DECL_EGREP +# -------------- +# If we don't have a new enough Autoconf to choose the best grep +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_EGREP], +[AC_REQUIRE([AC_PROG_EGREP])dnl +AC_REQUIRE([AC_PROG_FGREP])dnl +test -z "$GREP" && GREP=grep +_LT_DECL([], [GREP], [1], [A grep program that handles long lines]) +_LT_DECL([], [EGREP], [1], [An ERE matcher]) +_LT_DECL([], [FGREP], [1], [A literal string matcher]) +dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too +AC_SUBST([GREP]) +]) + + +# _LT_DECL_OBJDUMP +# -------------- +# If we don't have a new enough Autoconf to choose the best objdump +# available, choose the one first in the user's PATH. +m4_defun([_LT_DECL_OBJDUMP], +[AC_CHECK_TOOL(OBJDUMP, objdump, false) +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper]) +AC_SUBST([OBJDUMP]) +]) + +# _LT_DECL_DLLTOOL +# ---------------- +# Ensure DLLTOOL variable is set. +m4_defun([_LT_DECL_DLLTOOL], +[AC_CHECK_TOOL(DLLTOOL, dlltool, false) +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program]) +AC_SUBST([DLLTOOL]) +]) + +# _LT_DECL_SED +# ------------ +# Check for a fully-functional sed program, that truncates +# as few characters as possible. Prefer GNU sed if found. +m4_defun([_LT_DECL_SED], +[AC_PROG_SED +test -z "$SED" && SED=sed +Xsed="$SED -e 1s/^X//" +_LT_DECL([], [SED], [1], [A sed program that does not truncate output]) +_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"], + [Sed that helps us avoid accidentally triggering echo(1) options like -n]) +])# _LT_DECL_SED + +m4_ifndef([AC_PROG_SED], [ +############################################################ +# NOTE: This macro has been submitted for inclusion into # +# GNU Autoconf as AC_PROG_SED. When it is available in # +# a released version of Autoconf we should remove this # +# macro and use it instead. # +############################################################ + +m4_defun([AC_PROG_SED], +[AC_MSG_CHECKING([for a sed that does not truncate output]) +AC_CACHE_VAL(lt_cv_path_SED, +[# Loop through the user's path and test for sed and gsed. +# Then use that list of sed's as ones to test for truncation. +as_save_IFS=$IFS; IFS=$PATH_SEPARATOR +for as_dir in $PATH +do + IFS=$as_save_IFS + test -z "$as_dir" && as_dir=. + for lt_ac_prog in sed gsed; do + for ac_exec_ext in '' $ac_executable_extensions; do + if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then + lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext" + fi + done + done +done +IFS=$as_save_IFS +lt_ac_max=0 +lt_ac_count=0 +# Add /usr/xpg4/bin/sed as it is typically found on Solaris +# along with /bin/sed that truncates output. +for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do + test ! -f $lt_ac_sed && continue + cat /dev/null > conftest.in + lt_ac_count=0 + echo $ECHO_N "0123456789$ECHO_C" >conftest.in + # Check for GNU sed and select it if it is found. + if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then + lt_cv_path_SED=$lt_ac_sed + break + fi + while true; do + cat conftest.in conftest.in >conftest.tmp + mv conftest.tmp conftest.in + cp conftest.in conftest.nl + echo >>conftest.nl + $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break + cmp -s conftest.out conftest.nl || break + # 10000 chars as input seems more than enough + test $lt_ac_count -gt 10 && break + lt_ac_count=`expr $lt_ac_count + 1` + if test $lt_ac_count -gt $lt_ac_max; then + lt_ac_max=$lt_ac_count + lt_cv_path_SED=$lt_ac_sed + fi + done +done +]) +SED=$lt_cv_path_SED +AC_SUBST([SED]) +AC_MSG_RESULT([$SED]) +])#AC_PROG_SED +])#m4_ifndef + +# Old name: +AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED]) +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([LT_AC_PROG_SED], []) + + +# _LT_CHECK_SHELL_FEATURES +# ------------------------ +# Find out whether the shell is Bourne or XSI compatible, +# or has some other useful features. +m4_defun([_LT_CHECK_SHELL_FEATURES], +[AC_MSG_CHECKING([whether the shell understands some XSI constructs]) +# Try some XSI features +xsi_shell=no +( _lt_dummy="a/b/c" + test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \ + = c,a/b,b/c, \ + && eval 'test $(( 1 + 1 )) -eq 2 \ + && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \ + && xsi_shell=yes +AC_MSG_RESULT([$xsi_shell]) +_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell']) + +AC_MSG_CHECKING([whether the shell understands "+="]) +lt_shell_append=no +( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \ + >/dev/null 2>&1 \ + && lt_shell_append=yes +AC_MSG_RESULT([$lt_shell_append]) +_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append']) + +if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then + lt_unset=unset +else + lt_unset=false +fi +_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl + +# test EBCDIC or ASCII +case `echo X|tr X '\101'` in + A) # ASCII based system + # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr + lt_SP2NL='tr \040 \012' + lt_NL2SP='tr \015\012 \040\040' + ;; + *) # EBCDIC based system + lt_SP2NL='tr \100 \n' + lt_NL2SP='tr \r\n \100\100' + ;; +esac +_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl +_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl +])# _LT_CHECK_SHELL_FEATURES + + +# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY) +# ------------------------------------------------------ +# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and +# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY. +m4_defun([_LT_PROG_FUNCTION_REPLACE], +[dnl { +sed -e '/^$1 ()$/,/^} # $1 /c\ +$1 ()\ +{\ +m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1]) +} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") +test 0 -eq $? || _lt_function_replace_fail=: +]) + + +# _LT_PROG_REPLACE_SHELLFNS +# ------------------------- +# Replace existing portable implementations of several shell functions with +# equivalent extended shell implementations where those features are available.. +m4_defun([_LT_PROG_REPLACE_SHELLFNS], +[if test x"$xsi_shell" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl + case ${1} in + */*) func_dirname_result="${1%/*}${2}" ;; + * ) func_dirname_result="${3}" ;; + esac + func_basename_result="${1##*/}"]) + + _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl + # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are + # positional parameters, so assign one to ordinary parameter first. + func_stripname_result=${3} + func_stripname_result=${func_stripname_result#"${1}"} + func_stripname_result=${func_stripname_result%"${2}"}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl + func_split_long_opt_name=${1%%=*} + func_split_long_opt_arg=${1#*=}]) + + _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl + func_split_short_opt_arg=${1#??} + func_split_short_opt_name=${1%"$func_split_short_opt_arg"}]) + + _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl + case ${1} in + *.lo) func_lo2o_result=${1%.lo}.${objext} ;; + *) func_lo2o_result=${1} ;; + esac]) + + _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo]) + + _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))]) + + _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}]) +fi + +if test x"$lt_shell_append" = xyes; then + _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"]) + + _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl + func_quote_for_eval "${2}" +dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \ + eval "${1}+=\\\\ \\$func_quote_for_eval_result"]) + + # Save a `func_append' function call where possible by direct use of '+=' + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +else + # Save a `func_append' function call even when '+=' is not available + sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \ + && mv -f "$cfgfile.tmp" "$cfgfile" \ + || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp") + test 0 -eq $? || _lt_function_replace_fail=: +fi + +if test x"$_lt_function_replace_fail" = x":"; then + AC_MSG_WARN([Unable to substitute extended shell functions in $ofile]) +fi +]) + +# _LT_PATH_CONVERSION_FUNCTIONS +# ----------------------------- +# Determine which file name conversion functions should be used by +# func_to_host_file (and, implicitly, by func_to_host_path). These are needed +# for certain cross-compile configurations and native mingw. +m4_defun([_LT_PATH_CONVERSION_FUNCTIONS], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +AC_REQUIRE([AC_CANONICAL_BUILD])dnl +AC_MSG_CHECKING([how to convert $build file names to $host format]) +AC_CACHE_VAL(lt_cv_to_host_file_cmd, +[case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32 + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32 + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32 + ;; + esac + ;; + *-*-cygwin* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin + ;; + *-*-cygwin* ) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; + * ) # otherwise, assume *nix + lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin + ;; + esac + ;; + * ) # unhandled hosts (and "normal" native builds) + lt_cv_to_host_file_cmd=func_convert_file_noop + ;; +esac +]) +to_host_file_cmd=$lt_cv_to_host_file_cmd +AC_MSG_RESULT([$lt_cv_to_host_file_cmd]) +_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd], + [0], [convert $build file names to $host format])dnl + +AC_MSG_CHECKING([how to convert $build file names to toolchain format]) +AC_CACHE_VAL(lt_cv_to_tool_file_cmd, +[#assume ordinary cross tools, or native build. +lt_cv_to_tool_file_cmd=func_convert_file_noop +case $host in + *-*-mingw* ) + case $build in + *-*-mingw* ) # actually msys + lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32 + ;; + esac + ;; +esac +]) +to_tool_file_cmd=$lt_cv_to_tool_file_cmd +AC_MSG_RESULT([$lt_cv_to_tool_file_cmd]) +_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd], + [0], [convert $build files to toolchain format])dnl +])# _LT_PATH_CONVERSION_FUNCTIONS diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ltoptions.m4 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ltoptions.m4 new file mode 100644 index 000000000..17cfd51c0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ltoptions.m4 @@ -0,0 +1,369 @@ +# Helper functions for option handling. -*- Autoconf -*- +# +# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 7 ltoptions.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) + + +# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) +# ------------------------------------------ +m4_define([_LT_MANGLE_OPTION], +[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) + + +# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) +# --------------------------------------- +# Set option OPTION-NAME for macro MACRO-NAME, and if there is a +# matching handler defined, dispatch to it. Other OPTION-NAMEs are +# saved as a flag. +m4_define([_LT_SET_OPTION], +[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl +m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), + _LT_MANGLE_DEFUN([$1], [$2]), + [m4_warning([Unknown $1 option `$2'])])[]dnl +]) + + +# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) +# ------------------------------------------------------------ +# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. +m4_define([_LT_IF_OPTION], +[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) + + +# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) +# ------------------------------------------------------- +# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME +# are set. +m4_define([_LT_UNLESS_OPTIONS], +[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), + [m4_define([$0_found])])])[]dnl +m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 +])[]dnl +]) + + +# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) +# ---------------------------------------- +# OPTION-LIST is a space-separated list of Libtool options associated +# with MACRO-NAME. If any OPTION has a matching handler declared with +# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about +# the unknown option and exit. +m4_defun([_LT_SET_OPTIONS], +[# Set options +m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), + [_LT_SET_OPTION([$1], _LT_Option)]) + +m4_if([$1],[LT_INIT],[ + dnl + dnl Simply set some default values (i.e off) if boolean options were not + dnl specified: + _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no + ]) + _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no + ]) + dnl + dnl If no reference was made to various pairs of opposing options, then + dnl we run the default mode handler for the pair. For example, if neither + dnl `shared' nor `disable-shared' was passed, we enable building of shared + dnl archives by default: + _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) + _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) + _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], + [_LT_ENABLE_FAST_INSTALL]) + ]) +])# _LT_SET_OPTIONS + + +## --------------------------------- ## +## Macros to handle LT_INIT options. ## +## --------------------------------- ## + +# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) +# ----------------------------------------- +m4_define([_LT_MANGLE_DEFUN], +[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) + + +# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) +# ----------------------------------------------- +m4_define([LT_OPTION_DEFINE], +[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl +])# LT_OPTION_DEFINE + + +# dlopen +# ------ +LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes +]) + +AU_DEFUN([AC_LIBTOOL_DLOPEN], +[_LT_SET_OPTION([LT_INIT], [dlopen]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `dlopen' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) + + +# win32-dll +# --------- +# Declare package support for building win32 dll's. +LT_OPTION_DEFINE([LT_INIT], [win32-dll], +[enable_win32_dll=yes + +case $host in +*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) + AC_CHECK_TOOL(AS, as, false) + AC_CHECK_TOOL(DLLTOOL, dlltool, false) + AC_CHECK_TOOL(OBJDUMP, objdump, false) + ;; +esac + +test -z "$AS" && AS=as +_LT_DECL([], [AS], [1], [Assembler program])dnl + +test -z "$DLLTOOL" && DLLTOOL=dlltool +_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl + +test -z "$OBJDUMP" && OBJDUMP=objdump +_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl +])# win32-dll + +AU_DEFUN([AC_LIBTOOL_WIN32_DLL], +[AC_REQUIRE([AC_CANONICAL_HOST])dnl +_LT_SET_OPTION([LT_INIT], [win32-dll]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `win32-dll' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) + + +# _LT_ENABLE_SHARED([DEFAULT]) +# ---------------------------- +# implement the --enable-shared flag, and supports the `shared' and +# `disable-shared' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_SHARED], +[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([shared], + [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], + [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_shared=yes ;; + no) enable_shared=no ;; + *) + enable_shared=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_shared=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_shared=]_LT_ENABLE_SHARED_DEFAULT) + + _LT_DECL([build_libtool_libs], [enable_shared], [0], + [Whether or not to build shared libraries]) +])# _LT_ENABLE_SHARED + +LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) +]) + +AC_DEFUN([AC_DISABLE_SHARED], +[_LT_SET_OPTION([LT_INIT], [disable-shared]) +]) + +AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) +AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_SHARED], []) +dnl AC_DEFUN([AM_DISABLE_SHARED], []) + + + +# _LT_ENABLE_STATIC([DEFAULT]) +# ---------------------------- +# implement the --enable-static flag, and support the `static' and +# `disable-static' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_STATIC], +[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([static], + [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], + [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_static=yes ;; + no) enable_static=no ;; + *) + enable_static=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_static=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_static=]_LT_ENABLE_STATIC_DEFAULT) + + _LT_DECL([build_old_libs], [enable_static], [0], + [Whether or not to build static libraries]) +])# _LT_ENABLE_STATIC + +LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) + +# Old names: +AC_DEFUN([AC_ENABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) +]) + +AC_DEFUN([AC_DISABLE_STATIC], +[_LT_SET_OPTION([LT_INIT], [disable-static]) +]) + +AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) +AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AM_ENABLE_STATIC], []) +dnl AC_DEFUN([AM_DISABLE_STATIC], []) + + + +# _LT_ENABLE_FAST_INSTALL([DEFAULT]) +# ---------------------------------- +# implement the --enable-fast-install flag, and support the `fast-install' +# and `disable-fast-install' LT_INIT options. +# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. +m4_define([_LT_ENABLE_FAST_INSTALL], +[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl +AC_ARG_ENABLE([fast-install], + [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], + [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], + [p=${PACKAGE-default} + case $enableval in + yes) enable_fast_install=yes ;; + no) enable_fast_install=no ;; + *) + enable_fast_install=no + # Look at the argument we got. We use all the common list separators. + lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," + for pkg in $enableval; do + IFS="$lt_save_ifs" + if test "X$pkg" = "X$p"; then + enable_fast_install=yes + fi + done + IFS="$lt_save_ifs" + ;; + esac], + [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) + +_LT_DECL([fast_install], [enable_fast_install], [0], + [Whether or not to optimize for fast installation])dnl +])# _LT_ENABLE_FAST_INSTALL + +LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) +LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) + +# Old names: +AU_DEFUN([AC_ENABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `fast-install' option into LT_INIT's first parameter.]) +]) + +AU_DEFUN([AC_DISABLE_FAST_INSTALL], +[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you put +the `disable-fast-install' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) +dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) + + +# _LT_WITH_PIC([MODE]) +# -------------------- +# implement the --with-pic flag, and support the `pic-only' and `no-pic' +# LT_INIT options. +# MODE is either `yes' or `no'. If omitted, it defaults to `both'. +m4_define([_LT_WITH_PIC], +[AC_ARG_WITH([pic], + [AS_HELP_STRING([--with-pic], + [try to use only PIC/non-PIC objects @<:@default=use both@:>@])], + [pic_mode="$withval"], + [pic_mode=default]) + +test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) + +_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl +])# _LT_WITH_PIC + +LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) +LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) + +# Old name: +AU_DEFUN([AC_LIBTOOL_PICMODE], +[_LT_SET_OPTION([LT_INIT], [pic-only]) +AC_DIAGNOSE([obsolete], +[$0: Remove this warning and the call to _LT_SET_OPTION when you +put the `pic-only' option into LT_INIT's first parameter.]) +]) + +dnl aclocal-1.4 backwards compatibility: +dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) + +## ----------------- ## +## LTDL_INIT Options ## +## ----------------- ## + +m4_define([_LTDL_MODE], []) +LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], + [m4_define([_LTDL_MODE], [nonrecursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [recursive], + [m4_define([_LTDL_MODE], [recursive])]) +LT_OPTION_DEFINE([LTDL_INIT], [subproject], + [m4_define([_LTDL_MODE], [subproject])]) + +m4_define([_LTDL_TYPE], []) +LT_OPTION_DEFINE([LTDL_INIT], [installable], + [m4_define([_LTDL_TYPE], [installable])]) +LT_OPTION_DEFINE([LTDL_INIT], [convenience], + [m4_define([_LTDL_TYPE], [convenience])]) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ltsugar.m4 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ltsugar.m4 new file mode 100644 index 000000000..9000a057d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ltsugar.m4 @@ -0,0 +1,123 @@ +# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. +# Written by Gary V. Vaughan, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 6 ltsugar.m4 + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) + + +# lt_join(SEP, ARG1, [ARG2...]) +# ----------------------------- +# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their +# associated separator. +# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier +# versions in m4sugar had bugs. +m4_define([lt_join], +[m4_if([$#], [1], [], + [$#], [2], [[$2]], + [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) +m4_define([_lt_join], +[m4_if([$#$2], [2], [], + [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) + + +# lt_car(LIST) +# lt_cdr(LIST) +# ------------ +# Manipulate m4 lists. +# These macros are necessary as long as will still need to support +# Autoconf-2.59 which quotes differently. +m4_define([lt_car], [[$1]]) +m4_define([lt_cdr], +[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], + [$#], 1, [], + [m4_dquote(m4_shift($@))])]) +m4_define([lt_unquote], $1) + + +# lt_append(MACRO-NAME, STRING, [SEPARATOR]) +# ------------------------------------------ +# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. +# Note that neither SEPARATOR nor STRING are expanded; they are appended +# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). +# No SEPARATOR is output if MACRO-NAME was previously undefined (different +# than defined and empty). +# +# This macro is needed until we can rely on Autoconf 2.62, since earlier +# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. +m4_define([lt_append], +[m4_define([$1], + m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) + + + +# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) +# ---------------------------------------------------------- +# Produce a SEP delimited list of all paired combinations of elements of +# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list +# has the form PREFIXmINFIXSUFFIXn. +# Needed until we can rely on m4_combine added in Autoconf 2.62. +m4_define([lt_combine], +[m4_if(m4_eval([$# > 3]), [1], + [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl +[[m4_foreach([_Lt_prefix], [$2], + [m4_foreach([_Lt_suffix], + ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, + [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) + + +# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) +# ----------------------------------------------------------------------- +# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited +# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. +m4_define([lt_if_append_uniq], +[m4_ifdef([$1], + [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], + [lt_append([$1], [$2], [$3])$4], + [$5])], + [lt_append([$1], [$2], [$3])$4])]) + + +# lt_dict_add(DICT, KEY, VALUE) +# ----------------------------- +m4_define([lt_dict_add], +[m4_define([$1($2)], [$3])]) + + +# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) +# -------------------------------------------- +m4_define([lt_dict_add_subkey], +[m4_define([$1($2:$3)], [$4])]) + + +# lt_dict_fetch(DICT, KEY, [SUBKEY]) +# ---------------------------------- +m4_define([lt_dict_fetch], +[m4_ifval([$3], + m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), + m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) + + +# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) +# ----------------------------------------------------------------- +m4_define([lt_if_dict_fetch], +[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], + [$5], + [$6])]) + + +# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) +# -------------------------------------------------------------- +m4_define([lt_dict_filter], +[m4_if([$5], [], [], + [lt_join(m4_quote(m4_default([$4], [[, ]])), + lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), + [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl +]) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ltversion.m4 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ltversion.m4 new file mode 100644 index 000000000..9c7b5d411 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/ltversion.m4 @@ -0,0 +1,23 @@ +# ltversion.m4 -- version numbers -*- Autoconf -*- +# +# Copyright (C) 2004 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004 +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# @configure_input@ + +# serial 3293 ltversion.m4 +# This file is part of GNU Libtool + +m4_define([LT_PACKAGE_VERSION], [2.4]) +m4_define([LT_PACKAGE_REVISION], [1.3293]) + +AC_DEFUN([LTVERSION_VERSION], +[macro_version='2.4' +macro_revision='1.3293' +_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) +_LT_DECL(, macro_revision, 0) +]) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/lt~obsolete.m4 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/lt~obsolete.m4 new file mode 100644 index 000000000..c573da90c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/m4/lt~obsolete.m4 @@ -0,0 +1,98 @@ +# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- +# +# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. +# Written by Scott James Remnant, 2004. +# +# This file is free software; the Free Software Foundation gives +# unlimited permission to copy and/or distribute it, with or without +# modifications, as long as this notice is preserved. + +# serial 5 lt~obsolete.m4 + +# These exist entirely to fool aclocal when bootstrapping libtool. +# +# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) +# which have later been changed to m4_define as they aren't part of the +# exported API, or moved to Autoconf or Automake where they belong. +# +# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN +# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us +# using a macro with the same name in our local m4/libtool.m4 it'll +# pull the old libtool.m4 in (it doesn't see our shiny new m4_define +# and doesn't know about Autoconf macros at all.) +# +# So we provide this file, which has a silly filename so it's always +# included after everything else. This provides aclocal with the +# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything +# because those macros already exist, or will be overwritten later. +# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. +# +# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. +# Yes, that means every name once taken will need to remain here until +# we give up compatibility with versions before 1.7, at which point +# we need to keep only those names which we still refer to. + +# This is to help aclocal find these macros, as it can't see m4_define. +AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) + +m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) +m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) +m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) +m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) +m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) +m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) +m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) +m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) +m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) +m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) +m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) +m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) +m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) +m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) +m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) +m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) +m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) +m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) +m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) +m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) +m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) +m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) +m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) +m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) +m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) +m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) +m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) +m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) +m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) +m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) +m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) +m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) +m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) +m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) +m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) +m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) +m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) +m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) +m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) +m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) +m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) +m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) +m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) +m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) +m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) +m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) +m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) +m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) +m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) +m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) +m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) +m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) +m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) +m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) +m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/man/Makefile.am b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/man/Makefile.am new file mode 100644 index 000000000..251927748 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/man/Makefile.am @@ -0,0 +1,8 @@ +## Process this with automake to create Makefile.in + +AUTOMAKE_OPTIONS=foreign + +EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 + +man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/man/Makefile.in b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/man/Makefile.in new file mode 100644 index 000000000..2cb5ea81f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/man/Makefile.in @@ -0,0 +1,466 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = man +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cc_maxopt.m4 \ + $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ + $(top_srcdir)/m4/ax_check_compiler_flags.m4 \ + $(top_srcdir)/m4/ax_compiler_vendor.m4 \ + $(top_srcdir)/m4/ax_configure_args.m4 \ + $(top_srcdir)/m4/ax_enable_builddir.m4 \ + $(top_srcdir)/m4/ax_gcc_archflag.m4 \ + $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/fficonfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; +am__vpath_adj = case $$p in \ + $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ + *) f=$$p;; \ + esac; +am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`; +am__install_max = 40 +am__nobase_strip_setup = \ + srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'` +am__nobase_strip = \ + for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||" +am__nobase_list = $(am__nobase_strip_setup); \ + for p in $$list; do echo "$$p $$p"; done | \ + sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \ + $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \ + if (++n[$$2] == $(am__install_max)) \ + { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \ + END { for (dir in files) print dir, files[dir] }' +am__base_list = \ + sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ + sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' +man3dir = $(mandir)/man3 +am__installdirs = "$(DESTDIR)$(man3dir)" +NROFF = nroff +MANS = $(man_MANS) +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_LTLDFLAGS = @AM_LTLDFLAGS@ +AM_RUNTESTFLAGS = @AM_RUNTESTFLAGS@ +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PRTDIAG = @PRTDIAG@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TARGET = @TARGET@ +TARGETDIR = @TARGETDIR@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_enable_builddir_sed = @ax_enable_builddir_sed@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sys_symbol_underscore = @sys_symbol_underscore@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +toolexecdir = @toolexecdir@ +toolexeclibdir = @toolexeclibdir@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = foreign +EXTRA_DIST = ffi.3 ffi_call.3 ffi_prep_cif.3 +man_MANS = ffi.3 ffi_call.3 ffi_prep_cif.3 +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign man/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign man/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +install-man3: $(man_MANS) + @$(NORMAL_INSTALL) + test -z "$(man3dir)" || $(MKDIR_P) "$(DESTDIR)$(man3dir)" + @list=''; test -n "$(man3dir)" || exit 0; \ + { for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.3[a-z]*$$/p'; \ + } | while read p; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + echo "$$d$$p"; echo "$$p"; \ + done | \ + sed -e 'n;s,.*/,,;p;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,' | \ + sed 'N;N;s,\n, ,g' | { \ + list=; while read file base inst; do \ + if test "$$base" = "$$inst"; then list="$$list $$file"; else \ + echo " $(INSTALL_DATA) '$$file' '$(DESTDIR)$(man3dir)/$$inst'"; \ + $(INSTALL_DATA) "$$file" "$(DESTDIR)$(man3dir)/$$inst" || exit $$?; \ + fi; \ + done; \ + for i in $$list; do echo "$$i"; done | $(am__base_list) | \ + while read files; do \ + test -z "$$files" || { \ + echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(man3dir)'"; \ + $(INSTALL_DATA) $$files "$(DESTDIR)$(man3dir)" || exit $$?; }; \ + done; } + +uninstall-man3: + @$(NORMAL_UNINSTALL) + @list=''; test -n "$(man3dir)" || exit 0; \ + files=`{ for i in $$list; do echo "$$i"; done; \ + l2='$(man_MANS)'; for i in $$l2; do echo "$$i"; done | \ + sed -n '/\.3[a-z]*$$/p'; \ + } | sed -e 's,.*/,,;h;s,.*\.,,;s,^[^3][0-9a-z]*$$,3,;x' \ + -e 's,\.[0-9a-z]*$$,,;$(transform);G;s,\n,.,'`; \ + test -z "$$files" || { \ + echo " ( cd '$(DESTDIR)$(man3dir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(man3dir)" && rm -f $$files; } +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +distdir: $(DISTFILES) + @list='$(MANS)'; if test -n "$$list"; then \ + list=`for p in $$list; do \ + if test -f $$p; then d=; else d="$(srcdir)/"; fi; \ + if test -f "$$d$$p"; then echo "$$d$$p"; else :; fi; done`; \ + if test -n "$$list" && \ + grep 'ab help2man is required to generate this page' $$list >/dev/null; then \ + echo "error: found man pages containing the \`missing help2man' replacement text:" >&2; \ + grep -l 'ab help2man is required to generate this page' $$list | sed 's/^/ /' >&2; \ + echo " to fix them, install help2man, remove and regenerate the man pages;" >&2; \ + echo " typically \`make maintainer-clean' will remove them" >&2; \ + exit 1; \ + else :; fi; \ + else :; fi + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am +check: check-am +all-am: Makefile $(MANS) +installdirs: + for dir in "$(DESTDIR)$(man3dir)"; do \ + test -z "$$dir" || $(MKDIR_P) "$$dir"; \ + done +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: install-man + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: install-man3 + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: uninstall-man + +uninstall-man: uninstall-man3 + +.MAKE: install-am install-strip + +.PHONY: all all-am check check-am clean clean-generic clean-libtool \ + distclean distclean-generic distclean-libtool distdir dvi \ + dvi-am html html-am info info-am install install-am \ + install-data install-data-am install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-man3 \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + uninstall uninstall-am uninstall-man uninstall-man3 + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/man/ffi.3 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/man/ffi.3 new file mode 100644 index 000000000..18b5d5d2d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/man/ffi.3 @@ -0,0 +1,31 @@ +.Dd February 15, 2008 +.Dt FFI 3 +.Sh NAME +.Nm FFI +.Nd Foreign Function Interface +.Sh LIBRARY +libffi, -lffi +.Sh SYNOPSIS +.In ffi.h +.Ft ffi_status +.Fo ffi_prep_cif +.Fa "ffi_cif *cif" +.Fa "ffi_abi abi" +.Fa "unsigned int nargs" +.Fa "ffi_type *rtype" +.Fa "ffi_type **atypes" +.Fc +.Ft void +.Fo ffi_call +.Fa "ffi_cif *cif" +.Fa "void (*fn)(void)" +.Fa "void *rvalue" +.Fa "void **avalue" +.Fc +.Sh DESCRIPTION +The foreign function interface provides a mechanism by which a function can +generate a call to another function at runtime without requiring knowledge of +the called function's interface at compile time. +.Sh SEE ALSO +.Xr ffi_prep_cif 3 , +.Xr ffi_call 3 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/man/ffi_call.3 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/man/ffi_call.3 new file mode 100644 index 000000000..5351513f9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/man/ffi_call.3 @@ -0,0 +1,103 @@ +.Dd February 15, 2008 +.Dt ffi_call 3 +.Sh NAME +.Nm ffi_call +.Nd Invoke a foreign function. +.Sh SYNOPSIS +.In ffi.h +.Ft void +.Fo ffi_call +.Fa "ffi_cif *cif" +.Fa "void (*fn)(void)" +.Fa "void *rvalue" +.Fa "void **avalue" +.Fc +.Sh DESCRIPTION +The +.Nm ffi_call +function provides a simple mechanism for invoking a function without +requiring knowledge of the function's interface at compile time. +.Fa fn +is called with the values retrieved from the pointers in the +.Fa avalue +array. The return value from +.Fa fn +is placed in storage pointed to by +.Fa rvalue . +.Fa cif +contains information describing the data types, sizes and alignments of the +arguments to and return value from +.Fa fn , +and must be initialized with +.Nm ffi_prep_cif +before it is used with +.Nm ffi_call . +.Pp +.Fa rvalue +must point to storage that is sizeof(ffi_arg) or larger for non-floating point +types. For smaller-sized return value types, the +.Nm ffi_arg +or +.Nm ffi_sarg +integral type must be used to hold +the return value. +.Sh EXAMPLES +.Bd -literal +#include +#include + +unsigned char +foo(unsigned int, float); + +int +main(int argc, const char **argv) +{ + ffi_cif cif; + ffi_type *arg_types[2]; + void *arg_values[2]; + ffi_status status; + + // Because the return value from foo() is smaller than sizeof(long), it + // must be passed as ffi_arg or ffi_sarg. + ffi_arg result; + + // Specify the data type of each argument. Available types are defined + // in . + arg_types[0] = &ffi_type_uint; + arg_types[1] = &ffi_type_float; + + // Prepare the ffi_cif structure. + if ((status = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, + 2, &ffi_type_uint8, arg_types)) != FFI_OK) + { + // Handle the ffi_status error. + } + + // Specify the values of each argument. + unsigned int arg1 = 42; + float arg2 = 5.1; + + arg_values[0] = &arg1; + arg_values[1] = &arg2; + + // Invoke the function. + ffi_call(&cif, FFI_FN(foo), &result, arg_values); + + // The ffi_arg 'result' now contains the unsigned char returned from foo(), + // which can be accessed by a typecast. + printf("result is %hhu", (unsigned char)result); + + return 0; +} + +// The target function. +unsigned char +foo(unsigned int x, float y) +{ + unsigned char result = x - y; + return result; +} +.Ed +.Sh SEE ALSO +.Xr ffi 3 , +.Xr ffi_prep_cif 3 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/man/ffi_prep_cif.3 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/man/ffi_prep_cif.3 new file mode 100644 index 000000000..9436b3119 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/man/ffi_prep_cif.3 @@ -0,0 +1,66 @@ +.Dd February 15, 2008 +.Dt ffi_prep_cif 3 +.Sh NAME +.Nm ffi_prep_cif +.Nd Prepare a +.Nm ffi_cif +structure for use with +.Nm ffi_call +. +.Sh SYNOPSIS +.In ffi.h +.Ft ffi_status +.Fo ffi_prep_cif +.Fa "ffi_cif *cif" +.Fa "ffi_abi abi" +.Fa "unsigned int nargs" +.Fa "ffi_type *rtype" +.Fa "ffi_type **atypes" +.Fc +.Sh DESCRIPTION +The +.Nm ffi_prep_cif +function prepares a +.Nm ffi_cif +structure for use with +.Nm ffi_call +. +.Fa abi +specifies a set of calling conventions to use. +.Fa atypes +is an array of +.Fa nargs +pointers to +.Nm ffi_type +structs that describe the data type, size and alignment of each argument. +.Fa rtype +points to an +.Nm ffi_type +that describes the data type, size and alignment of the +return value. +.Sh RETURN VALUES +Upon successful completion, +.Nm ffi_prep_cif +returns +.Nm FFI_OK . +It will return +.Nm FFI_BAD_TYPEDEF +if +.Fa cif +is +.Nm NULL +or +.Fa atypes +or +.Fa rtype +is malformed. If +.Fa abi +does not refer to a valid ABI, +.Nm FFI_BAD_ABI +will be returned. Available ABIs are +defined in +.Nm +. +.Sh SEE ALSO +.Xr ffi 3 , +.Xr ffi_call 3 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/mdate-sh b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/mdate-sh new file mode 100644 index 000000000..cd916c0a3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/mdate-sh @@ -0,0 +1,201 @@ +#!/bin/sh +# Get modification time of a file or directory and pretty-print it. + +scriptversion=2005-06-29.22 + +# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005 Free Software +# Foundation, Inc. +# written by Ulrich Drepper , June 1995 +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software Foundation, +# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +# This file is maintained in Automake, please report +# bugs to or send patches to +# . + +case $1 in + '') + echo "$0: No file. Try \`$0 --help' for more information." 1>&2 + exit 1; + ;; + -h | --h*) + cat <<\EOF +Usage: mdate-sh [--help] [--version] FILE + +Pretty-print the modification time of FILE. + +Report bugs to . +EOF + exit $? + ;; + -v | --v*) + echo "mdate-sh $scriptversion" + exit $? + ;; +esac + +# Prevent date giving response in another language. +LANG=C +export LANG +LC_ALL=C +export LC_ALL +LC_TIME=C +export LC_TIME + +# GNU ls changes its time format in response to the TIME_STYLE +# variable. Since we cannot assume `unset' works, revert this +# variable to its documented default. +if test "${TIME_STYLE+set}" = set; then + TIME_STYLE=posix-long-iso + export TIME_STYLE +fi + +save_arg1=$1 + +# Find out how to get the extended ls output of a file or directory. +if ls -L /dev/null 1>/dev/null 2>&1; then + ls_command='ls -L -l -d' +else + ls_command='ls -l -d' +fi + +# A `ls -l' line looks as follows on OS/2. +# drwxrwx--- 0 Aug 11 2001 foo +# This differs from Unix, which adds ownership information. +# drwxrwx--- 2 root root 4096 Aug 11 2001 foo +# +# To find the date, we split the line on spaces and iterate on words +# until we find a month. This cannot work with files whose owner is a +# user named `Jan', or `Feb', etc. However, it's unlikely that `/' +# will be owned by a user whose name is a month. So we first look at +# the extended ls output of the root directory to decide how many +# words should be skipped to get the date. + +# On HPUX /bin/sh, "set" interprets "-rw-r--r--" as options, so the "x" below. +set x`ls -l -d /` + +# Find which argument is the month. +month= +command= +until test $month +do + shift + # Add another shift to the command. + command="$command shift;" + case $1 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; + esac +done + +# Get the extended ls output of the file or directory. +set dummy x`eval "$ls_command \"\$save_arg1\""` + +# Remove all preceding arguments +eval $command + +# Because of the dummy argument above, month is in $2. +# +# On a POSIX system, we should have +# +# $# = 5 +# $1 = file size +# $2 = month +# $3 = day +# $4 = year or time +# $5 = filename +# +# On Darwin 7.7.0 and 7.6.0, we have +# +# $# = 4 +# $1 = day +# $2 = month +# $3 = year or time +# $4 = filename + +# Get the month. +case $2 in + Jan) month=January; nummonth=1;; + Feb) month=February; nummonth=2;; + Mar) month=March; nummonth=3;; + Apr) month=April; nummonth=4;; + May) month=May; nummonth=5;; + Jun) month=June; nummonth=6;; + Jul) month=July; nummonth=7;; + Aug) month=August; nummonth=8;; + Sep) month=September; nummonth=9;; + Oct) month=October; nummonth=10;; + Nov) month=November; nummonth=11;; + Dec) month=December; nummonth=12;; +esac + +case $3 in + ???*) day=$1;; + *) day=$3; shift;; +esac + +# Here we have to deal with the problem that the ls output gives either +# the time of day or the year. +case $3 in + *:*) set `date`; eval year=\$$# + case $2 in + Jan) nummonthtod=1;; + Feb) nummonthtod=2;; + Mar) nummonthtod=3;; + Apr) nummonthtod=4;; + May) nummonthtod=5;; + Jun) nummonthtod=6;; + Jul) nummonthtod=7;; + Aug) nummonthtod=8;; + Sep) nummonthtod=9;; + Oct) nummonthtod=10;; + Nov) nummonthtod=11;; + Dec) nummonthtod=12;; + esac + # For the first six month of the year the time notation can also + # be used for files modified in the last year. + if (expr $nummonth \> $nummonthtod) > /dev/null; + then + year=`expr $year - 1` + fi;; + *) year=$3;; +esac + +# The result. +echo $day $month $year + +# Local Variables: +# mode: shell-script +# sh-indentation: 2 +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-end: "$" +# End: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/missing b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/missing new file mode 100755 index 000000000..28055d2ae --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/missing @@ -0,0 +1,376 @@ +#! /bin/sh +# Common stub for a few missing GNU programs while installing. + +scriptversion=2009-04-28.21; # UTC + +# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006, +# 2008, 2009 Free Software Foundation, Inc. +# Originally by Fran,cois Pinard , 1996. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2, or (at your option) +# any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. + +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +# As a special exception to the GNU General Public License, if you +# distribute this file as part of a program that contains a +# configuration script generated by Autoconf, you may include it under +# the same distribution terms that you use for the rest of that program. + +if test $# -eq 0; then + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 +fi + +run=: +sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' +sed_minuso='s/.* -o \([^ ]*\).*/\1/p' + +# In the cases where this matters, `missing' is being run in the +# srcdir already. +if test -f configure.ac; then + configure_ac=configure.ac +else + configure_ac=configure.in +fi + +msg="missing on your system" + +case $1 in +--run) + # Try to run requested program, and just exit if it succeeds. + run= + shift + "$@" && exit 0 + # Exit code 63 means version mismatch. This often happens + # when the user try to use an ancient version of a tool on + # a file that requires a minimum version. In this case we + # we should proceed has if the program had been absent, or + # if --run hadn't been passed. + if test $? = 63; then + run=: + msg="probably too old" + fi + ;; + + -h|--h|--he|--hel|--help) + echo "\ +$0 [OPTION]... PROGRAM [ARGUMENT]... + +Handle \`PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an +error status if there is no known handling for PROGRAM. + +Options: + -h, --help display this help and exit + -v, --version output version information and exit + --run try to run the given command, and emulate it if it fails + +Supported PROGRAM values: + aclocal touch file \`aclocal.m4' + autoconf touch file \`configure' + autoheader touch file \`config.h.in' + autom4te touch the output file, or create a stub one + automake touch all \`Makefile.in' files + bison create \`y.tab.[ch]', if possible, from existing .[ch] + flex create \`lex.yy.c', if possible, from existing .c + help2man touch the output file + lex create \`lex.yy.c', if possible, from existing .c + makeinfo touch the output file + tar try tar, gnutar, gtar, then tar without non-portable flags + yacc create \`y.tab.[ch]', if possible, from existing .[ch] + +Version suffixes to PROGRAM as well as the prefixes \`gnu-', \`gnu', and +\`g' are ignored when checking the name. + +Send bug reports to ." + exit $? + ;; + + -v|--v|--ve|--ver|--vers|--versi|--versio|--version) + echo "missing $scriptversion (GNU Automake)" + exit $? + ;; + + -*) + echo 1>&2 "$0: Unknown \`$1' option" + echo 1>&2 "Try \`$0 --help' for more information" + exit 1 + ;; + +esac + +# normalize program name to check for. +program=`echo "$1" | sed ' + s/^gnu-//; t + s/^gnu//; t + s/^g//; t'` + +# Now exit if we have it, but it failed. Also exit now if we +# don't have it and --version was passed (most likely to detect +# the program). This is about non-GNU programs, so use $1 not +# $program. +case $1 in + lex*|yacc*) + # Not GNU programs, they don't have --version. + ;; + + tar*) + if test -n "$run"; then + echo 1>&2 "ERROR: \`tar' requires --run" + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + exit 1 + fi + ;; + + *) + if test -z "$run" && ($1 --version) > /dev/null 2>&1; then + # We have it, but it failed. + exit 1 + elif test "x$2" = "x--version" || test "x$2" = "x--help"; then + # Could not run --version or --help. This is probably someone + # running `$TOOL --version' or `$TOOL --help' to check whether + # $TOOL exists and not knowing $TOOL uses missing. + exit 1 + fi + ;; +esac + +# If it does not exist, or fails to run (possibly an outdated version), +# try to emulate it. +case $program in + aclocal*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acinclude.m4' or \`${configure_ac}'. You might want + to install the \`Automake' and \`Perl' packages. Grab them from + any GNU archive site." + touch aclocal.m4 + ;; + + autoconf*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`${configure_ac}'. You might want to install the + \`Autoconf' and \`GNU m4' packages. Grab them from any GNU + archive site." + touch configure + ;; + + autoheader*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`acconfig.h' or \`${configure_ac}'. You might want + to install the \`Autoconf' and \`GNU m4' packages. Grab them + from any GNU archive site." + files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` + test -z "$files" && files="config.h" + touch_files= + for f in $files; do + case $f in + *:*) touch_files="$touch_files "`echo "$f" | + sed -e 's/^[^:]*://' -e 's/:.*//'`;; + *) touch_files="$touch_files $f.in";; + esac + done + touch $touch_files + ;; + + automake*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified \`Makefile.am', \`acinclude.m4' or \`${configure_ac}'. + You might want to install the \`Automake' and \`Perl' packages. + Grab them from any GNU archive site." + find . -type f -name Makefile.am -print | + sed 's/\.am$/.in/' | + while read f; do touch "$f"; done + ;; + + autom4te*) + echo 1>&2 "\ +WARNING: \`$1' is needed, but is $msg. + You might have modified some files without having the + proper tools for further handling them. + You can get \`$1' as part of \`Autoconf' from any GNU + archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo "#! /bin/sh" + echo "# Created by GNU Automake missing as a replacement of" + echo "# $ $@" + echo "exit 0" + chmod +x $file + exit 1 + fi + ;; + + bison*|yacc*) + echo 1>&2 "\ +WARNING: \`$1' $msg. You should only need it if + you modified a \`.y' file. You may need the \`Bison' package + in order for those modifications to take effect. You can get + \`Bison' from any GNU archive site." + rm -f y.tab.c y.tab.h + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.y) + SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.c + fi + SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" y.tab.h + fi + ;; + esac + fi + if test ! -f y.tab.h; then + echo >y.tab.h + fi + if test ! -f y.tab.c; then + echo 'main() { return 0; }' >y.tab.c + fi + ;; + + lex*|flex*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.l' file. You may need the \`Flex' package + in order for those modifications to take effect. You can get + \`Flex' from any GNU archive site." + rm -f lex.yy.c + if test $# -ne 1; then + eval LASTARG="\${$#}" + case $LASTARG in + *.l) + SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` + if test -f "$SRCFILE"; then + cp "$SRCFILE" lex.yy.c + fi + ;; + esac + fi + if test ! -f lex.yy.c; then + echo 'main() { return 0; }' >lex.yy.c + fi + ;; + + help2man*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a dependency of a manual page. You may need the + \`Help2man' package in order for those modifications to take + effect. You can get \`Help2man' from any GNU archive site." + + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -f "$file"; then + touch $file + else + test -z "$file" || exec >$file + echo ".ab help2man is required to generate this page" + exit $? + fi + ;; + + makeinfo*) + echo 1>&2 "\ +WARNING: \`$1' is $msg. You should only need it if + you modified a \`.texi' or \`.texinfo' file, or any other file + indirectly affecting the aspect of the manual. The spurious + call might also be the consequence of using a buggy \`make' (AIX, + DU, IRIX). You might want to install the \`Texinfo' package or + the \`GNU make' package. Grab either from any GNU archive site." + # The file to touch is that specified with -o ... + file=`echo "$*" | sed -n "$sed_output"` + test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` + if test -z "$file"; then + # ... or it is the one specified with @setfilename ... + infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` + file=`sed -n ' + /^@setfilename/{ + s/.* \([^ ]*\) *$/\1/ + p + q + }' $infile` + # ... or it is derived from the source name (dir/f.texi becomes f.info) + test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info + fi + # If the file does not exist, the user really needs makeinfo; + # let's fail without touching anything. + test -f $file || exit 1 + touch $file + ;; + + tar*) + shift + + # We have already tried tar in the generic part. + # Look for gnutar/gtar before invocation to avoid ugly error + # messages. + if (gnutar --version > /dev/null 2>&1); then + gnutar "$@" && exit 0 + fi + if (gtar --version > /dev/null 2>&1); then + gtar "$@" && exit 0 + fi + firstarg="$1" + if shift; then + case $firstarg in + *o*) + firstarg=`echo "$firstarg" | sed s/o//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + case $firstarg in + *h*) + firstarg=`echo "$firstarg" | sed s/h//` + tar "$firstarg" "$@" && exit 0 + ;; + esac + fi + + echo 1>&2 "\ +WARNING: I can't seem to be able to run \`tar' with the given arguments. + You may want to install GNU tar or Free paxutils, or check the + command line arguments." + exit 1 + ;; + + *) + echo 1>&2 "\ +WARNING: \`$1' is needed, and is $msg. + You might have modified some files without having the + proper tools for further handling them. Check the \`README' file, + it often tells you about the needed prerequisites for installing + this package. You may also peek at any GNU archive site, in case + some other package would contain this missing \`$1' program." + exit 1 + ;; +esac + +exit 0 + +# Local variables: +# eval: (add-hook 'write-file-hooks 'time-stamp) +# time-stamp-start: "scriptversion=" +# time-stamp-format: "%:y-%02m-%02d.%02H" +# time-stamp-time-zone: "UTC" +# time-stamp-end: "; # UTC" +# End: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/msvcc.sh b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/msvcc.sh new file mode 100755 index 000000000..dcdbeab16 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/msvcc.sh @@ -0,0 +1,197 @@ +#!/bin/sh + +# ***** BEGIN LICENSE BLOCK ***** +# Version: MPL 1.1/GPL 2.0/LGPL 2.1 +# +# The contents of this file are subject to the Mozilla Public License Version +# 1.1 (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# http://www.mozilla.org/MPL/ +# +# Software distributed under the License is distributed on an "AS IS" basis, +# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License +# for the specific language governing rights and limitations under the +# License. +# +# The Original Code is the MSVC wrappificator. +# +# The Initial Developer of the Original Code is +# Timothy Wall . +# Portions created by the Initial Developer are Copyright (C) 2009 +# the Initial Developer. All Rights Reserved. +# +# Contributor(s): +# Daniel Witte +# +# Alternatively, the contents of this file may be used under the terms of +# either the GNU General Public License Version 2 or later (the "GPL"), or +# the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), +# in which case the provisions of the GPL or the LGPL are applicable instead +# of those above. If you wish to allow use of your version of this file only +# under the terms of either the GPL or the LGPL, and not to allow others to +# use your version of this file under the terms of the MPL, indicate your +# decision by deleting the provisions above and replace them with the notice +# and other provisions required by the GPL or the LGPL. If you do not delete +# the provisions above, a recipient may use your version of this file under +# the terms of any one of the MPL, the GPL or the LGPL. +# +# ***** END LICENSE BLOCK ***** + +# +# GCC-compatible wrapper for cl.exe and ml.exe. Arguments are given in GCC +# format and translated into something sensible for cl or ml. +# + +args="-nologo -W3" +md=-MD +cl="cl" +ml="ml" +safeseh="-safeseh" +output= + +while [ $# -gt 0 ] +do + case $1 + in + -fexceptions) + # Don't enable exceptions for now. + #args="$args -EHac" + shift 1 + ;; + -m32) + shift 1 + ;; + -m64) + cl="cl" # "$MSVC/x86_amd64/cl" + ml="ml64" # "$MSVC/x86_amd64/ml64" + safeseh= + shift 1 + ;; + -O0) + args="$args -Od" + shift 1 + ;; + -O*) + # If we're optimizing, make sure we explicitly turn on some optimizations + # that are implicitly disabled by debug symbols (-Zi). + args="$args $1 -OPT:REF -OPT:ICF -INCREMENTAL:NO" + shift 1 + ;; + -g) + # Enable debug symbol generation. + args="$args -Zi -DEBUG" + shift 1 + ;; + -DFFI_DEBUG) + # Link against debug CRT and enable runtime error checks. + args="$args -RTC1" + defines="$defines $1" + md=-MDd + shift 1 + ;; + -c) + args="$args -c" + args="$(echo $args | sed 's%/Fe%/Fo%g')" + single="-c" + shift 1 + ;; + -D*=*) + name="$(echo $1|sed 's/-D\([^=][^=]*\)=.*/\1/g')" + value="$(echo $1|sed 's/-D[^=][^=]*=//g')" + args="$args -D${name}='$value'" + defines="$defines -D${name}='$value'" + shift 1 + ;; + -D*) + args="$args $1" + defines="$defines $1" + shift 1 + ;; + -I) + args="$args -I$2" + includes="$includes -I$2" + shift 2 + ;; + -I*) + args="$args $1" + includes="$includes $1" + shift 1 + ;; + -W|-Wextra) + # TODO map extra warnings + shift 1 + ;; + -Wall) + # -Wall on MSVC is overzealous, and we already build with -W3. Nothing + # to do here. + shift 1 + ;; + -Werror) + args="$args -WX" + shift 1 + ;; + -W*) + # TODO map specific warnings + shift 1 + ;; + -S) + args="$args -FAs" + shift 1 + ;; + -o) + outdir="$(dirname $2)" + base="$(basename $2|sed 's/\.[^.]*//g')" + if [ -n "$single" ]; then + output="-Fo$2" + else + output="-Fe$2" + fi + if [ -n "$assembly" ]; then + args="$args $output" + else + args="$args $output -Fd$outdir/$base -Fp$outdir/$base -Fa$outdir/$base" + fi + shift 2 + ;; + *.S) + src=$1 + assembly="true" + shift 1 + ;; + *.c) + args="$args $1" + shift 1 + ;; + *) + # Assume it's an MSVC argument, and pass it through. + args="$args $1" + shift 1 + ;; + esac +done + +if [ -n "$assembly" ]; then + if [ -z "$outdir" ]; then + outdir="." + fi + ppsrc="$outdir/$(basename $src|sed 's/.S$/.asm/g')" + echo "$cl -nologo -EP $includes $defines $src > $ppsrc" + "$cl" -nologo -EP $includes $defines $src > $ppsrc || exit $? + output="$(echo $output | sed 's%/F[dpa][^ ]*%%g')" + args="-nologo $safeseh $single $output $ppsrc" + + echo "$ml $args" + eval "\"$ml\" $args" + result=$? + + # required to fix ml64 broken output? + #mv *.obj $outdir +else + args="$md $args" + echo "$cl $args" + eval "\"$cl\" $args" + result=$? +fi + +exit $result + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/alpha/ffi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/alpha/ffi.c new file mode 100644 index 000000000..8d6b2ba27 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/alpha/ffi.c @@ -0,0 +1,284 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 1998, 2001, 2007, 2008 Red Hat, Inc. + + Alpha Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include +#include + +/* Force FFI_TYPE_LONGDOUBLE to be different than FFI_TYPE_DOUBLE; + all further uses in this file will refer to the 128-bit type. */ +#if defined(__LONG_DOUBLE_128__) +# if FFI_TYPE_LONGDOUBLE != 4 +# error FFI_TYPE_LONGDOUBLE out of date +# endif +#else +# undef FFI_TYPE_LONGDOUBLE +# define FFI_TYPE_LONGDOUBLE 4 +#endif + +extern void ffi_call_osf(void *, unsigned long, unsigned, void *, void (*)(void)) + FFI_HIDDEN; +extern void ffi_closure_osf(void) FFI_HIDDEN; + + +ffi_status +ffi_prep_cif_machdep(ffi_cif *cif) +{ + /* Adjust cif->bytes to represent a minimum 6 words for the temporary + register argument loading area. */ + if (cif->bytes < 6*FFI_SIZEOF_ARG) + cif->bytes = 6*FFI_SIZEOF_ARG; + + /* Set the return type flag */ + switch (cif->rtype->type) + { + case FFI_TYPE_STRUCT: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + cif->flags = cif->rtype->type; + break; + + case FFI_TYPE_LONGDOUBLE: + /* 128-bit long double is returned in memory, like a struct. */ + cif->flags = FFI_TYPE_STRUCT; + break; + + default: + cif->flags = FFI_TYPE_INT; + break; + } + + return FFI_OK; +} + + +void +ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + unsigned long *stack, *argp; + long i, avn; + ffi_type **arg_types; + + /* If the return value is a struct and we don't have a return + value address then we need to make one. */ + if (rvalue == NULL && cif->flags == FFI_TYPE_STRUCT) + rvalue = alloca(cif->rtype->size); + + /* Allocate the space for the arguments, plus 4 words of temp + space for ffi_call_osf. */ + argp = stack = alloca(cif->bytes + 4*FFI_SIZEOF_ARG); + + if (cif->flags == FFI_TYPE_STRUCT) + *(void **) argp++ = rvalue; + + i = 0; + avn = cif->nargs; + arg_types = cif->arg_types; + + while (i < avn) + { + size_t size = (*arg_types)->size; + + switch ((*arg_types)->type) + { + case FFI_TYPE_SINT8: + *(SINT64 *) argp = *(SINT8 *)(* avalue); + break; + + case FFI_TYPE_UINT8: + *(SINT64 *) argp = *(UINT8 *)(* avalue); + break; + + case FFI_TYPE_SINT16: + *(SINT64 *) argp = *(SINT16 *)(* avalue); + break; + + case FFI_TYPE_UINT16: + *(SINT64 *) argp = *(UINT16 *)(* avalue); + break; + + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + /* Note that unsigned 32-bit quantities are sign extended. */ + *(SINT64 *) argp = *(SINT32 *)(* avalue); + break; + + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + case FFI_TYPE_POINTER: + *(UINT64 *) argp = *(UINT64 *)(* avalue); + break; + + case FFI_TYPE_FLOAT: + if (argp - stack < 6) + { + /* Note the conversion -- all the fp regs are loaded as + doubles. The in-register format is the same. */ + *(double *) argp = *(float *)(* avalue); + } + else + *(float *) argp = *(float *)(* avalue); + break; + + case FFI_TYPE_DOUBLE: + *(double *) argp = *(double *)(* avalue); + break; + + case FFI_TYPE_LONGDOUBLE: + /* 128-bit long double is passed by reference. */ + *(long double **) argp = (long double *)(* avalue); + size = sizeof (long double *); + break; + + case FFI_TYPE_STRUCT: + memcpy(argp, *avalue, (*arg_types)->size); + break; + + default: + FFI_ASSERT(0); + } + + argp += ALIGN(size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; + i++, arg_types++, avalue++; + } + + ffi_call_osf(stack, cif->bytes, cif->flags, rvalue, fn); +} + + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void *user_data, + void *codeloc) +{ + unsigned int *tramp; + + tramp = (unsigned int *) &closure->tramp[0]; + tramp[0] = 0x47fb0401; /* mov $27,$1 */ + tramp[1] = 0xa77b0010; /* ldq $27,16($27) */ + tramp[2] = 0x6bfb0000; /* jmp $31,($27),0 */ + tramp[3] = 0x47ff041f; /* nop */ + *(void **) &tramp[4] = ffi_closure_osf; + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + + /* Flush the Icache. + + Tru64 UNIX as doesn't understand the imb mnemonic, so use call_pal + instead, since both Compaq as and gas can handle it. + + 0x86 is PAL_imb in Tru64 UNIX . */ + asm volatile ("call_pal 0x86" : : : "memory"); + + return FFI_OK; +} + + +long FFI_HIDDEN +ffi_closure_osf_inner(ffi_closure *closure, void *rvalue, unsigned long *argp) +{ + ffi_cif *cif; + void **avalue; + ffi_type **arg_types; + long i, avn, argn; + + cif = closure->cif; + avalue = alloca(cif->nargs * sizeof(void *)); + + argn = 0; + + /* Copy the caller's structure return address to that the closure + returns the data directly to the caller. */ + if (cif->flags == FFI_TYPE_STRUCT) + { + rvalue = (void *) argp[0]; + argn = 1; + } + + i = 0; + avn = cif->nargs; + arg_types = cif->arg_types; + + /* Grab the addresses of the arguments from the stack frame. */ + while (i < avn) + { + size_t size = arg_types[i]->size; + + switch (arg_types[i]->type) + { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + case FFI_TYPE_POINTER: + case FFI_TYPE_STRUCT: + avalue[i] = &argp[argn]; + break; + + case FFI_TYPE_FLOAT: + if (argn < 6) + { + /* Floats coming from registers need conversion from double + back to float format. */ + *(float *)&argp[argn - 6] = *(double *)&argp[argn - 6]; + avalue[i] = &argp[argn - 6]; + } + else + avalue[i] = &argp[argn]; + break; + + case FFI_TYPE_DOUBLE: + avalue[i] = &argp[argn - (argn < 6 ? 6 : 0)]; + break; + + case FFI_TYPE_LONGDOUBLE: + /* 128-bit long double is passed by reference. */ + avalue[i] = (long double *) argp[argn]; + size = sizeof (long double *); + break; + + default: + abort (); + } + + argn += ALIGN(size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; + i++; + } + + /* Invoke the closure. */ + closure->fun (cif, rvalue, avalue, closure->user_data); + + /* Tell ffi_closure_osf how to perform return type promotions. */ + return cif->rtype->type; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/alpha/ffitarget.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/alpha/ffitarget.h new file mode 100644 index 000000000..7d06eb0bc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/alpha/ffitarget.h @@ -0,0 +1,48 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + Target configuration macros for Alpha. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_OSF, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_OSF +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 24 +#define FFI_NATIVE_RAW_API 0 + +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/alpha/osf.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/alpha/osf.S new file mode 100644 index 000000000..6b9f4dfa0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/alpha/osf.S @@ -0,0 +1,387 @@ +/* ----------------------------------------------------------------------- + osf.S - Copyright (c) 1998, 2001, 2007, 2008, 2011 Red Hat + + Alpha/OSF Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + + .arch ev6 + .text + +/* ffi_call_osf (void *args, unsigned long bytes, unsigned flags, + void *raddr, void (*fnaddr)(void)); + + Bit o trickiness here -- ARGS+BYTES is the base of the stack frame + for this function. This has been allocated by ffi_call. We also + deallocate some of the stack that has been alloca'd. */ + + .align 3 + .globl ffi_call_osf + .ent ffi_call_osf + FFI_HIDDEN(ffi_call_osf) + +ffi_call_osf: + .frame $15, 32, $26, 0 + .mask 0x4008000, -32 +$LFB1: + addq $16,$17,$1 + mov $16, $30 + stq $26, 0($1) + stq $15, 8($1) + stq $18, 16($1) + mov $1, $15 +$LCFI1: + .prologue 0 + + stq $19, 24($1) + mov $20, $27 + + # Load up all of the (potential) argument registers. + ldq $16, 0($30) + ldt $f16, 0($30) + ldt $f17, 8($30) + ldq $17, 8($30) + ldt $f18, 16($30) + ldq $18, 16($30) + ldt $f19, 24($30) + ldq $19, 24($30) + ldt $f20, 32($30) + ldq $20, 32($30) + ldt $f21, 40($30) + ldq $21, 40($30) + + # Deallocate the register argument area. + lda $30, 48($30) + + jsr $26, ($27), 0 + ldgp $29, 0($26) + + # If the return value pointer is NULL, assume no return value. + ldq $19, 24($15) + ldq $18, 16($15) + ldq $26, 0($15) +$LCFI2: + beq $19, $noretval + + # Store the return value out in the proper type. + cmpeq $18, FFI_TYPE_INT, $1 + bne $1, $retint + cmpeq $18, FFI_TYPE_FLOAT, $2 + bne $2, $retfloat + cmpeq $18, FFI_TYPE_DOUBLE, $3 + bne $3, $retdouble + + .align 3 +$noretval: + ldq $15, 8($15) + ret + + .align 4 +$retint: + stq $0, 0($19) + nop + ldq $15, 8($15) + ret + + .align 4 +$retfloat: + sts $f0, 0($19) + nop + ldq $15, 8($15) + ret + + .align 4 +$retdouble: + stt $f0, 0($19) + nop + ldq $15, 8($15) + ret +$LFE1: + + .end ffi_call_osf + +/* ffi_closure_osf(...) + + Receives the closure argument in $1. */ + + .align 3 + .globl ffi_closure_osf + .ent ffi_closure_osf + FFI_HIDDEN(ffi_closure_osf) + +ffi_closure_osf: + .frame $30, 16*8, $26, 0 + .mask 0x4000000, -16*8 +$LFB2: + ldgp $29, 0($27) + subq $30, 16*8, $30 +$LCFI5: + stq $26, 0($30) +$LCFI6: + .prologue 1 + + # Store all of the potential argument registers in va_list format. + stt $f16, 4*8($30) + stt $f17, 5*8($30) + stt $f18, 6*8($30) + stt $f19, 7*8($30) + stt $f20, 8*8($30) + stt $f21, 9*8($30) + stq $16, 10*8($30) + stq $17, 11*8($30) + stq $18, 12*8($30) + stq $19, 13*8($30) + stq $20, 14*8($30) + stq $21, 15*8($30) + + # Call ffi_closure_osf_inner to do the bulk of the work. + mov $1, $16 + lda $17, 2*8($30) + lda $18, 10*8($30) + jsr $26, ffi_closure_osf_inner + ldgp $29, 0($26) + ldq $26, 0($30) + + # Load up the return value in the proper type. + lda $1, $load_table + s4addq $0, $1, $1 + ldl $1, 0($1) + addq $1, $29, $1 + jmp $31, ($1), $load_32 + + .align 4 +$load_none: + addq $30, 16*8, $30 + ret + + .align 4 +$load_float: + lds $f0, 16($30) + nop + addq $30, 16*8, $30 + ret + + .align 4 +$load_double: + ldt $f0, 16($30) + nop + addq $30, 16*8, $30 + ret + + .align 4 +$load_u8: +#ifdef __alpha_bwx__ + ldbu $0, 16($30) + nop +#else + ldq $0, 16($30) + and $0, 255, $0 +#endif + addq $30, 16*8, $30 + ret + + .align 4 +$load_s8: +#ifdef __alpha_bwx__ + ldbu $0, 16($30) + sextb $0, $0 +#else + ldq $0, 16($30) + sll $0, 56, $0 + sra $0, 56, $0 +#endif + addq $30, 16*8, $30 + ret + + .align 4 +$load_u16: +#ifdef __alpha_bwx__ + ldwu $0, 16($30) + nop +#else + ldq $0, 16($30) + zapnot $0, 3, $0 +#endif + addq $30, 16*8, $30 + ret + + .align 4 +$load_s16: +#ifdef __alpha_bwx__ + ldwu $0, 16($30) + sextw $0, $0 +#else + ldq $0, 16($30) + sll $0, 48, $0 + sra $0, 48, $0 +#endif + addq $30, 16*8, $30 + ret + + .align 4 +$load_32: + ldl $0, 16($30) + nop + addq $30, 16*8, $30 + ret + + .align 4 +$load_64: + ldq $0, 16($30) + nop + addq $30, 16*8, $30 + ret +$LFE2: + + .end ffi_closure_osf + +#ifdef __ELF__ +.section .rodata +#else +.rdata +#endif +$load_table: + .gprel32 $load_none # FFI_TYPE_VOID + .gprel32 $load_32 # FFI_TYPE_INT + .gprel32 $load_float # FFI_TYPE_FLOAT + .gprel32 $load_double # FFI_TYPE_DOUBLE + .gprel32 $load_none # FFI_TYPE_LONGDOUBLE + .gprel32 $load_u8 # FFI_TYPE_UINT8 + .gprel32 $load_s8 # FFI_TYPE_SINT8 + .gprel32 $load_u16 # FFI_TYPE_UINT16 + .gprel32 $load_s16 # FFI_TYPE_SINT16 + .gprel32 $load_32 # FFI_TYPE_UINT32 + .gprel32 $load_32 # FFI_TYPE_SINT32 + .gprel32 $load_64 # FFI_TYPE_UINT64 + .gprel32 $load_64 # FFI_TYPE_SINT64 + .gprel32 $load_none # FFI_TYPE_STRUCT + .gprel32 $load_64 # FFI_TYPE_POINTER + +/* Assert that the table above is in sync with ffi.h. */ + +#if FFI_TYPE_FLOAT != 2 \ + || FFI_TYPE_DOUBLE != 3 \ + || FFI_TYPE_UINT8 != 5 \ + || FFI_TYPE_SINT8 != 6 \ + || FFI_TYPE_UINT16 != 7 \ + || FFI_TYPE_SINT16 != 8 \ + || FFI_TYPE_UINT32 != 9 \ + || FFI_TYPE_SINT32 != 10 \ + || FFI_TYPE_UINT64 != 11 \ + || FFI_TYPE_SINT64 != 12 \ + || FFI_TYPE_STRUCT != 13 \ + || FFI_TYPE_POINTER != 14 \ + || FFI_TYPE_LAST != 14 +#error "osf.S out of sync with ffi.h" +#endif + +#ifdef __ELF__ +# define UA_SI .4byte +# define FDE_ENCODING 0x1b /* pcrel sdata4 */ +# define FDE_ENCODE(X) .4byte X-. +# define FDE_ARANGE(X) .4byte X +#elif defined __osf__ +# define UA_SI .align 0; .long +# define FDE_ENCODING 0x50 /* aligned absolute */ +# define FDE_ENCODE(X) .align 3; .quad X +# define FDE_ARANGE(X) .align 0; .quad X +#endif + +#ifdef __ELF__ + .section .eh_frame,EH_FRAME_FLAGS,@progbits +#elif defined __osf__ + .data + .align 3 + .globl _GLOBAL__F_ffi_call_osf +_GLOBAL__F_ffi_call_osf: +#endif +__FRAME_BEGIN__: + UA_SI $LECIE1-$LSCIE1 # Length of Common Information Entry +$LSCIE1: + UA_SI 0x0 # CIE Identifier Tag + .byte 0x1 # CIE Version + .ascii "zR\0" # CIE Augmentation + .byte 0x1 # uleb128 0x1; CIE Code Alignment Factor + .byte 0x78 # sleb128 -8; CIE Data Alignment Factor + .byte 26 # CIE RA Column + .byte 0x1 # uleb128 0x1; Augmentation size + .byte FDE_ENCODING # FDE Encoding + .byte 0xc # DW_CFA_def_cfa + .byte 30 # uleb128 column 30 + .byte 0 # uleb128 offset 0 + .align 3 +$LECIE1: +$LSFDE1: + UA_SI $LEFDE1-$LASFDE1 # FDE Length +$LASFDE1: + UA_SI $LASFDE1-__FRAME_BEGIN__ # FDE CIE offset + FDE_ENCODE($LFB1) # FDE initial location + FDE_ARANGE($LFE1-$LFB1) # FDE address range + .byte 0x0 # uleb128 0x0; Augmentation size + + .byte 0x4 # DW_CFA_advance_loc4 + UA_SI $LCFI1-$LFB1 + .byte 0x9a # DW_CFA_offset, column 26 + .byte 4 # uleb128 4*-8 + .byte 0x8f # DW_CFA_offset, column 15 + .byte 0x3 # uleb128 3*-8 + .byte 0xc # DW_CFA_def_cfa + .byte 15 # uleb128 column 15 + .byte 32 # uleb128 offset 32 + + .byte 0x4 # DW_CFA_advance_loc4 + UA_SI $LCFI2-$LCFI1 + .byte 0xda # DW_CFA_restore, column 26 + .align 3 +$LEFDE1: + +$LSFDE3: + UA_SI $LEFDE3-$LASFDE3 # FDE Length +$LASFDE3: + UA_SI $LASFDE3-__FRAME_BEGIN__ # FDE CIE offset + FDE_ENCODE($LFB2) # FDE initial location + FDE_ARANGE($LFE2-$LFB2) # FDE address range + .byte 0x0 # uleb128 0x0; Augmentation size + + .byte 0x4 # DW_CFA_advance_loc4 + UA_SI $LCFI5-$LFB2 + .byte 0xe # DW_CFA_def_cfa_offset + .byte 0x80,0x1 # uleb128 128 + + .byte 0x4 # DW_CFA_advance_loc4 + UA_SI $LCFI6-$LCFI5 + .byte 0x9a # DW_CFA_offset, column 26 + .byte 16 # uleb128 offset 16*-8 + .align 3 +$LEFDE3: +#if defined __osf__ + .align 0 + .long 0 # End of Table +#endif + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/arm/ffi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/arm/ffi.c new file mode 100644 index 000000000..b2e76679e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/arm/ffi.c @@ -0,0 +1,728 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2011 Plausible Labs Cooperative, Inc. + Copyright (c) 2011 Anthony Green + Copyright (c) 2011 Free Software Foundation + Copyright (c) 1998, 2008, 2011 Red Hat, Inc. + + ARM Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +#include + +/* Forward declares. */ +static int vfp_type_p (ffi_type *); +static void layout_vfp_args (ffi_cif *); + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments + + The vfp_space parameter is the load area for VFP regs, the return + value is cif->vfp_used (word bitset of VFP regs used for passing + arguments). These are only used for the VFP hard-float ABI. +*/ +int ffi_prep_args(char *stack, extended_cif *ecif, float *vfp_space) +{ + register unsigned int i, vi = 0; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + argp = stack; + + if ( ecif->cif->flags == FFI_TYPE_STRUCT ) { + *(void **) argp = ecif->rvalue; + argp += 4; + } + + p_argv = ecif->avalue; + + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; + (i != 0); + i--, p_arg++) + { + size_t z; + + /* Allocated in VFP registers. */ + if (ecif->cif->abi == FFI_VFP + && vi < ecif->cif->vfp_nargs && vfp_type_p (*p_arg)) + { + float* vfp_slot = vfp_space + ecif->cif->vfp_args[vi++]; + if ((*p_arg)->type == FFI_TYPE_FLOAT) + *((float*)vfp_slot) = *((float*)*p_argv); + else if ((*p_arg)->type == FFI_TYPE_DOUBLE) + *((double*)vfp_slot) = *((double*)*p_argv); + else + memcpy(vfp_slot, *p_argv, (*p_arg)->size); + p_argv++; + continue; + } + + /* Align if necessary */ + if (((*p_arg)->alignment - 1) & (unsigned) argp) { + argp = (char *) ALIGN(argp, (*p_arg)->alignment); + } + + if ((*p_arg)->type == FFI_TYPE_STRUCT) + argp = (char *) ALIGN(argp, 4); + + z = (*p_arg)->size; + if (z < sizeof(int)) + { + z = sizeof(int); + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); + break; + + case FFI_TYPE_UINT8: + *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); + break; + + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); + break; + + case FFI_TYPE_UINT16: + *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); + break; + + case FFI_TYPE_STRUCT: + memcpy(argp, *p_argv, (*p_arg)->size); + break; + + default: + FFI_ASSERT(0); + } + } + else if (z == sizeof(int)) + { + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + } + else + { + memcpy(argp, *p_argv, z); + } + p_argv++; + argp += z; + } + + /* Indicate the VFP registers used. */ + return ecif->cif->vfp_used; +} + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + int type_code; + /* Round the stack up to a multiple of 8 bytes. This isn't needed + everywhere, but it is on some platforms, and it doesn't harm anything + when it isn't needed. */ + cif->bytes = (cif->bytes + 7) & ~7; + + /* Set the return type flag */ + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + cif->flags = (unsigned) cif->rtype->type; + break; + + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + cif->flags = (unsigned) FFI_TYPE_SINT64; + break; + + case FFI_TYPE_STRUCT: + if (cif->abi == FFI_VFP + && (type_code = vfp_type_p (cif->rtype)) != 0) + { + /* A Composite Type passed in VFP registers, either + FFI_TYPE_STRUCT_VFP_FLOAT or FFI_TYPE_STRUCT_VFP_DOUBLE. */ + cif->flags = (unsigned) type_code; + } + else if (cif->rtype->size <= 4) + /* A Composite Type not larger than 4 bytes is returned in r0. */ + cif->flags = (unsigned)FFI_TYPE_INT; + else + /* A Composite Type larger than 4 bytes, or whose size cannot + be determined statically ... is stored in memory at an + address passed [in r0]. */ + cif->flags = (unsigned)FFI_TYPE_STRUCT; + break; + + default: + cif->flags = FFI_TYPE_INT; + break; + } + + /* Map out the register placements of VFP register args. + The VFP hard-float calling conventions are slightly more sophisticated than + the base calling conventions, so we do it here instead of in ffi_prep_args(). */ + if (cif->abi == FFI_VFP) + layout_vfp_args (cif); + + return FFI_OK; +} + +/* Prototypes for assembly functions, in sysv.S */ +extern void ffi_call_SYSV (void (*fn)(void), extended_cif *, unsigned, unsigned, unsigned *); +extern void ffi_call_VFP (void (*fn)(void), extended_cif *, unsigned, unsigned, unsigned *); + +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + + int small_struct = (cif->flags == FFI_TYPE_INT + && cif->rtype->type == FFI_TYPE_STRUCT); + int vfp_struct = (cif->flags == FFI_TYPE_STRUCT_VFP_FLOAT + || cif->flags == FFI_TYPE_STRUCT_VFP_DOUBLE); + + ecif.cif = cif; + ecif.avalue = avalue; + + unsigned int temp; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + + if ((rvalue == NULL) && + (cif->flags == FFI_TYPE_STRUCT)) + { + ecif.rvalue = alloca(cif->rtype->size); + } + else if (small_struct) + ecif.rvalue = &temp; + else if (vfp_struct) + { + /* Largest case is double x 4. */ + ecif.rvalue = alloca(32); + } + else + ecif.rvalue = rvalue; + + switch (cif->abi) + { + case FFI_SYSV: + ffi_call_SYSV (fn, &ecif, cif->bytes, cif->flags, ecif.rvalue); + break; + + case FFI_VFP: + ffi_call_VFP (fn, &ecif, cif->bytes, cif->flags, ecif.rvalue); + break; + + default: + FFI_ASSERT(0); + break; + } + if (small_struct) + memcpy (rvalue, &temp, cif->rtype->size); + else if (vfp_struct) + memcpy (rvalue, ecif.rvalue, cif->rtype->size); +} + +/** private members **/ + +static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, + void** args, ffi_cif* cif, float *vfp_stack); + +void ffi_closure_SYSV (ffi_closure *); + +void ffi_closure_VFP (ffi_closure *); + +/* This function is jumped to by the trampoline */ + +unsigned int +ffi_closure_SYSV_inner (closure, respp, args, vfp_args) + ffi_closure *closure; + void **respp; + void *args; + void *vfp_args; +{ + // our various things... + ffi_cif *cif; + void **arg_area; + + cif = closure->cif; + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + + /* this call will initialize ARG_AREA, such that each + * element in that array points to the corresponding + * value on the stack; and if the function returns + * a structure, it will re-set RESP to point to the + * structure return address. */ + + ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif, vfp_args); + + (closure->fun) (cif, *respp, arg_area, closure->user_data); + + return cif->flags; +} + +/*@-exportheader@*/ +static void +ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, + void **avalue, ffi_cif *cif, + /* Used only under VFP hard-float ABI. */ + float *vfp_stack) +/*@=exportheader@*/ +{ + register unsigned int i, vi = 0; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + argp = stack; + + if ( cif->flags == FFI_TYPE_STRUCT ) { + *rvalue = *(void **) argp; + argp += 4; + } + + p_argv = avalue; + + for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) + { + size_t z; + size_t alignment; + + if (cif->abi == FFI_VFP + && vi < cif->vfp_nargs && vfp_type_p (*p_arg)) + { + *p_argv++ = (void*)(vfp_stack + cif->vfp_args[vi++]); + continue; + } + + alignment = (*p_arg)->alignment; + if (alignment < 4) + alignment = 4; + /* Align if necessary */ + if ((alignment - 1) & (unsigned) argp) { + argp = (char *) ALIGN(argp, alignment); + } + + z = (*p_arg)->size; + + /* because we're little endian, this is what it turns into. */ + + *p_argv = (void*) argp; + + p_argv++; + argp += z; + } + + return; +} + +/* How to make a trampoline. */ + +#if FFI_EXEC_TRAMPOLINE_TABLE + +#include +#include +#include +#include + +extern void *ffi_closure_trampoline_table_page; + +typedef struct ffi_trampoline_table ffi_trampoline_table; +typedef struct ffi_trampoline_table_entry ffi_trampoline_table_entry; + +struct ffi_trampoline_table { + /* contigious writable and executable pages */ + vm_address_t config_page; + vm_address_t trampoline_page; + + /* free list tracking */ + uint16_t free_count; + ffi_trampoline_table_entry *free_list; + ffi_trampoline_table_entry *free_list_pool; + + ffi_trampoline_table *prev; + ffi_trampoline_table *next; +}; + +struct ffi_trampoline_table_entry { + void *(*trampoline)(); + ffi_trampoline_table_entry *next; +}; + +/* Override the standard architecture trampoline size */ +// XXX TODO - Fix +#undef FFI_TRAMPOLINE_SIZE +#define FFI_TRAMPOLINE_SIZE 12 + +/* The trampoline configuration is placed at 4080 bytes prior to the trampoline's entry point */ +#define FFI_TRAMPOLINE_CODELOC_CONFIG(codeloc) ((void **) (((uint8_t *) codeloc) - 4080)); + +/* The first 16 bytes of the config page are unused, as they are unaddressable from the trampoline page. */ +#define FFI_TRAMPOLINE_CONFIG_PAGE_OFFSET 16 + +/* Total number of trampolines that fit in one trampoline table */ +#define FFI_TRAMPOLINE_COUNT ((PAGE_SIZE - FFI_TRAMPOLINE_CONFIG_PAGE_OFFSET) / FFI_TRAMPOLINE_SIZE) + +static pthread_mutex_t ffi_trampoline_lock = PTHREAD_MUTEX_INITIALIZER; +static ffi_trampoline_table *ffi_trampoline_tables = NULL; + +static ffi_trampoline_table * +ffi_trampoline_table_alloc () +{ + ffi_trampoline_table *table = NULL; + + /* Loop until we can allocate two contigious pages */ + while (table == NULL) { + vm_address_t config_page = 0x0; + kern_return_t kt; + + /* Try to allocate two pages */ + kt = vm_allocate (mach_task_self (), &config_page, PAGE_SIZE*2, VM_FLAGS_ANYWHERE); + if (kt != KERN_SUCCESS) { + fprintf(stderr, "vm_allocate() failure: %d at %s:%d\n", kt, __FILE__, __LINE__); + break; + } + + /* Now drop the second half of the allocation to make room for the trampoline table */ + vm_address_t trampoline_page = config_page+PAGE_SIZE; + kt = vm_deallocate (mach_task_self (), trampoline_page, PAGE_SIZE); + if (kt != KERN_SUCCESS) { + fprintf(stderr, "vm_deallocate() failure: %d at %s:%d\n", kt, __FILE__, __LINE__); + break; + } + + /* Remap the trampoline table to directly follow the config page */ + vm_prot_t cur_prot; + vm_prot_t max_prot; + + kt = vm_remap (mach_task_self (), &trampoline_page, PAGE_SIZE, 0x0, FALSE, mach_task_self (), (vm_address_t) &ffi_closure_trampoline_table_page, FALSE, &cur_prot, &max_prot, VM_INHERIT_SHARE); + + /* If we lost access to the destination trampoline page, drop our config allocation mapping and retry */ + if (kt != KERN_SUCCESS) { + /* Log unexpected failures */ + if (kt != KERN_NO_SPACE) { + fprintf(stderr, "vm_remap() failure: %d at %s:%d\n", kt, __FILE__, __LINE__); + } + + vm_deallocate (mach_task_self (), config_page, PAGE_SIZE); + continue; + } + + /* We have valid trampoline and config pages */ + table = calloc (1, sizeof(ffi_trampoline_table)); + table->free_count = FFI_TRAMPOLINE_COUNT; + table->config_page = config_page; + table->trampoline_page = trampoline_page; + + /* Create and initialize the free list */ + table->free_list_pool = calloc(FFI_TRAMPOLINE_COUNT, sizeof(ffi_trampoline_table_entry)); + + uint16_t i; + for (i = 0; i < table->free_count; i++) { + ffi_trampoline_table_entry *entry = &table->free_list_pool[i]; + entry->trampoline = (void *) (table->trampoline_page + (i * FFI_TRAMPOLINE_SIZE)); + + if (i < table->free_count - 1) + entry->next = &table->free_list_pool[i+1]; + } + + table->free_list = table->free_list_pool; + } + + return table; +} + +void * +ffi_closure_alloc (size_t size, void **code) +{ + /* Create the closure */ + ffi_closure *closure = malloc(size); + if (closure == NULL) + return NULL; + + pthread_mutex_lock(&ffi_trampoline_lock); + + /* Check for an active trampoline table with available entries. */ + ffi_trampoline_table *table = ffi_trampoline_tables; + if (table == NULL || table->free_list == NULL) { + table = ffi_trampoline_table_alloc (); + if (table == NULL) { + free(closure); + return NULL; + } + + /* Insert the new table at the top of the list */ + table->next = ffi_trampoline_tables; + if (table->next != NULL) + table->next->prev = table; + + ffi_trampoline_tables = table; + } + + /* Claim the free entry */ + ffi_trampoline_table_entry *entry = ffi_trampoline_tables->free_list; + ffi_trampoline_tables->free_list = entry->next; + ffi_trampoline_tables->free_count--; + entry->next = NULL; + + pthread_mutex_unlock(&ffi_trampoline_lock); + + /* Initialize the return values */ + *code = entry->trampoline; + closure->trampoline_table = table; + closure->trampoline_table_entry = entry; + + return closure; +} + +void +ffi_closure_free (void *ptr) +{ + ffi_closure *closure = ptr; + + pthread_mutex_lock(&ffi_trampoline_lock); + + /* Fetch the table and entry references */ + ffi_trampoline_table *table = closure->trampoline_table; + ffi_trampoline_table_entry *entry = closure->trampoline_table_entry; + + /* Return the entry to the free list */ + entry->next = table->free_list; + table->free_list = entry; + table->free_count++; + + /* If all trampolines within this table are free, and at least one other table exists, deallocate + * the table */ + if (table->free_count == FFI_TRAMPOLINE_COUNT && ffi_trampoline_tables != table) { + /* Remove from the list */ + if (table->prev != NULL) + table->prev->next = table->next; + + if (table->next != NULL) + table->next->prev = table->prev; + + /* Deallocate pages */ + kern_return_t kt; + kt = vm_deallocate (mach_task_self (), table->config_page, PAGE_SIZE); + if (kt != KERN_SUCCESS) + fprintf(stderr, "vm_deallocate() failure: %d at %s:%d\n", kt, __FILE__, __LINE__); + + kt = vm_deallocate (mach_task_self (), table->trampoline_page, PAGE_SIZE); + if (kt != KERN_SUCCESS) + fprintf(stderr, "vm_deallocate() failure: %d at %s:%d\n", kt, __FILE__, __LINE__); + + /* Deallocate free list */ + free (table->free_list_pool); + free (table); + } else if (ffi_trampoline_tables != table) { + /* Otherwise, bump this table to the top of the list */ + table->prev = NULL; + table->next = ffi_trampoline_tables; + if (ffi_trampoline_tables != NULL) + ffi_trampoline_tables->prev = table; + + ffi_trampoline_tables = table; + } + + pthread_mutex_unlock (&ffi_trampoline_lock); + + /* Free the closure */ + free (closure); +} + +#else + +#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ +({ unsigned char *__tramp = (unsigned char*)(TRAMP); \ + unsigned int __fun = (unsigned int)(FUN); \ + unsigned int __ctx = (unsigned int)(CTX); \ + unsigned char *insns = (unsigned char *)(CTX); \ + *(unsigned int*) &__tramp[0] = 0xe92d000f; /* stmfd sp!, {r0-r3} */ \ + *(unsigned int*) &__tramp[4] = 0xe59f0000; /* ldr r0, [pc] */ \ + *(unsigned int*) &__tramp[8] = 0xe59ff000; /* ldr pc, [pc] */ \ + *(unsigned int*) &__tramp[12] = __ctx; \ + *(unsigned int*) &__tramp[16] = __fun; \ + __clear_cache((&__tramp[0]), (&__tramp[19])); /* Clear data mapping. */ \ + __clear_cache(insns, insns + 3 * sizeof (unsigned int)); \ + /* Clear instruction \ + mapping. */ \ + }) + +#endif + +/* the cif must already be prep'ed */ + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) +{ + void (*closure_func)(ffi_closure*) = NULL; + + if (cif->abi == FFI_SYSV) + closure_func = &ffi_closure_SYSV; + else if (cif->abi == FFI_VFP) + closure_func = &ffi_closure_VFP; + else + return FFI_BAD_ABI; + +#if FFI_EXEC_TRAMPOLINE_TABLE + void **config = FFI_TRAMPOLINE_CODELOC_CONFIG(codeloc); + config[0] = closure; + config[1] = closure_func; +#else + FFI_INIT_TRAMPOLINE (&closure->tramp[0], \ + closure_func, \ + codeloc); +#endif + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + +/* Below are routines for VFP hard-float support. */ + +static int rec_vfp_type_p (ffi_type *t, int *elt, int *elnum) +{ + switch (t->type) + { + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + *elt = (int) t->type; + *elnum = 1; + return 1; + + case FFI_TYPE_STRUCT_VFP_FLOAT: + *elt = FFI_TYPE_FLOAT; + *elnum = t->size / sizeof (float); + return 1; + + case FFI_TYPE_STRUCT_VFP_DOUBLE: + *elt = FFI_TYPE_DOUBLE; + *elnum = t->size / sizeof (double); + return 1; + + case FFI_TYPE_STRUCT:; + { + int base_elt = 0, total_elnum = 0; + ffi_type **el = t->elements; + while (*el) + { + int el_elt = 0, el_elnum = 0; + if (! rec_vfp_type_p (*el, &el_elt, &el_elnum) + || (base_elt && base_elt != el_elt) + || total_elnum + el_elnum > 4) + return 0; + base_elt = el_elt; + total_elnum += el_elnum; + el++; + } + *elnum = total_elnum; + *elt = base_elt; + return 1; + } + default: ; + } + return 0; +} + +static int vfp_type_p (ffi_type *t) +{ + int elt, elnum; + if (rec_vfp_type_p (t, &elt, &elnum)) + { + if (t->type == FFI_TYPE_STRUCT) + { + if (elnum == 1) + t->type = elt; + else + t->type = (elt == FFI_TYPE_FLOAT + ? FFI_TYPE_STRUCT_VFP_FLOAT + : FFI_TYPE_STRUCT_VFP_DOUBLE); + } + return (int) t->type; + } + return 0; +} + +static void place_vfp_arg (ffi_cif *cif, ffi_type *t) +{ + int reg = cif->vfp_reg_free; + int nregs = t->size / sizeof (float); + int align = ((t->type == FFI_TYPE_STRUCT_VFP_FLOAT + || t->type == FFI_TYPE_FLOAT) ? 1 : 2); + /* Align register number. */ + if ((reg & 1) && align == 2) + reg++; + while (reg + nregs <= 16) + { + int s, new_used = 0; + for (s = reg; s < reg + nregs; s++) + { + new_used |= (1 << s); + if (cif->vfp_used & (1 << s)) + { + reg += align; + goto next_reg; + } + } + /* Found regs to allocate. */ + cif->vfp_used |= new_used; + cif->vfp_args[cif->vfp_nargs++] = reg; + + /* Update vfp_reg_free. */ + if (cif->vfp_used & (1 << cif->vfp_reg_free)) + { + reg += nregs; + while (cif->vfp_used & (1 << reg)) + reg += 1; + cif->vfp_reg_free = reg; + } + return; + next_reg: ; + } +} + +static void layout_vfp_args (ffi_cif *cif) +{ + int i; + /* Init VFP fields */ + cif->vfp_used = 0; + cif->vfp_nargs = 0; + cif->vfp_reg_free = 0; + memset (cif->vfp_args, -1, 16); /* Init to -1. */ + + for (i = 0; i < cif->nargs; i++) + { + ffi_type *t = cif->arg_types[i]; + if (vfp_type_p (t)) + place_vfp_arg (cif, t); + } +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/arm/ffitarget.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/arm/ffitarget.h new file mode 100644 index 000000000..ce25b23f5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/arm/ffitarget.h @@ -0,0 +1,65 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + Copyright (c) 2010 CodeSourcery + + Target configuration macros for ARM. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_VFP, + FFI_LAST_ABI, +#ifdef __ARM_PCS_VFP + FFI_DEFAULT_ABI = FFI_VFP, +#else + FFI_DEFAULT_ABI = FFI_SYSV, +#endif +} ffi_abi; +#endif + +#define FFI_EXTRA_CIF_FIELDS \ + int vfp_used; \ + short vfp_reg_free, vfp_nargs; \ + signed char vfp_args[16] \ + +/* Internally used. */ +#define FFI_TYPE_STRUCT_VFP_FLOAT (FFI_TYPE_LAST + 1) +#define FFI_TYPE_STRUCT_VFP_DOUBLE (FFI_TYPE_LAST + 2) + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 20 +#define FFI_NATIVE_RAW_API 0 + +#endif + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/arm/gentramp.sh b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/arm/gentramp.sh new file mode 100755 index 000000000..74f0b867d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/arm/gentramp.sh @@ -0,0 +1,118 @@ +#!/bin/sh + +# ----------------------------------------------------------------------- +# gentramp.sh - Copyright (c) 2010, Plausible Labs Cooperative, Inc. +# +# ARM Trampoline Page Generator +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# ``Software''), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# ----------------------------------------------------------------------- + +PROGNAME=$0 + +# Each trampoline is exactly 3 instructions, or 12 bytes. If any of these values change, +# the entire arm trampoline implementation must be updated to match, too. + +# Size of an individual trampoline, in bytes +TRAMPOLINE_SIZE=12 + +# Page size, in bytes +PAGE_SIZE=4096 + +# Compute the size of the reachable config page; The first 16 bytes of the config page +# are unreachable due to our maximum pc-relative ldr offset. +PAGE_AVAIL=`expr $PAGE_SIZE - 16` + +# Compute the number of of available trampolines. +TRAMPOLINE_COUNT=`expr $PAGE_AVAIL / $TRAMPOLINE_SIZE` + +header () { + echo "# GENERATED CODE - DO NOT EDIT" + echo "# This file was generated by $PROGNAME" + echo "" + + # Write out the license header +cat << EOF +# Copyright (c) 2010, Plausible Labs Cooperative, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# ``Software''), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# ----------------------------------------------------------------------- + +EOF + + # Write out the trampoline table, aligned to the page boundary + echo ".text" + echo ".align 12" + echo ".globl _ffi_closure_trampoline_table_page" + echo "_ffi_closure_trampoline_table_page:" +} + + +# WARNING - Don't modify the trampoline code size without also updating the relevent libffi code +trampoline () { + cat << END + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + +END +} + +main () { + # Write out the header + header + + # Write out the trampolines + local i=0 + while [ $i -lt ${TRAMPOLINE_COUNT} ]; do + trampoline + local i=`expr $i + 1` + done +} + +main diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/arm/sysv.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/arm/sysv.S new file mode 100644 index 000000000..14a7f03f6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/arm/sysv.S @@ -0,0 +1,497 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 1998, 2008, 2011 Red Hat, Inc. + Copyright (c) 2011 Plausible Labs Cooperative, Inc. + + ARM Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include +#ifdef HAVE_MACHINE_ASM_H +#include +#else +#ifdef __USER_LABEL_PREFIX__ +#define CONCAT1(a, b) CONCAT2(a, b) +#define CONCAT2(a, b) a ## b + +/* Use the right prefix for global labels. */ +#define CNAME(x) CONCAT1 (__USER_LABEL_PREFIX__, x) +#else +#define CNAME(x) x +#endif +#ifdef __APPLE__ +#define ENTRY(x) .globl CNAME(x); CNAME(x): +#else +#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): +#endif /* __APPLE__ */ +#endif + +#ifdef __ELF__ +#define LSYM(x) .x +#else +#define LSYM(x) x +#endif + +/* Use the SOFTFP return value ABI on Mac OS X, as per the iOS ABI + Function Call Guide */ +#ifdef __APPLE__ +#define __SOFTFP__ +#endif + +/* We need a better way of testing for this, but for now, this is all + we can do. */ +@ This selects the minimum architecture level required. +#define __ARM_ARCH__ 3 + +#if defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) +# undef __ARM_ARCH__ +# define __ARM_ARCH__ 4 +#endif + +#if defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) \ + || defined(__ARM_ARCH_5E__) || defined(__ARM_ARCH_5TE__) \ + || defined(__ARM_ARCH_5TEJ__) +# undef __ARM_ARCH__ +# define __ARM_ARCH__ 5 +#endif + +#if defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) \ + || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) \ + || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) \ + || defined(__ARM_ARCH_6M__) +# undef __ARM_ARCH__ +# define __ARM_ARCH__ 6 +#endif + +#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) \ + || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) \ + || defined(__ARM_ARCH_7EM__) +# undef __ARM_ARCH__ +# define __ARM_ARCH__ 7 +#endif + +#if __ARM_ARCH__ >= 5 +# define call_reg(x) blx x +#elif defined (__ARM_ARCH_4T__) +# define call_reg(x) mov lr, pc ; bx x +# if defined(__thumb__) || defined(__THUMB_INTERWORK__) +# define __INTERWORKING__ +# endif +#else +# define call_reg(x) mov lr, pc ; mov pc, x +#endif + +/* Conditionally compile unwinder directives. */ +#ifdef __ARM_EABI__ +#define UNWIND +#else +#define UNWIND @ +#endif + + +#if defined(__thumb__) && !defined(__THUMB_INTERWORK__) +.macro ARM_FUNC_START name + .text + .align 0 + .thumb + .thumb_func +#ifdef __APPLE__ + ENTRY($0) +#else + ENTRY(\name) +#endif + bx pc + nop + .arm + UNWIND .fnstart +/* A hook to tell gdb that we've switched to ARM mode. Also used to call + directly from other local arm routines. */ +#ifdef __APPLE__ +_L__$0: +#else +_L__\name: +#endif +.endm +#else +.macro ARM_FUNC_START name + .text + .align 0 + .arm +#ifdef __APPLE__ + ENTRY($0) +#else + ENTRY(\name) +#endif + UNWIND .fnstart +.endm +#endif + +.macro RETLDM regs=, cond=, dirn=ia +#if defined (__INTERWORKING__) + .ifc "\regs","" + ldr\cond lr, [sp], #4 + .else + ldm\cond\dirn sp!, {\regs, lr} + .endif + bx\cond lr +#else + .ifc "\regs","" + ldr\cond pc, [sp], #4 + .else + ldm\cond\dirn sp!, {\regs, pc} + .endif +#endif +.endm + + @ r0: ffi_prep_args + @ r1: &ecif + @ r2: cif->bytes + @ r3: fig->flags + @ sp+0: ecif.rvalue + + @ This assumes we are using gas. +ARM_FUNC_START ffi_call_SYSV + @ Save registers + stmfd sp!, {r0-r3, fp, lr} + UNWIND .save {r0-r3, fp, lr} + mov fp, sp + + UNWIND .setfp fp, sp + + @ Make room for all of the new args. + sub sp, fp, r2 + + @ Place all of the ffi_prep_args in position + mov r0, sp + @ r1 already set + + @ Call ffi_prep_args(stack, &ecif) + bl ffi_prep_args + + @ move first 4 parameters in registers + ldmia sp, {r0-r3} + + @ and adjust stack + sub lr, fp, sp @ cif->bytes == fp - sp + ldr ip, [fp] @ load fn() in advance + cmp lr, #16 + movhs lr, #16 + add sp, sp, lr + + @ call (fn) (...) + call_reg(ip) + + @ Remove the space we pushed for the args + mov sp, fp + + @ Load r2 with the pointer to storage for the return value + ldr r2, [sp, #24] + + @ Load r3 with the return type code + ldr r3, [sp, #12] + + @ If the return value pointer is NULL, assume no return value. + cmp r2, #0 + beq LSYM(Lepilogue) + +@ return INT + cmp r3, #FFI_TYPE_INT +#if defined(__SOFTFP__) || defined(__ARM_EABI__) + cmpne r3, #FFI_TYPE_FLOAT +#endif + streq r0, [r2] + beq LSYM(Lepilogue) + + @ return INT64 + cmp r3, #FFI_TYPE_SINT64 +#if defined(__SOFTFP__) || defined(__ARM_EABI__) + cmpne r3, #FFI_TYPE_DOUBLE +#endif + stmeqia r2, {r0, r1} + +#if !defined(__SOFTFP__) && !defined(__ARM_EABI__) + beq LSYM(Lepilogue) + +@ return FLOAT + cmp r3, #FFI_TYPE_FLOAT + stfeqs f0, [r2] + beq LSYM(Lepilogue) + +@ return DOUBLE or LONGDOUBLE + cmp r3, #FFI_TYPE_DOUBLE + stfeqd f0, [r2] +#endif + +LSYM(Lepilogue): +#if defined (__INTERWORKING__) + ldmia sp!, {r0-r3,fp, lr} + bx lr +#else + ldmia sp!, {r0-r3,fp, pc} +#endif + +.ffi_call_SYSV_end: + UNWIND .fnend +#ifdef __ELF__ + .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) +#endif + + +/* + unsigned int FFI_HIDDEN + ffi_closure_SYSV_inner (closure, respp, args) + ffi_closure *closure; + void **respp; + void *args; +*/ + +ARM_FUNC_START ffi_closure_SYSV + UNWIND .pad #16 + add ip, sp, #16 + stmfd sp!, {ip, lr} + UNWIND .save {r0, lr} + add r2, sp, #8 + UNWIND .pad #16 + sub sp, sp, #16 + str sp, [sp, #8] + add r1, sp, #8 + bl CNAME(ffi_closure_SYSV_inner) + cmp r0, #FFI_TYPE_INT + beq .Lretint + + cmp r0, #FFI_TYPE_FLOAT +#if defined(__SOFTFP__) || defined(__ARM_EABI__) + beq .Lretint +#else + beq .Lretfloat +#endif + + cmp r0, #FFI_TYPE_DOUBLE +#if defined(__SOFTFP__) || defined(__ARM_EABI__) + beq .Lretlonglong +#else + beq .Lretdouble +#endif + + cmp r0, #FFI_TYPE_LONGDOUBLE +#if defined(__SOFTFP__) || defined(__ARM_EABI__) + beq .Lretlonglong +#else + beq .Lretlongdouble +#endif + + cmp r0, #FFI_TYPE_SINT64 + beq .Lretlonglong +.Lclosure_epilogue: + add sp, sp, #16 + ldmfd sp, {sp, pc} +.Lretint: + ldr r0, [sp] + b .Lclosure_epilogue +.Lretlonglong: + ldr r0, [sp] + ldr r1, [sp, #4] + b .Lclosure_epilogue + +#if !defined(__SOFTFP__) && !defined(__ARM_EABI__) +.Lretfloat: + ldfs f0, [sp] + b .Lclosure_epilogue +.Lretdouble: + ldfd f0, [sp] + b .Lclosure_epilogue +.Lretlongdouble: + ldfd f0, [sp] + b .Lclosure_epilogue +#endif + +.ffi_closure_SYSV_end: + UNWIND .fnend +#ifdef __ELF__ + .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) +#endif + + +/* Below are VFP hard-float ABI call and closure implementations. + Add VFP FPU directive here. */ + .fpu vfp + + @ r0: fn + @ r1: &ecif + @ r2: cif->bytes + @ r3: fig->flags + @ sp+0: ecif.rvalue + +ARM_FUNC_START ffi_call_VFP + @ Save registers + stmfd sp!, {r0-r3, fp, lr} + UNWIND .save {r0-r3, fp, lr} + mov fp, sp + UNWIND .setfp fp, sp + + @ Make room for all of the new args. + sub sp, sp, r2 + + @ Make room for loading VFP args + sub sp, sp, #64 + + @ Place all of the ffi_prep_args in position + mov r0, sp + @ r1 already set + sub r2, fp, #64 @ VFP scratch space + + @ Call ffi_prep_args(stack, &ecif, vfp_space) + bl ffi_prep_args + + @ Load VFP register args if needed + cmp r0, #0 + beq LSYM(Lbase_args) + + @ Load only d0 if possible + cmp r0, #3 + sub ip, fp, #64 + flddle d0, [ip] + fldmiadgt ip, {d0-d7} + +LSYM(Lbase_args): + @ move first 4 parameters in registers + ldmia sp, {r0-r3} + + @ and adjust stack + sub lr, ip, sp @ cif->bytes == (fp - 64) - sp + ldr ip, [fp] @ load fn() in advance + cmp lr, #16 + movhs lr, #16 + add sp, sp, lr + + @ call (fn) (...) + call_reg(ip) + + @ Remove the space we pushed for the args + mov sp, fp + + @ Load r2 with the pointer to storage for + @ the return value + ldr r2, [sp, #24] + + @ Load r3 with the return type code + ldr r3, [sp, #12] + + @ If the return value pointer is NULL, + @ assume no return value. + cmp r2, #0 + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_INT + streq r0, [r2] + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_SINT64 + stmeqia r2, {r0, r1} + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_FLOAT + fstseq s0, [r2] + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_DOUBLE + fstdeq d0, [r2] + beq LSYM(Lepilogue_vfp) + + cmp r3, #FFI_TYPE_STRUCT_VFP_FLOAT + cmpne r3, #FFI_TYPE_STRUCT_VFP_DOUBLE + fstmiadeq r2, {d0-d3} + +LSYM(Lepilogue_vfp): + RETLDM "r0-r3,fp" + +.ffi_call_VFP_end: + UNWIND .fnend + .size CNAME(ffi_call_VFP),.ffi_call_VFP_end-CNAME(ffi_call_VFP) + + +ARM_FUNC_START ffi_closure_VFP + fstmfdd sp!, {d0-d7} + @ r0-r3, then d0-d7 + UNWIND .pad #80 + add ip, sp, #80 + stmfd sp!, {ip, lr} + UNWIND .save {r0, lr} + add r2, sp, #72 + add r3, sp, #8 + UNWIND .pad #72 + sub sp, sp, #72 + str sp, [sp, #64] + add r1, sp, #64 + bl ffi_closure_SYSV_inner + + cmp r0, #FFI_TYPE_INT + beq .Lretint_vfp + + cmp r0, #FFI_TYPE_FLOAT + beq .Lretfloat_vfp + + cmp r0, #FFI_TYPE_DOUBLE + cmpne r0, #FFI_TYPE_LONGDOUBLE + beq .Lretdouble_vfp + + cmp r0, #FFI_TYPE_SINT64 + beq .Lretlonglong_vfp + + cmp r0, #FFI_TYPE_STRUCT_VFP_FLOAT + beq .Lretfloat_struct_vfp + + cmp r0, #FFI_TYPE_STRUCT_VFP_DOUBLE + beq .Lretdouble_struct_vfp + +.Lclosure_epilogue_vfp: + add sp, sp, #72 + ldmfd sp, {sp, pc} + +.Lretfloat_vfp: + flds s0, [sp] + b .Lclosure_epilogue_vfp +.Lretdouble_vfp: + fldd d0, [sp] + b .Lclosure_epilogue_vfp +.Lretint_vfp: + ldr r0, [sp] + b .Lclosure_epilogue_vfp +.Lretlonglong_vfp: + ldmia sp, {r0, r1} + b .Lclosure_epilogue_vfp +.Lretfloat_struct_vfp: + fldmiad sp, {d0-d1} + b .Lclosure_epilogue_vfp +.Lretdouble_struct_vfp: + fldmiad sp, {d0-d3} + b .Lclosure_epilogue_vfp + +.ffi_closure_VFP_end: + UNWIND .fnend + .size CNAME(ffi_closure_VFP),.ffi_closure_VFP_end-CNAME(ffi_closure_VFP) + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",%progbits +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/arm/trampoline.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/arm/trampoline.S new file mode 100644 index 000000000..7b474291a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/arm/trampoline.S @@ -0,0 +1,4450 @@ +# GENERATED CODE - DO NOT EDIT +# This file was generated by ./gentramp.sh + +# Copyright (c) 2010, Plausible Labs Cooperative, Inc. +# +# Permission is hereby granted, free of charge, to any person obtaining +# a copy of this software and associated documentation files (the +# Software''), to deal in the Software without restriction, including +# without limitation the rights to use, copy, modify, merge, publish, +# distribute, sublicense, and/or sell copies of the Software, and to +# permit persons to whom the Software is furnished to do so, subject to +# the following conditions: +# +# The above copyright notice and this permission notice shall be included +# in all copies or substantial portions of the Software. +# +# THE SOFTWARE IS PROVIDED AS IS'', WITHOUT WARRANTY OF ANY KIND, +# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +# DEALINGS IN THE SOFTWARE. +# ----------------------------------------------------------------------- + +.text +.align 12 +.globl _ffi_closure_trampoline_table_page +_ffi_closure_trampoline_table_page: + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + + + // trampoline + // Save to stack + stmfd sp!, {r0-r3} + + // Load the context argument from the config page. + // This places the first usable config value at _ffi_closure_trampoline_table-4080 + // This accounts for the above 4-byte stmfd instruction, plus 8 bytes constant when loading from pc. + ldr r0, [pc, #-4092] + + // Load the jump address from the config page. + ldr pc, [pc, #-4092] + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/avr32/ffi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/avr32/ffi.c new file mode 100644 index 000000000..3d43397b0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/avr32/ffi.c @@ -0,0 +1,423 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2011 Anthony Green + Copyright (c) 2009 Bradley Smith + + AVR32 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +#include +#include +#include +#include + +/* #define DEBUG */ + +extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, + unsigned int, unsigned int, unsigned int*, unsigned int, + void (*fn)(void)); +extern void ffi_closure_SYSV (ffi_closure *); + +unsigned int pass_struct_on_stack(ffi_type *type) +{ + if(type->type != FFI_TYPE_STRUCT) + return 0; + + if(type->alignment < type->size && + !(type->size == 4 || type->size == 8) && + !(type->size == 8 && type->alignment >= 4)) + return 1; + + if(type->size == 3 || type->size == 5 || type->size == 6 || + type->size == 7) + return 1; + + return 0; +} + +/* ffi_prep_args is called by the assembly routine once stack space + * has been allocated for the function's arguments + * + * This is annoyingly complex since we need to keep track of used + * registers. + */ + +void ffi_prep_args(char *stack, extended_cif *ecif) +{ + unsigned int i; + void **p_argv; + ffi_type **p_arg; + char *reg_base = stack; + char *stack_base = stack + 20; + unsigned int stack_offset = 0; + unsigned int reg_mask = 0; + + p_argv = ecif->avalue; + + /* If cif->flags is struct then we know it's not passed in registers */ + if(ecif->cif->flags == FFI_TYPE_STRUCT) + { + *(void**)reg_base = ecif->rvalue; + reg_mask |= 1; + } + + for(i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs; + i++, p_arg++) + { + size_t z = (*p_arg)->size; + int alignment = (*p_arg)->alignment; + int type = (*p_arg)->type; + char *addr = 0; + + if(z % 4 != 0) + z += (4 - z % 4); + + if(reg_mask != 0x1f) + { + if(pass_struct_on_stack(*p_arg)) + { + addr = stack_base + stack_offset; + stack_offset += z; + } + else if(z == sizeof(int)) + { + char index = 0; + + while((reg_mask >> index) & 1) + index++; + + addr = reg_base + (index * 4); + reg_mask |= (1 << index); + } + else if(z == 2 * sizeof(int)) + { + if(!((reg_mask >> 1) & 1)) + { + addr = reg_base + 4; + reg_mask |= (3 << 1); + } + else if(!((reg_mask >> 3) & 1)) + { + addr = reg_base + 12; + reg_mask |= (3 << 3); + } + } + } + + if(!addr) + { + addr = stack_base + stack_offset; + stack_offset += z; + } + + if(type == FFI_TYPE_STRUCT && (*p_arg)->elements[1] == NULL) + type = (*p_arg)->elements[0]->type; + + switch(type) + { + case FFI_TYPE_UINT8: + *(unsigned int *)addr = (unsigned int)*(UINT8 *)(*p_argv); + break; + case FFI_TYPE_SINT8: + *(signed int *)addr = (signed int)*(SINT8 *)(*p_argv); + break; + case FFI_TYPE_UINT16: + *(unsigned int *)addr = (unsigned int)*(UINT16 *)(*p_argv); + break; + case FFI_TYPE_SINT16: + *(signed int *)addr = (signed int)*(SINT16 *)(*p_argv); + break; + default: + memcpy(addr, *p_argv, z); + } + + p_argv++; + } + +#ifdef DEBUG + /* Debugging */ + for(i = 0; i < 5; i++) + { + if((reg_mask & (1 << i)) == 0) + printf("r%d: (unused)\n", 12 - i); + else + printf("r%d: 0x%08x\n", 12 - i, ((unsigned int*)reg_base)[i]); + } + + for(i = 0; i < stack_offset / 4; i++) + { + printf("sp+%d: 0x%08x\n", i*4, ((unsigned int*)stack_base)[i]); + } +#endif +} + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + /* Round the stack up to a multiple of 8 bytes. This isn't needed + * everywhere, but it is on some platforms, and it doesn't harm + * anything when it isn't needed. */ + cif->bytes = (cif->bytes + 7) & ~7; + + /* Flag to indicate that he return value is in fact a struct */ + cif->rstruct_flag = 0; + + /* Set the return type flag */ + switch(cif->rtype->type) + { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + cif->flags = (unsigned)FFI_TYPE_UINT8; + break; + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + cif->flags = (unsigned)FFI_TYPE_UINT16; + break; + case FFI_TYPE_FLOAT: + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + case FFI_TYPE_POINTER: + cif->flags = (unsigned)FFI_TYPE_UINT32; + break; + case FFI_TYPE_DOUBLE: + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + cif->flags = (unsigned)FFI_TYPE_UINT64; + break; + case FFI_TYPE_STRUCT: + cif->rstruct_flag = 1; + if(!pass_struct_on_stack(cif->rtype)) + { + if(cif->rtype->size <= 1) + cif->flags = (unsigned)FFI_TYPE_UINT8; + else if(cif->rtype->size <= 2) + cif->flags = (unsigned)FFI_TYPE_UINT16; + else if(cif->rtype->size <= 4) + cif->flags = (unsigned)FFI_TYPE_UINT32; + else if(cif->rtype->size <= 8) + cif->flags = (unsigned)FFI_TYPE_UINT64; + else + cif->flags = (unsigned)cif->rtype->type; + } + else + cif->flags = (unsigned)cif->rtype->type; + break; + default: + cif->flags = (unsigned)cif->rtype->type; + break; + } + + return FFI_OK; +} + +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + + unsigned int size = 0, i = 0; + ffi_type **p_arg; + + ecif.cif = cif; + ecif.avalue = avalue; + + for(i = 0, p_arg = cif->arg_types; i < cif->nargs; i++, p_arg++) + size += (*p_arg)->size + (4 - (*p_arg)->size % 4); + + /* If the return value is a struct and we don't have a return value + * address then we need to make one */ + + /* If cif->flags is struct then it's not suitable for registers */ + if((rvalue == NULL) && (cif->flags == FFI_TYPE_STRUCT)) + ecif.rvalue = alloca(cif->rtype->size); + else + ecif.rvalue = rvalue; + + switch(cif->abi) + { + case FFI_SYSV: + ffi_call_SYSV(ffi_prep_args, &ecif, size, cif->flags, + ecif.rvalue, cif->rstruct_flag, fn); + break; + default: + FFI_ASSERT(0); + break; + } +} + +static void ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, + void **avalue, ffi_cif *cif) +{ + register unsigned int i, reg_mask = 0; + register void **p_argv; + register ffi_type **p_arg; + register char *reg_base = stack; + register char *stack_base = stack + 20; + register unsigned int stack_offset = 0; + +#ifdef DEBUG + /* Debugging */ + for(i = 0; i < cif->nargs + 7; i++) + { + printf("sp+%d: 0x%08x\n", i*4, ((unsigned int*)stack)[i]); + } +#endif + + /* If cif->flags is struct then we know it's not passed in registers */ + if(cif->flags == FFI_TYPE_STRUCT) + { + *rvalue = *(void **)reg_base; + reg_mask |= 1; + } + + p_argv = avalue; + + for(i = 0, p_arg = cif->arg_types; i < cif->nargs; i++, p_arg++) + { + size_t z = (*p_arg)->size; + int alignment = (*p_arg)->alignment; + + *p_argv = 0; + + if(z % 4 != 0) + z += (4 - z % 4); + + if(reg_mask != 0x1f) + { + if(pass_struct_on_stack(*p_arg)) + { + *p_argv = (void*)stack_base + stack_offset; + stack_offset += z; + } + else if(z <= sizeof(int)) + { + char index = 0; + + while((reg_mask >> index) & 1) + index++; + + *p_argv = (void*)reg_base + (index * 4); + reg_mask |= (1 << index); + } + else if(z == 2 * sizeof(int)) + { + if(!((reg_mask >> 1) & 1)) + { + *p_argv = (void*)reg_base + 4; + reg_mask |= (3 << 1); + } + else if(!((reg_mask >> 3) & 1)) + { + *p_argv = (void*)reg_base + 12; + reg_mask |= (3 << 3); + } + } + } + + if(!*p_argv) + { + *p_argv = (void*)stack_base + stack_offset; + stack_offset += z; + } + + if((*p_arg)->type != FFI_TYPE_STRUCT || + (*p_arg)->elements[1] == NULL) + { + if(alignment == 1) + **(unsigned int**)p_argv <<= 24; + else if(alignment == 2) + **(unsigned int**)p_argv <<= 16; + } + + p_argv++; + } + +#ifdef DEBUG + /* Debugging */ + for(i = 0; i < cif->nargs; i++) + { + printf("sp+%d: 0x%08x\n", i*4, *(((unsigned int**)avalue)[i])); + } +#endif +} + +/* This function is jumped to by the trampoline */ + +unsigned int ffi_closure_SYSV_inner(ffi_closure *closure, void **respp, + void *args) +{ + ffi_cif *cif; + void **arg_area; + unsigned int i, size = 0; + ffi_type **p_arg; + + cif = closure->cif; + + for(i = 0, p_arg = cif->arg_types; i < cif->nargs; i++, p_arg++) + size += (*p_arg)->size + (4 - (*p_arg)->size % 4); + + arg_area = (void **)alloca(size); + + /* this call will initialize ARG_AREA, such that each element in that + * array points to the corresponding value on the stack; and if the + * function returns a structure, it will re-set RESP to point to the + * structure return address. */ + + ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); + + (closure->fun)(cif, *respp, arg_area, closure->user_data); + + return cif->flags; +} + +ffi_status ffi_prep_closure_loc(ffi_closure* closure, ffi_cif* cif, + void (*fun)(ffi_cif*, void*, void**, void*), void *user_data, + void *codeloc) +{ + if (cif->abi != FFI_SYSV) + return FFI_BAD_ABI; + + unsigned char *__tramp = (unsigned char*)(&closure->tramp[0]); + unsigned int __fun = (unsigned int)(&ffi_closure_SYSV); + unsigned int __ctx = (unsigned int)(codeloc); + unsigned int __rstruct_flag = (unsigned int)(cif->rstruct_flag); + unsigned int __inner = (unsigned int)(&ffi_closure_SYSV_inner); + *(unsigned int*) &__tramp[0] = 0xebcd1f00; /* pushm r8-r12 */ + *(unsigned int*) &__tramp[4] = 0xfefc0010; /* ld.w r12, pc[16] */ + *(unsigned int*) &__tramp[8] = 0xfefb0010; /* ld.w r11, pc[16] */ + *(unsigned int*) &__tramp[12] = 0xfefa0010; /* ld.w r10, pc[16] */ + *(unsigned int*) &__tramp[16] = 0xfeff0010; /* ld.w pc, pc[16] */ + *(unsigned int*) &__tramp[20] = __ctx; + *(unsigned int*) &__tramp[24] = __rstruct_flag; + *(unsigned int*) &__tramp[28] = __inner; + *(unsigned int*) &__tramp[32] = __fun; + syscall(__NR_cacheflush, 0, (&__tramp[0]), 36); + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/avr32/ffitarget.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/avr32/ffitarget.h new file mode 100644 index 000000000..b85d06225 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/avr32/ffitarget.h @@ -0,0 +1,50 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 2009 Bradley Smith + Target configuration macros for AVR32. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV +} ffi_abi; +#endif + +#define FFI_EXTRA_CIF_FIELDS unsigned int rstruct_flag + +/* Definitions for closures */ + +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 36 +#define FFI_NATIVE_RAW_API 0 + +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/avr32/sysv.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/avr32/sysv.S new file mode 100644 index 000000000..a984b3c88 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/avr32/sysv.S @@ -0,0 +1,208 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2009 Bradley Smith + + AVR32 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY + CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, + TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE + SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + --------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + + /* r12: ffi_prep_args + * r11: &ecif + * r10: size + * r9: cif->flags + * r8: ecif.rvalue + * sp+0: cif->rstruct_flag + * sp+4: fn */ + + .text + .align 1 + .globl ffi_call_SYSV + .type ffi_call_SYSV, @function +ffi_call_SYSV: + stm --sp, r0,r1,lr + stm --sp, r8-r12 + mov r0, sp + + /* Make room for all of the new args. */ + sub sp, r10 + /* Pad to make way for potential skipped registers */ + sub sp, 20 + + /* Call ffi_prep_args(stack, &ecif). */ + /* r11 already set */ + mov r1, r12 + mov r12, sp + icall r1 + + /* Save new argument size */ + mov r1, r12 + + /* Move first 5 parameters in registers. */ + ldm sp++, r8-r12 + + /* call (fn) (...). */ + ld.w r1, r0[36] + icall r1 + + /* Remove the space we pushed for the args. */ + mov sp, r0 + + /* Load r1 with the rstruct flag. */ + ld.w r1, sp[32] + + /* Load r9 with the return type code. */ + ld.w r9, sp[12] + + /* Load r8 with the return value pointer. */ + ld.w r8, sp[16] + + /* If the return value pointer is NULL, assume no return value. */ + cp.w r8, 0 + breq .Lend + + /* Check if return type is actually a struct */ + cp.w r1, 0 + breq 1f + + /* Return 8bit */ + cp.w r9, FFI_TYPE_UINT8 + breq .Lstore8 + + /* Return 16bit */ + cp.w r9, FFI_TYPE_UINT16 + breq .Lstore16 + +1: + /* Return 32bit */ + cp.w r9, FFI_TYPE_UINT32 + breq .Lstore32 + cp.w r9, FFI_TYPE_UINT16 + breq .Lstore32 + cp.w r9, FFI_TYPE_UINT8 + breq .Lstore32 + + /* Return 64bit */ + cp.w r9, FFI_TYPE_UINT64 + breq .Lstore64 + + /* Didn't match anything */ + bral .Lend + +.Lstore64: + st.w r8[0], r11 + st.w r8[4], r10 + bral .Lend + +.Lstore32: + st.w r8[0], r12 + bral .Lend + +.Lstore16: + st.h r8[0], r12 + bral .Lend + +.Lstore8: + st.b r8[0], r12 + bral .Lend + +.Lend: + sub sp, -20 + ldm sp++, r0,r1,pc + + .size ffi_call_SYSV, . - ffi_call_SYSV + + + /* r12: __ctx + * r11: __rstruct_flag + * r10: __inner */ + + .align 1 + .globl ffi_closure_SYSV + .type ffi_closure_SYSV, @function +ffi_closure_SYSV: + stm --sp, r0,lr + mov r0, r11 + mov r8, r10 + sub r10, sp, -8 + sub sp, 12 + st.w sp[8], sp + sub r11, sp, -8 + icall r8 + + /* Check if return type is actually a struct */ + cp.w r0, 0 + breq 1f + + /* Return 8bit */ + cp.w r12, FFI_TYPE_UINT8 + breq .Lget8 + + /* Return 16bit */ + cp.w r12, FFI_TYPE_UINT16 + breq .Lget16 + +1: + /* Return 32bit */ + cp.w r12, FFI_TYPE_UINT32 + breq .Lget32 + cp.w r12, FFI_TYPE_UINT16 + breq .Lget32 + cp.w r12, FFI_TYPE_UINT8 + breq .Lget32 + + /* Return 64bit */ + cp.w r12, FFI_TYPE_UINT64 + breq .Lget64 + + /* Didn't match anything */ + bral .Lclend + +.Lget64: + ld.w r11, sp[0] + ld.w r10, sp[4] + bral .Lclend + +.Lget32: + ld.w r12, sp[0] + bral .Lclend + +.Lget16: + ld.uh r12, sp[0] + bral .Lclend + +.Lget8: + ld.ub r12, sp[0] + bral .Lclend + +.Lclend: + sub sp, -12 + ldm sp++, r0,lr + sub sp, -20 + mov pc, lr + + .size ffi_closure_SYSV, . - ffi_closure_SYSV + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/closures.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/closures.c new file mode 100644 index 000000000..1b3782703 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/closures.c @@ -0,0 +1,615 @@ +/* ----------------------------------------------------------------------- + closures.c - Copyright (c) 2007, 2009, 2010 Red Hat, Inc. + Copyright (C) 2007, 2009, 2010 Free Software Foundation, Inc + Copyright (c) 2011 Plausible Labs Cooperative, Inc. + + Code to allocate and deallocate memory for closures. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#if defined __linux__ && !defined _GNU_SOURCE +#define _GNU_SOURCE 1 +#endif + +#include +#include + +#if !FFI_MMAP_EXEC_WRIT && !FFI_EXEC_TRAMPOLINE_TABLE +# if __gnu_linux__ +/* This macro indicates it may be forbidden to map anonymous memory + with both write and execute permission. Code compiled when this + option is defined will attempt to map such pages once, but if it + fails, it falls back to creating a temporary file in a writable and + executable filesystem and mapping pages from it into separate + locations in the virtual memory space, one location writable and + another executable. */ +# define FFI_MMAP_EXEC_WRIT 1 +# define HAVE_MNTENT 1 +# endif +# if defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__) +/* Windows systems may have Data Execution Protection (DEP) enabled, + which requires the use of VirtualMalloc/VirtualFree to alloc/free + executable memory. */ +# define FFI_MMAP_EXEC_WRIT 1 +# endif +#endif + +#if FFI_MMAP_EXEC_WRIT && !defined FFI_MMAP_EXEC_SELINUX +# ifdef __linux__ +/* When defined to 1 check for SELinux and if SELinux is active, + don't attempt PROT_EXEC|PROT_WRITE mapping at all, as that + might cause audit messages. */ +# define FFI_MMAP_EXEC_SELINUX 1 +# endif +#endif + +#if FFI_CLOSURES + +# if FFI_EXEC_TRAMPOLINE_TABLE + +// Per-target implementation; It's unclear what can reasonable be shared between two OS/architecture implementations. + +# elif FFI_MMAP_EXEC_WRIT /* !FFI_EXEC_TRAMPOLINE_TABLE */ + +#define USE_LOCKS 1 +#define USE_DL_PREFIX 1 +#ifdef __GNUC__ +#ifndef USE_BUILTIN_FFS +#define USE_BUILTIN_FFS 1 +#endif +#endif + +/* We need to use mmap, not sbrk. */ +#define HAVE_MORECORE 0 + +/* We could, in theory, support mremap, but it wouldn't buy us anything. */ +#define HAVE_MREMAP 0 + +/* We have no use for this, so save some code and data. */ +#define NO_MALLINFO 1 + +/* We need all allocations to be in regular segments, otherwise we + lose track of the corresponding code address. */ +#define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T + +/* Don't allocate more than a page unless needed. */ +#define DEFAULT_GRANULARITY ((size_t)malloc_getpagesize) + +#if FFI_CLOSURE_TEST +/* Don't release single pages, to avoid a worst-case scenario of + continuously allocating and releasing single pages, but release + pairs of pages, which should do just as well given that allocations + are likely to be small. */ +#define DEFAULT_TRIM_THRESHOLD ((size_t)malloc_getpagesize) +#endif + +#include +#include +#include +#include +#ifndef _MSC_VER +#include +#endif +#include +#include +#if !defined(X86_WIN32) && !defined(X86_WIN64) +#ifdef HAVE_MNTENT +#include +#endif /* HAVE_MNTENT */ +#include +#include + +/* We don't want sys/mman.h to be included after we redefine mmap and + dlmunmap. */ +#include +#define LACKS_SYS_MMAN_H 1 + +#if FFI_MMAP_EXEC_SELINUX +#include +#include + +static int selinux_enabled = -1; + +static int +selinux_enabled_check (void) +{ + struct statfs sfs; + FILE *f; + char *buf = NULL; + size_t len = 0; + + if (statfs ("/selinux", &sfs) >= 0 + && (unsigned int) sfs.f_type == 0xf97cff8cU) + return 1; + f = fopen ("/proc/mounts", "r"); + if (f == NULL) + return 0; + while (getline (&buf, &len, f) >= 0) + { + char *p = strchr (buf, ' '); + if (p == NULL) + break; + p = strchr (p + 1, ' '); + if (p == NULL) + break; + if (strncmp (p + 1, "selinuxfs ", 10) == 0) + { + free (buf); + fclose (f); + return 1; + } + } + free (buf); + fclose (f); + return 0; +} + +#define is_selinux_enabled() (selinux_enabled >= 0 ? selinux_enabled \ + : (selinux_enabled = selinux_enabled_check ())) + +#else + +#define is_selinux_enabled() 0 + +#endif /* !FFI_MMAP_EXEC_SELINUX */ + +#elif defined (__CYGWIN__) || defined(__INTERIX) + +#include + +/* Cygwin is Linux-like, but not quite that Linux-like. */ +#define is_selinux_enabled() 0 + +#endif /* !defined(X86_WIN32) && !defined(X86_WIN64) */ + +/* Declare all functions defined in dlmalloc.c as static. */ +static void *dlmalloc(size_t); +static void dlfree(void*); +static void *dlcalloc(size_t, size_t) MAYBE_UNUSED; +static void *dlrealloc(void *, size_t) MAYBE_UNUSED; +static void *dlmemalign(size_t, size_t) MAYBE_UNUSED; +static void *dlvalloc(size_t) MAYBE_UNUSED; +static int dlmallopt(int, int) MAYBE_UNUSED; +static size_t dlmalloc_footprint(void) MAYBE_UNUSED; +static size_t dlmalloc_max_footprint(void) MAYBE_UNUSED; +static void** dlindependent_calloc(size_t, size_t, void**) MAYBE_UNUSED; +static void** dlindependent_comalloc(size_t, size_t*, void**) MAYBE_UNUSED; +static void *dlpvalloc(size_t) MAYBE_UNUSED; +static int dlmalloc_trim(size_t) MAYBE_UNUSED; +static size_t dlmalloc_usable_size(void*) MAYBE_UNUSED; +static void dlmalloc_stats(void) MAYBE_UNUSED; + +#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) +/* Use these for mmap and munmap within dlmalloc.c. */ +static void *dlmmap(void *, size_t, int, int, int, off_t); +static int dlmunmap(void *, size_t); +#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */ + +#define mmap dlmmap +#define munmap dlmunmap + +#include "dlmalloc.c" + +#undef mmap +#undef munmap + +#if !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) + +/* A mutex used to synchronize access to *exec* variables in this file. */ +static pthread_mutex_t open_temp_exec_file_mutex = PTHREAD_MUTEX_INITIALIZER; + +/* A file descriptor of a temporary file from which we'll map + executable pages. */ +static int execfd = -1; + +/* The amount of space already allocated from the temporary file. */ +static size_t execsize = 0; + +/* Open a temporary file name, and immediately unlink it. */ +static int +open_temp_exec_file_name (char *name) +{ + int fd = mkstemp (name); + + if (fd != -1) + unlink (name); + + return fd; +} + +/* Open a temporary file in the named directory. */ +static int +open_temp_exec_file_dir (const char *dir) +{ + static const char suffix[] = "/ffiXXXXXX"; + int lendir = strlen (dir); + char *tempname = __builtin_alloca (lendir + sizeof (suffix)); + + if (!tempname) + return -1; + + memcpy (tempname, dir, lendir); + memcpy (tempname + lendir, suffix, sizeof (suffix)); + + return open_temp_exec_file_name (tempname); +} + +/* Open a temporary file in the directory in the named environment + variable. */ +static int +open_temp_exec_file_env (const char *envvar) +{ + const char *value = getenv (envvar); + + if (!value) + return -1; + + return open_temp_exec_file_dir (value); +} + +#ifdef HAVE_MNTENT +/* Open a temporary file in an executable and writable mount point + listed in the mounts file. Subsequent calls with the same mounts + keep searching for mount points in the same file. Providing NULL + as the mounts file closes the file. */ +static int +open_temp_exec_file_mnt (const char *mounts) +{ + static const char *last_mounts; + static FILE *last_mntent; + + if (mounts != last_mounts) + { + if (last_mntent) + endmntent (last_mntent); + + last_mounts = mounts; + + if (mounts) + last_mntent = setmntent (mounts, "r"); + else + last_mntent = NULL; + } + + if (!last_mntent) + return -1; + + for (;;) + { + int fd; + struct mntent mnt; + char buf[MAXPATHLEN * 3]; + + if (getmntent_r (last_mntent, &mnt, buf, sizeof (buf)) == NULL) + return -1; + + if (hasmntopt (&mnt, "ro") + || hasmntopt (&mnt, "noexec") + || access (mnt.mnt_dir, W_OK)) + continue; + + fd = open_temp_exec_file_dir (mnt.mnt_dir); + + if (fd != -1) + return fd; + } +} +#endif /* HAVE_MNTENT */ + +/* Instructions to look for a location to hold a temporary file that + can be mapped in for execution. */ +static struct +{ + int (*func)(const char *); + const char *arg; + int repeat; +} open_temp_exec_file_opts[] = { + { open_temp_exec_file_env, "TMPDIR", 0 }, + { open_temp_exec_file_dir, "/tmp", 0 }, + { open_temp_exec_file_dir, "/var/tmp", 0 }, + { open_temp_exec_file_dir, "/dev/shm", 0 }, + { open_temp_exec_file_env, "HOME", 0 }, +#ifdef HAVE_MNTENT + { open_temp_exec_file_mnt, "/etc/mtab", 1 }, + { open_temp_exec_file_mnt, "/proc/mounts", 1 }, +#endif /* HAVE_MNTENT */ +}; + +/* Current index into open_temp_exec_file_opts. */ +static int open_temp_exec_file_opts_idx = 0; + +/* Reset a current multi-call func, then advances to the next entry. + If we're at the last, go back to the first and return nonzero, + otherwise return zero. */ +static int +open_temp_exec_file_opts_next (void) +{ + if (open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat) + open_temp_exec_file_opts[open_temp_exec_file_opts_idx].func (NULL); + + open_temp_exec_file_opts_idx++; + if (open_temp_exec_file_opts_idx + == (sizeof (open_temp_exec_file_opts) + / sizeof (*open_temp_exec_file_opts))) + { + open_temp_exec_file_opts_idx = 0; + return 1; + } + + return 0; +} + +/* Return a file descriptor of a temporary zero-sized file in a + writable and exexutable filesystem. */ +static int +open_temp_exec_file (void) +{ + int fd; + + do + { + fd = open_temp_exec_file_opts[open_temp_exec_file_opts_idx].func + (open_temp_exec_file_opts[open_temp_exec_file_opts_idx].arg); + + if (!open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat + || fd == -1) + { + if (open_temp_exec_file_opts_next ()) + break; + } + } + while (fd == -1); + + return fd; +} + +/* Map in a chunk of memory from the temporary exec file into separate + locations in the virtual memory address space, one writable and one + executable. Returns the address of the writable portion, after + storing an offset to the corresponding executable portion at the + last word of the requested chunk. */ +static void * +dlmmap_locked (void *start, size_t length, int prot, int flags, off_t offset) +{ + void *ptr; + + if (execfd == -1) + { + open_temp_exec_file_opts_idx = 0; + retry_open: + execfd = open_temp_exec_file (); + if (execfd == -1) + return MFAIL; + } + + offset = execsize; + + if (ftruncate (execfd, offset + length)) + return MFAIL; + + flags &= ~(MAP_PRIVATE | MAP_ANONYMOUS); + flags |= MAP_SHARED; + + ptr = mmap (NULL, length, (prot & ~PROT_WRITE) | PROT_EXEC, + flags, execfd, offset); + if (ptr == MFAIL) + { + if (!offset) + { + close (execfd); + goto retry_open; + } + ftruncate (execfd, offset); + return MFAIL; + } + else if (!offset + && open_temp_exec_file_opts[open_temp_exec_file_opts_idx].repeat) + open_temp_exec_file_opts_next (); + + start = mmap (start, length, prot, flags, execfd, offset); + + if (start == MFAIL) + { + munmap (ptr, length); + ftruncate (execfd, offset); + return start; + } + + mmap_exec_offset ((char *)start, length) = (char*)ptr - (char*)start; + + execsize += length; + + return start; +} + +/* Map in a writable and executable chunk of memory if possible. + Failing that, fall back to dlmmap_locked. */ +static void * +dlmmap (void *start, size_t length, int prot, + int flags, int fd, off_t offset) +{ + void *ptr; + + assert (start == NULL && length % malloc_getpagesize == 0 + && prot == (PROT_READ | PROT_WRITE) + && flags == (MAP_PRIVATE | MAP_ANONYMOUS) + && fd == -1 && offset == 0); + +#if FFI_CLOSURE_TEST + printf ("mapping in %zi\n", length); +#endif + + if (execfd == -1 && !is_selinux_enabled ()) + { + ptr = mmap (start, length, prot | PROT_EXEC, flags, fd, offset); + + if (ptr != MFAIL || (errno != EPERM && errno != EACCES)) + /* Cool, no need to mess with separate segments. */ + return ptr; + + /* If MREMAP_DUP is ever introduced and implemented, try mmap + with ((prot & ~PROT_WRITE) | PROT_EXEC) and mremap with + MREMAP_DUP and prot at this point. */ + } + + if (execsize == 0 || execfd == -1) + { + pthread_mutex_lock (&open_temp_exec_file_mutex); + ptr = dlmmap_locked (start, length, prot, flags, offset); + pthread_mutex_unlock (&open_temp_exec_file_mutex); + + return ptr; + } + + return dlmmap_locked (start, length, prot, flags, offset); +} + +/* Release memory at the given address, as well as the corresponding + executable page if it's separate. */ +static int +dlmunmap (void *start, size_t length) +{ + /* We don't bother decreasing execsize or truncating the file, since + we can't quite tell whether we're unmapping the end of the file. + We don't expect frequent deallocation anyway. If we did, we + could locate pages in the file by writing to the pages being + deallocated and checking that the file contents change. + Yuck. */ + msegmentptr seg = segment_holding (gm, start); + void *code; + +#if FFI_CLOSURE_TEST + printf ("unmapping %zi\n", length); +#endif + + if (seg && (code = add_segment_exec_offset (start, seg)) != start) + { + int ret = munmap (code, length); + if (ret) + return ret; + } + + return munmap (start, length); +} + +#if FFI_CLOSURE_FREE_CODE +/* Return segment holding given code address. */ +static msegmentptr +segment_holding_code (mstate m, char* addr) +{ + msegmentptr sp = &m->seg; + for (;;) { + if (addr >= add_segment_exec_offset (sp->base, sp) + && addr < add_segment_exec_offset (sp->base, sp) + sp->size) + return sp; + if ((sp = sp->next) == 0) + return 0; + } +} +#endif + +#endif /* !(defined(X86_WIN32) || defined(X86_WIN64) || defined(__OS2__)) || defined (__CYGWIN__) || defined(__INTERIX) */ + +/* Allocate a chunk of memory with the given size. Returns a pointer + to the writable address, and sets *CODE to the executable + corresponding virtual address. */ +void * +ffi_closure_alloc (size_t size, void **code) +{ + void *ptr; + + if (!code) + return NULL; + + ptr = dlmalloc (size); + + if (ptr) + { + msegmentptr seg = segment_holding (gm, ptr); + + *code = add_segment_exec_offset (ptr, seg); + } + + return ptr; +} + +/* Release a chunk of memory allocated with ffi_closure_alloc. If + FFI_CLOSURE_FREE_CODE is nonzero, the given address can be the + writable or the executable address given. Otherwise, only the + writable address can be provided here. */ +void +ffi_closure_free (void *ptr) +{ +#if FFI_CLOSURE_FREE_CODE + msegmentptr seg = segment_holding_code (gm, ptr); + + if (seg) + ptr = sub_segment_exec_offset (ptr, seg); +#endif + + dlfree (ptr); +} + + +#if FFI_CLOSURE_TEST +/* Do some internal sanity testing to make sure allocation and + deallocation of pages are working as intended. */ +int main () +{ + void *p[3]; +#define GET(idx, len) do { p[idx] = dlmalloc (len); printf ("allocated %zi for p[%i]\n", (len), (idx)); } while (0) +#define PUT(idx) do { printf ("freeing p[%i]\n", (idx)); dlfree (p[idx]); } while (0) + GET (0, malloc_getpagesize / 2); + GET (1, 2 * malloc_getpagesize - 64 * sizeof (void*)); + PUT (1); + GET (1, 2 * malloc_getpagesize); + GET (2, malloc_getpagesize / 2); + PUT (1); + PUT (0); + PUT (2); + return 0; +} +#endif /* FFI_CLOSURE_TEST */ +# else /* ! FFI_MMAP_EXEC_WRIT */ + +/* On many systems, memory returned by malloc is writable and + executable, so just use it. */ + +#include + +void * +ffi_closure_alloc (size_t size, void **code) +{ + if (!code) + return NULL; + + return *code = malloc (size); +} + +void +ffi_closure_free (void *ptr) +{ + free (ptr); +} + +# endif /* ! FFI_MMAP_EXEC_WRIT */ +#endif /* FFI_CLOSURES */ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/cris/ffi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/cris/ffi.c new file mode 100644 index 000000000..f25d7b4c0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/cris/ffi.c @@ -0,0 +1,383 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 1998 Cygnus Solutions + Copyright (c) 2004 Simon Posnjak + Copyright (c) 2005 Axis Communications AB + Copyright (C) 2007 Free Software Foundation, Inc. + + CRIS Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL SIMON POSNJAK BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +#define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG) + +static ffi_status +initialize_aggregate_packed_struct (ffi_type * arg) +{ + ffi_type **ptr; + + FFI_ASSERT (arg != NULL); + + FFI_ASSERT (arg->elements != NULL); + FFI_ASSERT (arg->size == 0); + FFI_ASSERT (arg->alignment == 0); + + ptr = &(arg->elements[0]); + + while ((*ptr) != NULL) + { + if (((*ptr)->size == 0) + && (initialize_aggregate_packed_struct ((*ptr)) != FFI_OK)) + return FFI_BAD_TYPEDEF; + + FFI_ASSERT (ffi_type_test ((*ptr))); + + arg->size += (*ptr)->size; + + arg->alignment = (arg->alignment > (*ptr)->alignment) ? + arg->alignment : (*ptr)->alignment; + + ptr++; + } + + if (arg->size == 0) + return FFI_BAD_TYPEDEF; + else + return FFI_OK; +} + +int +ffi_prep_args (char *stack, extended_cif * ecif) +{ + unsigned int i; + unsigned int struct_count = 0; + void **p_argv; + char *argp; + ffi_type **p_arg; + + argp = stack; + + p_argv = ecif->avalue; + + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; + (i != 0); i--, p_arg++) + { + size_t z; + + switch ((*p_arg)->type) + { + case FFI_TYPE_STRUCT: + { + z = (*p_arg)->size; + if (z <= 4) + { + memcpy (argp, *p_argv, z); + z = 4; + } + else if (z <= 8) + { + memcpy (argp, *p_argv, z); + z = 8; + } + else + { + unsigned int uiLocOnStack; + z = sizeof (void *); + uiLocOnStack = 4 * ecif->cif->nargs + struct_count; + struct_count = struct_count + (*p_arg)->size; + *(unsigned int *) argp = + (unsigned int) (UINT32 *) (stack + uiLocOnStack); + memcpy ((stack + uiLocOnStack), *p_argv, (*p_arg)->size); + } + break; + } + default: + z = (*p_arg)->size; + if (z < sizeof (int)) + { + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(signed int *) argp = (signed int) *(SINT8 *) (*p_argv); + break; + + case FFI_TYPE_UINT8: + *(unsigned int *) argp = + (unsigned int) *(UINT8 *) (*p_argv); + break; + + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int) *(SINT16 *) (*p_argv); + break; + + case FFI_TYPE_UINT16: + *(unsigned int *) argp = + (unsigned int) *(UINT16 *) (*p_argv); + break; + + default: + FFI_ASSERT (0); + } + z = sizeof (int); + } + else if (z == sizeof (int)) + *(unsigned int *) argp = (unsigned int) *(UINT32 *) (*p_argv); + else + memcpy (argp, *p_argv, z); + break; + } + p_argv++; + argp += z; + } + + return (struct_count); +} + +ffi_status +ffi_prep_cif (ffi_cif * cif, + ffi_abi abi, unsigned int nargs, + ffi_type * rtype, ffi_type ** atypes) +{ + unsigned bytes = 0; + unsigned int i; + ffi_type **ptr; + + FFI_ASSERT (cif != NULL); + FFI_ASSERT (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI); + + cif->abi = abi; + cif->arg_types = atypes; + cif->nargs = nargs; + cif->rtype = rtype; + + cif->flags = 0; + + if ((cif->rtype->size == 0) + && (initialize_aggregate_packed_struct (cif->rtype) != FFI_OK)) + return FFI_BAD_TYPEDEF; + + FFI_ASSERT_VALID_TYPE (cif->rtype); + + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) + { + if (((*ptr)->size == 0) + && (initialize_aggregate_packed_struct ((*ptr)) != FFI_OK)) + return FFI_BAD_TYPEDEF; + + FFI_ASSERT_VALID_TYPE (*ptr); + + if (((*ptr)->alignment - 1) & bytes) + bytes = ALIGN (bytes, (*ptr)->alignment); + if ((*ptr)->type == FFI_TYPE_STRUCT) + { + if ((*ptr)->size > 8) + { + bytes += (*ptr)->size; + bytes += sizeof (void *); + } + else + { + if ((*ptr)->size > 4) + bytes += 8; + else + bytes += 4; + } + } + else + bytes += STACK_ARG_SIZE ((*ptr)->size); + } + + cif->bytes = bytes; + + return ffi_prep_cif_machdep (cif); +} + +ffi_status +ffi_prep_cif_machdep (ffi_cif * cif) +{ + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + case FFI_TYPE_STRUCT: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + cif->flags = (unsigned) cif->rtype->type; + break; + + default: + cif->flags = FFI_TYPE_INT; + break; + } + + return FFI_OK; +} + +extern void ffi_call_SYSV (int (*)(char *, extended_cif *), + extended_cif *, + unsigned, unsigned, unsigned *, void (*fn) ()) + __attribute__ ((__visibility__ ("hidden"))); + +void +ffi_call (ffi_cif * cif, void (*fn) (), void *rvalue, void **avalue) +{ + extended_cif ecif; + + ecif.cif = cif; + ecif.avalue = avalue; + + if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) + { + ecif.rvalue = alloca (cif->rtype->size); + } + else + ecif.rvalue = rvalue; + + switch (cif->abi) + { + case FFI_SYSV: + ffi_call_SYSV (ffi_prep_args, &ecif, cif->bytes, + cif->flags, ecif.rvalue, fn); + break; + default: + FFI_ASSERT (0); + break; + } +} + +/* Because the following variables are not exported outside libffi, we + mark them hidden. */ + +/* Assembly code for the jump stub. */ +extern const char ffi_cris_trampoline_template[] + __attribute__ ((__visibility__ ("hidden"))); + +/* Offset into ffi_cris_trampoline_template of where to put the + ffi_prep_closure_inner function. */ +extern const int ffi_cris_trampoline_fn_offset + __attribute__ ((__visibility__ ("hidden"))); + +/* Offset into ffi_cris_trampoline_template of where to put the + closure data. */ +extern const int ffi_cris_trampoline_closure_offset + __attribute__ ((__visibility__ ("hidden"))); + +/* This function is sibling-called (jumped to) by the closure + trampoline. We get R10..R13 at PARAMS[0..3] and a copy of [SP] at + PARAMS[4] to simplify handling of a straddling parameter. A copy + of R9 is at PARAMS[5] and SP at PARAMS[6]. These parameters are + put at the appropriate place in CLOSURE which is then executed and + the return value is passed back to the caller. */ + +static unsigned long long +ffi_prep_closure_inner (void **params, ffi_closure* closure) +{ + char *register_args = (char *) params; + void *struct_ret = params[5]; + char *stack_args = params[6]; + char *ptr = register_args; + ffi_cif *cif = closure->cif; + ffi_type **arg_types = cif->arg_types; + + /* Max room needed is number of arguments as 64-bit values. */ + void **avalue = alloca (closure->cif->nargs * sizeof(void *)); + int i; + int doing_regs; + long long llret = 0; + + /* Find the address of each argument. */ + for (i = 0, doing_regs = 1; i < cif->nargs; i++) + { + /* Types up to and including 8 bytes go by-value. */ + if (arg_types[i]->size <= 4) + { + avalue[i] = ptr; + ptr += 4; + } + else if (arg_types[i]->size <= 8) + { + avalue[i] = ptr; + ptr += 8; + } + else + { + FFI_ASSERT (arg_types[i]->type == FFI_TYPE_STRUCT); + + /* Passed by-reference, so copy the pointer. */ + avalue[i] = *(void **) ptr; + ptr += 4; + } + + /* If we've handled more arguments than fit in registers, start + looking at the those passed on the stack. Step over the + first one if we had a straddling parameter. */ + if (doing_regs && ptr >= register_args + 4*4) + { + ptr = stack_args + ((ptr > register_args + 4*4) ? 4 : 0); + doing_regs = 0; + } + } + + /* Invoke the closure. */ + (closure->fun) (cif, + + cif->rtype->type == FFI_TYPE_STRUCT + /* The caller allocated space for the return + structure, and passed a pointer to this space in + R9. */ + ? struct_ret + + /* We take advantage of being able to ignore that + the high part isn't set if the return value is + not in R10:R11, but in R10 only. */ + : (void *) &llret, + + avalue, closure->user_data); + + return llret; +} + +/* API function: Prepare the trampoline. */ + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif *, void *, void **, void*), + void *user_data, + void *codeloc) +{ + void *innerfn = ffi_prep_closure_inner; + FFI_ASSERT (cif->abi == FFI_SYSV); + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + memcpy (closure->tramp, ffi_cris_trampoline_template, + FFI_CRIS_TRAMPOLINE_CODE_PART_SIZE); + memcpy (closure->tramp + ffi_cris_trampoline_fn_offset, + &innerfn, sizeof (void *)); + memcpy (closure->tramp + ffi_cris_trampoline_closure_offset, + &codeloc, sizeof (void *)); + + return FFI_OK; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/cris/ffitarget.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/cris/ffitarget.h new file mode 100644 index 000000000..0e3705df3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/cris/ffitarget.h @@ -0,0 +1,51 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + Target configuration macros for CRIS. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_CRIS_TRAMPOLINE_CODE_PART_SIZE 36 +#define FFI_CRIS_TRAMPOLINE_DATA_PART_SIZE (7*4) +#define FFI_TRAMPOLINE_SIZE \ + (FFI_CRIS_TRAMPOLINE_CODE_PART_SIZE + FFI_CRIS_TRAMPOLINE_DATA_PART_SIZE) +#define FFI_NATIVE_RAW_API 0 + +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/cris/sysv.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/cris/sysv.S new file mode 100644 index 000000000..79abaee4d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/cris/sysv.S @@ -0,0 +1,215 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2004 Simon Posnjak + Copyright (c) 2005 Axis Communications AB + + CRIS Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL SIMON POSNJAK BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#define CONCAT(x,y) x ## y +#define XCONCAT(x,y) CONCAT (x, y) +#define L(x) XCONCAT (__USER_LABEL_PREFIX__, x) + + .text + + ;; OK, when we get called we should have this (according to + ;; AXIS ETRAX 100LX Programmer's Manual chapter 6.3). + ;; + ;; R10: ffi_prep_args (func. pointer) + ;; R11: &ecif + ;; R12: cif->bytes + ;; R13: fig->flags + ;; sp+0: ecif.rvalue + ;; sp+4: fn (function pointer to the function that we need to call) + + .globl L(ffi_call_SYSV) + .type L(ffi_call_SYSV),@function + .hidden L(ffi_call_SYSV) + +L(ffi_call_SYSV): + ;; Save the regs to the stack. + push $srp + ;; Used for stack pointer saving. + push $r6 + ;; Used for function address pointer. + push $r7 + ;; Used for stack pointer saving. + push $r8 + ;; We save fig->flags to stack we will need them after we + ;; call The Function. + push $r13 + + ;; Saving current stack pointer. + move.d $sp,$r8 + move.d $sp,$r6 + + ;; Move address of ffi_prep_args to r13. + move.d $r10,$r13 + + ;; Make room on the stack for the args of fn. + sub.d $r12,$sp + + ;; Function void ffi_prep_args(char *stack, extended_cif *ecif) parameters are: + ;; r10 <-- stack pointer + ;; r11 <-- &ecif (already there) + move.d $sp,$r10 + + ;; Call the function. + jsr $r13 + + ;; Save the size of the structures which are passed on stack. + move.d $r10,$r7 + + ;; Move first four args in to r10..r13. + move.d [$sp+0],$r10 + move.d [$sp+4],$r11 + move.d [$sp+8],$r12 + move.d [$sp+12],$r13 + + ;; Adjust the stack and check if any parameters are given on stack. + addq 16,$sp + sub.d $r7,$r6 + cmp.d $sp,$r6 + + bpl go_on + nop + +go_on_no_params_on_stack: + move.d $r6,$sp + +go_on: + ;; Discover if we need to put rval address in to r9. + move.d [$r8+0],$r7 + cmpq FFI_TYPE_STRUCT,$r7 + bne call_now + nop + + ;; Move rval address to $r9. + move.d [$r8+20],$r9 + +call_now: + ;; Move address of The Function in to r7. + move.d [$r8+24],$r7 + + ;; Call The Function. + jsr $r7 + + ;; Reset stack. + move.d $r8,$sp + + ;; Load rval type (fig->flags) in to r13. + pop $r13 + + ;; Detect rval type. + cmpq FFI_TYPE_VOID,$r13 + beq epilogue + + cmpq FFI_TYPE_STRUCT,$r13 + beq epilogue + + cmpq FFI_TYPE_DOUBLE,$r13 + beq return_double_or_longlong + + cmpq FFI_TYPE_UINT64,$r13 + beq return_double_or_longlong + + cmpq FFI_TYPE_SINT64,$r13 + beq return_double_or_longlong + nop + + ;; Just return the 32 bit value. + ba return + nop + +return_double_or_longlong: + ;; Load half of the rval to r10 and the other half to r11. + move.d [$sp+16],$r13 + move.d $r10,[$r13] + addq 4,$r13 + move.d $r11,[$r13] + ba epilogue + nop + +return: + ;; Load the rval to r10. + move.d [$sp+16],$r13 + move.d $r10,[$r13] + +epilogue: + pop $r8 + pop $r7 + pop $r6 + Jump [$sp+] + + .size ffi_call_SYSV,.-ffi_call_SYSV + +/* Save R10..R13 into an array, somewhat like varargs. Copy the next + argument too, to simplify handling of any straddling parameter. + Save R9 and SP after those. Jump to function handling the rest. + Since this is a template, copied and the main function filled in by + the user. */ + + .globl L(ffi_cris_trampoline_template) + .type L(ffi_cris_trampoline_template),@function + .hidden L(ffi_cris_trampoline_template) + +L(ffi_cris_trampoline_template): +0: + /* The value we get for "PC" is right after the prefix instruction, + two bytes from the beginning, i.e. 0b+2. */ + move.d $r10,[$pc+2f-(0b+2)] + move.d $pc,$r10 +1: + addq 2f-1b+4,$r10 + move.d $r11,[$r10+] + move.d $r12,[$r10+] + move.d $r13,[$r10+] + move.d [$sp],$r11 + move.d $r11,[$r10+] + move.d $r9,[$r10+] + move.d $sp,[$r10+] + subq FFI_CRIS_TRAMPOLINE_DATA_PART_SIZE,$r10 + move.d 0,$r11 +3: + jump 0 +2: + .size ffi_cris_trampoline_template,.-0b + +/* This macro create a constant usable as "extern const int \name" in + C from within libffi, when \name has no prefix decoration. */ + + .macro const name,value + .globl \name + .type \name,@object + .hidden \name +\name: + .dword \value + .size \name,4 + .endm + +/* Constants for offsets within the trampoline. We could do this with + just symbols, avoiding memory contents and memory accesses, but the + C usage code would look a bit stranger. */ + + const L(ffi_cris_trampoline_fn_offset),2b-4-0b + const L(ffi_cris_trampoline_closure_offset),3b-4-0b diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/debug.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/debug.c new file mode 100644 index 000000000..51dcfcf22 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/debug.c @@ -0,0 +1,59 @@ +/* ----------------------------------------------------------------------- + debug.c - Copyright (c) 1996 Red Hat, Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include +#include +#include + +/* General debugging routines */ + +void ffi_stop_here(void) +{ + /* This function is only useful for debugging purposes. + Place a breakpoint on ffi_stop_here to be notified of + significant events. */ +} + +/* This function should only be called via the FFI_ASSERT() macro */ + +void ffi_assert(char *expr, char *file, int line) +{ + fprintf(stderr, "ASSERTION FAILURE: %s at %s:%d\n", expr, file, line); + ffi_stop_here(); + abort(); +} + +/* Perform a sanity check on an ffi_type structure */ + +void ffi_type_test(ffi_type *a, char *file, int line) +{ + FFI_ASSERT_AT(a != NULL, file, line); + + FFI_ASSERT_AT(a->type <= FFI_TYPE_LAST, file, line); + FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->size > 0, file, line); + FFI_ASSERT_AT(a->type == FFI_TYPE_VOID || a->alignment > 0, file, line); + FFI_ASSERT_AT(a->type != FFI_TYPE_STRUCT || a->elements != NULL, file, line); + +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/dlmalloc.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/dlmalloc.c new file mode 100644 index 000000000..5c9f9c2d2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/dlmalloc.c @@ -0,0 +1,5161 @@ +/* + This is a version (aka dlmalloc) of malloc/free/realloc written by + Doug Lea and released to the public domain, as explained at + http://creativecommons.org/licenses/publicdomain. Send questions, + comments, complaints, performance data, etc to dl@cs.oswego.edu + +* Version 2.8.3 Thu Sep 22 11:16:15 2005 Doug Lea (dl at gee) + + Note: There may be an updated version of this malloc obtainable at + ftp://gee.cs.oswego.edu/pub/misc/malloc.c + Check before installing! + +* Quickstart + + This library is all in one file to simplify the most common usage: + ftp it, compile it (-O3), and link it into another program. All of + the compile-time options default to reasonable values for use on + most platforms. You might later want to step through various + compile-time and dynamic tuning options. + + For convenience, an include file for code using this malloc is at: + ftp://gee.cs.oswego.edu/pub/misc/malloc-2.8.3.h + You don't really need this .h file unless you call functions not + defined in your system include files. The .h file contains only the + excerpts from this file needed for using this malloc on ANSI C/C++ + systems, so long as you haven't changed compile-time options about + naming and tuning parameters. If you do, then you can create your + own malloc.h that does include all settings by cutting at the point + indicated below. Note that you may already by default be using a C + library containing a malloc that is based on some version of this + malloc (for example in linux). You might still want to use the one + in this file to customize settings or to avoid overheads associated + with library versions. + +* Vital statistics: + + Supported pointer/size_t representation: 4 or 8 bytes + size_t MUST be an unsigned type of the same width as + pointers. (If you are using an ancient system that declares + size_t as a signed type, or need it to be a different width + than pointers, you can use a previous release of this malloc + (e.g. 2.7.2) supporting these.) + + Alignment: 8 bytes (default) + This suffices for nearly all current machines and C compilers. + However, you can define MALLOC_ALIGNMENT to be wider than this + if necessary (up to 128bytes), at the expense of using more space. + + Minimum overhead per allocated chunk: 4 or 8 bytes (if 4byte sizes) + 8 or 16 bytes (if 8byte sizes) + Each malloced chunk has a hidden word of overhead holding size + and status information, and additional cross-check word + if FOOTERS is defined. + + Minimum allocated size: 4-byte ptrs: 16 bytes (including overhead) + 8-byte ptrs: 32 bytes (including overhead) + + Even a request for zero bytes (i.e., malloc(0)) returns a + pointer to something of the minimum allocatable size. + The maximum overhead wastage (i.e., number of extra bytes + allocated than were requested in malloc) is less than or equal + to the minimum size, except for requests >= mmap_threshold that + are serviced via mmap(), where the worst case wastage is about + 32 bytes plus the remainder from a system page (the minimal + mmap unit); typically 4096 or 8192 bytes. + + Security: static-safe; optionally more or less + The "security" of malloc refers to the ability of malicious + code to accentuate the effects of errors (for example, freeing + space that is not currently malloc'ed or overwriting past the + ends of chunks) in code that calls malloc. This malloc + guarantees not to modify any memory locations below the base of + heap, i.e., static variables, even in the presence of usage + errors. The routines additionally detect most improper frees + and reallocs. All this holds as long as the static bookkeeping + for malloc itself is not corrupted by some other means. This + is only one aspect of security -- these checks do not, and + cannot, detect all possible programming errors. + + If FOOTERS is defined nonzero, then each allocated chunk + carries an additional check word to verify that it was malloced + from its space. These check words are the same within each + execution of a program using malloc, but differ across + executions, so externally crafted fake chunks cannot be + freed. This improves security by rejecting frees/reallocs that + could corrupt heap memory, in addition to the checks preventing + writes to statics that are always on. This may further improve + security at the expense of time and space overhead. (Note that + FOOTERS may also be worth using with MSPACES.) + + By default detected errors cause the program to abort (calling + "abort()"). You can override this to instead proceed past + errors by defining PROCEED_ON_ERROR. In this case, a bad free + has no effect, and a malloc that encounters a bad address + caused by user overwrites will ignore the bad address by + dropping pointers and indices to all known memory. This may + be appropriate for programs that should continue if at all + possible in the face of programming errors, although they may + run out of memory because dropped memory is never reclaimed. + + If you don't like either of these options, you can define + CORRUPTION_ERROR_ACTION and USAGE_ERROR_ACTION to do anything + else. And if if you are sure that your program using malloc has + no errors or vulnerabilities, you can define INSECURE to 1, + which might (or might not) provide a small performance improvement. + + Thread-safety: NOT thread-safe unless USE_LOCKS defined + When USE_LOCKS is defined, each public call to malloc, free, + etc is surrounded with either a pthread mutex or a win32 + spinlock (depending on WIN32). This is not especially fast, and + can be a major bottleneck. It is designed only to provide + minimal protection in concurrent environments, and to provide a + basis for extensions. If you are using malloc in a concurrent + program, consider instead using ptmalloc, which is derived from + a version of this malloc. (See http://www.malloc.de). + + System requirements: Any combination of MORECORE and/or MMAP/MUNMAP + This malloc can use unix sbrk or any emulation (invoked using + the CALL_MORECORE macro) and/or mmap/munmap or any emulation + (invoked using CALL_MMAP/CALL_MUNMAP) to get and release system + memory. On most unix systems, it tends to work best if both + MORECORE and MMAP are enabled. On Win32, it uses emulations + based on VirtualAlloc. It also uses common C library functions + like memset. + + Compliance: I believe it is compliant with the Single Unix Specification + (See http://www.unix.org). Also SVID/XPG, ANSI C, and probably + others as well. + +* Overview of algorithms + + This is not the fastest, most space-conserving, most portable, or + most tunable malloc ever written. However it is among the fastest + while also being among the most space-conserving, portable and + tunable. Consistent balance across these factors results in a good + general-purpose allocator for malloc-intensive programs. + + In most ways, this malloc is a best-fit allocator. Generally, it + chooses the best-fitting existing chunk for a request, with ties + broken in approximately least-recently-used order. (This strategy + normally maintains low fragmentation.) However, for requests less + than 256bytes, it deviates from best-fit when there is not an + exactly fitting available chunk by preferring to use space adjacent + to that used for the previous small request, as well as by breaking + ties in approximately most-recently-used order. (These enhance + locality of series of small allocations.) And for very large requests + (>= 256Kb by default), it relies on system memory mapping + facilities, if supported. (This helps avoid carrying around and + possibly fragmenting memory used only for large chunks.) + + All operations (except malloc_stats and mallinfo) have execution + times that are bounded by a constant factor of the number of bits in + a size_t, not counting any clearing in calloc or copying in realloc, + or actions surrounding MORECORE and MMAP that have times + proportional to the number of non-contiguous regions returned by + system allocation routines, which is often just 1. + + The implementation is not very modular and seriously overuses + macros. Perhaps someday all C compilers will do as good a job + inlining modular code as can now be done by brute-force expansion, + but now, enough of them seem not to. + + Some compilers issue a lot of warnings about code that is + dead/unreachable only on some platforms, and also about intentional + uses of negation on unsigned types. All known cases of each can be + ignored. + + For a longer but out of date high-level description, see + http://gee.cs.oswego.edu/dl/html/malloc.html + +* MSPACES + If MSPACES is defined, then in addition to malloc, free, etc., + this file also defines mspace_malloc, mspace_free, etc. These + are versions of malloc routines that take an "mspace" argument + obtained using create_mspace, to control all internal bookkeeping. + If ONLY_MSPACES is defined, only these versions are compiled. + So if you would like to use this allocator for only some allocations, + and your system malloc for others, you can compile with + ONLY_MSPACES and then do something like... + static mspace mymspace = create_mspace(0,0); // for example + #define mymalloc(bytes) mspace_malloc(mymspace, bytes) + + (Note: If you only need one instance of an mspace, you can instead + use "USE_DL_PREFIX" to relabel the global malloc.) + + You can similarly create thread-local allocators by storing + mspaces as thread-locals. For example: + static __thread mspace tlms = 0; + void* tlmalloc(size_t bytes) { + if (tlms == 0) tlms = create_mspace(0, 0); + return mspace_malloc(tlms, bytes); + } + void tlfree(void* mem) { mspace_free(tlms, mem); } + + Unless FOOTERS is defined, each mspace is completely independent. + You cannot allocate from one and free to another (although + conformance is only weakly checked, so usage errors are not always + caught). If FOOTERS is defined, then each chunk carries around a tag + indicating its originating mspace, and frees are directed to their + originating spaces. + + ------------------------- Compile-time options --------------------------- + +Be careful in setting #define values for numerical constants of type +size_t. On some systems, literal values are not automatically extended +to size_t precision unless they are explicitly casted. + +WIN32 default: defined if _WIN32 defined + Defining WIN32 sets up defaults for MS environment and compilers. + Otherwise defaults are for unix. + +MALLOC_ALIGNMENT default: (size_t)8 + Controls the minimum alignment for malloc'ed chunks. It must be a + power of two and at least 8, even on machines for which smaller + alignments would suffice. It may be defined as larger than this + though. Note however that code and data structures are optimized for + the case of 8-byte alignment. + +MSPACES default: 0 (false) + If true, compile in support for independent allocation spaces. + This is only supported if HAVE_MMAP is true. + +ONLY_MSPACES default: 0 (false) + If true, only compile in mspace versions, not regular versions. + +USE_LOCKS default: 0 (false) + Causes each call to each public routine to be surrounded with + pthread or WIN32 mutex lock/unlock. (If set true, this can be + overridden on a per-mspace basis for mspace versions.) + +FOOTERS default: 0 + If true, provide extra checking and dispatching by placing + information in the footers of allocated chunks. This adds + space and time overhead. + +INSECURE default: 0 + If true, omit checks for usage errors and heap space overwrites. + +USE_DL_PREFIX default: NOT defined + Causes compiler to prefix all public routines with the string 'dl'. + This can be useful when you only want to use this malloc in one part + of a program, using your regular system malloc elsewhere. + +ABORT default: defined as abort() + Defines how to abort on failed checks. On most systems, a failed + check cannot die with an "assert" or even print an informative + message, because the underlying print routines in turn call malloc, + which will fail again. Generally, the best policy is to simply call + abort(). It's not very useful to do more than this because many + errors due to overwriting will show up as address faults (null, odd + addresses etc) rather than malloc-triggered checks, so will also + abort. Also, most compilers know that abort() does not return, so + can better optimize code conditionally calling it. + +PROCEED_ON_ERROR default: defined as 0 (false) + Controls whether detected bad addresses cause them to bypassed + rather than aborting. If set, detected bad arguments to free and + realloc are ignored. And all bookkeeping information is zeroed out + upon a detected overwrite of freed heap space, thus losing the + ability to ever return it from malloc again, but enabling the + application to proceed. If PROCEED_ON_ERROR is defined, the + static variable malloc_corruption_error_count is compiled in + and can be examined to see if errors have occurred. This option + generates slower code than the default abort policy. + +DEBUG default: NOT defined + The DEBUG setting is mainly intended for people trying to modify + this code or diagnose problems when porting to new platforms. + However, it may also be able to better isolate user errors than just + using runtime checks. The assertions in the check routines spell + out in more detail the assumptions and invariants underlying the + algorithms. The checking is fairly extensive, and will slow down + execution noticeably. Calling malloc_stats or mallinfo with DEBUG + set will attempt to check every non-mmapped allocated and free chunk + in the course of computing the summaries. + +ABORT_ON_ASSERT_FAILURE default: defined as 1 (true) + Debugging assertion failures can be nearly impossible if your + version of the assert macro causes malloc to be called, which will + lead to a cascade of further failures, blowing the runtime stack. + ABORT_ON_ASSERT_FAILURE cause assertions failures to call abort(), + which will usually make debugging easier. + +MALLOC_FAILURE_ACTION default: sets errno to ENOMEM, or no-op on win32 + The action to take before "return 0" when malloc fails to be able to + return memory because there is none available. + +HAVE_MORECORE default: 1 (true) unless win32 or ONLY_MSPACES + True if this system supports sbrk or an emulation of it. + +MORECORE default: sbrk + The name of the sbrk-style system routine to call to obtain more + memory. See below for guidance on writing custom MORECORE + functions. The type of the argument to sbrk/MORECORE varies across + systems. It cannot be size_t, because it supports negative + arguments, so it is normally the signed type of the same width as + size_t (sometimes declared as "intptr_t"). It doesn't much matter + though. Internally, we only call it with arguments less than half + the max value of a size_t, which should work across all reasonable + possibilities, although sometimes generating compiler warnings. See + near the end of this file for guidelines for creating a custom + version of MORECORE. + +MORECORE_CONTIGUOUS default: 1 (true) + If true, take advantage of fact that consecutive calls to MORECORE + with positive arguments always return contiguous increasing + addresses. This is true of unix sbrk. It does not hurt too much to + set it true anyway, since malloc copes with non-contiguities. + Setting it false when definitely non-contiguous saves time + and possibly wasted space it would take to discover this though. + +MORECORE_CANNOT_TRIM default: NOT defined + True if MORECORE cannot release space back to the system when given + negative arguments. This is generally necessary only if you are + using a hand-crafted MORECORE function that cannot handle negative + arguments. + +HAVE_MMAP default: 1 (true) + True if this system supports mmap or an emulation of it. If so, and + HAVE_MORECORE is not true, MMAP is used for all system + allocation. If set and HAVE_MORECORE is true as well, MMAP is + primarily used to directly allocate very large blocks. It is also + used as a backup strategy in cases where MORECORE fails to provide + space from system. Note: A single call to MUNMAP is assumed to be + able to unmap memory that may have be allocated using multiple calls + to MMAP, so long as they are adjacent. + +HAVE_MREMAP default: 1 on linux, else 0 + If true realloc() uses mremap() to re-allocate large blocks and + extend or shrink allocation spaces. + +MMAP_CLEARS default: 1 on unix + True if mmap clears memory so calloc doesn't need to. This is true + for standard unix mmap using /dev/zero. + +USE_BUILTIN_FFS default: 0 (i.e., not used) + Causes malloc to use the builtin ffs() function to compute indices. + Some compilers may recognize and intrinsify ffs to be faster than the + supplied C version. Also, the case of x86 using gcc is special-cased + to an asm instruction, so is already as fast as it can be, and so + this setting has no effect. (On most x86s, the asm version is only + slightly faster than the C version.) + +malloc_getpagesize default: derive from system includes, or 4096. + The system page size. To the extent possible, this malloc manages + memory from the system in page-size units. This may be (and + usually is) a function rather than a constant. This is ignored + if WIN32, where page size is determined using getSystemInfo during + initialization. + +USE_DEV_RANDOM default: 0 (i.e., not used) + Causes malloc to use /dev/random to initialize secure magic seed for + stamping footers. Otherwise, the current time is used. + +NO_MALLINFO default: 0 + If defined, don't compile "mallinfo". This can be a simple way + of dealing with mismatches between system declarations and + those in this file. + +MALLINFO_FIELD_TYPE default: size_t + The type of the fields in the mallinfo struct. This was originally + defined as "int" in SVID etc, but is more usefully defined as + size_t. The value is used only if HAVE_USR_INCLUDE_MALLOC_H is not set + +REALLOC_ZERO_BYTES_FREES default: not defined + This should be set if a call to realloc with zero bytes should + be the same as a call to free. Some people think it should. Otherwise, + since this malloc returns a unique pointer for malloc(0), so does + realloc(p, 0). + +LACKS_UNISTD_H, LACKS_FCNTL_H, LACKS_SYS_PARAM_H, LACKS_SYS_MMAN_H +LACKS_STRINGS_H, LACKS_STRING_H, LACKS_SYS_TYPES_H, LACKS_ERRNO_H +LACKS_STDLIB_H default: NOT defined unless on WIN32 + Define these if your system does not have these header files. + You might need to manually insert some of the declarations they provide. + +DEFAULT_GRANULARITY default: page size if MORECORE_CONTIGUOUS, + system_info.dwAllocationGranularity in WIN32, + otherwise 64K. + Also settable using mallopt(M_GRANULARITY, x) + The unit for allocating and deallocating memory from the system. On + most systems with contiguous MORECORE, there is no reason to + make this more than a page. However, systems with MMAP tend to + either require or encourage larger granularities. You can increase + this value to prevent system allocation functions to be called so + often, especially if they are slow. The value must be at least one + page and must be a power of two. Setting to 0 causes initialization + to either page size or win32 region size. (Note: In previous + versions of malloc, the equivalent of this option was called + "TOP_PAD") + +DEFAULT_TRIM_THRESHOLD default: 2MB + Also settable using mallopt(M_TRIM_THRESHOLD, x) + The maximum amount of unused top-most memory to keep before + releasing via malloc_trim in free(). Automatic trimming is mainly + useful in long-lived programs using contiguous MORECORE. Because + trimming via sbrk can be slow on some systems, and can sometimes be + wasteful (in cases where programs immediately afterward allocate + more large chunks) the value should be high enough so that your + overall system performance would improve by releasing this much + memory. As a rough guide, you might set to a value close to the + average size of a process (program) running on your system. + Releasing this much memory would allow such a process to run in + memory. Generally, it is worth tuning trim thresholds when a + program undergoes phases where several large chunks are allocated + and released in ways that can reuse each other's storage, perhaps + mixed with phases where there are no such chunks at all. The trim + value must be greater than page size to have any useful effect. To + disable trimming completely, you can set to MAX_SIZE_T. Note that the trick + some people use of mallocing a huge space and then freeing it at + program startup, in an attempt to reserve system memory, doesn't + have the intended effect under automatic trimming, since that memory + will immediately be returned to the system. + +DEFAULT_MMAP_THRESHOLD default: 256K + Also settable using mallopt(M_MMAP_THRESHOLD, x) + The request size threshold for using MMAP to directly service a + request. Requests of at least this size that cannot be allocated + using already-existing space will be serviced via mmap. (If enough + normal freed space already exists it is used instead.) Using mmap + segregates relatively large chunks of memory so that they can be + individually obtained and released from the host system. A request + serviced through mmap is never reused by any other request (at least + not directly; the system may just so happen to remap successive + requests to the same locations). Segregating space in this way has + the benefits that: Mmapped space can always be individually released + back to the system, which helps keep the system level memory demands + of a long-lived program low. Also, mapped memory doesn't become + `locked' between other chunks, as can happen with normally allocated + chunks, which means that even trimming via malloc_trim would not + release them. However, it has the disadvantage that the space + cannot be reclaimed, consolidated, and then used to service later + requests, as happens with normal chunks. The advantages of mmap + nearly always outweigh disadvantages for "large" chunks, but the + value of "large" may vary across systems. The default is an + empirically derived value that works well in most systems. You can + disable mmap by setting to MAX_SIZE_T. + +*/ + +#ifndef WIN32 +#ifdef _WIN32 +#define WIN32 1 +#endif /* _WIN32 */ +#endif /* WIN32 */ +#ifdef WIN32 +#define WIN32_LEAN_AND_MEAN +#include +#define HAVE_MMAP 1 +#define HAVE_MORECORE 0 +#define LACKS_UNISTD_H +#define LACKS_SYS_PARAM_H +#define LACKS_SYS_MMAN_H +#define LACKS_STRING_H +#define LACKS_STRINGS_H +#define LACKS_SYS_TYPES_H +#define LACKS_ERRNO_H +#define MALLOC_FAILURE_ACTION +#define MMAP_CLEARS 0 /* WINCE and some others apparently don't clear */ +#endif /* WIN32 */ + +#ifdef __OS2__ +#define INCL_DOS +#include +#define HAVE_MMAP 1 +#define HAVE_MORECORE 0 +#define LACKS_SYS_MMAN_H +#endif /* __OS2__ */ + +#if defined(DARWIN) || defined(_DARWIN) +/* Mac OSX docs advise not to use sbrk; it seems better to use mmap */ +#ifndef HAVE_MORECORE +#define HAVE_MORECORE 0 +#define HAVE_MMAP 1 +#endif /* HAVE_MORECORE */ +#endif /* DARWIN */ + +#ifndef LACKS_SYS_TYPES_H +#include /* For size_t */ +#endif /* LACKS_SYS_TYPES_H */ + +/* The maximum possible size_t value has all bits set */ +#define MAX_SIZE_T (~(size_t)0) + +#ifndef ONLY_MSPACES +#define ONLY_MSPACES 0 +#endif /* ONLY_MSPACES */ +#ifndef MSPACES +#if ONLY_MSPACES +#define MSPACES 1 +#else /* ONLY_MSPACES */ +#define MSPACES 0 +#endif /* ONLY_MSPACES */ +#endif /* MSPACES */ +#ifndef MALLOC_ALIGNMENT +#define MALLOC_ALIGNMENT ((size_t)8U) +#endif /* MALLOC_ALIGNMENT */ +#ifndef FOOTERS +#define FOOTERS 0 +#endif /* FOOTERS */ +#ifndef ABORT +#define ABORT abort() +#endif /* ABORT */ +#ifndef ABORT_ON_ASSERT_FAILURE +#define ABORT_ON_ASSERT_FAILURE 1 +#endif /* ABORT_ON_ASSERT_FAILURE */ +#ifndef PROCEED_ON_ERROR +#define PROCEED_ON_ERROR 0 +#endif /* PROCEED_ON_ERROR */ +#ifndef USE_LOCKS +#define USE_LOCKS 0 +#endif /* USE_LOCKS */ +#ifndef INSECURE +#define INSECURE 0 +#endif /* INSECURE */ +#ifndef HAVE_MMAP +#define HAVE_MMAP 1 +#endif /* HAVE_MMAP */ +#ifndef MMAP_CLEARS +#define MMAP_CLEARS 1 +#endif /* MMAP_CLEARS */ +#ifndef HAVE_MREMAP +#ifdef linux +#define HAVE_MREMAP 1 +#else /* linux */ +#define HAVE_MREMAP 0 +#endif /* linux */ +#endif /* HAVE_MREMAP */ +#ifndef MALLOC_FAILURE_ACTION +#define MALLOC_FAILURE_ACTION errno = ENOMEM; +#endif /* MALLOC_FAILURE_ACTION */ +#ifndef HAVE_MORECORE +#if ONLY_MSPACES +#define HAVE_MORECORE 0 +#else /* ONLY_MSPACES */ +#define HAVE_MORECORE 1 +#endif /* ONLY_MSPACES */ +#endif /* HAVE_MORECORE */ +#if !HAVE_MORECORE +#define MORECORE_CONTIGUOUS 0 +#else /* !HAVE_MORECORE */ +#ifndef MORECORE +#define MORECORE sbrk +#endif /* MORECORE */ +#ifndef MORECORE_CONTIGUOUS +#define MORECORE_CONTIGUOUS 1 +#endif /* MORECORE_CONTIGUOUS */ +#endif /* HAVE_MORECORE */ +#ifndef DEFAULT_GRANULARITY +#if MORECORE_CONTIGUOUS +#define DEFAULT_GRANULARITY (0) /* 0 means to compute in init_mparams */ +#else /* MORECORE_CONTIGUOUS */ +#define DEFAULT_GRANULARITY ((size_t)64U * (size_t)1024U) +#endif /* MORECORE_CONTIGUOUS */ +#endif /* DEFAULT_GRANULARITY */ +#ifndef DEFAULT_TRIM_THRESHOLD +#ifndef MORECORE_CANNOT_TRIM +#define DEFAULT_TRIM_THRESHOLD ((size_t)2U * (size_t)1024U * (size_t)1024U) +#else /* MORECORE_CANNOT_TRIM */ +#define DEFAULT_TRIM_THRESHOLD MAX_SIZE_T +#endif /* MORECORE_CANNOT_TRIM */ +#endif /* DEFAULT_TRIM_THRESHOLD */ +#ifndef DEFAULT_MMAP_THRESHOLD +#if HAVE_MMAP +#define DEFAULT_MMAP_THRESHOLD ((size_t)256U * (size_t)1024U) +#else /* HAVE_MMAP */ +#define DEFAULT_MMAP_THRESHOLD MAX_SIZE_T +#endif /* HAVE_MMAP */ +#endif /* DEFAULT_MMAP_THRESHOLD */ +#ifndef USE_BUILTIN_FFS +#define USE_BUILTIN_FFS 0 +#endif /* USE_BUILTIN_FFS */ +#ifndef USE_DEV_RANDOM +#define USE_DEV_RANDOM 0 +#endif /* USE_DEV_RANDOM */ +#ifndef NO_MALLINFO +#define NO_MALLINFO 0 +#endif /* NO_MALLINFO */ +#ifndef MALLINFO_FIELD_TYPE +#define MALLINFO_FIELD_TYPE size_t +#endif /* MALLINFO_FIELD_TYPE */ + +/* + mallopt tuning options. SVID/XPG defines four standard parameter + numbers for mallopt, normally defined in malloc.h. None of these + are used in this malloc, so setting them has no effect. But this + malloc does support the following options. +*/ + +#define M_TRIM_THRESHOLD (-1) +#define M_GRANULARITY (-2) +#define M_MMAP_THRESHOLD (-3) + +/* ------------------------ Mallinfo declarations ------------------------ */ + +#if !NO_MALLINFO +/* + This version of malloc supports the standard SVID/XPG mallinfo + routine that returns a struct containing usage properties and + statistics. It should work on any system that has a + /usr/include/malloc.h defining struct mallinfo. The main + declaration needed is the mallinfo struct that is returned (by-copy) + by mallinfo(). The malloinfo struct contains a bunch of fields that + are not even meaningful in this version of malloc. These fields are + are instead filled by mallinfo() with other numbers that might be of + interest. + + HAVE_USR_INCLUDE_MALLOC_H should be set if you have a + /usr/include/malloc.h file that includes a declaration of struct + mallinfo. If so, it is included; else a compliant version is + declared below. These must be precisely the same for mallinfo() to + work. The original SVID version of this struct, defined on most + systems with mallinfo, declares all fields as ints. But some others + define as unsigned long. If your system defines the fields using a + type of different width than listed here, you MUST #include your + system version and #define HAVE_USR_INCLUDE_MALLOC_H. +*/ + +/* #define HAVE_USR_INCLUDE_MALLOC_H */ + +#ifdef HAVE_USR_INCLUDE_MALLOC_H +#include "/usr/include/malloc.h" +#else /* HAVE_USR_INCLUDE_MALLOC_H */ + +/* HP-UX's stdlib.h redefines mallinfo unless _STRUCT_MALLINFO is defined */ +#define _STRUCT_MALLINFO + +struct mallinfo { + MALLINFO_FIELD_TYPE arena; /* non-mmapped space allocated from system */ + MALLINFO_FIELD_TYPE ordblks; /* number of free chunks */ + MALLINFO_FIELD_TYPE smblks; /* always 0 */ + MALLINFO_FIELD_TYPE hblks; /* always 0 */ + MALLINFO_FIELD_TYPE hblkhd; /* space in mmapped regions */ + MALLINFO_FIELD_TYPE usmblks; /* maximum total allocated space */ + MALLINFO_FIELD_TYPE fsmblks; /* always 0 */ + MALLINFO_FIELD_TYPE uordblks; /* total allocated space */ + MALLINFO_FIELD_TYPE fordblks; /* total free space */ + MALLINFO_FIELD_TYPE keepcost; /* releasable (via malloc_trim) space */ +}; + +#endif /* HAVE_USR_INCLUDE_MALLOC_H */ +#endif /* NO_MALLINFO */ + +#ifdef __cplusplus +extern "C" { +#endif /* __cplusplus */ + +#if !ONLY_MSPACES + +/* ------------------- Declarations of public routines ------------------- */ + +#ifndef USE_DL_PREFIX +#define dlcalloc calloc +#define dlfree free +#define dlmalloc malloc +#define dlmemalign memalign +#define dlrealloc realloc +#define dlvalloc valloc +#define dlpvalloc pvalloc +#define dlmallinfo mallinfo +#define dlmallopt mallopt +#define dlmalloc_trim malloc_trim +#define dlmalloc_stats malloc_stats +#define dlmalloc_usable_size malloc_usable_size +#define dlmalloc_footprint malloc_footprint +#define dlmalloc_max_footprint malloc_max_footprint +#define dlindependent_calloc independent_calloc +#define dlindependent_comalloc independent_comalloc +#endif /* USE_DL_PREFIX */ + + +/* + malloc(size_t n) + Returns a pointer to a newly allocated chunk of at least n bytes, or + null if no space is available, in which case errno is set to ENOMEM + on ANSI C systems. + + If n is zero, malloc returns a minimum-sized chunk. (The minimum + size is 16 bytes on most 32bit systems, and 32 bytes on 64bit + systems.) Note that size_t is an unsigned type, so calls with + arguments that would be negative if signed are interpreted as + requests for huge amounts of space, which will often fail. The + maximum supported value of n differs across systems, but is in all + cases less than the maximum representable value of a size_t. +*/ +void* dlmalloc(size_t); + +/* + free(void* p) + Releases the chunk of memory pointed to by p, that had been previously + allocated using malloc or a related routine such as realloc. + It has no effect if p is null. If p was not malloced or already + freed, free(p) will by default cause the current program to abort. +*/ +void dlfree(void*); + +/* + calloc(size_t n_elements, size_t element_size); + Returns a pointer to n_elements * element_size bytes, with all locations + set to zero. +*/ +void* dlcalloc(size_t, size_t); + +/* + realloc(void* p, size_t n) + Returns a pointer to a chunk of size n that contains the same data + as does chunk p up to the minimum of (n, p's size) bytes, or null + if no space is available. + + The returned pointer may or may not be the same as p. The algorithm + prefers extending p in most cases when possible, otherwise it + employs the equivalent of a malloc-copy-free sequence. + + If p is null, realloc is equivalent to malloc. + + If space is not available, realloc returns null, errno is set (if on + ANSI) and p is NOT freed. + + if n is for fewer bytes than already held by p, the newly unused + space is lopped off and freed if possible. realloc with a size + argument of zero (re)allocates a minimum-sized chunk. + + The old unix realloc convention of allowing the last-free'd chunk + to be used as an argument to realloc is not supported. +*/ + +void* dlrealloc(void*, size_t); + +/* + memalign(size_t alignment, size_t n); + Returns a pointer to a newly allocated chunk of n bytes, aligned + in accord with the alignment argument. + + The alignment argument should be a power of two. If the argument is + not a power of two, the nearest greater power is used. + 8-byte alignment is guaranteed by normal malloc calls, so don't + bother calling memalign with an argument of 8 or less. + + Overreliance on memalign is a sure way to fragment space. +*/ +void* dlmemalign(size_t, size_t); + +/* + valloc(size_t n); + Equivalent to memalign(pagesize, n), where pagesize is the page + size of the system. If the pagesize is unknown, 4096 is used. +*/ +void* dlvalloc(size_t); + +/* + mallopt(int parameter_number, int parameter_value) + Sets tunable parameters The format is to provide a + (parameter-number, parameter-value) pair. mallopt then sets the + corresponding parameter to the argument value if it can (i.e., so + long as the value is meaningful), and returns 1 if successful else + 0. SVID/XPG/ANSI defines four standard param numbers for mallopt, + normally defined in malloc.h. None of these are use in this malloc, + so setting them has no effect. But this malloc also supports other + options in mallopt. See below for details. Briefly, supported + parameters are as follows (listed defaults are for "typical" + configurations). + + Symbol param # default allowed param values + M_TRIM_THRESHOLD -1 2*1024*1024 any (MAX_SIZE_T disables) + M_GRANULARITY -2 page size any power of 2 >= page size + M_MMAP_THRESHOLD -3 256*1024 any (or 0 if no MMAP support) +*/ +int dlmallopt(int, int); + +/* + malloc_footprint(); + Returns the number of bytes obtained from the system. The total + number of bytes allocated by malloc, realloc etc., is less than this + value. Unlike mallinfo, this function returns only a precomputed + result, so can be called frequently to monitor memory consumption. + Even if locks are otherwise defined, this function does not use them, + so results might not be up to date. +*/ +size_t dlmalloc_footprint(void); + +/* + malloc_max_footprint(); + Returns the maximum number of bytes obtained from the system. This + value will be greater than current footprint if deallocated space + has been reclaimed by the system. The peak number of bytes allocated + by malloc, realloc etc., is less than this value. Unlike mallinfo, + this function returns only a precomputed result, so can be called + frequently to monitor memory consumption. Even if locks are + otherwise defined, this function does not use them, so results might + not be up to date. +*/ +size_t dlmalloc_max_footprint(void); + +#if !NO_MALLINFO +/* + mallinfo() + Returns (by copy) a struct containing various summary statistics: + + arena: current total non-mmapped bytes allocated from system + ordblks: the number of free chunks + smblks: always zero. + hblks: current number of mmapped regions + hblkhd: total bytes held in mmapped regions + usmblks: the maximum total allocated space. This will be greater + than current total if trimming has occurred. + fsmblks: always zero + uordblks: current total allocated space (normal or mmapped) + fordblks: total free space + keepcost: the maximum number of bytes that could ideally be released + back to system via malloc_trim. ("ideally" means that + it ignores page restrictions etc.) + + Because these fields are ints, but internal bookkeeping may + be kept as longs, the reported values may wrap around zero and + thus be inaccurate. +*/ +struct mallinfo dlmallinfo(void); +#endif /* NO_MALLINFO */ + +/* + independent_calloc(size_t n_elements, size_t element_size, void* chunks[]); + + independent_calloc is similar to calloc, but instead of returning a + single cleared space, it returns an array of pointers to n_elements + independent elements that can hold contents of size elem_size, each + of which starts out cleared, and can be independently freed, + realloc'ed etc. The elements are guaranteed to be adjacently + allocated (this is not guaranteed to occur with multiple callocs or + mallocs), which may also improve cache locality in some + applications. + + The "chunks" argument is optional (i.e., may be null, which is + probably the most typical usage). If it is null, the returned array + is itself dynamically allocated and should also be freed when it is + no longer needed. Otherwise, the chunks array must be of at least + n_elements in length. It is filled in with the pointers to the + chunks. + + In either case, independent_calloc returns this pointer array, or + null if the allocation failed. If n_elements is zero and "chunks" + is null, it returns a chunk representing an array with zero elements + (which should be freed if not wanted). + + Each element must be individually freed when it is no longer + needed. If you'd like to instead be able to free all at once, you + should instead use regular calloc and assign pointers into this + space to represent elements. (In this case though, you cannot + independently free elements.) + + independent_calloc simplifies and speeds up implementations of many + kinds of pools. It may also be useful when constructing large data + structures that initially have a fixed number of fixed-sized nodes, + but the number is not known at compile time, and some of the nodes + may later need to be freed. For example: + + struct Node { int item; struct Node* next; }; + + struct Node* build_list() { + struct Node** pool; + int n = read_number_of_nodes_needed(); + if (n <= 0) return 0; + pool = (struct Node**)(independent_calloc(n, sizeof(struct Node), 0); + if (pool == 0) die(); + // organize into a linked list... + struct Node* first = pool[0]; + for (i = 0; i < n-1; ++i) + pool[i]->next = pool[i+1]; + free(pool); // Can now free the array (or not, if it is needed later) + return first; + } +*/ +void** dlindependent_calloc(size_t, size_t, void**); + +/* + independent_comalloc(size_t n_elements, size_t sizes[], void* chunks[]); + + independent_comalloc allocates, all at once, a set of n_elements + chunks with sizes indicated in the "sizes" array. It returns + an array of pointers to these elements, each of which can be + independently freed, realloc'ed etc. The elements are guaranteed to + be adjacently allocated (this is not guaranteed to occur with + multiple callocs or mallocs), which may also improve cache locality + in some applications. + + The "chunks" argument is optional (i.e., may be null). If it is null + the returned array is itself dynamically allocated and should also + be freed when it is no longer needed. Otherwise, the chunks array + must be of at least n_elements in length. It is filled in with the + pointers to the chunks. + + In either case, independent_comalloc returns this pointer array, or + null if the allocation failed. If n_elements is zero and chunks is + null, it returns a chunk representing an array with zero elements + (which should be freed if not wanted). + + Each element must be individually freed when it is no longer + needed. If you'd like to instead be able to free all at once, you + should instead use a single regular malloc, and assign pointers at + particular offsets in the aggregate space. (In this case though, you + cannot independently free elements.) + + independent_comallac differs from independent_calloc in that each + element may have a different size, and also that it does not + automatically clear elements. + + independent_comalloc can be used to speed up allocation in cases + where several structs or objects must always be allocated at the + same time. For example: + + struct Head { ... } + struct Foot { ... } + + void send_message(char* msg) { + int msglen = strlen(msg); + size_t sizes[3] = { sizeof(struct Head), msglen, sizeof(struct Foot) }; + void* chunks[3]; + if (independent_comalloc(3, sizes, chunks) == 0) + die(); + struct Head* head = (struct Head*)(chunks[0]); + char* body = (char*)(chunks[1]); + struct Foot* foot = (struct Foot*)(chunks[2]); + // ... + } + + In general though, independent_comalloc is worth using only for + larger values of n_elements. For small values, you probably won't + detect enough difference from series of malloc calls to bother. + + Overuse of independent_comalloc can increase overall memory usage, + since it cannot reuse existing noncontiguous small chunks that + might be available for some of the elements. +*/ +void** dlindependent_comalloc(size_t, size_t*, void**); + + +/* + pvalloc(size_t n); + Equivalent to valloc(minimum-page-that-holds(n)), that is, + round up n to nearest pagesize. + */ +void* dlpvalloc(size_t); + +/* + malloc_trim(size_t pad); + + If possible, gives memory back to the system (via negative arguments + to sbrk) if there is unused memory at the `high' end of the malloc + pool or in unused MMAP segments. You can call this after freeing + large blocks of memory to potentially reduce the system-level memory + requirements of a program. However, it cannot guarantee to reduce + memory. Under some allocation patterns, some large free blocks of + memory will be locked between two used chunks, so they cannot be + given back to the system. + + The `pad' argument to malloc_trim represents the amount of free + trailing space to leave untrimmed. If this argument is zero, only + the minimum amount of memory to maintain internal data structures + will be left. Non-zero arguments can be supplied to maintain enough + trailing space to service future expected allocations without having + to re-obtain memory from the system. + + Malloc_trim returns 1 if it actually released any memory, else 0. +*/ +int dlmalloc_trim(size_t); + +/* + malloc_usable_size(void* p); + + Returns the number of bytes you can actually use in + an allocated chunk, which may be more than you requested (although + often not) due to alignment and minimum size constraints. + You can use this many bytes without worrying about + overwriting other allocated objects. This is not a particularly great + programming practice. malloc_usable_size can be more useful in + debugging and assertions, for example: + + p = malloc(n); + assert(malloc_usable_size(p) >= 256); +*/ +size_t dlmalloc_usable_size(void*); + +/* + malloc_stats(); + Prints on stderr the amount of space obtained from the system (both + via sbrk and mmap), the maximum amount (which may be more than + current if malloc_trim and/or munmap got called), and the current + number of bytes allocated via malloc (or realloc, etc) but not yet + freed. Note that this is the number of bytes allocated, not the + number requested. It will be larger than the number requested + because of alignment and bookkeeping overhead. Because it includes + alignment wastage as being in use, this figure may be greater than + zero even when no user-level chunks are allocated. + + The reported current and maximum system memory can be inaccurate if + a program makes other calls to system memory allocation functions + (normally sbrk) outside of malloc. + + malloc_stats prints only the most commonly interesting statistics. + More information can be obtained by calling mallinfo. +*/ +void dlmalloc_stats(void); + +#endif /* ONLY_MSPACES */ + +#if MSPACES + +/* + mspace is an opaque type representing an independent + region of space that supports mspace_malloc, etc. +*/ +typedef void* mspace; + +/* + create_mspace creates and returns a new independent space with the + given initial capacity, or, if 0, the default granularity size. It + returns null if there is no system memory available to create the + space. If argument locked is non-zero, the space uses a separate + lock to control access. The capacity of the space will grow + dynamically as needed to service mspace_malloc requests. You can + control the sizes of incremental increases of this space by + compiling with a different DEFAULT_GRANULARITY or dynamically + setting with mallopt(M_GRANULARITY, value). +*/ +mspace create_mspace(size_t capacity, int locked); + +/* + destroy_mspace destroys the given space, and attempts to return all + of its memory back to the system, returning the total number of + bytes freed. After destruction, the results of access to all memory + used by the space become undefined. +*/ +size_t destroy_mspace(mspace msp); + +/* + create_mspace_with_base uses the memory supplied as the initial base + of a new mspace. Part (less than 128*sizeof(size_t) bytes) of this + space is used for bookkeeping, so the capacity must be at least this + large. (Otherwise 0 is returned.) When this initial space is + exhausted, additional memory will be obtained from the system. + Destroying this space will deallocate all additionally allocated + space (if possible) but not the initial base. +*/ +mspace create_mspace_with_base(void* base, size_t capacity, int locked); + +/* + mspace_malloc behaves as malloc, but operates within + the given space. +*/ +void* mspace_malloc(mspace msp, size_t bytes); + +/* + mspace_free behaves as free, but operates within + the given space. + + If compiled with FOOTERS==1, mspace_free is not actually needed. + free may be called instead of mspace_free because freed chunks from + any space are handled by their originating spaces. +*/ +void mspace_free(mspace msp, void* mem); + +/* + mspace_realloc behaves as realloc, but operates within + the given space. + + If compiled with FOOTERS==1, mspace_realloc is not actually + needed. realloc may be called instead of mspace_realloc because + realloced chunks from any space are handled by their originating + spaces. +*/ +void* mspace_realloc(mspace msp, void* mem, size_t newsize); + +/* + mspace_calloc behaves as calloc, but operates within + the given space. +*/ +void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size); + +/* + mspace_memalign behaves as memalign, but operates within + the given space. +*/ +void* mspace_memalign(mspace msp, size_t alignment, size_t bytes); + +/* + mspace_independent_calloc behaves as independent_calloc, but + operates within the given space. +*/ +void** mspace_independent_calloc(mspace msp, size_t n_elements, + size_t elem_size, void* chunks[]); + +/* + mspace_independent_comalloc behaves as independent_comalloc, but + operates within the given space. +*/ +void** mspace_independent_comalloc(mspace msp, size_t n_elements, + size_t sizes[], void* chunks[]); + +/* + mspace_footprint() returns the number of bytes obtained from the + system for this space. +*/ +size_t mspace_footprint(mspace msp); + +/* + mspace_max_footprint() returns the peak number of bytes obtained from the + system for this space. +*/ +size_t mspace_max_footprint(mspace msp); + + +#if !NO_MALLINFO +/* + mspace_mallinfo behaves as mallinfo, but reports properties of + the given space. +*/ +struct mallinfo mspace_mallinfo(mspace msp); +#endif /* NO_MALLINFO */ + +/* + mspace_malloc_stats behaves as malloc_stats, but reports + properties of the given space. +*/ +void mspace_malloc_stats(mspace msp); + +/* + mspace_trim behaves as malloc_trim, but + operates within the given space. +*/ +int mspace_trim(mspace msp, size_t pad); + +/* + An alias for mallopt. +*/ +int mspace_mallopt(int, int); + +#endif /* MSPACES */ + +#ifdef __cplusplus +}; /* end of extern "C" */ +#endif /* __cplusplus */ + +/* + ======================================================================== + To make a fully customizable malloc.h header file, cut everything + above this line, put into file malloc.h, edit to suit, and #include it + on the next line, as well as in programs that use this malloc. + ======================================================================== +*/ + +/* #include "malloc.h" */ + +/*------------------------------ internal #includes ---------------------- */ + +#ifdef _MSC_VER +#pragma warning( disable : 4146 ) /* no "unsigned" warnings */ +#endif /* _MSC_VER */ + +#include /* for printing in malloc_stats */ + +#ifndef LACKS_ERRNO_H +#include /* for MALLOC_FAILURE_ACTION */ +#endif /* LACKS_ERRNO_H */ +#if FOOTERS +#include /* for magic initialization */ +#endif /* FOOTERS */ +#ifndef LACKS_STDLIB_H +#include /* for abort() */ +#endif /* LACKS_STDLIB_H */ +#ifdef DEBUG +#if ABORT_ON_ASSERT_FAILURE +#define assert(x) if(!(x)) ABORT +#else /* ABORT_ON_ASSERT_FAILURE */ +#include +#endif /* ABORT_ON_ASSERT_FAILURE */ +#else /* DEBUG */ +#define assert(x) +#endif /* DEBUG */ +#ifndef LACKS_STRING_H +#include /* for memset etc */ +#endif /* LACKS_STRING_H */ +#if USE_BUILTIN_FFS +#ifndef LACKS_STRINGS_H +#include /* for ffs */ +#endif /* LACKS_STRINGS_H */ +#endif /* USE_BUILTIN_FFS */ +#if HAVE_MMAP +#ifndef LACKS_SYS_MMAN_H +#include /* for mmap */ +#endif /* LACKS_SYS_MMAN_H */ +#ifndef LACKS_FCNTL_H +#include +#endif /* LACKS_FCNTL_H */ +#endif /* HAVE_MMAP */ +#if HAVE_MORECORE +#ifndef LACKS_UNISTD_H +#include /* for sbrk */ +#else /* LACKS_UNISTD_H */ +#if !defined(__FreeBSD__) && !defined(__OpenBSD__) && !defined(__NetBSD__) +extern void* sbrk(ptrdiff_t); +#endif /* FreeBSD etc */ +#endif /* LACKS_UNISTD_H */ +#endif /* HAVE_MMAP */ + +#ifndef WIN32 +#ifndef malloc_getpagesize +# ifdef _SC_PAGESIZE /* some SVR4 systems omit an underscore */ +# ifndef _SC_PAGE_SIZE +# define _SC_PAGE_SIZE _SC_PAGESIZE +# endif +# endif +# ifdef _SC_PAGE_SIZE +# define malloc_getpagesize sysconf(_SC_PAGE_SIZE) +# else +# if defined(BSD) || defined(DGUX) || defined(HAVE_GETPAGESIZE) + extern size_t getpagesize(); +# define malloc_getpagesize getpagesize() +# else +# ifdef WIN32 /* use supplied emulation of getpagesize */ +# define malloc_getpagesize getpagesize() +# else +# ifndef LACKS_SYS_PARAM_H +# include +# endif +# ifdef EXEC_PAGESIZE +# define malloc_getpagesize EXEC_PAGESIZE +# else +# ifdef NBPG +# ifndef CLSIZE +# define malloc_getpagesize NBPG +# else +# define malloc_getpagesize (NBPG * CLSIZE) +# endif +# else +# ifdef NBPC +# define malloc_getpagesize NBPC +# else +# ifdef PAGESIZE +# define malloc_getpagesize PAGESIZE +# else /* just guess */ +# define malloc_getpagesize ((size_t)4096U) +# endif +# endif +# endif +# endif +# endif +# endif +# endif +#endif +#endif + +/* ------------------- size_t and alignment properties -------------------- */ + +/* The byte and bit size of a size_t */ +#define SIZE_T_SIZE (sizeof(size_t)) +#define SIZE_T_BITSIZE (sizeof(size_t) << 3) + +/* Some constants coerced to size_t */ +/* Annoying but necessary to avoid errors on some plaftorms */ +#define SIZE_T_ZERO ((size_t)0) +#define SIZE_T_ONE ((size_t)1) +#define SIZE_T_TWO ((size_t)2) +#define TWO_SIZE_T_SIZES (SIZE_T_SIZE<<1) +#define FOUR_SIZE_T_SIZES (SIZE_T_SIZE<<2) +#define SIX_SIZE_T_SIZES (FOUR_SIZE_T_SIZES+TWO_SIZE_T_SIZES) +#define HALF_MAX_SIZE_T (MAX_SIZE_T / 2U) + +/* The bit mask value corresponding to MALLOC_ALIGNMENT */ +#define CHUNK_ALIGN_MASK (MALLOC_ALIGNMENT - SIZE_T_ONE) + +/* True if address a has acceptable alignment */ +#define is_aligned(A) (((size_t)((A)) & (CHUNK_ALIGN_MASK)) == 0) + +/* the number of bytes to offset an address to align it */ +#define align_offset(A)\ + ((((size_t)(A) & CHUNK_ALIGN_MASK) == 0)? 0 :\ + ((MALLOC_ALIGNMENT - ((size_t)(A) & CHUNK_ALIGN_MASK)) & CHUNK_ALIGN_MASK)) + +/* -------------------------- MMAP preliminaries ------------------------- */ + +/* + If HAVE_MORECORE or HAVE_MMAP are false, we just define calls and + checks to fail so compiler optimizer can delete code rather than + using so many "#if"s. +*/ + + +/* MORECORE and MMAP must return MFAIL on failure */ +#define MFAIL ((void*)(MAX_SIZE_T)) +#define CMFAIL ((char*)(MFAIL)) /* defined for convenience */ + +#if !HAVE_MMAP +#define IS_MMAPPED_BIT (SIZE_T_ZERO) +#define USE_MMAP_BIT (SIZE_T_ZERO) +#define CALL_MMAP(s) MFAIL +#define CALL_MUNMAP(a, s) (-1) +#define DIRECT_MMAP(s) MFAIL + +#else /* HAVE_MMAP */ +#define IS_MMAPPED_BIT (SIZE_T_ONE) +#define USE_MMAP_BIT (SIZE_T_ONE) + +#if !defined(WIN32) && !defined (__OS2__) +#define CALL_MUNMAP(a, s) munmap((a), (s)) +#define MMAP_PROT (PROT_READ|PROT_WRITE) +#if !defined(MAP_ANONYMOUS) && defined(MAP_ANON) +#define MAP_ANONYMOUS MAP_ANON +#endif /* MAP_ANON */ +#ifdef MAP_ANONYMOUS +#define MMAP_FLAGS (MAP_PRIVATE|MAP_ANONYMOUS) +#define CALL_MMAP(s) mmap(0, (s), MMAP_PROT, MMAP_FLAGS, -1, 0) +#else /* MAP_ANONYMOUS */ +/* + Nearly all versions of mmap support MAP_ANONYMOUS, so the following + is unlikely to be needed, but is supplied just in case. +*/ +#define MMAP_FLAGS (MAP_PRIVATE) +static int dev_zero_fd = -1; /* Cached file descriptor for /dev/zero. */ +#define CALL_MMAP(s) ((dev_zero_fd < 0) ? \ + (dev_zero_fd = open("/dev/zero", O_RDWR), \ + mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) : \ + mmap(0, (s), MMAP_PROT, MMAP_FLAGS, dev_zero_fd, 0)) +#endif /* MAP_ANONYMOUS */ + +#define DIRECT_MMAP(s) CALL_MMAP(s) + +#elif defined(__OS2__) + +/* OS/2 MMAP via DosAllocMem */ +static void* os2mmap(size_t size) { + void* ptr; + if (DosAllocMem(&ptr, size, OBJ_ANY|PAG_COMMIT|PAG_READ|PAG_WRITE) && + DosAllocMem(&ptr, size, PAG_COMMIT|PAG_READ|PAG_WRITE)) + return MFAIL; + return ptr; +} + +#define os2direct_mmap(n) os2mmap(n) + +/* This function supports releasing coalesed segments */ +static int os2munmap(void* ptr, size_t size) { + while (size) { + ULONG ulSize = size; + ULONG ulFlags = 0; + if (DosQueryMem(ptr, &ulSize, &ulFlags) != 0) + return -1; + if ((ulFlags & PAG_BASE) == 0 ||(ulFlags & PAG_COMMIT) == 0 || + ulSize > size) + return -1; + if (DosFreeMem(ptr) != 0) + return -1; + ptr = ( void * ) ( ( char * ) ptr + ulSize ); + size -= ulSize; + } + return 0; +} + +#define CALL_MMAP(s) os2mmap(s) +#define CALL_MUNMAP(a, s) os2munmap((a), (s)) +#define DIRECT_MMAP(s) os2direct_mmap(s) + +#else /* WIN32 */ + +/* Win32 MMAP via VirtualAlloc */ +static void* win32mmap(size_t size) { + void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT, PAGE_EXECUTE_READWRITE); + return (ptr != 0)? ptr: MFAIL; +} + +/* For direct MMAP, use MEM_TOP_DOWN to minimize interference */ +static void* win32direct_mmap(size_t size) { + void* ptr = VirtualAlloc(0, size, MEM_RESERVE|MEM_COMMIT|MEM_TOP_DOWN, + PAGE_EXECUTE_READWRITE); + return (ptr != 0)? ptr: MFAIL; +} + +/* This function supports releasing coalesed segments */ +static int win32munmap(void* ptr, size_t size) { + MEMORY_BASIC_INFORMATION minfo; + char* cptr = ptr; + while (size) { + if (VirtualQuery(cptr, &minfo, sizeof(minfo)) == 0) + return -1; + if (minfo.BaseAddress != cptr || minfo.AllocationBase != cptr || + minfo.State != MEM_COMMIT || minfo.RegionSize > size) + return -1; + if (VirtualFree(cptr, 0, MEM_RELEASE) == 0) + return -1; + cptr += minfo.RegionSize; + size -= minfo.RegionSize; + } + return 0; +} + +#define CALL_MMAP(s) win32mmap(s) +#define CALL_MUNMAP(a, s) win32munmap((a), (s)) +#define DIRECT_MMAP(s) win32direct_mmap(s) +#endif /* WIN32 */ +#endif /* HAVE_MMAP */ + +#if HAVE_MMAP && HAVE_MREMAP +#define CALL_MREMAP(addr, osz, nsz, mv) mremap((addr), (osz), (nsz), (mv)) +#else /* HAVE_MMAP && HAVE_MREMAP */ +#define CALL_MREMAP(addr, osz, nsz, mv) MFAIL +#endif /* HAVE_MMAP && HAVE_MREMAP */ + +#if HAVE_MORECORE +#define CALL_MORECORE(S) MORECORE(S) +#else /* HAVE_MORECORE */ +#define CALL_MORECORE(S) MFAIL +#endif /* HAVE_MORECORE */ + +/* mstate bit set if continguous morecore disabled or failed */ +#define USE_NONCONTIGUOUS_BIT (4U) + +/* segment bit set in create_mspace_with_base */ +#define EXTERN_BIT (8U) + + +/* --------------------------- Lock preliminaries ------------------------ */ + +#if USE_LOCKS + +/* + When locks are defined, there are up to two global locks: + + * If HAVE_MORECORE, morecore_mutex protects sequences of calls to + MORECORE. In many cases sys_alloc requires two calls, that should + not be interleaved with calls by other threads. This does not + protect against direct calls to MORECORE by other threads not + using this lock, so there is still code to cope the best we can on + interference. + + * magic_init_mutex ensures that mparams.magic and other + unique mparams values are initialized only once. +*/ + +#if !defined(WIN32) && !defined(__OS2__) +/* By default use posix locks */ +#include +#define MLOCK_T pthread_mutex_t +#define INITIAL_LOCK(l) pthread_mutex_init(l, NULL) +#define ACQUIRE_LOCK(l) pthread_mutex_lock(l) +#define RELEASE_LOCK(l) pthread_mutex_unlock(l) + +#if HAVE_MORECORE +static MLOCK_T morecore_mutex = PTHREAD_MUTEX_INITIALIZER; +#endif /* HAVE_MORECORE */ + +static MLOCK_T magic_init_mutex = PTHREAD_MUTEX_INITIALIZER; + +#elif defined(__OS2__) +#define MLOCK_T HMTX +#define INITIAL_LOCK(l) DosCreateMutexSem(0, l, 0, FALSE) +#define ACQUIRE_LOCK(l) DosRequestMutexSem(*l, SEM_INDEFINITE_WAIT) +#define RELEASE_LOCK(l) DosReleaseMutexSem(*l) +#if HAVE_MORECORE +static MLOCK_T morecore_mutex; +#endif /* HAVE_MORECORE */ +static MLOCK_T magic_init_mutex; + +#else /* WIN32 */ +/* + Because lock-protected regions have bounded times, and there + are no recursive lock calls, we can use simple spinlocks. +*/ + +#define MLOCK_T long +static int win32_acquire_lock (MLOCK_T *sl) { + for (;;) { +#ifdef InterlockedCompareExchangePointer + if (!InterlockedCompareExchange(sl, 1, 0)) + return 0; +#else /* Use older void* version */ + if (!InterlockedCompareExchange((void**)sl, (void*)1, (void*)0)) + return 0; +#endif /* InterlockedCompareExchangePointer */ + Sleep (0); + } +} + +static void win32_release_lock (MLOCK_T *sl) { + InterlockedExchange (sl, 0); +} + +#define INITIAL_LOCK(l) *(l)=0 +#define ACQUIRE_LOCK(l) win32_acquire_lock(l) +#define RELEASE_LOCK(l) win32_release_lock(l) +#if HAVE_MORECORE +static MLOCK_T morecore_mutex; +#endif /* HAVE_MORECORE */ +static MLOCK_T magic_init_mutex; +#endif /* WIN32 */ + +#define USE_LOCK_BIT (2U) +#else /* USE_LOCKS */ +#define USE_LOCK_BIT (0U) +#define INITIAL_LOCK(l) +#endif /* USE_LOCKS */ + +#if USE_LOCKS && HAVE_MORECORE +#define ACQUIRE_MORECORE_LOCK() ACQUIRE_LOCK(&morecore_mutex); +#define RELEASE_MORECORE_LOCK() RELEASE_LOCK(&morecore_mutex); +#else /* USE_LOCKS && HAVE_MORECORE */ +#define ACQUIRE_MORECORE_LOCK() +#define RELEASE_MORECORE_LOCK() +#endif /* USE_LOCKS && HAVE_MORECORE */ + +#if USE_LOCKS +#define ACQUIRE_MAGIC_INIT_LOCK() ACQUIRE_LOCK(&magic_init_mutex); +#define RELEASE_MAGIC_INIT_LOCK() RELEASE_LOCK(&magic_init_mutex); +#else /* USE_LOCKS */ +#define ACQUIRE_MAGIC_INIT_LOCK() +#define RELEASE_MAGIC_INIT_LOCK() +#endif /* USE_LOCKS */ + + +/* ----------------------- Chunk representations ------------------------ */ + +/* + (The following includes lightly edited explanations by Colin Plumb.) + + The malloc_chunk declaration below is misleading (but accurate and + necessary). It declares a "view" into memory allowing access to + necessary fields at known offsets from a given base. + + Chunks of memory are maintained using a `boundary tag' method as + originally described by Knuth. (See the paper by Paul Wilson + ftp://ftp.cs.utexas.edu/pub/garbage/allocsrv.ps for a survey of such + techniques.) Sizes of free chunks are stored both in the front of + each chunk and at the end. This makes consolidating fragmented + chunks into bigger chunks fast. The head fields also hold bits + representing whether chunks are free or in use. + + Here are some pictures to make it clearer. They are "exploded" to + show that the state of a chunk can be thought of as extending from + the high 31 bits of the head field of its header through the + prev_foot and PINUSE_BIT bit of the following chunk header. + + A chunk that's in use looks like: + + chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Size of previous chunk (if P = 1) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P| + | Size of this chunk 1| +-+ + mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | | + +- -+ + | | + +- -+ + | : + +- size - sizeof(size_t) available payload bytes -+ + : | + chunk-> +- -+ + | | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |1| + | Size of next chunk (may or may not be in use) | +-+ + mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + And if it's free, it looks like this: + + chunk-> +- -+ + | User payload (must be in use, or we would have merged!) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |P| + | Size of this chunk 0| +-+ + mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Next pointer | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Prev pointer | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | : + +- size - sizeof(struct chunk) unused bytes -+ + : | + chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Size of this chunk | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |0| + | Size of next chunk (must be in use, or we would have merged)| +-+ + mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | : + +- User payload -+ + : | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + |0| + +-+ + Note that since we always merge adjacent free chunks, the chunks + adjacent to a free chunk must be in use. + + Given a pointer to a chunk (which can be derived trivially from the + payload pointer) we can, in O(1) time, find out whether the adjacent + chunks are free, and if so, unlink them from the lists that they + are on and merge them with the current chunk. + + Chunks always begin on even word boundaries, so the mem portion + (which is returned to the user) is also on an even word boundary, and + thus at least double-word aligned. + + The P (PINUSE_BIT) bit, stored in the unused low-order bit of the + chunk size (which is always a multiple of two words), is an in-use + bit for the *previous* chunk. If that bit is *clear*, then the + word before the current chunk size contains the previous chunk + size, and can be used to find the front of the previous chunk. + The very first chunk allocated always has this bit set, preventing + access to non-existent (or non-owned) memory. If pinuse is set for + any given chunk, then you CANNOT determine the size of the + previous chunk, and might even get a memory addressing fault when + trying to do so. + + The C (CINUSE_BIT) bit, stored in the unused second-lowest bit of + the chunk size redundantly records whether the current chunk is + inuse. This redundancy enables usage checks within free and realloc, + and reduces indirection when freeing and consolidating chunks. + + Each freshly allocated chunk must have both cinuse and pinuse set. + That is, each allocated chunk borders either a previously allocated + and still in-use chunk, or the base of its memory arena. This is + ensured by making all allocations from the the `lowest' part of any + found chunk. Further, no free chunk physically borders another one, + so each free chunk is known to be preceded and followed by either + inuse chunks or the ends of memory. + + Note that the `foot' of the current chunk is actually represented + as the prev_foot of the NEXT chunk. This makes it easier to + deal with alignments etc but can be very confusing when trying + to extend or adapt this code. + + The exceptions to all this are + + 1. The special chunk `top' is the top-most available chunk (i.e., + the one bordering the end of available memory). It is treated + specially. Top is never included in any bin, is used only if + no other chunk is available, and is released back to the + system if it is very large (see M_TRIM_THRESHOLD). In effect, + the top chunk is treated as larger (and thus less well + fitting) than any other available chunk. The top chunk + doesn't update its trailing size field since there is no next + contiguous chunk that would have to index off it. However, + space is still allocated for it (TOP_FOOT_SIZE) to enable + separation or merging when space is extended. + + 3. Chunks allocated via mmap, which have the lowest-order bit + (IS_MMAPPED_BIT) set in their prev_foot fields, and do not set + PINUSE_BIT in their head fields. Because they are allocated + one-by-one, each must carry its own prev_foot field, which is + also used to hold the offset this chunk has within its mmapped + region, which is needed to preserve alignment. Each mmapped + chunk is trailed by the first two fields of a fake next-chunk + for sake of usage checks. + +*/ + +struct malloc_chunk { + size_t prev_foot; /* Size of previous chunk (if free). */ + size_t head; /* Size and inuse bits. */ + struct malloc_chunk* fd; /* double links -- used only if free. */ + struct malloc_chunk* bk; +}; + +typedef struct malloc_chunk mchunk; +typedef struct malloc_chunk* mchunkptr; +typedef struct malloc_chunk* sbinptr; /* The type of bins of chunks */ +typedef unsigned int bindex_t; /* Described below */ +typedef unsigned int binmap_t; /* Described below */ +typedef unsigned int flag_t; /* The type of various bit flag sets */ + +/* ------------------- Chunks sizes and alignments ----------------------- */ + +#define MCHUNK_SIZE (sizeof(mchunk)) + +#if FOOTERS +#define CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) +#else /* FOOTERS */ +#define CHUNK_OVERHEAD (SIZE_T_SIZE) +#endif /* FOOTERS */ + +/* MMapped chunks need a second word of overhead ... */ +#define MMAP_CHUNK_OVERHEAD (TWO_SIZE_T_SIZES) +/* ... and additional padding for fake next-chunk at foot */ +#define MMAP_FOOT_PAD (FOUR_SIZE_T_SIZES) + +/* The smallest size we can malloc is an aligned minimal chunk */ +#define MIN_CHUNK_SIZE\ + ((MCHUNK_SIZE + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) + +/* conversion from malloc headers to user pointers, and back */ +#define chunk2mem(p) ((void*)((char*)(p) + TWO_SIZE_T_SIZES)) +#define mem2chunk(mem) ((mchunkptr)((char*)(mem) - TWO_SIZE_T_SIZES)) +/* chunk associated with aligned address A */ +#define align_as_chunk(A) (mchunkptr)((A) + align_offset(chunk2mem(A))) + +/* Bounds on request (not chunk) sizes. */ +#define MAX_REQUEST ((-MIN_CHUNK_SIZE) << 2) +#define MIN_REQUEST (MIN_CHUNK_SIZE - CHUNK_OVERHEAD - SIZE_T_ONE) + +/* pad request bytes into a usable size */ +#define pad_request(req) \ + (((req) + CHUNK_OVERHEAD + CHUNK_ALIGN_MASK) & ~CHUNK_ALIGN_MASK) + +/* pad request, checking for minimum (but not maximum) */ +#define request2size(req) \ + (((req) < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(req)) + + +/* ------------------ Operations on head and foot fields ----------------- */ + +/* + The head field of a chunk is or'ed with PINUSE_BIT when previous + adjacent chunk in use, and or'ed with CINUSE_BIT if this chunk is in + use. If the chunk was obtained with mmap, the prev_foot field has + IS_MMAPPED_BIT set, otherwise holding the offset of the base of the + mmapped region to the base of the chunk. +*/ + +#define PINUSE_BIT (SIZE_T_ONE) +#define CINUSE_BIT (SIZE_T_TWO) +#define INUSE_BITS (PINUSE_BIT|CINUSE_BIT) + +/* Head value for fenceposts */ +#define FENCEPOST_HEAD (INUSE_BITS|SIZE_T_SIZE) + +/* extraction of fields from head words */ +#define cinuse(p) ((p)->head & CINUSE_BIT) +#define pinuse(p) ((p)->head & PINUSE_BIT) +#define chunksize(p) ((p)->head & ~(INUSE_BITS)) + +#define clear_pinuse(p) ((p)->head &= ~PINUSE_BIT) +#define clear_cinuse(p) ((p)->head &= ~CINUSE_BIT) + +/* Treat space at ptr +/- offset as a chunk */ +#define chunk_plus_offset(p, s) ((mchunkptr)(((char*)(p)) + (s))) +#define chunk_minus_offset(p, s) ((mchunkptr)(((char*)(p)) - (s))) + +/* Ptr to next or previous physical malloc_chunk. */ +#define next_chunk(p) ((mchunkptr)( ((char*)(p)) + ((p)->head & ~INUSE_BITS))) +#define prev_chunk(p) ((mchunkptr)( ((char*)(p)) - ((p)->prev_foot) )) + +/* extract next chunk's pinuse bit */ +#define next_pinuse(p) ((next_chunk(p)->head) & PINUSE_BIT) + +/* Get/set size at footer */ +#define get_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot) +#define set_foot(p, s) (((mchunkptr)((char*)(p) + (s)))->prev_foot = (s)) + +/* Set size, pinuse bit, and foot */ +#define set_size_and_pinuse_of_free_chunk(p, s)\ + ((p)->head = (s|PINUSE_BIT), set_foot(p, s)) + +/* Set size, pinuse bit, foot, and clear next pinuse */ +#define set_free_with_pinuse(p, s, n)\ + (clear_pinuse(n), set_size_and_pinuse_of_free_chunk(p, s)) + +#define is_mmapped(p)\ + (!((p)->head & PINUSE_BIT) && ((p)->prev_foot & IS_MMAPPED_BIT)) + +/* Get the internal overhead associated with chunk p */ +#define overhead_for(p)\ + (is_mmapped(p)? MMAP_CHUNK_OVERHEAD : CHUNK_OVERHEAD) + +/* Return true if malloced space is not necessarily cleared */ +#if MMAP_CLEARS +#define calloc_must_clear(p) (!is_mmapped(p)) +#else /* MMAP_CLEARS */ +#define calloc_must_clear(p) (1) +#endif /* MMAP_CLEARS */ + +/* ---------------------- Overlaid data structures ----------------------- */ + +/* + When chunks are not in use, they are treated as nodes of either + lists or trees. + + "Small" chunks are stored in circular doubly-linked lists, and look + like this: + + chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Size of previous chunk | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + `head:' | Size of chunk, in bytes |P| + mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Forward pointer to next chunk in list | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Back pointer to previous chunk in list | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Unused space (may be 0 bytes long) . + . . + . | +nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + `foot:' | Size of chunk, in bytes | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + Larger chunks are kept in a form of bitwise digital trees (aka + tries) keyed on chunksizes. Because malloc_tree_chunks are only for + free chunks greater than 256 bytes, their size doesn't impose any + constraints on user chunk sizes. Each node looks like: + + chunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Size of previous chunk | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + `head:' | Size of chunk, in bytes |P| + mem-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Forward pointer to next chunk of same size | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Back pointer to previous chunk of same size | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Pointer to left child (child[0]) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Pointer to right child (child[1]) | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Pointer to parent | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | bin index of this chunk | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + | Unused space . + . | +nextchunk-> +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + `foot:' | Size of chunk, in bytes | + +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ + + Each tree holding treenodes is a tree of unique chunk sizes. Chunks + of the same size are arranged in a circularly-linked list, with only + the oldest chunk (the next to be used, in our FIFO ordering) + actually in the tree. (Tree members are distinguished by a non-null + parent pointer.) If a chunk with the same size an an existing node + is inserted, it is linked off the existing node using pointers that + work in the same way as fd/bk pointers of small chunks. + + Each tree contains a power of 2 sized range of chunk sizes (the + smallest is 0x100 <= x < 0x180), which is is divided in half at each + tree level, with the chunks in the smaller half of the range (0x100 + <= x < 0x140 for the top nose) in the left subtree and the larger + half (0x140 <= x < 0x180) in the right subtree. This is, of course, + done by inspecting individual bits. + + Using these rules, each node's left subtree contains all smaller + sizes than its right subtree. However, the node at the root of each + subtree has no particular ordering relationship to either. (The + dividing line between the subtree sizes is based on trie relation.) + If we remove the last chunk of a given size from the interior of the + tree, we need to replace it with a leaf node. The tree ordering + rules permit a node to be replaced by any leaf below it. + + The smallest chunk in a tree (a common operation in a best-fit + allocator) can be found by walking a path to the leftmost leaf in + the tree. Unlike a usual binary tree, where we follow left child + pointers until we reach a null, here we follow the right child + pointer any time the left one is null, until we reach a leaf with + both child pointers null. The smallest chunk in the tree will be + somewhere along that path. + + The worst case number of steps to add, find, or remove a node is + bounded by the number of bits differentiating chunks within + bins. Under current bin calculations, this ranges from 6 up to 21 + (for 32 bit sizes) or up to 53 (for 64 bit sizes). The typical case + is of course much better. +*/ + +struct malloc_tree_chunk { + /* The first four fields must be compatible with malloc_chunk */ + size_t prev_foot; + size_t head; + struct malloc_tree_chunk* fd; + struct malloc_tree_chunk* bk; + + struct malloc_tree_chunk* child[2]; + struct malloc_tree_chunk* parent; + bindex_t index; +}; + +typedef struct malloc_tree_chunk tchunk; +typedef struct malloc_tree_chunk* tchunkptr; +typedef struct malloc_tree_chunk* tbinptr; /* The type of bins of trees */ + +/* A little helper macro for trees */ +#define leftmost_child(t) ((t)->child[0] != 0? (t)->child[0] : (t)->child[1]) + +/* ----------------------------- Segments -------------------------------- */ + +/* + Each malloc space may include non-contiguous segments, held in a + list headed by an embedded malloc_segment record representing the + top-most space. Segments also include flags holding properties of + the space. Large chunks that are directly allocated by mmap are not + included in this list. They are instead independently created and + destroyed without otherwise keeping track of them. + + Segment management mainly comes into play for spaces allocated by + MMAP. Any call to MMAP might or might not return memory that is + adjacent to an existing segment. MORECORE normally contiguously + extends the current space, so this space is almost always adjacent, + which is simpler and faster to deal with. (This is why MORECORE is + used preferentially to MMAP when both are available -- see + sys_alloc.) When allocating using MMAP, we don't use any of the + hinting mechanisms (inconsistently) supported in various + implementations of unix mmap, or distinguish reserving from + committing memory. Instead, we just ask for space, and exploit + contiguity when we get it. It is probably possible to do + better than this on some systems, but no general scheme seems + to be significantly better. + + Management entails a simpler variant of the consolidation scheme + used for chunks to reduce fragmentation -- new adjacent memory is + normally prepended or appended to an existing segment. However, + there are limitations compared to chunk consolidation that mostly + reflect the fact that segment processing is relatively infrequent + (occurring only when getting memory from system) and that we + don't expect to have huge numbers of segments: + + * Segments are not indexed, so traversal requires linear scans. (It + would be possible to index these, but is not worth the extra + overhead and complexity for most programs on most platforms.) + * New segments are only appended to old ones when holding top-most + memory; if they cannot be prepended to others, they are held in + different segments. + + Except for the top-most segment of an mstate, each segment record + is kept at the tail of its segment. Segments are added by pushing + segment records onto the list headed by &mstate.seg for the + containing mstate. + + Segment flags control allocation/merge/deallocation policies: + * If EXTERN_BIT set, then we did not allocate this segment, + and so should not try to deallocate or merge with others. + (This currently holds only for the initial segment passed + into create_mspace_with_base.) + * If IS_MMAPPED_BIT set, the segment may be merged with + other surrounding mmapped segments and trimmed/de-allocated + using munmap. + * If neither bit is set, then the segment was obtained using + MORECORE so can be merged with surrounding MORECORE'd segments + and deallocated/trimmed using MORECORE with negative arguments. +*/ + +struct malloc_segment { + char* base; /* base address */ + size_t size; /* allocated size */ + struct malloc_segment* next; /* ptr to next segment */ +#if FFI_MMAP_EXEC_WRIT + /* The mmap magic is supposed to store the address of the executable + segment at the very end of the requested block. */ + +# define mmap_exec_offset(b,s) (*(ptrdiff_t*)((b)+(s)-sizeof(ptrdiff_t))) + + /* We can only merge segments if their corresponding executable + segments are at identical offsets. */ +# define check_segment_merge(S,b,s) \ + (mmap_exec_offset((b),(s)) == (S)->exec_offset) + +# define add_segment_exec_offset(p,S) ((char*)(p) + (S)->exec_offset) +# define sub_segment_exec_offset(p,S) ((char*)(p) - (S)->exec_offset) + + /* The removal of sflags only works with HAVE_MORECORE == 0. */ + +# define get_segment_flags(S) (IS_MMAPPED_BIT) +# define set_segment_flags(S,v) \ + (((v) != IS_MMAPPED_BIT) ? (ABORT, (v)) : \ + (((S)->exec_offset = \ + mmap_exec_offset((S)->base, (S)->size)), \ + (mmap_exec_offset((S)->base + (S)->exec_offset, (S)->size) != \ + (S)->exec_offset) ? (ABORT, (v)) : \ + (mmap_exec_offset((S)->base, (S)->size) = 0), (v))) + + /* We use an offset here, instead of a pointer, because then, when + base changes, we don't have to modify this. On architectures + with segmented addresses, this might not work. */ + ptrdiff_t exec_offset; +#else + +# define get_segment_flags(S) ((S)->sflags) +# define set_segment_flags(S,v) ((S)->sflags = (v)) +# define check_segment_merge(S,b,s) (1) + + flag_t sflags; /* mmap and extern flag */ +#endif +}; + +#define is_mmapped_segment(S) (get_segment_flags(S) & IS_MMAPPED_BIT) +#define is_extern_segment(S) (get_segment_flags(S) & EXTERN_BIT) + +typedef struct malloc_segment msegment; +typedef struct malloc_segment* msegmentptr; + +/* ---------------------------- malloc_state ----------------------------- */ + +/* + A malloc_state holds all of the bookkeeping for a space. + The main fields are: + + Top + The topmost chunk of the currently active segment. Its size is + cached in topsize. The actual size of topmost space is + topsize+TOP_FOOT_SIZE, which includes space reserved for adding + fenceposts and segment records if necessary when getting more + space from the system. The size at which to autotrim top is + cached from mparams in trim_check, except that it is disabled if + an autotrim fails. + + Designated victim (dv) + This is the preferred chunk for servicing small requests that + don't have exact fits. It is normally the chunk split off most + recently to service another small request. Its size is cached in + dvsize. The link fields of this chunk are not maintained since it + is not kept in a bin. + + SmallBins + An array of bin headers for free chunks. These bins hold chunks + with sizes less than MIN_LARGE_SIZE bytes. Each bin contains + chunks of all the same size, spaced 8 bytes apart. To simplify + use in double-linked lists, each bin header acts as a malloc_chunk + pointing to the real first node, if it exists (else pointing to + itself). This avoids special-casing for headers. But to avoid + waste, we allocate only the fd/bk pointers of bins, and then use + repositioning tricks to treat these as the fields of a chunk. + + TreeBins + Treebins are pointers to the roots of trees holding a range of + sizes. There are 2 equally spaced treebins for each power of two + from TREE_SHIFT to TREE_SHIFT+16. The last bin holds anything + larger. + + Bin maps + There is one bit map for small bins ("smallmap") and one for + treebins ("treemap). Each bin sets its bit when non-empty, and + clears the bit when empty. Bit operations are then used to avoid + bin-by-bin searching -- nearly all "search" is done without ever + looking at bins that won't be selected. The bit maps + conservatively use 32 bits per map word, even if on 64bit system. + For a good description of some of the bit-based techniques used + here, see Henry S. Warren Jr's book "Hacker's Delight" (and + supplement at http://hackersdelight.org/). Many of these are + intended to reduce the branchiness of paths through malloc etc, as + well as to reduce the number of memory locations read or written. + + Segments + A list of segments headed by an embedded malloc_segment record + representing the initial space. + + Address check support + The least_addr field is the least address ever obtained from + MORECORE or MMAP. Attempted frees and reallocs of any address less + than this are trapped (unless INSECURE is defined). + + Magic tag + A cross-check field that should always hold same value as mparams.magic. + + Flags + Bits recording whether to use MMAP, locks, or contiguous MORECORE + + Statistics + Each space keeps track of current and maximum system memory + obtained via MORECORE or MMAP. + + Locking + If USE_LOCKS is defined, the "mutex" lock is acquired and released + around every public call using this mspace. +*/ + +/* Bin types, widths and sizes */ +#define NSMALLBINS (32U) +#define NTREEBINS (32U) +#define SMALLBIN_SHIFT (3U) +#define SMALLBIN_WIDTH (SIZE_T_ONE << SMALLBIN_SHIFT) +#define TREEBIN_SHIFT (8U) +#define MIN_LARGE_SIZE (SIZE_T_ONE << TREEBIN_SHIFT) +#define MAX_SMALL_SIZE (MIN_LARGE_SIZE - SIZE_T_ONE) +#define MAX_SMALL_REQUEST (MAX_SMALL_SIZE - CHUNK_ALIGN_MASK - CHUNK_OVERHEAD) + +struct malloc_state { + binmap_t smallmap; + binmap_t treemap; + size_t dvsize; + size_t topsize; + char* least_addr; + mchunkptr dv; + mchunkptr top; + size_t trim_check; + size_t magic; + mchunkptr smallbins[(NSMALLBINS+1)*2]; + tbinptr treebins[NTREEBINS]; + size_t footprint; + size_t max_footprint; + flag_t mflags; +#if USE_LOCKS + MLOCK_T mutex; /* locate lock among fields that rarely change */ +#endif /* USE_LOCKS */ + msegment seg; +}; + +typedef struct malloc_state* mstate; + +/* ------------- Global malloc_state and malloc_params ------------------- */ + +/* + malloc_params holds global properties, including those that can be + dynamically set using mallopt. There is a single instance, mparams, + initialized in init_mparams. +*/ + +struct malloc_params { + size_t magic; + size_t page_size; + size_t granularity; + size_t mmap_threshold; + size_t trim_threshold; + flag_t default_mflags; +}; + +static struct malloc_params mparams; + +/* The global malloc_state used for all non-"mspace" calls */ +static struct malloc_state _gm_; +#define gm (&_gm_) +#define is_global(M) ((M) == &_gm_) +#define is_initialized(M) ((M)->top != 0) + +/* -------------------------- system alloc setup ------------------------- */ + +/* Operations on mflags */ + +#define use_lock(M) ((M)->mflags & USE_LOCK_BIT) +#define enable_lock(M) ((M)->mflags |= USE_LOCK_BIT) +#define disable_lock(M) ((M)->mflags &= ~USE_LOCK_BIT) + +#define use_mmap(M) ((M)->mflags & USE_MMAP_BIT) +#define enable_mmap(M) ((M)->mflags |= USE_MMAP_BIT) +#define disable_mmap(M) ((M)->mflags &= ~USE_MMAP_BIT) + +#define use_noncontiguous(M) ((M)->mflags & USE_NONCONTIGUOUS_BIT) +#define disable_contiguous(M) ((M)->mflags |= USE_NONCONTIGUOUS_BIT) + +#define set_lock(M,L)\ + ((M)->mflags = (L)?\ + ((M)->mflags | USE_LOCK_BIT) :\ + ((M)->mflags & ~USE_LOCK_BIT)) + +/* page-align a size */ +#define page_align(S)\ + (((S) + (mparams.page_size)) & ~(mparams.page_size - SIZE_T_ONE)) + +/* granularity-align a size */ +#define granularity_align(S)\ + (((S) + (mparams.granularity)) & ~(mparams.granularity - SIZE_T_ONE)) + +#define is_page_aligned(S)\ + (((size_t)(S) & (mparams.page_size - SIZE_T_ONE)) == 0) +#define is_granularity_aligned(S)\ + (((size_t)(S) & (mparams.granularity - SIZE_T_ONE)) == 0) + +/* True if segment S holds address A */ +#define segment_holds(S, A)\ + ((char*)(A) >= S->base && (char*)(A) < S->base + S->size) + +/* Return segment holding given address */ +static msegmentptr segment_holding(mstate m, char* addr) { + msegmentptr sp = &m->seg; + for (;;) { + if (addr >= sp->base && addr < sp->base + sp->size) + return sp; + if ((sp = sp->next) == 0) + return 0; + } +} + +/* Return true if segment contains a segment link */ +static int has_segment_link(mstate m, msegmentptr ss) { + msegmentptr sp = &m->seg; + for (;;) { + if ((char*)sp >= ss->base && (char*)sp < ss->base + ss->size) + return 1; + if ((sp = sp->next) == 0) + return 0; + } +} + +#ifndef MORECORE_CANNOT_TRIM +#define should_trim(M,s) ((s) > (M)->trim_check) +#else /* MORECORE_CANNOT_TRIM */ +#define should_trim(M,s) (0) +#endif /* MORECORE_CANNOT_TRIM */ + +/* + TOP_FOOT_SIZE is padding at the end of a segment, including space + that may be needed to place segment records and fenceposts when new + noncontiguous segments are added. +*/ +#define TOP_FOOT_SIZE\ + (align_offset(chunk2mem(0))+pad_request(sizeof(struct malloc_segment))+MIN_CHUNK_SIZE) + + +/* ------------------------------- Hooks -------------------------------- */ + +/* + PREACTION should be defined to return 0 on success, and nonzero on + failure. If you are not using locking, you can redefine these to do + anything you like. +*/ + +#if USE_LOCKS + +/* Ensure locks are initialized */ +#define GLOBALLY_INITIALIZE() (mparams.page_size == 0 && init_mparams()) + +#define PREACTION(M) ((GLOBALLY_INITIALIZE() || use_lock(M))? ACQUIRE_LOCK(&(M)->mutex) : 0) +#define POSTACTION(M) { if (use_lock(M)) RELEASE_LOCK(&(M)->mutex); } +#else /* USE_LOCKS */ + +#ifndef PREACTION +#define PREACTION(M) (0) +#endif /* PREACTION */ + +#ifndef POSTACTION +#define POSTACTION(M) +#endif /* POSTACTION */ + +#endif /* USE_LOCKS */ + +/* + CORRUPTION_ERROR_ACTION is triggered upon detected bad addresses. + USAGE_ERROR_ACTION is triggered on detected bad frees and + reallocs. The argument p is an address that might have triggered the + fault. It is ignored by the two predefined actions, but might be + useful in custom actions that try to help diagnose errors. +*/ + +#if PROCEED_ON_ERROR + +/* A count of the number of corruption errors causing resets */ +int malloc_corruption_error_count; + +/* default corruption action */ +static void reset_on_error(mstate m); + +#define CORRUPTION_ERROR_ACTION(m) reset_on_error(m) +#define USAGE_ERROR_ACTION(m, p) + +#else /* PROCEED_ON_ERROR */ + +#ifndef CORRUPTION_ERROR_ACTION +#define CORRUPTION_ERROR_ACTION(m) ABORT +#endif /* CORRUPTION_ERROR_ACTION */ + +#ifndef USAGE_ERROR_ACTION +#define USAGE_ERROR_ACTION(m,p) ABORT +#endif /* USAGE_ERROR_ACTION */ + +#endif /* PROCEED_ON_ERROR */ + +/* -------------------------- Debugging setup ---------------------------- */ + +#if ! DEBUG + +#define check_free_chunk(M,P) +#define check_inuse_chunk(M,P) +#define check_malloced_chunk(M,P,N) +#define check_mmapped_chunk(M,P) +#define check_malloc_state(M) +#define check_top_chunk(M,P) + +#else /* DEBUG */ +#define check_free_chunk(M,P) do_check_free_chunk(M,P) +#define check_inuse_chunk(M,P) do_check_inuse_chunk(M,P) +#define check_top_chunk(M,P) do_check_top_chunk(M,P) +#define check_malloced_chunk(M,P,N) do_check_malloced_chunk(M,P,N) +#define check_mmapped_chunk(M,P) do_check_mmapped_chunk(M,P) +#define check_malloc_state(M) do_check_malloc_state(M) + +static void do_check_any_chunk(mstate m, mchunkptr p); +static void do_check_top_chunk(mstate m, mchunkptr p); +static void do_check_mmapped_chunk(mstate m, mchunkptr p); +static void do_check_inuse_chunk(mstate m, mchunkptr p); +static void do_check_free_chunk(mstate m, mchunkptr p); +static void do_check_malloced_chunk(mstate m, void* mem, size_t s); +static void do_check_tree(mstate m, tchunkptr t); +static void do_check_treebin(mstate m, bindex_t i); +static void do_check_smallbin(mstate m, bindex_t i); +static void do_check_malloc_state(mstate m); +static int bin_find(mstate m, mchunkptr x); +static size_t traverse_and_check(mstate m); +#endif /* DEBUG */ + +/* ---------------------------- Indexing Bins ---------------------------- */ + +#define is_small(s) (((s) >> SMALLBIN_SHIFT) < NSMALLBINS) +#define small_index(s) ((s) >> SMALLBIN_SHIFT) +#define small_index2size(i) ((i) << SMALLBIN_SHIFT) +#define MIN_SMALL_INDEX (small_index(MIN_CHUNK_SIZE)) + +/* addressing by index. See above about smallbin repositioning */ +#define smallbin_at(M, i) ((sbinptr)((char*)&((M)->smallbins[(i)<<1]))) +#define treebin_at(M,i) (&((M)->treebins[i])) + +/* assign tree index for size S to variable I */ +#if defined(__GNUC__) && defined(i386) +#define compute_tree_index(S, I)\ +{\ + size_t X = S >> TREEBIN_SHIFT;\ + if (X == 0)\ + I = 0;\ + else if (X > 0xFFFF)\ + I = NTREEBINS-1;\ + else {\ + unsigned int K;\ + __asm__("bsrl %1,%0\n\t" : "=r" (K) : "rm" (X));\ + I = (bindex_t)((K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1)));\ + }\ +} +#else /* GNUC */ +#define compute_tree_index(S, I)\ +{\ + size_t X = S >> TREEBIN_SHIFT;\ + if (X == 0)\ + I = 0;\ + else if (X > 0xFFFF)\ + I = NTREEBINS-1;\ + else {\ + unsigned int Y = (unsigned int)X;\ + unsigned int N = ((Y - 0x100) >> 16) & 8;\ + unsigned int K = (((Y <<= N) - 0x1000) >> 16) & 4;\ + N += K;\ + N += K = (((Y <<= K) - 0x4000) >> 16) & 2;\ + K = 14 - N + ((Y <<= K) >> 15);\ + I = (K << 1) + ((S >> (K + (TREEBIN_SHIFT-1)) & 1));\ + }\ +} +#endif /* GNUC */ + +/* Bit representing maximum resolved size in a treebin at i */ +#define bit_for_tree_index(i) \ + (i == NTREEBINS-1)? (SIZE_T_BITSIZE-1) : (((i) >> 1) + TREEBIN_SHIFT - 2) + +/* Shift placing maximum resolved bit in a treebin at i as sign bit */ +#define leftshift_for_tree_index(i) \ + ((i == NTREEBINS-1)? 0 : \ + ((SIZE_T_BITSIZE-SIZE_T_ONE) - (((i) >> 1) + TREEBIN_SHIFT - 2))) + +/* The size of the smallest chunk held in bin with index i */ +#define minsize_for_tree_index(i) \ + ((SIZE_T_ONE << (((i) >> 1) + TREEBIN_SHIFT)) | \ + (((size_t)((i) & SIZE_T_ONE)) << (((i) >> 1) + TREEBIN_SHIFT - 1))) + + +/* ------------------------ Operations on bin maps ----------------------- */ + +/* bit corresponding to given index */ +#define idx2bit(i) ((binmap_t)(1) << (i)) + +/* Mark/Clear bits with given index */ +#define mark_smallmap(M,i) ((M)->smallmap |= idx2bit(i)) +#define clear_smallmap(M,i) ((M)->smallmap &= ~idx2bit(i)) +#define smallmap_is_marked(M,i) ((M)->smallmap & idx2bit(i)) + +#define mark_treemap(M,i) ((M)->treemap |= idx2bit(i)) +#define clear_treemap(M,i) ((M)->treemap &= ~idx2bit(i)) +#define treemap_is_marked(M,i) ((M)->treemap & idx2bit(i)) + +/* index corresponding to given bit */ + +#if defined(__GNUC__) && defined(i386) +#define compute_bit2idx(X, I)\ +{\ + unsigned int J;\ + __asm__("bsfl %1,%0\n\t" : "=r" (J) : "rm" (X));\ + I = (bindex_t)J;\ +} + +#else /* GNUC */ +#if USE_BUILTIN_FFS +#define compute_bit2idx(X, I) I = ffs(X)-1 + +#else /* USE_BUILTIN_FFS */ +#define compute_bit2idx(X, I)\ +{\ + unsigned int Y = X - 1;\ + unsigned int K = Y >> (16-4) & 16;\ + unsigned int N = K; Y >>= K;\ + N += K = Y >> (8-3) & 8; Y >>= K;\ + N += K = Y >> (4-2) & 4; Y >>= K;\ + N += K = Y >> (2-1) & 2; Y >>= K;\ + N += K = Y >> (1-0) & 1; Y >>= K;\ + I = (bindex_t)(N + Y);\ +} +#endif /* USE_BUILTIN_FFS */ +#endif /* GNUC */ + +/* isolate the least set bit of a bitmap */ +#define least_bit(x) ((x) & -(x)) + +/* mask with all bits to left of least bit of x on */ +#define left_bits(x) ((x<<1) | -(x<<1)) + +/* mask with all bits to left of or equal to least bit of x on */ +#define same_or_left_bits(x) ((x) | -(x)) + + +/* ----------------------- Runtime Check Support ------------------------- */ + +/* + For security, the main invariant is that malloc/free/etc never + writes to a static address other than malloc_state, unless static + malloc_state itself has been corrupted, which cannot occur via + malloc (because of these checks). In essence this means that we + believe all pointers, sizes, maps etc held in malloc_state, but + check all of those linked or offsetted from other embedded data + structures. These checks are interspersed with main code in a way + that tends to minimize their run-time cost. + + When FOOTERS is defined, in addition to range checking, we also + verify footer fields of inuse chunks, which can be used guarantee + that the mstate controlling malloc/free is intact. This is a + streamlined version of the approach described by William Robertson + et al in "Run-time Detection of Heap-based Overflows" LISA'03 + http://www.usenix.org/events/lisa03/tech/robertson.html The footer + of an inuse chunk holds the xor of its mstate and a random seed, + that is checked upon calls to free() and realloc(). This is + (probablistically) unguessable from outside the program, but can be + computed by any code successfully malloc'ing any chunk, so does not + itself provide protection against code that has already broken + security through some other means. Unlike Robertson et al, we + always dynamically check addresses of all offset chunks (previous, + next, etc). This turns out to be cheaper than relying on hashes. +*/ + +#if !INSECURE +/* Check if address a is at least as high as any from MORECORE or MMAP */ +#define ok_address(M, a) ((char*)(a) >= (M)->least_addr) +/* Check if address of next chunk n is higher than base chunk p */ +#define ok_next(p, n) ((char*)(p) < (char*)(n)) +/* Check if p has its cinuse bit on */ +#define ok_cinuse(p) cinuse(p) +/* Check if p has its pinuse bit on */ +#define ok_pinuse(p) pinuse(p) + +#else /* !INSECURE */ +#define ok_address(M, a) (1) +#define ok_next(b, n) (1) +#define ok_cinuse(p) (1) +#define ok_pinuse(p) (1) +#endif /* !INSECURE */ + +#if (FOOTERS && !INSECURE) +/* Check if (alleged) mstate m has expected magic field */ +#define ok_magic(M) ((M)->magic == mparams.magic) +#else /* (FOOTERS && !INSECURE) */ +#define ok_magic(M) (1) +#endif /* (FOOTERS && !INSECURE) */ + + +/* In gcc, use __builtin_expect to minimize impact of checks */ +#if !INSECURE +#if defined(__GNUC__) && __GNUC__ >= 3 +#define RTCHECK(e) __builtin_expect(e, 1) +#else /* GNUC */ +#define RTCHECK(e) (e) +#endif /* GNUC */ +#else /* !INSECURE */ +#define RTCHECK(e) (1) +#endif /* !INSECURE */ + +/* macros to set up inuse chunks with or without footers */ + +#if !FOOTERS + +#define mark_inuse_foot(M,p,s) + +/* Set cinuse bit and pinuse bit of next chunk */ +#define set_inuse(M,p,s)\ + ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\ + ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT) + +/* Set cinuse and pinuse of this chunk and pinuse of next chunk */ +#define set_inuse_and_pinuse(M,p,s)\ + ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ + ((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT) + +/* Set size, cinuse and pinuse bit of this chunk */ +#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\ + ((p)->head = (s|PINUSE_BIT|CINUSE_BIT)) + +#else /* FOOTERS */ + +/* Set foot of inuse chunk to be xor of mstate and seed */ +#define mark_inuse_foot(M,p,s)\ + (((mchunkptr)((char*)(p) + (s)))->prev_foot = ((size_t)(M) ^ mparams.magic)) + +#define get_mstate_for(p)\ + ((mstate)(((mchunkptr)((char*)(p) +\ + (chunksize(p))))->prev_foot ^ mparams.magic)) + +#define set_inuse(M,p,s)\ + ((p)->head = (((p)->head & PINUSE_BIT)|s|CINUSE_BIT),\ + (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT), \ + mark_inuse_foot(M,p,s)) + +#define set_inuse_and_pinuse(M,p,s)\ + ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ + (((mchunkptr)(((char*)(p)) + (s)))->head |= PINUSE_BIT),\ + mark_inuse_foot(M,p,s)) + +#define set_size_and_pinuse_of_inuse_chunk(M, p, s)\ + ((p)->head = (s|PINUSE_BIT|CINUSE_BIT),\ + mark_inuse_foot(M, p, s)) + +#endif /* !FOOTERS */ + +/* ---------------------------- setting mparams -------------------------- */ + +/* Initialize mparams */ +static int init_mparams(void) { + if (mparams.page_size == 0) { + size_t s; + + mparams.mmap_threshold = DEFAULT_MMAP_THRESHOLD; + mparams.trim_threshold = DEFAULT_TRIM_THRESHOLD; +#if MORECORE_CONTIGUOUS + mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT; +#else /* MORECORE_CONTIGUOUS */ + mparams.default_mflags = USE_LOCK_BIT|USE_MMAP_BIT|USE_NONCONTIGUOUS_BIT; +#endif /* MORECORE_CONTIGUOUS */ + +#if (FOOTERS && !INSECURE) + { +#if USE_DEV_RANDOM + int fd; + unsigned char buf[sizeof(size_t)]; + /* Try to use /dev/urandom, else fall back on using time */ + if ((fd = open("/dev/urandom", O_RDONLY)) >= 0 && + read(fd, buf, sizeof(buf)) == sizeof(buf)) { + s = *((size_t *) buf); + close(fd); + } + else +#endif /* USE_DEV_RANDOM */ + s = (size_t)(time(0) ^ (size_t)0x55555555U); + + s |= (size_t)8U; /* ensure nonzero */ + s &= ~(size_t)7U; /* improve chances of fault for bad values */ + + } +#else /* (FOOTERS && !INSECURE) */ + s = (size_t)0x58585858U; +#endif /* (FOOTERS && !INSECURE) */ + ACQUIRE_MAGIC_INIT_LOCK(); + if (mparams.magic == 0) { + mparams.magic = s; + /* Set up lock for main malloc area */ + INITIAL_LOCK(&gm->mutex); + gm->mflags = mparams.default_mflags; + } + RELEASE_MAGIC_INIT_LOCK(); + +#if !defined(WIN32) && !defined(__OS2__) + mparams.page_size = malloc_getpagesize; + mparams.granularity = ((DEFAULT_GRANULARITY != 0)? + DEFAULT_GRANULARITY : mparams.page_size); +#elif defined (__OS2__) + /* if low-memory is used, os2munmap() would break + if it were anything other than 64k */ + mparams.page_size = 4096u; + mparams.granularity = 65536u; +#else /* WIN32 */ + { + SYSTEM_INFO system_info; + GetSystemInfo(&system_info); + mparams.page_size = system_info.dwPageSize; + mparams.granularity = system_info.dwAllocationGranularity; + } +#endif /* WIN32 */ + + /* Sanity-check configuration: + size_t must be unsigned and as wide as pointer type. + ints must be at least 4 bytes. + alignment must be at least 8. + Alignment, min chunk size, and page size must all be powers of 2. + */ + if ((sizeof(size_t) != sizeof(char*)) || + (MAX_SIZE_T < MIN_CHUNK_SIZE) || + (sizeof(int) < 4) || + (MALLOC_ALIGNMENT < (size_t)8U) || + ((MALLOC_ALIGNMENT & (MALLOC_ALIGNMENT-SIZE_T_ONE)) != 0) || + ((MCHUNK_SIZE & (MCHUNK_SIZE-SIZE_T_ONE)) != 0) || + ((mparams.granularity & (mparams.granularity-SIZE_T_ONE)) != 0) || + ((mparams.page_size & (mparams.page_size-SIZE_T_ONE)) != 0)) + ABORT; + } + return 0; +} + +/* support for mallopt */ +static int change_mparam(int param_number, int value) { + size_t val = (size_t)value; + init_mparams(); + switch(param_number) { + case M_TRIM_THRESHOLD: + mparams.trim_threshold = val; + return 1; + case M_GRANULARITY: + if (val >= mparams.page_size && ((val & (val-1)) == 0)) { + mparams.granularity = val; + return 1; + } + else + return 0; + case M_MMAP_THRESHOLD: + mparams.mmap_threshold = val; + return 1; + default: + return 0; + } +} + +#if DEBUG +/* ------------------------- Debugging Support --------------------------- */ + +/* Check properties of any chunk, whether free, inuse, mmapped etc */ +static void do_check_any_chunk(mstate m, mchunkptr p) { + assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); + assert(ok_address(m, p)); +} + +/* Check properties of top chunk */ +static void do_check_top_chunk(mstate m, mchunkptr p) { + msegmentptr sp = segment_holding(m, (char*)p); + size_t sz = chunksize(p); + assert(sp != 0); + assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); + assert(ok_address(m, p)); + assert(sz == m->topsize); + assert(sz > 0); + assert(sz == ((sp->base + sp->size) - (char*)p) - TOP_FOOT_SIZE); + assert(pinuse(p)); + assert(!next_pinuse(p)); +} + +/* Check properties of (inuse) mmapped chunks */ +static void do_check_mmapped_chunk(mstate m, mchunkptr p) { + size_t sz = chunksize(p); + size_t len = (sz + (p->prev_foot & ~IS_MMAPPED_BIT) + MMAP_FOOT_PAD); + assert(is_mmapped(p)); + assert(use_mmap(m)); + assert((is_aligned(chunk2mem(p))) || (p->head == FENCEPOST_HEAD)); + assert(ok_address(m, p)); + assert(!is_small(sz)); + assert((len & (mparams.page_size-SIZE_T_ONE)) == 0); + assert(chunk_plus_offset(p, sz)->head == FENCEPOST_HEAD); + assert(chunk_plus_offset(p, sz+SIZE_T_SIZE)->head == 0); +} + +/* Check properties of inuse chunks */ +static void do_check_inuse_chunk(mstate m, mchunkptr p) { + do_check_any_chunk(m, p); + assert(cinuse(p)); + assert(next_pinuse(p)); + /* If not pinuse and not mmapped, previous chunk has OK offset */ + assert(is_mmapped(p) || pinuse(p) || next_chunk(prev_chunk(p)) == p); + if (is_mmapped(p)) + do_check_mmapped_chunk(m, p); +} + +/* Check properties of free chunks */ +static void do_check_free_chunk(mstate m, mchunkptr p) { + size_t sz = p->head & ~(PINUSE_BIT|CINUSE_BIT); + mchunkptr next = chunk_plus_offset(p, sz); + do_check_any_chunk(m, p); + assert(!cinuse(p)); + assert(!next_pinuse(p)); + assert (!is_mmapped(p)); + if (p != m->dv && p != m->top) { + if (sz >= MIN_CHUNK_SIZE) { + assert((sz & CHUNK_ALIGN_MASK) == 0); + assert(is_aligned(chunk2mem(p))); + assert(next->prev_foot == sz); + assert(pinuse(p)); + assert (next == m->top || cinuse(next)); + assert(p->fd->bk == p); + assert(p->bk->fd == p); + } + else /* markers are always of size SIZE_T_SIZE */ + assert(sz == SIZE_T_SIZE); + } +} + +/* Check properties of malloced chunks at the point they are malloced */ +static void do_check_malloced_chunk(mstate m, void* mem, size_t s) { + if (mem != 0) { + mchunkptr p = mem2chunk(mem); + size_t sz = p->head & ~(PINUSE_BIT|CINUSE_BIT); + do_check_inuse_chunk(m, p); + assert((sz & CHUNK_ALIGN_MASK) == 0); + assert(sz >= MIN_CHUNK_SIZE); + assert(sz >= s); + /* unless mmapped, size is less than MIN_CHUNK_SIZE more than request */ + assert(is_mmapped(p) || sz < (s + MIN_CHUNK_SIZE)); + } +} + +/* Check a tree and its subtrees. */ +static void do_check_tree(mstate m, tchunkptr t) { + tchunkptr head = 0; + tchunkptr u = t; + bindex_t tindex = t->index; + size_t tsize = chunksize(t); + bindex_t idx; + compute_tree_index(tsize, idx); + assert(tindex == idx); + assert(tsize >= MIN_LARGE_SIZE); + assert(tsize >= minsize_for_tree_index(idx)); + assert((idx == NTREEBINS-1) || (tsize < minsize_for_tree_index((idx+1)))); + + do { /* traverse through chain of same-sized nodes */ + do_check_any_chunk(m, ((mchunkptr)u)); + assert(u->index == tindex); + assert(chunksize(u) == tsize); + assert(!cinuse(u)); + assert(!next_pinuse(u)); + assert(u->fd->bk == u); + assert(u->bk->fd == u); + if (u->parent == 0) { + assert(u->child[0] == 0); + assert(u->child[1] == 0); + } + else { + assert(head == 0); /* only one node on chain has parent */ + head = u; + assert(u->parent != u); + assert (u->parent->child[0] == u || + u->parent->child[1] == u || + *((tbinptr*)(u->parent)) == u); + if (u->child[0] != 0) { + assert(u->child[0]->parent == u); + assert(u->child[0] != u); + do_check_tree(m, u->child[0]); + } + if (u->child[1] != 0) { + assert(u->child[1]->parent == u); + assert(u->child[1] != u); + do_check_tree(m, u->child[1]); + } + if (u->child[0] != 0 && u->child[1] != 0) { + assert(chunksize(u->child[0]) < chunksize(u->child[1])); + } + } + u = u->fd; + } while (u != t); + assert(head != 0); +} + +/* Check all the chunks in a treebin. */ +static void do_check_treebin(mstate m, bindex_t i) { + tbinptr* tb = treebin_at(m, i); + tchunkptr t = *tb; + int empty = (m->treemap & (1U << i)) == 0; + if (t == 0) + assert(empty); + if (!empty) + do_check_tree(m, t); +} + +/* Check all the chunks in a smallbin. */ +static void do_check_smallbin(mstate m, bindex_t i) { + sbinptr b = smallbin_at(m, i); + mchunkptr p = b->bk; + unsigned int empty = (m->smallmap & (1U << i)) == 0; + if (p == b) + assert(empty); + if (!empty) { + for (; p != b; p = p->bk) { + size_t size = chunksize(p); + mchunkptr q; + /* each chunk claims to be free */ + do_check_free_chunk(m, p); + /* chunk belongs in bin */ + assert(small_index(size) == i); + assert(p->bk == b || chunksize(p->bk) == chunksize(p)); + /* chunk is followed by an inuse chunk */ + q = next_chunk(p); + if (q->head != FENCEPOST_HEAD) + do_check_inuse_chunk(m, q); + } + } +} + +/* Find x in a bin. Used in other check functions. */ +static int bin_find(mstate m, mchunkptr x) { + size_t size = chunksize(x); + if (is_small(size)) { + bindex_t sidx = small_index(size); + sbinptr b = smallbin_at(m, sidx); + if (smallmap_is_marked(m, sidx)) { + mchunkptr p = b; + do { + if (p == x) + return 1; + } while ((p = p->fd) != b); + } + } + else { + bindex_t tidx; + compute_tree_index(size, tidx); + if (treemap_is_marked(m, tidx)) { + tchunkptr t = *treebin_at(m, tidx); + size_t sizebits = size << leftshift_for_tree_index(tidx); + while (t != 0 && chunksize(t) != size) { + t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]; + sizebits <<= 1; + } + if (t != 0) { + tchunkptr u = t; + do { + if (u == (tchunkptr)x) + return 1; + } while ((u = u->fd) != t); + } + } + } + return 0; +} + +/* Traverse each chunk and check it; return total */ +static size_t traverse_and_check(mstate m) { + size_t sum = 0; + if (is_initialized(m)) { + msegmentptr s = &m->seg; + sum += m->topsize + TOP_FOOT_SIZE; + while (s != 0) { + mchunkptr q = align_as_chunk(s->base); + mchunkptr lastq = 0; + assert(pinuse(q)); + while (segment_holds(s, q) && + q != m->top && q->head != FENCEPOST_HEAD) { + sum += chunksize(q); + if (cinuse(q)) { + assert(!bin_find(m, q)); + do_check_inuse_chunk(m, q); + } + else { + assert(q == m->dv || bin_find(m, q)); + assert(lastq == 0 || cinuse(lastq)); /* Not 2 consecutive free */ + do_check_free_chunk(m, q); + } + lastq = q; + q = next_chunk(q); + } + s = s->next; + } + } + return sum; +} + +/* Check all properties of malloc_state. */ +static void do_check_malloc_state(mstate m) { + bindex_t i; + size_t total; + /* check bins */ + for (i = 0; i < NSMALLBINS; ++i) + do_check_smallbin(m, i); + for (i = 0; i < NTREEBINS; ++i) + do_check_treebin(m, i); + + if (m->dvsize != 0) { /* check dv chunk */ + do_check_any_chunk(m, m->dv); + assert(m->dvsize == chunksize(m->dv)); + assert(m->dvsize >= MIN_CHUNK_SIZE); + assert(bin_find(m, m->dv) == 0); + } + + if (m->top != 0) { /* check top chunk */ + do_check_top_chunk(m, m->top); + assert(m->topsize == chunksize(m->top)); + assert(m->topsize > 0); + assert(bin_find(m, m->top) == 0); + } + + total = traverse_and_check(m); + assert(total <= m->footprint); + assert(m->footprint <= m->max_footprint); +} +#endif /* DEBUG */ + +/* ----------------------------- statistics ------------------------------ */ + +#if !NO_MALLINFO +static struct mallinfo internal_mallinfo(mstate m) { + struct mallinfo nm = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; + if (!PREACTION(m)) { + check_malloc_state(m); + if (is_initialized(m)) { + size_t nfree = SIZE_T_ONE; /* top always free */ + size_t mfree = m->topsize + TOP_FOOT_SIZE; + size_t sum = mfree; + msegmentptr s = &m->seg; + while (s != 0) { + mchunkptr q = align_as_chunk(s->base); + while (segment_holds(s, q) && + q != m->top && q->head != FENCEPOST_HEAD) { + size_t sz = chunksize(q); + sum += sz; + if (!cinuse(q)) { + mfree += sz; + ++nfree; + } + q = next_chunk(q); + } + s = s->next; + } + + nm.arena = sum; + nm.ordblks = nfree; + nm.hblkhd = m->footprint - sum; + nm.usmblks = m->max_footprint; + nm.uordblks = m->footprint - mfree; + nm.fordblks = mfree; + nm.keepcost = m->topsize; + } + + POSTACTION(m); + } + return nm; +} +#endif /* !NO_MALLINFO */ + +static void internal_malloc_stats(mstate m) { + if (!PREACTION(m)) { + size_t maxfp = 0; + size_t fp = 0; + size_t used = 0; + check_malloc_state(m); + if (is_initialized(m)) { + msegmentptr s = &m->seg; + maxfp = m->max_footprint; + fp = m->footprint; + used = fp - (m->topsize + TOP_FOOT_SIZE); + + while (s != 0) { + mchunkptr q = align_as_chunk(s->base); + while (segment_holds(s, q) && + q != m->top && q->head != FENCEPOST_HEAD) { + if (!cinuse(q)) + used -= chunksize(q); + q = next_chunk(q); + } + s = s->next; + } + } + + fprintf(stderr, "max system bytes = %10lu\n", (unsigned long)(maxfp)); + fprintf(stderr, "system bytes = %10lu\n", (unsigned long)(fp)); + fprintf(stderr, "in use bytes = %10lu\n", (unsigned long)(used)); + + POSTACTION(m); + } +} + +/* ----------------------- Operations on smallbins ----------------------- */ + +/* + Various forms of linking and unlinking are defined as macros. Even + the ones for trees, which are very long but have very short typical + paths. This is ugly but reduces reliance on inlining support of + compilers. +*/ + +/* Link a free chunk into a smallbin */ +#define insert_small_chunk(M, P, S) {\ + bindex_t I = small_index(S);\ + mchunkptr B = smallbin_at(M, I);\ + mchunkptr F = B;\ + assert(S >= MIN_CHUNK_SIZE);\ + if (!smallmap_is_marked(M, I))\ + mark_smallmap(M, I);\ + else if (RTCHECK(ok_address(M, B->fd)))\ + F = B->fd;\ + else {\ + CORRUPTION_ERROR_ACTION(M);\ + }\ + B->fd = P;\ + F->bk = P;\ + P->fd = F;\ + P->bk = B;\ +} + +/* Unlink a chunk from a smallbin */ +#define unlink_small_chunk(M, P, S) {\ + mchunkptr F = P->fd;\ + mchunkptr B = P->bk;\ + bindex_t I = small_index(S);\ + assert(P != B);\ + assert(P != F);\ + assert(chunksize(P) == small_index2size(I));\ + if (F == B)\ + clear_smallmap(M, I);\ + else if (RTCHECK((F == smallbin_at(M,I) || ok_address(M, F)) &&\ + (B == smallbin_at(M,I) || ok_address(M, B)))) {\ + F->bk = B;\ + B->fd = F;\ + }\ + else {\ + CORRUPTION_ERROR_ACTION(M);\ + }\ +} + +/* Unlink the first chunk from a smallbin */ +#define unlink_first_small_chunk(M, B, P, I) {\ + mchunkptr F = P->fd;\ + assert(P != B);\ + assert(P != F);\ + assert(chunksize(P) == small_index2size(I));\ + if (B == F)\ + clear_smallmap(M, I);\ + else if (RTCHECK(ok_address(M, F))) {\ + B->fd = F;\ + F->bk = B;\ + }\ + else {\ + CORRUPTION_ERROR_ACTION(M);\ + }\ +} + +/* Replace dv node, binning the old one */ +/* Used only when dvsize known to be small */ +#define replace_dv(M, P, S) {\ + size_t DVS = M->dvsize;\ + if (DVS != 0) {\ + mchunkptr DV = M->dv;\ + assert(is_small(DVS));\ + insert_small_chunk(M, DV, DVS);\ + }\ + M->dvsize = S;\ + M->dv = P;\ +} + +/* ------------------------- Operations on trees ------------------------- */ + +/* Insert chunk into tree */ +#define insert_large_chunk(M, X, S) {\ + tbinptr* H;\ + bindex_t I;\ + compute_tree_index(S, I);\ + H = treebin_at(M, I);\ + X->index = I;\ + X->child[0] = X->child[1] = 0;\ + if (!treemap_is_marked(M, I)) {\ + mark_treemap(M, I);\ + *H = X;\ + X->parent = (tchunkptr)H;\ + X->fd = X->bk = X;\ + }\ + else {\ + tchunkptr T = *H;\ + size_t K = S << leftshift_for_tree_index(I);\ + for (;;) {\ + if (chunksize(T) != S) {\ + tchunkptr* C = &(T->child[(K >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]);\ + K <<= 1;\ + if (*C != 0)\ + T = *C;\ + else if (RTCHECK(ok_address(M, C))) {\ + *C = X;\ + X->parent = T;\ + X->fd = X->bk = X;\ + break;\ + }\ + else {\ + CORRUPTION_ERROR_ACTION(M);\ + break;\ + }\ + }\ + else {\ + tchunkptr F = T->fd;\ + if (RTCHECK(ok_address(M, T) && ok_address(M, F))) {\ + T->fd = F->bk = X;\ + X->fd = F;\ + X->bk = T;\ + X->parent = 0;\ + break;\ + }\ + else {\ + CORRUPTION_ERROR_ACTION(M);\ + break;\ + }\ + }\ + }\ + }\ +} + +/* + Unlink steps: + + 1. If x is a chained node, unlink it from its same-sized fd/bk links + and choose its bk node as its replacement. + 2. If x was the last node of its size, but not a leaf node, it must + be replaced with a leaf node (not merely one with an open left or + right), to make sure that lefts and rights of descendents + correspond properly to bit masks. We use the rightmost descendent + of x. We could use any other leaf, but this is easy to locate and + tends to counteract removal of leftmosts elsewhere, and so keeps + paths shorter than minimally guaranteed. This doesn't loop much + because on average a node in a tree is near the bottom. + 3. If x is the base of a chain (i.e., has parent links) relink + x's parent and children to x's replacement (or null if none). +*/ + +#define unlink_large_chunk(M, X) {\ + tchunkptr XP = X->parent;\ + tchunkptr R;\ + if (X->bk != X) {\ + tchunkptr F = X->fd;\ + R = X->bk;\ + if (RTCHECK(ok_address(M, F))) {\ + F->bk = R;\ + R->fd = F;\ + }\ + else {\ + CORRUPTION_ERROR_ACTION(M);\ + }\ + }\ + else {\ + tchunkptr* RP;\ + if (((R = *(RP = &(X->child[1]))) != 0) ||\ + ((R = *(RP = &(X->child[0]))) != 0)) {\ + tchunkptr* CP;\ + while ((*(CP = &(R->child[1])) != 0) ||\ + (*(CP = &(R->child[0])) != 0)) {\ + R = *(RP = CP);\ + }\ + if (RTCHECK(ok_address(M, RP)))\ + *RP = 0;\ + else {\ + CORRUPTION_ERROR_ACTION(M);\ + }\ + }\ + }\ + if (XP != 0) {\ + tbinptr* H = treebin_at(M, X->index);\ + if (X == *H) {\ + if ((*H = R) == 0) \ + clear_treemap(M, X->index);\ + }\ + else if (RTCHECK(ok_address(M, XP))) {\ + if (XP->child[0] == X) \ + XP->child[0] = R;\ + else \ + XP->child[1] = R;\ + }\ + else\ + CORRUPTION_ERROR_ACTION(M);\ + if (R != 0) {\ + if (RTCHECK(ok_address(M, R))) {\ + tchunkptr C0, C1;\ + R->parent = XP;\ + if ((C0 = X->child[0]) != 0) {\ + if (RTCHECK(ok_address(M, C0))) {\ + R->child[0] = C0;\ + C0->parent = R;\ + }\ + else\ + CORRUPTION_ERROR_ACTION(M);\ + }\ + if ((C1 = X->child[1]) != 0) {\ + if (RTCHECK(ok_address(M, C1))) {\ + R->child[1] = C1;\ + C1->parent = R;\ + }\ + else\ + CORRUPTION_ERROR_ACTION(M);\ + }\ + }\ + else\ + CORRUPTION_ERROR_ACTION(M);\ + }\ + }\ +} + +/* Relays to large vs small bin operations */ + +#define insert_chunk(M, P, S)\ + if (is_small(S)) insert_small_chunk(M, P, S)\ + else { tchunkptr TP = (tchunkptr)(P); insert_large_chunk(M, TP, S); } + +#define unlink_chunk(M, P, S)\ + if (is_small(S)) unlink_small_chunk(M, P, S)\ + else { tchunkptr TP = (tchunkptr)(P); unlink_large_chunk(M, TP); } + + +/* Relays to internal calls to malloc/free from realloc, memalign etc */ + +#if ONLY_MSPACES +#define internal_malloc(m, b) mspace_malloc(m, b) +#define internal_free(m, mem) mspace_free(m,mem); +#else /* ONLY_MSPACES */ +#if MSPACES +#define internal_malloc(m, b)\ + (m == gm)? dlmalloc(b) : mspace_malloc(m, b) +#define internal_free(m, mem)\ + if (m == gm) dlfree(mem); else mspace_free(m,mem); +#else /* MSPACES */ +#define internal_malloc(m, b) dlmalloc(b) +#define internal_free(m, mem) dlfree(mem) +#endif /* MSPACES */ +#endif /* ONLY_MSPACES */ + +/* ----------------------- Direct-mmapping chunks ----------------------- */ + +/* + Directly mmapped chunks are set up with an offset to the start of + the mmapped region stored in the prev_foot field of the chunk. This + allows reconstruction of the required argument to MUNMAP when freed, + and also allows adjustment of the returned chunk to meet alignment + requirements (especially in memalign). There is also enough space + allocated to hold a fake next chunk of size SIZE_T_SIZE to maintain + the PINUSE bit so frees can be checked. +*/ + +/* Malloc using mmap */ +static void* mmap_alloc(mstate m, size_t nb) { + size_t mmsize = granularity_align(nb + SIX_SIZE_T_SIZES + CHUNK_ALIGN_MASK); + if (mmsize > nb) { /* Check for wrap around 0 */ + char* mm = (char*)(DIRECT_MMAP(mmsize)); + if (mm != CMFAIL) { + size_t offset = align_offset(chunk2mem(mm)); + size_t psize = mmsize - offset - MMAP_FOOT_PAD; + mchunkptr p = (mchunkptr)(mm + offset); + p->prev_foot = offset | IS_MMAPPED_BIT; + (p)->head = (psize|CINUSE_BIT); + mark_inuse_foot(m, p, psize); + chunk_plus_offset(p, psize)->head = FENCEPOST_HEAD; + chunk_plus_offset(p, psize+SIZE_T_SIZE)->head = 0; + + if (mm < m->least_addr) + m->least_addr = mm; + if ((m->footprint += mmsize) > m->max_footprint) + m->max_footprint = m->footprint; + assert(is_aligned(chunk2mem(p))); + check_mmapped_chunk(m, p); + return chunk2mem(p); + } + } + return 0; +} + +/* Realloc using mmap */ +static mchunkptr mmap_resize(mstate m, mchunkptr oldp, size_t nb) { + size_t oldsize = chunksize(oldp); + if (is_small(nb)) /* Can't shrink mmap regions below small size */ + return 0; + /* Keep old chunk if big enough but not too big */ + if (oldsize >= nb + SIZE_T_SIZE && + (oldsize - nb) <= (mparams.granularity << 1)) + return oldp; + else { + size_t offset = oldp->prev_foot & ~IS_MMAPPED_BIT; + size_t oldmmsize = oldsize + offset + MMAP_FOOT_PAD; + size_t newmmsize = granularity_align(nb + SIX_SIZE_T_SIZES + + CHUNK_ALIGN_MASK); + char* cp = (char*)CALL_MREMAP((char*)oldp - offset, + oldmmsize, newmmsize, 1); + if (cp != CMFAIL) { + mchunkptr newp = (mchunkptr)(cp + offset); + size_t psize = newmmsize - offset - MMAP_FOOT_PAD; + newp->head = (psize|CINUSE_BIT); + mark_inuse_foot(m, newp, psize); + chunk_plus_offset(newp, psize)->head = FENCEPOST_HEAD; + chunk_plus_offset(newp, psize+SIZE_T_SIZE)->head = 0; + + if (cp < m->least_addr) + m->least_addr = cp; + if ((m->footprint += newmmsize - oldmmsize) > m->max_footprint) + m->max_footprint = m->footprint; + check_mmapped_chunk(m, newp); + return newp; + } + } + return 0; +} + +/* -------------------------- mspace management -------------------------- */ + +/* Initialize top chunk and its size */ +static void init_top(mstate m, mchunkptr p, size_t psize) { + /* Ensure alignment */ + size_t offset = align_offset(chunk2mem(p)); + p = (mchunkptr)((char*)p + offset); + psize -= offset; + + m->top = p; + m->topsize = psize; + p->head = psize | PINUSE_BIT; + /* set size of fake trailing chunk holding overhead space only once */ + chunk_plus_offset(p, psize)->head = TOP_FOOT_SIZE; + m->trim_check = mparams.trim_threshold; /* reset on each update */ +} + +/* Initialize bins for a new mstate that is otherwise zeroed out */ +static void init_bins(mstate m) { + /* Establish circular links for smallbins */ + bindex_t i; + for (i = 0; i < NSMALLBINS; ++i) { + sbinptr bin = smallbin_at(m,i); + bin->fd = bin->bk = bin; + } +} + +#if PROCEED_ON_ERROR + +/* default corruption action */ +static void reset_on_error(mstate m) { + int i; + ++malloc_corruption_error_count; + /* Reinitialize fields to forget about all memory */ + m->smallbins = m->treebins = 0; + m->dvsize = m->topsize = 0; + m->seg.base = 0; + m->seg.size = 0; + m->seg.next = 0; + m->top = m->dv = 0; + for (i = 0; i < NTREEBINS; ++i) + *treebin_at(m, i) = 0; + init_bins(m); +} +#endif /* PROCEED_ON_ERROR */ + +/* Allocate chunk and prepend remainder with chunk in successor base. */ +static void* prepend_alloc(mstate m, char* newbase, char* oldbase, + size_t nb) { + mchunkptr p = align_as_chunk(newbase); + mchunkptr oldfirst = align_as_chunk(oldbase); + size_t psize = (char*)oldfirst - (char*)p; + mchunkptr q = chunk_plus_offset(p, nb); + size_t qsize = psize - nb; + set_size_and_pinuse_of_inuse_chunk(m, p, nb); + + assert((char*)oldfirst > (char*)q); + assert(pinuse(oldfirst)); + assert(qsize >= MIN_CHUNK_SIZE); + + /* consolidate remainder with first chunk of old base */ + if (oldfirst == m->top) { + size_t tsize = m->topsize += qsize; + m->top = q; + q->head = tsize | PINUSE_BIT; + check_top_chunk(m, q); + } + else if (oldfirst == m->dv) { + size_t dsize = m->dvsize += qsize; + m->dv = q; + set_size_and_pinuse_of_free_chunk(q, dsize); + } + else { + if (!cinuse(oldfirst)) { + size_t nsize = chunksize(oldfirst); + unlink_chunk(m, oldfirst, nsize); + oldfirst = chunk_plus_offset(oldfirst, nsize); + qsize += nsize; + } + set_free_with_pinuse(q, qsize, oldfirst); + insert_chunk(m, q, qsize); + check_free_chunk(m, q); + } + + check_malloced_chunk(m, chunk2mem(p), nb); + return chunk2mem(p); +} + + +/* Add a segment to hold a new noncontiguous region */ +static void add_segment(mstate m, char* tbase, size_t tsize, flag_t mmapped) { + /* Determine locations and sizes of segment, fenceposts, old top */ + char* old_top = (char*)m->top; + msegmentptr oldsp = segment_holding(m, old_top); + char* old_end = oldsp->base + oldsp->size; + size_t ssize = pad_request(sizeof(struct malloc_segment)); + char* rawsp = old_end - (ssize + FOUR_SIZE_T_SIZES + CHUNK_ALIGN_MASK); + size_t offset = align_offset(chunk2mem(rawsp)); + char* asp = rawsp + offset; + char* csp = (asp < (old_top + MIN_CHUNK_SIZE))? old_top : asp; + mchunkptr sp = (mchunkptr)csp; + msegmentptr ss = (msegmentptr)(chunk2mem(sp)); + mchunkptr tnext = chunk_plus_offset(sp, ssize); + mchunkptr p = tnext; + int nfences = 0; + + /* reset top to new space */ + init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE); + + /* Set up segment record */ + assert(is_aligned(ss)); + set_size_and_pinuse_of_inuse_chunk(m, sp, ssize); + *ss = m->seg; /* Push current record */ + m->seg.base = tbase; + m->seg.size = tsize; + set_segment_flags(&m->seg, mmapped); + m->seg.next = ss; + + /* Insert trailing fenceposts */ + for (;;) { + mchunkptr nextp = chunk_plus_offset(p, SIZE_T_SIZE); + p->head = FENCEPOST_HEAD; + ++nfences; + if ((char*)(&(nextp->head)) < old_end) + p = nextp; + else + break; + } + assert(nfences >= 2); + + /* Insert the rest of old top into a bin as an ordinary free chunk */ + if (csp != old_top) { + mchunkptr q = (mchunkptr)old_top; + size_t psize = csp - old_top; + mchunkptr tn = chunk_plus_offset(q, psize); + set_free_with_pinuse(q, psize, tn); + insert_chunk(m, q, psize); + } + + check_top_chunk(m, m->top); +} + +/* -------------------------- System allocation -------------------------- */ + +/* Get memory from system using MORECORE or MMAP */ +static void* sys_alloc(mstate m, size_t nb) { + char* tbase = CMFAIL; + size_t tsize = 0; + flag_t mmap_flag = 0; + + init_mparams(); + + /* Directly map large chunks */ + if (use_mmap(m) && nb >= mparams.mmap_threshold) { + void* mem = mmap_alloc(m, nb); + if (mem != 0) + return mem; + } + + /* + Try getting memory in any of three ways (in most-preferred to + least-preferred order): + 1. A call to MORECORE that can normally contiguously extend memory. + (disabled if not MORECORE_CONTIGUOUS or not HAVE_MORECORE or + or main space is mmapped or a previous contiguous call failed) + 2. A call to MMAP new space (disabled if not HAVE_MMAP). + Note that under the default settings, if MORECORE is unable to + fulfill a request, and HAVE_MMAP is true, then mmap is + used as a noncontiguous system allocator. This is a useful backup + strategy for systems with holes in address spaces -- in this case + sbrk cannot contiguously expand the heap, but mmap may be able to + find space. + 3. A call to MORECORE that cannot usually contiguously extend memory. + (disabled if not HAVE_MORECORE) + */ + + if (MORECORE_CONTIGUOUS && !use_noncontiguous(m)) { + char* br = CMFAIL; + msegmentptr ss = (m->top == 0)? 0 : segment_holding(m, (char*)m->top); + size_t asize = 0; + ACQUIRE_MORECORE_LOCK(); + + if (ss == 0) { /* First time through or recovery */ + char* base = (char*)CALL_MORECORE(0); + if (base != CMFAIL) { + asize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE); + /* Adjust to end on a page boundary */ + if (!is_page_aligned(base)) + asize += (page_align((size_t)base) - (size_t)base); + /* Can't call MORECORE if size is negative when treated as signed */ + if (asize < HALF_MAX_SIZE_T && + (br = (char*)(CALL_MORECORE(asize))) == base) { + tbase = base; + tsize = asize; + } + } + } + else { + /* Subtract out existing available top space from MORECORE request. */ + asize = granularity_align(nb - m->topsize + TOP_FOOT_SIZE + SIZE_T_ONE); + /* Use mem here only if it did continuously extend old space */ + if (asize < HALF_MAX_SIZE_T && + (br = (char*)(CALL_MORECORE(asize))) == ss->base+ss->size) { + tbase = br; + tsize = asize; + } + } + + if (tbase == CMFAIL) { /* Cope with partial failure */ + if (br != CMFAIL) { /* Try to use/extend the space we did get */ + if (asize < HALF_MAX_SIZE_T && + asize < nb + TOP_FOOT_SIZE + SIZE_T_ONE) { + size_t esize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE - asize); + if (esize < HALF_MAX_SIZE_T) { + char* end = (char*)CALL_MORECORE(esize); + if (end != CMFAIL) + asize += esize; + else { /* Can't use; try to release */ + (void)CALL_MORECORE(-asize); + br = CMFAIL; + } + } + } + } + if (br != CMFAIL) { /* Use the space we did get */ + tbase = br; + tsize = asize; + } + else + disable_contiguous(m); /* Don't try contiguous path in the future */ + } + + RELEASE_MORECORE_LOCK(); + } + + if (HAVE_MMAP && tbase == CMFAIL) { /* Try MMAP */ + size_t req = nb + TOP_FOOT_SIZE + SIZE_T_ONE; + size_t rsize = granularity_align(req); + if (rsize > nb) { /* Fail if wraps around zero */ + char* mp = (char*)(CALL_MMAP(rsize)); + if (mp != CMFAIL) { + tbase = mp; + tsize = rsize; + mmap_flag = IS_MMAPPED_BIT; + } + } + } + + if (HAVE_MORECORE && tbase == CMFAIL) { /* Try noncontiguous MORECORE */ + size_t asize = granularity_align(nb + TOP_FOOT_SIZE + SIZE_T_ONE); + if (asize < HALF_MAX_SIZE_T) { + char* br = CMFAIL; + char* end = CMFAIL; + ACQUIRE_MORECORE_LOCK(); + br = (char*)(CALL_MORECORE(asize)); + end = (char*)(CALL_MORECORE(0)); + RELEASE_MORECORE_LOCK(); + if (br != CMFAIL && end != CMFAIL && br < end) { + size_t ssize = end - br; + if (ssize > nb + TOP_FOOT_SIZE) { + tbase = br; + tsize = ssize; + } + } + } + } + + if (tbase != CMFAIL) { + + if ((m->footprint += tsize) > m->max_footprint) + m->max_footprint = m->footprint; + + if (!is_initialized(m)) { /* first-time initialization */ + m->seg.base = m->least_addr = tbase; + m->seg.size = tsize; + set_segment_flags(&m->seg, mmap_flag); + m->magic = mparams.magic; + init_bins(m); + if (is_global(m)) + init_top(m, (mchunkptr)tbase, tsize - TOP_FOOT_SIZE); + else { + /* Offset top by embedded malloc_state */ + mchunkptr mn = next_chunk(mem2chunk(m)); + init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) -TOP_FOOT_SIZE); + } + } + + else { + /* Try to merge with an existing segment */ + msegmentptr sp = &m->seg; + while (sp != 0 && tbase != sp->base + sp->size) + sp = sp->next; + if (sp != 0 && + !is_extern_segment(sp) && + check_segment_merge(sp, tbase, tsize) && + (get_segment_flags(sp) & IS_MMAPPED_BIT) == mmap_flag && + segment_holds(sp, m->top)) { /* append */ + sp->size += tsize; + init_top(m, m->top, m->topsize + tsize); + } + else { + if (tbase < m->least_addr) + m->least_addr = tbase; + sp = &m->seg; + while (sp != 0 && sp->base != tbase + tsize) + sp = sp->next; + if (sp != 0 && + !is_extern_segment(sp) && + check_segment_merge(sp, tbase, tsize) && + (get_segment_flags(sp) & IS_MMAPPED_BIT) == mmap_flag) { + char* oldbase = sp->base; + sp->base = tbase; + sp->size += tsize; + return prepend_alloc(m, tbase, oldbase, nb); + } + else + add_segment(m, tbase, tsize, mmap_flag); + } + } + + if (nb < m->topsize) { /* Allocate from new or extended top space */ + size_t rsize = m->topsize -= nb; + mchunkptr p = m->top; + mchunkptr r = m->top = chunk_plus_offset(p, nb); + r->head = rsize | PINUSE_BIT; + set_size_and_pinuse_of_inuse_chunk(m, p, nb); + check_top_chunk(m, m->top); + check_malloced_chunk(m, chunk2mem(p), nb); + return chunk2mem(p); + } + } + + MALLOC_FAILURE_ACTION; + return 0; +} + +/* ----------------------- system deallocation -------------------------- */ + +/* Unmap and unlink any mmapped segments that don't contain used chunks */ +static size_t release_unused_segments(mstate m) { + size_t released = 0; + msegmentptr pred = &m->seg; + msegmentptr sp = pred->next; + while (sp != 0) { + char* base = sp->base; + size_t size = sp->size; + msegmentptr next = sp->next; + if (is_mmapped_segment(sp) && !is_extern_segment(sp)) { + mchunkptr p = align_as_chunk(base); + size_t psize = chunksize(p); + /* Can unmap if first chunk holds entire segment and not pinned */ + if (!cinuse(p) && (char*)p + psize >= base + size - TOP_FOOT_SIZE) { + tchunkptr tp = (tchunkptr)p; + assert(segment_holds(sp, (char*)sp)); + if (p == m->dv) { + m->dv = 0; + m->dvsize = 0; + } + else { + unlink_large_chunk(m, tp); + } + if (CALL_MUNMAP(base, size) == 0) { + released += size; + m->footprint -= size; + /* unlink obsoleted record */ + sp = pred; + sp->next = next; + } + else { /* back out if cannot unmap */ + insert_large_chunk(m, tp, psize); + } + } + } + pred = sp; + sp = next; + } + return released; +} + +static int sys_trim(mstate m, size_t pad) { + size_t released = 0; + if (pad < MAX_REQUEST && is_initialized(m)) { + pad += TOP_FOOT_SIZE; /* ensure enough room for segment overhead */ + + if (m->topsize > pad) { + /* Shrink top space in granularity-size units, keeping at least one */ + size_t unit = mparams.granularity; + size_t extra = ((m->topsize - pad + (unit - SIZE_T_ONE)) / unit - + SIZE_T_ONE) * unit; + msegmentptr sp = segment_holding(m, (char*)m->top); + + if (!is_extern_segment(sp)) { + if (is_mmapped_segment(sp)) { + if (HAVE_MMAP && + sp->size >= extra && + !has_segment_link(m, sp)) { /* can't shrink if pinned */ + size_t newsize = sp->size - extra; + /* Prefer mremap, fall back to munmap */ + if ((CALL_MREMAP(sp->base, sp->size, newsize, 0) != MFAIL) || + (CALL_MUNMAP(sp->base + newsize, extra) == 0)) { + released = extra; + } + } + } + else if (HAVE_MORECORE) { + if (extra >= HALF_MAX_SIZE_T) /* Avoid wrapping negative */ + extra = (HALF_MAX_SIZE_T) + SIZE_T_ONE - unit; + ACQUIRE_MORECORE_LOCK(); + { + /* Make sure end of memory is where we last set it. */ + char* old_br = (char*)(CALL_MORECORE(0)); + if (old_br == sp->base + sp->size) { + char* rel_br = (char*)(CALL_MORECORE(-extra)); + char* new_br = (char*)(CALL_MORECORE(0)); + if (rel_br != CMFAIL && new_br < old_br) + released = old_br - new_br; + } + } + RELEASE_MORECORE_LOCK(); + } + } + + if (released != 0) { + sp->size -= released; + m->footprint -= released; + init_top(m, m->top, m->topsize - released); + check_top_chunk(m, m->top); + } + } + + /* Unmap any unused mmapped segments */ + if (HAVE_MMAP) + released += release_unused_segments(m); + + /* On failure, disable autotrim to avoid repeated failed future calls */ + if (released == 0) + m->trim_check = MAX_SIZE_T; + } + + return (released != 0)? 1 : 0; +} + +/* ---------------------------- malloc support --------------------------- */ + +/* allocate a large request from the best fitting chunk in a treebin */ +static void* tmalloc_large(mstate m, size_t nb) { + tchunkptr v = 0; + size_t rsize = -nb; /* Unsigned negation */ + tchunkptr t; + bindex_t idx; + compute_tree_index(nb, idx); + + if ((t = *treebin_at(m, idx)) != 0) { + /* Traverse tree for this bin looking for node with size == nb */ + size_t sizebits = nb << leftshift_for_tree_index(idx); + tchunkptr rst = 0; /* The deepest untaken right subtree */ + for (;;) { + tchunkptr rt; + size_t trem = chunksize(t) - nb; + if (trem < rsize) { + v = t; + if ((rsize = trem) == 0) + break; + } + rt = t->child[1]; + t = t->child[(sizebits >> (SIZE_T_BITSIZE-SIZE_T_ONE)) & 1]; + if (rt != 0 && rt != t) + rst = rt; + if (t == 0) { + t = rst; /* set t to least subtree holding sizes > nb */ + break; + } + sizebits <<= 1; + } + } + + if (t == 0 && v == 0) { /* set t to root of next non-empty treebin */ + binmap_t leftbits = left_bits(idx2bit(idx)) & m->treemap; + if (leftbits != 0) { + bindex_t i; + binmap_t leastbit = least_bit(leftbits); + compute_bit2idx(leastbit, i); + t = *treebin_at(m, i); + } + } + + while (t != 0) { /* find smallest of tree or subtree */ + size_t trem = chunksize(t) - nb; + if (trem < rsize) { + rsize = trem; + v = t; + } + t = leftmost_child(t); + } + + /* If dv is a better fit, return 0 so malloc will use it */ + if (v != 0 && rsize < (size_t)(m->dvsize - nb)) { + if (RTCHECK(ok_address(m, v))) { /* split */ + mchunkptr r = chunk_plus_offset(v, nb); + assert(chunksize(v) == rsize + nb); + if (RTCHECK(ok_next(v, r))) { + unlink_large_chunk(m, v); + if (rsize < MIN_CHUNK_SIZE) + set_inuse_and_pinuse(m, v, (rsize + nb)); + else { + set_size_and_pinuse_of_inuse_chunk(m, v, nb); + set_size_and_pinuse_of_free_chunk(r, rsize); + insert_chunk(m, r, rsize); + } + return chunk2mem(v); + } + } + CORRUPTION_ERROR_ACTION(m); + } + return 0; +} + +/* allocate a small request from the best fitting chunk in a treebin */ +static void* tmalloc_small(mstate m, size_t nb) { + tchunkptr t, v; + size_t rsize; + bindex_t i; + binmap_t leastbit = least_bit(m->treemap); + compute_bit2idx(leastbit, i); + + v = t = *treebin_at(m, i); + rsize = chunksize(t) - nb; + + while ((t = leftmost_child(t)) != 0) { + size_t trem = chunksize(t) - nb; + if (trem < rsize) { + rsize = trem; + v = t; + } + } + + if (RTCHECK(ok_address(m, v))) { + mchunkptr r = chunk_plus_offset(v, nb); + assert(chunksize(v) == rsize + nb); + if (RTCHECK(ok_next(v, r))) { + unlink_large_chunk(m, v); + if (rsize < MIN_CHUNK_SIZE) + set_inuse_and_pinuse(m, v, (rsize + nb)); + else { + set_size_and_pinuse_of_inuse_chunk(m, v, nb); + set_size_and_pinuse_of_free_chunk(r, rsize); + replace_dv(m, r, rsize); + } + return chunk2mem(v); + } + } + + CORRUPTION_ERROR_ACTION(m); + return 0; +} + +/* --------------------------- realloc support --------------------------- */ + +static void* internal_realloc(mstate m, void* oldmem, size_t bytes) { + if (bytes >= MAX_REQUEST) { + MALLOC_FAILURE_ACTION; + return 0; + } + if (!PREACTION(m)) { + mchunkptr oldp = mem2chunk(oldmem); + size_t oldsize = chunksize(oldp); + mchunkptr next = chunk_plus_offset(oldp, oldsize); + mchunkptr newp = 0; + void* extra = 0; + + /* Try to either shrink or extend into top. Else malloc-copy-free */ + + if (RTCHECK(ok_address(m, oldp) && ok_cinuse(oldp) && + ok_next(oldp, next) && ok_pinuse(next))) { + size_t nb = request2size(bytes); + if (is_mmapped(oldp)) + newp = mmap_resize(m, oldp, nb); + else if (oldsize >= nb) { /* already big enough */ + size_t rsize = oldsize - nb; + newp = oldp; + if (rsize >= MIN_CHUNK_SIZE) { + mchunkptr remainder = chunk_plus_offset(newp, nb); + set_inuse(m, newp, nb); + set_inuse(m, remainder, rsize); + extra = chunk2mem(remainder); + } + } + else if (next == m->top && oldsize + m->topsize > nb) { + /* Expand into top */ + size_t newsize = oldsize + m->topsize; + size_t newtopsize = newsize - nb; + mchunkptr newtop = chunk_plus_offset(oldp, nb); + set_inuse(m, oldp, nb); + newtop->head = newtopsize |PINUSE_BIT; + m->top = newtop; + m->topsize = newtopsize; + newp = oldp; + } + } + else { + USAGE_ERROR_ACTION(m, oldmem); + POSTACTION(m); + return 0; + } + + POSTACTION(m); + + if (newp != 0) { + if (extra != 0) { + internal_free(m, extra); + } + check_inuse_chunk(m, newp); + return chunk2mem(newp); + } + else { + void* newmem = internal_malloc(m, bytes); + if (newmem != 0) { + size_t oc = oldsize - overhead_for(oldp); + memcpy(newmem, oldmem, (oc < bytes)? oc : bytes); + internal_free(m, oldmem); + } + return newmem; + } + } + return 0; +} + +/* --------------------------- memalign support -------------------------- */ + +static void* internal_memalign(mstate m, size_t alignment, size_t bytes) { + if (alignment <= MALLOC_ALIGNMENT) /* Can just use malloc */ + return internal_malloc(m, bytes); + if (alignment < MIN_CHUNK_SIZE) /* must be at least a minimum chunk size */ + alignment = MIN_CHUNK_SIZE; + if ((alignment & (alignment-SIZE_T_ONE)) != 0) {/* Ensure a power of 2 */ + size_t a = MALLOC_ALIGNMENT << 1; + while (a < alignment) a <<= 1; + alignment = a; + } + + if (bytes >= MAX_REQUEST - alignment) { + if (m != 0) { /* Test isn't needed but avoids compiler warning */ + MALLOC_FAILURE_ACTION; + } + } + else { + size_t nb = request2size(bytes); + size_t req = nb + alignment + MIN_CHUNK_SIZE - CHUNK_OVERHEAD; + char* mem = (char*)internal_malloc(m, req); + if (mem != 0) { + void* leader = 0; + void* trailer = 0; + mchunkptr p = mem2chunk(mem); + + if (PREACTION(m)) return 0; + if ((((size_t)(mem)) % alignment) != 0) { /* misaligned */ + /* + Find an aligned spot inside chunk. Since we need to give + back leading space in a chunk of at least MIN_CHUNK_SIZE, if + the first calculation places us at a spot with less than + MIN_CHUNK_SIZE leader, we can move to the next aligned spot. + We've allocated enough total room so that this is always + possible. + */ + char* br = (char*)mem2chunk((size_t)(((size_t)(mem + + alignment - + SIZE_T_ONE)) & + -alignment)); + char* pos = ((size_t)(br - (char*)(p)) >= MIN_CHUNK_SIZE)? + br : br+alignment; + mchunkptr newp = (mchunkptr)pos; + size_t leadsize = pos - (char*)(p); + size_t newsize = chunksize(p) - leadsize; + + if (is_mmapped(p)) { /* For mmapped chunks, just adjust offset */ + newp->prev_foot = p->prev_foot + leadsize; + newp->head = (newsize|CINUSE_BIT); + } + else { /* Otherwise, give back leader, use the rest */ + set_inuse(m, newp, newsize); + set_inuse(m, p, leadsize); + leader = chunk2mem(p); + } + p = newp; + } + + /* Give back spare room at the end */ + if (!is_mmapped(p)) { + size_t size = chunksize(p); + if (size > nb + MIN_CHUNK_SIZE) { + size_t remainder_size = size - nb; + mchunkptr remainder = chunk_plus_offset(p, nb); + set_inuse(m, p, nb); + set_inuse(m, remainder, remainder_size); + trailer = chunk2mem(remainder); + } + } + + assert (chunksize(p) >= nb); + assert((((size_t)(chunk2mem(p))) % alignment) == 0); + check_inuse_chunk(m, p); + POSTACTION(m); + if (leader != 0) { + internal_free(m, leader); + } + if (trailer != 0) { + internal_free(m, trailer); + } + return chunk2mem(p); + } + } + return 0; +} + +/* ------------------------ comalloc/coalloc support --------------------- */ + +static void** ialloc(mstate m, + size_t n_elements, + size_t* sizes, + int opts, + void* chunks[]) { + /* + This provides common support for independent_X routines, handling + all of the combinations that can result. + + The opts arg has: + bit 0 set if all elements are same size (using sizes[0]) + bit 1 set if elements should be zeroed + */ + + size_t element_size; /* chunksize of each element, if all same */ + size_t contents_size; /* total size of elements */ + size_t array_size; /* request size of pointer array */ + void* mem; /* malloced aggregate space */ + mchunkptr p; /* corresponding chunk */ + size_t remainder_size; /* remaining bytes while splitting */ + void** marray; /* either "chunks" or malloced ptr array */ + mchunkptr array_chunk; /* chunk for malloced ptr array */ + flag_t was_enabled; /* to disable mmap */ + size_t size; + size_t i; + + /* compute array length, if needed */ + if (chunks != 0) { + if (n_elements == 0) + return chunks; /* nothing to do */ + marray = chunks; + array_size = 0; + } + else { + /* if empty req, must still return chunk representing empty array */ + if (n_elements == 0) + return (void**)internal_malloc(m, 0); + marray = 0; + array_size = request2size(n_elements * (sizeof(void*))); + } + + /* compute total element size */ + if (opts & 0x1) { /* all-same-size */ + element_size = request2size(*sizes); + contents_size = n_elements * element_size; + } + else { /* add up all the sizes */ + element_size = 0; + contents_size = 0; + for (i = 0; i != n_elements; ++i) + contents_size += request2size(sizes[i]); + } + + size = contents_size + array_size; + + /* + Allocate the aggregate chunk. First disable direct-mmapping so + malloc won't use it, since we would not be able to later + free/realloc space internal to a segregated mmap region. + */ + was_enabled = use_mmap(m); + disable_mmap(m); + mem = internal_malloc(m, size - CHUNK_OVERHEAD); + if (was_enabled) + enable_mmap(m); + if (mem == 0) + return 0; + + if (PREACTION(m)) return 0; + p = mem2chunk(mem); + remainder_size = chunksize(p); + + assert(!is_mmapped(p)); + + if (opts & 0x2) { /* optionally clear the elements */ + memset((size_t*)mem, 0, remainder_size - SIZE_T_SIZE - array_size); + } + + /* If not provided, allocate the pointer array as final part of chunk */ + if (marray == 0) { + size_t array_chunk_size; + array_chunk = chunk_plus_offset(p, contents_size); + array_chunk_size = remainder_size - contents_size; + marray = (void**) (chunk2mem(array_chunk)); + set_size_and_pinuse_of_inuse_chunk(m, array_chunk, array_chunk_size); + remainder_size = contents_size; + } + + /* split out elements */ + for (i = 0; ; ++i) { + marray[i] = chunk2mem(p); + if (i != n_elements-1) { + if (element_size != 0) + size = element_size; + else + size = request2size(sizes[i]); + remainder_size -= size; + set_size_and_pinuse_of_inuse_chunk(m, p, size); + p = chunk_plus_offset(p, size); + } + else { /* the final element absorbs any overallocation slop */ + set_size_and_pinuse_of_inuse_chunk(m, p, remainder_size); + break; + } + } + +#if DEBUG + if (marray != chunks) { + /* final element must have exactly exhausted chunk */ + if (element_size != 0) { + assert(remainder_size == element_size); + } + else { + assert(remainder_size == request2size(sizes[i])); + } + check_inuse_chunk(m, mem2chunk(marray)); + } + for (i = 0; i != n_elements; ++i) + check_inuse_chunk(m, mem2chunk(marray[i])); + +#endif /* DEBUG */ + + POSTACTION(m); + return marray; +} + + +/* -------------------------- public routines ---------------------------- */ + +#if !ONLY_MSPACES + +void* dlmalloc(size_t bytes) { + /* + Basic algorithm: + If a small request (< 256 bytes minus per-chunk overhead): + 1. If one exists, use a remainderless chunk in associated smallbin. + (Remainderless means that there are too few excess bytes to + represent as a chunk.) + 2. If it is big enough, use the dv chunk, which is normally the + chunk adjacent to the one used for the most recent small request. + 3. If one exists, split the smallest available chunk in a bin, + saving remainder in dv. + 4. If it is big enough, use the top chunk. + 5. If available, get memory from system and use it + Otherwise, for a large request: + 1. Find the smallest available binned chunk that fits, and use it + if it is better fitting than dv chunk, splitting if necessary. + 2. If better fitting than any binned chunk, use the dv chunk. + 3. If it is big enough, use the top chunk. + 4. If request size >= mmap threshold, try to directly mmap this chunk. + 5. If available, get memory from system and use it + + The ugly goto's here ensure that postaction occurs along all paths. + */ + + if (!PREACTION(gm)) { + void* mem; + size_t nb; + if (bytes <= MAX_SMALL_REQUEST) { + bindex_t idx; + binmap_t smallbits; + nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes); + idx = small_index(nb); + smallbits = gm->smallmap >> idx; + + if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */ + mchunkptr b, p; + idx += ~smallbits & 1; /* Uses next bin if idx empty */ + b = smallbin_at(gm, idx); + p = b->fd; + assert(chunksize(p) == small_index2size(idx)); + unlink_first_small_chunk(gm, b, p, idx); + set_inuse_and_pinuse(gm, p, small_index2size(idx)); + mem = chunk2mem(p); + check_malloced_chunk(gm, mem, nb); + goto postaction; + } + + else if (nb > gm->dvsize) { + if (smallbits != 0) { /* Use chunk in next nonempty smallbin */ + mchunkptr b, p, r; + size_t rsize; + bindex_t i; + binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx)); + binmap_t leastbit = least_bit(leftbits); + compute_bit2idx(leastbit, i); + b = smallbin_at(gm, i); + p = b->fd; + assert(chunksize(p) == small_index2size(i)); + unlink_first_small_chunk(gm, b, p, i); + rsize = small_index2size(i) - nb; + /* Fit here cannot be remainderless if 4byte sizes */ + if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE) + set_inuse_and_pinuse(gm, p, small_index2size(i)); + else { + set_size_and_pinuse_of_inuse_chunk(gm, p, nb); + r = chunk_plus_offset(p, nb); + set_size_and_pinuse_of_free_chunk(r, rsize); + replace_dv(gm, r, rsize); + } + mem = chunk2mem(p); + check_malloced_chunk(gm, mem, nb); + goto postaction; + } + + else if (gm->treemap != 0 && (mem = tmalloc_small(gm, nb)) != 0) { + check_malloced_chunk(gm, mem, nb); + goto postaction; + } + } + } + else if (bytes >= MAX_REQUEST) + nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */ + else { + nb = pad_request(bytes); + if (gm->treemap != 0 && (mem = tmalloc_large(gm, nb)) != 0) { + check_malloced_chunk(gm, mem, nb); + goto postaction; + } + } + + if (nb <= gm->dvsize) { + size_t rsize = gm->dvsize - nb; + mchunkptr p = gm->dv; + if (rsize >= MIN_CHUNK_SIZE) { /* split dv */ + mchunkptr r = gm->dv = chunk_plus_offset(p, nb); + gm->dvsize = rsize; + set_size_and_pinuse_of_free_chunk(r, rsize); + set_size_and_pinuse_of_inuse_chunk(gm, p, nb); + } + else { /* exhaust dv */ + size_t dvs = gm->dvsize; + gm->dvsize = 0; + gm->dv = 0; + set_inuse_and_pinuse(gm, p, dvs); + } + mem = chunk2mem(p); + check_malloced_chunk(gm, mem, nb); + goto postaction; + } + + else if (nb < gm->topsize) { /* Split top */ + size_t rsize = gm->topsize -= nb; + mchunkptr p = gm->top; + mchunkptr r = gm->top = chunk_plus_offset(p, nb); + r->head = rsize | PINUSE_BIT; + set_size_and_pinuse_of_inuse_chunk(gm, p, nb); + mem = chunk2mem(p); + check_top_chunk(gm, gm->top); + check_malloced_chunk(gm, mem, nb); + goto postaction; + } + + mem = sys_alloc(gm, nb); + + postaction: + POSTACTION(gm); + return mem; + } + + return 0; +} + +void dlfree(void* mem) { + /* + Consolidate freed chunks with preceding or succeeding bordering + free chunks, if they exist, and then place in a bin. Intermixed + with special cases for top, dv, mmapped chunks, and usage errors. + */ + + if (mem != 0) { + mchunkptr p = mem2chunk(mem); +#if FOOTERS + mstate fm = get_mstate_for(p); + if (!ok_magic(fm)) { + USAGE_ERROR_ACTION(fm, p); + return; + } +#else /* FOOTERS */ +#define fm gm +#endif /* FOOTERS */ + if (!PREACTION(fm)) { + check_inuse_chunk(fm, p); + if (RTCHECK(ok_address(fm, p) && ok_cinuse(p))) { + size_t psize = chunksize(p); + mchunkptr next = chunk_plus_offset(p, psize); + if (!pinuse(p)) { + size_t prevsize = p->prev_foot; + if ((prevsize & IS_MMAPPED_BIT) != 0) { + prevsize &= ~IS_MMAPPED_BIT; + psize += prevsize + MMAP_FOOT_PAD; + if (CALL_MUNMAP((char*)p - prevsize, psize) == 0) + fm->footprint -= psize; + goto postaction; + } + else { + mchunkptr prev = chunk_minus_offset(p, prevsize); + psize += prevsize; + p = prev; + if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */ + if (p != fm->dv) { + unlink_chunk(fm, p, prevsize); + } + else if ((next->head & INUSE_BITS) == INUSE_BITS) { + fm->dvsize = psize; + set_free_with_pinuse(p, psize, next); + goto postaction; + } + } + else + goto erroraction; + } + } + + if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) { + if (!cinuse(next)) { /* consolidate forward */ + if (next == fm->top) { + size_t tsize = fm->topsize += psize; + fm->top = p; + p->head = tsize | PINUSE_BIT; + if (p == fm->dv) { + fm->dv = 0; + fm->dvsize = 0; + } + if (should_trim(fm, tsize)) + sys_trim(fm, 0); + goto postaction; + } + else if (next == fm->dv) { + size_t dsize = fm->dvsize += psize; + fm->dv = p; + set_size_and_pinuse_of_free_chunk(p, dsize); + goto postaction; + } + else { + size_t nsize = chunksize(next); + psize += nsize; + unlink_chunk(fm, next, nsize); + set_size_and_pinuse_of_free_chunk(p, psize); + if (p == fm->dv) { + fm->dvsize = psize; + goto postaction; + } + } + } + else + set_free_with_pinuse(p, psize, next); + insert_chunk(fm, p, psize); + check_free_chunk(fm, p); + goto postaction; + } + } + erroraction: + USAGE_ERROR_ACTION(fm, p); + postaction: + POSTACTION(fm); + } + } +#if !FOOTERS +#undef fm +#endif /* FOOTERS */ +} + +void* dlcalloc(size_t n_elements, size_t elem_size) { + void* mem; + size_t req = 0; + if (n_elements != 0) { + req = n_elements * elem_size; + if (((n_elements | elem_size) & ~(size_t)0xffff) && + (req / n_elements != elem_size)) + req = MAX_SIZE_T; /* force downstream failure on overflow */ + } + mem = dlmalloc(req); + if (mem != 0 && calloc_must_clear(mem2chunk(mem))) + memset(mem, 0, req); + return mem; +} + +void* dlrealloc(void* oldmem, size_t bytes) { + if (oldmem == 0) + return dlmalloc(bytes); +#ifdef REALLOC_ZERO_BYTES_FREES + if (bytes == 0) { + dlfree(oldmem); + return 0; + } +#endif /* REALLOC_ZERO_BYTES_FREES */ + else { +#if ! FOOTERS + mstate m = gm; +#else /* FOOTERS */ + mstate m = get_mstate_for(mem2chunk(oldmem)); + if (!ok_magic(m)) { + USAGE_ERROR_ACTION(m, oldmem); + return 0; + } +#endif /* FOOTERS */ + return internal_realloc(m, oldmem, bytes); + } +} + +void* dlmemalign(size_t alignment, size_t bytes) { + return internal_memalign(gm, alignment, bytes); +} + +void** dlindependent_calloc(size_t n_elements, size_t elem_size, + void* chunks[]) { + size_t sz = elem_size; /* serves as 1-element array */ + return ialloc(gm, n_elements, &sz, 3, chunks); +} + +void** dlindependent_comalloc(size_t n_elements, size_t sizes[], + void* chunks[]) { + return ialloc(gm, n_elements, sizes, 0, chunks); +} + +void* dlvalloc(size_t bytes) { + size_t pagesz; + init_mparams(); + pagesz = mparams.page_size; + return dlmemalign(pagesz, bytes); +} + +void* dlpvalloc(size_t bytes) { + size_t pagesz; + init_mparams(); + pagesz = mparams.page_size; + return dlmemalign(pagesz, (bytes + pagesz - SIZE_T_ONE) & ~(pagesz - SIZE_T_ONE)); +} + +int dlmalloc_trim(size_t pad) { + int result = 0; + if (!PREACTION(gm)) { + result = sys_trim(gm, pad); + POSTACTION(gm); + } + return result; +} + +size_t dlmalloc_footprint(void) { + return gm->footprint; +} + +size_t dlmalloc_max_footprint(void) { + return gm->max_footprint; +} + +#if !NO_MALLINFO +struct mallinfo dlmallinfo(void) { + return internal_mallinfo(gm); +} +#endif /* NO_MALLINFO */ + +void dlmalloc_stats() { + internal_malloc_stats(gm); +} + +size_t dlmalloc_usable_size(void* mem) { + if (mem != 0) { + mchunkptr p = mem2chunk(mem); + if (cinuse(p)) + return chunksize(p) - overhead_for(p); + } + return 0; +} + +int dlmallopt(int param_number, int value) { + return change_mparam(param_number, value); +} + +#endif /* !ONLY_MSPACES */ + +/* ----------------------------- user mspaces ---------------------------- */ + +#if MSPACES + +static mstate init_user_mstate(char* tbase, size_t tsize) { + size_t msize = pad_request(sizeof(struct malloc_state)); + mchunkptr mn; + mchunkptr msp = align_as_chunk(tbase); + mstate m = (mstate)(chunk2mem(msp)); + memset(m, 0, msize); + INITIAL_LOCK(&m->mutex); + msp->head = (msize|PINUSE_BIT|CINUSE_BIT); + m->seg.base = m->least_addr = tbase; + m->seg.size = m->footprint = m->max_footprint = tsize; + m->magic = mparams.magic; + m->mflags = mparams.default_mflags; + disable_contiguous(m); + init_bins(m); + mn = next_chunk(mem2chunk(m)); + init_top(m, mn, (size_t)((tbase + tsize) - (char*)mn) - TOP_FOOT_SIZE); + check_top_chunk(m, m->top); + return m; +} + +mspace create_mspace(size_t capacity, int locked) { + mstate m = 0; + size_t msize = pad_request(sizeof(struct malloc_state)); + init_mparams(); /* Ensure pagesize etc initialized */ + + if (capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) { + size_t rs = ((capacity == 0)? mparams.granularity : + (capacity + TOP_FOOT_SIZE + msize)); + size_t tsize = granularity_align(rs); + char* tbase = (char*)(CALL_MMAP(tsize)); + if (tbase != CMFAIL) { + m = init_user_mstate(tbase, tsize); + set_segment_flags(&m->seg, IS_MMAPPED_BIT); + set_lock(m, locked); + } + } + return (mspace)m; +} + +mspace create_mspace_with_base(void* base, size_t capacity, int locked) { + mstate m = 0; + size_t msize = pad_request(sizeof(struct malloc_state)); + init_mparams(); /* Ensure pagesize etc initialized */ + + if (capacity > msize + TOP_FOOT_SIZE && + capacity < (size_t) -(msize + TOP_FOOT_SIZE + mparams.page_size)) { + m = init_user_mstate((char*)base, capacity); + set_segment_flags(&m->seg, EXTERN_BIT); + set_lock(m, locked); + } + return (mspace)m; +} + +size_t destroy_mspace(mspace msp) { + size_t freed = 0; + mstate ms = (mstate)msp; + if (ok_magic(ms)) { + msegmentptr sp = &ms->seg; + while (sp != 0) { + char* base = sp->base; + size_t size = sp->size; + flag_t flag = get_segment_flags(sp); + sp = sp->next; + if ((flag & IS_MMAPPED_BIT) && !(flag & EXTERN_BIT) && + CALL_MUNMAP(base, size) == 0) + freed += size; + } + } + else { + USAGE_ERROR_ACTION(ms,ms); + } + return freed; +} + +/* + mspace versions of routines are near-clones of the global + versions. This is not so nice but better than the alternatives. +*/ + + +void* mspace_malloc(mspace msp, size_t bytes) { + mstate ms = (mstate)msp; + if (!ok_magic(ms)) { + USAGE_ERROR_ACTION(ms,ms); + return 0; + } + if (!PREACTION(ms)) { + void* mem; + size_t nb; + if (bytes <= MAX_SMALL_REQUEST) { + bindex_t idx; + binmap_t smallbits; + nb = (bytes < MIN_REQUEST)? MIN_CHUNK_SIZE : pad_request(bytes); + idx = small_index(nb); + smallbits = ms->smallmap >> idx; + + if ((smallbits & 0x3U) != 0) { /* Remainderless fit to a smallbin. */ + mchunkptr b, p; + idx += ~smallbits & 1; /* Uses next bin if idx empty */ + b = smallbin_at(ms, idx); + p = b->fd; + assert(chunksize(p) == small_index2size(idx)); + unlink_first_small_chunk(ms, b, p, idx); + set_inuse_and_pinuse(ms, p, small_index2size(idx)); + mem = chunk2mem(p); + check_malloced_chunk(ms, mem, nb); + goto postaction; + } + + else if (nb > ms->dvsize) { + if (smallbits != 0) { /* Use chunk in next nonempty smallbin */ + mchunkptr b, p, r; + size_t rsize; + bindex_t i; + binmap_t leftbits = (smallbits << idx) & left_bits(idx2bit(idx)); + binmap_t leastbit = least_bit(leftbits); + compute_bit2idx(leastbit, i); + b = smallbin_at(ms, i); + p = b->fd; + assert(chunksize(p) == small_index2size(i)); + unlink_first_small_chunk(ms, b, p, i); + rsize = small_index2size(i) - nb; + /* Fit here cannot be remainderless if 4byte sizes */ + if (SIZE_T_SIZE != 4 && rsize < MIN_CHUNK_SIZE) + set_inuse_and_pinuse(ms, p, small_index2size(i)); + else { + set_size_and_pinuse_of_inuse_chunk(ms, p, nb); + r = chunk_plus_offset(p, nb); + set_size_and_pinuse_of_free_chunk(r, rsize); + replace_dv(ms, r, rsize); + } + mem = chunk2mem(p); + check_malloced_chunk(ms, mem, nb); + goto postaction; + } + + else if (ms->treemap != 0 && (mem = tmalloc_small(ms, nb)) != 0) { + check_malloced_chunk(ms, mem, nb); + goto postaction; + } + } + } + else if (bytes >= MAX_REQUEST) + nb = MAX_SIZE_T; /* Too big to allocate. Force failure (in sys alloc) */ + else { + nb = pad_request(bytes); + if (ms->treemap != 0 && (mem = tmalloc_large(ms, nb)) != 0) { + check_malloced_chunk(ms, mem, nb); + goto postaction; + } + } + + if (nb <= ms->dvsize) { + size_t rsize = ms->dvsize - nb; + mchunkptr p = ms->dv; + if (rsize >= MIN_CHUNK_SIZE) { /* split dv */ + mchunkptr r = ms->dv = chunk_plus_offset(p, nb); + ms->dvsize = rsize; + set_size_and_pinuse_of_free_chunk(r, rsize); + set_size_and_pinuse_of_inuse_chunk(ms, p, nb); + } + else { /* exhaust dv */ + size_t dvs = ms->dvsize; + ms->dvsize = 0; + ms->dv = 0; + set_inuse_and_pinuse(ms, p, dvs); + } + mem = chunk2mem(p); + check_malloced_chunk(ms, mem, nb); + goto postaction; + } + + else if (nb < ms->topsize) { /* Split top */ + size_t rsize = ms->topsize -= nb; + mchunkptr p = ms->top; + mchunkptr r = ms->top = chunk_plus_offset(p, nb); + r->head = rsize | PINUSE_BIT; + set_size_and_pinuse_of_inuse_chunk(ms, p, nb); + mem = chunk2mem(p); + check_top_chunk(ms, ms->top); + check_malloced_chunk(ms, mem, nb); + goto postaction; + } + + mem = sys_alloc(ms, nb); + + postaction: + POSTACTION(ms); + return mem; + } + + return 0; +} + +void mspace_free(mspace msp, void* mem) { + if (mem != 0) { + mchunkptr p = mem2chunk(mem); +#if FOOTERS + mstate fm = get_mstate_for(p); +#else /* FOOTERS */ + mstate fm = (mstate)msp; +#endif /* FOOTERS */ + if (!ok_magic(fm)) { + USAGE_ERROR_ACTION(fm, p); + return; + } + if (!PREACTION(fm)) { + check_inuse_chunk(fm, p); + if (RTCHECK(ok_address(fm, p) && ok_cinuse(p))) { + size_t psize = chunksize(p); + mchunkptr next = chunk_plus_offset(p, psize); + if (!pinuse(p)) { + size_t prevsize = p->prev_foot; + if ((prevsize & IS_MMAPPED_BIT) != 0) { + prevsize &= ~IS_MMAPPED_BIT; + psize += prevsize + MMAP_FOOT_PAD; + if (CALL_MUNMAP((char*)p - prevsize, psize) == 0) + fm->footprint -= psize; + goto postaction; + } + else { + mchunkptr prev = chunk_minus_offset(p, prevsize); + psize += prevsize; + p = prev; + if (RTCHECK(ok_address(fm, prev))) { /* consolidate backward */ + if (p != fm->dv) { + unlink_chunk(fm, p, prevsize); + } + else if ((next->head & INUSE_BITS) == INUSE_BITS) { + fm->dvsize = psize; + set_free_with_pinuse(p, psize, next); + goto postaction; + } + } + else + goto erroraction; + } + } + + if (RTCHECK(ok_next(p, next) && ok_pinuse(next))) { + if (!cinuse(next)) { /* consolidate forward */ + if (next == fm->top) { + size_t tsize = fm->topsize += psize; + fm->top = p; + p->head = tsize | PINUSE_BIT; + if (p == fm->dv) { + fm->dv = 0; + fm->dvsize = 0; + } + if (should_trim(fm, tsize)) + sys_trim(fm, 0); + goto postaction; + } + else if (next == fm->dv) { + size_t dsize = fm->dvsize += psize; + fm->dv = p; + set_size_and_pinuse_of_free_chunk(p, dsize); + goto postaction; + } + else { + size_t nsize = chunksize(next); + psize += nsize; + unlink_chunk(fm, next, nsize); + set_size_and_pinuse_of_free_chunk(p, psize); + if (p == fm->dv) { + fm->dvsize = psize; + goto postaction; + } + } + } + else + set_free_with_pinuse(p, psize, next); + insert_chunk(fm, p, psize); + check_free_chunk(fm, p); + goto postaction; + } + } + erroraction: + USAGE_ERROR_ACTION(fm, p); + postaction: + POSTACTION(fm); + } + } +} + +void* mspace_calloc(mspace msp, size_t n_elements, size_t elem_size) { + void* mem; + size_t req = 0; + mstate ms = (mstate)msp; + if (!ok_magic(ms)) { + USAGE_ERROR_ACTION(ms,ms); + return 0; + } + if (n_elements != 0) { + req = n_elements * elem_size; + if (((n_elements | elem_size) & ~(size_t)0xffff) && + (req / n_elements != elem_size)) + req = MAX_SIZE_T; /* force downstream failure on overflow */ + } + mem = internal_malloc(ms, req); + if (mem != 0 && calloc_must_clear(mem2chunk(mem))) + memset(mem, 0, req); + return mem; +} + +void* mspace_realloc(mspace msp, void* oldmem, size_t bytes) { + if (oldmem == 0) + return mspace_malloc(msp, bytes); +#ifdef REALLOC_ZERO_BYTES_FREES + if (bytes == 0) { + mspace_free(msp, oldmem); + return 0; + } +#endif /* REALLOC_ZERO_BYTES_FREES */ + else { +#if FOOTERS + mchunkptr p = mem2chunk(oldmem); + mstate ms = get_mstate_for(p); +#else /* FOOTERS */ + mstate ms = (mstate)msp; +#endif /* FOOTERS */ + if (!ok_magic(ms)) { + USAGE_ERROR_ACTION(ms,ms); + return 0; + } + return internal_realloc(ms, oldmem, bytes); + } +} + +void* mspace_memalign(mspace msp, size_t alignment, size_t bytes) { + mstate ms = (mstate)msp; + if (!ok_magic(ms)) { + USAGE_ERROR_ACTION(ms,ms); + return 0; + } + return internal_memalign(ms, alignment, bytes); +} + +void** mspace_independent_calloc(mspace msp, size_t n_elements, + size_t elem_size, void* chunks[]) { + size_t sz = elem_size; /* serves as 1-element array */ + mstate ms = (mstate)msp; + if (!ok_magic(ms)) { + USAGE_ERROR_ACTION(ms,ms); + return 0; + } + return ialloc(ms, n_elements, &sz, 3, chunks); +} + +void** mspace_independent_comalloc(mspace msp, size_t n_elements, + size_t sizes[], void* chunks[]) { + mstate ms = (mstate)msp; + if (!ok_magic(ms)) { + USAGE_ERROR_ACTION(ms,ms); + return 0; + } + return ialloc(ms, n_elements, sizes, 0, chunks); +} + +int mspace_trim(mspace msp, size_t pad) { + int result = 0; + mstate ms = (mstate)msp; + if (ok_magic(ms)) { + if (!PREACTION(ms)) { + result = sys_trim(ms, pad); + POSTACTION(ms); + } + } + else { + USAGE_ERROR_ACTION(ms,ms); + } + return result; +} + +void mspace_malloc_stats(mspace msp) { + mstate ms = (mstate)msp; + if (ok_magic(ms)) { + internal_malloc_stats(ms); + } + else { + USAGE_ERROR_ACTION(ms,ms); + } +} + +size_t mspace_footprint(mspace msp) { + size_t result; + mstate ms = (mstate)msp; + if (ok_magic(ms)) { + result = ms->footprint; + } + USAGE_ERROR_ACTION(ms,ms); + return result; +} + + +size_t mspace_max_footprint(mspace msp) { + size_t result; + mstate ms = (mstate)msp; + if (ok_magic(ms)) { + result = ms->max_footprint; + } + USAGE_ERROR_ACTION(ms,ms); + return result; +} + + +#if !NO_MALLINFO +struct mallinfo mspace_mallinfo(mspace msp) { + mstate ms = (mstate)msp; + if (!ok_magic(ms)) { + USAGE_ERROR_ACTION(ms,ms); + } + return internal_mallinfo(ms); +} +#endif /* NO_MALLINFO */ + +int mspace_mallopt(int param_number, int value) { + return change_mparam(param_number, value); +} + +#endif /* MSPACES */ + +/* -------------------- Alternative MORECORE functions ------------------- */ + +/* + Guidelines for creating a custom version of MORECORE: + + * For best performance, MORECORE should allocate in multiples of pagesize. + * MORECORE may allocate more memory than requested. (Or even less, + but this will usually result in a malloc failure.) + * MORECORE must not allocate memory when given argument zero, but + instead return one past the end address of memory from previous + nonzero call. + * For best performance, consecutive calls to MORECORE with positive + arguments should return increasing addresses, indicating that + space has been contiguously extended. + * Even though consecutive calls to MORECORE need not return contiguous + addresses, it must be OK for malloc'ed chunks to span multiple + regions in those cases where they do happen to be contiguous. + * MORECORE need not handle negative arguments -- it may instead + just return MFAIL when given negative arguments. + Negative arguments are always multiples of pagesize. MORECORE + must not misinterpret negative args as large positive unsigned + args. You can suppress all such calls from even occurring by defining + MORECORE_CANNOT_TRIM, + + As an example alternative MORECORE, here is a custom allocator + kindly contributed for pre-OSX macOS. It uses virtually but not + necessarily physically contiguous non-paged memory (locked in, + present and won't get swapped out). You can use it by uncommenting + this section, adding some #includes, and setting up the appropriate + defines above: + + #define MORECORE osMoreCore + + There is also a shutdown routine that should somehow be called for + cleanup upon program exit. + + #define MAX_POOL_ENTRIES 100 + #define MINIMUM_MORECORE_SIZE (64 * 1024U) + static int next_os_pool; + void *our_os_pools[MAX_POOL_ENTRIES]; + + void *osMoreCore(int size) + { + void *ptr = 0; + static void *sbrk_top = 0; + + if (size > 0) + { + if (size < MINIMUM_MORECORE_SIZE) + size = MINIMUM_MORECORE_SIZE; + if (CurrentExecutionLevel() == kTaskLevel) + ptr = PoolAllocateResident(size + RM_PAGE_SIZE, 0); + if (ptr == 0) + { + return (void *) MFAIL; + } + // save ptrs so they can be freed during cleanup + our_os_pools[next_os_pool] = ptr; + next_os_pool++; + ptr = (void *) ((((size_t) ptr) + RM_PAGE_MASK) & ~RM_PAGE_MASK); + sbrk_top = (char *) ptr + size; + return ptr; + } + else if (size < 0) + { + // we don't currently support shrink behavior + return (void *) MFAIL; + } + else + { + return sbrk_top; + } + } + + // cleanup any allocated memory pools + // called as last thing before shutting down driver + + void osCleanupMem(void) + { + void **ptr; + + for (ptr = our_os_pools; ptr < &our_os_pools[MAX_POOL_ENTRIES]; ptr++) + if (*ptr) + { + PoolDeallocate(*ptr); + *ptr = 0; + } + } + +*/ + + +/* ----------------------------------------------------------------------- +History: + V2.8.3 Thu Sep 22 11:16:32 2005 Doug Lea (dl at gee) + * Add max_footprint functions + * Ensure all appropriate literals are size_t + * Fix conditional compilation problem for some #define settings + * Avoid concatenating segments with the one provided + in create_mspace_with_base + * Rename some variables to avoid compiler shadowing warnings + * Use explicit lock initialization. + * Better handling of sbrk interference. + * Simplify and fix segment insertion, trimming and mspace_destroy + * Reinstate REALLOC_ZERO_BYTES_FREES option from 2.7.x + * Thanks especially to Dennis Flanagan for help on these. + + V2.8.2 Sun Jun 12 16:01:10 2005 Doug Lea (dl at gee) + * Fix memalign brace error. + + V2.8.1 Wed Jun 8 16:11:46 2005 Doug Lea (dl at gee) + * Fix improper #endif nesting in C++ + * Add explicit casts needed for C++ + + V2.8.0 Mon May 30 14:09:02 2005 Doug Lea (dl at gee) + * Use trees for large bins + * Support mspaces + * Use segments to unify sbrk-based and mmap-based system allocation, + removing need for emulation on most platforms without sbrk. + * Default safety checks + * Optional footer checks. Thanks to William Robertson for the idea. + * Internal code refactoring + * Incorporate suggestions and platform-specific changes. + Thanks to Dennis Flanagan, Colin Plumb, Niall Douglas, + Aaron Bachmann, Emery Berger, and others. + * Speed up non-fastbin processing enough to remove fastbins. + * Remove useless cfree() to avoid conflicts with other apps. + * Remove internal memcpy, memset. Compilers handle builtins better. + * Remove some options that no one ever used and rename others. + + V2.7.2 Sat Aug 17 09:07:30 2002 Doug Lea (dl at gee) + * Fix malloc_state bitmap array misdeclaration + + V2.7.1 Thu Jul 25 10:58:03 2002 Doug Lea (dl at gee) + * Allow tuning of FIRST_SORTED_BIN_SIZE + * Use PTR_UINT as type for all ptr->int casts. Thanks to John Belmonte. + * Better detection and support for non-contiguousness of MORECORE. + Thanks to Andreas Mueller, Conal Walsh, and Wolfram Gloger + * Bypass most of malloc if no frees. Thanks To Emery Berger. + * Fix freeing of old top non-contiguous chunk im sysmalloc. + * Raised default trim and map thresholds to 256K. + * Fix mmap-related #defines. Thanks to Lubos Lunak. + * Fix copy macros; added LACKS_FCNTL_H. Thanks to Neal Walfield. + * Branch-free bin calculation + * Default trim and mmap thresholds now 256K. + + V2.7.0 Sun Mar 11 14:14:06 2001 Doug Lea (dl at gee) + * Introduce independent_comalloc and independent_calloc. + Thanks to Michael Pachos for motivation and help. + * Make optional .h file available + * Allow > 2GB requests on 32bit systems. + * new WIN32 sbrk, mmap, munmap, lock code from . + Thanks also to Andreas Mueller , + and Anonymous. + * Allow override of MALLOC_ALIGNMENT (Thanks to Ruud Waij for + helping test this.) + * memalign: check alignment arg + * realloc: don't try to shift chunks backwards, since this + leads to more fragmentation in some programs and doesn't + seem to help in any others. + * Collect all cases in malloc requiring system memory into sysmalloc + * Use mmap as backup to sbrk + * Place all internal state in malloc_state + * Introduce fastbins (although similar to 2.5.1) + * Many minor tunings and cosmetic improvements + * Introduce USE_PUBLIC_MALLOC_WRAPPERS, USE_MALLOC_LOCK + * Introduce MALLOC_FAILURE_ACTION, MORECORE_CONTIGUOUS + Thanks to Tony E. Bennett and others. + * Include errno.h to support default failure action. + + V2.6.6 Sun Dec 5 07:42:19 1999 Doug Lea (dl at gee) + * return null for negative arguments + * Added Several WIN32 cleanups from Martin C. Fong + * Add 'LACKS_SYS_PARAM_H' for those systems without 'sys/param.h' + (e.g. WIN32 platforms) + * Cleanup header file inclusion for WIN32 platforms + * Cleanup code to avoid Microsoft Visual C++ compiler complaints + * Add 'USE_DL_PREFIX' to quickly allow co-existence with existing + memory allocation routines + * Set 'malloc_getpagesize' for WIN32 platforms (needs more work) + * Use 'assert' rather than 'ASSERT' in WIN32 code to conform to + usage of 'assert' in non-WIN32 code + * Improve WIN32 'sbrk()' emulation's 'findRegion()' routine to + avoid infinite loop + * Always call 'fREe()' rather than 'free()' + + V2.6.5 Wed Jun 17 15:57:31 1998 Doug Lea (dl at gee) + * Fixed ordering problem with boundary-stamping + + V2.6.3 Sun May 19 08:17:58 1996 Doug Lea (dl at gee) + * Added pvalloc, as recommended by H.J. Liu + * Added 64bit pointer support mainly from Wolfram Gloger + * Added anonymously donated WIN32 sbrk emulation + * Malloc, calloc, getpagesize: add optimizations from Raymond Nijssen + * malloc_extend_top: fix mask error that caused wastage after + foreign sbrks + * Add linux mremap support code from HJ Liu + + V2.6.2 Tue Dec 5 06:52:55 1995 Doug Lea (dl at gee) + * Integrated most documentation with the code. + * Add support for mmap, with help from + Wolfram Gloger (Gloger@lrz.uni-muenchen.de). + * Use last_remainder in more cases. + * Pack bins using idea from colin@nyx10.cs.du.edu + * Use ordered bins instead of best-fit threshhold + * Eliminate block-local decls to simplify tracing and debugging. + * Support another case of realloc via move into top + * Fix error occuring when initial sbrk_base not word-aligned. + * Rely on page size for units instead of SBRK_UNIT to + avoid surprises about sbrk alignment conventions. + * Add mallinfo, mallopt. Thanks to Raymond Nijssen + (raymond@es.ele.tue.nl) for the suggestion. + * Add `pad' argument to malloc_trim and top_pad mallopt parameter. + * More precautions for cases where other routines call sbrk, + courtesy of Wolfram Gloger (Gloger@lrz.uni-muenchen.de). + * Added macros etc., allowing use in linux libc from + H.J. Lu (hjl@gnu.ai.mit.edu) + * Inverted this history list + + V2.6.1 Sat Dec 2 14:10:57 1995 Doug Lea (dl at gee) + * Re-tuned and fixed to behave more nicely with V2.6.0 changes. + * Removed all preallocation code since under current scheme + the work required to undo bad preallocations exceeds + the work saved in good cases for most test programs. + * No longer use return list or unconsolidated bins since + no scheme using them consistently outperforms those that don't + given above changes. + * Use best fit for very large chunks to prevent some worst-cases. + * Added some support for debugging + + V2.6.0 Sat Nov 4 07:05:23 1995 Doug Lea (dl at gee) + * Removed footers when chunks are in use. Thanks to + Paul Wilson (wilson@cs.texas.edu) for the suggestion. + + V2.5.4 Wed Nov 1 07:54:51 1995 Doug Lea (dl at gee) + * Added malloc_trim, with help from Wolfram Gloger + (wmglo@Dent.MED.Uni-Muenchen.DE). + + V2.5.3 Tue Apr 26 10:16:01 1994 Doug Lea (dl at g) + + V2.5.2 Tue Apr 5 16:20:40 1994 Doug Lea (dl at g) + * realloc: try to expand in both directions + * malloc: swap order of clean-bin strategy; + * realloc: only conditionally expand backwards + * Try not to scavenge used bins + * Use bin counts as a guide to preallocation + * Occasionally bin return list chunks in first scan + * Add a few optimizations from colin@nyx10.cs.du.edu + + V2.5.1 Sat Aug 14 15:40:43 1993 Doug Lea (dl at g) + * faster bin computation & slightly different binning + * merged all consolidations to one part of malloc proper + (eliminating old malloc_find_space & malloc_clean_bin) + * Scan 2 returns chunks (not just 1) + * Propagate failure in realloc if malloc returns 0 + * Add stuff to allow compilation on non-ANSI compilers + from kpv@research.att.com + + V2.5 Sat Aug 7 07:41:59 1993 Doug Lea (dl at g.oswego.edu) + * removed potential for odd address access in prev_chunk + * removed dependency on getpagesize.h + * misc cosmetics and a bit more internal documentation + * anticosmetics: mangled names in macros to evade debugger strangeness + * tested on sparc, hp-700, dec-mips, rs6000 + with gcc & native cc (hp, dec only) allowing + Detlefs & Zorn comparison study (in SIGPLAN Notices.) + + Trial version Fri Aug 28 13:14:29 1992 Doug Lea (dl at g.oswego.edu) + * Based loosely on libg++-1.2X malloc. (It retains some of the overall + structure of old version, but most details differ.) + +*/ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/frv/eabi.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/frv/eabi.S new file mode 100644 index 000000000..379ea4bb0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/frv/eabi.S @@ -0,0 +1,128 @@ +/* ----------------------------------------------------------------------- + eabi.S - Copyright (c) 2004 Anthony Green + + FR-V Assembly glue. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + + .globl ffi_prep_args_EABI + + .text + .p2align 4 + .globl ffi_call_EABI + .type ffi_call_EABI, @function + + # gr8 : ffi_prep_args + # gr9 : &ecif + # gr10: cif->bytes + # gr11: fig->flags + # gr12: ecif.rvalue + # gr13: fn + +ffi_call_EABI: + addi sp, #-80, sp + sti fp, @(sp, #24) + addi sp, #24, fp + movsg lr, gr5 + + /* Make room for the new arguments. */ + /* subi sp, fp, gr10 */ + + /* Store return address and incoming args on stack. */ + sti gr5, @(fp, #8) + sti gr8, @(fp, #-4) + sti gr9, @(fp, #-8) + sti gr10, @(fp, #-12) + sti gr11, @(fp, #-16) + sti gr12, @(fp, #-20) + sti gr13, @(fp, #-24) + + sub sp, gr10, sp + + /* Call ffi_prep_args. */ + ldi @(fp, #-4), gr4 + addi sp, #0, gr8 + ldi @(fp, #-8), gr9 +#ifdef __FRV_FDPIC__ + ldd @(gr4, gr0), gr14 + calll @(gr14, gr0) +#else + calll @(gr4, gr0) +#endif + + /* ffi_prep_args returns the new stack pointer. */ + mov gr8, gr4 + + ldi @(sp, #0), gr8 + ldi @(sp, #4), gr9 + ldi @(sp, #8), gr10 + ldi @(sp, #12), gr11 + ldi @(sp, #16), gr12 + ldi @(sp, #20), gr13 + + /* Always copy the return value pointer into the hidden + parameter register. This is only strictly necessary + when we're returning an aggregate type, but it doesn't + hurt to do this all the time, and it saves a branch. */ + ldi @(fp, #-20), gr3 + + /* Use the ffi_prep_args return value for the new sp. */ + mov gr4, sp + + /* Call the target function. */ + ldi @(fp, -24), gr4 +#ifdef __FRV_FDPIC__ + ldd @(gr4, gr0), gr14 + calll @(gr14, gr0) +#else + calll @(gr4, gr0) +#endif + + /* Store the result. */ + ldi @(fp, #-16), gr10 /* fig->flags */ + ldi @(fp, #-20), gr4 /* ecif.rvalue */ + + /* Is the return value stored in two registers? */ + cmpi gr10, #8, icc0 + bne icc0, 0, .L2 + /* Yes, save them. */ + sti gr8, @(gr4, #0) + sti gr9, @(gr4, #4) + bra .L3 +.L2: + /* Is the return value a structure? */ + cmpi gr10, #-1, icc0 + beq icc0, 0, .L3 + /* No, save a 4 byte return value. */ + sti gr8, @(gr4, #0) +.L3: + + /* Restore the stack, and return. */ + ldi @(fp, 8), gr5 + ld @(fp, gr0), fp + addi sp,#80,sp + jmpl @(gr5,gr0) + .size ffi_call_EABI, .-ffi_call_EABI + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/frv/ffi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/frv/ffi.c new file mode 100644 index 000000000..5698c89c3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/frv/ffi.c @@ -0,0 +1,292 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (C) 2004 Anthony Green + Copyright (C) 2007 Free Software Foundation, Inc. + Copyright (C) 2008 Red Hat, Inc. + + FR-V Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +#include + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments */ + +void *ffi_prep_args(char *stack, extended_cif *ecif) +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + register int count = 0; + + p_argv = ecif->avalue; + argp = stack; + + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; + (i != 0); + i--, p_arg++) + { + size_t z; + + z = (*p_arg)->size; + + if ((*p_arg)->type == FFI_TYPE_STRUCT) + { + z = sizeof(void*); + *(void **) argp = *p_argv; + } + /* if ((*p_arg)->type == FFI_TYPE_FLOAT) + { + if (count > 24) + { + // This is going on the stack. Turn it into a double. + *(double *) argp = (double) *(float*)(* p_argv); + z = sizeof(double); + } + else + *(void **) argp = *(void **)(* p_argv); + } */ + else if (z < sizeof(int)) + { + z = sizeof(int); + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); + break; + + case FFI_TYPE_UINT8: + *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); + break; + + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); + break; + + case FFI_TYPE_UINT16: + *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); + break; + + default: + FFI_ASSERT(0); + } + } + else if (z == sizeof(int)) + { + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + } + else + { + memcpy(argp, *p_argv, z); + } + p_argv++; + argp += z; + count += z; + } + + return (stack + ((count > 24) ? 24 : ALIGN_DOWN(count, 8))); +} + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + if (cif->rtype->type == FFI_TYPE_STRUCT) + cif->flags = -1; + else + cif->flags = cif->rtype->size; + + cif->bytes = ALIGN (cif->bytes, 8); + + return FFI_OK; +} + +extern void ffi_call_EABI(void *(*)(char *, extended_cif *), + extended_cif *, + unsigned, unsigned, + unsigned *, + void (*fn)(void)); + +void ffi_call(ffi_cif *cif, + void (*fn)(void), + void *rvalue, + void **avalue) +{ + extended_cif ecif; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + + if ((rvalue == NULL) && + (cif->rtype->type == FFI_TYPE_STRUCT)) + { + ecif.rvalue = alloca(cif->rtype->size); + } + else + ecif.rvalue = rvalue; + + + switch (cif->abi) + { + case FFI_EABI: + ffi_call_EABI(ffi_prep_args, &ecif, cif->bytes, + cif->flags, ecif.rvalue, fn); + break; + default: + FFI_ASSERT(0); + break; + } +} + +void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3, + unsigned arg4, unsigned arg5, unsigned arg6) +{ + /* This function is called by a trampoline. The trampoline stows a + pointer to the ffi_closure object in gr7. We must save this + pointer in a place that will persist while we do our work. */ + register ffi_closure *creg __asm__ ("gr7"); + ffi_closure *closure = creg; + + /* Arguments that don't fit in registers are found on the stack + at a fixed offset above the current frame pointer. */ + register char *frame_pointer __asm__ ("fp"); + char *stack_args = frame_pointer + 16; + + /* Lay the register arguments down in a continuous chunk of memory. */ + unsigned register_args[6] = + { arg1, arg2, arg3, arg4, arg5, arg6 }; + + ffi_cif *cif = closure->cif; + ffi_type **arg_types = cif->arg_types; + void **avalue = alloca (cif->nargs * sizeof(void *)); + char *ptr = (char *) register_args; + int i; + + /* Find the address of each argument. */ + for (i = 0; i < cif->nargs; i++) + { + switch (arg_types[i]->type) + { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + avalue[i] = ptr + 3; + break; + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + avalue[i] = ptr + 2; + break; + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + case FFI_TYPE_FLOAT: + avalue[i] = ptr; + break; + case FFI_TYPE_STRUCT: + avalue[i] = *(void**)ptr; + break; + default: + /* This is an 8-byte value. */ + avalue[i] = ptr; + ptr += 4; + break; + } + ptr += 4; + + /* If we've handled more arguments than fit in registers, + start looking at the those passed on the stack. */ + if (ptr == ((char *)register_args + (6*4))) + ptr = stack_args; + } + + /* Invoke the closure. */ + if (cif->rtype->type == FFI_TYPE_STRUCT) + { + /* The caller allocates space for the return structure, and + passes a pointer to this space in gr3. Use this value directly + as the return value. */ + register void *return_struct_ptr __asm__("gr3"); + (closure->fun) (cif, return_struct_ptr, avalue, closure->user_data); + } + else + { + /* Allocate space for the return value and call the function. */ + long long rvalue; + (closure->fun) (cif, &rvalue, avalue, closure->user_data); + + /* Functions return 4-byte or smaller results in gr8. 8-byte + values also use gr9. We fill the both, even for small return + values, just to avoid a branch. */ + asm ("ldi @(%0, #0), gr8" : : "r" (&rvalue)); + asm ("ldi @(%0, #0), gr9" : : "r" (&((int *) &rvalue)[1])); + } +} + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void *user_data, + void *codeloc) +{ + unsigned int *tramp = (unsigned int *) &closure->tramp[0]; + unsigned long fn = (long) ffi_closure_eabi; + unsigned long cls = (long) codeloc; +#ifdef __FRV_FDPIC__ + register void *got __asm__("gr15"); +#endif + int i; + + fn = (unsigned long) ffi_closure_eabi; + +#ifdef __FRV_FDPIC__ + tramp[0] = &((unsigned int *)codeloc)[2]; + tramp[1] = got; + tramp[2] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */ + tramp[3] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */ + tramp[4] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */ + tramp[5] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */ + tramp[6] = 0x9cc86000; /* ldi @(gr6, #0), gr14 */ + tramp[7] = 0x8030e000; /* jmpl @(gr14, gr0) */ +#else + tramp[0] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */ + tramp[1] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */ + tramp[2] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */ + tramp[3] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */ + tramp[4] = 0x80300006; /* jmpl @(gr0, gr6) */ +#endif + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + + /* Cache flushing. */ + for (i = 0; i < FFI_TRAMPOLINE_SIZE; i++) + __asm__ volatile ("dcf @(%0,%1)\n\tici @(%2,%1)" :: "r" (tramp), "r" (i), + "r" (codeloc)); + + return FFI_OK; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/frv/ffitarget.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/frv/ffitarget.h new file mode 100644 index 000000000..4839069dc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/frv/ffitarget.h @@ -0,0 +1,57 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 1996-2004 Red Hat, Inc. + Target configuration macros for FR-V + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +/* ---- System specific configurations ----------------------------------- */ + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_EABI, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_EABI +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_NATIVE_RAW_API 0 + +#ifdef __FRV_FDPIC__ +/* Trampolines are 8 4-byte instructions long. */ +#define FFI_TRAMPOLINE_SIZE (8*4) +#else +/* Trampolines are 5 4-byte instructions long. */ +#define FFI_TRAMPOLINE_SIZE (5*4) +#endif + +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/ia64/ffi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/ia64/ffi.c new file mode 100644 index 000000000..60120edfd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/ia64/ffi.c @@ -0,0 +1,582 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2011 Anthony Green + Copyright (c) 2000 Hewlett Packard Company + Copyright (c) 1998, 2007, 2008 Red Hat, Inc. + + IA64 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +#include +#include +#include + +#include "ia64_flags.h" + +/* A 64-bit pointer value. In LP64 mode, this is effectively a plain + pointer. In ILP32 mode, it's a pointer that's been extended to + 64 bits by "addp4". */ +typedef void *PTR64 __attribute__((mode(DI))); + +/* Memory image of fp register contents. This is the implementation + specific format used by ldf.fill/stf.spill. All we care about is + that it wants a 16 byte aligned slot. */ +typedef struct +{ + UINT64 x[2] __attribute__((aligned(16))); +} fpreg; + + +/* The stack layout given to ffi_call_unix and ffi_closure_unix_inner. */ + +struct ia64_args +{ + fpreg fp_regs[8]; /* Contents of 8 fp arg registers. */ + UINT64 gp_regs[8]; /* Contents of 8 gp arg registers. */ + UINT64 other_args[]; /* Arguments passed on stack, variable size. */ +}; + + +/* Adjust ADDR, a pointer to an 8 byte slot, to point to the low LEN bytes. */ + +static inline void * +endian_adjust (void *addr, size_t len) +{ +#ifdef __BIG_ENDIAN__ + return addr + (8 - len); +#else + return addr; +#endif +} + +/* Store VALUE to ADDR in the current cpu implementation's fp spill format. + This is a macro instead of a function, so that it works for all 3 floating + point types without type conversions. Type conversion to long double breaks + the denorm support. */ + +#define stf_spill(addr, value) \ + asm ("stf.spill %0 = %1%P0" : "=m" (*addr) : "f"(value)); + +/* Load a value from ADDR, which is in the current cpu implementation's + fp spill format. As above, this must also be a macro. */ + +#define ldf_fill(result, addr) \ + asm ("ldf.fill %0 = %1%P1" : "=f"(result) : "m"(*addr)); + +/* Return the size of the C type associated with with TYPE. Which will + be one of the FFI_IA64_TYPE_HFA_* values. */ + +static size_t +hfa_type_size (int type) +{ + switch (type) + { + case FFI_IA64_TYPE_HFA_FLOAT: + return sizeof(float); + case FFI_IA64_TYPE_HFA_DOUBLE: + return sizeof(double); + case FFI_IA64_TYPE_HFA_LDOUBLE: + return sizeof(__float80); + default: + abort (); + } +} + +/* Load from ADDR a value indicated by TYPE. Which will be one of + the FFI_IA64_TYPE_HFA_* values. */ + +static void +hfa_type_load (fpreg *fpaddr, int type, void *addr) +{ + switch (type) + { + case FFI_IA64_TYPE_HFA_FLOAT: + stf_spill (fpaddr, *(float *) addr); + return; + case FFI_IA64_TYPE_HFA_DOUBLE: + stf_spill (fpaddr, *(double *) addr); + return; + case FFI_IA64_TYPE_HFA_LDOUBLE: + stf_spill (fpaddr, *(__float80 *) addr); + return; + default: + abort (); + } +} + +/* Load VALUE into ADDR as indicated by TYPE. Which will be one of + the FFI_IA64_TYPE_HFA_* values. */ + +static void +hfa_type_store (int type, void *addr, fpreg *fpaddr) +{ + switch (type) + { + case FFI_IA64_TYPE_HFA_FLOAT: + { + float result; + ldf_fill (result, fpaddr); + *(float *) addr = result; + break; + } + case FFI_IA64_TYPE_HFA_DOUBLE: + { + double result; + ldf_fill (result, fpaddr); + *(double *) addr = result; + break; + } + case FFI_IA64_TYPE_HFA_LDOUBLE: + { + __float80 result; + ldf_fill (result, fpaddr); + *(__float80 *) addr = result; + break; + } + default: + abort (); + } +} + +/* Is TYPE a struct containing floats, doubles, or extended doubles, + all of the same fp type? If so, return the element type. Return + FFI_TYPE_VOID if not. */ + +static int +hfa_element_type (ffi_type *type, int nested) +{ + int element = FFI_TYPE_VOID; + + switch (type->type) + { + case FFI_TYPE_FLOAT: + /* We want to return VOID for raw floating-point types, but the + synthetic HFA type if we're nested within an aggregate. */ + if (nested) + element = FFI_IA64_TYPE_HFA_FLOAT; + break; + + case FFI_TYPE_DOUBLE: + /* Similarly. */ + if (nested) + element = FFI_IA64_TYPE_HFA_DOUBLE; + break; + + case FFI_TYPE_LONGDOUBLE: + /* Similarly, except that that HFA is true for double extended, + but not quad precision. Both have sizeof == 16, so tell the + difference based on the precision. */ + if (LDBL_MANT_DIG == 64 && nested) + element = FFI_IA64_TYPE_HFA_LDOUBLE; + break; + + case FFI_TYPE_STRUCT: + { + ffi_type **ptr = &type->elements[0]; + + for (ptr = &type->elements[0]; *ptr ; ptr++) + { + int sub_element = hfa_element_type (*ptr, 1); + if (sub_element == FFI_TYPE_VOID) + return FFI_TYPE_VOID; + + if (element == FFI_TYPE_VOID) + element = sub_element; + else if (element != sub_element) + return FFI_TYPE_VOID; + } + } + break; + + default: + return FFI_TYPE_VOID; + } + + return element; +} + + +/* Perform machine dependent cif processing. */ + +ffi_status +ffi_prep_cif_machdep(ffi_cif *cif) +{ + int flags; + + /* Adjust cif->bytes to include space for the bits of the ia64_args frame + that precedes the integer register portion. The estimate that the + generic bits did for the argument space required is good enough for the + integer component. */ + cif->bytes += offsetof(struct ia64_args, gp_regs[0]); + if (cif->bytes < sizeof(struct ia64_args)) + cif->bytes = sizeof(struct ia64_args); + + /* Set the return type flag. */ + flags = cif->rtype->type; + switch (cif->rtype->type) + { + case FFI_TYPE_LONGDOUBLE: + /* Leave FFI_TYPE_LONGDOUBLE as meaning double extended precision, + and encode quad precision as a two-word integer structure. */ + if (LDBL_MANT_DIG != 64) + flags = FFI_IA64_TYPE_SMALL_STRUCT | (16 << 8); + break; + + case FFI_TYPE_STRUCT: + { + size_t size = cif->rtype->size; + int hfa_type = hfa_element_type (cif->rtype, 0); + + if (hfa_type != FFI_TYPE_VOID) + { + size_t nelts = size / hfa_type_size (hfa_type); + if (nelts <= 8) + flags = hfa_type | (size << 8); + } + else + { + if (size <= 32) + flags = FFI_IA64_TYPE_SMALL_STRUCT | (size << 8); + } + } + break; + + default: + break; + } + cif->flags = flags; + + return FFI_OK; +} + +extern int ffi_call_unix (struct ia64_args *, PTR64, void (*)(void), UINT64); + +void +ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + struct ia64_args *stack; + long i, avn, gpcount, fpcount; + ffi_type **p_arg; + + FFI_ASSERT (cif->abi == FFI_UNIX); + + /* If we have no spot for a return value, make one. */ + if (rvalue == NULL && cif->rtype->type != FFI_TYPE_VOID) + rvalue = alloca (cif->rtype->size); + + /* Allocate the stack frame. */ + stack = alloca (cif->bytes); + + gpcount = fpcount = 0; + avn = cif->nargs; + for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) + { + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + stack->gp_regs[gpcount++] = *(SINT8 *)avalue[i]; + break; + case FFI_TYPE_UINT8: + stack->gp_regs[gpcount++] = *(UINT8 *)avalue[i]; + break; + case FFI_TYPE_SINT16: + stack->gp_regs[gpcount++] = *(SINT16 *)avalue[i]; + break; + case FFI_TYPE_UINT16: + stack->gp_regs[gpcount++] = *(UINT16 *)avalue[i]; + break; + case FFI_TYPE_SINT32: + stack->gp_regs[gpcount++] = *(SINT32 *)avalue[i]; + break; + case FFI_TYPE_UINT32: + stack->gp_regs[gpcount++] = *(UINT32 *)avalue[i]; + break; + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + stack->gp_regs[gpcount++] = *(UINT64 *)avalue[i]; + break; + + case FFI_TYPE_POINTER: + stack->gp_regs[gpcount++] = (UINT64)(PTR64) *(void **)avalue[i]; + break; + + case FFI_TYPE_FLOAT: + if (gpcount < 8 && fpcount < 8) + stf_spill (&stack->fp_regs[fpcount++], *(float *)avalue[i]); + stack->gp_regs[gpcount++] = *(UINT32 *)avalue[i]; + break; + + case FFI_TYPE_DOUBLE: + if (gpcount < 8 && fpcount < 8) + stf_spill (&stack->fp_regs[fpcount++], *(double *)avalue[i]); + stack->gp_regs[gpcount++] = *(UINT64 *)avalue[i]; + break; + + case FFI_TYPE_LONGDOUBLE: + if (gpcount & 1) + gpcount++; + if (LDBL_MANT_DIG == 64 && gpcount < 8 && fpcount < 8) + stf_spill (&stack->fp_regs[fpcount++], *(__float80 *)avalue[i]); + memcpy (&stack->gp_regs[gpcount], avalue[i], 16); + gpcount += 2; + break; + + case FFI_TYPE_STRUCT: + { + size_t size = (*p_arg)->size; + size_t align = (*p_arg)->alignment; + int hfa_type = hfa_element_type (*p_arg, 0); + + FFI_ASSERT (align <= 16); + if (align == 16 && (gpcount & 1)) + gpcount++; + + if (hfa_type != FFI_TYPE_VOID) + { + size_t hfa_size = hfa_type_size (hfa_type); + size_t offset = 0; + size_t gp_offset = gpcount * 8; + + while (fpcount < 8 + && offset < size + && gp_offset < 8 * 8) + { + hfa_type_load (&stack->fp_regs[fpcount], hfa_type, + avalue[i] + offset); + offset += hfa_size; + gp_offset += hfa_size; + fpcount += 1; + } + } + + memcpy (&stack->gp_regs[gpcount], avalue[i], size); + gpcount += (size + 7) / 8; + } + break; + + default: + abort (); + } + } + + ffi_call_unix (stack, rvalue, fn, cif->flags); +} + +/* Closures represent a pair consisting of a function pointer, and + some user data. A closure is invoked by reinterpreting the closure + as a function pointer, and branching to it. Thus we can make an + interpreted function callable as a C function: We turn the + interpreter itself, together with a pointer specifying the + interpreted procedure, into a closure. + + For IA64, function pointer are already pairs consisting of a code + pointer, and a gp pointer. The latter is needed to access global + variables. Here we set up such a pair as the first two words of + the closure (in the "trampoline" area), but we replace the gp + pointer with a pointer to the closure itself. We also add the real + gp pointer to the closure. This allows the function entry code to + both retrieve the user data, and to restire the correct gp pointer. */ + +extern void ffi_closure_unix (); + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) +{ + /* The layout of a function descriptor. A C function pointer really + points to one of these. */ + struct ia64_fd + { + UINT64 code_pointer; + UINT64 gp; + }; + + struct ffi_ia64_trampoline_struct + { + UINT64 code_pointer; /* Pointer to ffi_closure_unix. */ + UINT64 fake_gp; /* Pointer to closure, installed as gp. */ + UINT64 real_gp; /* Real gp value. */ + }; + + struct ffi_ia64_trampoline_struct *tramp; + struct ia64_fd *fd; + + if (cif->abi != FFI_UNIX) + return FFI_BAD_ABI; + + tramp = (struct ffi_ia64_trampoline_struct *)closure->tramp; + fd = (struct ia64_fd *)(void *)ffi_closure_unix; + + tramp->code_pointer = fd->code_pointer; + tramp->real_gp = fd->gp; + tramp->fake_gp = (UINT64)(PTR64)codeloc; + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + + +UINT64 +ffi_closure_unix_inner (ffi_closure *closure, struct ia64_args *stack, + void *rvalue, void *r8) +{ + ffi_cif *cif; + void **avalue; + ffi_type **p_arg; + long i, avn, gpcount, fpcount; + + cif = closure->cif; + avn = cif->nargs; + avalue = alloca (avn * sizeof (void *)); + + /* If the structure return value is passed in memory get that location + from r8 so as to pass the value directly back to the caller. */ + if (cif->flags == FFI_TYPE_STRUCT) + rvalue = r8; + + gpcount = fpcount = 0; + for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) + { + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], 1); + break; + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], 2); + break; + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], 4); + break; + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + avalue[i] = &stack->gp_regs[gpcount++]; + break; + case FFI_TYPE_POINTER: + avalue[i] = endian_adjust(&stack->gp_regs[gpcount++], sizeof(void*)); + break; + + case FFI_TYPE_FLOAT: + if (gpcount < 8 && fpcount < 8) + { + fpreg *addr = &stack->fp_regs[fpcount++]; + float result; + avalue[i] = addr; + ldf_fill (result, addr); + *(float *)addr = result; + } + else + avalue[i] = endian_adjust(&stack->gp_regs[gpcount], 4); + gpcount++; + break; + + case FFI_TYPE_DOUBLE: + if (gpcount < 8 && fpcount < 8) + { + fpreg *addr = &stack->fp_regs[fpcount++]; + double result; + avalue[i] = addr; + ldf_fill (result, addr); + *(double *)addr = result; + } + else + avalue[i] = &stack->gp_regs[gpcount]; + gpcount++; + break; + + case FFI_TYPE_LONGDOUBLE: + if (gpcount & 1) + gpcount++; + if (LDBL_MANT_DIG == 64 && gpcount < 8 && fpcount < 8) + { + fpreg *addr = &stack->fp_regs[fpcount++]; + __float80 result; + avalue[i] = addr; + ldf_fill (result, addr); + *(__float80 *)addr = result; + } + else + avalue[i] = &stack->gp_regs[gpcount]; + gpcount += 2; + break; + + case FFI_TYPE_STRUCT: + { + size_t size = (*p_arg)->size; + size_t align = (*p_arg)->alignment; + int hfa_type = hfa_element_type (*p_arg, 0); + + FFI_ASSERT (align <= 16); + if (align == 16 && (gpcount & 1)) + gpcount++; + + if (hfa_type != FFI_TYPE_VOID) + { + size_t hfa_size = hfa_type_size (hfa_type); + size_t offset = 0; + size_t gp_offset = gpcount * 8; + void *addr = alloca (size); + + avalue[i] = addr; + + while (fpcount < 8 + && offset < size + && gp_offset < 8 * 8) + { + hfa_type_store (hfa_type, addr + offset, + &stack->fp_regs[fpcount]); + offset += hfa_size; + gp_offset += hfa_size; + fpcount += 1; + } + + if (offset < size) + memcpy (addr + offset, (char *)stack->gp_regs + gp_offset, + size - offset); + } + else + avalue[i] = &stack->gp_regs[gpcount]; + + gpcount += (size + 7) / 8; + } + break; + + default: + abort (); + } + } + + closure->fun (cif, rvalue, avalue, closure->user_data); + + return cif->flags; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/ia64/ffitarget.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/ia64/ffitarget.h new file mode 100644 index 000000000..0d2001df7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/ia64/ffitarget.h @@ -0,0 +1,50 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + Target configuration macros for IA-64. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_ASM +typedef unsigned long long ffi_arg; +typedef signed long long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_UNIX, /* Linux and all Unix variants use the same conventions */ + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_UNIX +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 24 /* Really the following struct, which */ + /* can be interpreted as a C function */ + /* descriptor: */ + +#endif + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/ia64/ia64_flags.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/ia64/ia64_flags.h new file mode 100644 index 000000000..9d652cef1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/ia64/ia64_flags.h @@ -0,0 +1,40 @@ +/* ----------------------------------------------------------------------- + ia64_flags.h - Copyright (c) 2000 Hewlett Packard Company + + IA64/unix Foreign Function Interface + + Original author: Hans Boehm, HP Labs + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +/* "Type" codes used between assembly and C. When used as a part of + a cfi->flags value, the low byte will be these extra type codes, + and bits 8-31 will be the actual size of the type. */ + +/* Small structures containing N words in integer registers. */ +#define FFI_IA64_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 1) + +/* Homogeneous Floating Point Aggregates (HFAs) which are returned + in FP registers. */ +#define FFI_IA64_TYPE_HFA_FLOAT (FFI_TYPE_LAST + 2) +#define FFI_IA64_TYPE_HFA_DOUBLE (FFI_TYPE_LAST + 3) +#define FFI_IA64_TYPE_HFA_LDOUBLE (FFI_TYPE_LAST + 4) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/ia64/unix.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/ia64/unix.S new file mode 100644 index 000000000..4d2a86d42 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/ia64/unix.S @@ -0,0 +1,560 @@ +/* ----------------------------------------------------------------------- + unix.S - Copyright (c) 1998, 2008 Red Hat, Inc. + Copyright (c) 2000 Hewlett Packard Company + + IA64/unix Foreign Function Interface + + Primary author: Hans Boehm, HP Labs + + Loosely modeled on Cygnus code for other platforms. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include +#include "ia64_flags.h" + + .pred.safe_across_calls p1-p5,p16-p63 +.text + +/* int ffi_call_unix (struct ia64_args *stack, PTR64 rvalue, + void (*fn)(void), int flags); + */ + + .align 16 + .global ffi_call_unix + .proc ffi_call_unix +ffi_call_unix: + .prologue + /* Bit o trickiness. We actually share a stack frame with ffi_call. + Rely on the fact that ffi_call uses a vframe and don't bother + tracking one here at all. */ + .fframe 0 + .save ar.pfs, r36 // loc0 + alloc loc0 = ar.pfs, 4, 3, 8, 0 + .save rp, loc1 + mov loc1 = b0 + .body + add r16 = 16, in0 + mov loc2 = gp + mov r8 = in1 + ;; + + /* Load up all of the argument registers. */ + ldf.fill f8 = [in0], 32 + ldf.fill f9 = [r16], 32 + ;; + ldf.fill f10 = [in0], 32 + ldf.fill f11 = [r16], 32 + ;; + ldf.fill f12 = [in0], 32 + ldf.fill f13 = [r16], 32 + ;; + ldf.fill f14 = [in0], 32 + ldf.fill f15 = [r16], 24 + ;; + ld8 out0 = [in0], 16 + ld8 out1 = [r16], 16 + ;; + ld8 out2 = [in0], 16 + ld8 out3 = [r16], 16 + ;; + ld8 out4 = [in0], 16 + ld8 out5 = [r16], 16 + ;; + ld8 out6 = [in0] + ld8 out7 = [r16] + ;; + + /* Deallocate the register save area from the stack frame. */ + mov sp = in0 + + /* Call the target function. */ + ld8 r16 = [in2], 8 + ;; + ld8 gp = [in2] + mov b6 = r16 + br.call.sptk.many b0 = b6 + ;; + + /* Dispatch to handle return value. */ + mov gp = loc2 + zxt1 r16 = in3 + ;; + mov ar.pfs = loc0 + addl r18 = @ltoffx(.Lst_table), gp + ;; + ld8.mov r18 = [r18], .Lst_table + mov b0 = loc1 + ;; + shladd r18 = r16, 3, r18 + ;; + ld8 r17 = [r18] + shr in3 = in3, 8 + ;; + add r17 = r17, r18 + ;; + mov b6 = r17 + br b6 + ;; + +.Lst_void: + br.ret.sptk.many b0 + ;; +.Lst_uint8: + zxt1 r8 = r8 + ;; + st8 [in1] = r8 + br.ret.sptk.many b0 + ;; +.Lst_sint8: + sxt1 r8 = r8 + ;; + st8 [in1] = r8 + br.ret.sptk.many b0 + ;; +.Lst_uint16: + zxt2 r8 = r8 + ;; + st8 [in1] = r8 + br.ret.sptk.many b0 + ;; +.Lst_sint16: + sxt2 r8 = r8 + ;; + st8 [in1] = r8 + br.ret.sptk.many b0 + ;; +.Lst_uint32: + zxt4 r8 = r8 + ;; + st8 [in1] = r8 + br.ret.sptk.many b0 + ;; +.Lst_sint32: + sxt4 r8 = r8 + ;; + st8 [in1] = r8 + br.ret.sptk.many b0 + ;; +.Lst_int64: + st8 [in1] = r8 + br.ret.sptk.many b0 + ;; +.Lst_float: + stfs [in1] = f8 + br.ret.sptk.many b0 + ;; +.Lst_double: + stfd [in1] = f8 + br.ret.sptk.many b0 + ;; +.Lst_ldouble: + stfe [in1] = f8 + br.ret.sptk.many b0 + ;; + +.Lst_small_struct: + add sp = -16, sp + cmp.lt p6, p0 = 8, in3 + cmp.lt p7, p0 = 16, in3 + cmp.lt p8, p0 = 24, in3 + ;; + add r16 = 8, sp + add r17 = 16, sp + add r18 = 24, sp + ;; + st8 [sp] = r8 +(p6) st8 [r16] = r9 + mov out0 = in1 +(p7) st8 [r17] = r10 +(p8) st8 [r18] = r11 + mov out1 = sp + mov out2 = in3 + br.call.sptk.many b0 = memcpy# + ;; + mov ar.pfs = loc0 + mov b0 = loc1 + mov gp = loc2 + br.ret.sptk.many b0 + +.Lst_hfa_float: + add r16 = 4, in1 + cmp.lt p6, p0 = 4, in3 + ;; + stfs [in1] = f8, 8 +(p6) stfs [r16] = f9, 8 + cmp.lt p7, p0 = 8, in3 + cmp.lt p8, p0 = 12, in3 + ;; +(p7) stfs [in1] = f10, 8 +(p8) stfs [r16] = f11, 8 + cmp.lt p9, p0 = 16, in3 + cmp.lt p10, p0 = 20, in3 + ;; +(p9) stfs [in1] = f12, 8 +(p10) stfs [r16] = f13, 8 + cmp.lt p6, p0 = 24, in3 + cmp.lt p7, p0 = 28, in3 + ;; +(p6) stfs [in1] = f14 +(p7) stfs [r16] = f15 + br.ret.sptk.many b0 + ;; + +.Lst_hfa_double: + add r16 = 8, in1 + cmp.lt p6, p0 = 8, in3 + ;; + stfd [in1] = f8, 16 +(p6) stfd [r16] = f9, 16 + cmp.lt p7, p0 = 16, in3 + cmp.lt p8, p0 = 24, in3 + ;; +(p7) stfd [in1] = f10, 16 +(p8) stfd [r16] = f11, 16 + cmp.lt p9, p0 = 32, in3 + cmp.lt p10, p0 = 40, in3 + ;; +(p9) stfd [in1] = f12, 16 +(p10) stfd [r16] = f13, 16 + cmp.lt p6, p0 = 48, in3 + cmp.lt p7, p0 = 56, in3 + ;; +(p6) stfd [in1] = f14 +(p7) stfd [r16] = f15 + br.ret.sptk.many b0 + ;; + +.Lst_hfa_ldouble: + add r16 = 16, in1 + cmp.lt p6, p0 = 16, in3 + ;; + stfe [in1] = f8, 32 +(p6) stfe [r16] = f9, 32 + cmp.lt p7, p0 = 32, in3 + cmp.lt p8, p0 = 48, in3 + ;; +(p7) stfe [in1] = f10, 32 +(p8) stfe [r16] = f11, 32 + cmp.lt p9, p0 = 64, in3 + cmp.lt p10, p0 = 80, in3 + ;; +(p9) stfe [in1] = f12, 32 +(p10) stfe [r16] = f13, 32 + cmp.lt p6, p0 = 96, in3 + cmp.lt p7, p0 = 112, in3 + ;; +(p6) stfe [in1] = f14 +(p7) stfe [r16] = f15 + br.ret.sptk.many b0 + ;; + + .endp ffi_call_unix + + .align 16 + .global ffi_closure_unix + .proc ffi_closure_unix + +#define FRAME_SIZE (8*16 + 8*8 + 8*16) + +ffi_closure_unix: + .prologue + .save ar.pfs, r40 // loc0 + alloc loc0 = ar.pfs, 8, 4, 4, 0 + .fframe FRAME_SIZE + add r12 = -FRAME_SIZE, r12 + .save rp, loc1 + mov loc1 = b0 + .save ar.unat, loc2 + mov loc2 = ar.unat + .body + + /* Retrieve closure pointer and real gp. */ +#ifdef _ILP32 + addp4 out0 = 0, gp + addp4 gp = 16, gp +#else + mov out0 = gp + add gp = 16, gp +#endif + ;; + ld8 gp = [gp] + + /* Spill all of the possible argument registers. */ + add r16 = 16 + 8*16, sp + add r17 = 16 + 8*16 + 16, sp + ;; + stf.spill [r16] = f8, 32 + stf.spill [r17] = f9, 32 + mov loc3 = gp + ;; + stf.spill [r16] = f10, 32 + stf.spill [r17] = f11, 32 + ;; + stf.spill [r16] = f12, 32 + stf.spill [r17] = f13, 32 + ;; + stf.spill [r16] = f14, 32 + stf.spill [r17] = f15, 24 + ;; + .mem.offset 0, 0 + st8.spill [r16] = in0, 16 + .mem.offset 8, 0 + st8.spill [r17] = in1, 16 + add out1 = 16 + 8*16, sp + ;; + .mem.offset 0, 0 + st8.spill [r16] = in2, 16 + .mem.offset 8, 0 + st8.spill [r17] = in3, 16 + add out2 = 16, sp + ;; + .mem.offset 0, 0 + st8.spill [r16] = in4, 16 + .mem.offset 8, 0 + st8.spill [r17] = in5, 16 + mov out3 = r8 + ;; + .mem.offset 0, 0 + st8.spill [r16] = in6 + .mem.offset 8, 0 + st8.spill [r17] = in7 + + /* Invoke ffi_closure_unix_inner for the hard work. */ + br.call.sptk.many b0 = ffi_closure_unix_inner + ;; + + /* Dispatch to handle return value. */ + mov gp = loc3 + zxt1 r16 = r8 + ;; + addl r18 = @ltoffx(.Lld_table), gp + mov ar.pfs = loc0 + ;; + ld8.mov r18 = [r18], .Lld_table + mov b0 = loc1 + ;; + shladd r18 = r16, 3, r18 + mov ar.unat = loc2 + ;; + ld8 r17 = [r18] + shr r8 = r8, 8 + ;; + add r17 = r17, r18 + add r16 = 16, sp + ;; + mov b6 = r17 + br b6 + ;; + .label_state 1 + +.Lld_void: + .restore sp + add sp = FRAME_SIZE, sp + br.ret.sptk.many b0 + ;; +.Lld_int: + .body + .copy_state 1 + ld8 r8 = [r16] + .restore sp + add sp = FRAME_SIZE, sp + br.ret.sptk.many b0 + ;; +.Lld_float: + .body + .copy_state 1 + ldfs f8 = [r16] + .restore sp + add sp = FRAME_SIZE, sp + br.ret.sptk.many b0 + ;; +.Lld_double: + .body + .copy_state 1 + ldfd f8 = [r16] + .restore sp + add sp = FRAME_SIZE, sp + br.ret.sptk.many b0 + ;; +.Lld_ldouble: + .body + .copy_state 1 + ldfe f8 = [r16] + .restore sp + add sp = FRAME_SIZE, sp + br.ret.sptk.many b0 + ;; + +.Lld_small_struct: + .body + .copy_state 1 + add r17 = 8, r16 + cmp.lt p6, p0 = 8, r8 + cmp.lt p7, p0 = 16, r8 + cmp.lt p8, p0 = 24, r8 + ;; + ld8 r8 = [r16], 16 +(p6) ld8 r9 = [r17], 16 + ;; +(p7) ld8 r10 = [r16] +(p8) ld8 r11 = [r17] + .restore sp + add sp = FRAME_SIZE, sp + br.ret.sptk.many b0 + ;; + +.Lld_hfa_float: + .body + .copy_state 1 + add r17 = 4, r16 + cmp.lt p6, p0 = 4, r8 + ;; + ldfs f8 = [r16], 8 +(p6) ldfs f9 = [r17], 8 + cmp.lt p7, p0 = 8, r8 + cmp.lt p8, p0 = 12, r8 + ;; +(p7) ldfs f10 = [r16], 8 +(p8) ldfs f11 = [r17], 8 + cmp.lt p9, p0 = 16, r8 + cmp.lt p10, p0 = 20, r8 + ;; +(p9) ldfs f12 = [r16], 8 +(p10) ldfs f13 = [r17], 8 + cmp.lt p6, p0 = 24, r8 + cmp.lt p7, p0 = 28, r8 + ;; +(p6) ldfs f14 = [r16] +(p7) ldfs f15 = [r17] + .restore sp + add sp = FRAME_SIZE, sp + br.ret.sptk.many b0 + ;; + +.Lld_hfa_double: + .body + .copy_state 1 + add r17 = 8, r16 + cmp.lt p6, p0 = 8, r8 + ;; + ldfd f8 = [r16], 16 +(p6) ldfd f9 = [r17], 16 + cmp.lt p7, p0 = 16, r8 + cmp.lt p8, p0 = 24, r8 + ;; +(p7) ldfd f10 = [r16], 16 +(p8) ldfd f11 = [r17], 16 + cmp.lt p9, p0 = 32, r8 + cmp.lt p10, p0 = 40, r8 + ;; +(p9) ldfd f12 = [r16], 16 +(p10) ldfd f13 = [r17], 16 + cmp.lt p6, p0 = 48, r8 + cmp.lt p7, p0 = 56, r8 + ;; +(p6) ldfd f14 = [r16] +(p7) ldfd f15 = [r17] + .restore sp + add sp = FRAME_SIZE, sp + br.ret.sptk.many b0 + ;; + +.Lld_hfa_ldouble: + .body + .copy_state 1 + add r17 = 16, r16 + cmp.lt p6, p0 = 16, r8 + ;; + ldfe f8 = [r16], 32 +(p6) ldfe f9 = [r17], 32 + cmp.lt p7, p0 = 32, r8 + cmp.lt p8, p0 = 48, r8 + ;; +(p7) ldfe f10 = [r16], 32 +(p8) ldfe f11 = [r17], 32 + cmp.lt p9, p0 = 64, r8 + cmp.lt p10, p0 = 80, r8 + ;; +(p9) ldfe f12 = [r16], 32 +(p10) ldfe f13 = [r17], 32 + cmp.lt p6, p0 = 96, r8 + cmp.lt p7, p0 = 112, r8 + ;; +(p6) ldfe f14 = [r16] +(p7) ldfe f15 = [r17] + .restore sp + add sp = FRAME_SIZE, sp + br.ret.sptk.many b0 + ;; + + .endp ffi_closure_unix + + .section .rodata + .align 8 +.Lst_table: + data8 @pcrel(.Lst_void) // FFI_TYPE_VOID + data8 @pcrel(.Lst_sint32) // FFI_TYPE_INT + data8 @pcrel(.Lst_float) // FFI_TYPE_FLOAT + data8 @pcrel(.Lst_double) // FFI_TYPE_DOUBLE + data8 @pcrel(.Lst_ldouble) // FFI_TYPE_LONGDOUBLE + data8 @pcrel(.Lst_uint8) // FFI_TYPE_UINT8 + data8 @pcrel(.Lst_sint8) // FFI_TYPE_SINT8 + data8 @pcrel(.Lst_uint16) // FFI_TYPE_UINT16 + data8 @pcrel(.Lst_sint16) // FFI_TYPE_SINT16 + data8 @pcrel(.Lst_uint32) // FFI_TYPE_UINT32 + data8 @pcrel(.Lst_sint32) // FFI_TYPE_SINT32 + data8 @pcrel(.Lst_int64) // FFI_TYPE_UINT64 + data8 @pcrel(.Lst_int64) // FFI_TYPE_SINT64 + data8 @pcrel(.Lst_void) // FFI_TYPE_STRUCT + data8 @pcrel(.Lst_int64) // FFI_TYPE_POINTER + data8 @pcrel(.Lst_small_struct) // FFI_IA64_TYPE_SMALL_STRUCT + data8 @pcrel(.Lst_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT + data8 @pcrel(.Lst_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE + data8 @pcrel(.Lst_hfa_ldouble) // FFI_IA64_TYPE_HFA_LDOUBLE + +.Lld_table: + data8 @pcrel(.Lld_void) // FFI_TYPE_VOID + data8 @pcrel(.Lld_int) // FFI_TYPE_INT + data8 @pcrel(.Lld_float) // FFI_TYPE_FLOAT + data8 @pcrel(.Lld_double) // FFI_TYPE_DOUBLE + data8 @pcrel(.Lld_ldouble) // FFI_TYPE_LONGDOUBLE + data8 @pcrel(.Lld_int) // FFI_TYPE_UINT8 + data8 @pcrel(.Lld_int) // FFI_TYPE_SINT8 + data8 @pcrel(.Lld_int) // FFI_TYPE_UINT16 + data8 @pcrel(.Lld_int) // FFI_TYPE_SINT16 + data8 @pcrel(.Lld_int) // FFI_TYPE_UINT32 + data8 @pcrel(.Lld_int) // FFI_TYPE_SINT32 + data8 @pcrel(.Lld_int) // FFI_TYPE_UINT64 + data8 @pcrel(.Lld_int) // FFI_TYPE_SINT64 + data8 @pcrel(.Lld_void) // FFI_TYPE_STRUCT + data8 @pcrel(.Lld_int) // FFI_TYPE_POINTER + data8 @pcrel(.Lld_small_struct) // FFI_IA64_TYPE_SMALL_STRUCT + data8 @pcrel(.Lld_hfa_float) // FFI_IA64_TYPE_HFA_FLOAT + data8 @pcrel(.Lld_hfa_double) // FFI_IA64_TYPE_HFA_DOUBLE + data8 @pcrel(.Lld_hfa_ldouble) // FFI_IA64_TYPE_HFA_LDOUBLE + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/java_raw_api.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/java_raw_api.c new file mode 100644 index 000000000..522c8bfd6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/java_raw_api.c @@ -0,0 +1,356 @@ +/* ----------------------------------------------------------------------- + java_raw_api.c - Copyright (c) 1999, 2007, 2008 Red Hat, Inc. + + Cloned from raw_api.c + + Raw_api.c author: Kresten Krab Thorup + Java_raw_api.c author: Hans-J. Boehm + + $Id $ + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +/* This defines a Java- and 64-bit specific variant of the raw API. */ +/* It assumes that "raw" argument blocks look like Java stacks on a */ +/* 64-bit machine. Arguments that can be stored in a single stack */ +/* stack slots (longs, doubles) occupy 128 bits, but only the first */ +/* 64 bits are actually used. */ + +#include +#include +#include + +#if !defined(NO_JAVA_RAW_API) && !defined(FFI_NO_RAW_API) + +size_t +ffi_java_raw_size (ffi_cif *cif) +{ + size_t result = 0; + int i; + + ffi_type **at = cif->arg_types; + + for (i = cif->nargs-1; i >= 0; i--, at++) + { + switch((*at) -> type) { + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + case FFI_TYPE_DOUBLE: + result += 2 * FFI_SIZEOF_JAVA_RAW; + break; + case FFI_TYPE_STRUCT: + /* No structure parameters in Java. */ + abort(); + default: + result += FFI_SIZEOF_JAVA_RAW; + } + } + + return result; +} + + +void +ffi_java_raw_to_ptrarray (ffi_cif *cif, ffi_java_raw *raw, void **args) +{ + unsigned i; + ffi_type **tp = cif->arg_types; + +#if WORDS_BIGENDIAN + + for (i = 0; i < cif->nargs; i++, tp++, args++) + { + switch ((*tp)->type) + { + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + *args = (void*) ((char*)(raw++) + 3); + break; + + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + *args = (void*) ((char*)(raw++) + 2); + break; + +#if FFI_SIZEOF_JAVA_RAW == 8 + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + case FFI_TYPE_DOUBLE: + *args = (void *)raw; + raw += 2; + break; +#endif + + case FFI_TYPE_POINTER: + *args = (void*) &(raw++)->ptr; + break; + + default: + *args = raw; + raw += + ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw); + } + } + +#else /* WORDS_BIGENDIAN */ + +#if !PDP + + /* then assume little endian */ + for (i = 0; i < cif->nargs; i++, tp++, args++) + { +#if FFI_SIZEOF_JAVA_RAW == 8 + switch((*tp)->type) { + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + case FFI_TYPE_DOUBLE: + *args = (void*) raw; + raw += 2; + break; + default: + *args = (void*) raw++; + } +#else /* FFI_SIZEOF_JAVA_RAW != 8 */ + *args = (void*) raw; + raw += + ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw); +#endif /* FFI_SIZEOF_JAVA_RAW == 8 */ + } + +#else +#error "pdp endian not supported" +#endif /* ! PDP */ + +#endif /* WORDS_BIGENDIAN */ +} + +void +ffi_java_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_java_raw *raw) +{ + unsigned i; + ffi_type **tp = cif->arg_types; + + for (i = 0; i < cif->nargs; i++, tp++, args++) + { + switch ((*tp)->type) + { + case FFI_TYPE_UINT8: +#if WORDS_BIGENDIAN + *(UINT32*)(raw++) = *(UINT8*) (*args); +#else + (raw++)->uint = *(UINT8*) (*args); +#endif + break; + + case FFI_TYPE_SINT8: +#if WORDS_BIGENDIAN + *(SINT32*)(raw++) = *(SINT8*) (*args); +#else + (raw++)->sint = *(SINT8*) (*args); +#endif + break; + + case FFI_TYPE_UINT16: +#if WORDS_BIGENDIAN + *(UINT32*)(raw++) = *(UINT16*) (*args); +#else + (raw++)->uint = *(UINT16*) (*args); +#endif + break; + + case FFI_TYPE_SINT16: +#if WORDS_BIGENDIAN + *(SINT32*)(raw++) = *(SINT16*) (*args); +#else + (raw++)->sint = *(SINT16*) (*args); +#endif + break; + + case FFI_TYPE_UINT32: +#if WORDS_BIGENDIAN + *(UINT32*)(raw++) = *(UINT32*) (*args); +#else + (raw++)->uint = *(UINT32*) (*args); +#endif + break; + + case FFI_TYPE_SINT32: +#if WORDS_BIGENDIAN + *(SINT32*)(raw++) = *(SINT32*) (*args); +#else + (raw++)->sint = *(SINT32*) (*args); +#endif + break; + + case FFI_TYPE_FLOAT: + (raw++)->flt = *(FLOAT32*) (*args); + break; + +#if FFI_SIZEOF_JAVA_RAW == 8 + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + case FFI_TYPE_DOUBLE: + raw->uint = *(UINT64*) (*args); + raw += 2; + break; +#endif + + case FFI_TYPE_POINTER: + (raw++)->ptr = **(void***) args; + break; + + default: +#if FFI_SIZEOF_JAVA_RAW == 8 + FFI_ASSERT(0); /* Should have covered all cases */ +#else + memcpy ((void*) raw->data, (void*)*args, (*tp)->size); + raw += + ALIGN ((*tp)->size, sizeof(ffi_java_raw)) / sizeof(ffi_java_raw); +#endif + } + } +} + +#if !FFI_NATIVE_RAW_API + +static void +ffi_java_rvalue_to_raw (ffi_cif *cif, void *rvalue) +{ +#if WORDS_BIGENDIAN && FFI_SIZEOF_ARG == 8 + switch (cif->rtype->type) + { + case FFI_TYPE_UINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_UINT32: + *(UINT64 *)rvalue <<= 32; + break; + + case FFI_TYPE_SINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_SINT32: + case FFI_TYPE_INT: +#if FFI_SIZEOF_JAVA_RAW == 4 + case FFI_TYPE_POINTER: +#endif + *(SINT64 *)rvalue <<= 32; + break; + + default: + break; + } +#endif +} + +static void +ffi_java_raw_to_rvalue (ffi_cif *cif, void *rvalue) +{ +#if WORDS_BIGENDIAN && FFI_SIZEOF_ARG == 8 + switch (cif->rtype->type) + { + case FFI_TYPE_UINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_UINT32: + *(UINT64 *)rvalue >>= 32; + break; + + case FFI_TYPE_SINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_SINT32: + case FFI_TYPE_INT: + *(SINT64 *)rvalue >>= 32; + break; + + default: + break; + } +#endif +} + +/* This is a generic definition of ffi_raw_call, to be used if the + * native system does not provide a machine-specific implementation. + * Having this, allows code to be written for the raw API, without + * the need for system-specific code to handle input in that format; + * these following couple of functions will handle the translation forth + * and back automatically. */ + +void ffi_java_raw_call (ffi_cif *cif, void (*fn)(void), void *rvalue, + ffi_java_raw *raw) +{ + void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); + ffi_java_raw_to_ptrarray (cif, raw, avalue); + ffi_call (cif, fn, rvalue, avalue); + ffi_java_rvalue_to_raw (cif, rvalue); +} + +#if FFI_CLOSURES /* base system provides closures */ + +static void +ffi_java_translate_args (ffi_cif *cif, void *rvalue, + void **avalue, void *user_data) +{ + ffi_java_raw *raw = (ffi_java_raw*)alloca (ffi_java_raw_size (cif)); + ffi_raw_closure *cl = (ffi_raw_closure*)user_data; + + ffi_java_ptrarray_to_raw (cif, avalue, raw); + (*cl->fun) (cif, rvalue, (ffi_raw*)raw, cl->user_data); + ffi_java_raw_to_rvalue (cif, rvalue); +} + +ffi_status +ffi_prep_java_raw_closure_loc (ffi_java_raw_closure* cl, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), + void *user_data, + void *codeloc) +{ + ffi_status status; + + status = ffi_prep_closure_loc ((ffi_closure*) cl, + cif, + &ffi_java_translate_args, + codeloc, + codeloc); + if (status == FFI_OK) + { + cl->fun = fun; + cl->user_data = user_data; + } + + return status; +} + +/* Again, here is the generic version of ffi_prep_raw_closure, which + * will install an intermediate "hub" for translation of arguments from + * the pointer-array format, to the raw format */ + +ffi_status +ffi_prep_java_raw_closure (ffi_java_raw_closure* cl, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_java_raw*,void*), + void *user_data) +{ + return ffi_prep_java_raw_closure_loc (cl, cif, fun, user_data, cl); +} + +#endif /* FFI_CLOSURES */ +#endif /* !FFI_NATIVE_RAW_API */ +#endif /* !FFI_NO_RAW_API */ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/m32r/ffi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/m32r/ffi.c new file mode 100644 index 000000000..300006349 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/m32r/ffi.c @@ -0,0 +1,232 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2004 Renesas Technology + Copyright (c) 2008 Red Hat, Inc. + + M32R Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +#include + +/* ffi_prep_args is called by the assembly routine once stack + space has been allocated for the function's arguments. */ + +void ffi_prep_args(char *stack, extended_cif *ecif) +{ + unsigned int i; + int tmp; + unsigned int avn; + void **p_argv; + char *argp; + ffi_type **p_arg; + + tmp = 0; + argp = stack; + + if (ecif->cif->rtype->type == FFI_TYPE_STRUCT && ecif->cif->rtype->size > 8) + { + *(void **) argp = ecif->rvalue; + argp += 4; + } + + avn = ecif->cif->nargs; + p_argv = ecif->avalue; + + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; + (i != 0) && (avn != 0); + i--, p_arg++) + { + size_t z; + + /* Align if necessary. */ + if (((*p_arg)->alignment - 1) & (unsigned) argp) + argp = (char *) ALIGN (argp, (*p_arg)->alignment); + + if (avn != 0) + { + avn--; + z = (*p_arg)->size; + if (z < sizeof (int)) + { + z = sizeof (int); + + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); + break; + + case FFI_TYPE_UINT8: + *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); + break; + + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); + break; + + case FFI_TYPE_UINT16: + *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); + break; + + case FFI_TYPE_STRUCT: + z = (*p_arg)->size; + if ((*p_arg)->alignment != 1) + memcpy (argp, *p_argv, z); + else + memcpy (argp + 4 - z, *p_argv, z); + z = sizeof (int); + break; + + default: + FFI_ASSERT(0); + } + } + else if (z == sizeof (int)) + { + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + } + else + { + if ((*p_arg)->type == FFI_TYPE_STRUCT) + { + if (z > 8) + { + *(unsigned int *) argp = (unsigned int)(void *)(* p_argv); + z = sizeof(void *); + } + else + { + memcpy(argp, *p_argv, z); + z = 8; + } + } + else + { + /* Double or long long 64bit. */ + memcpy (argp, *p_argv, z); + } + } + p_argv++; + argp += z; + } + } + + return; +} + +/* Perform machine dependent cif processing. */ +ffi_status +ffi_prep_cif_machdep(ffi_cif *cif) +{ + /* Set the return type flag. */ + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + cif->flags = (unsigned) cif->rtype->type; + break; + + case FFI_TYPE_STRUCT: + if (cif->rtype->size <= 4) + cif->flags = FFI_TYPE_INT; + + else if (cif->rtype->size <= 8) + cif->flags = FFI_TYPE_DOUBLE; + + else + cif->flags = (unsigned) cif->rtype->type; + break; + + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + case FFI_TYPE_DOUBLE: + cif->flags = FFI_TYPE_DOUBLE; + break; + + case FFI_TYPE_FLOAT: + default: + cif->flags = FFI_TYPE_INT; + break; + } + + return FFI_OK; +} + +extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, + unsigned, unsigned, unsigned *, void (*fn)(void)); + +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have + a return value address then we need to make one. */ + if ((rvalue == NULL) && + (cif->rtype->type == FFI_TYPE_STRUCT)) + { + ecif.rvalue = alloca (cif->rtype->size); + } + else + ecif.rvalue = rvalue; + + switch (cif->abi) + { + case FFI_SYSV: + ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, + cif->flags, ecif.rvalue, fn); + if (cif->rtype->type == FFI_TYPE_STRUCT) + { + int size = cif->rtype->size; + int align = cif->rtype->alignment; + + if (size < 4) + { + if (align == 1) + *(unsigned long *)(ecif.rvalue) <<= (4 - size) * 8; + } + else if (4 < size && size < 8) + { + if (align == 1) + { + memcpy (ecif.rvalue, ecif.rvalue + 8-size, size); + } + else if (align == 2) + { + if (size & 1) + size += 1; + + if (size != 8) + memcpy (ecif.rvalue, ecif.rvalue + 8-size, size); + } + } + } + break; + + default: + FFI_ASSERT(0); + break; + } +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/m32r/ffitarget.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/m32r/ffitarget.h new file mode 100644 index 000000000..2e2ea4833 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/m32r/ffitarget.h @@ -0,0 +1,48 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 2004 Renesas Technology. + Target configuration macros for M32R. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +/* ---- Generic type definitions ----------------------------------------- */ + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi + { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV + } ffi_abi; +#endif + +#define FFI_CLOSURES 0 +#define FFI_TRAMPOLINE_SIZE 24 +#define FFI_NATIVE_RAW_API 0 + +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/m32r/sysv.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/m32r/sysv.S new file mode 100644 index 000000000..06b75c226 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/m32r/sysv.S @@ -0,0 +1,121 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2004 Renesas Technology + + M32R Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include +#ifdef HAVE_MACHINE_ASM_H +#include +#else +/* XXX these lose for some platforms, I'm sure. */ +#define CNAME(x) x +#define ENTRY(x) .globl CNAME(x)! .type CNAME(x),%function! CNAME(x): +#endif + +.text + + /* R0: ffi_prep_args */ + /* R1: &ecif */ + /* R2: cif->bytes */ + /* R3: fig->flags */ + /* sp+0: ecif.rvalue */ + /* sp+4: fn */ + + /* This assumes we are using gas. */ +ENTRY(ffi_call_SYSV) + /* Save registers. */ + push fp + push lr + push r3 + push r2 + push r1 + push r0 + mv fp, sp + + /* Make room for all of the new args. */ + sub sp, r2 + + /* Place all of the ffi_prep_args in position. */ + mv lr, r0 + mv r0, sp + /* R1 already set. */ + + /* And call. */ + jl lr + + /* Move first 4 parameters in registers... */ + ld r0, @(0,sp) + ld r1, @(4,sp) + ld r2, @(8,sp) + ld r3, @(12,sp) + + /* ...and adjust the stack. */ + ld lr, @(8,fp) + cmpi lr, #16 + bc adjust_stack + ldi lr, #16 +adjust_stack: + add sp, lr + + /* Call the function. */ + ld lr, @(28,fp) + jl lr + + /* Remove the space we pushed for the args. */ + mv sp, fp + + /* Load R2 with the pointer to storage for the return value. */ + ld r2, @(24,sp) + + /* Load R3 with the return type code. */ + ld r3, @(12,sp) + + /* If the return value pointer is NULL, assume no return value. */ + beqz r2, epilogue + + /* Return INT. */ + ldi r4, #FFI_TYPE_INT + bne r3, r4, return_double + st r0, @r2 + bra epilogue + +return_double: + /* Return DOUBLE or LONGDOUBLE. */ + ldi r4, #FFI_TYPE_DOUBLE + bne r3, r4, epilogue + st r0, @r2 + st r1, @(4,r2) + +epilogue: + pop r0 + pop r1 + pop r2 + pop r3 + pop lr + pop fp + jmp lr + +.ffi_call_SYSV_end: + .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/m68k/ffi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/m68k/ffi.c new file mode 100644 index 000000000..0d4df1e23 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/m68k/ffi.c @@ -0,0 +1,288 @@ +/* ----------------------------------------------------------------------- + ffi.c + + m68k Foreign Function Interface + ----------------------------------------------------------------------- */ + +#include +#include + +#include +#include +#ifdef __rtems__ +void rtems_cache_flush_multiple_data_lines( const void *, size_t ); +#else +#include +#include +#endif + +void ffi_call_SYSV (extended_cif *, + unsigned, unsigned, + void *, void (*fn) ()); +void *ffi_prep_args (void *stack, extended_cif *ecif); +void ffi_closure_SYSV (ffi_closure *); +void ffi_closure_struct_SYSV (ffi_closure *); +unsigned int ffi_closure_SYSV_inner (ffi_closure *closure, + void *resp, void *args); + +/* ffi_prep_args is called by the assembly routine once stack space has + been allocated for the function's arguments. */ + +void * +ffi_prep_args (void *stack, extended_cif *ecif) +{ + unsigned int i; + void **p_argv; + char *argp; + ffi_type **p_arg; + void *struct_value_ptr; + + argp = stack; + + if (ecif->cif->rtype->type == FFI_TYPE_STRUCT + && !ecif->cif->flags) + struct_value_ptr = ecif->rvalue; + else + struct_value_ptr = NULL; + + p_argv = ecif->avalue; + + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; + i != 0; + i--, p_arg++) + { + size_t z; + + z = (*p_arg)->size; + if (z < sizeof (int)) + { + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(signed int *) argp = (signed int) *(SINT8 *) *p_argv; + break; + + case FFI_TYPE_UINT8: + *(unsigned int *) argp = (unsigned int) *(UINT8 *) *p_argv; + break; + + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int) *(SINT16 *) *p_argv; + break; + + case FFI_TYPE_UINT16: + *(unsigned int *) argp = (unsigned int) *(UINT16 *) *p_argv; + break; + + case FFI_TYPE_STRUCT: + memcpy (argp + sizeof (int) - z, *p_argv, z); + break; + + default: + FFI_ASSERT (0); + } + z = sizeof (int); + } + else + { + memcpy (argp, *p_argv, z); + + /* Align if necessary. */ + if ((sizeof(int) - 1) & z) + z = ALIGN(z, sizeof(int)); + } + + p_argv++; + argp += z; + } + + return struct_value_ptr; +} + +#define CIF_FLAGS_INT 1 +#define CIF_FLAGS_DINT 2 +#define CIF_FLAGS_FLOAT 4 +#define CIF_FLAGS_DOUBLE 8 +#define CIF_FLAGS_LDOUBLE 16 +#define CIF_FLAGS_POINTER 32 +#define CIF_FLAGS_STRUCT1 64 +#define CIF_FLAGS_STRUCT2 128 + +/* Perform machine dependent cif processing */ +ffi_status +ffi_prep_cif_machdep (ffi_cif *cif) +{ + /* Set the return type flag */ + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + cif->flags = 0; + break; + + case FFI_TYPE_STRUCT: + switch (cif->rtype->size) + { + case 1: + cif->flags = CIF_FLAGS_STRUCT1; + break; + case 2: + cif->flags = CIF_FLAGS_STRUCT2; + break; + case 4: + cif->flags = CIF_FLAGS_INT; + break; + case 8: + cif->flags = CIF_FLAGS_DINT; + break; + default: + cif->flags = 0; + break; + } + break; + + case FFI_TYPE_FLOAT: + cif->flags = CIF_FLAGS_FLOAT; + break; + + case FFI_TYPE_DOUBLE: + cif->flags = CIF_FLAGS_DOUBLE; + break; + +#if (FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE) + case FFI_TYPE_LONGDOUBLE: + cif->flags = CIF_FLAGS_LDOUBLE; + break; +#endif + + case FFI_TYPE_POINTER: + cif->flags = CIF_FLAGS_POINTER; + break; + + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + cif->flags = CIF_FLAGS_DINT; + break; + + default: + cif->flags = CIF_FLAGS_INT; + break; + } + + return FFI_OK; +} + +void +ffi_call (ffi_cif *cif, void (*fn) (), void *rvalue, void **avalue) +{ + extended_cif ecif; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return value + address then we need to make one. */ + + if (rvalue == NULL + && cif->rtype->type == FFI_TYPE_STRUCT + && cif->rtype->size > 8) + ecif.rvalue = alloca (cif->rtype->size); + else + ecif.rvalue = rvalue; + + switch (cif->abi) + { + case FFI_SYSV: + ffi_call_SYSV (&ecif, cif->bytes, cif->flags, + ecif.rvalue, fn); + break; + + default: + FFI_ASSERT (0); + break; + } +} + +static void +ffi_prep_incoming_args_SYSV (char *stack, void **avalue, ffi_cif *cif) +{ + unsigned int i; + void **p_argv; + char *argp; + ffi_type **p_arg; + + argp = stack; + p_argv = avalue; + + for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) + { + size_t z; + + z = (*p_arg)->size; + if (z <= 4) + { + *p_argv = (void *) (argp + 4 - z); + + z = 4; + } + else + { + *p_argv = (void *) argp; + + /* Align if necessary */ + if ((sizeof(int) - 1) & z) + z = ALIGN(z, sizeof(int)); + } + + p_argv++; + argp += z; + } +} + +unsigned int +ffi_closure_SYSV_inner (ffi_closure *closure, void *resp, void *args) +{ + ffi_cif *cif; + void **arg_area; + + cif = closure->cif; + arg_area = (void**) alloca (cif->nargs * sizeof (void *)); + + ffi_prep_incoming_args_SYSV(args, arg_area, cif); + + (closure->fun) (cif, resp, arg_area, closure->user_data); + + return cif->flags; +} + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) +{ + FFI_ASSERT (cif->abi == FFI_SYSV); + + *(unsigned short *)closure->tramp = 0x207c; + *(void **)(closure->tramp + 2) = codeloc; + *(unsigned short *)(closure->tramp + 6) = 0x4ef9; + if (cif->rtype->type == FFI_TYPE_STRUCT + && !cif->flags) + *(void **)(closure->tramp + 8) = ffi_closure_struct_SYSV; + else + *(void **)(closure->tramp + 8) = ffi_closure_SYSV; + +#ifdef __rtems__ + rtems_cache_flush_multiple_data_lines( codeloc, FFI_TRAMPOLINE_SIZE ); +#else + syscall(SYS_cacheflush, codeloc, FLUSH_SCOPE_LINE, + FLUSH_CACHE_BOTH, FFI_TRAMPOLINE_SIZE); +#endif + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/m68k/ffitarget.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/m68k/ffitarget.h new file mode 100644 index 000000000..3b777ed20 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/m68k/ffitarget.h @@ -0,0 +1,49 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + Target configuration macros for Motorola 68K. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 16 +#define FFI_NATIVE_RAW_API 0 + +#endif + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/m68k/sysv.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/m68k/sysv.S new file mode 100644 index 000000000..c782f5192 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/m68k/sysv.S @@ -0,0 +1,270 @@ +/* ----------------------------------------------------------------------- + + sysv.S - Copyright (c) 1998 Andreas Schwab + Copyright (c) 2008 Red Hat, Inc. + + m68k Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + +#ifdef HAVE_AS_CFI_PSEUDO_OP +#define CFI_STARTPROC() .cfi_startproc +#define CFI_OFFSET(reg,off) .cfi_offset reg,off +#define CFI_DEF_CFA(reg,off) .cfi_def_cfa reg,off +#define CFI_ENDPROC() .cfi_endproc +#else +#define CFI_STARTPROC() +#define CFI_OFFSET(reg,off) +#define CFI_DEF_CFA(reg,off) +#define CFI_ENDPROC() +#endif + + .text + + .globl ffi_call_SYSV + .type ffi_call_SYSV,@function + .align 4 + +ffi_call_SYSV: + CFI_STARTPROC() + link %fp,#0 + CFI_OFFSET(14,-8) + CFI_DEF_CFA(14,8) + move.l %d2,-(%sp) + CFI_OFFSET(2,-12) + + | Make room for all of the new args. + sub.l 12(%fp),%sp + + | Call ffi_prep_args + move.l 8(%fp),-(%sp) + pea 4(%sp) +#if !defined __PIC__ + jsr ffi_prep_args +#else + bsr.l ffi_prep_args@PLTPC +#endif + addq.l #8,%sp + + | Pass pointer to struct value, if any + move.l %a0,%a1 + + | Call the function + move.l 24(%fp),%a0 + jsr (%a0) + + | Remove the space we pushed for the args + add.l 12(%fp),%sp + + | Load the pointer to storage for the return value + move.l 20(%fp),%a1 + + | Load the return type code + move.l 16(%fp),%d2 + + | If the return value pointer is NULL, assume no return value. + | NOTE: On the mc68000, tst on an address register is not supported. +#if defined(__mc68000__) && !defined(__mcoldfire__) + cmp.w #0, %a1 +#else + tst.l %a1 +#endif + jbeq noretval + + btst #0,%d2 + jbeq retlongint + move.l %d0,(%a1) + jbra epilogue + +retlongint: + btst #1,%d2 + jbeq retfloat + move.l %d0,(%a1) + move.l %d1,4(%a1) + jbra epilogue + +retfloat: + btst #2,%d2 + jbeq retdouble +#if defined(__MC68881__) + fmove.s %fp0,(%a1) +#else + move.l %d0,(%a1) +#endif + jbra epilogue + +retdouble: + btst #3,%d2 + jbeq retlongdouble +#if defined(__MC68881__) + fmove.d %fp0,(%a1) +#else + move.l %d0,(%a1)+ + move.l %d1,(%a1) +#endif + jbra epilogue + +retlongdouble: + btst #4,%d2 + jbeq retpointer +#if defined(__MC68881__) + fmove.x %fp0,(%a1) +#else + move.l %d0,(%a1)+ + move.l %d1,(%a1)+ + move.l %d2,(%a1) +#endif + jbra epilogue + +retpointer: + btst #5,%d2 + jbeq retstruct1 + move.l %a0,(%a1) + jbra epilogue + +retstruct1: + btst #6,%d2 + jbeq retstruct2 + move.b %d0,(%a1) + jbra epilogue + +retstruct2: + btst #7,%d2 + jbeq noretval + move.w %d0,(%a1) + +noretval: +epilogue: + move.l (%sp)+,%d2 + unlk %fp + rts + CFI_ENDPROC() + .size ffi_call_SYSV,.-ffi_call_SYSV + + .globl ffi_closure_SYSV + .type ffi_closure_SYSV, @function + .align 4 + +ffi_closure_SYSV: + CFI_STARTPROC() + link %fp,#-12 + CFI_OFFSET(14,-8) + CFI_DEF_CFA(14,8) + move.l %sp,-12(%fp) + pea 8(%fp) + pea -12(%fp) + move.l %a0,-(%sp) +#if !defined __PIC__ + jsr ffi_closure_SYSV_inner +#else + bsr.l ffi_closure_SYSV_inner@PLTPC +#endif + + lsr.l #1,%d0 + jne 1f + jcc .Lcls_epilogue + move.l -12(%fp),%d0 +.Lcls_epilogue: + unlk %fp + rts +1: + lea -12(%fp),%a0 + lsr.l #2,%d0 + jne 1f + jcs .Lcls_ret_float + move.l (%a0)+,%d0 + move.l (%a0),%d1 + jra .Lcls_epilogue +.Lcls_ret_float: +#if defined(__MC68881__) + fmove.s (%a0),%fp0 +#else + move.l (%a0),%d0 +#endif + jra .Lcls_epilogue +1: + lsr.l #2,%d0 + jne 1f + jcs .Lcls_ret_ldouble +#if defined(__MC68881__) + fmove.d (%a0),%fp0 +#else + move.l (%a0)+,%d0 + move.l (%a0),%d1 +#endif + jra .Lcls_epilogue +.Lcls_ret_ldouble: +#if defined(__MC68881__) + fmove.x (%a0),%fp0 +#else + move.l (%a0)+,%d0 + move.l (%a0)+,%d1 + move.l (%a0),%d2 +#endif + jra .Lcls_epilogue +1: + lsr.l #2,%d0 + jne .Lcls_ret_struct2 + jcs .Lcls_ret_struct1 + move.l (%a0),%a0 + move.l %a0,%d0 + jra .Lcls_epilogue +.Lcls_ret_struct1: + move.b (%a0),%d0 + jra .Lcls_epilogue +.Lcls_ret_struct2: + move.w (%a0),%d0 + jra .Lcls_epilogue + CFI_ENDPROC() + + .size ffi_closure_SYSV,.-ffi_closure_SYSV + + .globl ffi_closure_struct_SYSV + .type ffi_closure_struct_SYSV, @function + .align 4 + +ffi_closure_struct_SYSV: + CFI_STARTPROC() + link %fp,#0 + CFI_OFFSET(14,-8) + CFI_DEF_CFA(14,8) + move.l %sp,-12(%fp) + pea 8(%fp) + move.l %a1,-(%sp) + move.l %a0,-(%sp) +#if !defined __PIC__ + jsr ffi_closure_SYSV_inner +#else + bsr.l ffi_closure_SYSV_inner@PLTPC +#endif + unlk %fp + rts + CFI_ENDPROC() + .size ffi_closure_struct_SYSV,.-ffi_closure_struct_SYSV + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/mips/ffi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/mips/ffi.c new file mode 100644 index 000000000..79cff9b53 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/mips/ffi.c @@ -0,0 +1,1036 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2011 Anthony Green + Copyright (c) 2008 David Daney + Copyright (c) 1996, 2007, 2008, 2011 Red Hat, Inc. + + MIPS Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +#include + +#ifdef __GNUC__ +# if (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) +# define USE__BUILTIN___CLEAR_CACHE 1 +# endif +#endif + +#ifndef USE__BUILTIN___CLEAR_CACHE +# if defined(__OpenBSD__) +# include +# else +# include +# endif +#endif + +#ifdef FFI_DEBUG +# define FFI_MIPS_STOP_HERE() ffi_stop_here() +#else +# define FFI_MIPS_STOP_HERE() do {} while(0) +#endif + +#ifdef FFI_MIPS_N32 +#define FIX_ARGP \ +FFI_ASSERT(argp <= &stack[bytes]); \ +if (argp == &stack[bytes]) \ +{ \ + argp = stack; \ + FFI_MIPS_STOP_HERE(); \ +} +#else +#define FIX_ARGP +#endif + + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments */ + +static void ffi_prep_args(char *stack, + extended_cif *ecif, + int bytes, + int flags) +{ + int i; + void **p_argv; + char *argp; + ffi_type **p_arg; + +#ifdef FFI_MIPS_N32 + /* If more than 8 double words are used, the remainder go + on the stack. We reorder stuff on the stack here to + support this easily. */ + if (bytes > 8 * sizeof(ffi_arg)) + argp = &stack[bytes - (8 * sizeof(ffi_arg))]; + else + argp = stack; +#else + argp = stack; +#endif + + memset(stack, 0, bytes); + +#ifdef FFI_MIPS_N32 + if ( ecif->cif->rstruct_flag != 0 ) +#else + if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT ) +#endif + { + *(ffi_arg *) argp = (ffi_arg) ecif->rvalue; + argp += sizeof(ffi_arg); + FIX_ARGP; + } + + p_argv = ecif->avalue; + + for (i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs; i++, p_arg++) + { + size_t z; + unsigned int a; + + /* Align if necessary. */ + a = (*p_arg)->alignment; + if (a < sizeof(ffi_arg)) + a = sizeof(ffi_arg); + + if ((a - 1) & (unsigned long) argp) + { + argp = (char *) ALIGN(argp, a); + FIX_ARGP; + } + + z = (*p_arg)->size; + if (z <= sizeof(ffi_arg)) + { + int type = (*p_arg)->type; + z = sizeof(ffi_arg); + + /* The size of a pointer depends on the ABI */ + if (type == FFI_TYPE_POINTER) + type = (ecif->cif->abi == FFI_N64 + || ecif->cif->abi == FFI_N64_SOFT_FLOAT) + ? FFI_TYPE_SINT64 : FFI_TYPE_SINT32; + + if (i < 8 && (ecif->cif->abi == FFI_N32_SOFT_FLOAT + || ecif->cif->abi == FFI_N64_SOFT_FLOAT)) + { + switch (type) + { + case FFI_TYPE_FLOAT: + type = FFI_TYPE_UINT32; + break; + case FFI_TYPE_DOUBLE: + type = FFI_TYPE_UINT64; + break; + default: + break; + } + } + switch (type) + { + case FFI_TYPE_SINT8: + *(ffi_arg *)argp = *(SINT8 *)(* p_argv); + break; + + case FFI_TYPE_UINT8: + *(ffi_arg *)argp = *(UINT8 *)(* p_argv); + break; + + case FFI_TYPE_SINT16: + *(ffi_arg *)argp = *(SINT16 *)(* p_argv); + break; + + case FFI_TYPE_UINT16: + *(ffi_arg *)argp = *(UINT16 *)(* p_argv); + break; + + case FFI_TYPE_SINT32: + *(ffi_arg *)argp = *(SINT32 *)(* p_argv); + break; + + case FFI_TYPE_UINT32: + *(ffi_arg *)argp = *(UINT32 *)(* p_argv); + break; + + /* This can only happen with 64bit slots. */ + case FFI_TYPE_FLOAT: + *(float *) argp = *(float *)(* p_argv); + break; + + /* Handle structures. */ + default: + memcpy(argp, *p_argv, (*p_arg)->size); + break; + } + } + else + { +#ifdef FFI_MIPS_O32 + memcpy(argp, *p_argv, z); +#else + { + unsigned long end = (unsigned long) argp + z; + unsigned long cap = (unsigned long) stack + bytes; + + /* Check if the data will fit within the register space. + Handle it if it doesn't. */ + + if (end <= cap) + memcpy(argp, *p_argv, z); + else + { + unsigned long portion = cap - (unsigned long)argp; + + memcpy(argp, *p_argv, portion); + argp = stack; + z -= portion; + memcpy(argp, (void*)((unsigned long)(*p_argv) + portion), + z); + } + } +#endif + } + p_argv++; + argp += z; + FIX_ARGP; + } +} + +#ifdef FFI_MIPS_N32 + +/* The n32 spec says that if "a chunk consists solely of a double + float field (but not a double, which is part of a union), it + is passed in a floating point register. Any other chunk is + passed in an integer register". This code traverses structure + definitions and generates the appropriate flags. */ + +static unsigned +calc_n32_struct_flags(int soft_float, ffi_type *arg, + unsigned *loc, unsigned *arg_reg) +{ + unsigned flags = 0; + unsigned index = 0; + + ffi_type *e; + + if (soft_float) + return 0; + + while ((e = arg->elements[index])) + { + /* Align this object. */ + *loc = ALIGN(*loc, e->alignment); + if (e->type == FFI_TYPE_DOUBLE) + { + /* Already aligned to FFI_SIZEOF_ARG. */ + *arg_reg = *loc / FFI_SIZEOF_ARG; + if (*arg_reg > 7) + break; + flags += (FFI_TYPE_DOUBLE << (*arg_reg * FFI_FLAG_BITS)); + *loc += e->size; + } + else + *loc += e->size; + index++; + } + /* Next Argument register at alignment of FFI_SIZEOF_ARG. */ + *arg_reg = ALIGN(*loc, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; + + return flags; +} + +static unsigned +calc_n32_return_struct_flags(int soft_float, ffi_type *arg) +{ + unsigned flags = 0; + unsigned small = FFI_TYPE_SMALLSTRUCT; + ffi_type *e; + + /* Returning structures under n32 is a tricky thing. + A struct with only one or two floating point fields + is returned in $f0 (and $f2 if necessary). Any other + struct results at most 128 bits are returned in $2 + (the first 64 bits) and $3 (remainder, if necessary). + Larger structs are handled normally. */ + + if (arg->size > 16) + return 0; + + if (arg->size > 8) + small = FFI_TYPE_SMALLSTRUCT2; + + e = arg->elements[0]; + + if (e->type == FFI_TYPE_DOUBLE) + flags = FFI_TYPE_DOUBLE; + else if (e->type == FFI_TYPE_FLOAT) + flags = FFI_TYPE_FLOAT; + + if (flags && (e = arg->elements[1])) + { + if (e->type == FFI_TYPE_DOUBLE) + flags += FFI_TYPE_DOUBLE << FFI_FLAG_BITS; + else if (e->type == FFI_TYPE_FLOAT) + flags += FFI_TYPE_FLOAT << FFI_FLAG_BITS; + else + return small; + + if (flags && (arg->elements[2])) + { + /* There are three arguments and the first two are + floats! This must be passed the old way. */ + return small; + } + if (soft_float) + flags += FFI_TYPE_STRUCT_SOFT; + } + else + if (!flags) + return small; + + return flags; +} + +#endif + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + cif->flags = 0; + +#ifdef FFI_MIPS_O32 + /* Set the flags necessary for O32 processing. FFI_O32_SOFT_FLOAT + * does not have special handling for floating point args. + */ + + if (cif->rtype->type != FFI_TYPE_STRUCT && cif->abi == FFI_O32) + { + if (cif->nargs > 0) + { + switch ((cif->arg_types)[0]->type) + { + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + cif->flags += (cif->arg_types)[0]->type; + break; + + default: + break; + } + + if (cif->nargs > 1) + { + /* Only handle the second argument if the first + is a float or double. */ + if (cif->flags) + { + switch ((cif->arg_types)[1]->type) + { + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + cif->flags += (cif->arg_types)[1]->type << FFI_FLAG_BITS; + break; + + default: + break; + } + } + } + } + } + + /* Set the return type flag */ + + if (cif->abi == FFI_O32_SOFT_FLOAT) + { + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + case FFI_TYPE_STRUCT: + cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 2); + break; + + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + case FFI_TYPE_DOUBLE: + cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 2); + break; + + case FFI_TYPE_FLOAT: + default: + cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 2); + break; + } + } + else + { + /* FFI_O32 */ + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + case FFI_TYPE_STRUCT: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 2); + break; + + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + cif->flags += FFI_TYPE_UINT64 << (FFI_FLAG_BITS * 2); + break; + + default: + cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 2); + break; + } + } +#endif + +#ifdef FFI_MIPS_N32 + /* Set the flags necessary for N32 processing */ + { + int type; + unsigned arg_reg = 0; + unsigned loc = 0; + unsigned count = (cif->nargs < 8) ? cif->nargs : 8; + unsigned index = 0; + + unsigned struct_flags = 0; + int soft_float = (cif->abi == FFI_N32_SOFT_FLOAT + || cif->abi == FFI_N64_SOFT_FLOAT); + + if (cif->rtype->type == FFI_TYPE_STRUCT) + { + struct_flags = calc_n32_return_struct_flags(soft_float, cif->rtype); + + if (struct_flags == 0) + { + /* This means that the structure is being passed as + a hidden argument */ + + arg_reg = 1; + count = (cif->nargs < 7) ? cif->nargs : 7; + + cif->rstruct_flag = !0; + } + else + cif->rstruct_flag = 0; + } + else + cif->rstruct_flag = 0; + + while (count-- > 0 && arg_reg < 8) + { + type = (cif->arg_types)[index]->type; + if (soft_float) + { + switch (type) + { + case FFI_TYPE_FLOAT: + type = FFI_TYPE_UINT32; + break; + case FFI_TYPE_DOUBLE: + type = FFI_TYPE_UINT64; + break; + default: + break; + } + } + switch (type) + { + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + cif->flags += + ((cif->arg_types)[index]->type << (arg_reg * FFI_FLAG_BITS)); + arg_reg++; + break; + case FFI_TYPE_LONGDOUBLE: + /* Align it. */ + arg_reg = ALIGN(arg_reg, 2); + /* Treat it as two adjacent doubles. */ + if (soft_float) + { + arg_reg += 2; + } + else + { + cif->flags += + (FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS)); + arg_reg++; + cif->flags += + (FFI_TYPE_DOUBLE << (arg_reg * FFI_FLAG_BITS)); + arg_reg++; + } + break; + + case FFI_TYPE_STRUCT: + loc = arg_reg * FFI_SIZEOF_ARG; + cif->flags += calc_n32_struct_flags(soft_float, + (cif->arg_types)[index], + &loc, &arg_reg); + break; + + default: + arg_reg++; + break; + } + + index++; + } + + /* Set the return type flag */ + switch (cif->rtype->type) + { + case FFI_TYPE_STRUCT: + { + if (struct_flags == 0) + { + /* The structure is returned through a hidden + first argument. Do nothing, 'cause FFI_TYPE_VOID + is 0 */ + } + else + { + /* The structure is returned via some tricky + mechanism */ + cif->flags += FFI_TYPE_STRUCT << (FFI_FLAG_BITS * 8); + cif->flags += struct_flags << (4 + (FFI_FLAG_BITS * 8)); + } + break; + } + + case FFI_TYPE_VOID: + /* Do nothing, 'cause FFI_TYPE_VOID is 0 */ + break; + + case FFI_TYPE_POINTER: + if (cif->abi == FFI_N32_SOFT_FLOAT || cif->abi == FFI_N32) + cif->flags += FFI_TYPE_SINT32 << (FFI_FLAG_BITS * 8); + else + cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8); + break; + + case FFI_TYPE_FLOAT: + if (soft_float) + { + cif->flags += FFI_TYPE_SINT32 << (FFI_FLAG_BITS * 8); + break; + } + /* else fall through */ + case FFI_TYPE_DOUBLE: + if (soft_float) + cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8); + else + cif->flags += cif->rtype->type << (FFI_FLAG_BITS * 8); + break; + + case FFI_TYPE_LONGDOUBLE: + /* Long double is returned as if it were a struct containing + two doubles. */ + if (soft_float) + { + cif->flags += FFI_TYPE_STRUCT << (FFI_FLAG_BITS * 8); + cif->flags += FFI_TYPE_SMALLSTRUCT2 << (4 + (FFI_FLAG_BITS * 8)); + } + else + { + cif->flags += FFI_TYPE_STRUCT << (FFI_FLAG_BITS * 8); + cif->flags += (FFI_TYPE_DOUBLE + + (FFI_TYPE_DOUBLE << FFI_FLAG_BITS)) + << (4 + (FFI_FLAG_BITS * 8)); + } + break; + default: + cif->flags += FFI_TYPE_INT << (FFI_FLAG_BITS * 8); + break; + } + } +#endif + + return FFI_OK; +} + +/* Low level routine for calling O32 functions */ +extern int ffi_call_O32(void (*)(char *, extended_cif *, int, int), + extended_cif *, unsigned, + unsigned, unsigned *, void (*)(void)); + +/* Low level routine for calling N32 functions */ +extern int ffi_call_N32(void (*)(char *, extended_cif *, int, int), + extended_cif *, unsigned, + unsigned, void *, void (*)(void)); + +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + + if ((rvalue == NULL) && + (cif->rtype->type == FFI_TYPE_STRUCT)) + ecif.rvalue = alloca(cif->rtype->size); + else + ecif.rvalue = rvalue; + + switch (cif->abi) + { +#ifdef FFI_MIPS_O32 + case FFI_O32: + case FFI_O32_SOFT_FLOAT: + ffi_call_O32(ffi_prep_args, &ecif, cif->bytes, + cif->flags, ecif.rvalue, fn); + break; +#endif + +#ifdef FFI_MIPS_N32 + case FFI_N32: + case FFI_N32_SOFT_FLOAT: + case FFI_N64: + case FFI_N64_SOFT_FLOAT: + { + int copy_rvalue = 0; + int copy_offset = 0; + char *rvalue_copy = ecif.rvalue; + if (cif->rtype->type == FFI_TYPE_STRUCT && cif->rtype->size < 16) + { + /* For structures smaller than 16 bytes we clobber memory + in 8 byte increments. Make a copy so we don't clobber + the callers memory outside of the struct bounds. */ + rvalue_copy = alloca(16); + copy_rvalue = 1; + } + else if (cif->rtype->type == FFI_TYPE_FLOAT + && (cif->abi == FFI_N64_SOFT_FLOAT + || cif->abi == FFI_N32_SOFT_FLOAT)) + { + rvalue_copy = alloca (8); + copy_rvalue = 1; +#if defined(__MIPSEB__) || defined(_MIPSEB) + copy_offset = 4; +#endif + } + ffi_call_N32(ffi_prep_args, &ecif, cif->bytes, + cif->flags, rvalue_copy, fn); + if (copy_rvalue) + memcpy(ecif.rvalue, rvalue_copy + copy_offset, cif->rtype->size); + } + break; +#endif + + default: + FFI_ASSERT(0); + break; + } +} + +#if FFI_CLOSURES +#if defined(FFI_MIPS_O32) +extern void ffi_closure_O32(void); +#else +extern void ffi_closure_N32(void); +#endif /* FFI_MIPS_O32 */ + +ffi_status +ffi_prep_closure_loc (ffi_closure *closure, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) +{ + unsigned int *tramp = (unsigned int *) &closure->tramp[0]; + void * fn; + char *clear_location = (char *) codeloc; + +#if defined(FFI_MIPS_O32) + if (cif->abi != FFI_O32 && cif->abi != FFI_O32_SOFT_FLOAT) + return FFI_BAD_ABI; + fn = ffi_closure_O32; +#else /* FFI_MIPS_N32 */ + if (cif->abi != FFI_N32 && cif->abi != FFI_N64) + return FFI_BAD_ABI; + fn = ffi_closure_N32; +#endif /* FFI_MIPS_O32 */ + +#if defined(FFI_MIPS_O32) || (_MIPS_SIM ==_ABIN32) + /* lui $25,high(fn) */ + tramp[0] = 0x3c190000 | ((unsigned)fn >> 16); + /* ori $25,low(fn) */ + tramp[1] = 0x37390000 | ((unsigned)fn & 0xffff); + /* lui $12,high(codeloc) */ + tramp[2] = 0x3c0c0000 | ((unsigned)codeloc >> 16); + /* jr $25 */ + tramp[3] = 0x03200008; + /* ori $12,low(codeloc) */ + tramp[4] = 0x358c0000 | ((unsigned)codeloc & 0xffff); +#else + /* N64 has a somewhat larger trampoline. */ + /* lui $25,high(fn) */ + tramp[0] = 0x3c190000 | ((unsigned long)fn >> 48); + /* lui $12,high(codeloc) */ + tramp[1] = 0x3c0c0000 | ((unsigned long)codeloc >> 48); + /* ori $25,mid-high(fn) */ + tramp[2] = 0x37390000 | (((unsigned long)fn >> 32 ) & 0xffff); + /* ori $12,mid-high(codeloc) */ + tramp[3] = 0x358c0000 | (((unsigned long)codeloc >> 32) & 0xffff); + /* dsll $25,$25,16 */ + tramp[4] = 0x0019cc38; + /* dsll $12,$12,16 */ + tramp[5] = 0x000c6438; + /* ori $25,mid-low(fn) */ + tramp[6] = 0x37390000 | (((unsigned long)fn >> 16 ) & 0xffff); + /* ori $12,mid-low(codeloc) */ + tramp[7] = 0x358c0000 | (((unsigned long)codeloc >> 16) & 0xffff); + /* dsll $25,$25,16 */ + tramp[8] = 0x0019cc38; + /* dsll $12,$12,16 */ + tramp[9] = 0x000c6438; + /* ori $25,low(fn) */ + tramp[10] = 0x37390000 | ((unsigned long)fn & 0xffff); + /* jr $25 */ + tramp[11] = 0x03200008; + /* ori $12,low(codeloc) */ + tramp[12] = 0x358c0000 | ((unsigned long)codeloc & 0xffff); + +#endif + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + +#ifdef USE__BUILTIN___CLEAR_CACHE + __builtin___clear_cache(clear_location, clear_location + FFI_TRAMPOLINE_SIZE); +#else + cacheflush (clear_location, FFI_TRAMPOLINE_SIZE, ICACHE); +#endif + return FFI_OK; +} + +/* + * Decodes the arguments to a function, which will be stored on the + * stack. AR is the pointer to the beginning of the integer arguments + * (and, depending upon the arguments, some floating-point arguments + * as well). FPR is a pointer to the area where floating point + * registers have been saved, if any. + * + * RVALUE is the location where the function return value will be + * stored. CLOSURE is the prepared closure to invoke. + * + * This function should only be called from assembly, which is in + * turn called from a trampoline. + * + * Returns the function return type. + * + * Based on the similar routine for sparc. + */ +int +ffi_closure_mips_inner_O32 (ffi_closure *closure, + void *rvalue, ffi_arg *ar, + double *fpr) +{ + ffi_cif *cif; + void **avaluep; + ffi_arg *avalue; + ffi_type **arg_types; + int i, avn, argn, seen_int; + + cif = closure->cif; + avalue = alloca (cif->nargs * sizeof (ffi_arg)); + avaluep = alloca (cif->nargs * sizeof (ffi_arg)); + + seen_int = (cif->abi == FFI_O32_SOFT_FLOAT); + argn = 0; + + if ((cif->flags >> (FFI_FLAG_BITS * 2)) == FFI_TYPE_STRUCT) + { + rvalue = (void *)(UINT32)ar[0]; + argn = 1; + } + + i = 0; + avn = cif->nargs; + arg_types = cif->arg_types; + + while (i < avn) + { + if (i < 2 && !seen_int && + (arg_types[i]->type == FFI_TYPE_FLOAT || + arg_types[i]->type == FFI_TYPE_DOUBLE || + arg_types[i]->type == FFI_TYPE_LONGDOUBLE)) + { +#if defined(__MIPSEB__) || defined(_MIPSEB) + if (arg_types[i]->type == FFI_TYPE_FLOAT) + avaluep[i] = ((char *) &fpr[i]) + sizeof (float); + else +#endif + avaluep[i] = (char *) &fpr[i]; + } + else + { + if (arg_types[i]->alignment == 8 && (argn & 0x1)) + argn++; + switch (arg_types[i]->type) + { + case FFI_TYPE_SINT8: + avaluep[i] = &avalue[i]; + *(SINT8 *) &avalue[i] = (SINT8) ar[argn]; + break; + + case FFI_TYPE_UINT8: + avaluep[i] = &avalue[i]; + *(UINT8 *) &avalue[i] = (UINT8) ar[argn]; + break; + + case FFI_TYPE_SINT16: + avaluep[i] = &avalue[i]; + *(SINT16 *) &avalue[i] = (SINT16) ar[argn]; + break; + + case FFI_TYPE_UINT16: + avaluep[i] = &avalue[i]; + *(UINT16 *) &avalue[i] = (UINT16) ar[argn]; + break; + + default: + avaluep[i] = (char *) &ar[argn]; + break; + } + seen_int = 1; + } + argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; + i++; + } + + /* Invoke the closure. */ + (closure->fun) (cif, rvalue, avaluep, closure->user_data); + + if (cif->abi == FFI_O32_SOFT_FLOAT) + { + switch (cif->rtype->type) + { + case FFI_TYPE_FLOAT: + return FFI_TYPE_INT; + case FFI_TYPE_DOUBLE: + return FFI_TYPE_UINT64; + default: + return cif->rtype->type; + } + } + else + { + return cif->rtype->type; + } +} + +#if defined(FFI_MIPS_N32) + +static void +copy_struct_N32(char *target, unsigned offset, ffi_abi abi, ffi_type *type, + int argn, unsigned arg_offset, ffi_arg *ar, + ffi_arg *fpr, int soft_float) +{ + ffi_type **elt_typep = type->elements; + while(*elt_typep) + { + ffi_type *elt_type = *elt_typep; + unsigned o; + char *tp; + char *argp; + char *fpp; + + o = ALIGN(offset, elt_type->alignment); + arg_offset += o - offset; + offset = o; + argn += arg_offset / sizeof(ffi_arg); + arg_offset = arg_offset % sizeof(ffi_arg); + + argp = (char *)(ar + argn); + fpp = (char *)(argn >= 8 ? ar + argn : fpr + argn); + + tp = target + offset; + + if (elt_type->type == FFI_TYPE_DOUBLE && !soft_float) + *(double *)tp = *(double *)fpp; + else + memcpy(tp, argp + arg_offset, elt_type->size); + + offset += elt_type->size; + arg_offset += elt_type->size; + elt_typep++; + argn += arg_offset / sizeof(ffi_arg); + arg_offset = arg_offset % sizeof(ffi_arg); + } +} + +/* + * Decodes the arguments to a function, which will be stored on the + * stack. AR is the pointer to the beginning of the integer + * arguments. FPR is a pointer to the area where floating point + * registers have been saved. + * + * RVALUE is the location where the function return value will be + * stored. CLOSURE is the prepared closure to invoke. + * + * This function should only be called from assembly, which is in + * turn called from a trampoline. + * + * Returns the function return flags. + * + */ +int +ffi_closure_mips_inner_N32 (ffi_closure *closure, + void *rvalue, ffi_arg *ar, + ffi_arg *fpr) +{ + ffi_cif *cif; + void **avaluep; + ffi_arg *avalue; + ffi_type **arg_types; + int i, avn, argn; + int soft_float; + ffi_arg *argp; + + cif = closure->cif; + soft_float = cif->abi == FFI_N64_SOFT_FLOAT + || cif->abi == FFI_N32_SOFT_FLOAT; + avalue = alloca (cif->nargs * sizeof (ffi_arg)); + avaluep = alloca (cif->nargs * sizeof (ffi_arg)); + + argn = 0; + + if (cif->rstruct_flag) + { +#if _MIPS_SIM==_ABIN32 + rvalue = (void *)(UINT32)ar[0]; +#else /* N64 */ + rvalue = (void *)ar[0]; +#endif + argn = 1; + } + + i = 0; + avn = cif->nargs; + arg_types = cif->arg_types; + + while (i < avn) + { + if (arg_types[i]->type == FFI_TYPE_FLOAT + || arg_types[i]->type == FFI_TYPE_DOUBLE + || arg_types[i]->type == FFI_TYPE_LONGDOUBLE) + { + argp = (argn >= 8 || soft_float) ? ar + argn : fpr + argn; + if ((arg_types[i]->type == FFI_TYPE_LONGDOUBLE) && ((unsigned)argp & (arg_types[i]->alignment-1))) + { + argp=(ffi_arg*)ALIGN(argp,arg_types[i]->alignment); + argn++; + } +#if defined(__MIPSEB__) || defined(_MIPSEB) + if (arg_types[i]->type == FFI_TYPE_FLOAT && argn < 8) + avaluep[i] = ((char *) argp) + sizeof (float); + else +#endif + avaluep[i] = (char *) argp; + } + else + { + unsigned type = arg_types[i]->type; + + if (arg_types[i]->alignment > sizeof(ffi_arg)) + argn = ALIGN(argn, arg_types[i]->alignment / sizeof(ffi_arg)); + + argp = ar + argn; + + /* The size of a pointer depends on the ABI */ + if (type == FFI_TYPE_POINTER) + type = (cif->abi == FFI_N64 || cif->abi == FFI_N64_SOFT_FLOAT) + ? FFI_TYPE_SINT64 : FFI_TYPE_SINT32; + + if (soft_float && type == FFI_TYPE_FLOAT) + type = FFI_TYPE_UINT32; + + switch (type) + { + case FFI_TYPE_SINT8: + avaluep[i] = &avalue[i]; + *(SINT8 *) &avalue[i] = (SINT8) *argp; + break; + + case FFI_TYPE_UINT8: + avaluep[i] = &avalue[i]; + *(UINT8 *) &avalue[i] = (UINT8) *argp; + break; + + case FFI_TYPE_SINT16: + avaluep[i] = &avalue[i]; + *(SINT16 *) &avalue[i] = (SINT16) *argp; + break; + + case FFI_TYPE_UINT16: + avaluep[i] = &avalue[i]; + *(UINT16 *) &avalue[i] = (UINT16) *argp; + break; + + case FFI_TYPE_SINT32: + avaluep[i] = &avalue[i]; + *(SINT32 *) &avalue[i] = (SINT32) *argp; + break; + + case FFI_TYPE_UINT32: + avaluep[i] = &avalue[i]; + *(UINT32 *) &avalue[i] = (UINT32) *argp; + break; + + case FFI_TYPE_STRUCT: + if (argn < 8) + { + /* Allocate space for the struct as at least part of + it was passed in registers. */ + avaluep[i] = alloca(arg_types[i]->size); + copy_struct_N32(avaluep[i], 0, cif->abi, arg_types[i], + argn, 0, ar, fpr, soft_float); + + break; + } + /* Else fall through. */ + default: + avaluep[i] = (char *) argp; + break; + } + } + argn += ALIGN(arg_types[i]->size, sizeof(ffi_arg)) / sizeof(ffi_arg); + i++; + } + + /* Invoke the closure. */ + (closure->fun) (cif, rvalue, avaluep, closure->user_data); + + return cif->flags >> (FFI_FLAG_BITS * 8); +} + +#endif /* FFI_MIPS_N32 */ + +#endif /* FFI_CLOSURES */ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/mips/ffitarget.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/mips/ffitarget.h new file mode 100644 index 000000000..637adbfe4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/mips/ffitarget.h @@ -0,0 +1,242 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + Target configuration macros for MIPS. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#ifdef linux +# include +#elif defined(__rtems__) +/* + * Subprogram calling convention - copied from sgidefs.h + */ +#define _MIPS_SIM_ABI32 1 +#define _MIPS_SIM_NABI32 2 +#define _MIPS_SIM_ABI64 3 +#elif !defined(__OpenBSD__) +# include +#endif + +# ifndef _ABIN32 +# define _ABIN32 _MIPS_SIM_NABI32 +# endif +# ifndef _ABI64 +# define _ABI64 _MIPS_SIM_ABI64 +# endif +# ifndef _ABIO32 +# define _ABIO32 _MIPS_SIM_ABI32 +# endif + +#if !defined(_MIPS_SIM) +# error -- something is very wrong -- +#else +# if (_MIPS_SIM==_ABIN32 && defined(_ABIN32)) || (_MIPS_SIM==_ABI64 && defined(_ABI64)) +# define FFI_MIPS_N32 +# else +# if (_MIPS_SIM==_ABIO32 && defined(_ABIO32)) +# define FFI_MIPS_O32 +# else +# error -- this is an unsupported platform -- +# endif +# endif +#endif + +#ifdef FFI_MIPS_O32 +/* O32 stack frames have 32bit integer args */ +# define FFI_SIZEOF_ARG 4 +#else +/* N32 and N64 frames have 64bit integer args */ +# define FFI_SIZEOF_ARG 8 +# if _MIPS_SIM == _ABIN32 +# define FFI_SIZEOF_JAVA_RAW 4 +# endif +#endif + +#define FFI_FLAG_BITS 2 + +/* SGI's strange assembler requires that we multiply by 4 rather + than shift left by FFI_FLAG_BITS */ + +#define FFI_ARGS_D FFI_TYPE_DOUBLE +#define FFI_ARGS_F FFI_TYPE_FLOAT +#define FFI_ARGS_DD FFI_TYPE_DOUBLE * 4 + FFI_TYPE_DOUBLE +#define FFI_ARGS_FF FFI_TYPE_FLOAT * 4 + FFI_TYPE_FLOAT +#define FFI_ARGS_FD FFI_TYPE_DOUBLE * 4 + FFI_TYPE_FLOAT +#define FFI_ARGS_DF FFI_TYPE_FLOAT * 4 + FFI_TYPE_DOUBLE + +/* Needed for N32 structure returns */ +#define FFI_TYPE_SMALLSTRUCT FFI_TYPE_UINT8 +#define FFI_TYPE_SMALLSTRUCT2 FFI_TYPE_SINT8 + +#if 0 +/* The SGI assembler can't handle this.. */ +#define FFI_TYPE_STRUCT_DD (( FFI_ARGS_DD ) << 4) + FFI_TYPE_STRUCT +/* (and so on) */ +#else +/* ...so we calculate these by hand! */ +#define FFI_TYPE_STRUCT_D 61 +#define FFI_TYPE_STRUCT_F 45 +#define FFI_TYPE_STRUCT_DD 253 +#define FFI_TYPE_STRUCT_FF 173 +#define FFI_TYPE_STRUCT_FD 237 +#define FFI_TYPE_STRUCT_DF 189 +#define FFI_TYPE_STRUCT_SMALL 93 +#define FFI_TYPE_STRUCT_SMALL2 109 + +/* and for n32 soft float, add 16 * 2^4 */ +#define FFI_TYPE_STRUCT_D_SOFT 317 +#define FFI_TYPE_STRUCT_F_SOFT 301 +#define FFI_TYPE_STRUCT_DD_SOFT 509 +#define FFI_TYPE_STRUCT_FF_SOFT 429 +#define FFI_TYPE_STRUCT_FD_SOFT 493 +#define FFI_TYPE_STRUCT_DF_SOFT 445 +#define FFI_TYPE_STRUCT_SOFT 16 +#endif + +#ifdef LIBFFI_ASM +#define v0 $2 +#define v1 $3 +#define a0 $4 +#define a1 $5 +#define a2 $6 +#define a3 $7 +#define a4 $8 +#define a5 $9 +#define a6 $10 +#define a7 $11 +#define t0 $8 +#define t1 $9 +#define t2 $10 +#define t3 $11 +#define t4 $12 +#define t5 $13 +#define t6 $14 +#define t7 $15 +#define t8 $24 +#define t9 $25 +#define ra $31 + +#ifdef FFI_MIPS_O32 +# define REG_L lw +# define REG_S sw +# define SUBU subu +# define ADDU addu +# define SRL srl +# define LI li +#else /* !FFI_MIPS_O32 */ +# define REG_L ld +# define REG_S sd +# define SUBU dsubu +# define ADDU daddu +# define SRL dsrl +# define LI dli +# if (_MIPS_SIM==_ABI64) +# define LA dla +# define EH_FRAME_ALIGN 3 +# define FDE_ADDR_BYTES .8byte +# else +# define LA la +# define EH_FRAME_ALIGN 2 +# define FDE_ADDR_BYTES .4byte +# endif /* _MIPS_SIM==_ABI64 */ +#endif /* !FFI_MIPS_O32 */ +#else /* !LIBFFI_ASM */ +# ifdef __GNUC__ +# ifdef FFI_MIPS_O32 +/* O32 stack frames have 32bit integer args */ +typedef unsigned int ffi_arg __attribute__((__mode__(__SI__))); +typedef signed int ffi_sarg __attribute__((__mode__(__SI__))); +#else +/* N32 and N64 frames have 64bit integer args */ +typedef unsigned int ffi_arg __attribute__((__mode__(__DI__))); +typedef signed int ffi_sarg __attribute__((__mode__(__DI__))); +# endif +# else +# ifdef FFI_MIPS_O32 +/* O32 stack frames have 32bit integer args */ +typedef __uint32_t ffi_arg; +typedef __int32_t ffi_sarg; +# else +/* N32 and N64 frames have 64bit integer args */ +typedef __uint64_t ffi_arg; +typedef __int64_t ffi_sarg; +# endif +# endif /* __GNUC__ */ + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_O32, + FFI_N32, + FFI_N64, + FFI_O32_SOFT_FLOAT, + FFI_N32_SOFT_FLOAT, + FFI_N64_SOFT_FLOAT, + FFI_LAST_ABI, + +#ifdef FFI_MIPS_O32 +#ifdef __mips_soft_float + FFI_DEFAULT_ABI = FFI_O32_SOFT_FLOAT +#else + FFI_DEFAULT_ABI = FFI_O32 +#endif +#else +# if _MIPS_SIM==_ABI64 +# ifdef __mips_soft_float + FFI_DEFAULT_ABI = FFI_N64_SOFT_FLOAT +# else + FFI_DEFAULT_ABI = FFI_N64 +# endif +# else +# ifdef __mips_soft_float + FFI_DEFAULT_ABI = FFI_N32_SOFT_FLOAT +# else + FFI_DEFAULT_ABI = FFI_N32 +# endif +# endif +#endif +} ffi_abi; + +#define FFI_EXTRA_CIF_FIELDS unsigned rstruct_flag +#endif /* !LIBFFI_ASM */ + +/* ---- Definitions for closures ----------------------------------------- */ + +#if defined(FFI_MIPS_O32) +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 20 +#else +/* N32/N64. */ +# define FFI_CLOSURES 1 +#if _MIPS_SIM==_ABI64 +#define FFI_TRAMPOLINE_SIZE 52 +#else +#define FFI_TRAMPOLINE_SIZE 20 +#endif +#endif /* FFI_MIPS_O32 */ +#define FFI_NATIVE_RAW_API 0 + +#endif + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/mips/n32.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/mips/n32.S new file mode 100644 index 000000000..ae2309466 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/mips/n32.S @@ -0,0 +1,591 @@ +/* ----------------------------------------------------------------------- + n32.S - Copyright (c) 1996, 1998, 2005, 2007, 2009, 2010 Red Hat, Inc. + + MIPS Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + +/* Only build this code if we are compiling for n32 */ + +#if defined(FFI_MIPS_N32) + +#define callback a0 +#define bytes a2 +#define flags a3 +#define raddr a4 +#define fn a5 + +#define SIZEOF_FRAME ( 8 * FFI_SIZEOF_ARG ) + +#ifdef __GNUC__ + .abicalls +#endif + .text + .align 2 + .globl ffi_call_N32 + .ent ffi_call_N32 +ffi_call_N32: +.LFB3: + .frame $fp, SIZEOF_FRAME, ra + .mask 0xc0000000,-FFI_SIZEOF_ARG + .fmask 0x00000000,0 + + # Prologue + SUBU $sp, SIZEOF_FRAME # Frame size +.LCFI0: + REG_S $fp, SIZEOF_FRAME - 2*FFI_SIZEOF_ARG($sp) # Save frame pointer + REG_S ra, SIZEOF_FRAME - 1*FFI_SIZEOF_ARG($sp) # Save return address +.LCFI1: + move $fp, $sp +.LCFI3: + move t9, callback # callback function pointer + REG_S bytes, 2*FFI_SIZEOF_ARG($fp) # bytes + REG_S flags, 3*FFI_SIZEOF_ARG($fp) # flags + REG_S raddr, 4*FFI_SIZEOF_ARG($fp) # raddr + REG_S fn, 5*FFI_SIZEOF_ARG($fp) # fn + + # Allocate at least 4 words in the argstack + move v0, bytes + bge bytes, 4 * FFI_SIZEOF_ARG, bigger + LI v0, 4 * FFI_SIZEOF_ARG + b sixteen + + bigger: + ADDU t4, v0, 2 * FFI_SIZEOF_ARG -1 # make sure it is aligned + and v0, t4, -2 * FFI_SIZEOF_ARG # to a proper boundry. + +sixteen: + SUBU $sp, $sp, v0 # move the stack pointer to reflect the + # arg space + + move a0, $sp # 4 * FFI_SIZEOF_ARG + ADDU a3, $fp, 3 * FFI_SIZEOF_ARG + + # Call ffi_prep_args + jal t9 + + # Copy the stack pointer to t9 + move t9, $sp + + # Fix the stack if there are more than 8 64bit slots worth + # of arguments. + + # Load the number of bytes + REG_L t6, 2*FFI_SIZEOF_ARG($fp) + + # Is it bigger than 8 * FFI_SIZEOF_ARG? + daddiu t8, t6, -(8 * FFI_SIZEOF_ARG) + bltz t8, loadregs + + ADDU t9, t9, t8 + +loadregs: + + REG_L t6, 3*FFI_SIZEOF_ARG($fp) # load the flags word into t6. + + and t4, t6, ((1< +#include + +/* Only build this code if we are compiling for o32 */ + +#if defined(FFI_MIPS_O32) + +#define callback a0 +#define bytes a2 +#define flags a3 + +#define SIZEOF_FRAME (4 * FFI_SIZEOF_ARG + 2 * FFI_SIZEOF_ARG) +#define A3_OFF (SIZEOF_FRAME + 3 * FFI_SIZEOF_ARG) +#define FP_OFF (SIZEOF_FRAME - 2 * FFI_SIZEOF_ARG) +#define RA_OFF (SIZEOF_FRAME - 1 * FFI_SIZEOF_ARG) + + .abicalls + .text + .align 2 + .globl ffi_call_O32 + .ent ffi_call_O32 +ffi_call_O32: +$LFB0: + # Prologue + SUBU $sp, SIZEOF_FRAME # Frame size +$LCFI0: + REG_S $fp, FP_OFF($sp) # Save frame pointer +$LCFI1: + REG_S ra, RA_OFF($sp) # Save return address +$LCFI2: + move $fp, $sp + +$LCFI3: + move t9, callback # callback function pointer + REG_S flags, A3_OFF($fp) # flags + + # Allocate at least 4 words in the argstack + LI v0, 4 * FFI_SIZEOF_ARG + blt bytes, v0, sixteen + + ADDU v0, bytes, 7 # make sure it is aligned + and v0, -8 # to an 8 byte boundry + +sixteen: + SUBU $sp, v0 # move the stack pointer to reflect the + # arg space + + ADDU a0, $sp, 4 * FFI_SIZEOF_ARG + + jalr t9 + + REG_L t0, A3_OFF($fp) # load the flags word + SRL t2, t0, 4 # shift our arg info + and t0, ((1<<4)-1) # mask out the return type + + ADDU $sp, 4 * FFI_SIZEOF_ARG # adjust $sp to new args + + bnez t0, pass_d # make it quick for int + REG_L a0, 0*FFI_SIZEOF_ARG($sp) # just go ahead and load the + REG_L a1, 1*FFI_SIZEOF_ARG($sp) # four regs. + REG_L a2, 2*FFI_SIZEOF_ARG($sp) + REG_L a3, 3*FFI_SIZEOF_ARG($sp) + b call_it + +pass_d: + bne t0, FFI_ARGS_D, pass_f + l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args + REG_L a2, 2*FFI_SIZEOF_ARG($sp) # passing a double + REG_L a3, 3*FFI_SIZEOF_ARG($sp) + b call_it + +pass_f: + bne t0, FFI_ARGS_F, pass_d_d + l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args + REG_L a1, 1*FFI_SIZEOF_ARG($sp) # passing a float + REG_L a2, 2*FFI_SIZEOF_ARG($sp) + REG_L a3, 3*FFI_SIZEOF_ARG($sp) + b call_it + +pass_d_d: + bne t0, FFI_ARGS_DD, pass_f_f + l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args + l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing two doubles + b call_it + +pass_f_f: + bne t0, FFI_ARGS_FF, pass_d_f + l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args + l.s $f14, 1*FFI_SIZEOF_ARG($sp) # passing two floats + REG_L a2, 2*FFI_SIZEOF_ARG($sp) + REG_L a3, 3*FFI_SIZEOF_ARG($sp) + b call_it + +pass_d_f: + bne t0, FFI_ARGS_DF, pass_f_d + l.d $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args + l.s $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float + REG_L a3, 3*FFI_SIZEOF_ARG($sp) + b call_it + +pass_f_d: + # assume that the only other combination must be float then double + # bne t0, FFI_ARGS_F_D, call_it + l.s $f12, 0*FFI_SIZEOF_ARG($sp) # load $fp regs from args + l.d $f14, 2*FFI_SIZEOF_ARG($sp) # passing double and float + +call_it: + # Load the function pointer + REG_L t9, SIZEOF_FRAME + 5*FFI_SIZEOF_ARG($fp) + + # If the return value pointer is NULL, assume no return value. + REG_L t1, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) + beqz t1, noretval + + bne t2, FFI_TYPE_INT, retlonglong + jalr t9 + REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) + REG_S v0, 0(t0) + b epilogue + +retlonglong: + # Really any 64-bit int, signed or not. + bne t2, FFI_TYPE_UINT64, retfloat + jalr t9 + REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) + REG_S v1, 4(t0) + REG_S v0, 0(t0) + b epilogue + +retfloat: + bne t2, FFI_TYPE_FLOAT, retdouble + jalr t9 + REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) + s.s $f0, 0(t0) + b epilogue + +retdouble: + bne t2, FFI_TYPE_DOUBLE, noretval + jalr t9 + REG_L t0, SIZEOF_FRAME + 4*FFI_SIZEOF_ARG($fp) + s.d $f0, 0(t0) + b epilogue + +noretval: + jalr t9 + + # Epilogue +epilogue: + move $sp, $fp + REG_L $fp, FP_OFF($sp) # Restore frame pointer + REG_L ra, RA_OFF($sp) # Restore return address + ADDU $sp, SIZEOF_FRAME # Fix stack pointer + j ra + +$LFE0: + .end ffi_call_O32 + + +/* ffi_closure_O32. Expects address of the passed-in ffi_closure + in t4 ($12). Stores any arguments passed in registers onto the + stack, then calls ffi_closure_mips_inner_O32, which + then decodes them. + + Stack layout: + + 3 - a3 save + 2 - a2 save + 1 - a1 save + 0 - a0 save, original sp + -1 - ra save + -2 - fp save + -3 - $16 (s0) save + -4 - cprestore + -5 - return value high (v1) + -6 - return value low (v0) + -7 - f14 (le high, be low) + -8 - f14 (le low, be high) + -9 - f12 (le high, be low) + -10 - f12 (le low, be high) + -11 - Called function a3 save + -12 - Called function a2 save + -13 - Called function a1 save + -14 - Called function a0 save, our sp and fp point here + */ + +#define SIZEOF_FRAME2 (14 * FFI_SIZEOF_ARG) +#define A3_OFF2 (SIZEOF_FRAME2 + 3 * FFI_SIZEOF_ARG) +#define A2_OFF2 (SIZEOF_FRAME2 + 2 * FFI_SIZEOF_ARG) +#define A1_OFF2 (SIZEOF_FRAME2 + 1 * FFI_SIZEOF_ARG) +#define A0_OFF2 (SIZEOF_FRAME2 + 0 * FFI_SIZEOF_ARG) +#define RA_OFF2 (SIZEOF_FRAME2 - 1 * FFI_SIZEOF_ARG) +#define FP_OFF2 (SIZEOF_FRAME2 - 2 * FFI_SIZEOF_ARG) +#define S0_OFF2 (SIZEOF_FRAME2 - 3 * FFI_SIZEOF_ARG) +#define GP_OFF2 (SIZEOF_FRAME2 - 4 * FFI_SIZEOF_ARG) +#define V1_OFF2 (SIZEOF_FRAME2 - 5 * FFI_SIZEOF_ARG) +#define V0_OFF2 (SIZEOF_FRAME2 - 6 * FFI_SIZEOF_ARG) +#define FA_1_1_OFF2 (SIZEOF_FRAME2 - 7 * FFI_SIZEOF_ARG) +#define FA_1_0_OFF2 (SIZEOF_FRAME2 - 8 * FFI_SIZEOF_ARG) +#define FA_0_1_OFF2 (SIZEOF_FRAME2 - 9 * FFI_SIZEOF_ARG) +#define FA_0_0_OFF2 (SIZEOF_FRAME2 - 10 * FFI_SIZEOF_ARG) + + .text + .align 2 + .globl ffi_closure_O32 + .ent ffi_closure_O32 +ffi_closure_O32: +$LFB1: + # Prologue + .frame $fp, SIZEOF_FRAME2, ra + .set noreorder + .cpload t9 + .set reorder + SUBU $sp, SIZEOF_FRAME2 + .cprestore GP_OFF2 +$LCFI4: + REG_S $16, S0_OFF2($sp) # Save s0 + REG_S $fp, FP_OFF2($sp) # Save frame pointer + REG_S ra, RA_OFF2($sp) # Save return address +$LCFI6: + move $fp, $sp + +$LCFI7: + # Store all possible argument registers. If there are more than + # four arguments, then they are stored above where we put a3. + REG_S a0, A0_OFF2($fp) + REG_S a1, A1_OFF2($fp) + REG_S a2, A2_OFF2($fp) + REG_S a3, A3_OFF2($fp) + + # Load ABI enum to s0 + REG_L $16, 20($12) # cif pointer follows tramp. + REG_L $16, 0($16) # abi is first member. + + li $13, 1 # FFI_O32 + bne $16, $13, 1f # Skip fp save if FFI_O32_SOFT_FLOAT + + # Store all possible float/double registers. + s.d $f12, FA_0_0_OFF2($fp) + s.d $f14, FA_1_0_OFF2($fp) +1: + # Call ffi_closure_mips_inner_O32 to do the work. + la t9, ffi_closure_mips_inner_O32 + move a0, $12 # Pointer to the ffi_closure + addu a1, $fp, V0_OFF2 + addu a2, $fp, A0_OFF2 + addu a3, $fp, FA_0_0_OFF2 + jalr t9 + + # Load the return value into the appropriate register. + move $8, $2 + li $9, FFI_TYPE_VOID + beq $8, $9, closure_done + + li $13, 1 # FFI_O32 + bne $16, $13, 1f # Skip fp restore if FFI_O32_SOFT_FLOAT + + li $9, FFI_TYPE_FLOAT + l.s $f0, V0_OFF2($fp) + beq $8, $9, closure_done + + li $9, FFI_TYPE_DOUBLE + l.d $f0, V0_OFF2($fp) + beq $8, $9, closure_done +1: + REG_L $3, V1_OFF2($fp) + REG_L $2, V0_OFF2($fp) + +closure_done: + # Epilogue + move $sp, $fp + REG_L $16, S0_OFF2($sp) # Restore s0 + REG_L $fp, FP_OFF2($sp) # Restore frame pointer + REG_L ra, RA_OFF2($sp) # Restore return address + ADDU $sp, SIZEOF_FRAME2 + j ra +$LFE1: + .end ffi_closure_O32 + +/* DWARF-2 unwind info. */ + + .section .eh_frame,"a",@progbits +$Lframe0: + .4byte $LECIE0-$LSCIE0 # Length of Common Information Entry +$LSCIE0: + .4byte 0x0 # CIE Identifier Tag + .byte 0x1 # CIE Version + .ascii "zR\0" # CIE Augmentation + .uleb128 0x1 # CIE Code Alignment Factor + .sleb128 4 # CIE Data Alignment Factor + .byte 0x1f # CIE RA Column + .uleb128 0x1 # Augmentation size + .byte 0x00 # FDE Encoding (absptr) + .byte 0xc # DW_CFA_def_cfa + .uleb128 0x1d + .uleb128 0x0 + .align 2 +$LECIE0: +$LSFDE0: + .4byte $LEFDE0-$LASFDE0 # FDE Length +$LASFDE0: + .4byte $LASFDE0-$Lframe0 # FDE CIE offset + .4byte $LFB0 # FDE initial location + .4byte $LFE0-$LFB0 # FDE address range + .uleb128 0x0 # Augmentation size + .byte 0x4 # DW_CFA_advance_loc4 + .4byte $LCFI0-$LFB0 + .byte 0xe # DW_CFA_def_cfa_offset + .uleb128 0x18 + .byte 0x4 # DW_CFA_advance_loc4 + .4byte $LCFI2-$LCFI0 + .byte 0x11 # DW_CFA_offset_extended_sf + .uleb128 0x1e # $fp + .sleb128 -2 # SIZEOF_FRAME2 - 2*FFI_SIZEOF_ARG($sp) + .byte 0x11 # DW_CFA_offset_extended_sf + .uleb128 0x1f # $ra + .sleb128 -1 # SIZEOF_FRAME2 - 1*FFI_SIZEOF_ARG($sp) + .byte 0x4 # DW_CFA_advance_loc4 + .4byte $LCFI3-$LCFI2 + .byte 0xc # DW_CFA_def_cfa + .uleb128 0x1e + .uleb128 0x18 + .align 2 +$LEFDE0: +$LSFDE1: + .4byte $LEFDE1-$LASFDE1 # FDE Length +$LASFDE1: + .4byte $LASFDE1-$Lframe0 # FDE CIE offset + .4byte $LFB1 # FDE initial location + .4byte $LFE1-$LFB1 # FDE address range + .uleb128 0x0 # Augmentation size + .byte 0x4 # DW_CFA_advance_loc4 + .4byte $LCFI4-$LFB1 + .byte 0xe # DW_CFA_def_cfa_offset + .uleb128 0x38 + .byte 0x4 # DW_CFA_advance_loc4 + .4byte $LCFI6-$LCFI4 + .byte 0x11 # DW_CFA_offset_extended_sf + .uleb128 0x10 # $16 + .sleb128 -3 # SIZEOF_FRAME2 - 3*FFI_SIZEOF_ARG($sp) + .byte 0x11 # DW_CFA_offset_extended_sf + .uleb128 0x1e # $fp + .sleb128 -2 # SIZEOF_FRAME2 - 2*FFI_SIZEOF_ARG($sp) + .byte 0x11 # DW_CFA_offset_extended_sf + .uleb128 0x1f # $ra + .sleb128 -1 # SIZEOF_FRAME2 - 1*FFI_SIZEOF_ARG($sp) + .byte 0x4 # DW_CFA_advance_loc4 + .4byte $LCFI7-$LCFI6 + .byte 0xc # DW_CFA_def_cfa + .uleb128 0x1e + .uleb128 0x38 + .align 2 +$LEFDE1: + +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/moxie/eabi.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/moxie/eabi.S new file mode 100644 index 000000000..379ea4bb0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/moxie/eabi.S @@ -0,0 +1,128 @@ +/* ----------------------------------------------------------------------- + eabi.S - Copyright (c) 2004 Anthony Green + + FR-V Assembly glue. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + + .globl ffi_prep_args_EABI + + .text + .p2align 4 + .globl ffi_call_EABI + .type ffi_call_EABI, @function + + # gr8 : ffi_prep_args + # gr9 : &ecif + # gr10: cif->bytes + # gr11: fig->flags + # gr12: ecif.rvalue + # gr13: fn + +ffi_call_EABI: + addi sp, #-80, sp + sti fp, @(sp, #24) + addi sp, #24, fp + movsg lr, gr5 + + /* Make room for the new arguments. */ + /* subi sp, fp, gr10 */ + + /* Store return address and incoming args on stack. */ + sti gr5, @(fp, #8) + sti gr8, @(fp, #-4) + sti gr9, @(fp, #-8) + sti gr10, @(fp, #-12) + sti gr11, @(fp, #-16) + sti gr12, @(fp, #-20) + sti gr13, @(fp, #-24) + + sub sp, gr10, sp + + /* Call ffi_prep_args. */ + ldi @(fp, #-4), gr4 + addi sp, #0, gr8 + ldi @(fp, #-8), gr9 +#ifdef __FRV_FDPIC__ + ldd @(gr4, gr0), gr14 + calll @(gr14, gr0) +#else + calll @(gr4, gr0) +#endif + + /* ffi_prep_args returns the new stack pointer. */ + mov gr8, gr4 + + ldi @(sp, #0), gr8 + ldi @(sp, #4), gr9 + ldi @(sp, #8), gr10 + ldi @(sp, #12), gr11 + ldi @(sp, #16), gr12 + ldi @(sp, #20), gr13 + + /* Always copy the return value pointer into the hidden + parameter register. This is only strictly necessary + when we're returning an aggregate type, but it doesn't + hurt to do this all the time, and it saves a branch. */ + ldi @(fp, #-20), gr3 + + /* Use the ffi_prep_args return value for the new sp. */ + mov gr4, sp + + /* Call the target function. */ + ldi @(fp, -24), gr4 +#ifdef __FRV_FDPIC__ + ldd @(gr4, gr0), gr14 + calll @(gr14, gr0) +#else + calll @(gr4, gr0) +#endif + + /* Store the result. */ + ldi @(fp, #-16), gr10 /* fig->flags */ + ldi @(fp, #-20), gr4 /* ecif.rvalue */ + + /* Is the return value stored in two registers? */ + cmpi gr10, #8, icc0 + bne icc0, 0, .L2 + /* Yes, save them. */ + sti gr8, @(gr4, #0) + sti gr9, @(gr4, #4) + bra .L3 +.L2: + /* Is the return value a structure? */ + cmpi gr10, #-1, icc0 + beq icc0, 0, .L3 + /* No, save a 4 byte return value. */ + sti gr8, @(gr4, #0) +.L3: + + /* Restore the stack, and return. */ + ldi @(fp, 8), gr5 + ld @(fp, gr0), fp + addi sp,#80,sp + jmpl @(gr5,gr0) + .size ffi_call_EABI, .-ffi_call_EABI + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/moxie/ffi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/moxie/ffi.c new file mode 100644 index 000000000..54cbbb9e4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/moxie/ffi.c @@ -0,0 +1,276 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (C) 2009 Anthony Green + + Moxie Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +#include + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments */ + +void *ffi_prep_args(char *stack, extended_cif *ecif) +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + register int count = 0; + + p_argv = ecif->avalue; + argp = stack; + + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; + (i != 0); + i--, p_arg++) + { + size_t z; + + z = (*p_arg)->size; + + if ((*p_arg)->type == FFI_TYPE_STRUCT) + { + z = sizeof(void*); + *(void **) argp = *p_argv; + } + /* if ((*p_arg)->type == FFI_TYPE_FLOAT) + { + if (count > 24) + { + // This is going on the stack. Turn it into a double. + *(double *) argp = (double) *(float*)(* p_argv); + z = sizeof(double); + } + else + *(void **) argp = *(void **)(* p_argv); + } */ + else if (z < sizeof(int)) + { + z = sizeof(int); + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); + break; + + case FFI_TYPE_UINT8: + *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); + break; + + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); + break; + + case FFI_TYPE_UINT16: + *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); + break; + + default: + FFI_ASSERT(0); + } + } + else if (z == sizeof(int)) + { + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + } + else + { + memcpy(argp, *p_argv, z); + } + p_argv++; + argp += z; + count += z; + } + + return (stack + ((count > 24) ? 24 : ALIGN_DOWN(count, 8))); +} + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + if (cif->rtype->type == FFI_TYPE_STRUCT) + cif->flags = -1; + else + cif->flags = cif->rtype->size; + + cif->bytes = ALIGN (cif->bytes, 8); + + return FFI_OK; +} + +extern void ffi_call_EABI(void *(*)(char *, extended_cif *), + extended_cif *, + unsigned, unsigned, + unsigned *, + void (*fn)(void)); + +void ffi_call(ffi_cif *cif, + void (*fn)(void), + void *rvalue, + void **avalue) +{ + extended_cif ecif; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + + if ((rvalue == NULL) && + (cif->rtype->type == FFI_TYPE_STRUCT)) + { + ecif.rvalue = alloca(cif->rtype->size); + } + else + ecif.rvalue = rvalue; + + + switch (cif->abi) + { + case FFI_EABI: + ffi_call_EABI(ffi_prep_args, &ecif, cif->bytes, + cif->flags, ecif.rvalue, fn); + break; + default: + FFI_ASSERT(0); + break; + } +} + +void ffi_closure_eabi (unsigned arg1, unsigned arg2, unsigned arg3, + unsigned arg4, unsigned arg5, unsigned arg6) +{ + /* This function is called by a trampoline. The trampoline stows a + pointer to the ffi_closure object in gr7. We must save this + pointer in a place that will persist while we do our work. */ + register ffi_closure *creg __asm__ ("gr7"); + ffi_closure *closure = creg; + + /* Arguments that don't fit in registers are found on the stack + at a fixed offset above the current frame pointer. */ + register char *frame_pointer __asm__ ("fp"); + char *stack_args = frame_pointer + 16; + + /* Lay the register arguments down in a continuous chunk of memory. */ + unsigned register_args[6] = + { arg1, arg2, arg3, arg4, arg5, arg6 }; + + ffi_cif *cif = closure->cif; + ffi_type **arg_types = cif->arg_types; + void **avalue = alloca (cif->nargs * sizeof(void *)); + char *ptr = (char *) register_args; + int i; + + /* Find the address of each argument. */ + for (i = 0; i < cif->nargs; i++) + { + switch (arg_types[i]->type) + { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + avalue[i] = ptr + 3; + break; + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + avalue[i] = ptr + 2; + break; + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + case FFI_TYPE_FLOAT: + avalue[i] = ptr; + break; + case FFI_TYPE_STRUCT: + avalue[i] = *(void**)ptr; + break; + default: + /* This is an 8-byte value. */ + avalue[i] = ptr; + ptr += 4; + break; + } + ptr += 4; + + /* If we've handled more arguments than fit in registers, + start looking at the those passed on the stack. */ + if (ptr == ((char *)register_args + (6*4))) + ptr = stack_args; + } + + /* Invoke the closure. */ + if (cif->rtype->type == FFI_TYPE_STRUCT) + { + /* The caller allocates space for the return structure, and + passes a pointer to this space in gr3. Use this value directly + as the return value. */ + register void *return_struct_ptr __asm__("gr3"); + (closure->fun) (cif, return_struct_ptr, avalue, closure->user_data); + } + else + { + /* Allocate space for the return value and call the function. */ + long long rvalue; + (closure->fun) (cif, &rvalue, avalue, closure->user_data); + + /* Functions return 4-byte or smaller results in gr8. 8-byte + values also use gr9. We fill the both, even for small return + values, just to avoid a branch. */ + asm ("ldi @(%0, #0), gr8" : : "r" (&rvalue)); + asm ("ldi @(%0, #0), gr9" : : "r" (&((int *) &rvalue)[1])); + } +} + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void *user_data, + void *codeloc) +{ + unsigned int *tramp = (unsigned int *) &closure->tramp[0]; + unsigned long fn = (long) ffi_closure_eabi; + unsigned long cls = (long) codeloc; + int i; + + fn = (unsigned long) ffi_closure_eabi; + + tramp[0] = 0x8cfc0000 + (fn & 0xffff); /* setlos lo(fn), gr6 */ + tramp[1] = 0x8efc0000 + (cls & 0xffff); /* setlos lo(cls), gr7 */ + tramp[2] = 0x8cf80000 + (fn >> 16); /* sethi hi(fn), gr6 */ + tramp[3] = 0x8ef80000 + (cls >> 16); /* sethi hi(cls), gr7 */ + tramp[4] = 0x80300006; /* jmpl @(gr0, gr6) */ + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + + /* Cache flushing. */ + for (i = 0; i < FFI_TRAMPOLINE_SIZE; i++) + __asm__ volatile ("dcf @(%0,%1)\n\tici @(%2,%1)" :: "r" (tramp), "r" (i), + "r" (codeloc)); + + return FFI_OK; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/pa/ffi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/pa/ffi.c new file mode 100644 index 000000000..4ce2bc6f0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/pa/ffi.c @@ -0,0 +1,719 @@ +/* ----------------------------------------------------------------------- + ffi.c - (c) 2011 Anthony Green + (c) 2008 Red Hat, Inc. + (c) 2006 Free Software Foundation, Inc. + (c) 2003-2004 Randolph Chung + + HPPA Foreign Function Interface + HP-UX PA ABI support + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +#include +#include + +#define ROUND_UP(v, a) (((size_t)(v) + (a) - 1) & ~((a) - 1)) + +#define MIN_STACK_SIZE 64 +#define FIRST_ARG_SLOT 9 +#define DEBUG_LEVEL 0 + +#define fldw(addr, fpreg) \ + __asm__ volatile ("fldw 0(%0), %%" #fpreg "L" : : "r"(addr) : #fpreg) +#define fstw(fpreg, addr) \ + __asm__ volatile ("fstw %%" #fpreg "L, 0(%0)" : : "r"(addr)) +#define fldd(addr, fpreg) \ + __asm__ volatile ("fldd 0(%0), %%" #fpreg : : "r"(addr) : #fpreg) +#define fstd(fpreg, addr) \ + __asm__ volatile ("fstd %%" #fpreg "L, 0(%0)" : : "r"(addr)) + +#define debug(lvl, x...) do { if (lvl <= DEBUG_LEVEL) { printf(x); } } while (0) + +static inline int ffi_struct_type(ffi_type *t) +{ + size_t sz = t->size; + + /* Small structure results are passed in registers, + larger ones are passed by pointer. Note that + small structures of size 2, 4 and 8 differ from + the corresponding integer types in that they have + different alignment requirements. */ + + if (sz <= 1) + return FFI_TYPE_UINT8; + else if (sz == 2) + return FFI_TYPE_SMALL_STRUCT2; + else if (sz == 3) + return FFI_TYPE_SMALL_STRUCT3; + else if (sz == 4) + return FFI_TYPE_SMALL_STRUCT4; + else if (sz == 5) + return FFI_TYPE_SMALL_STRUCT5; + else if (sz == 6) + return FFI_TYPE_SMALL_STRUCT6; + else if (sz == 7) + return FFI_TYPE_SMALL_STRUCT7; + else if (sz <= 8) + return FFI_TYPE_SMALL_STRUCT8; + else + return FFI_TYPE_STRUCT; /* else, we pass it by pointer. */ +} + +/* PA has a downward growing stack, which looks like this: + + Offset + [ Variable args ] + SP = (4*(n+9)) arg word N + ... + SP-52 arg word 4 + [ Fixed args ] + SP-48 arg word 3 + SP-44 arg word 2 + SP-40 arg word 1 + SP-36 arg word 0 + [ Frame marker ] + ... + SP-20 RP + SP-4 previous SP + + The first four argument words on the stack are reserved for use by + the callee. Instead, the general and floating registers replace + the first four argument slots. Non FP arguments are passed solely + in the general registers. FP arguments are passed in both general + and floating registers when using libffi. + + Non-FP 32-bit args are passed in gr26, gr25, gr24 and gr23. + Non-FP 64-bit args are passed in register pairs, starting + on an odd numbered register (i.e. r25+r26 and r23+r24). + FP 32-bit arguments are passed in fr4L, fr5L, fr6L and fr7L. + FP 64-bit arguments are passed in fr5 and fr7. + + The registers are allocated in the same manner as stack slots. + This allows the callee to save its arguments on the stack if + necessary: + + arg word 3 -> gr23 or fr7L + arg word 2 -> gr24 or fr6L or fr7R + arg word 1 -> gr25 or fr5L + arg word 0 -> gr26 or fr4L or fr5R + + Note that fr4R and fr6R are never used for arguments (i.e., + doubles are not passed in fr4 or fr6). + + The rest of the arguments are passed on the stack starting at SP-52, + but 64-bit arguments need to be aligned to an 8-byte boundary + + This means we can have holes either in the register allocation, + or in the stack. */ + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments + + The following code will put everything into the stack frame + (which was allocated by the asm routine), and on return + the asm routine will load the arguments that should be + passed by register into the appropriate registers + + NOTE: We load floating point args in this function... that means we + assume gcc will not mess with fp regs in here. */ + +void ffi_prep_args_pa32(UINT32 *stack, extended_cif *ecif, unsigned bytes) +{ + register unsigned int i; + register ffi_type **p_arg; + register void **p_argv; + unsigned int slot = FIRST_ARG_SLOT; + char *dest_cpy; + size_t len; + + debug(1, "%s: stack = %p, ecif = %p, bytes = %u\n", __FUNCTION__, stack, + ecif, bytes); + + p_arg = ecif->cif->arg_types; + p_argv = ecif->avalue; + + for (i = 0; i < ecif->cif->nargs; i++) + { + int type = (*p_arg)->type; + + switch (type) + { + case FFI_TYPE_SINT8: + *(SINT32 *)(stack - slot) = *(SINT8 *)(*p_argv); + break; + + case FFI_TYPE_UINT8: + *(UINT32 *)(stack - slot) = *(UINT8 *)(*p_argv); + break; + + case FFI_TYPE_SINT16: + *(SINT32 *)(stack - slot) = *(SINT16 *)(*p_argv); + break; + + case FFI_TYPE_UINT16: + *(UINT32 *)(stack - slot) = *(UINT16 *)(*p_argv); + break; + + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + debug(3, "Storing UINT32 %u in slot %u\n", *(UINT32 *)(*p_argv), + slot); + *(UINT32 *)(stack - slot) = *(UINT32 *)(*p_argv); + break; + + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + /* Align slot for 64-bit type. */ + slot += (slot & 1) ? 1 : 2; + *(UINT64 *)(stack - slot) = *(UINT64 *)(*p_argv); + break; + + case FFI_TYPE_FLOAT: + /* First 4 args go in fr4L - fr7L. */ + debug(3, "Storing UINT32(float) in slot %u\n", slot); + *(UINT32 *)(stack - slot) = *(UINT32 *)(*p_argv); + switch (slot - FIRST_ARG_SLOT) + { + /* First 4 args go in fr4L - fr7L. */ + case 0: fldw(stack - slot, fr4); break; + case 1: fldw(stack - slot, fr5); break; + case 2: fldw(stack - slot, fr6); break; + case 3: fldw(stack - slot, fr7); break; + } + break; + + case FFI_TYPE_DOUBLE: + /* Align slot for 64-bit type. */ + slot += (slot & 1) ? 1 : 2; + debug(3, "Storing UINT64(double) at slot %u\n", slot); + *(UINT64 *)(stack - slot) = *(UINT64 *)(*p_argv); + switch (slot - FIRST_ARG_SLOT) + { + /* First 2 args go in fr5, fr7. */ + case 1: fldd(stack - slot, fr5); break; + case 3: fldd(stack - slot, fr7); break; + } + break; + +#ifdef PA_HPUX + case FFI_TYPE_LONGDOUBLE: + /* Long doubles are passed in the same manner as structures + larger than 8 bytes. */ + *(UINT32 *)(stack - slot) = (UINT32)(*p_argv); + break; +#endif + + case FFI_TYPE_STRUCT: + + /* Structs smaller or equal than 4 bytes are passed in one + register. Structs smaller or equal 8 bytes are passed in two + registers. Larger structures are passed by pointer. */ + + len = (*p_arg)->size; + if (len <= 4) + { + dest_cpy = (char *)(stack - slot) + 4 - len; + memcpy(dest_cpy, (char *)*p_argv, len); + } + else if (len <= 8) + { + slot += (slot & 1) ? 1 : 2; + dest_cpy = (char *)(stack - slot) + 8 - len; + memcpy(dest_cpy, (char *)*p_argv, len); + } + else + *(UINT32 *)(stack - slot) = (UINT32)(*p_argv); + break; + + default: + FFI_ASSERT(0); + } + + slot++; + p_arg++; + p_argv++; + } + + /* Make sure we didn't mess up and scribble on the stack. */ + { + unsigned int n; + + debug(5, "Stack setup:\n"); + for (n = 0; n < (bytes + 3) / 4; n++) + { + if ((n%4) == 0) { debug(5, "\n%08x: ", (unsigned int)(stack - n)); } + debug(5, "%08x ", *(stack - n)); + } + debug(5, "\n"); + } + + FFI_ASSERT(slot * 4 <= bytes); + + return; +} + +static void ffi_size_stack_pa32(ffi_cif *cif) +{ + ffi_type **ptr; + int i; + int z = 0; /* # stack slots */ + + for (ptr = cif->arg_types, i = 0; i < cif->nargs; ptr++, i++) + { + int type = (*ptr)->type; + + switch (type) + { + case FFI_TYPE_DOUBLE: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + z += 2 + (z & 1); /* must start on even regs, so we may waste one */ + break; + +#ifdef PA_HPUX + case FFI_TYPE_LONGDOUBLE: +#endif + case FFI_TYPE_STRUCT: + z += 1; /* pass by ptr, callee will copy */ + break; + + default: /* <= 32-bit values */ + z++; + } + } + + /* We can fit up to 6 args in the default 64-byte stack frame, + if we need more, we need more stack. */ + if (z <= 6) + cif->bytes = MIN_STACK_SIZE; /* min stack size */ + else + cif->bytes = 64 + ROUND_UP((z - 6) * sizeof(UINT32), MIN_STACK_SIZE); + + debug(3, "Calculated stack size is %u bytes\n", cif->bytes); +} + +/* Perform machine dependent cif processing. */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + /* Set the return type flag */ + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + cif->flags = (unsigned) cif->rtype->type; + break; + +#ifdef PA_HPUX + case FFI_TYPE_LONGDOUBLE: + /* Long doubles are treated like a structure. */ + cif->flags = FFI_TYPE_STRUCT; + break; +#endif + + case FFI_TYPE_STRUCT: + /* For the return type we have to check the size of the structures. + If the size is smaller or equal 4 bytes, the result is given back + in one register. If the size is smaller or equal 8 bytes than we + return the result in two registers. But if the size is bigger than + 8 bytes, we work with pointers. */ + cif->flags = ffi_struct_type(cif->rtype); + break; + + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + cif->flags = FFI_TYPE_UINT64; + break; + + default: + cif->flags = FFI_TYPE_INT; + break; + } + + /* Lucky us, because of the unique PA ABI we get to do our + own stack sizing. */ + switch (cif->abi) + { + case FFI_PA32: + ffi_size_stack_pa32(cif); + break; + + default: + FFI_ASSERT(0); + break; + } + + return FFI_OK; +} + +extern void ffi_call_pa32(void (*)(UINT32 *, extended_cif *, unsigned), + extended_cif *, unsigned, unsigned, unsigned *, + void (*fn)(void)); + +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return + value address then we need to make one. */ + + if (rvalue == NULL +#ifdef PA_HPUX + && (cif->rtype->type == FFI_TYPE_STRUCT + || cif->rtype->type == FFI_TYPE_LONGDOUBLE)) +#else + && cif->rtype->type == FFI_TYPE_STRUCT) +#endif + { + ecif.rvalue = alloca(cif->rtype->size); + } + else + ecif.rvalue = rvalue; + + + switch (cif->abi) + { + case FFI_PA32: + debug(3, "Calling ffi_call_pa32: ecif=%p, bytes=%u, flags=%u, rvalue=%p, fn=%p\n", &ecif, cif->bytes, cif->flags, ecif.rvalue, (void *)fn); + ffi_call_pa32(ffi_prep_args_pa32, &ecif, cif->bytes, + cif->flags, ecif.rvalue, fn); + break; + + default: + FFI_ASSERT(0); + break; + } +} + +#if FFI_CLOSURES +/* This is more-or-less an inverse of ffi_call -- we have arguments on + the stack, and we need to fill them into a cif structure and invoke + the user function. This really ought to be in asm to make sure + the compiler doesn't do things we don't expect. */ +ffi_status ffi_closure_inner_pa32(ffi_closure *closure, UINT32 *stack) +{ + ffi_cif *cif; + void **avalue; + void *rvalue; + UINT32 ret[2]; /* function can return up to 64-bits in registers */ + ffi_type **p_arg; + char *tmp; + int i, avn; + unsigned int slot = FIRST_ARG_SLOT; + register UINT32 r28 asm("r28"); + + cif = closure->cif; + + /* If returning via structure, callee will write to our pointer. */ + if (cif->flags == FFI_TYPE_STRUCT) + rvalue = (void *)r28; + else + rvalue = &ret[0]; + + avalue = (void **)alloca(cif->nargs * FFI_SIZEOF_ARG); + avn = cif->nargs; + p_arg = cif->arg_types; + + for (i = 0; i < avn; i++) + { + int type = (*p_arg)->type; + + switch (type) + { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + case FFI_TYPE_POINTER: + avalue[i] = (char *)(stack - slot) + sizeof(UINT32) - (*p_arg)->size; + break; + + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + slot += (slot & 1) ? 1 : 2; + avalue[i] = (void *)(stack - slot); + break; + + case FFI_TYPE_FLOAT: +#ifdef PA_LINUX + /* The closure call is indirect. In Linux, floating point + arguments in indirect calls with a prototype are passed + in the floating point registers instead of the general + registers. So, we need to replace what was previously + stored in the current slot with the value in the + corresponding floating point register. */ + switch (slot - FIRST_ARG_SLOT) + { + case 0: fstw(fr4, (void *)(stack - slot)); break; + case 1: fstw(fr5, (void *)(stack - slot)); break; + case 2: fstw(fr6, (void *)(stack - slot)); break; + case 3: fstw(fr7, (void *)(stack - slot)); break; + } +#endif + avalue[i] = (void *)(stack - slot); + break; + + case FFI_TYPE_DOUBLE: + slot += (slot & 1) ? 1 : 2; +#ifdef PA_LINUX + /* See previous comment for FFI_TYPE_FLOAT. */ + switch (slot - FIRST_ARG_SLOT) + { + case 1: fstd(fr5, (void *)(stack - slot)); break; + case 3: fstd(fr7, (void *)(stack - slot)); break; + } +#endif + avalue[i] = (void *)(stack - slot); + break; + +#ifdef PA_HPUX + case FFI_TYPE_LONGDOUBLE: + /* Long doubles are treated like a big structure. */ + avalue[i] = (void *) *(stack - slot); + break; +#endif + + case FFI_TYPE_STRUCT: + /* Structs smaller or equal than 4 bytes are passed in one + register. Structs smaller or equal 8 bytes are passed in two + registers. Larger structures are passed by pointer. */ + if((*p_arg)->size <= 4) + { + avalue[i] = (void *)(stack - slot) + sizeof(UINT32) - + (*p_arg)->size; + } + else if ((*p_arg)->size <= 8) + { + slot += (slot & 1) ? 1 : 2; + avalue[i] = (void *)(stack - slot) + sizeof(UINT64) - + (*p_arg)->size; + } + else + avalue[i] = (void *) *(stack - slot); + break; + + default: + FFI_ASSERT(0); + } + + slot++; + p_arg++; + } + + /* Invoke the closure. */ + (closure->fun) (cif, rvalue, avalue, closure->user_data); + + debug(3, "after calling function, ret[0] = %08x, ret[1] = %08x\n", ret[0], + ret[1]); + + /* Store the result using the lower 2 bytes of the flags. */ + switch (cif->flags) + { + case FFI_TYPE_UINT8: + *(stack - FIRST_ARG_SLOT) = (UINT8)(ret[0] >> 24); + break; + case FFI_TYPE_SINT8: + *(stack - FIRST_ARG_SLOT) = (SINT8)(ret[0] >> 24); + break; + case FFI_TYPE_UINT16: + *(stack - FIRST_ARG_SLOT) = (UINT16)(ret[0] >> 16); + break; + case FFI_TYPE_SINT16: + *(stack - FIRST_ARG_SLOT) = (SINT16)(ret[0] >> 16); + break; + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + *(stack - FIRST_ARG_SLOT) = ret[0]; + break; + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + *(stack - FIRST_ARG_SLOT) = ret[0]; + *(stack - FIRST_ARG_SLOT - 1) = ret[1]; + break; + + case FFI_TYPE_DOUBLE: + fldd(rvalue, fr4); + break; + + case FFI_TYPE_FLOAT: + fldw(rvalue, fr4); + break; + + case FFI_TYPE_STRUCT: + /* Don't need a return value, done by caller. */ + break; + + case FFI_TYPE_SMALL_STRUCT2: + case FFI_TYPE_SMALL_STRUCT3: + case FFI_TYPE_SMALL_STRUCT4: + tmp = (void*)(stack - FIRST_ARG_SLOT); + tmp += 4 - cif->rtype->size; + memcpy((void*)tmp, &ret[0], cif->rtype->size); + break; + + case FFI_TYPE_SMALL_STRUCT5: + case FFI_TYPE_SMALL_STRUCT6: + case FFI_TYPE_SMALL_STRUCT7: + case FFI_TYPE_SMALL_STRUCT8: + { + unsigned int ret2[2]; + int off; + + /* Right justify ret[0] and ret[1] */ + switch (cif->flags) + { + case FFI_TYPE_SMALL_STRUCT5: off = 3; break; + case FFI_TYPE_SMALL_STRUCT6: off = 2; break; + case FFI_TYPE_SMALL_STRUCT7: off = 1; break; + default: off = 0; break; + } + + memset (ret2, 0, sizeof (ret2)); + memcpy ((char *)ret2 + off, ret, 8 - off); + + *(stack - FIRST_ARG_SLOT) = ret2[0]; + *(stack - FIRST_ARG_SLOT - 1) = ret2[1]; + } + break; + + case FFI_TYPE_POINTER: + case FFI_TYPE_VOID: + break; + + default: + debug(0, "assert with cif->flags: %d\n",cif->flags); + FFI_ASSERT(0); + break; + } + return FFI_OK; +} + +/* Fill in a closure to refer to the specified fun and user_data. + cif specifies the argument and result types for fun. + The cif must already be prep'ed. */ + +extern void ffi_closure_pa32(void); + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) +{ + UINT32 *tramp = (UINT32 *)(closure->tramp); +#ifdef PA_HPUX + UINT32 *tmp; +#endif + + if (cif->abi != FFI_PA32) + return FFI_BAD_ABI; + + /* Make a small trampoline that will branch to our + handler function. Use PC-relative addressing. */ + +#ifdef PA_LINUX + tramp[0] = 0xeaa00000; /* b,l .+8,%r21 ; %r21 <- pc+8 */ + tramp[1] = 0xd6a01c1e; /* depi 0,31,2,%r21 ; mask priv bits */ + tramp[2] = 0x4aa10028; /* ldw 20(%r21),%r1 ; load plabel */ + tramp[3] = 0x36b53ff1; /* ldo -8(%r21),%r21 ; get closure addr */ + tramp[4] = 0x0c201096; /* ldw 0(%r1),%r22 ; address of handler */ + tramp[5] = 0xeac0c000; /* bv%r0(%r22) ; branch to handler */ + tramp[6] = 0x0c281093; /* ldw 4(%r1),%r19 ; GP of handler */ + tramp[7] = ((UINT32)(ffi_closure_pa32) & ~2); + + /* Flush d/icache -- have to flush up 2 two lines because of + alignment. */ + __asm__ volatile( + "fdc 0(%0)\n\t" + "fdc %1(%0)\n\t" + "fic 0(%%sr4, %0)\n\t" + "fic %1(%%sr4, %0)\n\t" + "sync\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n" + : + : "r"((unsigned long)tramp & ~31), + "r"(32 /* stride */) + : "memory"); +#endif + +#ifdef PA_HPUX + tramp[0] = 0xeaa00000; /* b,l .+8,%r21 ; %r21 <- pc+8 */ + tramp[1] = 0xd6a01c1e; /* depi 0,31,2,%r21 ; mask priv bits */ + tramp[2] = 0x4aa10038; /* ldw 28(%r21),%r1 ; load plabel */ + tramp[3] = 0x36b53ff1; /* ldo -8(%r21),%r21 ; get closure addr */ + tramp[4] = 0x0c201096; /* ldw 0(%r1),%r22 ; address of handler */ + tramp[5] = 0x02c010b4; /* ldsid (%r22),%r20 ; load space id */ + tramp[6] = 0x00141820; /* mtsp %r20,%sr0 ; into %sr0 */ + tramp[7] = 0xe2c00000; /* be 0(%sr0,%r22) ; branch to handler */ + tramp[8] = 0x0c281093; /* ldw 4(%r1),%r19 ; GP of handler */ + tramp[9] = ((UINT32)(ffi_closure_pa32) & ~2); + + /* Flush d/icache -- have to flush three lines because of alignment. */ + __asm__ volatile( + "copy %1,%0\n\t" + "fdc,m %2(%0)\n\t" + "fdc,m %2(%0)\n\t" + "fdc,m %2(%0)\n\t" + "ldsid (%1),%0\n\t" + "mtsp %0,%%sr0\n\t" + "copy %1,%0\n\t" + "fic,m %2(%%sr0,%0)\n\t" + "fic,m %2(%%sr0,%0)\n\t" + "fic,m %2(%%sr0,%0)\n\t" + "sync\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n\t" + "nop\n" + : "=&r" ((unsigned long)tmp) + : "r" ((unsigned long)tramp & ~31), + "r" (32/* stride */) + : "memory"); +#endif + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/pa/ffitarget.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/pa/ffitarget.h new file mode 100644 index 000000000..efa2f4e39 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/pa/ffitarget.h @@ -0,0 +1,78 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + Target configuration macros for hppa. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +/* ---- System specific configurations ----------------------------------- */ + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + +#ifdef PA_LINUX + FFI_PA32, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_PA32 +#endif + +#ifdef PA_HPUX + FFI_PA32, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_PA32 +#endif + +#ifdef PA64_HPUX +#error "PA64_HPUX FFI is not yet implemented" + FFI_PA64, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_PA64 +#endif +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_NATIVE_RAW_API 0 + +#ifdef PA_LINUX +#define FFI_TRAMPOLINE_SIZE 32 +#else +#define FFI_TRAMPOLINE_SIZE 40 +#endif + +#define FFI_TYPE_SMALL_STRUCT2 -1 +#define FFI_TYPE_SMALL_STRUCT3 -2 +#define FFI_TYPE_SMALL_STRUCT4 -3 +#define FFI_TYPE_SMALL_STRUCT5 -4 +#define FFI_TYPE_SMALL_STRUCT6 -5 +#define FFI_TYPE_SMALL_STRUCT7 -6 +#define FFI_TYPE_SMALL_STRUCT8 -7 +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/pa/hpux32.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/pa/hpux32.S new file mode 100644 index 000000000..40528bad7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/pa/hpux32.S @@ -0,0 +1,368 @@ +/* ----------------------------------------------------------------------- + hpux32.S - Copyright (c) 2006 Free Software Foundation, Inc. + (c) 2008 Red Hat, Inc. + based on src/pa/linux.S + + HP-UX PA Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + + .LEVEL 1.1 + .SPACE $PRIVATE$ + .IMPORT $global$,DATA + .IMPORT $$dyncall,MILLICODE + .SUBSPA $DATA$ + .align 4 + + /* void ffi_call_pa32(void (*)(char *, extended_cif *), + extended_cif *ecif, + unsigned bytes, + unsigned flags, + unsigned *rvalue, + void (*fn)(void)); + */ + + .export ffi_call_pa32,ENTRY,PRIV_LEV=3 + .import ffi_prep_args_pa32,CODE + + .SPACE $TEXT$ + .SUBSPA $CODE$ + .align 4 + +L$FB1 +ffi_call_pa32 + .proc + .callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=4 + .entry + stw %rp, -20(%sp) + copy %r3, %r1 +L$CFI11 + copy %sp, %r3 +L$CFI12 + + /* Setup the stack for calling prep_args... + We want the stack to look like this: + + [ Previous stack ] <- %r3 + + [ 64-bytes register save area ] <- %r4 + + [ Stack space for actual call, passed as ] <- %arg0 + [ arg0 to ffi_prep_args_pa32 ] + + [ Stack for calling prep_args ] <- %sp + */ + + stwm %r1, 64(%sp) + stw %r4, 12(%r3) +L$CFI13 + copy %sp, %r4 + + addl %arg2, %r4, %arg0 ; arg stack + stw %arg3, -48(%r3) ; save flags we need it later + + /* Call prep_args: + %arg0(stack) -- set up above + %arg1(ecif) -- same as incoming param + %arg2(bytes) -- same as incoming param */ + bl ffi_prep_args_pa32,%r2 + ldo 64(%arg0), %sp + ldo -64(%sp), %sp + + /* now %sp should point where %arg0 was pointing. */ + + /* Load the arguments that should be passed in registers + The fp args are loaded by the prep_args function. */ + ldw -36(%sp), %arg0 + ldw -40(%sp), %arg1 + ldw -44(%sp), %arg2 + ldw -48(%sp), %arg3 + + /* in case the function is going to return a structure + we need to give it a place to put the result. */ + ldw -52(%r3), %ret0 ; %ret0 <- rvalue + ldw -56(%r3), %r22 ; %r22 <- function to call + bl $$dyncall, %r31 ; Call the user function + copy %r31, %rp + + /* Prepare to store the result; we need to recover flags and rvalue. */ + ldw -48(%r3), %r21 ; r21 <- flags + ldw -52(%r3), %r20 ; r20 <- rvalue + + /* Store the result according to the return type. The most + likely types should come first. */ + +L$checkint + comib,<>,n FFI_TYPE_INT, %r21, L$checkint8 + b L$done + stw %ret0, 0(%r20) + +L$checkint8 + comib,<>,n FFI_TYPE_UINT8, %r21, L$checkint16 + b L$done + stb %ret0, 0(%r20) + +L$checkint16 + comib,<>,n FFI_TYPE_UINT16, %r21, L$checkdbl + b L$done + sth %ret0, 0(%r20) + +L$checkdbl + comib,<>,n FFI_TYPE_DOUBLE, %r21, L$checkfloat + b L$done + fstd %fr4,0(%r20) + +L$checkfloat + comib,<>,n FFI_TYPE_FLOAT, %r21, L$checkll + b L$done + fstw %fr4L,0(%r20) + +L$checkll + comib,<>,n FFI_TYPE_UINT64, %r21, L$checksmst2 + stw %ret0, 0(%r20) + b L$done + stw %ret1, 4(%r20) + +L$checksmst2 + comib,<>,n FFI_TYPE_SMALL_STRUCT2, %r21, L$checksmst3 + /* 2-byte structs are returned in ret0 as ????xxyy. */ + extru %ret0, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + b L$done + stb %ret0, 0(%r20) + +L$checksmst3 + comib,<>,n FFI_TYPE_SMALL_STRUCT3, %r21, L$checksmst4 + /* 3-byte structs are returned in ret0 as ??xxyyzz. */ + extru %ret0, 15, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret0, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + b L$done + stb %ret0, 0(%r20) + +L$checksmst4 + comib,<>,n FFI_TYPE_SMALL_STRUCT4, %r21, L$checksmst5 + /* 4-byte structs are returned in ret0 as wwxxyyzz. */ + extru %ret0, 7, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret0, 15, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret0, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + b L$done + stb %ret0, 0(%r20) + +L$checksmst5 + comib,<>,n FFI_TYPE_SMALL_STRUCT5, %r21, L$checksmst6 + /* 5 byte values are returned right justified: + ret0 ret1 + 5: ??????aa bbccddee */ + stbs,ma %ret0, 1(%r20) + extru %ret1, 7, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret1, 15, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret1, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + b L$done + stb %ret1, 0(%r20) + +L$checksmst6 + comib,<>,n FFI_TYPE_SMALL_STRUCT6, %r21, L$checksmst7 + /* 6 byte values are returned right justified: + ret0 ret1 + 6: ????aabb ccddeeff */ + extru %ret0, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + stbs,ma %ret0, 1(%r20) + extru %ret1, 7, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret1, 15, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret1, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + b L$done + stb %ret1, 0(%r20) + +L$checksmst7 + comib,<>,n FFI_TYPE_SMALL_STRUCT7, %r21, L$checksmst8 + /* 7 byte values are returned right justified: + ret0 ret1 + 7: ??aabbcc ddeeffgg */ + extru %ret0, 15, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret0, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + stbs,ma %ret0, 1(%r20) + extru %ret1, 7, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret1, 15, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret1, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + b L$done + stb %ret1, 0(%r20) + +L$checksmst8 + comib,<>,n FFI_TYPE_SMALL_STRUCT8, %r21, L$done + /* 8 byte values are returned right justified: + ret0 ret1 + 8: aabbccdd eeffgghh */ + extru %ret0, 7, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret0, 15, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret0, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + stbs,ma %ret0, 1(%r20) + extru %ret1, 7, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret1, 15, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret1, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + stb %ret1, 0(%r20) + +L$done + /* all done, return */ + copy %r4, %sp ; pop arg stack + ldw 12(%r3), %r4 + ldwm -64(%sp), %r3 ; .. and pop stack + ldw -20(%sp), %rp + bv %r0(%rp) + nop + .exit + .procend +L$FE1 + + /* void ffi_closure_pa32(void); + Called with closure argument in %r21 */ + + .SPACE $TEXT$ + .SUBSPA $CODE$ + .export ffi_closure_pa32,ENTRY,PRIV_LEV=3,RTNVAL=GR + .import ffi_closure_inner_pa32,CODE + .align 4 +L$FB2 +ffi_closure_pa32 + .proc + .callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=3 + .entry + + stw %rp, -20(%sp) + copy %r3, %r1 +L$CFI21 + copy %sp, %r3 +L$CFI22 + stwm %r1, 64(%sp) + + /* Put arguments onto the stack and call ffi_closure_inner. */ + stw %arg0, -36(%r3) + stw %arg1, -40(%r3) + stw %arg2, -44(%r3) + stw %arg3, -48(%r3) + + copy %r21, %arg0 + bl ffi_closure_inner_pa32, %r2 + copy %r3, %arg1 + ldwm -64(%sp), %r3 + ldw -20(%sp), %rp + ldw -36(%sp), %ret0 + bv %r0(%rp) + ldw -40(%sp), %ret1 + .exit + .procend +L$FE2: + + .SPACE $PRIVATE$ + .SUBSPA $DATA$ + + .align 4 + .EXPORT _GLOBAL__F_ffi_call_pa32,DATA +_GLOBAL__F_ffi_call_pa32 +L$frame1: + .word L$ECIE1-L$SCIE1 ;# Length of Common Information Entry +L$SCIE1: + .word 0x0 ;# CIE Identifier Tag + .byte 0x1 ;# CIE Version + .ascii "\0" ;# CIE Augmentation + .uleb128 0x1 ;# CIE Code Alignment Factor + .sleb128 4 ;# CIE Data Alignment Factor + .byte 0x2 ;# CIE RA Column + .byte 0xc ;# DW_CFA_def_cfa + .uleb128 0x1e + .uleb128 0x0 + .align 4 +L$ECIE1: +L$SFDE1: + .word L$EFDE1-L$ASFDE1 ;# FDE Length +L$ASFDE1: + .word L$ASFDE1-L$frame1 ;# FDE CIE offset + .word L$FB1 ;# FDE initial location + .word L$FE1-L$FB1 ;# FDE address range + + .byte 0x4 ;# DW_CFA_advance_loc4 + .word L$CFI11-L$FB1 + .byte 0x83 ;# DW_CFA_offset, column 0x3 + .uleb128 0x0 + .byte 0x11 ;# DW_CFA_offset_extended_sf; save r2 at [r30-20] + .uleb128 0x2 + .sleb128 -5 + + .byte 0x4 ;# DW_CFA_advance_loc4 + .word L$CFI12-L$CFI11 + .byte 0xd ;# DW_CFA_def_cfa_register = r3 + .uleb128 0x3 + + .byte 0x4 ;# DW_CFA_advance_loc4 + .word L$CFI13-L$CFI12 + .byte 0x84 ;# DW_CFA_offset, column 0x4 + .uleb128 0x3 + + .align 4 +L$EFDE1: + +L$SFDE2: + .word L$EFDE2-L$ASFDE2 ;# FDE Length +L$ASFDE2: + .word L$ASFDE2-L$frame1 ;# FDE CIE offset + .word L$FB2 ;# FDE initial location + .word L$FE2-L$FB2 ;# FDE address range + .byte 0x4 ;# DW_CFA_advance_loc4 + .word L$CFI21-L$FB2 + .byte 0x83 ;# DW_CFA_offset, column 0x3 + .uleb128 0x0 + .byte 0x11 ;# DW_CFA_offset_extended_sf + .uleb128 0x2 + .sleb128 -5 + + .byte 0x4 ;# DW_CFA_advance_loc4 + .word L$CFI22-L$CFI21 + .byte 0xd ;# DW_CFA_def_cfa_register = r3 + .uleb128 0x3 + + .align 4 +L$EFDE2: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/pa/linux.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/pa/linux.S new file mode 100644 index 000000000..f11ae7680 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/pa/linux.S @@ -0,0 +1,357 @@ +/* ----------------------------------------------------------------------- + linux.S - (c) 2003-2004 Randolph Chung + (c) 2008 Red Hat, Inc. + + HPPA Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL RENESAS TECHNOLOGY BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + + .text + .level 1.1 + .align 4 + + /* void ffi_call_pa32(void (*)(char *, extended_cif *), + extended_cif *ecif, + unsigned bytes, + unsigned flags, + unsigned *rvalue, + void (*fn)(void)); + */ + + .export ffi_call_pa32,code + .import ffi_prep_args_pa32,code + + .type ffi_call_pa32, @function +.LFB1: +ffi_call_pa32: + .proc + .callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=4 + .entry + stw %rp, -20(%sp) + copy %r3, %r1 +.LCFI11: + + copy %sp, %r3 +.LCFI12: + + /* Setup the stack for calling prep_args... + We want the stack to look like this: + + [ Previous stack ] <- %r3 + + [ 64-bytes register save area ] <- %r4 + + [ Stack space for actual call, passed as ] <- %arg0 + [ arg0 to ffi_prep_args_pa32 ] + + [ Stack for calling prep_args ] <- %sp + */ + + stwm %r1, 64(%sp) + stw %r4, 12(%r3) +.LCFI13: + copy %sp, %r4 + + addl %arg2, %r4, %arg0 /* arg stack */ + stw %arg3, -48(%r3) /* save flags; we need it later */ + + /* Call prep_args: + %arg0(stack) -- set up above + %arg1(ecif) -- same as incoming param + %arg2(bytes) -- same as incoming param */ + bl ffi_prep_args_pa32,%r2 + ldo 64(%arg0), %sp + ldo -64(%sp), %sp + + /* now %sp should point where %arg0 was pointing. */ + + /* Load the arguments that should be passed in registers + The fp args were loaded by the prep_args function. */ + ldw -36(%sp), %arg0 + ldw -40(%sp), %arg1 + ldw -44(%sp), %arg2 + ldw -48(%sp), %arg3 + + /* in case the function is going to return a structure + we need to give it a place to put the result. */ + ldw -52(%r3), %ret0 /* %ret0 <- rvalue */ + ldw -56(%r3), %r22 /* %r22 <- function to call */ + bl $$dyncall, %r31 /* Call the user function */ + copy %r31, %rp + + /* Prepare to store the result; we need to recover flags and rvalue. */ + ldw -48(%r3), %r21 /* r21 <- flags */ + ldw -52(%r3), %r20 /* r20 <- rvalue */ + + /* Store the result according to the return type. */ + +.Lcheckint: + comib,<>,n FFI_TYPE_INT, %r21, .Lcheckint8 + b .Ldone + stw %ret0, 0(%r20) + +.Lcheckint8: + comib,<>,n FFI_TYPE_UINT8, %r21, .Lcheckint16 + b .Ldone + stb %ret0, 0(%r20) + +.Lcheckint16: + comib,<>,n FFI_TYPE_UINT16, %r21, .Lcheckdbl + b .Ldone + sth %ret0, 0(%r20) + +.Lcheckdbl: + comib,<>,n FFI_TYPE_DOUBLE, %r21, .Lcheckfloat + b .Ldone + fstd %fr4,0(%r20) + +.Lcheckfloat: + comib,<>,n FFI_TYPE_FLOAT, %r21, .Lcheckll + b .Ldone + fstw %fr4L,0(%r20) + +.Lcheckll: + comib,<>,n FFI_TYPE_UINT64, %r21, .Lchecksmst2 + stw %ret0, 0(%r20) + b .Ldone + stw %ret1, 4(%r20) + +.Lchecksmst2: + comib,<>,n FFI_TYPE_SMALL_STRUCT2, %r21, .Lchecksmst3 + /* 2-byte structs are returned in ret0 as ????xxyy. */ + extru %ret0, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + b .Ldone + stb %ret0, 0(%r20) + +.Lchecksmst3: + comib,<>,n FFI_TYPE_SMALL_STRUCT3, %r21, .Lchecksmst4 + /* 3-byte structs are returned in ret0 as ??xxyyzz. */ + extru %ret0, 15, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret0, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + b .Ldone + stb %ret0, 0(%r20) + +.Lchecksmst4: + comib,<>,n FFI_TYPE_SMALL_STRUCT4, %r21, .Lchecksmst5 + /* 4-byte structs are returned in ret0 as wwxxyyzz. */ + extru %ret0, 7, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret0, 15, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret0, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + b .Ldone + stb %ret0, 0(%r20) + +.Lchecksmst5: + comib,<>,n FFI_TYPE_SMALL_STRUCT5, %r21, .Lchecksmst6 + /* 5 byte values are returned right justified: + ret0 ret1 + 5: ??????aa bbccddee */ + stbs,ma %ret0, 1(%r20) + extru %ret1, 7, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret1, 15, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret1, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + b .Ldone + stb %ret1, 0(%r20) + +.Lchecksmst6: + comib,<>,n FFI_TYPE_SMALL_STRUCT6, %r21, .Lchecksmst7 + /* 6 byte values are returned right justified: + ret0 ret1 + 6: ????aabb ccddeeff */ + extru %ret0, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + stbs,ma %ret0, 1(%r20) + extru %ret1, 7, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret1, 15, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret1, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + b .Ldone + stb %ret1, 0(%r20) + +.Lchecksmst7: + comib,<>,n FFI_TYPE_SMALL_STRUCT7, %r21, .Lchecksmst8 + /* 7 byte values are returned right justified: + ret0 ret1 + 7: ??aabbcc ddeeffgg */ + extru %ret0, 15, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret0, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + stbs,ma %ret0, 1(%r20) + extru %ret1, 7, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret1, 15, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret1, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + b .Ldone + stb %ret1, 0(%r20) + +.Lchecksmst8: + comib,<>,n FFI_TYPE_SMALL_STRUCT8, %r21, .Ldone + /* 8 byte values are returned right justified: + ret0 ret1 + 8: aabbccdd eeffgghh */ + extru %ret0, 7, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret0, 15, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret0, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + stbs,ma %ret0, 1(%r20) + extru %ret1, 7, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret1, 15, 8, %r22 + stbs,ma %r22, 1(%r20) + extru %ret1, 23, 8, %r22 + stbs,ma %r22, 1(%r20) + stb %ret1, 0(%r20) + +.Ldone: + /* all done, return */ + copy %r4, %sp /* pop arg stack */ + ldw 12(%r3), %r4 + ldwm -64(%sp), %r3 /* .. and pop stack */ + ldw -20(%sp), %rp + bv %r0(%rp) + nop + .exit + .procend +.LFE1: + + /* void ffi_closure_pa32(void); + Called with closure argument in %r21 */ + .export ffi_closure_pa32,code + .import ffi_closure_inner_pa32,code + + .type ffi_closure_pa32, @function +.LFB2: +ffi_closure_pa32: + .proc + .callinfo FRAME=64,CALLS,SAVE_RP,SAVE_SP,ENTRY_GR=3 + .entry + + stw %rp, -20(%sp) +.LCFI20: + copy %r3, %r1 +.LCFI21: + copy %sp, %r3 +.LCFI22: + stwm %r1, 64(%sp) + + /* Put arguments onto the stack and call ffi_closure_inner. */ + stw %arg0, -36(%r3) + stw %arg1, -40(%r3) + stw %arg2, -44(%r3) + stw %arg3, -48(%r3) + + copy %r21, %arg0 + bl ffi_closure_inner_pa32, %r2 + copy %r3, %arg1 + + ldwm -64(%sp), %r3 + ldw -20(%sp), %rp + ldw -36(%sp), %ret0 + bv %r0(%r2) + ldw -40(%sp), %ret1 + + .exit + .procend +.LFE2: + + .section ".eh_frame",EH_FRAME_FLAGS,@progbits +.Lframe1: + .word .LECIE1-.LSCIE1 ;# Length of Common Information Entry +.LSCIE1: + .word 0x0 ;# CIE Identifier Tag + .byte 0x1 ;# CIE Version + .ascii "\0" ;# CIE Augmentation + .uleb128 0x1 ;# CIE Code Alignment Factor + .sleb128 4 ;# CIE Data Alignment Factor + .byte 0x2 ;# CIE RA Column + .byte 0xc ;# DW_CFA_def_cfa + .uleb128 0x1e + .uleb128 0x0 + .align 4 +.LECIE1: +.LSFDE1: + .word .LEFDE1-.LASFDE1 ;# FDE Length +.LASFDE1: + .word .LASFDE1-.Lframe1 ;# FDE CIE offset + .word .LFB1 ;# FDE initial location + .word .LFE1-.LFB1 ;# FDE address range + + .byte 0x4 ;# DW_CFA_advance_loc4 + .word .LCFI11-.LFB1 + .byte 0x83 ;# DW_CFA_offset, column 0x3 + .uleb128 0x0 + .byte 0x11 ;# DW_CFA_offset_extended_sf; save r2 at [r30-20] + .uleb128 0x2 + .sleb128 -5 + + .byte 0x4 ;# DW_CFA_advance_loc4 + .word .LCFI12-.LCFI11 + .byte 0xd ;# DW_CFA_def_cfa_register = r3 + .uleb128 0x3 + + .byte 0x4 ;# DW_CFA_advance_loc4 + .word .LCFI13-.LCFI12 + .byte 0x84 ;# DW_CFA_offset, column 0x4 + .uleb128 0x3 + + .align 4 +.LEFDE1: + +.LSFDE2: + .word .LEFDE2-.LASFDE2 ;# FDE Length +.LASFDE2: + .word .LASFDE2-.Lframe1 ;# FDE CIE offset + .word .LFB2 ;# FDE initial location + .word .LFE2-.LFB2 ;# FDE address range + .byte 0x4 ;# DW_CFA_advance_loc4 + .word .LCFI21-.LFB2 + .byte 0x83 ;# DW_CFA_offset, column 0x3 + .uleb128 0x0 + .byte 0x11 ;# DW_CFA_offset_extended_sf + .uleb128 0x2 + .sleb128 -5 + + .byte 0x4 ;# DW_CFA_advance_loc4 + .word .LCFI22-.LCFI21 + .byte 0xd ;# DW_CFA_def_cfa_register = r3 + .uleb128 0x3 + + .align 4 +.LEFDE2: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/aix.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/aix.S new file mode 100644 index 000000000..213f2db39 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/aix.S @@ -0,0 +1,328 @@ +/* ----------------------------------------------------------------------- + aix.S - Copyright (c) 2002, 2009 Free Software Foundation, Inc. + based on darwin.S by John Hornkvist + + PowerPC Assembly glue. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + + .set r0,0 + .set r1,1 + .set r2,2 + .set r3,3 + .set r4,4 + .set r5,5 + .set r6,6 + .set r7,7 + .set r8,8 + .set r9,9 + .set r10,10 + .set r11,11 + .set r12,12 + .set r13,13 + .set r14,14 + .set r15,15 + .set r16,16 + .set r17,17 + .set r18,18 + .set r19,19 + .set r20,20 + .set r21,21 + .set r22,22 + .set r23,23 + .set r24,24 + .set r25,25 + .set r26,26 + .set r27,27 + .set r28,28 + .set r29,29 + .set r30,30 + .set r31,31 + .set f0,0 + .set f1,1 + .set f2,2 + .set f3,3 + .set f4,4 + .set f5,5 + .set f6,6 + .set f7,7 + .set f8,8 + .set f9,9 + .set f10,10 + .set f11,11 + .set f12,12 + .set f13,13 + .set f14,14 + .set f15,15 + .set f16,16 + .set f17,17 + .set f18,18 + .set f19,19 + .set f20,20 + .set f21,21 + + .extern .ffi_prep_args + +#define LIBFFI_ASM +#include +#include +#define JUMPTARGET(name) name +#define L(x) x + .file "aix.S" + .toc + + /* void ffi_call_AIX(extended_cif *ecif, unsigned long bytes, + * unsigned int flags, unsigned int *rvalue, + * void (*fn)(), + * void (*prep_args)(extended_cif*, unsigned *const)); + * r3=ecif, r4=bytes, r5=flags, r6=rvalue, r7=fn, r8=prep_args + */ + +.csect .text[PR] + .align 2 + .globl ffi_call_AIX + .globl .ffi_call_AIX +.csect ffi_call_AIX[DS] +ffi_call_AIX: +#ifdef __64BIT__ + .llong .ffi_call_AIX, TOC[tc0], 0 + .csect .text[PR] +.ffi_call_AIX: + /* Save registers we use. */ + mflr r0 + + std r28,-32(r1) + std r29,-24(r1) + std r30,-16(r1) + std r31, -8(r1) + + std r0, 16(r1) + mr r28, r1 /* our AP. */ + stdux r1, r1, r4 + + /* Save arguments over call... */ + mr r31, r5 /* flags, */ + mr r30, r6 /* rvalue, */ + mr r29, r7 /* function address. */ + std r2, 40(r1) + + /* Call ffi_prep_args. */ + mr r4, r1 + bl .ffi_prep_args + nop + + /* Now do the call. */ + ld r0, 0(r29) + ld r2, 8(r29) + ld r11, 16(r29) + /* Set up cr1 with bits 4-7 of the flags. */ + mtcrf 0x40, r31 + mtctr r0 + /* Load all those argument registers. */ + // We have set up a nice stack frame, just load it into registers. + ld r3, 40+(1*8)(r1) + ld r4, 40+(2*8)(r1) + ld r5, 40+(3*8)(r1) + ld r6, 40+(4*8)(r1) + nop + ld r7, 40+(5*8)(r1) + ld r8, 40+(6*8)(r1) + ld r9, 40+(7*8)(r1) + ld r10,40+(8*8)(r1) + +L1: + /* Load all the FP registers. */ + bf 6,L2 // 2f + 0x18 + lfd f1,-32-(13*8)(r28) + lfd f2,-32-(12*8)(r28) + lfd f3,-32-(11*8)(r28) + lfd f4,-32-(10*8)(r28) + nop + lfd f5,-32-(9*8)(r28) + lfd f6,-32-(8*8)(r28) + lfd f7,-32-(7*8)(r28) + lfd f8,-32-(6*8)(r28) + nop + lfd f9,-32-(5*8)(r28) + lfd f10,-32-(4*8)(r28) + lfd f11,-32-(3*8)(r28) + lfd f12,-32-(2*8)(r28) + nop + lfd f13,-32-(1*8)(r28) + +L2: + /* Make the call. */ + bctrl + ld r2, 40(r1) + + /* Now, deal with the return value. */ + mtcrf 0x01, r31 + + bt 30, L(done_return_value) + bt 29, L(fp_return_value) + std r3, 0(r30) + + /* Fall through... */ + +L(done_return_value): + /* Restore the registers we used and return. */ + mr r1, r28 + ld r0, 16(r28) + ld r28, -32(r1) + mtlr r0 + ld r29, -24(r1) + ld r30, -16(r1) + ld r31, -8(r1) + blr + +L(fp_return_value): + bf 28, L(float_return_value) + stfd f1, 0(r30) + bf 31, L(done_return_value) + stfd f2, 8(r30) + b L(done_return_value) +L(float_return_value): + stfs f1, 0(r30) + b L(done_return_value) + +#else /* ! __64BIT__ */ + + .long .ffi_call_AIX, TOC[tc0], 0 + .csect .text[PR] +.ffi_call_AIX: + /* Save registers we use. */ + mflr r0 + + stw r28,-16(r1) + stw r29,-12(r1) + stw r30, -8(r1) + stw r31, -4(r1) + + stw r0, 8(r1) + mr r28, r1 /* out AP. */ + stwux r1, r1, r4 + + /* Save arguments over call... */ + mr r31, r5 /* flags, */ + mr r30, r6 /* rvalue, */ + mr r29, r7 /* function address, */ + stw r2, 20(r1) + + /* Call ffi_prep_args. */ + mr r4, r1 + bl .ffi_prep_args + nop + + /* Now do the call. */ + lwz r0, 0(r29) + lwz r2, 4(r29) + lwz r11, 8(r29) + /* Set up cr1 with bits 4-7 of the flags. */ + mtcrf 0x40, r31 + mtctr r0 + /* Load all those argument registers. */ + // We have set up a nice stack frame, just load it into registers. + lwz r3, 20+(1*4)(r1) + lwz r4, 20+(2*4)(r1) + lwz r5, 20+(3*4)(r1) + lwz r6, 20+(4*4)(r1) + nop + lwz r7, 20+(5*4)(r1) + lwz r8, 20+(6*4)(r1) + lwz r9, 20+(7*4)(r1) + lwz r10,20+(8*4)(r1) + +L1: + /* Load all the FP registers. */ + bf 6,L2 // 2f + 0x18 + lfd f1,-16-(13*8)(r28) + lfd f2,-16-(12*8)(r28) + lfd f3,-16-(11*8)(r28) + lfd f4,-16-(10*8)(r28) + nop + lfd f5,-16-(9*8)(r28) + lfd f6,-16-(8*8)(r28) + lfd f7,-16-(7*8)(r28) + lfd f8,-16-(6*8)(r28) + nop + lfd f9,-16-(5*8)(r28) + lfd f10,-16-(4*8)(r28) + lfd f11,-16-(3*8)(r28) + lfd f12,-16-(2*8)(r28) + nop + lfd f13,-16-(1*8)(r28) + +L2: + /* Make the call. */ + bctrl + lwz r2, 20(r1) + + /* Now, deal with the return value. */ + mtcrf 0x01, r31 + + bt 30, L(done_return_value) + bt 29, L(fp_return_value) + stw r3, 0(r30) + bf 28, L(done_return_value) + stw r4, 4(r30) + + /* Fall through... */ + +L(done_return_value): + /* Restore the registers we used and return. */ + mr r1, r28 + lwz r0, 8(r28) + lwz r28,-16(r1) + mtlr r0 + lwz r29,-12(r1) + lwz r30, -8(r1) + lwz r31, -4(r1) + blr + +L(fp_return_value): + bf 28, L(float_return_value) + stfd f1, 0(r30) + b L(done_return_value) +L(float_return_value): + stfs f1, 0(r30) + b L(done_return_value) +#endif + .long 0 + .byte 0,0,0,1,128,4,0,0 +//END(ffi_call_AIX) + +.csect .text[PR] + .align 2 + .globl ffi_call_DARWIN + .globl .ffi_call_DARWIN +.csect ffi_call_DARWIN[DS] +ffi_call_DARWIN: +#ifdef __64BIT__ + .llong .ffi_call_DARWIN, TOC[tc0], 0 +#else + .long .ffi_call_DARWIN, TOC[tc0], 0 +#endif + .csect .text[PR] +.ffi_call_DARWIN: + blr + .long 0 + .byte 0,0,0,0,0,0,0,0 +//END(ffi_call_DARWIN) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/aix_closure.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/aix_closure.S new file mode 100644 index 000000000..c906017c4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/aix_closure.S @@ -0,0 +1,445 @@ +/* ----------------------------------------------------------------------- + aix_closure.S - Copyright (c) 2002, 2003, 2009 Free Software Foundation, Inc. + based on darwin_closure.S + + PowerPC Assembly glue. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + + .set r0,0 + .set r1,1 + .set r2,2 + .set r3,3 + .set r4,4 + .set r5,5 + .set r6,6 + .set r7,7 + .set r8,8 + .set r9,9 + .set r10,10 + .set r11,11 + .set r12,12 + .set r13,13 + .set r14,14 + .set r15,15 + .set r16,16 + .set r17,17 + .set r18,18 + .set r19,19 + .set r20,20 + .set r21,21 + .set r22,22 + .set r23,23 + .set r24,24 + .set r25,25 + .set r26,26 + .set r27,27 + .set r28,28 + .set r29,29 + .set r30,30 + .set r31,31 + .set f0,0 + .set f1,1 + .set f2,2 + .set f3,3 + .set f4,4 + .set f5,5 + .set f6,6 + .set f7,7 + .set f8,8 + .set f9,9 + .set f10,10 + .set f11,11 + .set f12,12 + .set f13,13 + .set f14,14 + .set f15,15 + .set f16,16 + .set f17,17 + .set f18,18 + .set f19,19 + .set f20,20 + .set f21,21 + + .extern .ffi_closure_helper_DARWIN + +#define LIBFFI_ASM +#define JUMPTARGET(name) name +#define L(x) x + .file "aix_closure.S" + .toc +LC..60: + .tc L..60[TC],L..60 + .csect .text[PR] + .align 2 + +.csect .text[PR] + .align 2 + .globl ffi_closure_ASM + .globl .ffi_closure_ASM +.csect ffi_closure_ASM[DS] +ffi_closure_ASM: +#ifdef __64BIT__ + .llong .ffi_closure_ASM, TOC[tc0], 0 + .csect .text[PR] +.ffi_closure_ASM: +/* we want to build up an area for the parameters passed */ +/* in registers (both floating point and integer) */ + + /* we store gpr 3 to gpr 10 (aligned to 4) + in the parents outgoing area */ + std r3, 48+(0*8)(r1) + std r4, 48+(1*8)(r1) + std r5, 48+(2*8)(r1) + std r6, 48+(3*8)(r1) + mflr r0 + + std r7, 48+(4*8)(r1) + std r8, 48+(5*8)(r1) + std r9, 48+(6*8)(r1) + std r10, 48+(7*8)(r1) + std r0, 16(r1) /* save the return address */ + + + /* 48 Bytes (Linkage Area) */ + /* 64 Bytes (params) */ + /* 16 Bytes (result) */ + /* 104 Bytes (13*8 from FPR) */ + /* 8 Bytes (alignment) */ + /* 240 Bytes */ + + stdu r1, -240(r1) /* skip over caller save area + keep stack aligned to 16 */ + + /* next save fpr 1 to fpr 13 (aligned to 8) */ + stfd f1, 128+(0*8)(r1) + stfd f2, 128+(1*8)(r1) + stfd f3, 128+(2*8)(r1) + stfd f4, 128+(3*8)(r1) + stfd f5, 128+(4*8)(r1) + stfd f6, 128+(5*8)(r1) + stfd f7, 128+(6*8)(r1) + stfd f8, 128+(7*8)(r1) + stfd f9, 128+(8*8)(r1) + stfd f10, 128+(9*8)(r1) + stfd f11, 128+(10*8)(r1) + stfd f12, 128+(11*8)(r1) + stfd f13, 128+(12*8)(r1) + + /* set up registers for the routine that actually does the work */ + /* get the context pointer from the trampoline */ + mr r3, r11 + + /* now load up the pointer to the result storage */ + addi r4, r1, 112 + + /* now load up the pointer to the saved gpr registers */ + addi r5, r1, 288 + + /* now load up the pointer to the saved fpr registers */ + addi r6, r1, 128 + + /* make the call */ + bl .ffi_closure_helper_DARWIN + nop + + /* now r3 contains the return type */ + /* so use it to look up in a table */ + /* so we know how to deal with each type */ + + /* look up the proper starting point in table */ + /* by using return type as offset */ + ld r4, LC..60(2) /* get address of jump table */ + sldi r3, r3, 4 /* now multiply return type by 16 */ + ld r0, 240+16(r1) /* load return address */ + add r3, r3, r4 /* add contents of table to table address */ + mtctr r3 + bctr /* jump to it */ + +/* Each fragment must be exactly 16 bytes long (4 instructions). + Align to 16 byte boundary for cache and dispatch efficiency. */ + .align 4 + +L..60: +/* case FFI_TYPE_VOID */ + mtlr r0 + addi r1, r1, 240 + blr + nop + +/* case FFI_TYPE_INT */ + lwa r3, 112+4(r1) + mtlr r0 + addi r1, r1, 240 + blr + +/* case FFI_TYPE_FLOAT */ + lfs f1, 112+0(r1) + mtlr r0 + addi r1, r1, 240 + blr + +/* case FFI_TYPE_DOUBLE */ + lfd f1, 112+0(r1) + mtlr r0 + addi r1, r1, 240 + blr + +/* case FFI_TYPE_LONGDOUBLE */ + lfd f1, 112+0(r1) + mtlr r0 + lfd f2, 112+8(r1) + b L..finish + +/* case FFI_TYPE_UINT8 */ + lbz r3, 112+7(r1) + mtlr r0 + addi r1, r1, 240 + blr + +/* case FFI_TYPE_SINT8 */ + lbz r3, 112+7(r1) + mtlr r0 + extsb r3, r3 + b L..finish + +/* case FFI_TYPE_UINT16 */ + lhz r3, 112+6(r1) + mtlr r0 +L..finish: + addi r1, r1, 240 + blr + +/* case FFI_TYPE_SINT16 */ + lha r3, 112+6(r1) + mtlr r0 + addi r1, r1, 240 + blr + +/* case FFI_TYPE_UINT32 */ + lwz r3, 112+4(r1) + mtlr r0 + addi r1, r1, 240 + blr + +/* case FFI_TYPE_SINT32 */ + lwa r3, 112+4(r1) + mtlr r0 + addi r1, r1, 240 + blr + +/* case FFI_TYPE_UINT64 */ + ld r3, 112+0(r1) + mtlr r0 + addi r1, r1, 240 + blr + +/* case FFI_TYPE_SINT64 */ + ld r3, 112+0(r1) + mtlr r0 + addi r1, r1, 240 + blr + +/* case FFI_TYPE_STRUCT */ + mtlr r0 + addi r1, r1, 240 + blr + nop + +/* case FFI_TYPE_POINTER */ + ld r3, 112+0(r1) + mtlr r0 + addi r1, r1, 240 + blr + +#else /* ! __64BIT__ */ + + .long .ffi_closure_ASM, TOC[tc0], 0 + .csect .text[PR] +.ffi_closure_ASM: +/* we want to build up an area for the parameters passed */ +/* in registers (both floating point and integer) */ + + /* we store gpr 3 to gpr 10 (aligned to 4) + in the parents outgoing area */ + stw r3, 24+(0*4)(r1) + stw r4, 24+(1*4)(r1) + stw r5, 24+(2*4)(r1) + stw r6, 24+(3*4)(r1) + mflr r0 + + stw r7, 24+(4*4)(r1) + stw r8, 24+(5*4)(r1) + stw r9, 24+(6*4)(r1) + stw r10, 24+(7*4)(r1) + stw r0, 8(r1) + + /* 24 Bytes (Linkage Area) */ + /* 32 Bytes (params) */ + /* 16 Bytes (result) */ + /* 104 Bytes (13*8 from FPR) */ + /* 176 Bytes */ + + stwu r1, -176(r1) /* skip over caller save area + keep stack aligned to 16 */ + + /* next save fpr 1 to fpr 13 (aligned to 8) */ + stfd f1, 72+(0*8)(r1) + stfd f2, 72+(1*8)(r1) + stfd f3, 72+(2*8)(r1) + stfd f4, 72+(3*8)(r1) + stfd f5, 72+(4*8)(r1) + stfd f6, 72+(5*8)(r1) + stfd f7, 72+(6*8)(r1) + stfd f8, 72+(7*8)(r1) + stfd f9, 72+(8*8)(r1) + stfd f10, 72+(9*8)(r1) + stfd f11, 72+(10*8)(r1) + stfd f12, 72+(11*8)(r1) + stfd f13, 72+(12*8)(r1) + + /* set up registers for the routine that actually does the work */ + /* get the context pointer from the trampoline */ + mr r3, r11 + + /* now load up the pointer to the result storage */ + addi r4, r1, 56 + + /* now load up the pointer to the saved gpr registers */ + addi r5, r1, 200 + + /* now load up the pointer to the saved fpr registers */ + addi r6, r1, 72 + + /* make the call */ + bl .ffi_closure_helper_DARWIN + nop + + /* now r3 contains the return type */ + /* so use it to look up in a table */ + /* so we know how to deal with each type */ + + /* look up the proper starting point in table */ + /* by using return type as offset */ + lwz r4, LC..60(2) /* get address of jump table */ + slwi r3, r3, 4 /* now multiply return type by 4 */ + lwz r0, 176+8(r1) /* load return address */ + add r3, r3, r4 /* add contents of table to table address */ + mtctr r3 + bctr /* jump to it */ + +/* Each fragment must be exactly 16 bytes long (4 instructions). + Align to 16 byte boundary for cache and dispatch efficiency. */ + .align 4 + +L..60: +/* case FFI_TYPE_VOID */ + mtlr r0 + addi r1, r1, 176 + blr + nop + +/* case FFI_TYPE_INT */ + lwz r3, 56+0(r1) + mtlr r0 + addi r1, r1, 176 + blr + +/* case FFI_TYPE_FLOAT */ + lfs f1, 56+0(r1) + mtlr r0 + addi r1, r1, 176 + blr + +/* case FFI_TYPE_DOUBLE */ + lfd f1, 56+0(r1) + mtlr r0 + addi r1, r1, 176 + blr + +/* case FFI_TYPE_LONGDOUBLE */ + lfd f1, 56+0(r1) + mtlr r0 + lfd f2, 56+8(r1) + b L..finish + +/* case FFI_TYPE_UINT8 */ + lbz r3, 56+3(r1) + mtlr r0 + addi r1, r1, 176 + blr + +/* case FFI_TYPE_SINT8 */ + lbz r3, 56+3(r1) + mtlr r0 + extsb r3, r3 + b L..finish + +/* case FFI_TYPE_UINT16 */ + lhz r3, 56+2(r1) + mtlr r0 + addi r1, r1, 176 + blr + +/* case FFI_TYPE_SINT16 */ + lha r3, 56+2(r1) + mtlr r0 + addi r1, r1, 176 + blr + +/* case FFI_TYPE_UINT32 */ + lwz r3, 56+0(r1) + mtlr r0 + addi r1, r1, 176 + blr + +/* case FFI_TYPE_SINT32 */ + lwz r3, 56+0(r1) + mtlr r0 + addi r1, r1, 176 + blr + +/* case FFI_TYPE_UINT64 */ + lwz r3, 56+0(r1) + mtlr r0 + lwz r4, 56+4(r1) + b L..finish + +/* case FFI_TYPE_SINT64 */ + lwz r3, 56+0(r1) + mtlr r0 + lwz r4, 56+4(r1) + b L..finish + +/* case FFI_TYPE_STRUCT */ + mtlr r0 + addi r1, r1, 176 + blr + nop + +/* case FFI_TYPE_POINTER */ + lwz r3, 56+0(r1) + mtlr r0 +L..finish: + addi r1, r1, 176 + blr +#endif +/* END(ffi_closure_ASM) */ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/asm.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/asm.h new file mode 100644 index 000000000..994f62d07 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/asm.h @@ -0,0 +1,125 @@ +/* ----------------------------------------------------------------------- + asm.h - Copyright (c) 1998 Geoffrey Keating + + PowerPC Assembly glue. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define ASM_GLOBAL_DIRECTIVE .globl + + +#define C_SYMBOL_NAME(name) name +/* Macro for a label. */ +#ifdef __STDC__ +#define C_LABEL(name) name##: +#else +#define C_LABEL(name) name/**/: +#endif + +/* This seems to always be the case on PPC. */ +#define ALIGNARG(log2) log2 +/* For ELF we need the `.type' directive to make shared libs work right. */ +#define ASM_TYPE_DIRECTIVE(name,typearg) .type name,typearg; +#define ASM_SIZE_DIRECTIVE(name) .size name,.-name + +/* If compiled for profiling, call `_mcount' at the start of each function. */ +#ifdef PROF +/* The mcount code relies on the return address being on the stack + to locate our caller and so it can restore it; so store one just + for its benefit. */ +#ifdef PIC +#define CALL_MCOUNT \ + .pushsection; \ + .section ".data"; \ + .align ALIGNARG(2); \ +0:.long 0; \ + .previous; \ + mflr %r0; \ + stw %r0,4(%r1); \ + bl _GLOBAL_OFFSET_TABLE_@local-4; \ + mflr %r11; \ + lwz %r0,0b@got(%r11); \ + bl JUMPTARGET(_mcount); +#else /* PIC */ +#define CALL_MCOUNT \ + .section ".data"; \ + .align ALIGNARG(2); \ +0:.long 0; \ + .previous; \ + mflr %r0; \ + lis %r11,0b@ha; \ + stw %r0,4(%r1); \ + addi %r0,%r11,0b@l; \ + bl JUMPTARGET(_mcount); +#endif /* PIC */ +#else /* PROF */ +#define CALL_MCOUNT /* Do nothing. */ +#endif /* PROF */ + +#define ENTRY(name) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \ + ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ + .align ALIGNARG(2); \ + C_LABEL(name) \ + CALL_MCOUNT + +#define EALIGN_W_0 /* No words to insert. */ +#define EALIGN_W_1 nop +#define EALIGN_W_2 nop;nop +#define EALIGN_W_3 nop;nop;nop +#define EALIGN_W_4 EALIGN_W_3;nop +#define EALIGN_W_5 EALIGN_W_4;nop +#define EALIGN_W_6 EALIGN_W_5;nop +#define EALIGN_W_7 EALIGN_W_6;nop + +/* EALIGN is like ENTRY, but does alignment to 'words'*4 bytes + past a 2^align boundary. */ +#ifdef PROF +#define EALIGN(name, alignt, words) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \ + ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ + .align ALIGNARG(2); \ + C_LABEL(name) \ + CALL_MCOUNT \ + b 0f; \ + .align ALIGNARG(alignt); \ + EALIGN_W_##words; \ + 0: +#else /* PROF */ +#define EALIGN(name, alignt, words) \ + ASM_GLOBAL_DIRECTIVE C_SYMBOL_NAME(name); \ + ASM_TYPE_DIRECTIVE (C_SYMBOL_NAME(name),@function) \ + .align ALIGNARG(alignt); \ + EALIGN_W_##words; \ + C_LABEL(name) +#endif + +#define END(name) \ + ASM_SIZE_DIRECTIVE(name) + +#ifdef PIC +#define JUMPTARGET(name) name##@plt +#else +#define JUMPTARGET(name) name +#endif + +/* Local labels stripped out by the linker. */ +#define L(x) .L##x diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/darwin.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/darwin.S new file mode 100644 index 000000000..4f987dc74 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/darwin.S @@ -0,0 +1,383 @@ +/* ----------------------------------------------------------------------- + darwin.S - Copyright (c) 2000 John Hornkvist + Copyright (c) 2004, 2010 Free Software Foundation, Inc. + + PowerPC Assembly glue. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#if defined(__ppc64__) +#define MODE_CHOICE(x, y) y +#else +#define MODE_CHOICE(x, y) x +#endif + +#define machine_choice MODE_CHOICE(ppc7400,ppc64) + +; Define some pseudo-opcodes for size-independent load & store of GPRs ... +#define lgu MODE_CHOICE(lwzu, ldu) +#define lg MODE_CHOICE(lwz,ld) +#define sg MODE_CHOICE(stw,std) +#define sgu MODE_CHOICE(stwu,stdu) +#define sgux MODE_CHOICE(stwux,stdux) + +; ... and the size of GPRs and their storage indicator. +#define GPR_BYTES MODE_CHOICE(4,8) +#define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ +#define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ + +; From the ABI doc: "Mac OS X ABI Function Call Guide" Version 2009-02-04. +#define LINKAGE_SIZE MODE_CHOICE(24,48) +#define PARAM_AREA MODE_CHOICE(32,64) +#define SAVED_LR_OFFSET MODE_CHOICE(8,16) /* save position for lr */ + +/* If there is any FP stuff we make space for all of the regs. */ +#define SAVED_FPR_COUNT 13 +#define FPR_SIZE 8 +#define RESULT_BYTES 16 + +/* This should be kept in step with the same value in ffi_darwin.c. */ +#define ASM_NEEDS_REGISTERS 4 +#define SAVE_REGS_SIZE (ASM_NEEDS_REGISTERS * GPR_BYTES) + +#include +#include + +#define JUMPTARGET(name) name +#define L(x) x + + .text + .align 2 + .globl _ffi_prep_args + + .align 2 + .globl _ffi_call_DARWIN + + /* We arrive here with: + r3 = ptr to extended cif. + r4 = -bytes. + r5 = cif flags. + r6 = ptr to return value. + r7 = fn pointer (user func). + r8 = fn pointer (ffi_prep_args). + r9 = ffi_type* for the ret val. */ + +_ffi_call_DARWIN: +Lstartcode: + mr r12,r8 /* We only need r12 until the call, + so it does not have to be saved. */ +LFB1: + /* Save the old stack pointer as AP. */ + mr r8,r1 +LCFI0: + + /* Save the retval type in parents frame. */ + sg r9,(LINKAGE_SIZE+6*GPR_BYTES)(r8) + + /* Allocate the stack space we need. */ + sgux r1,r1,r4 + + /* Save registers we use. */ + mflr r9 + sg r9,SAVED_LR_OFFSET(r8) + + sg r28,-(4 * GPR_BYTES)(r8) + sg r29,-(3 * GPR_BYTES)(r8) + sg r30,-(2 * GPR_BYTES)(r8) + sg r31,-( GPR_BYTES)(r8) + +#if !defined(POWERPC_DARWIN) + /* The TOC slot is reserved in the Darwin ABI and r2 is volatile. */ + sg r2,(5 * GPR_BYTES)(r1) +#endif + +LCFI1: + + /* Save arguments over call. */ + mr r31,r5 /* flags, */ + mr r30,r6 /* rvalue, */ + mr r29,r7 /* function address, */ + mr r28,r8 /* our AP. */ +LCFI2: + /* Call ffi_prep_args. r3 = extended cif, r4 = stack ptr copy. */ + mr r4,r1 + li r9,0 + + mtctr r12 /* r12 holds address of _ffi_prep_args. */ + bctrl + +#if !defined(POWERPC_DARWIN) + /* The TOC slot is reserved in the Darwin ABI and r2 is volatile. */ + lg r2,(5 * GPR_BYTES)(r1) +#endif + /* Now do the call. + Set up cr1 with bits 4-7 of the flags. */ + mtcrf 0x40,r31 + /* Get the address to call into CTR. */ + mtctr r29 + /* Load all those argument registers. + We have set up a nice stack frame, just load it into registers. */ + lg r3, (LINKAGE_SIZE )(r1) + lg r4, (LINKAGE_SIZE + GPR_BYTES)(r1) + lg r5, (LINKAGE_SIZE + 2 * GPR_BYTES)(r1) + lg r6, (LINKAGE_SIZE + 3 * GPR_BYTES)(r1) + nop + lg r7, (LINKAGE_SIZE + 4 * GPR_BYTES)(r1) + lg r8, (LINKAGE_SIZE + 5 * GPR_BYTES)(r1) + lg r9, (LINKAGE_SIZE + 6 * GPR_BYTES)(r1) + lg r10,(LINKAGE_SIZE + 7 * GPR_BYTES)(r1) + +L1: + /* ... Load all the FP registers. */ + bf 6,L2 /* No floats to load. */ + lfd f1, -SAVE_REGS_SIZE-(13*FPR_SIZE)(r28) + lfd f2, -SAVE_REGS_SIZE-(12*FPR_SIZE)(r28) + lfd f3, -SAVE_REGS_SIZE-(11*FPR_SIZE)(r28) + lfd f4, -SAVE_REGS_SIZE-(10*FPR_SIZE)(r28) + nop + lfd f5, -SAVE_REGS_SIZE-( 9*FPR_SIZE)(r28) + lfd f6, -SAVE_REGS_SIZE-( 8*FPR_SIZE)(r28) + lfd f7, -SAVE_REGS_SIZE-( 7*FPR_SIZE)(r28) + lfd f8, -SAVE_REGS_SIZE-( 6*FPR_SIZE)(r28) + nop + lfd f9, -SAVE_REGS_SIZE-( 5*FPR_SIZE)(r28) + lfd f10,-SAVE_REGS_SIZE-( 4*FPR_SIZE)(r28) + lfd f11,-SAVE_REGS_SIZE-( 3*FPR_SIZE)(r28) + lfd f12,-SAVE_REGS_SIZE-( 2*FPR_SIZE)(r28) + nop + lfd f13,-SAVE_REGS_SIZE-( 1*FPR_SIZE)(r28) + +L2: + mr r12,r29 /* Put the target address in r12 as specified. */ + mtctr r12 + nop + nop + + /* Make the call. */ + bctrl + + /* Now, deal with the return value. */ + + /* m64 structure returns can occupy the same set of registers as + would be used to pass such a structure as arg0 - so take care + not to step on any possibly hot regs. */ + + /* Get the flags.. */ + mtcrf 0x03,r31 ; we need c6 & cr7 now. + ; FLAG_RETURNS_NOTHING also covers struct ret-by-ref. + bt 30,L(done_return_value) ; FLAG_RETURNS_NOTHING + bf 27,L(scalar_return_value) ; not FLAG_RETURNS_STRUCT + + /* OK, so we have a struct. */ +#if defined(__ppc64__) + bt 31,L(maybe_return_128) ; FLAG_RETURNS_128BITS, special case + + /* OK, we have to map the return back to a mem struct. + We are about to trample the parents param area, so recover the + return type. r29 is free, since the call is done. */ + lg r29,(LINKAGE_SIZE + 6 * GPR_BYTES)(r28) + + sg r3, (LINKAGE_SIZE )(r28) + sg r4, (LINKAGE_SIZE + GPR_BYTES)(r28) + sg r5, (LINKAGE_SIZE + 2 * GPR_BYTES)(r28) + sg r6, (LINKAGE_SIZE + 3 * GPR_BYTES)(r28) + nop + sg r7, (LINKAGE_SIZE + 4 * GPR_BYTES)(r28) + sg r8, (LINKAGE_SIZE + 5 * GPR_BYTES)(r28) + sg r9, (LINKAGE_SIZE + 6 * GPR_BYTES)(r28) + sg r10,(LINKAGE_SIZE + 7 * GPR_BYTES)(r28) + /* OK, so do the block move - we trust that memcpy will not trample + the fprs... */ + mr r3,r30 ; dest + addi r4,r28,LINKAGE_SIZE ; source + /* The size is a size_t, should be long. */ + lg r5,0(r29) + /* Figure out small structs */ + cmpi 0,r5,4 + bgt L3 ; 1, 2 and 4 bytes have special rules. + cmpi 0,r5,3 + beq L3 ; not 3 + addi r4,r4,8 + subf r4,r5,r4 +L3: + bl _memcpy + + /* ... do we need the FP registers? - recover the flags.. */ + mtcrf 0x03,r31 ; we need c6 & cr7 now. + bf 29,L(done_return_value) /* No floats in the struct. */ + stfd f1, -SAVE_REGS_SIZE-(13*FPR_SIZE)(r28) + stfd f2, -SAVE_REGS_SIZE-(12*FPR_SIZE)(r28) + stfd f3, -SAVE_REGS_SIZE-(11*FPR_SIZE)(r28) + stfd f4, -SAVE_REGS_SIZE-(10*FPR_SIZE)(r28) + nop + stfd f5, -SAVE_REGS_SIZE-( 9*FPR_SIZE)(r28) + stfd f6, -SAVE_REGS_SIZE-( 8*FPR_SIZE)(r28) + stfd f7, -SAVE_REGS_SIZE-( 7*FPR_SIZE)(r28) + stfd f8, -SAVE_REGS_SIZE-( 6*FPR_SIZE)(r28) + nop + stfd f9, -SAVE_REGS_SIZE-( 5*FPR_SIZE)(r28) + stfd f10,-SAVE_REGS_SIZE-( 4*FPR_SIZE)(r28) + stfd f11,-SAVE_REGS_SIZE-( 3*FPR_SIZE)(r28) + stfd f12,-SAVE_REGS_SIZE-( 2*FPR_SIZE)(r28) + nop + stfd f13,-SAVE_REGS_SIZE-( 1*FPR_SIZE)(r28) + + mr r3,r29 ; ffi_type * + mr r4,r30 ; dest + addi r5,r28,-SAVE_REGS_SIZE-(13*FPR_SIZE) ; fprs + xor r6,r6,r6 + sg r6,(LINKAGE_SIZE + 7 * GPR_BYTES)(r28) + addi r6,r28,(LINKAGE_SIZE + 7 * GPR_BYTES) ; point to a zeroed counter. + bl _darwin64_struct_floats_to_mem + + b L(done_return_value) +#else + stw r3,0(r30) ; m32 the only struct return in reg is 4 bytes. +#endif + b L(done_return_value) + +L(fp_return_value): + /* Do we have long double to store? */ + bf 31,L(fd_return_value) ; FLAG_RETURNS_128BITS + stfd f1,0(r30) + stfd f2,FPR_SIZE(r30) + b L(done_return_value) + +L(fd_return_value): + /* Do we have double to store? */ + bf 28,L(float_return_value) + stfd f1,0(r30) + b L(done_return_value) + +L(float_return_value): + /* We only have a float to store. */ + stfs f1,0(r30) + b L(done_return_value) + +L(scalar_return_value): + bt 29,L(fp_return_value) ; FLAG_RETURNS_FP + ; ffi_arg is defined as unsigned long. + sg r3,0(r30) ; Save the reg. + bf 28,L(done_return_value) ; not FLAG_RETURNS_64BITS + +#if defined(__ppc64__) +L(maybe_return_128): + std r3,0(r30) + bf 31,L(done_return_value) ; not FLAG_RETURNS_128BITS + std r4,8(r30) +#else + stw r4,4(r30) +#endif + + /* Fall through. */ + /* We want this at the end to simplify eh epilog computation. */ + +L(done_return_value): + /* Restore the registers we used and return. */ + lg r29,SAVED_LR_OFFSET(r28) + ; epilog + lg r31,-(1 * GPR_BYTES)(r28) + mtlr r29 + lg r30,-(2 * GPR_BYTES)(r28) + lg r29,-(3 * GPR_BYTES)(r28) + lg r28,-(4 * GPR_BYTES)(r28) + lg r1,0(r1) + blr +LFE1: + .align 1 +/* END(_ffi_call_DARWIN) */ + +/* Provide a null definition of _ffi_call_AIX. */ + .text + .globl _ffi_call_AIX + .align 2 +_ffi_call_AIX: + blr +/* END(_ffi_call_AIX) */ + +/* EH stuff. */ + +#define EH_DATA_ALIGN_FACT MODE_CHOICE(0x7c,0x78) + + .static_data + .align LOG2_GPR_BYTES +LLFB0$non_lazy_ptr: + .g_long Lstartcode + + .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support +EH_frame1: + .set L$set$0,LECIE1-LSCIE1 + .long L$set$0 ; Length of Common Information Entry +LSCIE1: + .long 0x0 ; CIE Identifier Tag + .byte 0x1 ; CIE Version + .ascii "zR\0" ; CIE Augmentation + .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor + .byte EH_DATA_ALIGN_FACT ; sleb128 -4; CIE Data Alignment Factor + .byte 0x41 ; CIE RA Column + .byte 0x1 ; uleb128 0x1; Augmentation size + .byte 0x10 ; FDE Encoding (indirect pcrel) + .byte 0xc ; DW_CFA_def_cfa + .byte 0x1 ; uleb128 0x1 + .byte 0x0 ; uleb128 0x0 + .align LOG2_GPR_BYTES +LECIE1: + + .globl _ffi_call_DARWIN.eh +_ffi_call_DARWIN.eh: +LSFDE1: + .set L$set$1,LEFDE1-LASFDE1 + .long L$set$1 ; FDE Length +LASFDE1: + .long LASFDE1-EH_frame1 ; FDE CIE offset + .g_long LLFB0$non_lazy_ptr-. ; FDE initial location + .set L$set$3,LFE1-Lstartcode + .g_long L$set$3 ; FDE address range + .byte 0x0 ; uleb128 0x0; Augmentation size + .byte 0x4 ; DW_CFA_advance_loc4 + .set L$set$4,LCFI0-Lstartcode + .long L$set$4 + .byte 0xd ; DW_CFA_def_cfa_register + .byte 0x08 ; uleb128 0x08 + .byte 0x4 ; DW_CFA_advance_loc4 + .set L$set$5,LCFI1-LCFI0 + .long L$set$5 + .byte 0x11 ; DW_CFA_offset_extended_sf + .byte 0x41 ; uleb128 0x41 + .byte 0x7e ; sleb128 -2 + .byte 0x9f ; DW_CFA_offset, column 0x1f + .byte 0x1 ; uleb128 0x1 + .byte 0x9e ; DW_CFA_offset, column 0x1e + .byte 0x2 ; uleb128 0x2 + .byte 0x9d ; DW_CFA_offset, column 0x1d + .byte 0x3 ; uleb128 0x3 + .byte 0x9c ; DW_CFA_offset, column 0x1c + .byte 0x4 ; uleb128 0x4 + .byte 0x4 ; DW_CFA_advance_loc4 + .set L$set$6,LCFI2-LCFI1 + .long L$set$6 + .byte 0xd ; DW_CFA_def_cfa_register + .byte 0x1c ; uleb128 0x1c + .align LOG2_GPR_BYTES +LEFDE1: + .align 1 + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/darwin_closure.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/darwin_closure.S new file mode 100644 index 000000000..db20cf615 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/darwin_closure.S @@ -0,0 +1,575 @@ +/* ----------------------------------------------------------------------- + darwin_closure.S - Copyright (c) 2002, 2003, 2004, 2010, + Free Software Foundation, Inc. + based on ppc_closure.S + + PowerPC Assembly glue. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#define L(x) x + +#if defined(__ppc64__) +#define MODE_CHOICE(x, y) y +#else +#define MODE_CHOICE(x, y) x +#endif + +#define machine_choice MODE_CHOICE(ppc7400,ppc64) + +; Define some pseudo-opcodes for size-independent load & store of GPRs ... +#define lgu MODE_CHOICE(lwzu, ldu) +#define lg MODE_CHOICE(lwz,ld) +#define sg MODE_CHOICE(stw,std) +#define sgu MODE_CHOICE(stwu,stdu) + +; ... and the size of GPRs and their storage indicator. +#define GPR_BYTES MODE_CHOICE(4,8) +#define LOG2_GPR_BYTES MODE_CHOICE(2,3) /* log2(GPR_BYTES) */ +#define g_long MODE_CHOICE(long, quad) /* usage is ".g_long" */ + +; From the ABI doc: "Mac OS X ABI Function Call Guide" Version 2009-02-04. +#define LINKAGE_SIZE MODE_CHOICE(24,48) +#define PARAM_AREA MODE_CHOICE(32,64) + +#define SAVED_CR_OFFSET MODE_CHOICE(4,8) /* save position for CR */ +#define SAVED_LR_OFFSET MODE_CHOICE(8,16) /* save position for lr */ + +/* WARNING: if ffi_type is changed... here be monsters. + Offsets of items within the result type. */ +#define FFI_TYPE_TYPE MODE_CHOICE(6,10) +#define FFI_TYPE_ELEM MODE_CHOICE(8,16) + +#define SAVED_FPR_COUNT 13 +#define FPR_SIZE 8 +/* biggest m64 struct ret is 8GPRS + 13FPRS = 168 bytes - rounded to 16bytes = 176. */ +#define RESULT_BYTES MODE_CHOICE(16,176) + +; The whole stack frame **MUST** be 16byte-aligned. +#define SAVE_SIZE (((LINKAGE_SIZE+PARAM_AREA+SAVED_FPR_COUNT*FPR_SIZE+RESULT_BYTES)+15) & -16LL) +#define PAD_SIZE (SAVE_SIZE-(LINKAGE_SIZE+PARAM_AREA+SAVED_FPR_COUNT*FPR_SIZE+RESULT_BYTES)) + +#define PARENT_PARM_BASE (SAVE_SIZE+LINKAGE_SIZE) +#define FP_SAVE_BASE (LINKAGE_SIZE+PARAM_AREA) + +#if defined(__ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__) && __ENVIRONMENT_MAC_OS_X_VERSION_MIN_REQUIRED__ >= 1050 +; We no longer need the pic symbol stub for Darwin >= 9. +#define BLCLS_HELP _ffi_closure_helper_DARWIN +#define STRUCT_RETVALUE_P _darwin64_struct_ret_by_value_p +#define PASS_STR_FLOATS _darwin64_pass_struct_floats +#undef WANT_STUB +#else +#define BLCLS_HELP L_ffi_closure_helper_DARWIN$stub +#define STRUCT_RETVALUE_P L_darwin64_struct_ret_by_value_p$stub +#define PASS_STR_FLOATS L_darwin64_pass_struct_floats$stub +#define WANT_STUB +#endif + +/* m32/m64 + + The stack layout looks like this: + + | Additional params... | | Higher address + ~ ~ ~ + | Parameters (at least 8*4/8=32/64) | | NUM_GPR_ARG_REGISTERS + |--------------------------------------------| | + | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | + |--------------------------------------------| | + | Reserved 2*4/8 | | + |--------------------------------------------| | + | Space for callee`s LR 4/8 | | + |--------------------------------------------| | + | Saved CR [low word for m64] 4/8 | | + |--------------------------------------------| | + | Current backchain pointer 4/8 |-/ Parent`s frame. + |--------------------------------------------| <+ <<< on entry to + | Result Bytes 16/176 | | + |--------------------------------------------| | + ~ padding to 16-byte alignment ~ ~ + |--------------------------------------------| | + | NUM_FPR_ARG_REGISTERS slots | | + | here fp13 .. fp1 13*8 | | + |--------------------------------------------| | + | R3..R10 8*4/8=32/64 | | NUM_GPR_ARG_REGISTERS + |--------------------------------------------| | + | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | + |--------------------------------------------| | stack | + | Reserved [compiler,binder] 2*4/8 | | grows | + |--------------------------------------------| | down V + | Space for callees LR 4/8 | | + |--------------------------------------------| | lower addresses + | Saved CR [low word for m64] 4/8 | | + |--------------------------------------------| | stack pointer here + | Current backchain pointer 4/8 |-/ during + |--------------------------------------------| <<< call. + +*/ + + .file "darwin_closure.S" + + .machine machine_choice + + .text + .globl _ffi_closure_ASM + .align LOG2_GPR_BYTES +_ffi_closure_ASM: +LFB1: +Lstartcode: + mflr r0 /* extract return address */ + sg r0,SAVED_LR_OFFSET(r1) /* save the return address */ +LCFI0: + sgu r1,-SAVE_SIZE(r1) /* skip over caller save area + keep stack aligned to 16. */ +LCFI1: + /* We want to build up an area for the parameters passed + in registers. (both floating point and integer) */ + + /* Put gpr 3 to gpr 10 in the parents outgoing area... + ... the remainder of any params that overflowed the regs will + follow here. */ + sg r3, (PARENT_PARM_BASE )(r1) + sg r4, (PARENT_PARM_BASE + GPR_BYTES )(r1) + sg r5, (PARENT_PARM_BASE + GPR_BYTES * 2)(r1) + sg r6, (PARENT_PARM_BASE + GPR_BYTES * 3)(r1) + sg r7, (PARENT_PARM_BASE + GPR_BYTES * 4)(r1) + sg r8, (PARENT_PARM_BASE + GPR_BYTES * 5)(r1) + sg r9, (PARENT_PARM_BASE + GPR_BYTES * 6)(r1) + sg r10,(PARENT_PARM_BASE + GPR_BYTES * 7)(r1) + + /* We save fpr 1 to fpr 14 in our own save frame. */ + stfd f1, (FP_SAVE_BASE )(r1) + stfd f2, (FP_SAVE_BASE + FPR_SIZE )(r1) + stfd f3, (FP_SAVE_BASE + FPR_SIZE * 2 )(r1) + stfd f4, (FP_SAVE_BASE + FPR_SIZE * 3 )(r1) + stfd f5, (FP_SAVE_BASE + FPR_SIZE * 4 )(r1) + stfd f6, (FP_SAVE_BASE + FPR_SIZE * 5 )(r1) + stfd f7, (FP_SAVE_BASE + FPR_SIZE * 6 )(r1) + stfd f8, (FP_SAVE_BASE + FPR_SIZE * 7 )(r1) + stfd f9, (FP_SAVE_BASE + FPR_SIZE * 8 )(r1) + stfd f10,(FP_SAVE_BASE + FPR_SIZE * 9 )(r1) + stfd f11,(FP_SAVE_BASE + FPR_SIZE * 10)(r1) + stfd f12,(FP_SAVE_BASE + FPR_SIZE * 11)(r1) + stfd f13,(FP_SAVE_BASE + FPR_SIZE * 12)(r1) + + /* Set up registers for the routine that actually does the work + get the context pointer from the trampoline. */ + mr r3,r11 + + /* Now load up the pointer to the result storage. */ + addi r4,r1,(SAVE_SIZE-RESULT_BYTES) + + /* Now load up the pointer to the saved gpr registers. */ + addi r5,r1,PARENT_PARM_BASE + + /* Now load up the pointer to the saved fpr registers. */ + addi r6,r1,FP_SAVE_BASE + + /* Make the call. */ + bl BLCLS_HELP + + /* r3 contains the rtype pointer... save it since we will need + it later. */ + sg r3,LINKAGE_SIZE(r1) ; ffi_type * result_type + lg r0,0(r3) ; size => r0 + lhz r3,FFI_TYPE_TYPE(r3) ; type => r3 + + /* The helper will have intercepted struture returns and inserted + the caller`s destination address for structs returned by ref. */ + + /* r3 contains the return type so use it to look up in a table + so we know how to deal with each type. */ + + addi r5,r1,(SAVE_SIZE-RESULT_BYTES) /* Otherwise, our return is here. */ + bl Lget_ret_type0_addr /* Get pointer to Lret_type0 into LR. */ + mflr r4 /* Move to r4. */ + slwi r3,r3,4 /* Now multiply return type by 16. */ + add r3,r3,r4 /* Add contents of table to table address. */ + mtctr r3 + bctr /* Jump to it. */ +LFE1: +/* Each of the ret_typeX code fragments has to be exactly 16 bytes long + (4 instructions). For cache effectiveness we align to a 16 byte boundary + first. */ + + .align 4 + + nop + nop + nop +Lget_ret_type0_addr: + blrl + +/* case FFI_TYPE_VOID */ +Lret_type0: + b Lfinish + nop + nop + nop + +/* case FFI_TYPE_INT */ +Lret_type1: + lg r3,0(r5) + b Lfinish + nop + nop + +/* case FFI_TYPE_FLOAT */ +Lret_type2: + lfs f1,0(r5) + b Lfinish + nop + nop + +/* case FFI_TYPE_DOUBLE */ +Lret_type3: + lfd f1,0(r5) + b Lfinish + nop + nop + +/* case FFI_TYPE_LONGDOUBLE */ +Lret_type4: + lfd f1,0(r5) + lfd f2,8(r5) + b Lfinish + nop + +/* case FFI_TYPE_UINT8 */ +Lret_type5: +#if defined(__ppc64__) + lbz r3,7(r5) +#else + lbz r3,3(r5) +#endif + b Lfinish + nop + nop + +/* case FFI_TYPE_SINT8 */ +Lret_type6: +#if defined(__ppc64__) + lbz r3,7(r5) +#else + lbz r3,3(r5) +#endif + extsb r3,r3 + b Lfinish + nop + +/* case FFI_TYPE_UINT16 */ +Lret_type7: +#if defined(__ppc64__) + lhz r3,6(r5) +#else + lhz r3,2(r5) +#endif + b Lfinish + nop + nop + +/* case FFI_TYPE_SINT16 */ +Lret_type8: +#if defined(__ppc64__) + lha r3,6(r5) +#else + lha r3,2(r5) +#endif + b Lfinish + nop + nop + +/* case FFI_TYPE_UINT32 */ +Lret_type9: +#if defined(__ppc64__) + lwz r3,4(r5) +#else + lwz r3,0(r5) +#endif + b Lfinish + nop + nop + +/* case FFI_TYPE_SINT32 */ +Lret_type10: +#if defined(__ppc64__) + lwz r3,4(r5) +#else + lwz r3,0(r5) +#endif + b Lfinish + nop + nop + +/* case FFI_TYPE_UINT64 */ +Lret_type11: +#if defined(__ppc64__) + lg r3,0(r5) + b Lfinish + nop +#else + lwz r3,0(r5) + lwz r4,4(r5) + b Lfinish +#endif + nop + +/* case FFI_TYPE_SINT64 */ +Lret_type12: +#if defined(__ppc64__) + lg r3,0(r5) + b Lfinish + nop +#else + lwz r3,0(r5) + lwz r4,4(r5) + b Lfinish +#endif + nop + +/* case FFI_TYPE_STRUCT */ +Lret_type13: +#if defined(__ppc64__) + lg r3,0(r5) ; we need at least this... + cmpi 0,r0,4 + bgt Lstructend ; not a special small case + b Lsmallstruct ; see if we need more. +#else + cmpi 0,r0,4 + bgt Lfinish ; not by value + lg r3,0(r5) + b Lfinish +#endif +/* case FFI_TYPE_POINTER */ +Lret_type14: + lg r3,0(r5) + b Lfinish + nop + nop + +#if defined(__ppc64__) +Lsmallstruct: + beq Lfour ; continuation of Lret13. + cmpi 0,r0,3 + beq Lfinish ; don`t adjust this - can`t be any floats here... + srdi r3,r3,48 + cmpi 0,r0,2 + beq Lfinish ; .. or here .. + srdi r3,r3,8 + b Lfinish ; .. or here. + +Lfour: + lg r6,LINKAGE_SIZE(r1) ; get the result type + lg r6,FFI_TYPE_ELEM(r6) ; elements array pointer + lg r6,0(r6) ; first element + lhz r0,FFI_TYPE_TYPE(r6) ; OK go the type + cmpi 0,r0,2 ; FFI_TYPE_FLOAT + bne Lfourint + lfs f1,0(r5) ; just one float in the struct. + b Lfinish + +Lfourint: + srdi r3,r3,32 ; four bytes. + b Lfinish + +Lstructend: + lg r3,LINKAGE_SIZE(r1) ; get the result type + bl STRUCT_RETVALUE_P + cmpi 0,r3,0 + beq Lfinish ; nope. + /* Recover a pointer to the results. */ + addi r11,r1,(SAVE_SIZE-RESULT_BYTES) + lg r3,0(r11) ; we need at least this... + lg r4,8(r11) + cmpi 0,r0,16 + beq Lfinish ; special case 16 bytes we don't consider floats. + + /* OK, frustratingly, the process of saving the struct to mem might have + messed with the FPRs, so we have to re-load them :(. + We`ll use our FPRs space again - calling: + void darwin64_pass_struct_floats (ffi_type *s, char *src, + unsigned *nfpr, double **fprs) + We`ll temporarily pinch the first two slots of the param area for local + vars used by the routine. */ + xor r6,r6,r6 + addi r5,r1,PARENT_PARM_BASE ; some space + sg r6,0(r5) ; *nfpr zeroed. + addi r6,r5,8 ; **fprs + addi r3,r1,FP_SAVE_BASE ; pointer to FPRs space + sg r3,0(r6) + mr r4,r11 ; the struct is here... + lg r3,LINKAGE_SIZE(r1) ; ffi_type * result_type. + bl PASS_STR_FLOATS ; get struct floats into FPR save space. + /* See if we used any floats */ + lwz r0,(SAVE_SIZE-RESULT_BYTES)(r1) + cmpi 0,r0,0 + beq Lstructints ; nope. + /* OK load `em up... */ + lfd f1, (FP_SAVE_BASE )(r1) + lfd f2, (FP_SAVE_BASE + FPR_SIZE )(r1) + lfd f3, (FP_SAVE_BASE + FPR_SIZE * 2 )(r1) + lfd f4, (FP_SAVE_BASE + FPR_SIZE * 3 )(r1) + lfd f5, (FP_SAVE_BASE + FPR_SIZE * 4 )(r1) + lfd f6, (FP_SAVE_BASE + FPR_SIZE * 5 )(r1) + lfd f7, (FP_SAVE_BASE + FPR_SIZE * 6 )(r1) + lfd f8, (FP_SAVE_BASE + FPR_SIZE * 7 )(r1) + lfd f9, (FP_SAVE_BASE + FPR_SIZE * 8 )(r1) + lfd f10,(FP_SAVE_BASE + FPR_SIZE * 9 )(r1) + lfd f11,(FP_SAVE_BASE + FPR_SIZE * 10)(r1) + lfd f12,(FP_SAVE_BASE + FPR_SIZE * 11)(r1) + lfd f13,(FP_SAVE_BASE + FPR_SIZE * 12)(r1) + + /* point back at our saved struct. */ +Lstructints: + addi r11,r1,(SAVE_SIZE-RESULT_BYTES) + lg r3,0(r11) ; we end up picking the + lg r4,8(r11) ; first two again. + lg r5,16(r11) + lg r6,24(r11) + lg r7,32(r11) + lg r8,40(r11) + lg r9,48(r11) + lg r10,56(r11) +#endif + +/* case done */ +Lfinish: + addi r1,r1,SAVE_SIZE /* Restore stack pointer. */ + lg r0,SAVED_LR_OFFSET(r1) /* Get return address. */ + mtlr r0 /* Reset link register. */ + blr +Lendcode: + .align 1 + +/* END(ffi_closure_ASM) */ + +/* EH frame stuff. */ +#define EH_DATA_ALIGN_FACT MODE_CHOICE(0x7c,0x78) +/* 176, 400 */ +#define EH_FRAME_OFFSETA MODE_CHOICE(176,0x90) +#define EH_FRAME_OFFSETB MODE_CHOICE(1,3) + + .static_data + .align LOG2_GPR_BYTES +LLFB1$non_lazy_ptr: + .g_long Lstartcode + + .section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support +EH_frame1: + .set L$set$0,LECIE1-LSCIE1 + .long L$set$0 ; Length of Common Information Entry +LSCIE1: + .long 0x0 ; CIE Identifier Tag + .byte 0x1 ; CIE Version + .ascii "zR\0" ; CIE Augmentation + .byte 0x1 ; uleb128 0x1; CIE Code Alignment Factor + .byte EH_DATA_ALIGN_FACT ; sleb128 -4; CIE Data Alignment Factor + .byte 0x41 ; CIE RA Column + .byte 0x1 ; uleb128 0x1; Augmentation size + .byte 0x10 ; FDE Encoding (indirect pcrel) + .byte 0xc ; DW_CFA_def_cfa + .byte 0x1 ; uleb128 0x1 + .byte 0x0 ; uleb128 0x0 + .align LOG2_GPR_BYTES +LECIE1: + .globl _ffi_closure_ASM.eh +_ffi_closure_ASM.eh: +LSFDE1: + .set L$set$1,LEFDE1-LASFDE1 + .long L$set$1 ; FDE Length + +LASFDE1: + .long LASFDE1-EH_frame1 ; FDE CIE offset + .g_long LLFB1$non_lazy_ptr-. ; FDE initial location + .set L$set$3,LFE1-Lstartcode + .g_long L$set$3 ; FDE address range + .byte 0x0 ; uleb128 0x0; Augmentation size + .byte 0x4 ; DW_CFA_advance_loc4 + .set L$set$3,LCFI1-LCFI0 + .long L$set$3 + .byte 0xe ; DW_CFA_def_cfa_offset + .byte EH_FRAME_OFFSETA,EH_FRAME_OFFSETB ; uleb128 176,1/190,3 + .byte 0x4 ; DW_CFA_advance_loc4 + .set L$set$4,LCFI0-Lstartcode + .long L$set$4 + .byte 0x11 ; DW_CFA_offset_extended_sf + .byte 0x41 ; uleb128 0x41 + .byte 0x7e ; sleb128 -2 + .align LOG2_GPR_BYTES +LEFDE1: + .align 1 + +#ifdef WANT_STUB + .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 + .align 5 +L_ffi_closure_helper_DARWIN$stub: + .indirect_symbol _ffi_closure_helper_DARWIN + mflr r0 + bcl 20,31,"L00000000001$spb" +"L00000000001$spb": + mflr r11 + addis r11,r11,ha16(L_ffi_closure_helper_DARWIN$lazy_ptr-"L00000000001$spb") + mtlr r0 + lwzu r12,lo16(L_ffi_closure_helper_DARWIN$lazy_ptr-"L00000000001$spb")(r11) + mtctr r12 + bctr + .lazy_symbol_pointer +L_ffi_closure_helper_DARWIN$lazy_ptr: + .indirect_symbol _ffi_closure_helper_DARWIN + .long dyld_stub_binding_helper + +#if defined(__ppc64__) + .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 + .align 5 +L_darwin64_struct_ret_by_value_p$stub: + .indirect_symbol _darwin64_struct_ret_by_value_p + mflr r0 + bcl 20,31,"L00000000002$spb" +"L00000000002$spb": + mflr r11 + addis r11,r11,ha16(L_darwin64_struct_ret_by_value_p$lazy_ptr-"L00000000002$spb") + mtlr r0 + lwzu r12,lo16(L_darwin64_struct_ret_by_value_p$lazy_ptr-"L00000000002$spb")(r11) + mtctr r12 + bctr + .lazy_symbol_pointer +L_darwin64_struct_ret_by_value_p$lazy_ptr: + .indirect_symbol _darwin64_struct_ret_by_value_p + .long dyld_stub_binding_helper + .section __TEXT,__picsymbolstub1,symbol_stubs,pure_instructions,32 + .align 5 +L_darwin64_pass_struct_floats$stub: + .indirect_symbol _darwin64_pass_struct_floats + mflr r0 + bcl 20,31,"L00000000003$spb" +"L00000000003$spb": + mflr r11 + addis r11,r11,ha16(L_darwin64_pass_struct_floats$lazy_ptr-"L00000000003$spb") + mtlr r0 + lwzu r12,lo16(L_darwin64_pass_struct_floats$lazy_ptr-"L00000000003$spb")(r11) + mtctr r12 + bctr + .lazy_symbol_pointer +L_darwin64_pass_struct_floats$lazy_ptr: + .indirect_symbol _darwin64_pass_struct_floats + .long dyld_stub_binding_helper +# endif +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/ffi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/ffi.c new file mode 100644 index 000000000..fb2a39f55 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/ffi.c @@ -0,0 +1,1448 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (C) 2011 Anthony Green + Copyright (C) 2008 Red Hat, Inc + Copyright (C) 2007, 2008 Free Software Foundation, Inc + Copyright (c) 1998 Geoffrey Keating + + PowerPC Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +#include +#include + + +extern void ffi_closure_SYSV (void); +extern void FFI_HIDDEN ffi_closure_LINUX64 (void); + +enum { + /* The assembly depends on these exact flags. */ + FLAG_RETURNS_SMST = 1 << (31-31), /* Used for FFI_SYSV small structs. */ + FLAG_RETURNS_NOTHING = 1 << (31-30), /* These go in cr7 */ + FLAG_RETURNS_FP = 1 << (31-29), + FLAG_RETURNS_64BITS = 1 << (31-28), + + FLAG_RETURNS_128BITS = 1 << (31-27), /* cr6 */ + FLAG_SYSV_SMST_R4 = 1 << (31-26), /* use r4 for FFI_SYSV 8 byte + structs. */ + FLAG_SYSV_SMST_R3 = 1 << (31-25), /* use r3 for FFI_SYSV 4 byte + structs. */ + /* Bits (31-24) through (31-19) store shift value for SMST */ + + FLAG_ARG_NEEDS_COPY = 1 << (31- 7), + FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ + FLAG_4_GPR_ARGUMENTS = 1 << (31- 5), + FLAG_RETVAL_REFERENCE = 1 << (31- 4) +}; + +/* About the SYSV ABI. */ +unsigned int NUM_GPR_ARG_REGISTERS = 8; +#ifndef __NO_FPRS__ +unsigned int NUM_FPR_ARG_REGISTERS = 8; +#else +unsigned int NUM_FPR_ARG_REGISTERS = 0; +#endif + +enum { ASM_NEEDS_REGISTERS = 4 }; + +/* ffi_prep_args_SYSV is called by the assembly routine once stack space + has been allocated for the function's arguments. + + The stack layout we want looks like this: + + | Return address from ffi_call_SYSV 4bytes | higher addresses + |--------------------------------------------| + | Previous backchain pointer 4 | stack pointer here + |--------------------------------------------|<+ <<< on entry to + | Saved r28-r31 4*4 | | ffi_call_SYSV + |--------------------------------------------| | + | GPR registers r3-r10 8*4 | | ffi_call_SYSV + |--------------------------------------------| | + | FPR registers f1-f8 (optional) 8*8 | | + |--------------------------------------------| | stack | + | Space for copied structures | | grows | + |--------------------------------------------| | down V + | Parameters that didn't fit in registers | | + |--------------------------------------------| | lower addresses + | Space for callee's LR 4 | | + |--------------------------------------------| | stack pointer here + | Current backchain pointer 4 |-/ during + |--------------------------------------------| <<< ffi_call_SYSV + +*/ + +void +ffi_prep_args_SYSV (extended_cif *ecif, unsigned *const stack) +{ + const unsigned bytes = ecif->cif->bytes; + const unsigned flags = ecif->cif->flags; + + typedef union { + char *c; + unsigned *u; + long long *ll; + float *f; + double *d; + } valp; + + /* 'stacktop' points at the previous backchain pointer. */ + valp stacktop; + + /* 'gpr_base' points at the space for gpr3, and grows upwards as + we use GPR registers. */ + valp gpr_base; + int intarg_count; + + /* 'fpr_base' points at the space for fpr1, and grows upwards as + we use FPR registers. */ + valp fpr_base; + int fparg_count; + + /* 'copy_space' grows down as we put structures in it. It should + stay 16-byte aligned. */ + valp copy_space; + + /* 'next_arg' grows up as we put parameters in it. */ + valp next_arg; + + int i, ii MAYBE_UNUSED; + ffi_type **ptr; + double double_tmp; + union { + void **v; + char **c; + signed char **sc; + unsigned char **uc; + signed short **ss; + unsigned short **us; + unsigned int **ui; + long long **ll; + float **f; + double **d; + } p_argv; + size_t struct_copy_size; + unsigned gprvalue; + + if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) + NUM_FPR_ARG_REGISTERS = 0; + + stacktop.c = (char *) stack + bytes; + gpr_base.u = stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS; + intarg_count = 0; + fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS; + fparg_count = 0; + copy_space.c = ((flags & FLAG_FP_ARGUMENTS) ? fpr_base.c : gpr_base.c); + next_arg.u = stack + 2; + + /* Check that everything starts aligned properly. */ + FFI_ASSERT (((unsigned) (char *) stack & 0xF) == 0); + FFI_ASSERT (((unsigned) copy_space.c & 0xF) == 0); + FFI_ASSERT (((unsigned) stacktop.c & 0xF) == 0); + FFI_ASSERT ((bytes & 0xF) == 0); + FFI_ASSERT (copy_space.c >= next_arg.c); + + /* Deal with return values that are actually pass-by-reference. */ + if (flags & FLAG_RETVAL_REFERENCE) + { + *gpr_base.u++ = (unsigned long) (char *) ecif->rvalue; + intarg_count++; + } + + /* Now for the arguments. */ + p_argv.v = ecif->avalue; + for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs; + i > 0; + i--, ptr++, p_argv.v++) + { + switch ((*ptr)->type) + { + case FFI_TYPE_FLOAT: + /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ + if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) + goto soft_float_prep; + double_tmp = **p_argv.f; + if (fparg_count >= NUM_FPR_ARG_REGISTERS) + { + *next_arg.f = (float) double_tmp; + next_arg.u += 1; + intarg_count++; + } + else + *fpr_base.d++ = double_tmp; + fparg_count++; + FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); + break; + + case FFI_TYPE_DOUBLE: + /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ + if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) + goto soft_double_prep; + double_tmp = **p_argv.d; + + if (fparg_count >= NUM_FPR_ARG_REGISTERS) + { + if (intarg_count >= NUM_GPR_ARG_REGISTERS + && intarg_count % 2 != 0) + { + intarg_count++; + next_arg.u++; + } + *next_arg.d = double_tmp; + next_arg.u += 2; + } + else + *fpr_base.d++ = double_tmp; + fparg_count++; + FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); + break; + +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + case FFI_TYPE_LONGDOUBLE: + if ((ecif->cif->abi != FFI_LINUX) + && (ecif->cif->abi != FFI_LINUX_SOFT_FLOAT)) + goto do_struct; + /* The soft float ABI for long doubles works like this, + a long double is passed in four consecutive gprs if available. + A maximum of 2 long doubles can be passed in gprs. + If we do not have 4 gprs left, the long double is passed on the + stack, 4-byte aligned. */ + if (ecif->cif->abi == FFI_LINUX_SOFT_FLOAT) + { + unsigned int int_tmp = (*p_argv.ui)[0]; + if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3) + { + if (intarg_count < NUM_GPR_ARG_REGISTERS) + intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count; + *next_arg.u = int_tmp; + next_arg.u++; + for (ii = 1; ii < 4; ii++) + { + int_tmp = (*p_argv.ui)[ii]; + *next_arg.u = int_tmp; + next_arg.u++; + } + } + else + { + *gpr_base.u++ = int_tmp; + for (ii = 1; ii < 4; ii++) + { + int_tmp = (*p_argv.ui)[ii]; + *gpr_base.u++ = int_tmp; + } + } + intarg_count +=4; + } + else + { + double_tmp = (*p_argv.d)[0]; + + if (fparg_count >= NUM_FPR_ARG_REGISTERS - 1) + { + if (intarg_count >= NUM_GPR_ARG_REGISTERS + && intarg_count % 2 != 0) + { + intarg_count++; + next_arg.u++; + } + *next_arg.d = double_tmp; + next_arg.u += 2; + double_tmp = (*p_argv.d)[1]; + *next_arg.d = double_tmp; + next_arg.u += 2; + } + else + { + *fpr_base.d++ = double_tmp; + double_tmp = (*p_argv.d)[1]; + *fpr_base.d++ = double_tmp; + } + + fparg_count += 2; + FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); + } + break; +#endif + + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + soft_double_prep: + if (intarg_count == NUM_GPR_ARG_REGISTERS-1) + intarg_count++; + if (intarg_count >= NUM_GPR_ARG_REGISTERS) + { + if (intarg_count % 2 != 0) + { + intarg_count++; + next_arg.u++; + } + *next_arg.ll = **p_argv.ll; + next_arg.u += 2; + } + else + { + /* whoops: abi states only certain register pairs + * can be used for passing long long int + * specifically (r3,r4), (r5,r6), (r7,r8), + * (r9,r10) and if next arg is long long but + * not correct starting register of pair then skip + * until the proper starting register + */ + if (intarg_count % 2 != 0) + { + intarg_count ++; + gpr_base.u++; + } + *gpr_base.ll++ = **p_argv.ll; + } + intarg_count += 2; + break; + + case FFI_TYPE_STRUCT: +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + do_struct: +#endif + struct_copy_size = ((*ptr)->size + 15) & ~0xF; + copy_space.c -= struct_copy_size; + memcpy (copy_space.c, *p_argv.c, (*ptr)->size); + + gprvalue = (unsigned long) copy_space.c; + + FFI_ASSERT (copy_space.c > next_arg.c); + FFI_ASSERT (flags & FLAG_ARG_NEEDS_COPY); + goto putgpr; + + case FFI_TYPE_UINT8: + gprvalue = **p_argv.uc; + goto putgpr; + case FFI_TYPE_SINT8: + gprvalue = **p_argv.sc; + goto putgpr; + case FFI_TYPE_UINT16: + gprvalue = **p_argv.us; + goto putgpr; + case FFI_TYPE_SINT16: + gprvalue = **p_argv.ss; + goto putgpr; + + case FFI_TYPE_INT: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_POINTER: + soft_float_prep: + + gprvalue = **p_argv.ui; + + putgpr: + if (intarg_count >= NUM_GPR_ARG_REGISTERS) + *next_arg.u++ = gprvalue; + else + *gpr_base.u++ = gprvalue; + intarg_count++; + break; + } + } + + /* Check that we didn't overrun the stack... */ + FFI_ASSERT (copy_space.c >= next_arg.c); + FFI_ASSERT (gpr_base.u <= stacktop.u - ASM_NEEDS_REGISTERS); + FFI_ASSERT (fpr_base.u + <= stacktop.u - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); + FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); +} + +/* About the LINUX64 ABI. */ +enum { + NUM_GPR_ARG_REGISTERS64 = 8, + NUM_FPR_ARG_REGISTERS64 = 13 +}; +enum { ASM_NEEDS_REGISTERS64 = 4 }; + +/* ffi_prep_args64 is called by the assembly routine once stack space + has been allocated for the function's arguments. + + The stack layout we want looks like this: + + | Ret addr from ffi_call_LINUX64 8bytes | higher addresses + |--------------------------------------------| + | CR save area 8bytes | + |--------------------------------------------| + | Previous backchain pointer 8 | stack pointer here + |--------------------------------------------|<+ <<< on entry to + | Saved r28-r31 4*8 | | ffi_call_LINUX64 + |--------------------------------------------| | + | GPR registers r3-r10 8*8 | | + |--------------------------------------------| | + | FPR registers f1-f13 (optional) 13*8 | | + |--------------------------------------------| | + | Parameter save area | | + |--------------------------------------------| | + | TOC save area 8 | | + |--------------------------------------------| | stack | + | Linker doubleword 8 | | grows | + |--------------------------------------------| | down V + | Compiler doubleword 8 | | + |--------------------------------------------| | lower addresses + | Space for callee's LR 8 | | + |--------------------------------------------| | + | CR save area 8 | | + |--------------------------------------------| | stack pointer here + | Current backchain pointer 8 |-/ during + |--------------------------------------------| <<< ffi_call_LINUX64 + +*/ + +void FFI_HIDDEN +ffi_prep_args64 (extended_cif *ecif, unsigned long *const stack) +{ + const unsigned long bytes = ecif->cif->bytes; + const unsigned long flags = ecif->cif->flags; + + typedef union { + char *c; + unsigned long *ul; + float *f; + double *d; + } valp; + + /* 'stacktop' points at the previous backchain pointer. */ + valp stacktop; + + /* 'next_arg' points at the space for gpr3, and grows upwards as + we use GPR registers, then continues at rest. */ + valp gpr_base; + valp gpr_end; + valp rest; + valp next_arg; + + /* 'fpr_base' points at the space for fpr3, and grows upwards as + we use FPR registers. */ + valp fpr_base; + int fparg_count; + + int i, words; + ffi_type **ptr; + double double_tmp; + union { + void **v; + char **c; + signed char **sc; + unsigned char **uc; + signed short **ss; + unsigned short **us; + signed int **si; + unsigned int **ui; + unsigned long **ul; + float **f; + double **d; + } p_argv; + unsigned long gprvalue; + + stacktop.c = (char *) stack + bytes; + gpr_base.ul = stacktop.ul - ASM_NEEDS_REGISTERS64 - NUM_GPR_ARG_REGISTERS64; + gpr_end.ul = gpr_base.ul + NUM_GPR_ARG_REGISTERS64; + rest.ul = stack + 6 + NUM_GPR_ARG_REGISTERS64; + fpr_base.d = gpr_base.d - NUM_FPR_ARG_REGISTERS64; + fparg_count = 0; + next_arg.ul = gpr_base.ul; + + /* Check that everything starts aligned properly. */ + FFI_ASSERT (((unsigned long) (char *) stack & 0xF) == 0); + FFI_ASSERT (((unsigned long) stacktop.c & 0xF) == 0); + FFI_ASSERT ((bytes & 0xF) == 0); + + /* Deal with return values that are actually pass-by-reference. */ + if (flags & FLAG_RETVAL_REFERENCE) + *next_arg.ul++ = (unsigned long) (char *) ecif->rvalue; + + /* Now for the arguments. */ + p_argv.v = ecif->avalue; + for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs; + i > 0; + i--, ptr++, p_argv.v++) + { + switch ((*ptr)->type) + { + case FFI_TYPE_FLOAT: + double_tmp = **p_argv.f; + *next_arg.f = (float) double_tmp; + if (++next_arg.ul == gpr_end.ul) + next_arg.ul = rest.ul; + if (fparg_count < NUM_FPR_ARG_REGISTERS64) + *fpr_base.d++ = double_tmp; + fparg_count++; + FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); + break; + + case FFI_TYPE_DOUBLE: + double_tmp = **p_argv.d; + *next_arg.d = double_tmp; + if (++next_arg.ul == gpr_end.ul) + next_arg.ul = rest.ul; + if (fparg_count < NUM_FPR_ARG_REGISTERS64) + *fpr_base.d++ = double_tmp; + fparg_count++; + FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); + break; + +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + case FFI_TYPE_LONGDOUBLE: + double_tmp = (*p_argv.d)[0]; + *next_arg.d = double_tmp; + if (++next_arg.ul == gpr_end.ul) + next_arg.ul = rest.ul; + if (fparg_count < NUM_FPR_ARG_REGISTERS64) + *fpr_base.d++ = double_tmp; + fparg_count++; + double_tmp = (*p_argv.d)[1]; + *next_arg.d = double_tmp; + if (++next_arg.ul == gpr_end.ul) + next_arg.ul = rest.ul; + if (fparg_count < NUM_FPR_ARG_REGISTERS64) + *fpr_base.d++ = double_tmp; + fparg_count++; + FFI_ASSERT (__LDBL_MANT_DIG__ == 106); + FFI_ASSERT (flags & FLAG_FP_ARGUMENTS); + break; +#endif + + case FFI_TYPE_STRUCT: + words = ((*ptr)->size + 7) / 8; + if (next_arg.ul >= gpr_base.ul && next_arg.ul + words > gpr_end.ul) + { + size_t first = gpr_end.c - next_arg.c; + memcpy (next_arg.c, *p_argv.c, first); + memcpy (rest.c, *p_argv.c + first, (*ptr)->size - first); + next_arg.c = rest.c + words * 8 - first; + } + else + { + char *where = next_arg.c; + + /* Structures with size less than eight bytes are passed + left-padded. */ + if ((*ptr)->size < 8) + where += 8 - (*ptr)->size; + + memcpy (where, *p_argv.c, (*ptr)->size); + next_arg.ul += words; + if (next_arg.ul == gpr_end.ul) + next_arg.ul = rest.ul; + } + break; + + case FFI_TYPE_UINT8: + gprvalue = **p_argv.uc; + goto putgpr; + case FFI_TYPE_SINT8: + gprvalue = **p_argv.sc; + goto putgpr; + case FFI_TYPE_UINT16: + gprvalue = **p_argv.us; + goto putgpr; + case FFI_TYPE_SINT16: + gprvalue = **p_argv.ss; + goto putgpr; + case FFI_TYPE_UINT32: + gprvalue = **p_argv.ui; + goto putgpr; + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + gprvalue = **p_argv.si; + goto putgpr; + + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + case FFI_TYPE_POINTER: + gprvalue = **p_argv.ul; + putgpr: + *next_arg.ul++ = gprvalue; + if (next_arg.ul == gpr_end.ul) + next_arg.ul = rest.ul; + break; + } + } + + FFI_ASSERT (flags & FLAG_4_GPR_ARGUMENTS + || (next_arg.ul >= gpr_base.ul + && next_arg.ul <= gpr_base.ul + 4)); +} + + + +/* Perform machine dependent cif processing */ +ffi_status +ffi_prep_cif_machdep (ffi_cif *cif) +{ + /* All this is for the SYSV and LINUX64 ABI. */ + int i; + ffi_type **ptr; + unsigned bytes; + int fparg_count = 0, intarg_count = 0; + unsigned flags = 0; + unsigned struct_copy_size = 0; + unsigned type = cif->rtype->type; + unsigned size = cif->rtype->size; + + if (cif->abi == FFI_LINUX_SOFT_FLOAT) + NUM_FPR_ARG_REGISTERS = 0; + + if (cif->abi != FFI_LINUX64) + { + /* All the machine-independent calculation of cif->bytes will be wrong. + Redo the calculation for SYSV. */ + + /* Space for the frame pointer, callee's LR, and the asm's temp regs. */ + bytes = (2 + ASM_NEEDS_REGISTERS) * sizeof (int); + + /* Space for the GPR registers. */ + bytes += NUM_GPR_ARG_REGISTERS * sizeof (int); + } + else + { + /* 64-bit ABI. */ + + /* Space for backchain, CR, LR, cc/ld doubleword, TOC and the asm's temp + regs. */ + bytes = (6 + ASM_NEEDS_REGISTERS64) * sizeof (long); + + /* Space for the mandatory parm save area and general registers. */ + bytes += 2 * NUM_GPR_ARG_REGISTERS64 * sizeof (long); + } + + /* Return value handling. The rules for SYSV are as follows: + - 32-bit (or less) integer values are returned in gpr3; + - Structures of size <= 4 bytes also returned in gpr3; + - 64-bit integer values and structures between 5 and 8 bytes are returned + in gpr3 and gpr4; + - Single/double FP values are returned in fpr1; + - Larger structures are allocated space and a pointer is passed as + the first argument. + - long doubles (if not equivalent to double) are returned in + fpr1,fpr2 for Linux and as for large structs for SysV. + For LINUX64: + - integer values in gpr3; + - Structures/Unions by reference; + - Single/double FP values in fpr1, long double in fpr1,fpr2. + - soft-float float/doubles are treated as UINT32/UINT64 respectivley. + - soft-float long doubles are returned in gpr3-gpr6. */ + switch (type) + { +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + case FFI_TYPE_LONGDOUBLE: + if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX64 + && cif->abi != FFI_LINUX_SOFT_FLOAT) + goto byref; + flags |= FLAG_RETURNS_128BITS; + /* Fall through. */ +#endif + case FFI_TYPE_DOUBLE: + flags |= FLAG_RETURNS_64BITS; + /* Fall through. */ + case FFI_TYPE_FLOAT: + /* With FFI_LINUX_SOFT_FLOAT no fp registers are used. */ + if (cif->abi != FFI_LINUX_SOFT_FLOAT) + flags |= FLAG_RETURNS_FP; + break; + + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + flags |= FLAG_RETURNS_64BITS; + break; + + case FFI_TYPE_STRUCT: + if (cif->abi == FFI_SYSV) + { + /* The final SYSV ABI says that structures smaller or equal 8 bytes + are returned in r3/r4. The FFI_GCC_SYSV ABI instead returns them + in memory. */ + + /* Treat structs with size <= 8 bytes. */ + if (size <= 8) + { + flags |= FLAG_RETURNS_SMST; + /* These structs are returned in r3. We pack the type and the + precalculated shift value (needed in the sysv.S) into flags. + The same applies for the structs returned in r3/r4. */ + if (size <= 4) + { + flags |= FLAG_SYSV_SMST_R3; + flags |= 8 * (4 - size) << 8; + break; + } + /* These structs are returned in r3 and r4. See above. */ + if (size <= 8) + { + flags |= FLAG_SYSV_SMST_R3 | FLAG_SYSV_SMST_R4; + flags |= 8 * (8 - size) << 8; + break; + } + } + } +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + byref: +#endif + intarg_count++; + flags |= FLAG_RETVAL_REFERENCE; + /* Fall through. */ + case FFI_TYPE_VOID: + flags |= FLAG_RETURNS_NOTHING; + break; + + default: + /* Returns 32-bit integer, or similar. Nothing to do here. */ + break; + } + + if (cif->abi != FFI_LINUX64) + /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the + first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest + goes on the stack. Structures and long doubles (if not equivalent + to double) are passed as a pointer to a copy of the structure. + Stuff on the stack needs to keep proper alignment. */ + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) + { + switch ((*ptr)->type) + { + case FFI_TYPE_FLOAT: + /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ + if (cif->abi == FFI_LINUX_SOFT_FLOAT) + goto soft_float_cif; + fparg_count++; + /* floating singles are not 8-aligned on stack */ + break; + +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + case FFI_TYPE_LONGDOUBLE: + if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) + goto do_struct; + if (cif->abi == FFI_LINUX_SOFT_FLOAT) + { + if (intarg_count >= NUM_GPR_ARG_REGISTERS - 3 + || intarg_count < NUM_GPR_ARG_REGISTERS) + /* A long double in FFI_LINUX_SOFT_FLOAT can use only + a set of four consecutive gprs. If we have not enough, + we have to adjust the intarg_count value. */ + intarg_count += NUM_GPR_ARG_REGISTERS - intarg_count; + intarg_count += 4; + break; + } + else + fparg_count++; + /* Fall thru */ +#endif + case FFI_TYPE_DOUBLE: + /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ + if (cif->abi == FFI_LINUX_SOFT_FLOAT) + goto soft_double_cif; + fparg_count++; + /* If this FP arg is going on the stack, it must be + 8-byte-aligned. */ + if (fparg_count > NUM_FPR_ARG_REGISTERS + && intarg_count >= NUM_GPR_ARG_REGISTERS + && intarg_count % 2 != 0) + intarg_count++; + break; + + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + soft_double_cif: + /* 'long long' arguments are passed as two words, but + either both words must fit in registers or both go + on the stack. If they go on the stack, they must + be 8-byte-aligned. + + Also, only certain register pairs can be used for + passing long long int -- specifically (r3,r4), (r5,r6), + (r7,r8), (r9,r10). + */ + if (intarg_count == NUM_GPR_ARG_REGISTERS-1 + || intarg_count % 2 != 0) + intarg_count++; + intarg_count += 2; + break; + + case FFI_TYPE_STRUCT: +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + do_struct: +#endif + /* We must allocate space for a copy of these to enforce + pass-by-value. Pad the space up to a multiple of 16 + bytes (the maximum alignment required for anything under + the SYSV ABI). */ + struct_copy_size += ((*ptr)->size + 15) & ~0xF; + /* Fall through (allocate space for the pointer). */ + + default: + soft_float_cif: + /* Everything else is passed as a 4-byte word in a GPR, either + the object itself or a pointer to it. */ + intarg_count++; + break; + } + } + else + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) + { + switch ((*ptr)->type) + { +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + case FFI_TYPE_LONGDOUBLE: + if (cif->abi == FFI_LINUX_SOFT_FLOAT) + intarg_count += 4; + else + { + fparg_count += 2; + intarg_count += 2; + } + break; +#endif + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + fparg_count++; + intarg_count++; + break; + + case FFI_TYPE_STRUCT: + intarg_count += ((*ptr)->size + 7) / 8; + break; + + default: + /* Everything else is passed as a 8-byte word in a GPR, either + the object itself or a pointer to it. */ + intarg_count++; + break; + } + } + + if (fparg_count != 0) + flags |= FLAG_FP_ARGUMENTS; + if (intarg_count > 4) + flags |= FLAG_4_GPR_ARGUMENTS; + if (struct_copy_size != 0) + flags |= FLAG_ARG_NEEDS_COPY; + + if (cif->abi != FFI_LINUX64) + { + /* Space for the FPR registers, if needed. */ + if (fparg_count != 0) + bytes += NUM_FPR_ARG_REGISTERS * sizeof (double); + + /* Stack space. */ + if (intarg_count > NUM_GPR_ARG_REGISTERS) + bytes += (intarg_count - NUM_GPR_ARG_REGISTERS) * sizeof (int); + if (fparg_count > NUM_FPR_ARG_REGISTERS) + bytes += (fparg_count - NUM_FPR_ARG_REGISTERS) * sizeof (double); + } + else + { + /* Space for the FPR registers, if needed. */ + if (fparg_count != 0) + bytes += NUM_FPR_ARG_REGISTERS64 * sizeof (double); + + /* Stack space. */ + if (intarg_count > NUM_GPR_ARG_REGISTERS64) + bytes += (intarg_count - NUM_GPR_ARG_REGISTERS64) * sizeof (long); + } + + /* The stack space allocated needs to be a multiple of 16 bytes. */ + bytes = (bytes + 15) & ~0xF; + + /* Add in the space for the copied structures. */ + bytes += struct_copy_size; + + cif->flags = flags; + cif->bytes = bytes; + + return FFI_OK; +} + +extern void ffi_call_SYSV(extended_cif *, unsigned, unsigned, unsigned *, + void (*fn)(void)); +extern void FFI_HIDDEN ffi_call_LINUX64(extended_cif *, unsigned long, + unsigned long, unsigned long *, + void (*fn)(void)); + +void +ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + + if ((rvalue == NULL) && (cif->rtype->type == FFI_TYPE_STRUCT)) + { + ecif.rvalue = alloca(cif->rtype->size); + } + else + ecif.rvalue = rvalue; + + + switch (cif->abi) + { +#ifndef POWERPC64 + case FFI_SYSV: + case FFI_GCC_SYSV: + case FFI_LINUX: + case FFI_LINUX_SOFT_FLOAT: + ffi_call_SYSV (&ecif, -cif->bytes, cif->flags, ecif.rvalue, fn); + break; +#else + case FFI_LINUX64: + ffi_call_LINUX64 (&ecif, -(long) cif->bytes, cif->flags, ecif.rvalue, fn); + break; +#endif + default: + FFI_ASSERT (0); + break; + } +} + + +#ifndef POWERPC64 +#define MIN_CACHE_LINE_SIZE 8 + +static void +flush_icache (char *wraddr, char *xaddr, int size) +{ + int i; + for (i = 0; i < size; i += MIN_CACHE_LINE_SIZE) + __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" + : : "r" (xaddr + i), "r" (wraddr + i) : "memory"); + __asm__ volatile ("icbi 0,%0;" "dcbf 0,%1;" "sync;" "isync;" + : : "r"(xaddr + size - 1), "r"(wraddr + size - 1) + : "memory"); +} +#endif + +ffi_status +ffi_prep_closure_loc (ffi_closure *closure, + ffi_cif *cif, + void (*fun) (ffi_cif *, void *, void **, void *), + void *user_data, + void *codeloc) +{ +#ifdef POWERPC64 + void **tramp = (void **) &closure->tramp[0]; + + if (cif->abi != FFI_LINUX64) + return FFI_BAD_ABI; + /* Copy function address and TOC from ffi_closure_LINUX64. */ + memcpy (tramp, (char *) ffi_closure_LINUX64, 16); + tramp[2] = codeloc; +#else + unsigned int *tramp; + + if (! (cif->abi == FFI_GCC_SYSV + || cif->abi == FFI_SYSV + || cif->abi == FFI_LINUX + || cif->abi == FFI_LINUX_SOFT_FLOAT)) + return FFI_BAD_ABI; + + tramp = (unsigned int *) &closure->tramp[0]; + tramp[0] = 0x7c0802a6; /* mflr r0 */ + tramp[1] = 0x4800000d; /* bl 10 */ + tramp[4] = 0x7d6802a6; /* mflr r11 */ + tramp[5] = 0x7c0803a6; /* mtlr r0 */ + tramp[6] = 0x800b0000; /* lwz r0,0(r11) */ + tramp[7] = 0x816b0004; /* lwz r11,4(r11) */ + tramp[8] = 0x7c0903a6; /* mtctr r0 */ + tramp[9] = 0x4e800420; /* bctr */ + *(void **) &tramp[2] = (void *) ffi_closure_SYSV; /* function */ + *(void **) &tramp[3] = codeloc; /* context */ + + /* Flush the icache. */ + flush_icache ((char *)tramp, (char *)codeloc, FFI_TRAMPOLINE_SIZE); +#endif + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + + return FFI_OK; +} + +typedef union +{ + float f; + double d; +} ffi_dblfl; + +int ffi_closure_helper_SYSV (ffi_closure *, void *, unsigned long *, + ffi_dblfl *, unsigned long *); + +/* Basically the trampoline invokes ffi_closure_SYSV, and on + * entry, r11 holds the address of the closure. + * After storing the registers that could possibly contain + * parameters to be passed into the stack frame and setting + * up space for a return value, ffi_closure_SYSV invokes the + * following helper function to do most of the work + */ + +int +ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue, + unsigned long *pgr, ffi_dblfl *pfr, + unsigned long *pst) +{ + /* rvalue is the pointer to space for return value in closure assembly */ + /* pgr is the pointer to where r3-r10 are stored in ffi_closure_SYSV */ + /* pfr is the pointer to where f1-f8 are stored in ffi_closure_SYSV */ + /* pst is the pointer to outgoing parameter stack in original caller */ + + void ** avalue; + ffi_type ** arg_types; + long i, avn; + long nf; /* number of floating registers already used */ + long ng; /* number of general registers already used */ + ffi_cif * cif; + double temp; + unsigned size; + + cif = closure->cif; + avalue = alloca (cif->nargs * sizeof (void *)); + size = cif->rtype->size; + + nf = 0; + ng = 0; + + /* Copy the caller's structure return value address so that the closure + returns the data directly to the caller. + For FFI_SYSV the result is passed in r3/r4 if the struct size is less + or equal 8 bytes. */ + + if ((cif->rtype->type == FFI_TYPE_STRUCT + && !((cif->abi == FFI_SYSV) && (size <= 8))) +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + || (cif->rtype->type == FFI_TYPE_LONGDOUBLE + && cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) +#endif + ) + { + rvalue = (void *) *pgr; + ng++; + pgr++; + } + + i = 0; + avn = cif->nargs; + arg_types = cif->arg_types; + + /* Grab the addresses of the arguments from the stack frame. */ + while (i < avn) + { + switch (arg_types[i]->type) + { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + /* there are 8 gpr registers used to pass values */ + if (ng < 8) + { + avalue[i] = (char *) pgr + 3; + ng++; + pgr++; + } + else + { + avalue[i] = (char *) pst + 3; + pst++; + } + break; + + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + /* there are 8 gpr registers used to pass values */ + if (ng < 8) + { + avalue[i] = (char *) pgr + 2; + ng++; + pgr++; + } + else + { + avalue[i] = (char *) pst + 2; + pst++; + } + break; + + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + case FFI_TYPE_POINTER: + soft_float_closure: + /* there are 8 gpr registers used to pass values */ + if (ng < 8) + { + avalue[i] = pgr; + ng++; + pgr++; + } + else + { + avalue[i] = pst; + pst++; + } + break; + + case FFI_TYPE_STRUCT: +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + do_struct: +#endif + /* Structs are passed by reference. The address will appear in a + gpr if it is one of the first 8 arguments. */ + if (ng < 8) + { + avalue[i] = (void *) *pgr; + ng++; + pgr++; + } + else + { + avalue[i] = (void *) *pst; + pst++; + } + break; + + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + soft_double_closure: + /* passing long long ints are complex, they must + * be passed in suitable register pairs such as + * (r3,r4) or (r5,r6) or (r6,r7), or (r7,r8) or (r9,r10) + * and if the entire pair aren't available then the outgoing + * parameter stack is used for both but an alignment of 8 + * must will be kept. So we must either look in pgr + * or pst to find the correct address for this type + * of parameter. + */ + if (ng < 7) + { + if (ng & 0x01) + { + /* skip r4, r6, r8 as starting points */ + ng++; + pgr++; + } + avalue[i] = pgr; + ng += 2; + pgr += 2; + } + else + { + if (((long) pst) & 4) + pst++; + avalue[i] = pst; + pst += 2; + ng = 8; + } + break; + + case FFI_TYPE_FLOAT: + /* With FFI_LINUX_SOFT_FLOAT floats are handled like UINT32. */ + if (cif->abi == FFI_LINUX_SOFT_FLOAT) + goto soft_float_closure; + /* unfortunately float values are stored as doubles + * in the ffi_closure_SYSV code (since we don't check + * the type in that routine). + */ + + /* there are 8 64bit floating point registers */ + + if (nf < 8) + { + temp = pfr->d; + pfr->f = (float) temp; + avalue[i] = pfr; + nf++; + pfr++; + } + else + { + /* FIXME? here we are really changing the values + * stored in the original calling routines outgoing + * parameter stack. This is probably a really + * naughty thing to do but... + */ + avalue[i] = pst; + pst += 1; + } + break; + + case FFI_TYPE_DOUBLE: + /* With FFI_LINUX_SOFT_FLOAT doubles are handled like UINT64. */ + if (cif->abi == FFI_LINUX_SOFT_FLOAT) + goto soft_double_closure; + /* On the outgoing stack all values are aligned to 8 */ + /* there are 8 64bit floating point registers */ + + if (nf < 8) + { + avalue[i] = pfr; + nf++; + pfr++; + } + else + { + if (((long) pst) & 4) + pst++; + avalue[i] = pst; + pst += 2; + } + break; + +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + case FFI_TYPE_LONGDOUBLE: + if (cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) + goto do_struct; + if (cif->abi == FFI_LINUX_SOFT_FLOAT) + { /* Test if for the whole long double, 4 gprs are available. + otherwise the stuff ends up on the stack. */ + if (ng < 5) + { + avalue[i] = pgr; + pgr += 4; + ng += 4; + } + else + { + avalue[i] = pst; + pst += 4; + ng = 8; + } + break; + } + if (nf < 7) + { + avalue[i] = pfr; + pfr += 2; + nf += 2; + } + else + { + if (((long) pst) & 4) + pst++; + avalue[i] = pst; + pst += 4; + nf = 8; + } + break; +#endif + + default: + FFI_ASSERT (0); + } + + i++; + } + + + (closure->fun) (cif, rvalue, avalue, closure->user_data); + + /* Tell ffi_closure_SYSV how to perform return type promotions. + Because the FFI_SYSV ABI returns the structures <= 8 bytes in r3/r4 + we have to tell ffi_closure_SYSV how to treat them. We combine the base + type FFI_SYSV_TYPE_SMALL_STRUCT - 1 with the size of the struct. + So a one byte struct gets the return type 16. Return type 1 to 15 are + already used and we never have a struct with size zero. That is the reason + for the subtraction of 1. See the comment in ffitarget.h about ordering. + */ + if (cif->abi == FFI_SYSV && cif->rtype->type == FFI_TYPE_STRUCT + && size <= 8) + return (FFI_SYSV_TYPE_SMALL_STRUCT - 1) + size; +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + else if (cif->rtype->type == FFI_TYPE_LONGDOUBLE + && cif->abi != FFI_LINUX && cif->abi != FFI_LINUX_SOFT_FLOAT) + return FFI_TYPE_STRUCT; +#endif + /* With FFI_LINUX_SOFT_FLOAT floats and doubles are handled like UINT32 + respectivley UINT64. */ + if (cif->abi == FFI_LINUX_SOFT_FLOAT) + { + switch (cif->rtype->type) + { + case FFI_TYPE_FLOAT: + return FFI_TYPE_UINT32; + break; + case FFI_TYPE_DOUBLE: + return FFI_TYPE_UINT64; + break; +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + case FFI_TYPE_LONGDOUBLE: + return FFI_TYPE_UINT128; + break; +#endif + default: + return cif->rtype->type; + } + } + else + { + return cif->rtype->type; + } +} + +int FFI_HIDDEN ffi_closure_helper_LINUX64 (ffi_closure *, void *, + unsigned long *, ffi_dblfl *); + +int FFI_HIDDEN +ffi_closure_helper_LINUX64 (ffi_closure *closure, void *rvalue, + unsigned long *pst, ffi_dblfl *pfr) +{ + /* rvalue is the pointer to space for return value in closure assembly */ + /* pst is the pointer to parameter save area + (r3-r10 are stored into its first 8 slots by ffi_closure_LINUX64) */ + /* pfr is the pointer to where f1-f13 are stored in ffi_closure_LINUX64 */ + + void **avalue; + ffi_type **arg_types; + long i, avn; + ffi_cif *cif; + ffi_dblfl *end_pfr = pfr + NUM_FPR_ARG_REGISTERS64; + + cif = closure->cif; + avalue = alloca (cif->nargs * sizeof (void *)); + + /* Copy the caller's structure return value address so that the closure + returns the data directly to the caller. */ + if (cif->rtype->type == FFI_TYPE_STRUCT) + { + rvalue = (void *) *pst; + pst++; + } + + i = 0; + avn = cif->nargs; + arg_types = cif->arg_types; + + /* Grab the addresses of the arguments from the stack frame. */ + while (i < avn) + { + switch (arg_types[i]->type) + { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + avalue[i] = (char *) pst + 7; + pst++; + break; + + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + avalue[i] = (char *) pst + 6; + pst++; + break; + + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + avalue[i] = (char *) pst + 4; + pst++; + break; + + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + case FFI_TYPE_POINTER: + avalue[i] = pst; + pst++; + break; + + case FFI_TYPE_STRUCT: + /* Structures with size less than eight bytes are passed + left-padded. */ + if (arg_types[i]->size < 8) + avalue[i] = (char *) pst + 8 - arg_types[i]->size; + else + avalue[i] = pst; + pst += (arg_types[i]->size + 7) / 8; + break; + + case FFI_TYPE_FLOAT: + /* unfortunately float values are stored as doubles + * in the ffi_closure_LINUX64 code (since we don't check + * the type in that routine). + */ + + /* there are 13 64bit floating point registers */ + + if (pfr < end_pfr) + { + double temp = pfr->d; + pfr->f = (float) temp; + avalue[i] = pfr; + pfr++; + } + else + avalue[i] = pst; + pst++; + break; + + case FFI_TYPE_DOUBLE: + /* On the outgoing stack all values are aligned to 8 */ + /* there are 13 64bit floating point registers */ + + if (pfr < end_pfr) + { + avalue[i] = pfr; + pfr++; + } + else + avalue[i] = pst; + pst++; + break; + +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + case FFI_TYPE_LONGDOUBLE: + if (pfr + 1 < end_pfr) + { + avalue[i] = pfr; + pfr += 2; + } + else + { + if (pfr < end_pfr) + { + /* Passed partly in f13 and partly on the stack. + Move it all to the stack. */ + *pst = *(unsigned long *) pfr; + pfr++; + } + avalue[i] = pst; + } + pst += 2; + break; +#endif + + default: + FFI_ASSERT (0); + } + + i++; + } + + + (closure->fun) (cif, rvalue, avalue, closure->user_data); + + /* Tell ffi_closure_LINUX64 how to perform return type promotions. */ + return cif->rtype->type; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c new file mode 100644 index 000000000..ee03dab69 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/ffi_darwin.c @@ -0,0 +1,1359 @@ +/* ----------------------------------------------------------------------- + ffi_darwin.c + + Copyright (C) 1998 Geoffrey Keating + Copyright (C) 2001 John Hornkvist + Copyright (C) 2002, 2006, 2007, 2009, 2010 Free Software Foundation, Inc. + + FFI support for Darwin and AIX. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +#include + +extern void ffi_closure_ASM (void); + +enum { + /* The assembly depends on these exact flags. + For Darwin64 (when FLAG_RETURNS_STRUCT is set): + FLAG_RETURNS_FP indicates that the structure embeds FP data. + FLAG_RETURNS_128BITS signals a special struct size that is not + expanded for float content. */ + FLAG_RETURNS_128BITS = 1 << (31-31), /* These go in cr7 */ + FLAG_RETURNS_NOTHING = 1 << (31-30), + FLAG_RETURNS_FP = 1 << (31-29), + FLAG_RETURNS_64BITS = 1 << (31-28), + + FLAG_RETURNS_STRUCT = 1 << (31-27), /* This goes in cr6 */ + + FLAG_ARG_NEEDS_COPY = 1 << (31- 7), + FLAG_FP_ARGUMENTS = 1 << (31- 6), /* cr1.eq; specified by ABI */ + FLAG_4_GPR_ARGUMENTS = 1 << (31- 5), + FLAG_RETVAL_REFERENCE = 1 << (31- 4) +}; + +/* About the DARWIN ABI. */ +enum { + NUM_GPR_ARG_REGISTERS = 8, + NUM_FPR_ARG_REGISTERS = 13, + LINKAGE_AREA_GPRS = 6 +}; + +enum { ASM_NEEDS_REGISTERS = 4 }; /* r28-r31 */ + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments. + + m32/m64 + + The stack layout we want looks like this: + + | Return address from ffi_call_DARWIN | higher addresses + |--------------------------------------------| + | Previous backchain pointer 4/8 | stack pointer here + |--------------------------------------------|<+ <<< on entry to + | ASM_NEEDS_REGISTERS=r28-r31 4*(4/8) | | ffi_call_DARWIN + |--------------------------------------------| | + | When we have any FP activity... the | | + | FPRs occupy NUM_FPR_ARG_REGISTERS slots | | + | here fp13 .. fp1 from high to low addr. | | + ~ ~ ~ + | Parameters (at least 8*4/8=32/64) | | NUM_GPR_ARG_REGISTERS + |--------------------------------------------| | + | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | + |--------------------------------------------| | stack | + | Reserved 2*4/8 | | grows | + |--------------------------------------------| | down V + | Space for callee's LR 4/8 | | + |--------------------------------------------| | lower addresses + | Saved CR [low word for m64] 4/8 | | + |--------------------------------------------| | stack pointer here + | Current backchain pointer 4/8 |-/ during + |--------------------------------------------| <<< ffi_call_DARWIN + + */ + +#if defined(POWERPC_DARWIN64) +static void +darwin64_pass_struct_by_value + (ffi_type *, char *, unsigned, unsigned *, double **, unsigned long **); +#endif + +/* This depends on GPR_SIZE = sizeof (unsigned long) */ + +void +ffi_prep_args (extended_cif *ecif, unsigned long *const stack) +{ + const unsigned bytes = ecif->cif->bytes; + const unsigned flags = ecif->cif->flags; + const unsigned nargs = ecif->cif->nargs; +#if !defined(POWERPC_DARWIN64) + const ffi_abi abi = ecif->cif->abi; +#endif + + /* 'stacktop' points at the previous backchain pointer. */ + unsigned long *const stacktop = stack + (bytes / sizeof(unsigned long)); + + /* 'fpr_base' points at the space for fpr1, and grows upwards as + we use FPR registers. */ + double *fpr_base = (double *) (stacktop - ASM_NEEDS_REGISTERS) - NUM_FPR_ARG_REGISTERS; + int gp_count = 0, fparg_count = 0; + + /* 'next_arg' grows up as we put parameters in it. */ + unsigned long *next_arg = stack + LINKAGE_AREA_GPRS; /* 6 reserved positions. */ + + int i; + double double_tmp; + void **p_argv = ecif->avalue; + unsigned long gprvalue; + ffi_type** ptr = ecif->cif->arg_types; +#if !defined(POWERPC_DARWIN64) + char *dest_cpy; +#endif + unsigned size_al = 0; + + /* Check that everything starts aligned properly. */ + FFI_ASSERT(((unsigned) (char *) stack & 0xF) == 0); + FFI_ASSERT(((unsigned) (char *) stacktop & 0xF) == 0); + FFI_ASSERT((bytes & 0xF) == 0); + + /* Deal with return values that are actually pass-by-reference. + Rule: + Return values are referenced by r3, so r4 is the first parameter. */ + + if (flags & FLAG_RETVAL_REFERENCE) + *next_arg++ = (unsigned long) (char *) ecif->rvalue; + + /* Now for the arguments. */ + for (i = nargs; i > 0; i--, ptr++, p_argv++) + { + switch ((*ptr)->type) + { + /* If a floating-point parameter appears before all of the general- + purpose registers are filled, the corresponding GPRs that match + the size of the floating-point parameter are skipped. */ + case FFI_TYPE_FLOAT: + double_tmp = *(float *) *p_argv; + if (fparg_count < NUM_FPR_ARG_REGISTERS) + *fpr_base++ = double_tmp; +#if defined(POWERPC_DARWIN) + *(float *)next_arg = *(float *) *p_argv; +#else + *(double *)next_arg = double_tmp; +#endif + next_arg++; + gp_count++; + fparg_count++; + FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); + break; + + case FFI_TYPE_DOUBLE: + double_tmp = *(double *) *p_argv; + if (fparg_count < NUM_FPR_ARG_REGISTERS) + *fpr_base++ = double_tmp; + *(double *)next_arg = double_tmp; +#ifdef POWERPC64 + next_arg++; + gp_count++; +#else + next_arg += 2; + gp_count += 2; +#endif + fparg_count++; + FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); + break; + +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + + case FFI_TYPE_LONGDOUBLE: +# if defined(POWERPC64) && !defined(POWERPC_DARWIN64) + /* ??? This will exceed the regs count when the value starts at fp13 + and it will not put the extra bit on the stack. */ + if (fparg_count < NUM_FPR_ARG_REGISTERS) + *(long double *) fpr_base++ = *(long double *) *p_argv; + else + *(long double *) next_arg = *(long double *) *p_argv; + next_arg += 2; + fparg_count += 2; +# else + double_tmp = ((double *) *p_argv)[0]; + if (fparg_count < NUM_FPR_ARG_REGISTERS) + *fpr_base++ = double_tmp; + *(double *) next_arg = double_tmp; +# if defined(POWERPC_DARWIN64) + next_arg++; + gp_count++; +# else + next_arg += 2; + gp_count += 2; +# endif + fparg_count++; + double_tmp = ((double *) *p_argv)[1]; + if (fparg_count < NUM_FPR_ARG_REGISTERS) + *fpr_base++ = double_tmp; + *(double *) next_arg = double_tmp; +# if defined(POWERPC_DARWIN64) + next_arg++; + gp_count++; +# else + next_arg += 2; + gp_count += 2; +# endif + fparg_count++; +# endif + FFI_ASSERT(flags & FLAG_FP_ARGUMENTS); + break; +#endif + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: +#ifdef POWERPC64 + gprvalue = *(long long *) *p_argv; + goto putgpr; +#else + *(long long *) next_arg = *(long long *) *p_argv; + next_arg += 2; + gp_count += 2; +#endif + break; + case FFI_TYPE_POINTER: + gprvalue = *(unsigned long *) *p_argv; + goto putgpr; + case FFI_TYPE_UINT8: + gprvalue = *(unsigned char *) *p_argv; + goto putgpr; + case FFI_TYPE_SINT8: + gprvalue = *(signed char *) *p_argv; + goto putgpr; + case FFI_TYPE_UINT16: + gprvalue = *(unsigned short *) *p_argv; + goto putgpr; + case FFI_TYPE_SINT16: + gprvalue = *(signed short *) *p_argv; + goto putgpr; + + case FFI_TYPE_STRUCT: + size_al = (*ptr)->size; +#if defined(POWERPC_DARWIN64) + next_arg = (unsigned long *)ALIGN((char *)next_arg, (*ptr)->alignment); + darwin64_pass_struct_by_value (*ptr, (char *) *p_argv, + (unsigned) size_al, + (unsigned int *) &fparg_count, + &fpr_base, &next_arg); +#else + dest_cpy = (char *) next_arg; + + /* If the first member of the struct is a double, then include enough + padding in the struct size to align it to double-word. */ + if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE) + size_al = ALIGN((*ptr)->size, 8); + +# if defined(POWERPC64) + FFI_ASSERT (abi != FFI_DARWIN); + memcpy ((char *) dest_cpy, (char *) *p_argv, size_al); + next_arg += (size_al + 7) / 8; +# else + /* Structures that match the basic modes (QI 1 byte, HI 2 bytes, + SI 4 bytes) are aligned as if they were those modes. + Structures with 3 byte in size are padded upwards. */ + if (size_al < 3 && abi == FFI_DARWIN) + dest_cpy += 4 - size_al; + + memcpy((char *) dest_cpy, (char *) *p_argv, size_al); + next_arg += (size_al + 3) / 4; +# endif +#endif + break; + + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + gprvalue = *(signed int *) *p_argv; + goto putgpr; + + case FFI_TYPE_UINT32: + gprvalue = *(unsigned int *) *p_argv; + putgpr: + *next_arg++ = gprvalue; + gp_count++; + break; + default: + break; + } + } + + /* Check that we didn't overrun the stack... */ + //FFI_ASSERT(gpr_base <= stacktop - ASM_NEEDS_REGISTERS); + //FFI_ASSERT((unsigned *)fpr_base + // <= stacktop - ASM_NEEDS_REGISTERS - NUM_GPR_ARG_REGISTERS); + //FFI_ASSERT(flags & FLAG_4_GPR_ARGUMENTS || intarg_count <= 4); +} + +#if defined(POWERPC_DARWIN64) + +/* See if we can put some of the struct into fprs. + This should not be called for structures of size 16 bytes, since these are not + broken out this way. */ +static void +darwin64_scan_struct_for_floats (ffi_type *s, unsigned *nfpr) +{ + int i; + + FFI_ASSERT (s->type == FFI_TYPE_STRUCT) + + for (i = 0; s->elements[i] != NULL; i++) + { + ffi_type *p = s->elements[i]; + switch (p->type) + { + case FFI_TYPE_STRUCT: + darwin64_scan_struct_for_floats (p, nfpr); + break; + case FFI_TYPE_LONGDOUBLE: + (*nfpr) += 2; + break; + case FFI_TYPE_DOUBLE: + case FFI_TYPE_FLOAT: + (*nfpr) += 1; + break; + default: + break; + } + } +} + +static int +darwin64_struct_size_exceeds_gprs_p (ffi_type *s, char *src, unsigned *nfpr) +{ + unsigned struct_offset=0, i; + + for (i = 0; s->elements[i] != NULL; i++) + { + char *item_base; + ffi_type *p = s->elements[i]; + /* Find the start of this item (0 for the first one). */ + if (i > 0) + struct_offset = ALIGN(struct_offset, p->alignment); + + item_base = src + struct_offset; + + switch (p->type) + { + case FFI_TYPE_STRUCT: + if (darwin64_struct_size_exceeds_gprs_p (p, item_base, nfpr)) + return 1; + break; + case FFI_TYPE_LONGDOUBLE: + if (*nfpr >= NUM_FPR_ARG_REGISTERS) + return 1; + (*nfpr) += 1; + item_base += 8; + /* FALL THROUGH */ + case FFI_TYPE_DOUBLE: + if (*nfpr >= NUM_FPR_ARG_REGISTERS) + return 1; + (*nfpr) += 1; + break; + case FFI_TYPE_FLOAT: + if (*nfpr >= NUM_FPR_ARG_REGISTERS) + return 1; + (*nfpr) += 1; + break; + default: + /* If we try and place any item, that is non-float, once we've + exceeded the 8 GPR mark, then we can't fit the struct. */ + if ((unsigned long)item_base >= 8*8) + return 1; + break; + } + /* now count the size of what we just used. */ + struct_offset += p->size; + } + return 0; +} + +/* Can this struct be returned by value? */ +int +darwin64_struct_ret_by_value_p (ffi_type *s) +{ + unsigned nfp = 0; + + FFI_ASSERT (s && s->type == FFI_TYPE_STRUCT); + + /* The largest structure we can return is 8long + 13 doubles. */ + if (s->size > 168) + return 0; + + /* We can't pass more than 13 floats. */ + darwin64_scan_struct_for_floats (s, &nfp); + if (nfp > 13) + return 0; + + /* If there are not too many floats, and the struct is + small enough to accommodate in the GPRs, then it must be OK. */ + if (s->size <= 64) + return 1; + + /* Well, we have to look harder. */ + nfp = 0; + if (darwin64_struct_size_exceeds_gprs_p (s, NULL, &nfp)) + return 0; + + return 1; +} + +void +darwin64_pass_struct_floats (ffi_type *s, char *src, + unsigned *nfpr, double **fprs) +{ + int i; + double *fpr_base = *fprs; + unsigned struct_offset = 0; + + /* We don't assume anything about the alignment of the source. */ + for (i = 0; s->elements[i] != NULL; i++) + { + char *item_base; + ffi_type *p = s->elements[i]; + /* Find the start of this item (0 for the first one). */ + if (i > 0) + struct_offset = ALIGN(struct_offset, p->alignment); + item_base = src + struct_offset; + + switch (p->type) + { + case FFI_TYPE_STRUCT: + darwin64_pass_struct_floats (p, item_base, nfpr, + &fpr_base); + break; + case FFI_TYPE_LONGDOUBLE: + if (*nfpr < NUM_FPR_ARG_REGISTERS) + *fpr_base++ = *(double *)item_base; + (*nfpr) += 1; + item_base += 8; + /* FALL THROUGH */ + case FFI_TYPE_DOUBLE: + if (*nfpr < NUM_FPR_ARG_REGISTERS) + *fpr_base++ = *(double *)item_base; + (*nfpr) += 1; + break; + case FFI_TYPE_FLOAT: + if (*nfpr < NUM_FPR_ARG_REGISTERS) + *fpr_base++ = (double) *(float *)item_base; + (*nfpr) += 1; + break; + default: + break; + } + /* now count the size of what we just used. */ + struct_offset += p->size; + } + /* Update the scores. */ + *fprs = fpr_base; +} + +/* Darwin64 special rules. + Break out a struct into params and float registers. */ +static void +darwin64_pass_struct_by_value (ffi_type *s, char *src, unsigned size, + unsigned *nfpr, double **fprs, unsigned long **arg) +{ + unsigned long *next_arg = *arg; + char *dest_cpy = (char *)next_arg; + + FFI_ASSERT (s->type == FFI_TYPE_STRUCT) + + if (!size) + return; + + /* First... special cases. */ + if (size < 3 + || (size == 4 + && s->elements[0] + && s->elements[0]->type != FFI_TYPE_FLOAT)) + { + /* Must be at least one GPR, padding is unspecified in value, + let's make it zero. */ + *next_arg = 0UL; + dest_cpy += 8 - size; + memcpy ((char *) dest_cpy, src, size); + next_arg++; + } + else if (size == 16) + { + memcpy ((char *) dest_cpy, src, size); + next_arg += 2; + } + else + { + /* now the general case, we consider embedded floats. */ + memcpy ((char *) dest_cpy, src, size); + darwin64_pass_struct_floats (s, src, nfpr, fprs); + next_arg += (size+7)/8; + } + + *arg = next_arg; +} + +double * +darwin64_struct_floats_to_mem (ffi_type *s, char *dest, double *fprs, unsigned *nf) +{ + int i; + unsigned struct_offset = 0; + + /* We don't assume anything about the alignment of the source. */ + for (i = 0; s->elements[i] != NULL; i++) + { + char *item_base; + ffi_type *p = s->elements[i]; + /* Find the start of this item (0 for the first one). */ + if (i > 0) + struct_offset = ALIGN(struct_offset, p->alignment); + item_base = dest + struct_offset; + + switch (p->type) + { + case FFI_TYPE_STRUCT: + fprs = darwin64_struct_floats_to_mem (p, item_base, fprs, nf); + break; + case FFI_TYPE_LONGDOUBLE: + if (*nf < NUM_FPR_ARG_REGISTERS) + { + *(double *)item_base = *fprs++ ; + (*nf) += 1; + } + item_base += 8; + /* FALL THROUGH */ + case FFI_TYPE_DOUBLE: + if (*nf < NUM_FPR_ARG_REGISTERS) + { + *(double *)item_base = *fprs++ ; + (*nf) += 1; + } + break; + case FFI_TYPE_FLOAT: + if (*nf < NUM_FPR_ARG_REGISTERS) + { + *(float *)item_base = (float) *fprs++ ; + (*nf) += 1; + } + break; + default: + break; + } + /* now count the size of what we just used. */ + struct_offset += p->size; + } + return fprs; +} + +#endif + +/* Adjust the size of S to be correct for Darwin. + On Darwin m32, the first field of a structure has natural alignment. + On Darwin m64, all fields have natural alignment. */ + +static void +darwin_adjust_aggregate_sizes (ffi_type *s) +{ + int i; + + if (s->type != FFI_TYPE_STRUCT) + return; + + s->size = 0; + for (i = 0; s->elements[i] != NULL; i++) + { + ffi_type *p; + int align; + + p = s->elements[i]; + if (p->type == FFI_TYPE_STRUCT) + darwin_adjust_aggregate_sizes (p); +#if defined(POWERPC_DARWIN64) + /* Natural alignment for all items. */ + align = p->alignment; +#else + /* Natrual alignment for the first item... */ + if (i == 0) + align = p->alignment; + else if (p->alignment == 16 || p->alignment < 4) + /* .. subsequent items with vector or align < 4 have natural align. */ + align = p->alignment; + else + /* .. or align is 4. */ + align = 4; +#endif + /* Pad, if necessary, before adding the current item. */ + s->size = ALIGN(s->size, align) + p->size; + } + + s->size = ALIGN(s->size, s->alignment); + + /* This should not be necessary on m64, but harmless. */ + if (s->elements[0]->type == FFI_TYPE_UINT64 + || s->elements[0]->type == FFI_TYPE_SINT64 + || s->elements[0]->type == FFI_TYPE_DOUBLE + || s->elements[0]->alignment == 8) + s->alignment = s->alignment > 8 ? s->alignment : 8; + /* Do not add additional tail padding. */ +} + +/* Adjust the size of S to be correct for AIX. + Word-align double unless it is the first member of a structure. */ + +static void +aix_adjust_aggregate_sizes (ffi_type *s) +{ + int i; + + if (s->type != FFI_TYPE_STRUCT) + return; + + s->size = 0; + for (i = 0; s->elements[i] != NULL; i++) + { + ffi_type *p; + int align; + + p = s->elements[i]; + aix_adjust_aggregate_sizes (p); + align = p->alignment; + if (i != 0 && p->type == FFI_TYPE_DOUBLE) + align = 4; + s->size = ALIGN(s->size, align) + p->size; + } + + s->size = ALIGN(s->size, s->alignment); + + if (s->elements[0]->type == FFI_TYPE_UINT64 + || s->elements[0]->type == FFI_TYPE_SINT64 + || s->elements[0]->type == FFI_TYPE_DOUBLE + || s->elements[0]->alignment == 8) + s->alignment = s->alignment > 8 ? s->alignment : 8; + /* Do not add additional tail padding. */ +} + +/* Perform machine dependent cif processing. */ +ffi_status +ffi_prep_cif_machdep (ffi_cif *cif) +{ + /* All this is for the DARWIN ABI. */ + unsigned i; + ffi_type **ptr; + unsigned bytes; + unsigned fparg_count = 0, intarg_count = 0; + unsigned flags = 0; + unsigned size_al = 0; + + /* All the machine-independent calculation of cif->bytes will be wrong. + All the calculation of structure sizes will also be wrong. + Redo the calculation for DARWIN. */ + + if (cif->abi == FFI_DARWIN) + { + darwin_adjust_aggregate_sizes (cif->rtype); + for (i = 0; i < cif->nargs; i++) + darwin_adjust_aggregate_sizes (cif->arg_types[i]); + } + + if (cif->abi == FFI_AIX) + { + aix_adjust_aggregate_sizes (cif->rtype); + for (i = 0; i < cif->nargs; i++) + aix_adjust_aggregate_sizes (cif->arg_types[i]); + } + + /* Space for the frame pointer, callee's LR, CR, etc, and for + the asm's temp regs. */ + + bytes = (LINKAGE_AREA_GPRS + ASM_NEEDS_REGISTERS) * sizeof(unsigned long); + + /* Return value handling. + The rules m32 are as follows: + - 32-bit (or less) integer values are returned in gpr3; + - structures of size <= 4 bytes also returned in gpr3; + - 64-bit integer values [??? and structures between 5 and 8 bytes] are + returned in gpr3 and gpr4; + - Single/double FP values are returned in fpr1; + - Long double FP (if not equivalent to double) values are returned in + fpr1 and fpr2; + m64: + - 64-bit or smaller integral values are returned in GPR3 + - Single/double FP values are returned in fpr1; + - Long double FP values are returned in fpr1 and fpr2; + m64 Structures: + - If the structure could be accommodated in registers were it to be the + first argument to a routine, then it is returned in those registers. + m32/m64 structures otherwise: + - Larger structures values are allocated space and a pointer is passed + as the first argument. */ + switch (cif->rtype->type) + { + +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + case FFI_TYPE_LONGDOUBLE: + flags |= FLAG_RETURNS_128BITS; + flags |= FLAG_RETURNS_FP; + break; +#endif + + case FFI_TYPE_DOUBLE: + flags |= FLAG_RETURNS_64BITS; + /* Fall through. */ + case FFI_TYPE_FLOAT: + flags |= FLAG_RETURNS_FP; + break; + + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: +#ifdef POWERPC64 + case FFI_TYPE_POINTER: +#endif + flags |= FLAG_RETURNS_64BITS; + break; + + case FFI_TYPE_STRUCT: +#if defined(POWERPC_DARWIN64) + { + /* Can we fit the struct into regs? */ + if (darwin64_struct_ret_by_value_p (cif->rtype)) + { + unsigned nfpr = 0; + flags |= FLAG_RETURNS_STRUCT; + if (cif->rtype->size != 16) + darwin64_scan_struct_for_floats (cif->rtype, &nfpr) ; + else + flags |= FLAG_RETURNS_128BITS; + /* Will be 0 for 16byte struct. */ + if (nfpr) + flags |= FLAG_RETURNS_FP; + } + else /* By ref. */ + { + flags |= FLAG_RETVAL_REFERENCE; + flags |= FLAG_RETURNS_NOTHING; + intarg_count++; + } + } +#elif defined(DARWIN_PPC) + if (cif->rtype->size <= 4) + flags |= FLAG_RETURNS_STRUCT; + else /* else by reference. */ + { + flags |= FLAG_RETVAL_REFERENCE; + flags |= FLAG_RETURNS_NOTHING; + intarg_count++; + } +#else /* assume we pass by ref. */ + flags |= FLAG_RETVAL_REFERENCE; + flags |= FLAG_RETURNS_NOTHING; + intarg_count++; +#endif + break; + case FFI_TYPE_VOID: + flags |= FLAG_RETURNS_NOTHING; + break; + + default: + /* Returns 32-bit integer, or similar. Nothing to do here. */ + break; + } + + /* The first NUM_GPR_ARG_REGISTERS words of integer arguments, and the + first NUM_FPR_ARG_REGISTERS fp arguments, go in registers; the rest + goes on the stack. + ??? Structures are passed as a pointer to a copy of the structure. + Stuff on the stack needs to keep proper alignment. + For m64 the count is effectively of half-GPRs. */ + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) + { + unsigned align_words; + switch ((*ptr)->type) + { + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + fparg_count++; +#if !defined(POWERPC_DARWIN64) + /* If this FP arg is going on the stack, it must be + 8-byte-aligned. */ + if (fparg_count > NUM_FPR_ARG_REGISTERS + && (intarg_count & 0x01) != 0) + intarg_count++; +#endif + break; + +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + case FFI_TYPE_LONGDOUBLE: + fparg_count += 2; + /* If this FP arg is going on the stack, it must be + 16-byte-aligned. */ + if (fparg_count >= NUM_FPR_ARG_REGISTERS) +#if defined (POWERPC64) + intarg_count = ALIGN(intarg_count, 2); +#else + intarg_count = ALIGN(intarg_count, 4); +#endif + break; +#endif + + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: +#if defined(POWERPC64) + intarg_count++; +#else + /* 'long long' arguments are passed as two words, but + either both words must fit in registers or both go + on the stack. If they go on the stack, they must + be 8-byte-aligned. */ + if (intarg_count == NUM_GPR_ARG_REGISTERS-1 + || (intarg_count >= NUM_GPR_ARG_REGISTERS + && (intarg_count & 0x01) != 0)) + intarg_count++; + intarg_count += 2; +#endif + break; + + case FFI_TYPE_STRUCT: + size_al = (*ptr)->size; +#if defined(POWERPC_DARWIN64) + align_words = (*ptr)->alignment >> 3; + if (align_words) + intarg_count = ALIGN(intarg_count, align_words); + /* Base size of the struct. */ + intarg_count += (size_al + 7) / 8; + /* If 16 bytes then don't worry about floats. */ + if (size_al != 16) + /* Scan through for floats to be placed in regs. */ + darwin64_scan_struct_for_floats (*ptr, &fparg_count) ; +#else + align_words = (*ptr)->alignment >> 2; + if (align_words) + intarg_count = ALIGN(intarg_count, align_words); + /* If the first member of the struct is a double, then align + the struct to double-word. + if ((*ptr)->elements[0]->type == FFI_TYPE_DOUBLE) + size_al = ALIGN((*ptr)->size, 8); */ +# ifdef POWERPC64 + intarg_count += (size_al + 7) / 8; +# else + intarg_count += (size_al + 3) / 4; +# endif +#endif + break; + + default: + /* Everything else is passed as a 4-byte word in a GPR, either + the object itself or a pointer to it. */ + intarg_count++; + break; + } + } + + if (fparg_count != 0) + flags |= FLAG_FP_ARGUMENTS; + +#if defined(POWERPC_DARWIN64) + /* Space to image the FPR registers, if needed - which includes when they might be + used in a struct return. */ + if (fparg_count != 0 + || ((flags & FLAG_RETURNS_STRUCT) + && (flags & FLAG_RETURNS_FP))) + bytes += NUM_FPR_ARG_REGISTERS * sizeof(double); +#else + /* Space for the FPR registers, if needed. */ + if (fparg_count != 0) + bytes += NUM_FPR_ARG_REGISTERS * sizeof(double); +#endif + + /* Stack space. */ +#ifdef POWERPC64 + if ((intarg_count + fparg_count) > NUM_GPR_ARG_REGISTERS) + bytes += (intarg_count + fparg_count) * sizeof(long); +#else + if ((intarg_count + 2 * fparg_count) > NUM_GPR_ARG_REGISTERS) + bytes += (intarg_count + 2 * fparg_count) * sizeof(long); +#endif + else + bytes += NUM_GPR_ARG_REGISTERS * sizeof(long); + + /* The stack space allocated needs to be a multiple of 16 bytes. */ + bytes = ALIGN(bytes, 16) ; + + cif->flags = flags; + cif->bytes = bytes; + + return FFI_OK; +} + +extern void ffi_call_AIX(extended_cif *, long, unsigned, unsigned *, + void (*fn)(void), void (*fn2)(void)); + +extern void ffi_call_DARWIN(extended_cif *, long, unsigned, unsigned *, + void (*fn)(void), void (*fn2)(void), ffi_type*); + +void +ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return + value address then we need to make one. */ + + if ((rvalue == NULL) && + (cif->rtype->type == FFI_TYPE_STRUCT)) + { + ecif.rvalue = alloca (cif->rtype->size); + } + else + ecif.rvalue = rvalue; + + switch (cif->abi) + { + case FFI_AIX: + ffi_call_AIX(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn, + FFI_FN(ffi_prep_args)); + break; + case FFI_DARWIN: + ffi_call_DARWIN(&ecif, -(long)cif->bytes, cif->flags, ecif.rvalue, fn, + FFI_FN(ffi_prep_args), cif->rtype); + break; + default: + FFI_ASSERT(0); + break; + } +} + +static void flush_icache(char *); +static void flush_range(char *, int); + +/* The layout of a function descriptor. A C function pointer really + points to one of these. */ + +typedef struct aix_fd_struct { + void *code_pointer; + void *toc; +} aix_fd; + +/* here I'd like to add the stack frame layout we use in darwin_closure.S + and aix_closure.S + + m32/m64 + + The stack layout looks like this: + + | Additional params... | | Higher address + ~ ~ ~ + | Parameters (at least 8*4/8=32/64) | | NUM_GPR_ARG_REGISTERS + |--------------------------------------------| | + | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | + |--------------------------------------------| | + | Reserved 2*4/8 | | + |--------------------------------------------| | + | Space for callee's LR 4/8 | | + |--------------------------------------------| | + | Saved CR [low word for m64] 4/8 | | + |--------------------------------------------| | + | Current backchain pointer 4/8 |-/ Parent's frame. + |--------------------------------------------| <+ <<< on entry to ffi_closure_ASM + | Result Bytes 16 | | + |--------------------------------------------| | + ~ padding to 16-byte alignment ~ ~ + |--------------------------------------------| | + | NUM_FPR_ARG_REGISTERS slots | | + | here fp13 .. fp1 13*8 | | + |--------------------------------------------| | + | R3..R10 8*4/8=32/64 | | NUM_GPR_ARG_REGISTERS + |--------------------------------------------| | + | TOC=R2 (AIX) Reserved (Darwin) 4/8 | | + |--------------------------------------------| | stack | + | Reserved [compiler,binder] 2*4/8 | | grows | + |--------------------------------------------| | down V + | Space for callee's LR 4/8 | | + |--------------------------------------------| | lower addresses + | Saved CR [low word for m64] 4/8 | | + |--------------------------------------------| | stack pointer here + | Current backchain pointer 4/8 |-/ during + |--------------------------------------------| <<< ffi_closure_ASM. + +*/ + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void *user_data, + void *codeloc) +{ + unsigned int *tramp; + struct ffi_aix_trampoline_struct *tramp_aix; + aix_fd *fd; + + switch (cif->abi) + { + case FFI_DARWIN: + + FFI_ASSERT (cif->abi == FFI_DARWIN); + + tramp = (unsigned int *) &closure->tramp[0]; +#if defined(POWERPC_DARWIN64) + tramp[0] = 0x7c0802a6; /* mflr r0 */ + tramp[1] = 0x429f0015; /* bcl- 20,4*cr7+so, +0x18 (L1) */ + /* We put the addresses here. */ + tramp[6] = 0x7d6802a6; /*L1: mflr r11 */ + tramp[7] = 0xe98b0000; /* ld r12,0(r11) function address */ + tramp[8] = 0x7c0803a6; /* mtlr r0 */ + tramp[9] = 0x7d8903a6; /* mtctr r12 */ + tramp[10] = 0xe96b0008; /* lwz r11,8(r11) static chain */ + tramp[11] = 0x4e800420; /* bctr */ + + *((unsigned long *)&tramp[2]) = (unsigned long) ffi_closure_ASM; /* function */ + *((unsigned long *)&tramp[4]) = (unsigned long) codeloc; /* context */ +#else + tramp[0] = 0x7c0802a6; /* mflr r0 */ + tramp[1] = 0x429f000d; /* bcl- 20,4*cr7+so,0x10 */ + tramp[4] = 0x7d6802a6; /* mflr r11 */ + tramp[5] = 0x818b0000; /* lwz r12,0(r11) function address */ + tramp[6] = 0x7c0803a6; /* mtlr r0 */ + tramp[7] = 0x7d8903a6; /* mtctr r12 */ + tramp[8] = 0x816b0004; /* lwz r11,4(r11) static chain */ + tramp[9] = 0x4e800420; /* bctr */ + tramp[2] = (unsigned long) ffi_closure_ASM; /* function */ + tramp[3] = (unsigned long) codeloc; /* context */ +#endif + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + + /* Flush the icache. Only necessary on Darwin. */ + flush_range(codeloc, FFI_TRAMPOLINE_SIZE); + + break; + + case FFI_AIX: + + tramp_aix = (struct ffi_aix_trampoline_struct *) (closure->tramp); + fd = (aix_fd *)(void *)ffi_closure_ASM; + + FFI_ASSERT (cif->abi == FFI_AIX); + + tramp_aix->code_pointer = fd->code_pointer; + tramp_aix->toc = fd->toc; + tramp_aix->static_chain = codeloc; + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + + default: + + FFI_ASSERT(0); + break; + } + return FFI_OK; +} + +static void +flush_icache(char *addr) +{ +#ifndef _AIX + __asm__ volatile ( + "dcbf 0,%0\n" + "\tsync\n" + "\ticbi 0,%0\n" + "\tsync\n" + "\tisync" + : : "r"(addr) : "memory"); +#endif +} + +static void +flush_range(char * addr1, int size) +{ +#define MIN_LINE_SIZE 32 + int i; + for (i = 0; i < size; i += MIN_LINE_SIZE) + flush_icache(addr1+i); + flush_icache(addr1+size-1); +} + +typedef union +{ + float f; + double d; +} ffi_dblfl; + +ffi_type * +ffi_closure_helper_DARWIN (ffi_closure *, void *, + unsigned long *, ffi_dblfl *); + +/* Basically the trampoline invokes ffi_closure_ASM, and on + entry, r11 holds the address of the closure. + After storing the registers that could possibly contain + parameters to be passed into the stack frame and setting + up space for a return value, ffi_closure_ASM invokes the + following helper function to do most of the work. */ + +ffi_type * +ffi_closure_helper_DARWIN (ffi_closure *closure, void *rvalue, + unsigned long *pgr, ffi_dblfl *pfr) +{ + /* rvalue is the pointer to space for return value in closure assembly + pgr is the pointer to where r3-r10 are stored in ffi_closure_ASM + pfr is the pointer to where f1-f13 are stored in ffi_closure_ASM. */ + + typedef double ldbits[2]; + + union ldu + { + ldbits lb; + long double ld; + }; + + void ** avalue; + ffi_type ** arg_types; + long i, avn; + ffi_cif * cif; + ffi_dblfl * end_pfr = pfr + NUM_FPR_ARG_REGISTERS; + unsigned size_al; +#if defined(POWERPC_DARWIN64) + unsigned fpsused = 0; +#endif + + cif = closure->cif; + avalue = alloca (cif->nargs * sizeof(void *)); + + if (cif->rtype->type == FFI_TYPE_STRUCT) + { +#if defined(POWERPC_DARWIN64) + if (!darwin64_struct_ret_by_value_p (cif->rtype)) + { + /* Won't fit into the regs - return by ref. */ + rvalue = (void *) *pgr; + pgr++; + } +#elif defined(DARWIN_PPC) + if (cif->rtype->size > 4) + { + rvalue = (void *) *pgr; + pgr++; + } +#else /* assume we return by ref. */ + rvalue = (void *) *pgr; + pgr++; +#endif + } + + i = 0; + avn = cif->nargs; + arg_types = cif->arg_types; + + /* Grab the addresses of the arguments from the stack frame. */ + while (i < avn) + { + switch (arg_types[i]->type) + { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: +#if defined(POWERPC64) + avalue[i] = (char *) pgr + 7; +#else + avalue[i] = (char *) pgr + 3; +#endif + pgr++; + break; + + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: +#if defined(POWERPC64) + avalue[i] = (char *) pgr + 6; +#else + avalue[i] = (char *) pgr + 2; +#endif + pgr++; + break; + + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: +#if defined(POWERPC64) + avalue[i] = (char *) pgr + 4; +#else + case FFI_TYPE_POINTER: + avalue[i] = pgr; +#endif + pgr++; + break; + + case FFI_TYPE_STRUCT: + size_al = arg_types[i]->size; +#if defined(POWERPC_DARWIN64) + pgr = (unsigned long *)ALIGN((char *)pgr, arg_types[i]->alignment); + if (size_al < 3 || size_al == 4) + { + avalue[i] = ((char *)pgr)+8-size_al; + if (arg_types[i]->elements[0]->type == FFI_TYPE_FLOAT + && fpsused < NUM_FPR_ARG_REGISTERS) + { + *(float *)pgr = (float) *(double *)pfr; + pfr++; + fpsused++; + } + } + else + { + if (size_al != 16) + pfr = (ffi_dblfl *) + darwin64_struct_floats_to_mem (arg_types[i], (char *)pgr, + (double *)pfr, &fpsused); + avalue[i] = pgr; + } + pgr += (size_al + 7) / 8; +#else + /* If the first member of the struct is a double, then align + the struct to double-word. */ + if (arg_types[i]->elements[0]->type == FFI_TYPE_DOUBLE) + size_al = ALIGN(arg_types[i]->size, 8); +# if defined(POWERPC64) + FFI_ASSERT (cif->abi != FFI_DARWIN) + avalue[i] = pgr; + pgr += (size_al + 7) / 8; +# else + /* Structures that match the basic modes (QI 1 byte, HI 2 bytes, + SI 4 bytes) are aligned as if they were those modes. */ + if (size_al < 3 && cif->abi == FFI_DARWIN) + avalue[i] = (char*) pgr + 4 - size_al; + else + avalue[i] = pgr; + pgr += (size_al + 3) / 4; +# endif +#endif + break; + + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: +#if defined(POWERPC64) + case FFI_TYPE_POINTER: + avalue[i] = pgr; + pgr++; + break; +#else + /* Long long ints are passed in two gpr's. */ + avalue[i] = pgr; + pgr += 2; + break; +#endif + + case FFI_TYPE_FLOAT: + /* A float value consumes a GPR. + There are 13 64bit floating point registers. */ + if (pfr < end_pfr) + { + double temp = pfr->d; + pfr->f = (float) temp; + avalue[i] = pfr; + pfr++; + } + else + { + avalue[i] = pgr; + } + pgr++; + break; + + case FFI_TYPE_DOUBLE: + /* A double value consumes two GPRs. + There are 13 64bit floating point registers. */ + if (pfr < end_pfr) + { + avalue[i] = pfr; + pfr++; + } + else + { + avalue[i] = pgr; + } +#ifdef POWERPC64 + pgr++; +#else + pgr += 2; +#endif + break; + +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + + case FFI_TYPE_LONGDOUBLE: +#ifdef POWERPC64 + if (pfr + 1 < end_pfr) + { + avalue[i] = pfr; + pfr += 2; + } + else + { + if (pfr < end_pfr) + { + *pgr = *(unsigned long *) pfr; + pfr++; + } + avalue[i] = pgr; + } + pgr += 2; +#else /* POWERPC64 */ + /* A long double value consumes four GPRs and two FPRs. + There are 13 64bit floating point registers. */ + if (pfr + 1 < end_pfr) + { + avalue[i] = pfr; + pfr += 2; + } + /* Here we have the situation where one part of the long double + is stored in fpr13 and the other part is already on the stack. + We use a union to pass the long double to avalue[i]. */ + else if (pfr + 1 == end_pfr) + { + union ldu temp_ld; + memcpy (&temp_ld.lb[0], pfr, sizeof(ldbits)); + memcpy (&temp_ld.lb[1], pgr + 2, sizeof(ldbits)); + avalue[i] = &temp_ld.ld; + pfr++; + } + else + { + avalue[i] = pgr; + } + pgr += 4; +#endif /* POWERPC64 */ + break; +#endif + default: + FFI_ASSERT(0); + } + i++; + } + + (closure->fun) (cif, rvalue, avalue, closure->user_data); + + /* Tell ffi_closure_ASM to perform return type promotions. */ + return cif->rtype; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/ffitarget.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/ffitarget.h new file mode 100644 index 000000000..d17f7312d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/ffitarget.h @@ -0,0 +1,139 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + Copyright (C) 2007, 2008, 2010 Free Software Foundation, Inc + Target configuration macros for PowerPC. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +/* ---- System specific configurations ----------------------------------- */ + +#if defined (POWERPC) && defined (__powerpc64__) /* linux64 */ +#ifndef POWERPC64 +#define POWERPC64 +#endif +#elif defined (POWERPC_DARWIN) && defined (__ppc64__) /* Darwin64 */ +#ifndef POWERPC64 +#define POWERPC64 +#endif +#ifndef POWERPC_DARWIN64 +#define POWERPC_DARWIN64 +#endif +#elif defined (POWERPC_AIX) && defined (__64BIT__) /* AIX64 */ +#ifndef POWERPC64 +#define POWERPC64 +#endif +#endif + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + +#ifdef POWERPC + FFI_SYSV, + FFI_GCC_SYSV, + FFI_LINUX64, + FFI_LINUX, + FFI_LINUX_SOFT_FLOAT, +# ifdef POWERPC64 + FFI_DEFAULT_ABI = FFI_LINUX64, +# else +# if (!defined(__NO_FPRS__) && (__LDBL_MANT_DIG__ == 106)) + FFI_DEFAULT_ABI = FFI_LINUX, +# else +# ifdef __NO_FPRS__ + FFI_DEFAULT_ABI = FFI_LINUX_SOFT_FLOAT, +# else + FFI_DEFAULT_ABI = FFI_GCC_SYSV, +# endif +# endif +# endif +#endif + +#ifdef POWERPC_AIX + FFI_AIX, + FFI_DARWIN, + FFI_DEFAULT_ABI = FFI_AIX, +#endif + +#ifdef POWERPC_DARWIN + FFI_AIX, + FFI_DARWIN, + FFI_DEFAULT_ABI = FFI_DARWIN, +#endif + +#ifdef POWERPC_FREEBSD + FFI_SYSV, + FFI_GCC_SYSV, + FFI_LINUX64, + FFI_LINUX, + FFI_LINUX_SOFT_FLOAT, + FFI_DEFAULT_ABI = FFI_SYSV, +#endif + + FFI_LAST_ABI +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_NATIVE_RAW_API 0 + +/* For additional types like the below, take care about the order in + ppc_closures.S. They must follow after the FFI_TYPE_LAST. */ + +/* Needed for soft-float long-double-128 support. */ +#define FFI_TYPE_UINT128 (FFI_TYPE_LAST + 1) + +/* Needed for FFI_SYSV small structure returns. + We use two flag bits, (FLAG_SYSV_SMST_R3, FLAG_SYSV_SMST_R4) which are + defined in ffi.c, to determine the exact return type and its size. */ +#define FFI_SYSV_TYPE_SMALL_STRUCT (FFI_TYPE_LAST + 2) + +#if defined(POWERPC64) || defined(POWERPC_AIX) +# if defined(POWERPC_DARWIN64) +# define FFI_TRAMPOLINE_SIZE 48 +# else +# define FFI_TRAMPOLINE_SIZE 24 +# endif +#else /* POWERPC || POWERPC_AIX */ +# define FFI_TRAMPOLINE_SIZE 40 +#endif + +#ifndef LIBFFI_ASM +#if defined(POWERPC_DARWIN) || defined(POWERPC_AIX) +struct ffi_aix_trampoline_struct { + void * code_pointer; /* Pointer to ffi_closure_ASM */ + void * toc; /* TOC */ + void * static_chain; /* Pointer to closure */ +}; +#endif +#endif + +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/linux64.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/linux64.S new file mode 100644 index 000000000..57b56cbb2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/linux64.S @@ -0,0 +1,187 @@ +/* ----------------------------------------------------------------------- + sysv.h - Copyright (c) 2003 Jakub Jelinek + Copyright (c) 2008 Red Hat, Inc. + + PowerPC64 Assembly glue. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + +#ifdef __powerpc64__ + .hidden ffi_call_LINUX64, .ffi_call_LINUX64 + .globl ffi_call_LINUX64, .ffi_call_LINUX64 + .section ".opd","aw" + .align 3 +ffi_call_LINUX64: + .quad .ffi_call_LINUX64,.TOC.@tocbase,0 + .size ffi_call_LINUX64,24 + .type .ffi_call_LINUX64,@function + .text +.ffi_call_LINUX64: +.LFB1: + mflr %r0 + std %r28, -32(%r1) + std %r29, -24(%r1) + std %r30, -16(%r1) + std %r31, -8(%r1) + std %r0, 16(%r1) + + mr %r28, %r1 /* our AP. */ +.LCFI0: + stdux %r1, %r1, %r4 + mr %r31, %r5 /* flags, */ + mr %r30, %r6 /* rvalue, */ + mr %r29, %r7 /* function address. */ + std %r2, 40(%r1) + + /* Call ffi_prep_args64. */ + mr %r4, %r1 + bl .ffi_prep_args64 + + ld %r0, 0(%r29) + ld %r2, 8(%r29) + ld %r11, 16(%r29) + + /* Now do the call. */ + /* Set up cr1 with bits 4-7 of the flags. */ + mtcrf 0x40, %r31 + + /* Get the address to call into CTR. */ + mtctr %r0 + /* Load all those argument registers. */ + ld %r3, -32-(8*8)(%r28) + ld %r4, -32-(7*8)(%r28) + ld %r5, -32-(6*8)(%r28) + ld %r6, -32-(5*8)(%r28) + bf- 5, 1f + ld %r7, -32-(4*8)(%r28) + ld %r8, -32-(3*8)(%r28) + ld %r9, -32-(2*8)(%r28) + ld %r10, -32-(1*8)(%r28) +1: + + /* Load all the FP registers. */ + bf- 6, 2f + lfd %f1, -32-(21*8)(%r28) + lfd %f2, -32-(20*8)(%r28) + lfd %f3, -32-(19*8)(%r28) + lfd %f4, -32-(18*8)(%r28) + lfd %f5, -32-(17*8)(%r28) + lfd %f6, -32-(16*8)(%r28) + lfd %f7, -32-(15*8)(%r28) + lfd %f8, -32-(14*8)(%r28) + lfd %f9, -32-(13*8)(%r28) + lfd %f10, -32-(12*8)(%r28) + lfd %f11, -32-(11*8)(%r28) + lfd %f12, -32-(10*8)(%r28) + lfd %f13, -32-(9*8)(%r28) +2: + + /* Make the call. */ + bctrl + + /* This must follow the call immediately, the unwinder + uses this to find out if r2 has been saved or not. */ + ld %r2, 40(%r1) + + /* Now, deal with the return value. */ + mtcrf 0x01, %r31 + bt- 30, .Ldone_return_value + bt- 29, .Lfp_return_value + std %r3, 0(%r30) + /* Fall through... */ + +.Ldone_return_value: + /* Restore the registers we used and return. */ + mr %r1, %r28 + ld %r0, 16(%r28) + ld %r28, -32(%r1) + mtlr %r0 + ld %r29, -24(%r1) + ld %r30, -16(%r1) + ld %r31, -8(%r1) + blr + +.Lfp_return_value: + bf 28, .Lfloat_return_value + stfd %f1, 0(%r30) + mtcrf 0x02, %r31 /* cr6 */ + bf 27, .Ldone_return_value + stfd %f2, 8(%r30) + b .Ldone_return_value +.Lfloat_return_value: + stfs %f1, 0(%r30) + b .Ldone_return_value +.LFE1: + .long 0 + .byte 0,12,0,1,128,4,0,0 + .size .ffi_call_LINUX64,.-.ffi_call_LINUX64 + + .section .eh_frame,EH_FRAME_FLAGS,@progbits +.Lframe1: + .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry +.LSCIE1: + .4byte 0x0 # CIE Identifier Tag + .byte 0x1 # CIE Version + .ascii "zR\0" # CIE Augmentation + .uleb128 0x1 # CIE Code Alignment Factor + .sleb128 -8 # CIE Data Alignment Factor + .byte 0x41 # CIE RA Column + .uleb128 0x1 # Augmentation size + .byte 0x14 # FDE Encoding (pcrel udata8) + .byte 0xc # DW_CFA_def_cfa + .uleb128 0x1 + .uleb128 0x0 + .align 3 +.LECIE1: +.LSFDE1: + .4byte .LEFDE1-.LASFDE1 # FDE Length +.LASFDE1: + .4byte .LASFDE1-.Lframe1 # FDE CIE offset + .8byte .LFB1-. # FDE initial location + .8byte .LFE1-.LFB1 # FDE address range + .uleb128 0x0 # Augmentation size + .byte 0x2 # DW_CFA_advance_loc1 + .byte .LCFI0-.LFB1 + .byte 0xd # DW_CFA_def_cfa_register + .uleb128 0x1c + .byte 0x11 # DW_CFA_offset_extended_sf + .uleb128 0x41 + .sleb128 -2 + .byte 0x9f # DW_CFA_offset, column 0x1f + .uleb128 0x1 + .byte 0x9e # DW_CFA_offset, column 0x1e + .uleb128 0x2 + .byte 0x9d # DW_CFA_offset, column 0x1d + .uleb128 0x3 + .byte 0x9c # DW_CFA_offset, column 0x1c + .uleb128 0x4 + .align 3 +.LEFDE1: +#endif + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/linux64_closure.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/linux64_closure.S new file mode 100644 index 000000000..f7aa2c98e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/linux64_closure.S @@ -0,0 +1,236 @@ +/* ----------------------------------------------------------------------- + sysv.h - Copyright (c) 2003 Jakub Jelinek + Copyright (c) 2008 Red Hat, Inc. + + PowerPC64 Assembly glue. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ +#define LIBFFI_ASM +#include +#include + + .file "linux64_closure.S" + +#ifdef __powerpc64__ + FFI_HIDDEN (ffi_closure_LINUX64) + FFI_HIDDEN (.ffi_closure_LINUX64) + .globl ffi_closure_LINUX64, .ffi_closure_LINUX64 + .section ".opd","aw" + .align 3 +ffi_closure_LINUX64: + .quad .ffi_closure_LINUX64,.TOC.@tocbase,0 + .size ffi_closure_LINUX64,24 + .type .ffi_closure_LINUX64,@function + .text +.ffi_closure_LINUX64: +.LFB1: + # save general regs into parm save area + std %r3, 48(%r1) + std %r4, 56(%r1) + std %r5, 64(%r1) + std %r6, 72(%r1) + mflr %r0 + + std %r7, 80(%r1) + std %r8, 88(%r1) + std %r9, 96(%r1) + std %r10, 104(%r1) + std %r0, 16(%r1) + + # mandatory 48 bytes special reg save area + 64 bytes parm save area + # + 16 bytes retval area + 13*8 bytes fpr save area + round to 16 + stdu %r1, -240(%r1) +.LCFI0: + + # next save fpr 1 to fpr 13 + stfd %f1, 128+(0*8)(%r1) + stfd %f2, 128+(1*8)(%r1) + stfd %f3, 128+(2*8)(%r1) + stfd %f4, 128+(3*8)(%r1) + stfd %f5, 128+(4*8)(%r1) + stfd %f6, 128+(5*8)(%r1) + stfd %f7, 128+(6*8)(%r1) + stfd %f8, 128+(7*8)(%r1) + stfd %f9, 128+(8*8)(%r1) + stfd %f10, 128+(9*8)(%r1) + stfd %f11, 128+(10*8)(%r1) + stfd %f12, 128+(11*8)(%r1) + stfd %f13, 128+(12*8)(%r1) + + # set up registers for the routine that actually does the work + # get the context pointer from the trampoline + mr %r3, %r11 + + # now load up the pointer to the result storage + addi %r4, %r1, 112 + + # now load up the pointer to the parameter save area + # in the previous frame + addi %r5, %r1, 240 + 48 + + # now load up the pointer to the saved fpr registers */ + addi %r6, %r1, 128 + + # make the call + bl .ffi_closure_helper_LINUX64 +.Lret: + + # now r3 contains the return type + # so use it to look up in a table + # so we know how to deal with each type + + # look up the proper starting point in table + # by using return type as offset + mflr %r4 # move address of .Lret to r4 + sldi %r3, %r3, 4 # now multiply return type by 16 + addi %r4, %r4, .Lret_type0 - .Lret + ld %r0, 240+16(%r1) + add %r3, %r3, %r4 # add contents of table to table address + mtctr %r3 + bctr # jump to it + +# Each of the ret_typeX code fragments has to be exactly 16 bytes long +# (4 instructions). For cache effectiveness we align to a 16 byte boundary +# first. + .align 4 + +.Lret_type0: +# case FFI_TYPE_VOID + mtlr %r0 + addi %r1, %r1, 240 + blr + nop +# case FFI_TYPE_INT + lwa %r3, 112+4(%r1) + mtlr %r0 + addi %r1, %r1, 240 + blr +# case FFI_TYPE_FLOAT + lfs %f1, 112+0(%r1) + mtlr %r0 + addi %r1, %r1, 240 + blr +# case FFI_TYPE_DOUBLE + lfd %f1, 112+0(%r1) + mtlr %r0 + addi %r1, %r1, 240 + blr +# case FFI_TYPE_LONGDOUBLE + lfd %f1, 112+0(%r1) + mtlr %r0 + lfd %f2, 112+8(%r1) + b .Lfinish +# case FFI_TYPE_UINT8 + lbz %r3, 112+7(%r1) + mtlr %r0 + addi %r1, %r1, 240 + blr +# case FFI_TYPE_SINT8 + lbz %r3, 112+7(%r1) + extsb %r3,%r3 + mtlr %r0 + b .Lfinish +# case FFI_TYPE_UINT16 + lhz %r3, 112+6(%r1) + mtlr %r0 +.Lfinish: + addi %r1, %r1, 240 + blr +# case FFI_TYPE_SINT16 + lha %r3, 112+6(%r1) + mtlr %r0 + addi %r1, %r1, 240 + blr +# case FFI_TYPE_UINT32 + lwz %r3, 112+4(%r1) + mtlr %r0 + addi %r1, %r1, 240 + blr +# case FFI_TYPE_SINT32 + lwa %r3, 112+4(%r1) + mtlr %r0 + addi %r1, %r1, 240 + blr +# case FFI_TYPE_UINT64 + ld %r3, 112+0(%r1) + mtlr %r0 + addi %r1, %r1, 240 + blr +# case FFI_TYPE_SINT64 + ld %r3, 112+0(%r1) + mtlr %r0 + addi %r1, %r1, 240 + blr +# case FFI_TYPE_STRUCT + mtlr %r0 + addi %r1, %r1, 240 + blr + nop +# case FFI_TYPE_POINTER + ld %r3, 112+0(%r1) + mtlr %r0 + addi %r1, %r1, 240 + blr +# esac +.LFE1: + .long 0 + .byte 0,12,0,1,128,0,0,0 + .size .ffi_closure_LINUX64,.-.ffi_closure_LINUX64 + + .section .eh_frame,EH_FRAME_FLAGS,@progbits +.Lframe1: + .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry +.LSCIE1: + .4byte 0x0 # CIE Identifier Tag + .byte 0x1 # CIE Version + .ascii "zR\0" # CIE Augmentation + .uleb128 0x1 # CIE Code Alignment Factor + .sleb128 -8 # CIE Data Alignment Factor + .byte 0x41 # CIE RA Column + .uleb128 0x1 # Augmentation size + .byte 0x14 # FDE Encoding (pcrel udata8) + .byte 0xc # DW_CFA_def_cfa + .uleb128 0x1 + .uleb128 0x0 + .align 3 +.LECIE1: +.LSFDE1: + .4byte .LEFDE1-.LASFDE1 # FDE Length +.LASFDE1: + .4byte .LASFDE1-.Lframe1 # FDE CIE offset + .8byte .LFB1-. # FDE initial location + .8byte .LFE1-.LFB1 # FDE address range + .uleb128 0x0 # Augmentation size + .byte 0x2 # DW_CFA_advance_loc1 + .byte .LCFI0-.LFB1 + .byte 0xe # DW_CFA_def_cfa_offset + .uleb128 240 + .byte 0x11 # DW_CFA_offset_extended_sf + .uleb128 0x41 + .sleb128 -2 + .align 3 +.LEFDE1: +#endif + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/ppc_closure.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/ppc_closure.S new file mode 100644 index 000000000..56f7d1af2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/ppc_closure.S @@ -0,0 +1,327 @@ +/* ----------------------------------------------------------------------- + sysv.h - Copyright (c) 2003 Jakub Jelinek + Copyright (c) 2008 Red Hat, Inc. + + PowerPC Assembly glue. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ +#define LIBFFI_ASM +#include +#include +#include + + .file "ppc_closure.S" + +#ifndef __powerpc64__ + +ENTRY(ffi_closure_SYSV) +.LFB1: + stwu %r1,-144(%r1) +.LCFI0: + mflr %r0 +.LCFI1: + stw %r0,148(%r1) + +# we want to build up an areas for the parameters passed +# in registers (both floating point and integer) + + # so first save gpr 3 to gpr 10 (aligned to 4) + stw %r3, 16(%r1) + stw %r4, 20(%r1) + stw %r5, 24(%r1) + stw %r6, 28(%r1) + stw %r7, 32(%r1) + stw %r8, 36(%r1) + stw %r9, 40(%r1) + stw %r10,44(%r1) + +#ifndef __NO_FPRS__ + # next save fpr 1 to fpr 8 (aligned to 8) + stfd %f1, 48(%r1) + stfd %f2, 56(%r1) + stfd %f3, 64(%r1) + stfd %f4, 72(%r1) + stfd %f5, 80(%r1) + stfd %f6, 88(%r1) + stfd %f7, 96(%r1) + stfd %f8, 104(%r1) +#endif + + # set up registers for the routine that actually does the work + # get the context pointer from the trampoline + mr %r3,%r11 + + # now load up the pointer to the result storage + addi %r4,%r1,112 + + # now load up the pointer to the saved gpr registers + addi %r5,%r1,16 + + # now load up the pointer to the saved fpr registers */ + addi %r6,%r1,48 + + # now load up the pointer to the outgoing parameter + # stack in the previous frame + # i.e. the previous frame pointer + 8 + addi %r7,%r1,152 + + # make the call + bl ffi_closure_helper_SYSV@local +.Lret: + # now r3 contains the return type + # so use it to look up in a table + # so we know how to deal with each type + + # look up the proper starting point in table + # by using return type as offset + + mflr %r4 # move address of .Lret to r4 + slwi %r3,%r3,4 # now multiply return type by 16 + addi %r4, %r4, .Lret_type0 - .Lret + lwz %r0,148(%r1) + add %r3,%r3,%r4 # add contents of table to table address + mtctr %r3 + bctr # jump to it +.LFE1: + +# Each of the ret_typeX code fragments has to be exactly 16 bytes long +# (4 instructions). For cache effectiveness we align to a 16 byte boundary +# first. + .align 4 +# case FFI_TYPE_VOID +.Lret_type0: + mtlr %r0 + addi %r1,%r1,144 + blr + nop + +# case FFI_TYPE_INT + lwz %r3,112+0(%r1) + mtlr %r0 +.Lfinish: + addi %r1,%r1,144 + blr + +# case FFI_TYPE_FLOAT + lfs %f1,112+0(%r1) + mtlr %r0 + addi %r1,%r1,144 + blr + +# case FFI_TYPE_DOUBLE + lfd %f1,112+0(%r1) + mtlr %r0 + addi %r1,%r1,144 + blr + +# case FFI_TYPE_LONGDOUBLE + lfd %f1,112+0(%r1) + lfd %f2,112+8(%r1) + mtlr %r0 + b .Lfinish + +# case FFI_TYPE_UINT8 + lbz %r3,112+3(%r1) + mtlr %r0 + addi %r1,%r1,144 + blr + +# case FFI_TYPE_SINT8 + lbz %r3,112+3(%r1) + extsb %r3,%r3 + mtlr %r0 + b .Lfinish + +# case FFI_TYPE_UINT16 + lhz %r3,112+2(%r1) + mtlr %r0 + addi %r1,%r1,144 + blr + +# case FFI_TYPE_SINT16 + lha %r3,112+2(%r1) + mtlr %r0 + addi %r1,%r1,144 + blr + +# case FFI_TYPE_UINT32 + lwz %r3,112+0(%r1) + mtlr %r0 + addi %r1,%r1,144 + blr + +# case FFI_TYPE_SINT32 + lwz %r3,112+0(%r1) + mtlr %r0 + addi %r1,%r1,144 + blr + +# case FFI_TYPE_UINT64 + lwz %r3,112+0(%r1) + lwz %r4,112+4(%r1) + mtlr %r0 + b .Lfinish + +# case FFI_TYPE_SINT64 + lwz %r3,112+0(%r1) + lwz %r4,112+4(%r1) + mtlr %r0 + b .Lfinish + +# case FFI_TYPE_STRUCT + mtlr %r0 + addi %r1,%r1,144 + blr + nop + +# case FFI_TYPE_POINTER + lwz %r3,112+0(%r1) + mtlr %r0 + addi %r1,%r1,144 + blr + +# case FFI_TYPE_UINT128 + lwz %r3,112+0(%r1) + lwz %r4,112+4(%r1) + lwz %r5,112+8(%r1) + bl .Luint128 + +# The return types below are only used when the ABI type is FFI_SYSV. +# case FFI_SYSV_TYPE_SMALL_STRUCT + 1. One byte struct. + lbz %r3,112+0(%r1) + mtlr %r0 + addi %r1,%r1,144 + blr + +# case FFI_SYSV_TYPE_SMALL_STRUCT + 2. Two byte struct. + lhz %r3,112+0(%r1) + mtlr %r0 + addi %r1,%r1,144 + blr + +# case FFI_SYSV_TYPE_SMALL_STRUCT + 3. Three byte struct. + lwz %r3,112+0(%r1) + srwi %r3,%r3,8 + mtlr %r0 + b .Lfinish + +# case FFI_SYSV_TYPE_SMALL_STRUCT + 4. Four byte struct. + lwz %r3,112+0(%r1) + mtlr %r0 + addi %r1,%r1,144 + blr + +# case FFI_SYSV_TYPE_SMALL_STRUCT + 5. Five byte struct. + lwz %r3,112+0(%r1) + lwz %r4,112+4(%r1) + li %r5,24 + b .Lstruct567 + +# case FFI_SYSV_TYPE_SMALL_STRUCT + 6. Six byte struct. + lwz %r3,112+0(%r1) + lwz %r4,112+4(%r1) + li %r5,16 + b .Lstruct567 + +# case FFI_SYSV_TYPE_SMALL_STRUCT + 7. Seven byte struct. + lwz %r3,112+0(%r1) + lwz %r4,112+4(%r1) + li %r5,8 + b .Lstruct567 + +# case FFI_SYSV_TYPE_SMALL_STRUCT + 8. Eight byte struct. + lwz %r3,112+0(%r1) + lwz %r4,112+4(%r1) + mtlr %r0 + b .Lfinish + +.Lstruct567: + subfic %r6,%r5,32 + srw %r4,%r4,%r5 + slw %r6,%r3,%r6 + srw %r3,%r3,%r5 + or %r4,%r6,%r4 + mtlr %r0 + addi %r1,%r1,144 + blr + +.Luint128: + lwz %r6,112+12(%r1) + mtlr %r0 + addi %r1,%r1,144 + blr + +END(ffi_closure_SYSV) + + .section ".eh_frame",EH_FRAME_FLAGS,@progbits +.Lframe1: + .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry +.LSCIE1: + .4byte 0x0 # CIE Identifier Tag + .byte 0x1 # CIE Version +#if defined _RELOCATABLE || defined __PIC__ + .ascii "zR\0" # CIE Augmentation +#else + .ascii "\0" # CIE Augmentation +#endif + .uleb128 0x1 # CIE Code Alignment Factor + .sleb128 -4 # CIE Data Alignment Factor + .byte 0x41 # CIE RA Column +#if defined _RELOCATABLE || defined __PIC__ + .uleb128 0x1 # Augmentation size + .byte 0x1b # FDE Encoding (pcrel sdata4) +#endif + .byte 0xc # DW_CFA_def_cfa + .uleb128 0x1 + .uleb128 0x0 + .align 2 +.LECIE1: +.LSFDE1: + .4byte .LEFDE1-.LASFDE1 # FDE Length +.LASFDE1: + .4byte .LASFDE1-.Lframe1 # FDE CIE offset +#if defined _RELOCATABLE || defined __PIC__ + .4byte .LFB1-. # FDE initial location +#else + .4byte .LFB1 # FDE initial location +#endif + .4byte .LFE1-.LFB1 # FDE address range +#if defined _RELOCATABLE || defined __PIC__ + .uleb128 0x0 # Augmentation size +#endif + .byte 0x4 # DW_CFA_advance_loc4 + .4byte .LCFI0-.LFB1 + .byte 0xe # DW_CFA_def_cfa_offset + .uleb128 144 + .byte 0x4 # DW_CFA_advance_loc4 + .4byte .LCFI1-.LCFI0 + .byte 0x11 # DW_CFA_offset_extended_sf + .uleb128 0x41 + .sleb128 -1 + .align 2 +.LEFDE1: + +#endif + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/sysv.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/sysv.S new file mode 100644 index 000000000..96ea22b0b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/powerpc/sysv.S @@ -0,0 +1,219 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 1998 Geoffrey Keating + Copyright (C) 2007 Free Software Foundation, Inc + + PowerPC Assembly glue. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include +#include + +#ifndef __powerpc64__ + .globl ffi_prep_args_SYSV +ENTRY(ffi_call_SYSV) +.LFB1: + /* Save the old stack pointer as AP. */ + mr %r8,%r1 + +.LCFI0: + /* Allocate the stack space we need. */ + stwux %r1,%r1,%r4 + /* Save registers we use. */ + mflr %r9 + stw %r28,-16(%r8) +.LCFI1: + stw %r29,-12(%r8) +.LCFI2: + stw %r30, -8(%r8) +.LCFI3: + stw %r31, -4(%r8) +.LCFI4: + stw %r9, 4(%r8) +.LCFI5: + + /* Save arguments over call... */ + mr %r31,%r5 /* flags, */ + mr %r30,%r6 /* rvalue, */ + mr %r29,%r7 /* function address, */ + mr %r28,%r8 /* our AP. */ +.LCFI6: + + /* Call ffi_prep_args_SYSV. */ + mr %r4,%r1 + bl ffi_prep_args_SYSV@local + + /* Now do the call. */ + /* Set up cr1 with bits 4-7 of the flags. */ + mtcrf 0x40,%r31 + /* Get the address to call into CTR. */ + mtctr %r29 + /* Load all those argument registers. */ + lwz %r3,-16-(8*4)(%r28) + lwz %r4,-16-(7*4)(%r28) + lwz %r5,-16-(6*4)(%r28) + lwz %r6,-16-(5*4)(%r28) + bf- 5,1f + nop + lwz %r7,-16-(4*4)(%r28) + lwz %r8,-16-(3*4)(%r28) + lwz %r9,-16-(2*4)(%r28) + lwz %r10,-16-(1*4)(%r28) + nop +1: + + /* Load all the FP registers. */ + bf- 6,2f + lfd %f1,-16-(8*4)-(8*8)(%r28) + lfd %f2,-16-(8*4)-(7*8)(%r28) + lfd %f3,-16-(8*4)-(6*8)(%r28) + lfd %f4,-16-(8*4)-(5*8)(%r28) + nop + lfd %f5,-16-(8*4)-(4*8)(%r28) + lfd %f6,-16-(8*4)-(3*8)(%r28) + lfd %f7,-16-(8*4)-(2*8)(%r28) + lfd %f8,-16-(8*4)-(1*8)(%r28) +2: + + /* Make the call. */ + bctrl + + /* Now, deal with the return value. */ + mtcrf 0x01,%r31 /* cr7 */ + bt- 31,L(small_struct_return_value) + bt- 30,L(done_return_value) + bt- 29,L(fp_return_value) + stw %r3,0(%r30) + bf+ 28,L(done_return_value) + stw %r4,4(%r30) + mtcrf 0x02,%r31 /* cr6 */ + bf 27,L(done_return_value) + stw %r5,8(%r30) + stw %r6,12(%r30) + /* Fall through... */ + +L(done_return_value): + /* Restore the registers we used and return. */ + lwz %r9, 4(%r28) + lwz %r31, -4(%r28) + mtlr %r9 + lwz %r30, -8(%r28) + lwz %r29,-12(%r28) + lwz %r28,-16(%r28) + lwz %r1,0(%r1) + blr + +L(fp_return_value): + bf 28,L(float_return_value) + stfd %f1,0(%r30) + mtcrf 0x02,%r31 /* cr6 */ + bf 27,L(done_return_value) + stfd %f2,8(%r30) + b L(done_return_value) +L(float_return_value): + stfs %f1,0(%r30) + b L(done_return_value) + +L(small_struct_return_value): + extrwi %r6,%r31,2,19 /* number of bytes padding = shift/8 */ + mtcrf 0x02,%r31 /* copy flags to cr[24:27] (cr6) */ + extrwi %r5,%r31,5,19 /* r5 <- number of bits of padding */ + subfic %r6,%r6,4 /* r6 <- number of useful bytes in r3 */ + bf- 25,L(done_return_value) /* struct in r3 ? if not, done. */ +/* smst_one_register: */ + slw %r3,%r3,%r5 /* Left-justify value in r3 */ + mtxer %r6 /* move byte count to XER ... */ + stswx %r3,0,%r30 /* ... and store that many bytes */ + bf+ 26,L(done_return_value) /* struct in r3:r4 ? */ + add %r6,%r6,%r30 /* adjust pointer */ + stswi %r4,%r6,4 /* store last four bytes */ + b L(done_return_value) + +.LFE1: +END(ffi_call_SYSV) + + .section ".eh_frame",EH_FRAME_FLAGS,@progbits +.Lframe1: + .4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */ +.LSCIE1: + .4byte 0x0 /* CIE Identifier Tag */ + .byte 0x1 /* CIE Version */ +#if defined _RELOCATABLE || defined __PIC__ + .ascii "zR\0" /* CIE Augmentation */ +#else + .ascii "\0" /* CIE Augmentation */ +#endif + .uleb128 0x1 /* CIE Code Alignment Factor */ + .sleb128 -4 /* CIE Data Alignment Factor */ + .byte 0x41 /* CIE RA Column */ +#if defined _RELOCATABLE || defined __PIC__ + .uleb128 0x1 /* Augmentation size */ + .byte 0x1b /* FDE Encoding (pcrel sdata4) */ +#endif + .byte 0xc /* DW_CFA_def_cfa */ + .uleb128 0x1 + .uleb128 0x0 + .align 2 +.LECIE1: +.LSFDE1: + .4byte .LEFDE1-.LASFDE1 /* FDE Length */ +.LASFDE1: + .4byte .LASFDE1-.Lframe1 /* FDE CIE offset */ +#if defined _RELOCATABLE || defined __PIC__ + .4byte .LFB1-. /* FDE initial location */ +#else + .4byte .LFB1 /* FDE initial location */ +#endif + .4byte .LFE1-.LFB1 /* FDE address range */ +#if defined _RELOCATABLE || defined __PIC__ + .uleb128 0x0 /* Augmentation size */ +#endif + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte .LCFI0-.LFB1 + .byte 0xd /* DW_CFA_def_cfa_register */ + .uleb128 0x08 + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte .LCFI5-.LCFI0 + .byte 0x11 /* DW_CFA_offset_extended_sf */ + .uleb128 0x41 + .sleb128 -1 + .byte 0x9f /* DW_CFA_offset, column 0x1f */ + .uleb128 0x1 + .byte 0x9e /* DW_CFA_offset, column 0x1e */ + .uleb128 0x2 + .byte 0x9d /* DW_CFA_offset, column 0x1d */ + .uleb128 0x3 + .byte 0x9c /* DW_CFA_offset, column 0x1c */ + .uleb128 0x4 + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte .LCFI6-.LCFI5 + .byte 0xd /* DW_CFA_def_cfa_register */ + .uleb128 0x1c + .align 2 +.LEFDE1: +#endif + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/prep_cif.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/prep_cif.c new file mode 100644 index 000000000..8548cfd7a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/prep_cif.c @@ -0,0 +1,177 @@ +/* ----------------------------------------------------------------------- + prep_cif.c - Copyright (c) 2011 Anthony Green + Copyright (c) 1996, 1998, 2007 Red Hat, Inc. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include +#include + +/* Round up to FFI_SIZEOF_ARG. */ + +#define STACK_ARG_SIZE(x) ALIGN(x, FFI_SIZEOF_ARG) + +/* Perform machine independent initialization of aggregate type + specifications. */ + +static ffi_status initialize_aggregate(ffi_type *arg) +{ + ffi_type **ptr; + + if (UNLIKELY(arg == NULL || arg->elements == NULL)) + return FFI_BAD_TYPEDEF; + + arg->size = 0; + arg->alignment = 0; + + ptr = &(arg->elements[0]); + + if (UNLIKELY(ptr == 0)) + return FFI_BAD_TYPEDEF; + + while ((*ptr) != NULL) + { + if (UNLIKELY(((*ptr)->size == 0) + && (initialize_aggregate((*ptr)) != FFI_OK))) + return FFI_BAD_TYPEDEF; + + /* Perform a sanity check on the argument type */ + FFI_ASSERT_VALID_TYPE(*ptr); + + arg->size = ALIGN(arg->size, (*ptr)->alignment); + arg->size += (*ptr)->size; + + arg->alignment = (arg->alignment > (*ptr)->alignment) ? + arg->alignment : (*ptr)->alignment; + + ptr++; + } + + /* Structure size includes tail padding. This is important for + structures that fit in one register on ABIs like the PowerPC64 + Linux ABI that right justify small structs in a register. + It's also needed for nested structure layout, for example + struct A { long a; char b; }; struct B { struct A x; char y; }; + should find y at an offset of 2*sizeof(long) and result in a + total size of 3*sizeof(long). */ + arg->size = ALIGN (arg->size, arg->alignment); + + if (arg->size == 0) + return FFI_BAD_TYPEDEF; + else + return FFI_OK; +} + +#ifndef __CRIS__ +/* The CRIS ABI specifies structure elements to have byte + alignment only, so it completely overrides this functions, + which assumes "natural" alignment and padding. */ + +/* Perform machine independent ffi_cif preparation, then call + machine dependent routine. */ + +ffi_status ffi_prep_cif(ffi_cif *cif, ffi_abi abi, unsigned int nargs, + ffi_type *rtype, ffi_type **atypes) +{ + unsigned bytes = 0; + unsigned int i; + ffi_type **ptr; + + FFI_ASSERT(cif != NULL); + if (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI)) + return FFI_BAD_ABI; + + cif->abi = abi; + cif->arg_types = atypes; + cif->nargs = nargs; + cif->rtype = rtype; + + cif->flags = 0; + + /* Initialize the return type if necessary */ + if ((cif->rtype->size == 0) && (initialize_aggregate(cif->rtype) != FFI_OK)) + return FFI_BAD_TYPEDEF; + + /* Perform a sanity check on the return type */ + FFI_ASSERT_VALID_TYPE(cif->rtype); + + /* x86, x86-64 and s390 stack space allocation is handled in prep_machdep. */ +#if !defined M68K && !defined X86_ANY && !defined S390 && !defined PA + /* Make space for the return structure pointer */ + if (cif->rtype->type == FFI_TYPE_STRUCT +#ifdef SPARC + && (cif->abi != FFI_V9 || cif->rtype->size > 32) +#endif + ) + bytes = STACK_ARG_SIZE(sizeof(void*)); +#endif + + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) + { + + /* Initialize any uninitialized aggregate type definitions */ + if (((*ptr)->size == 0) && (initialize_aggregate((*ptr)) != FFI_OK)) + return FFI_BAD_TYPEDEF; + + /* Perform a sanity check on the argument type, do this + check after the initialization. */ + FFI_ASSERT_VALID_TYPE(*ptr); + +#if !defined X86_ANY && !defined S390 && !defined PA +#ifdef SPARC + if (((*ptr)->type == FFI_TYPE_STRUCT + && ((*ptr)->size > 16 || cif->abi != FFI_V9)) + || ((*ptr)->type == FFI_TYPE_LONGDOUBLE + && cif->abi != FFI_V9)) + bytes += sizeof(void*); + else +#endif + { + /* Add any padding if necessary */ + if (((*ptr)->alignment - 1) & bytes) + bytes = ALIGN(bytes, (*ptr)->alignment); + + bytes += STACK_ARG_SIZE((*ptr)->size); + } +#endif + } + + cif->bytes = bytes; + + /* Perform machine dependent cif processing */ + return ffi_prep_cif_machdep(cif); +} +#endif /* not __CRIS__ */ + +#if FFI_CLOSURES + +ffi_status +ffi_prep_closure (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data) +{ + return ffi_prep_closure_loc (closure, cif, fun, user_data, closure); +} + +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/raw_api.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/raw_api.c new file mode 100644 index 000000000..ce21372e2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/raw_api.c @@ -0,0 +1,254 @@ +/* ----------------------------------------------------------------------- + raw_api.c - Copyright (c) 1999, 2008 Red Hat, Inc. + + Author: Kresten Krab Thorup + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +/* This file defines generic functions for use with the raw api. */ + +#include +#include + +#if !FFI_NO_RAW_API + +size_t +ffi_raw_size (ffi_cif *cif) +{ + size_t result = 0; + int i; + + ffi_type **at = cif->arg_types; + + for (i = cif->nargs-1; i >= 0; i--, at++) + { +#if !FFI_NO_STRUCTS + if ((*at)->type == FFI_TYPE_STRUCT) + result += ALIGN (sizeof (void*), FFI_SIZEOF_ARG); + else +#endif + result += ALIGN ((*at)->size, FFI_SIZEOF_ARG); + } + + return result; +} + + +void +ffi_raw_to_ptrarray (ffi_cif *cif, ffi_raw *raw, void **args) +{ + unsigned i; + ffi_type **tp = cif->arg_types; + +#if WORDS_BIGENDIAN + + for (i = 0; i < cif->nargs; i++, tp++, args++) + { + switch ((*tp)->type) + { + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 1); + break; + + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 2); + break; + +#if FFI_SIZEOF_ARG >= 4 + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + *args = (void*) ((char*)(raw++) + FFI_SIZEOF_ARG - 4); + break; +#endif + +#if !FFI_NO_STRUCTS + case FFI_TYPE_STRUCT: + *args = (raw++)->ptr; + break; +#endif + + case FFI_TYPE_POINTER: + *args = (void*) &(raw++)->ptr; + break; + + default: + *args = raw; + raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; + } + } + +#else /* WORDS_BIGENDIAN */ + +#if !PDP + + /* then assume little endian */ + for (i = 0; i < cif->nargs; i++, tp++, args++) + { +#if !FFI_NO_STRUCTS + if ((*tp)->type == FFI_TYPE_STRUCT) + { + *args = (raw++)->ptr; + } + else +#endif + { + *args = (void*) raw; + raw += ALIGN ((*tp)->size, sizeof (void*)) / sizeof (void*); + } + } + +#else +#error "pdp endian not supported" +#endif /* ! PDP */ + +#endif /* WORDS_BIGENDIAN */ +} + +void +ffi_ptrarray_to_raw (ffi_cif *cif, void **args, ffi_raw *raw) +{ + unsigned i; + ffi_type **tp = cif->arg_types; + + for (i = 0; i < cif->nargs; i++, tp++, args++) + { + switch ((*tp)->type) + { + case FFI_TYPE_UINT8: + (raw++)->uint = *(UINT8*) (*args); + break; + + case FFI_TYPE_SINT8: + (raw++)->sint = *(SINT8*) (*args); + break; + + case FFI_TYPE_UINT16: + (raw++)->uint = *(UINT16*) (*args); + break; + + case FFI_TYPE_SINT16: + (raw++)->sint = *(SINT16*) (*args); + break; + +#if FFI_SIZEOF_ARG >= 4 + case FFI_TYPE_UINT32: + (raw++)->uint = *(UINT32*) (*args); + break; + + case FFI_TYPE_SINT32: + (raw++)->sint = *(SINT32*) (*args); + break; +#endif + +#if !FFI_NO_STRUCTS + case FFI_TYPE_STRUCT: + (raw++)->ptr = *args; + break; +#endif + + case FFI_TYPE_POINTER: + (raw++)->ptr = **(void***) args; + break; + + default: + memcpy ((void*) raw->data, (void*)*args, (*tp)->size); + raw += ALIGN ((*tp)->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; + } + } +} + +#if !FFI_NATIVE_RAW_API + + +/* This is a generic definition of ffi_raw_call, to be used if the + * native system does not provide a machine-specific implementation. + * Having this, allows code to be written for the raw API, without + * the need for system-specific code to handle input in that format; + * these following couple of functions will handle the translation forth + * and back automatically. */ + +void ffi_raw_call (ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *raw) +{ + void **avalue = (void**) alloca (cif->nargs * sizeof (void*)); + ffi_raw_to_ptrarray (cif, raw, avalue); + ffi_call (cif, fn, rvalue, avalue); +} + +#if FFI_CLOSURES /* base system provides closures */ + +static void +ffi_translate_args (ffi_cif *cif, void *rvalue, + void **avalue, void *user_data) +{ + ffi_raw *raw = (ffi_raw*)alloca (ffi_raw_size (cif)); + ffi_raw_closure *cl = (ffi_raw_closure*)user_data; + + ffi_ptrarray_to_raw (cif, avalue, raw); + (*cl->fun) (cif, rvalue, raw, cl->user_data); +} + +ffi_status +ffi_prep_raw_closure_loc (ffi_raw_closure* cl, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data, + void *codeloc) +{ + ffi_status status; + + status = ffi_prep_closure_loc ((ffi_closure*) cl, + cif, + &ffi_translate_args, + codeloc, + codeloc); + if (status == FFI_OK) + { + cl->fun = fun; + cl->user_data = user_data; + } + + return status; +} + +#endif /* FFI_CLOSURES */ +#endif /* !FFI_NATIVE_RAW_API */ + +#if FFI_CLOSURES + +/* Again, here is the generic version of ffi_prep_raw_closure, which + * will install an intermediate "hub" for translation of arguments from + * the pointer-array format, to the raw format */ + +ffi_status +ffi_prep_raw_closure (ffi_raw_closure* cl, + ffi_cif *cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data) +{ + return ffi_prep_raw_closure_loc (cl, cif, fun, user_data, cl); +} + +#endif /* FFI_CLOSURES */ + +#endif /* !FFI_NO_RAW_API */ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/s390/ffi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/s390/ffi.c new file mode 100644 index 000000000..ca2675bc8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/s390/ffi.c @@ -0,0 +1,780 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2000, 2007 Software AG + Copyright (c) 2008 Red Hat, Inc + + S390 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ +/*====================================================================*/ +/* Includes */ +/* -------- */ +/*====================================================================*/ + +#include +#include + +#include +#include + +/*====================== End of Includes =============================*/ + +/*====================================================================*/ +/* Defines */ +/* ------- */ +/*====================================================================*/ + +/* Maximum number of GPRs available for argument passing. */ +#define MAX_GPRARGS 5 + +/* Maximum number of FPRs available for argument passing. */ +#ifdef __s390x__ +#define MAX_FPRARGS 4 +#else +#define MAX_FPRARGS 2 +#endif + +/* Round to multiple of 16. */ +#define ROUND_SIZE(size) (((size) + 15) & ~15) + +/* If these values change, sysv.S must be adapted! */ +#define FFI390_RET_VOID 0 +#define FFI390_RET_STRUCT 1 +#define FFI390_RET_FLOAT 2 +#define FFI390_RET_DOUBLE 3 +#define FFI390_RET_INT32 4 +#define FFI390_RET_INT64 5 + +/*===================== End of Defines ===============================*/ + +/*====================================================================*/ +/* Prototypes */ +/* ---------- */ +/*====================================================================*/ + +static void ffi_prep_args (unsigned char *, extended_cif *); +void +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ > 2) +__attribute__ ((visibility ("hidden"))) +#endif +ffi_closure_helper_SYSV (ffi_closure *, unsigned long *, + unsigned long long *, unsigned long *); + +/*====================== End of Prototypes ===========================*/ + +/*====================================================================*/ +/* Externals */ +/* --------- */ +/*====================================================================*/ + +extern void ffi_call_SYSV(unsigned, + extended_cif *, + void (*)(unsigned char *, extended_cif *), + unsigned, + void *, + void (*fn)(void)); + +extern void ffi_closure_SYSV(void); + +/*====================== End of Externals ============================*/ + +/*====================================================================*/ +/* */ +/* Name - ffi_check_struct_type. */ +/* */ +/* Function - Determine if a structure can be passed within a */ +/* general purpose or floating point register. */ +/* */ +/*====================================================================*/ + +static int +ffi_check_struct_type (ffi_type *arg) +{ + size_t size = arg->size; + + /* If the struct has just one element, look at that element + to find out whether to consider the struct as floating point. */ + while (arg->type == FFI_TYPE_STRUCT + && arg->elements[0] && !arg->elements[1]) + arg = arg->elements[0]; + + /* Structs of size 1, 2, 4, and 8 are passed in registers, + just like the corresponding int/float types. */ + switch (size) + { + case 1: + return FFI_TYPE_UINT8; + + case 2: + return FFI_TYPE_UINT16; + + case 4: + if (arg->type == FFI_TYPE_FLOAT) + return FFI_TYPE_FLOAT; + else + return FFI_TYPE_UINT32; + + case 8: + if (arg->type == FFI_TYPE_DOUBLE) + return FFI_TYPE_DOUBLE; + else + return FFI_TYPE_UINT64; + + default: + break; + } + + /* Other structs are passed via a pointer to the data. */ + return FFI_TYPE_POINTER; +} + +/*======================== End of Routine ============================*/ + +/*====================================================================*/ +/* */ +/* Name - ffi_prep_args. */ +/* */ +/* Function - Prepare parameters for call to function. */ +/* */ +/* ffi_prep_args is called by the assembly routine once stack space */ +/* has been allocated for the function's arguments. */ +/* */ +/*====================================================================*/ + +static void +ffi_prep_args (unsigned char *stack, extended_cif *ecif) +{ + /* The stack space will be filled with those areas: + + FPR argument register save area (highest addresses) + GPR argument register save area + temporary struct copies + overflow argument area (lowest addresses) + + We set up the following pointers: + + p_fpr: bottom of the FPR area (growing upwards) + p_gpr: bottom of the GPR area (growing upwards) + p_ov: bottom of the overflow area (growing upwards) + p_struct: top of the struct copy area (growing downwards) + + All areas are kept aligned to twice the word size. */ + + int gpr_off = ecif->cif->bytes; + int fpr_off = gpr_off + ROUND_SIZE (MAX_GPRARGS * sizeof (long)); + + unsigned long long *p_fpr = (unsigned long long *)(stack + fpr_off); + unsigned long *p_gpr = (unsigned long *)(stack + gpr_off); + unsigned char *p_struct = (unsigned char *)p_gpr; + unsigned long *p_ov = (unsigned long *)stack; + + int n_fpr = 0; + int n_gpr = 0; + int n_ov = 0; + + ffi_type **ptr; + void **p_argv = ecif->avalue; + int i; + + /* If we returning a structure then we set the first parameter register + to the address of where we are returning this structure. */ + + if (ecif->cif->flags == FFI390_RET_STRUCT) + p_gpr[n_gpr++] = (unsigned long) ecif->rvalue; + + /* Now for the arguments. */ + + for (ptr = ecif->cif->arg_types, i = ecif->cif->nargs; + i > 0; + i--, ptr++, p_argv++) + { + void *arg = *p_argv; + int type = (*ptr)->type; + +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + /* 16-byte long double is passed like a struct. */ + if (type == FFI_TYPE_LONGDOUBLE) + type = FFI_TYPE_STRUCT; +#endif + + /* Check how a structure type is passed. */ + if (type == FFI_TYPE_STRUCT) + { + type = ffi_check_struct_type (*ptr); + + /* If we pass the struct via pointer, copy the data. */ + if (type == FFI_TYPE_POINTER) + { + p_struct -= ROUND_SIZE ((*ptr)->size); + memcpy (p_struct, (char *)arg, (*ptr)->size); + arg = &p_struct; + } + } + + /* Now handle all primitive int/pointer/float data types. */ + switch (type) + { + case FFI_TYPE_DOUBLE: + if (n_fpr < MAX_FPRARGS) + p_fpr[n_fpr++] = *(unsigned long long *) arg; + else +#ifdef __s390x__ + p_ov[n_ov++] = *(unsigned long *) arg; +#else + p_ov[n_ov++] = ((unsigned long *) arg)[0], + p_ov[n_ov++] = ((unsigned long *) arg)[1]; +#endif + break; + + case FFI_TYPE_FLOAT: + if (n_fpr < MAX_FPRARGS) + p_fpr[n_fpr++] = (long long) *(unsigned int *) arg << 32; + else + p_ov[n_ov++] = *(unsigned int *) arg; + break; + + case FFI_TYPE_POINTER: + if (n_gpr < MAX_GPRARGS) + p_gpr[n_gpr++] = (unsigned long)*(unsigned char **) arg; + else + p_ov[n_ov++] = (unsigned long)*(unsigned char **) arg; + break; + + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: +#ifdef __s390x__ + if (n_gpr < MAX_GPRARGS) + p_gpr[n_gpr++] = *(unsigned long *) arg; + else + p_ov[n_ov++] = *(unsigned long *) arg; +#else + if (n_gpr == MAX_GPRARGS-1) + n_gpr = MAX_GPRARGS; + if (n_gpr < MAX_GPRARGS) + p_gpr[n_gpr++] = ((unsigned long *) arg)[0], + p_gpr[n_gpr++] = ((unsigned long *) arg)[1]; + else + p_ov[n_ov++] = ((unsigned long *) arg)[0], + p_ov[n_ov++] = ((unsigned long *) arg)[1]; +#endif + break; + + case FFI_TYPE_UINT32: + if (n_gpr < MAX_GPRARGS) + p_gpr[n_gpr++] = *(unsigned int *) arg; + else + p_ov[n_ov++] = *(unsigned int *) arg; + break; + + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + if (n_gpr < MAX_GPRARGS) + p_gpr[n_gpr++] = *(signed int *) arg; + else + p_ov[n_ov++] = *(signed int *) arg; + break; + + case FFI_TYPE_UINT16: + if (n_gpr < MAX_GPRARGS) + p_gpr[n_gpr++] = *(unsigned short *) arg; + else + p_ov[n_ov++] = *(unsigned short *) arg; + break; + + case FFI_TYPE_SINT16: + if (n_gpr < MAX_GPRARGS) + p_gpr[n_gpr++] = *(signed short *) arg; + else + p_ov[n_ov++] = *(signed short *) arg; + break; + + case FFI_TYPE_UINT8: + if (n_gpr < MAX_GPRARGS) + p_gpr[n_gpr++] = *(unsigned char *) arg; + else + p_ov[n_ov++] = *(unsigned char *) arg; + break; + + case FFI_TYPE_SINT8: + if (n_gpr < MAX_GPRARGS) + p_gpr[n_gpr++] = *(signed char *) arg; + else + p_ov[n_ov++] = *(signed char *) arg; + break; + + default: + FFI_ASSERT (0); + break; + } + } +} + +/*======================== End of Routine ============================*/ + +/*====================================================================*/ +/* */ +/* Name - ffi_prep_cif_machdep. */ +/* */ +/* Function - Perform machine dependent CIF processing. */ +/* */ +/*====================================================================*/ + +ffi_status +ffi_prep_cif_machdep(ffi_cif *cif) +{ + size_t struct_size = 0; + int n_gpr = 0; + int n_fpr = 0; + int n_ov = 0; + + ffi_type **ptr; + int i; + + /* Determine return value handling. */ + + switch (cif->rtype->type) + { + /* Void is easy. */ + case FFI_TYPE_VOID: + cif->flags = FFI390_RET_VOID; + break; + + /* Structures are returned via a hidden pointer. */ + case FFI_TYPE_STRUCT: + cif->flags = FFI390_RET_STRUCT; + n_gpr++; /* We need one GPR to pass the pointer. */ + break; + + /* Floating point values are returned in fpr 0. */ + case FFI_TYPE_FLOAT: + cif->flags = FFI390_RET_FLOAT; + break; + + case FFI_TYPE_DOUBLE: + cif->flags = FFI390_RET_DOUBLE; + break; + +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + case FFI_TYPE_LONGDOUBLE: + cif->flags = FFI390_RET_STRUCT; + n_gpr++; + break; +#endif + /* Integer values are returned in gpr 2 (and gpr 3 + for 64-bit values on 31-bit machines). */ + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + cif->flags = FFI390_RET_INT64; + break; + + case FFI_TYPE_POINTER: + case FFI_TYPE_INT: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + /* These are to be extended to word size. */ +#ifdef __s390x__ + cif->flags = FFI390_RET_INT64; +#else + cif->flags = FFI390_RET_INT32; +#endif + break; + + default: + FFI_ASSERT (0); + break; + } + + /* Now for the arguments. */ + + for (ptr = cif->arg_types, i = cif->nargs; + i > 0; + i--, ptr++) + { + int type = (*ptr)->type; + +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + /* 16-byte long double is passed like a struct. */ + if (type == FFI_TYPE_LONGDOUBLE) + type = FFI_TYPE_STRUCT; +#endif + + /* Check how a structure type is passed. */ + if (type == FFI_TYPE_STRUCT) + { + type = ffi_check_struct_type (*ptr); + + /* If we pass the struct via pointer, we must reserve space + to copy its data for proper call-by-value semantics. */ + if (type == FFI_TYPE_POINTER) + struct_size += ROUND_SIZE ((*ptr)->size); + } + + /* Now handle all primitive int/float data types. */ + switch (type) + { + /* The first MAX_FPRARGS floating point arguments + go in FPRs, the rest overflow to the stack. */ + + case FFI_TYPE_DOUBLE: + if (n_fpr < MAX_FPRARGS) + n_fpr++; + else + n_ov += sizeof (double) / sizeof (long); + break; + + case FFI_TYPE_FLOAT: + if (n_fpr < MAX_FPRARGS) + n_fpr++; + else + n_ov++; + break; + + /* On 31-bit machines, 64-bit integers are passed in GPR pairs, + if one is still available, or else on the stack. If only one + register is free, skip the register (it won't be used for any + subsequent argument either). */ + +#ifndef __s390x__ + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + if (n_gpr == MAX_GPRARGS-1) + n_gpr = MAX_GPRARGS; + if (n_gpr < MAX_GPRARGS) + n_gpr += 2; + else + n_ov += 2; + break; +#endif + + /* Everything else is passed in GPRs (until MAX_GPRARGS + have been used) or overflows to the stack. */ + + default: + if (n_gpr < MAX_GPRARGS) + n_gpr++; + else + n_ov++; + break; + } + } + + /* Total stack space as required for overflow arguments + and temporary structure copies. */ + + cif->bytes = ROUND_SIZE (n_ov * sizeof (long)) + struct_size; + + return FFI_OK; +} + +/*======================== End of Routine ============================*/ + +/*====================================================================*/ +/* */ +/* Name - ffi_call. */ +/* */ +/* Function - Call the FFI routine. */ +/* */ +/*====================================================================*/ + +void +ffi_call(ffi_cif *cif, + void (*fn)(void), + void *rvalue, + void **avalue) +{ + int ret_type = cif->flags; + extended_cif ecif; + + ecif.cif = cif; + ecif.avalue = avalue; + ecif.rvalue = rvalue; + + /* If we don't have a return value, we need to fake one. */ + if (rvalue == NULL) + { + if (ret_type == FFI390_RET_STRUCT) + ecif.rvalue = alloca (cif->rtype->size); + else + ret_type = FFI390_RET_VOID; + } + + switch (cif->abi) + { + case FFI_SYSV: + ffi_call_SYSV (cif->bytes, &ecif, ffi_prep_args, + ret_type, ecif.rvalue, fn); + break; + + default: + FFI_ASSERT (0); + break; + } +} + +/*======================== End of Routine ============================*/ + +/*====================================================================*/ +/* */ +/* Name - ffi_closure_helper_SYSV. */ +/* */ +/* Function - Call a FFI closure target function. */ +/* */ +/*====================================================================*/ + +void +ffi_closure_helper_SYSV (ffi_closure *closure, + unsigned long *p_gpr, + unsigned long long *p_fpr, + unsigned long *p_ov) +{ + unsigned long long ret_buffer; + + void *rvalue = &ret_buffer; + void **avalue; + void **p_arg; + + int n_gpr = 0; + int n_fpr = 0; + int n_ov = 0; + + ffi_type **ptr; + int i; + + /* Allocate buffer for argument list pointers. */ + + p_arg = avalue = alloca (closure->cif->nargs * sizeof (void *)); + + /* If we returning a structure, pass the structure address + directly to the target function. Otherwise, have the target + function store the return value to the GPR save area. */ + + if (closure->cif->flags == FFI390_RET_STRUCT) + rvalue = (void *) p_gpr[n_gpr++]; + + /* Now for the arguments. */ + + for (ptr = closure->cif->arg_types, i = closure->cif->nargs; + i > 0; + i--, p_arg++, ptr++) + { + int deref_struct_pointer = 0; + int type = (*ptr)->type; + +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + /* 16-byte long double is passed like a struct. */ + if (type == FFI_TYPE_LONGDOUBLE) + type = FFI_TYPE_STRUCT; +#endif + + /* Check how a structure type is passed. */ + if (type == FFI_TYPE_STRUCT) + { + type = ffi_check_struct_type (*ptr); + + /* If we pass the struct via pointer, remember to + retrieve the pointer later. */ + if (type == FFI_TYPE_POINTER) + deref_struct_pointer = 1; + } + + /* Pointers are passed like UINTs of the same size. */ + if (type == FFI_TYPE_POINTER) +#ifdef __s390x__ + type = FFI_TYPE_UINT64; +#else + type = FFI_TYPE_UINT32; +#endif + + /* Now handle all primitive int/float data types. */ + switch (type) + { + case FFI_TYPE_DOUBLE: + if (n_fpr < MAX_FPRARGS) + *p_arg = &p_fpr[n_fpr++]; + else + *p_arg = &p_ov[n_ov], + n_ov += sizeof (double) / sizeof (long); + break; + + case FFI_TYPE_FLOAT: + if (n_fpr < MAX_FPRARGS) + *p_arg = &p_fpr[n_fpr++]; + else + *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 4; + break; + + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: +#ifdef __s390x__ + if (n_gpr < MAX_GPRARGS) + *p_arg = &p_gpr[n_gpr++]; + else + *p_arg = &p_ov[n_ov++]; +#else + if (n_gpr == MAX_GPRARGS-1) + n_gpr = MAX_GPRARGS; + if (n_gpr < MAX_GPRARGS) + *p_arg = &p_gpr[n_gpr], n_gpr += 2; + else + *p_arg = &p_ov[n_ov], n_ov += 2; +#endif + break; + + case FFI_TYPE_INT: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + if (n_gpr < MAX_GPRARGS) + *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 4; + else + *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 4; + break; + + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + if (n_gpr < MAX_GPRARGS) + *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 2; + else + *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 2; + break; + + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + if (n_gpr < MAX_GPRARGS) + *p_arg = (char *)&p_gpr[n_gpr++] + sizeof (long) - 1; + else + *p_arg = (char *)&p_ov[n_ov++] + sizeof (long) - 1; + break; + + default: + FFI_ASSERT (0); + break; + } + + /* If this is a struct passed via pointer, we need to + actually retrieve that pointer. */ + if (deref_struct_pointer) + *p_arg = *(void **)*p_arg; + } + + + /* Call the target function. */ + (closure->fun) (closure->cif, rvalue, avalue, closure->user_data); + + /* Convert the return value. */ + switch (closure->cif->rtype->type) + { + /* Void is easy, and so is struct. */ + case FFI_TYPE_VOID: + case FFI_TYPE_STRUCT: +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + case FFI_TYPE_LONGDOUBLE: +#endif + break; + + /* Floating point values are returned in fpr 0. */ + case FFI_TYPE_FLOAT: + p_fpr[0] = (long long) *(unsigned int *) rvalue << 32; + break; + + case FFI_TYPE_DOUBLE: + p_fpr[0] = *(unsigned long long *) rvalue; + break; + + /* Integer values are returned in gpr 2 (and gpr 3 + for 64-bit values on 31-bit machines). */ + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: +#ifdef __s390x__ + p_gpr[0] = *(unsigned long *) rvalue; +#else + p_gpr[0] = ((unsigned long *) rvalue)[0], + p_gpr[1] = ((unsigned long *) rvalue)[1]; +#endif + break; + + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT32: + case FFI_TYPE_UINT16: + case FFI_TYPE_UINT8: + p_gpr[0] = *(unsigned long *) rvalue; + break; + + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + case FFI_TYPE_SINT16: + case FFI_TYPE_SINT8: + p_gpr[0] = *(signed long *) rvalue; + break; + + default: + FFI_ASSERT (0); + break; + } +} + +/*======================== End of Routine ============================*/ + +/*====================================================================*/ +/* */ +/* Name - ffi_prep_closure_loc. */ +/* */ +/* Function - Prepare a FFI closure. */ +/* */ +/*====================================================================*/ + +ffi_status +ffi_prep_closure_loc (ffi_closure *closure, + ffi_cif *cif, + void (*fun) (ffi_cif *, void *, void **, void *), + void *user_data, + void *codeloc) +{ + FFI_ASSERT (cif->abi == FFI_SYSV); + +#ifndef __s390x__ + *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */ + *(short *)&closure->tramp [2] = 0x9801; /* lm %r0,%r1,6(%r1) */ + *(short *)&closure->tramp [4] = 0x1006; + *(short *)&closure->tramp [6] = 0x07f1; /* br %r1 */ + *(long *)&closure->tramp [8] = (long)codeloc; + *(long *)&closure->tramp[12] = (long)&ffi_closure_SYSV; +#else + *(short *)&closure->tramp [0] = 0x0d10; /* basr %r1,0 */ + *(short *)&closure->tramp [2] = 0xeb01; /* lmg %r0,%r1,14(%r1) */ + *(short *)&closure->tramp [4] = 0x100e; + *(short *)&closure->tramp [6] = 0x0004; + *(short *)&closure->tramp [8] = 0x07f1; /* br %r1 */ + *(long *)&closure->tramp[16] = (long)codeloc; + *(long *)&closure->tramp[24] = (long)&ffi_closure_SYSV; +#endif + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + +/*======================== End of Routine ============================*/ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/s390/ffitarget.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/s390/ffitarget.h new file mode 100644 index 000000000..a26269126 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/s390/ffitarget.h @@ -0,0 +1,62 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + Target configuration macros for S390. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +#if defined (__s390x__) +#ifndef S390X +#define S390X +#endif +#endif + +/* ---- System specific configurations ----------------------------------- */ + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV +} ffi_abi; +#endif + + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#ifdef S390X +#define FFI_TRAMPOLINE_SIZE 32 +#else +#define FFI_TRAMPOLINE_SIZE 16 +#endif +#define FFI_NATIVE_RAW_API 0 + +#endif + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/s390/sysv.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/s390/sysv.S new file mode 100644 index 000000000..4731a3177 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/s390/sysv.S @@ -0,0 +1,434 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2000 Software AG + Copyright (c) 2008 Red Hat, Inc. + + S390 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + +#ifndef __s390x__ + +.text + + # r2: cif->bytes + # r3: &ecif + # r4: ffi_prep_args + # r5: ret_type + # r6: ecif.rvalue + # ov: fn + + # This assumes we are using gas. + .globl ffi_call_SYSV + .type ffi_call_SYSV,%function +ffi_call_SYSV: +.LFB1: + stm %r6,%r15,24(%r15) # Save registers +.LCFI0: + basr %r13,0 # Set up base register +.Lbase: + lr %r11,%r15 # Set up frame pointer +.LCFI1: + sr %r15,%r2 + ahi %r15,-96-48 # Allocate stack + lr %r8,%r6 # Save ecif.rvalue + sr %r9,%r9 + ic %r9,.Ltable-.Lbase(%r13,%r5) # Load epilog address + l %r7,96(%r11) # Load function address + st %r11,0(%r15) # Set up back chain + ahi %r11,-48 # Register save area +.LCFI2: + + la %r2,96(%r15) # Save area + # r3 already holds &ecif + basr %r14,%r4 # Call ffi_prep_args + + lm %r2,%r6,0(%r11) # Load arguments + ld %f0,32(%r11) + ld %f2,40(%r11) + la %r14,0(%r13,%r9) # Set return address + br %r7 # ... and call function + +.LretNone: # Return void + l %r4,48+56(%r11) + lm %r6,%r15,48+24(%r11) + br %r4 + +.LretFloat: + l %r4,48+56(%r11) + ste %f0,0(%r8) # Return float + lm %r6,%r15,48+24(%r11) + br %r4 + +.LretDouble: + l %r4,48+56(%r11) + std %f0,0(%r8) # Return double + lm %r6,%r15,48+24(%r11) + br %r4 + +.LretInt32: + l %r4,48+56(%r11) + st %r2,0(%r8) # Return int + lm %r6,%r15,48+24(%r11) + br %r4 + +.LretInt64: + l %r4,48+56(%r11) + stm %r2,%r3,0(%r8) # Return long long + lm %r6,%r15,48+24(%r11) + br %r4 + +.Ltable: + .byte .LretNone-.Lbase # FFI390_RET_VOID + .byte .LretNone-.Lbase # FFI390_RET_STRUCT + .byte .LretFloat-.Lbase # FFI390_RET_FLOAT + .byte .LretDouble-.Lbase # FFI390_RET_DOUBLE + .byte .LretInt32-.Lbase # FFI390_RET_INT32 + .byte .LretInt64-.Lbase # FFI390_RET_INT64 + +.LFE1: +.ffi_call_SYSV_end: + .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV + + + .globl ffi_closure_SYSV + .type ffi_closure_SYSV,%function +ffi_closure_SYSV: +.LFB2: + stm %r12,%r15,48(%r15) # Save registers +.LCFI10: + basr %r13,0 # Set up base register +.Lcbase: + stm %r2,%r6,8(%r15) # Save arguments + std %f0,64(%r15) + std %f2,72(%r15) + lr %r1,%r15 # Set up stack frame + ahi %r15,-96 +.LCFI11: + l %r12,.Lchelper-.Lcbase(%r13) # Get helper function + lr %r2,%r0 # Closure + la %r3,8(%r1) # GPRs + la %r4,64(%r1) # FPRs + la %r5,96(%r1) # Overflow + st %r1,0(%r15) # Set up back chain + + bas %r14,0(%r12,%r13) # Call helper + + l %r4,96+56(%r15) + ld %f0,96+64(%r15) # Load return registers + lm %r2,%r3,96+8(%r15) + lm %r12,%r15,96+48(%r15) + br %r4 + + .align 4 +.Lchelper: + .long ffi_closure_helper_SYSV-.Lcbase + +.LFE2: + +.ffi_closure_SYSV_end: + .size ffi_closure_SYSV,.ffi_closure_SYSV_end-ffi_closure_SYSV + + + .section .eh_frame,EH_FRAME_FLAGS,@progbits +.Lframe1: + .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry +.LSCIE1: + .4byte 0x0 # CIE Identifier Tag + .byte 0x1 # CIE Version + .ascii "zR\0" # CIE Augmentation + .uleb128 0x1 # CIE Code Alignment Factor + .sleb128 -4 # CIE Data Alignment Factor + .byte 0xe # CIE RA Column + .uleb128 0x1 # Augmentation size + .byte 0x1b # FDE Encoding (pcrel sdata4) + .byte 0xc # DW_CFA_def_cfa + .uleb128 0xf + .uleb128 0x60 + .align 4 +.LECIE1: +.LSFDE1: + .4byte .LEFDE1-.LASFDE1 # FDE Length +.LASFDE1: + .4byte .LASFDE1-.Lframe1 # FDE CIE offset + .4byte .LFB1-. # FDE initial location + .4byte .LFE1-.LFB1 # FDE address range + .uleb128 0x0 # Augmentation size + .byte 0x4 # DW_CFA_advance_loc4 + .4byte .LCFI0-.LFB1 + .byte 0x8f # DW_CFA_offset, column 0xf + .uleb128 0x9 + .byte 0x8e # DW_CFA_offset, column 0xe + .uleb128 0xa + .byte 0x8d # DW_CFA_offset, column 0xd + .uleb128 0xb + .byte 0x8c # DW_CFA_offset, column 0xc + .uleb128 0xc + .byte 0x8b # DW_CFA_offset, column 0xb + .uleb128 0xd + .byte 0x8a # DW_CFA_offset, column 0xa + .uleb128 0xe + .byte 0x89 # DW_CFA_offset, column 0x9 + .uleb128 0xf + .byte 0x88 # DW_CFA_offset, column 0x8 + .uleb128 0x10 + .byte 0x87 # DW_CFA_offset, column 0x7 + .uleb128 0x11 + .byte 0x86 # DW_CFA_offset, column 0x6 + .uleb128 0x12 + .byte 0x4 # DW_CFA_advance_loc4 + .4byte .LCFI1-.LCFI0 + .byte 0xd # DW_CFA_def_cfa_register + .uleb128 0xb + .byte 0x4 # DW_CFA_advance_loc4 + .4byte .LCFI2-.LCFI1 + .byte 0xe # DW_CFA_def_cfa_offset + .uleb128 0x90 + .align 4 +.LEFDE1: +.LSFDE2: + .4byte .LEFDE2-.LASFDE2 # FDE Length +.LASFDE2: + .4byte .LASFDE2-.Lframe1 # FDE CIE offset + .4byte .LFB2-. # FDE initial location + .4byte .LFE2-.LFB2 # FDE address range + .uleb128 0x0 # Augmentation size + .byte 0x4 # DW_CFA_advance_loc4 + .4byte .LCFI10-.LFB2 + .byte 0x8f # DW_CFA_offset, column 0xf + .uleb128 0x9 + .byte 0x8e # DW_CFA_offset, column 0xe + .uleb128 0xa + .byte 0x8d # DW_CFA_offset, column 0xd + .uleb128 0xb + .byte 0x8c # DW_CFA_offset, column 0xc + .uleb128 0xc + .byte 0x4 # DW_CFA_advance_loc4 + .4byte .LCFI11-.LCFI10 + .byte 0xe # DW_CFA_def_cfa_offset + .uleb128 0xc0 + .align 4 +.LEFDE2: + +#else + +.text + + # r2: cif->bytes + # r3: &ecif + # r4: ffi_prep_args + # r5: ret_type + # r6: ecif.rvalue + # ov: fn + + # This assumes we are using gas. + .globl ffi_call_SYSV + .type ffi_call_SYSV,%function +ffi_call_SYSV: +.LFB1: + stmg %r6,%r15,48(%r15) # Save registers +.LCFI0: + larl %r13,.Lbase # Set up base register + lgr %r11,%r15 # Set up frame pointer +.LCFI1: + sgr %r15,%r2 + aghi %r15,-160-80 # Allocate stack + lgr %r8,%r6 # Save ecif.rvalue + llgc %r9,.Ltable-.Lbase(%r13,%r5) # Load epilog address + lg %r7,160(%r11) # Load function address + stg %r11,0(%r15) # Set up back chain + aghi %r11,-80 # Register save area +.LCFI2: + + la %r2,160(%r15) # Save area + # r3 already holds &ecif + basr %r14,%r4 # Call ffi_prep_args + + lmg %r2,%r6,0(%r11) # Load arguments + ld %f0,48(%r11) + ld %f2,56(%r11) + ld %f4,64(%r11) + ld %f6,72(%r11) + la %r14,0(%r13,%r9) # Set return address + br %r7 # ... and call function + +.Lbase: +.LretNone: # Return void + lg %r4,80+112(%r11) + lmg %r6,%r15,80+48(%r11) + br %r4 + +.LretFloat: + lg %r4,80+112(%r11) + ste %f0,0(%r8) # Return float + lmg %r6,%r15,80+48(%r11) + br %r4 + +.LretDouble: + lg %r4,80+112(%r11) + std %f0,0(%r8) # Return double + lmg %r6,%r15,80+48(%r11) + br %r4 + +.LretInt32: + lg %r4,80+112(%r11) + st %r2,0(%r8) # Return int + lmg %r6,%r15,80+48(%r11) + br %r4 + +.LretInt64: + lg %r4,80+112(%r11) + stg %r2,0(%r8) # Return long + lmg %r6,%r15,80+48(%r11) + br %r4 + +.Ltable: + .byte .LretNone-.Lbase # FFI390_RET_VOID + .byte .LretNone-.Lbase # FFI390_RET_STRUCT + .byte .LretFloat-.Lbase # FFI390_RET_FLOAT + .byte .LretDouble-.Lbase # FFI390_RET_DOUBLE + .byte .LretInt32-.Lbase # FFI390_RET_INT32 + .byte .LretInt64-.Lbase # FFI390_RET_INT64 + +.LFE1: +.ffi_call_SYSV_end: + .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV + + + .globl ffi_closure_SYSV + .type ffi_closure_SYSV,%function +ffi_closure_SYSV: +.LFB2: + stmg %r14,%r15,112(%r15) # Save registers +.LCFI10: + stmg %r2,%r6,16(%r15) # Save arguments + std %f0,128(%r15) + std %f2,136(%r15) + std %f4,144(%r15) + std %f6,152(%r15) + lgr %r1,%r15 # Set up stack frame + aghi %r15,-160 +.LCFI11: + lgr %r2,%r0 # Closure + la %r3,16(%r1) # GPRs + la %r4,128(%r1) # FPRs + la %r5,160(%r1) # Overflow + stg %r1,0(%r15) # Set up back chain + + brasl %r14,ffi_closure_helper_SYSV # Call helper + + lg %r14,160+112(%r15) + ld %f0,160+128(%r15) # Load return registers + lg %r2,160+16(%r15) + la %r15,160(%r15) + br %r14 +.LFE2: + +.ffi_closure_SYSV_end: + .size ffi_closure_SYSV,.ffi_closure_SYSV_end-ffi_closure_SYSV + + + + .section .eh_frame,EH_FRAME_FLAGS,@progbits +.Lframe1: + .4byte .LECIE1-.LSCIE1 # Length of Common Information Entry +.LSCIE1: + .4byte 0x0 # CIE Identifier Tag + .byte 0x1 # CIE Version + .ascii "zR\0" # CIE Augmentation + .uleb128 0x1 # CIE Code Alignment Factor + .sleb128 -8 # CIE Data Alignment Factor + .byte 0xe # CIE RA Column + .uleb128 0x1 # Augmentation size + .byte 0x1b # FDE Encoding (pcrel sdata4) + .byte 0xc # DW_CFA_def_cfa + .uleb128 0xf + .uleb128 0xa0 + .align 8 +.LECIE1: +.LSFDE1: + .4byte .LEFDE1-.LASFDE1 # FDE Length +.LASFDE1: + .4byte .LASFDE1-.Lframe1 # FDE CIE offset + .4byte .LFB1-. # FDE initial location + .4byte .LFE1-.LFB1 # FDE address range + .uleb128 0x0 # Augmentation size + .byte 0x4 # DW_CFA_advance_loc4 + .4byte .LCFI0-.LFB1 + .byte 0x8f # DW_CFA_offset, column 0xf + .uleb128 0x5 + .byte 0x8e # DW_CFA_offset, column 0xe + .uleb128 0x6 + .byte 0x8d # DW_CFA_offset, column 0xd + .uleb128 0x7 + .byte 0x8c # DW_CFA_offset, column 0xc + .uleb128 0x8 + .byte 0x8b # DW_CFA_offset, column 0xb + .uleb128 0x9 + .byte 0x8a # DW_CFA_offset, column 0xa + .uleb128 0xa + .byte 0x89 # DW_CFA_offset, column 0x9 + .uleb128 0xb + .byte 0x88 # DW_CFA_offset, column 0x8 + .uleb128 0xc + .byte 0x87 # DW_CFA_offset, column 0x7 + .uleb128 0xd + .byte 0x86 # DW_CFA_offset, column 0x6 + .uleb128 0xe + .byte 0x4 # DW_CFA_advance_loc4 + .4byte .LCFI1-.LCFI0 + .byte 0xd # DW_CFA_def_cfa_register + .uleb128 0xb + .byte 0x4 # DW_CFA_advance_loc4 + .4byte .LCFI2-.LCFI1 + .byte 0xe # DW_CFA_def_cfa_offset + .uleb128 0xf0 + .align 8 +.LEFDE1: +.LSFDE2: + .4byte .LEFDE2-.LASFDE2 # FDE Length +.LASFDE2: + .4byte .LASFDE2-.Lframe1 # FDE CIE offset + .4byte .LFB2-. # FDE initial location + .4byte .LFE2-.LFB2 # FDE address range + .uleb128 0x0 # Augmentation size + .byte 0x4 # DW_CFA_advance_loc4 + .4byte .LCFI10-.LFB2 + .byte 0x8f # DW_CFA_offset, column 0xf + .uleb128 0x5 + .byte 0x8e # DW_CFA_offset, column 0xe + .uleb128 0x6 + .byte 0x4 # DW_CFA_advance_loc4 + .4byte .LCFI11-.LCFI10 + .byte 0xe # DW_CFA_def_cfa_offset + .uleb128 0x140 + .align 8 +.LEFDE2: + +#endif + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sh/ffi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sh/ffi.c new file mode 100644 index 000000000..69bd025fb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sh/ffi.c @@ -0,0 +1,716 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2002, 2003, 2004, 2005, 2006, 2007, 2008 Kaz Kojima + Copyright (c) 2008 Red Hat, Inc. + + SuperH Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +#include + +#define NGREGARG 4 +#if defined(__SH4__) +#define NFREGARG 8 +#endif + +#if defined(__HITACHI__) +#define STRUCT_VALUE_ADDRESS_WITH_ARG 1 +#else +#define STRUCT_VALUE_ADDRESS_WITH_ARG 0 +#endif + +/* If the structure has essentialy an unique element, return its type. */ +static int +simple_type (ffi_type *arg) +{ + if (arg->type != FFI_TYPE_STRUCT) + return arg->type; + else if (arg->elements[1]) + return FFI_TYPE_STRUCT; + + return simple_type (arg->elements[0]); +} + +static int +return_type (ffi_type *arg) +{ + unsigned short type; + + if (arg->type != FFI_TYPE_STRUCT) + return arg->type; + + type = simple_type (arg->elements[0]); + if (! arg->elements[1]) + { + switch (type) + { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + return FFI_TYPE_INT; + + default: + return type; + } + } + + /* gcc uses r0/r1 pair for some kind of structures. */ + if (arg->size <= 2 * sizeof (int)) + { + int i = 0; + ffi_type *e; + + while ((e = arg->elements[i++])) + { + type = simple_type (e); + switch (type) + { + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT32: + case FFI_TYPE_INT: + case FFI_TYPE_FLOAT: + return FFI_TYPE_UINT64; + + default: + break; + } + } + } + + return FFI_TYPE_STRUCT; +} + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments */ + +void ffi_prep_args(char *stack, extended_cif *ecif) +{ + register unsigned int i; + register int tmp; + register unsigned int avn; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + int greg, ireg; +#if defined(__SH4__) + int freg = 0; +#endif + + tmp = 0; + argp = stack; + + if (return_type (ecif->cif->rtype) == FFI_TYPE_STRUCT) + { + *(void **) argp = ecif->rvalue; + argp += 4; + ireg = STRUCT_VALUE_ADDRESS_WITH_ARG ? 1 : 0; + } + else + ireg = 0; + + /* Set arguments for registers. */ + greg = ireg; + avn = ecif->cif->nargs; + p_argv = ecif->avalue; + + for (i = 0, p_arg = ecif->cif->arg_types; i < avn; i++, p_arg++, p_argv++) + { + size_t z; + + z = (*p_arg)->size; + if (z < sizeof(int)) + { + if (greg++ >= NGREGARG) + continue; + + z = sizeof(int); + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); + break; + + case FFI_TYPE_UINT8: + *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); + break; + + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); + break; + + case FFI_TYPE_UINT16: + *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); + break; + + case FFI_TYPE_STRUCT: + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + break; + + default: + FFI_ASSERT(0); + } + argp += z; + } + else if (z == sizeof(int)) + { +#if defined(__SH4__) + if ((*p_arg)->type == FFI_TYPE_FLOAT) + { + if (freg++ >= NFREGARG) + continue; + } + else +#endif + { + if (greg++ >= NGREGARG) + continue; + } + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + argp += z; + } +#if defined(__SH4__) + else if ((*p_arg)->type == FFI_TYPE_DOUBLE) + { + if (freg + 1 >= NFREGARG) + continue; + freg = (freg + 1) & ~1; + freg += 2; + memcpy (argp, *p_argv, z); + argp += z; + } +#endif + else + { + int n = (z + sizeof (int) - 1) / sizeof (int); +#if defined(__SH4__) + if (greg + n - 1 >= NGREGARG) + continue; +#else + if (greg >= NGREGARG) + continue; +#endif + greg += n; + memcpy (argp, *p_argv, z); + argp += n * sizeof (int); + } + } + + /* Set arguments on stack. */ + greg = ireg; +#if defined(__SH4__) + freg = 0; +#endif + p_argv = ecif->avalue; + + for (i = 0, p_arg = ecif->cif->arg_types; i < avn; i++, p_arg++, p_argv++) + { + size_t z; + + z = (*p_arg)->size; + if (z < sizeof(int)) + { + if (greg++ < NGREGARG) + continue; + + z = sizeof(int); + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(signed int *) argp = (signed int)*(SINT8 *)(* p_argv); + break; + + case FFI_TYPE_UINT8: + *(unsigned int *) argp = (unsigned int)*(UINT8 *)(* p_argv); + break; + + case FFI_TYPE_SINT16: + *(signed int *) argp = (signed int)*(SINT16 *)(* p_argv); + break; + + case FFI_TYPE_UINT16: + *(unsigned int *) argp = (unsigned int)*(UINT16 *)(* p_argv); + break; + + case FFI_TYPE_STRUCT: + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + break; + + default: + FFI_ASSERT(0); + } + argp += z; + } + else if (z == sizeof(int)) + { +#if defined(__SH4__) + if ((*p_arg)->type == FFI_TYPE_FLOAT) + { + if (freg++ < NFREGARG) + continue; + } + else +#endif + { + if (greg++ < NGREGARG) + continue; + } + *(unsigned int *) argp = (unsigned int)*(UINT32 *)(* p_argv); + argp += z; + } +#if defined(__SH4__) + else if ((*p_arg)->type == FFI_TYPE_DOUBLE) + { + if (freg + 1 < NFREGARG) + { + freg = (freg + 1) & ~1; + freg += 2; + continue; + } + memcpy (argp, *p_argv, z); + argp += z; + } +#endif + else + { + int n = (z + sizeof (int) - 1) / sizeof (int); + if (greg + n - 1 < NGREGARG) + { + greg += n; + continue; + } +#if (! defined(__SH4__)) + else if (greg < NGREGARG) + { + greg = NGREGARG; + continue; + } +#endif + memcpy (argp, *p_argv, z); + argp += n * sizeof (int); + } + } + + return; +} + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + int i, j; + int size, type; + int n, m; + int greg; +#if defined(__SH4__) + int freg = 0; +#endif + + cif->flags = 0; + + greg = ((return_type (cif->rtype) == FFI_TYPE_STRUCT) && + STRUCT_VALUE_ADDRESS_WITH_ARG) ? 1 : 0; + +#if defined(__SH4__) + for (i = j = 0; i < cif->nargs && j < 12; i++) + { + type = (cif->arg_types)[i]->type; + switch (type) + { + case FFI_TYPE_FLOAT: + if (freg >= NFREGARG) + continue; + freg++; + cif->flags += ((cif->arg_types)[i]->type) << (2 * j); + j++; + break; + + case FFI_TYPE_DOUBLE: + if ((freg + 1) >= NFREGARG) + continue; + freg = (freg + 1) & ~1; + freg += 2; + cif->flags += ((cif->arg_types)[i]->type) << (2 * j); + j++; + break; + + default: + size = (cif->arg_types)[i]->size; + n = (size + sizeof (int) - 1) / sizeof (int); + if (greg + n - 1 >= NGREGARG) + continue; + greg += n; + for (m = 0; m < n; m++) + cif->flags += FFI_TYPE_INT << (2 * j++); + break; + } + } +#else + for (i = j = 0; i < cif->nargs && j < 4; i++) + { + size = (cif->arg_types)[i]->size; + n = (size + sizeof (int) - 1) / sizeof (int); + if (greg >= NGREGARG) + continue; + else if (greg + n - 1 >= NGREGARG) + n = NGREGARG - greg; + greg += n; + for (m = 0; m < n; m++) + cif->flags += FFI_TYPE_INT << (2 * j++); + } +#endif + + /* Set the return type flag */ + switch (cif->rtype->type) + { + case FFI_TYPE_STRUCT: + cif->flags += (unsigned) (return_type (cif->rtype)) << 24; + break; + + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + cif->flags += (unsigned) cif->rtype->type << 24; + break; + + default: + cif->flags += FFI_TYPE_INT << 24; + break; + } + + return FFI_OK; +} + +extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, + unsigned, unsigned, unsigned *, void (*fn)(void)); + +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + UINT64 trvalue; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + + if (cif->rtype->type == FFI_TYPE_STRUCT + && return_type (cif->rtype) != FFI_TYPE_STRUCT) + ecif.rvalue = &trvalue; + else if ((rvalue == NULL) && + (cif->rtype->type == FFI_TYPE_STRUCT)) + { + ecif.rvalue = alloca(cif->rtype->size); + } + else + ecif.rvalue = rvalue; + + switch (cif->abi) + { + case FFI_SYSV: + ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, + fn); + break; + default: + FFI_ASSERT(0); + break; + } + + if (rvalue + && cif->rtype->type == FFI_TYPE_STRUCT + && return_type (cif->rtype) != FFI_TYPE_STRUCT) + memcpy (rvalue, &trvalue, cif->rtype->size); +} + +extern void ffi_closure_SYSV (void); +#if defined(__SH4__) +extern void __ic_invalidate (void *line); +#endif + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void *user_data, + void *codeloc) +{ + unsigned int *tramp; + unsigned int insn; + + FFI_ASSERT (cif->abi == FFI_GCC_SYSV); + + tramp = (unsigned int *) &closure->tramp[0]; + /* Set T bit if the function returns a struct pointed with R2. */ + insn = (return_type (cif->rtype) == FFI_TYPE_STRUCT + ? 0x0018 /* sett */ + : 0x0008 /* clrt */); + +#ifdef __LITTLE_ENDIAN__ + tramp[0] = 0xd301d102; + tramp[1] = 0x0000412b | (insn << 16); +#else + tramp[0] = 0xd102d301; + tramp[1] = 0x412b0000 | insn; +#endif + *(void **) &tramp[2] = (void *)codeloc; /* ctx */ + *(void **) &tramp[3] = (void *)ffi_closure_SYSV; /* funaddr */ + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + +#if defined(__SH4__) + /* Flush the icache. */ + __ic_invalidate(codeloc); +#endif + + return FFI_OK; +} + +/* Basically the trampoline invokes ffi_closure_SYSV, and on + * entry, r3 holds the address of the closure. + * After storing the registers that could possibly contain + * parameters to be passed into the stack frame and setting + * up space for a return value, ffi_closure_SYSV invokes the + * following helper function to do most of the work. + */ + +#ifdef __LITTLE_ENDIAN__ +#define OFS_INT8 0 +#define OFS_INT16 0 +#else +#define OFS_INT8 3 +#define OFS_INT16 2 +#endif + +int +ffi_closure_helper_SYSV (ffi_closure *closure, void *rvalue, + unsigned long *pgr, unsigned long *pfr, + unsigned long *pst) +{ + void **avalue; + ffi_type **p_arg; + int i, avn; + int ireg, greg = 0; +#if defined(__SH4__) + int freg = 0; +#endif + ffi_cif *cif; + + cif = closure->cif; + avalue = alloca(cif->nargs * sizeof(void *)); + + /* Copy the caller's structure return value address so that the closure + returns the data directly to the caller. */ + if (cif->rtype->type == FFI_TYPE_STRUCT && STRUCT_VALUE_ADDRESS_WITH_ARG) + { + rvalue = (void *) *pgr++; + ireg = 1; + } + else + ireg = 0; + + cif = closure->cif; + greg = ireg; + avn = cif->nargs; + + /* Grab the addresses of the arguments from the stack frame. */ + for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) + { + size_t z; + + z = (*p_arg)->size; + if (z < sizeof(int)) + { + if (greg++ >= NGREGARG) + continue; + + z = sizeof(int); + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + avalue[i] = (((char *)pgr) + OFS_INT8); + break; + + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + avalue[i] = (((char *)pgr) + OFS_INT16); + break; + + case FFI_TYPE_STRUCT: + avalue[i] = pgr; + break; + + default: + FFI_ASSERT(0); + } + pgr++; + } + else if (z == sizeof(int)) + { +#if defined(__SH4__) + if ((*p_arg)->type == FFI_TYPE_FLOAT) + { + if (freg++ >= NFREGARG) + continue; + avalue[i] = pfr; + pfr++; + } + else +#endif + { + if (greg++ >= NGREGARG) + continue; + avalue[i] = pgr; + pgr++; + } + } +#if defined(__SH4__) + else if ((*p_arg)->type == FFI_TYPE_DOUBLE) + { + if (freg + 1 >= NFREGARG) + continue; + if (freg & 1) + pfr++; + freg = (freg + 1) & ~1; + freg += 2; + avalue[i] = pfr; + pfr += 2; + } +#endif + else + { + int n = (z + sizeof (int) - 1) / sizeof (int); +#if defined(__SH4__) + if (greg + n - 1 >= NGREGARG) + continue; +#else + if (greg >= NGREGARG) + continue; +#endif + greg += n; + avalue[i] = pgr; + pgr += n; + } + } + + greg = ireg; +#if defined(__SH4__) + freg = 0; +#endif + + for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) + { + size_t z; + + z = (*p_arg)->size; + if (z < sizeof(int)) + { + if (greg++ < NGREGARG) + continue; + + z = sizeof(int); + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + avalue[i] = (((char *)pst) + OFS_INT8); + break; + + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + avalue[i] = (((char *)pst) + OFS_INT16); + break; + + case FFI_TYPE_STRUCT: + avalue[i] = pst; + break; + + default: + FFI_ASSERT(0); + } + pst++; + } + else if (z == sizeof(int)) + { +#if defined(__SH4__) + if ((*p_arg)->type == FFI_TYPE_FLOAT) + { + if (freg++ < NFREGARG) + continue; + } + else +#endif + { + if (greg++ < NGREGARG) + continue; + } + avalue[i] = pst; + pst++; + } +#if defined(__SH4__) + else if ((*p_arg)->type == FFI_TYPE_DOUBLE) + { + if (freg + 1 < NFREGARG) + { + freg = (freg + 1) & ~1; + freg += 2; + continue; + } + avalue[i] = pst; + pst += 2; + } +#endif + else + { + int n = (z + sizeof (int) - 1) / sizeof (int); + if (greg + n - 1 < NGREGARG) + { + greg += n; + continue; + } +#if (! defined(__SH4__)) + else if (greg < NGREGARG) + { + greg += n; + pst += greg - NGREGARG; + continue; + } +#endif + avalue[i] = pst; + pst += n; + } + } + + (closure->fun) (cif, rvalue, avalue, closure->user_data); + + /* Tell ffi_closure_SYSV how to perform return type promotions. */ + return return_type (cif->rtype); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sh/ffitarget.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sh/ffitarget.h new file mode 100644 index 000000000..4f1f63960 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sh/ffitarget.h @@ -0,0 +1,49 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + Target configuration macros for SuperH. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +/* ---- Generic type definitions ----------------------------------------- */ + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV +} ffi_abi; +#endif + +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 16 +#define FFI_NATIVE_RAW_API 0 + +#endif + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sh/sysv.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sh/sysv.S new file mode 100644 index 000000000..5be7516d6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sh/sysv.S @@ -0,0 +1,850 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2002, 2003, 2004, 2006, 2008 Kaz Kojima + + SuperH Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include +#ifdef HAVE_MACHINE_ASM_H +#include +#else +/* XXX these lose for some platforms, I'm sure. */ +#define CNAME(x) x +#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): +#endif + +#if defined(__HITACHI__) +#define STRUCT_VALUE_ADDRESS_WITH_ARG 1 +#else +#define STRUCT_VALUE_ADDRESS_WITH_ARG 0 +#endif + +.text + + # r4: ffi_prep_args + # r5: &ecif + # r6: bytes + # r7: flags + # sp+0: rvalue + # sp+4: fn + + # This assumes we are using gas. +ENTRY(ffi_call_SYSV) + # Save registers +.LFB1: + mov.l r8,@-r15 +.LCFI0: + mov.l r9,@-r15 +.LCFI1: + mov.l r10,@-r15 +.LCFI2: + mov.l r12,@-r15 +.LCFI3: + mov.l r14,@-r15 +.LCFI4: + sts.l pr,@-r15 +.LCFI5: + mov r15,r14 +.LCFI6: +#if defined(__SH4__) + mov r6,r8 + mov r7,r9 + + sub r6,r15 + add #-16,r15 + mov #~7,r0 + and r0,r15 + + mov r4,r0 + jsr @r0 + mov r15,r4 + + mov r9,r1 + shlr8 r9 + shlr8 r9 + shlr8 r9 + + mov #FFI_TYPE_STRUCT,r2 + cmp/eq r2,r9 + bf 1f +#if STRUCT_VALUE_ADDRESS_WITH_ARG + mov.l @r15+,r4 + bra 2f + mov #5,r2 +#else + mov.l @r15+,r10 +#endif +1: + mov #4,r2 +2: + mov #4,r3 + +L_pass: + cmp/pl r8 + bf L_call_it + + mov r1,r0 + and #3,r0 + +L_pass_d: + cmp/eq #FFI_TYPE_DOUBLE,r0 + bf L_pass_f + + mov r3,r0 + and #1,r0 + tst r0,r0 + bt 1f + add #1,r3 +1: + mov #12,r0 + cmp/hs r0,r3 + bt/s 3f + shlr2 r1 + bsr L_pop_d + nop +3: + add #2,r3 + bra L_pass + add #-8,r8 + +L_pop_d: + mov r3,r0 + add r0,r0 + add r3,r0 + add #-12,r0 + braf r0 + nop +#ifdef __LITTLE_ENDIAN__ + fmov.s @r15+,fr5 + rts + fmov.s @r15+,fr4 + fmov.s @r15+,fr7 + rts + fmov.s @r15+,fr6 + fmov.s @r15+,fr9 + rts + fmov.s @r15+,fr8 + fmov.s @r15+,fr11 + rts + fmov.s @r15+,fr10 +#else + fmov.s @r15+,fr4 + rts + fmov.s @r15+,fr5 + fmov.s @r15+,fr6 + rts + fmov.s @r15+,fr7 + fmov.s @r15+,fr8 + rts + fmov.s @r15+,fr9 + fmov.s @r15+,fr10 + rts + fmov.s @r15+,fr11 +#endif + +L_pass_f: + cmp/eq #FFI_TYPE_FLOAT,r0 + bf L_pass_i + + mov #12,r0 + cmp/hs r0,r3 + bt/s 2f + shlr2 r1 + bsr L_pop_f + nop +2: + add #1,r3 + bra L_pass + add #-4,r8 + +L_pop_f: + mov r3,r0 + shll2 r0 + add #-16,r0 + braf r0 + nop +#ifdef __LITTLE_ENDIAN__ + rts + fmov.s @r15+,fr5 + rts + fmov.s @r15+,fr4 + rts + fmov.s @r15+,fr7 + rts + fmov.s @r15+,fr6 + rts + fmov.s @r15+,fr9 + rts + fmov.s @r15+,fr8 + rts + fmov.s @r15+,fr11 + rts + fmov.s @r15+,fr10 +#else + rts + fmov.s @r15+,fr4 + rts + fmov.s @r15+,fr5 + rts + fmov.s @r15+,fr6 + rts + fmov.s @r15+,fr7 + rts + fmov.s @r15+,fr8 + rts + fmov.s @r15+,fr9 + rts + fmov.s @r15+,fr10 + rts + fmov.s @r15+,fr11 +#endif + +L_pass_i: + cmp/eq #FFI_TYPE_INT,r0 + bf L_call_it + + mov #8,r0 + cmp/hs r0,r2 + bt/s 2f + shlr2 r1 + bsr L_pop_i + nop +2: + add #1,r2 + bra L_pass + add #-4,r8 + +L_pop_i: + mov r2,r0 + shll2 r0 + add #-16,r0 + braf r0 + nop + rts + mov.l @r15+,r4 + rts + mov.l @r15+,r5 + rts + mov.l @r15+,r6 + rts + mov.l @r15+,r7 + +L_call_it: + # call function +#if (! STRUCT_VALUE_ADDRESS_WITH_ARG) + mov r10, r2 +#endif + mov.l @(28,r14),r1 + jsr @r1 + nop + +L_ret_d: + mov #FFI_TYPE_DOUBLE,r2 + cmp/eq r2,r9 + bf L_ret_ll + + mov.l @(24,r14),r1 +#ifdef __LITTLE_ENDIAN__ + fmov.s fr1,@r1 + add #4,r1 + bra L_epilogue + fmov.s fr0,@r1 +#else + fmov.s fr0,@r1 + add #4,r1 + bra L_epilogue + fmov.s fr1,@r1 +#endif + +L_ret_ll: + mov #FFI_TYPE_SINT64,r2 + cmp/eq r2,r9 + bt/s 1f + mov #FFI_TYPE_UINT64,r2 + cmp/eq r2,r9 + bf L_ret_f + +1: + mov.l @(24,r14),r2 + mov.l r0,@r2 + bra L_epilogue + mov.l r1,@(4,r2) + +L_ret_f: + mov #FFI_TYPE_FLOAT,r2 + cmp/eq r2,r9 + bf L_ret_i + + mov.l @(24,r14),r1 + bra L_epilogue + fmov.s fr0,@r1 + +L_ret_i: + mov #FFI_TYPE_INT,r2 + cmp/eq r2,r9 + bf L_epilogue + + mov.l @(24,r14),r1 + bra L_epilogue + mov.l r0,@r1 + +L_epilogue: + # Remove the space we pushed for the args + mov r14,r15 + + lds.l @r15+,pr + mov.l @r15+,r14 + mov.l @r15+,r12 + mov.l @r15+,r10 + mov.l @r15+,r9 + rts + mov.l @r15+,r8 +#else + mov r6,r8 + mov r7,r9 + + sub r6,r15 + add #-16,r15 + mov #~7,r0 + and r0,r15 + + mov r4,r0 + jsr @r0 + mov r15,r4 + + mov r9,r3 + shlr8 r9 + shlr8 r9 + shlr8 r9 + + mov #FFI_TYPE_STRUCT,r2 + cmp/eq r2,r9 + bf 1f +#if STRUCT_VALUE_ADDRESS_WITH_ARG + mov.l @r15+,r4 + bra 2f + mov #5,r2 +#else + mov.l @r15+,r10 +#endif +1: + mov #4,r2 +2: + +L_pass: + cmp/pl r8 + bf L_call_it + + mov r3,r0 + and #3,r0 + +L_pass_d: + cmp/eq #FFI_TYPE_DOUBLE,r0 + bf L_pass_i + + mov r15,r0 + and #7,r0 + tst r0,r0 + bt 1f + add #4,r15 +1: + mov #8,r0 + cmp/hs r0,r2 + bt/s 2f + shlr2 r3 + bsr L_pop_d + nop +2: + add #2,r2 + bra L_pass + add #-8,r8 + +L_pop_d: + mov r2,r0 + add r0,r0 + add r2,r0 + add #-12,r0 + add r0,r0 + braf r0 + nop + mov.l @r15+,r4 + rts + mov.l @r15+,r5 + mov.l @r15+,r5 + rts + mov.l @r15+,r6 + mov.l @r15+,r6 + rts + mov.l @r15+,r7 + rts + mov.l @r15+,r7 + +L_pass_i: + cmp/eq #FFI_TYPE_INT,r0 + bf L_call_it + + mov #8,r0 + cmp/hs r0,r2 + bt/s 2f + shlr2 r3 + bsr L_pop_i + nop +2: + add #1,r2 + bra L_pass + add #-4,r8 + +L_pop_i: + mov r2,r0 + shll2 r0 + add #-16,r0 + braf r0 + nop + rts + mov.l @r15+,r4 + rts + mov.l @r15+,r5 + rts + mov.l @r15+,r6 + rts + mov.l @r15+,r7 + +L_call_it: + # call function +#if (! STRUCT_VALUE_ADDRESS_WITH_ARG) + mov r10, r2 +#endif + mov.l @(28,r14),r1 + jsr @r1 + nop + +L_ret_d: + mov #FFI_TYPE_DOUBLE,r2 + cmp/eq r2,r9 + bf L_ret_ll + + mov.l @(24,r14),r2 + mov.l r0,@r2 + bra L_epilogue + mov.l r1,@(4,r2) + +L_ret_ll: + mov #FFI_TYPE_SINT64,r2 + cmp/eq r2,r9 + bt/s 1f + mov #FFI_TYPE_UINT64,r2 + cmp/eq r2,r9 + bf L_ret_i + +1: + mov.l @(24,r14),r2 + mov.l r0,@r2 + bra L_epilogue + mov.l r1,@(4,r2) + +L_ret_i: + mov #FFI_TYPE_FLOAT,r2 + cmp/eq r2,r9 + bt 1f + mov #FFI_TYPE_INT,r2 + cmp/eq r2,r9 + bf L_epilogue +1: + mov.l @(24,r14),r1 + bra L_epilogue + mov.l r0,@r1 + +L_epilogue: + # Remove the space we pushed for the args + mov r14,r15 + + lds.l @r15+,pr + mov.l @r15+,r14 + mov.l @r15+,r12 + mov.l @r15+,r10 + mov.l @r15+,r9 + rts + mov.l @r15+,r8 +#endif +.LFE1: +.ffi_call_SYSV_end: + .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) + +.globl ffi_closure_helper_SYSV + +ENTRY(ffi_closure_SYSV) +.LFB2: + mov.l r7,@-r15 +.LCFI7: + mov.l r6,@-r15 +.LCFI8: + mov.l r5,@-r15 +.LCFI9: + mov.l r4,@-r15 +.LCFIA: + mov.l r14,@-r15 +.LCFIB: + sts.l pr,@-r15 + + /* Stack layout: + xx bytes (on stack parameters) + 16 bytes (register parameters) + 4 bytes (saved frame pointer) + 4 bytes (saved return address) + 32 bytes (floating register parameters, SH-4 only) + 8 bytes (result) + 4 bytes (pad) + 4 bytes (5th arg) + <- new stack pointer + */ +.LCFIC: +#if defined(__SH4__) + add #-48,r15 +#else + add #-16,r15 +#endif +.LCFID: + mov r15,r14 +.LCFIE: + +#if defined(__SH4__) + mov r14,r1 + add #48,r1 +#ifdef __LITTLE_ENDIAN__ + fmov.s fr10,@-r1 + fmov.s fr11,@-r1 + fmov.s fr8,@-r1 + fmov.s fr9,@-r1 + fmov.s fr6,@-r1 + fmov.s fr7,@-r1 + fmov.s fr4,@-r1 + fmov.s fr5,@-r1 +#else + fmov.s fr11,@-r1 + fmov.s fr10,@-r1 + fmov.s fr9,@-r1 + fmov.s fr8,@-r1 + fmov.s fr7,@-r1 + fmov.s fr6,@-r1 + fmov.s fr5,@-r1 + fmov.s fr4,@-r1 +#endif + mov r1,r7 + mov r14,r6 + add #56,r6 +#else + mov r14,r6 + add #24,r6 +#endif + + bt/s 10f + mov r2, r5 + mov r14,r1 + add #8,r1 + mov r1,r5 +10: + + mov r14,r1 +#if defined(__SH4__) + add #72,r1 +#else + add #40,r1 +#endif + mov.l r1,@r14 + +#ifdef PIC + mov.l L_got,r1 + mova L_got,r0 + add r0,r1 + mov.l L_helper,r0 + add r1,r0 +#else + mov.l L_helper,r0 +#endif + jsr @r0 + mov r3,r4 + + shll r0 + mov r0,r1 + mova L_table,r0 + add r1,r0 + mov.w @r0,r0 + mov r14,r2 + braf r0 + add #8,r2 +0: + .align 2 +#ifdef PIC +L_got: + .long _GLOBAL_OFFSET_TABLE_ +L_helper: + .long ffi_closure_helper_SYSV@GOTOFF +#else +L_helper: + .long ffi_closure_helper_SYSV +#endif +L_table: + .short L_case_v - 0b /* FFI_TYPE_VOID */ + .short L_case_i - 0b /* FFI_TYPE_INT */ +#if defined(__SH4__) + .short L_case_f - 0b /* FFI_TYPE_FLOAT */ + .short L_case_d - 0b /* FFI_TYPE_DOUBLE */ + .short L_case_d - 0b /* FFI_TYPE_LONGDOUBLE */ +#else + .short L_case_i - 0b /* FFI_TYPE_FLOAT */ + .short L_case_ll - 0b /* FFI_TYPE_DOUBLE */ + .short L_case_ll - 0b /* FFI_TYPE_LONGDOUBLE */ +#endif + .short L_case_uq - 0b /* FFI_TYPE_UINT8 */ + .short L_case_q - 0b /* FFI_TYPE_SINT8 */ + .short L_case_uh - 0b /* FFI_TYPE_UINT16 */ + .short L_case_h - 0b /* FFI_TYPE_SINT16 */ + .short L_case_i - 0b /* FFI_TYPE_UINT32 */ + .short L_case_i - 0b /* FFI_TYPE_SINT32 */ + .short L_case_ll - 0b /* FFI_TYPE_UINT64 */ + .short L_case_ll - 0b /* FFI_TYPE_SINT64 */ + .short L_case_v - 0b /* FFI_TYPE_STRUCT */ + .short L_case_i - 0b /* FFI_TYPE_POINTER */ + +#if defined(__SH4__) +L_case_d: +#ifdef __LITTLE_ENDIAN__ + fmov.s @r2+,fr1 + bra L_case_v + fmov.s @r2,fr0 +#else + fmov.s @r2+,fr0 + bra L_case_v + fmov.s @r2,fr1 +#endif + +L_case_f: + bra L_case_v + fmov.s @r2,fr0 +#endif + +L_case_ll: + mov.l @r2+,r0 + bra L_case_v + mov.l @r2,r1 + +L_case_i: + bra L_case_v + mov.l @r2,r0 + +L_case_q: +#ifdef __LITTLE_ENDIAN__ +#else + add #3,r2 +#endif + bra L_case_v + mov.b @r2,r0 + +L_case_uq: +#ifdef __LITTLE_ENDIAN__ +#else + add #3,r2 +#endif + mov.b @r2,r0 + bra L_case_v + extu.b r0,r0 + +L_case_h: +#ifdef __LITTLE_ENDIAN__ +#else + add #2,r2 +#endif + bra L_case_v + mov.w @r2,r0 + +L_case_uh: +#ifdef __LITTLE_ENDIAN__ +#else + add #2,r2 +#endif + mov.w @r2,r0 + extu.w r0,r0 + /* fall through */ + +L_case_v: +#if defined(__SH4__) + add #48,r15 +#else + add #16,r15 +#endif + lds.l @r15+,pr + mov.l @r15+,r14 + rts + add #16,r15 +.LFE2: +.ffi_closure_SYSV_end: + .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif + + .section ".eh_frame","aw",@progbits +__FRAME_BEGIN__: + .4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */ +.LSCIE1: + .4byte 0x0 /* CIE Identifier Tag */ + .byte 0x1 /* CIE Version */ +#ifdef PIC + .ascii "zR\0" /* CIE Augmentation */ +#else + .byte 0x0 /* CIE Augmentation */ +#endif + .byte 0x1 /* uleb128 0x1; CIE Code Alignment Factor */ + .byte 0x7c /* sleb128 -4; CIE Data Alignment Factor */ + .byte 0x11 /* CIE RA Column */ +#ifdef PIC + .uleb128 0x1 /* Augmentation size */ + .byte 0x10 /* FDE Encoding (pcrel) */ +#endif + .byte 0xc /* DW_CFA_def_cfa */ + .byte 0xf /* uleb128 0xf */ + .byte 0x0 /* uleb128 0x0 */ + .align 2 +.LECIE1: +.LSFDE1: + .4byte .LEFDE1-.LASFDE1 /* FDE Length */ +.LASFDE1: + .4byte .LASFDE1-__FRAME_BEGIN__ /* FDE CIE offset */ +#ifdef PIC + .4byte .LFB1-. /* FDE initial location */ +#else + .4byte .LFB1 /* FDE initial location */ +#endif + .4byte .LFE1-.LFB1 /* FDE address range */ +#ifdef PIC + .uleb128 0x0 /* Augmentation size */ +#endif + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte .LCFI0-.LFB1 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x4 /* uleb128 0x4 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte .LCFI1-.LCFI0 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x8 /* uleb128 0x4 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte .LCFI2-.LCFI1 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0xc /* uleb128 0x4 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte .LCFI3-.LCFI2 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x10 /* uleb128 0x4 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte .LCFI4-.LCFI3 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x14 /* uleb128 0x4 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte .LCFI5-.LCFI4 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x18 /* uleb128 0x4 */ + .byte 0x91 /* DW_CFA_offset, column 0x11 */ + .byte 0x6 /* uleb128 0x6 */ + .byte 0x8e /* DW_CFA_offset, column 0xe */ + .byte 0x5 /* uleb128 0x5 */ + .byte 0x8c /* DW_CFA_offset, column 0xc */ + .byte 0x4 /* uleb128 0x4 */ + .byte 0x8a /* DW_CFA_offset, column 0xa */ + .byte 0x3 /* uleb128 0x3 */ + .byte 0x89 /* DW_CFA_offset, column 0x9 */ + .byte 0x2 /* uleb128 0x2 */ + .byte 0x88 /* DW_CFA_offset, column 0x8 */ + .byte 0x1 /* uleb128 0x1 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte .LCFI6-.LCFI5 + .byte 0xd /* DW_CFA_def_cfa_register */ + .byte 0xe /* uleb128 0xe */ + .align 2 +.LEFDE1: + +.LSFDE3: + .4byte .LEFDE3-.LASFDE3 /* FDE Length */ +.LASFDE3: + .4byte .LASFDE3-__FRAME_BEGIN__ /* FDE CIE offset */ +#ifdef PIC + .4byte .LFB2-. /* FDE initial location */ +#else + .4byte .LFB2 /* FDE initial location */ +#endif + .4byte .LFE2-.LFB2 /* FDE address range */ +#ifdef PIC + .uleb128 0x0 /* Augmentation size */ +#endif + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte .LCFI7-.LFB2 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x4 /* uleb128 0x4 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte .LCFI8-.LCFI7 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x8 /* uleb128 0x4 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte .LCFI9-.LCFI8 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0xc /* uleb128 0x4 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte .LCFIA-.LCFI9 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x10 /* uleb128 0x4 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte .LCFIB-.LCFIA + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x14 /* uleb128 0x4 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte .LCFIC-.LCFIB + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x18 /* uleb128 0x4 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte .LCFID-.LCFIC + .byte 0xe /* DW_CFA_def_cfa_offset */ +#if defined(__SH4__) + .byte 24+48 /* uleb128 24+48 */ +#else + .byte 24+16 /* uleb128 24+16 */ +#endif + .byte 0x91 /* DW_CFA_offset, column 0x11 */ + .byte 0x6 /* uleb128 0x6 */ + .byte 0x8e /* DW_CFA_offset, column 0xe */ + .byte 0x5 /* uleb128 0x5 */ + .byte 0x84 /* DW_CFA_offset, column 0x4 */ + .byte 0x4 /* uleb128 0x4 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 */ + .byte 0x3 /* uleb128 0x3 */ + .byte 0x86 /* DW_CFA_offset, column 0x6 */ + .byte 0x2 /* uleb128 0x2 */ + .byte 0x87 /* DW_CFA_offset, column 0x7 */ + .byte 0x1 /* uleb128 0x1 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte .LCFIE-.LCFID + .byte 0xd /* DW_CFA_def_cfa_register */ + .byte 0xe /* uleb128 0xe */ + .align 2 +.LEFDE3: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sh64/ffi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sh64/ffi.c new file mode 100644 index 000000000..8fbc05ca6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sh64/ffi.c @@ -0,0 +1,468 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2003, 2004, 2006, 2007 Kaz Kojima + Copyright (c) 2008 Anthony Green + + SuperH SHmedia Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +#include + +#define NGREGARG 8 +#define NFREGARG 12 + +static int +return_type (ffi_type *arg) +{ + + if (arg->type != FFI_TYPE_STRUCT) + return arg->type; + + /* gcc uses r2 if the result can be packed in on register. */ + if (arg->size <= sizeof (UINT8)) + return FFI_TYPE_UINT8; + else if (arg->size <= sizeof (UINT16)) + return FFI_TYPE_UINT16; + else if (arg->size <= sizeof (UINT32)) + return FFI_TYPE_UINT32; + else if (arg->size <= sizeof (UINT64)) + return FFI_TYPE_UINT64; + + return FFI_TYPE_STRUCT; +} + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments */ + +void ffi_prep_args(char *stack, extended_cif *ecif) +{ + register unsigned int i; + register unsigned int avn; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + argp = stack; + + if (return_type (ecif->cif->rtype) == FFI_TYPE_STRUCT) + { + *(void **) argp = ecif->rvalue; + argp += sizeof (UINT64); + } + + avn = ecif->cif->nargs; + p_argv = ecif->avalue; + + for (i = 0, p_arg = ecif->cif->arg_types; i < avn; i++, p_arg++, p_argv++) + { + size_t z; + int align; + + z = (*p_arg)->size; + align = (*p_arg)->alignment; + if (z < sizeof (UINT32)) + { + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(SINT64 *) argp = (SINT64) *(SINT8 *)(*p_argv); + break; + + case FFI_TYPE_UINT8: + *(UINT64 *) argp = (UINT64) *(UINT8 *)(*p_argv); + break; + + case FFI_TYPE_SINT16: + *(SINT64 *) argp = (SINT64) *(SINT16 *)(*p_argv); + break; + + case FFI_TYPE_UINT16: + *(UINT64 *) argp = (UINT64) *(UINT16 *)(*p_argv); + break; + + case FFI_TYPE_STRUCT: + memcpy (argp, *p_argv, z); + break; + + default: + FFI_ASSERT(0); + } + argp += sizeof (UINT64); + } + else if (z == sizeof (UINT32) && align == sizeof (UINT32)) + { + switch ((*p_arg)->type) + { + case FFI_TYPE_INT: + case FFI_TYPE_SINT32: + *(SINT64 *) argp = (SINT64) *(SINT32 *) (*p_argv); + break; + + case FFI_TYPE_FLOAT: + case FFI_TYPE_POINTER: + case FFI_TYPE_UINT32: + case FFI_TYPE_STRUCT: + *(UINT64 *) argp = (UINT64) *(UINT32 *) (*p_argv); + break; + + default: + FFI_ASSERT(0); + break; + } + argp += sizeof (UINT64); + } + else if (z == sizeof (UINT64) + && align == sizeof (UINT64) + && ((int) *p_argv & (sizeof (UINT64) - 1)) == 0) + { + *(UINT64 *) argp = *(UINT64 *) (*p_argv); + argp += sizeof (UINT64); + } + else + { + int n = (z + sizeof (UINT64) - 1) / sizeof (UINT64); + + memcpy (argp, *p_argv, z); + argp += n * sizeof (UINT64); + } + } + + return; +} + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + int i, j; + int size, type; + int n, m; + int greg; + int freg; + int fpair = -1; + + greg = (return_type (cif->rtype) == FFI_TYPE_STRUCT ? 1 : 0); + freg = 0; + cif->flags2 = 0; + + for (i = j = 0; i < cif->nargs; i++) + { + type = (cif->arg_types)[i]->type; + switch (type) + { + case FFI_TYPE_FLOAT: + greg++; + cif->bytes += sizeof (UINT64) - sizeof (float); + if (freg >= NFREGARG - 1) + continue; + if (fpair < 0) + { + fpair = freg; + freg += 2; + } + else + fpair = -1; + cif->flags2 += ((cif->arg_types)[i]->type) << (2 * j++); + break; + + case FFI_TYPE_DOUBLE: + if (greg++ >= NGREGARG && (freg + 1) >= NFREGARG) + continue; + if ((freg + 1) < NFREGARG) + { + freg += 2; + cif->flags2 += ((cif->arg_types)[i]->type) << (2 * j++); + } + else + cif->flags2 += FFI_TYPE_INT << (2 * j++); + break; + + default: + size = (cif->arg_types)[i]->size; + if (size < sizeof (UINT64)) + cif->bytes += sizeof (UINT64) - size; + n = (size + sizeof (UINT64) - 1) / sizeof (UINT64); + if (greg >= NGREGARG) + continue; + else if (greg + n - 1 >= NGREGARG) + greg = NGREGARG; + else + greg += n; + for (m = 0; m < n; m++) + cif->flags2 += FFI_TYPE_INT << (2 * j++); + break; + } + } + + /* Set the return type flag */ + switch (cif->rtype->type) + { + case FFI_TYPE_STRUCT: + cif->flags = return_type (cif->rtype); + break; + + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + cif->flags = cif->rtype->type; + break; + + default: + cif->flags = FFI_TYPE_INT; + break; + } + + return FFI_OK; +} + +/*@-declundef@*/ +/*@-exportheader@*/ +extern void ffi_call_SYSV(void (*)(char *, extended_cif *), + /*@out@*/ extended_cif *, + unsigned, unsigned, long long, + /*@out@*/ unsigned *, + void (*fn)(void)); +/*@=declundef@*/ +/*@=exportheader@*/ + +void ffi_call(/*@dependent@*/ ffi_cif *cif, + void (*fn)(void), + /*@out@*/ void *rvalue, + /*@dependent@*/ void **avalue) +{ + extended_cif ecif; + UINT64 trvalue; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + + if (cif->rtype->type == FFI_TYPE_STRUCT + && return_type (cif->rtype) != FFI_TYPE_STRUCT) + ecif.rvalue = &trvalue; + else if ((rvalue == NULL) && + (cif->rtype->type == FFI_TYPE_STRUCT)) + { + ecif.rvalue = alloca(cif->rtype->size); + } + else + ecif.rvalue = rvalue; + + switch (cif->abi) + { + case FFI_SYSV: + ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, cif->flags2, + ecif.rvalue, fn); + break; + default: + FFI_ASSERT(0); + break; + } + + if (rvalue + && cif->rtype->type == FFI_TYPE_STRUCT + && return_type (cif->rtype) != FFI_TYPE_STRUCT) + memcpy (rvalue, &trvalue, cif->rtype->size); +} + +extern void ffi_closure_SYSV (void); +extern void __ic_invalidate (void *line); + +ffi_status +ffi_prep_closure_loc (ffi_closure *closure, + ffi_cif *cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void *user_data, + void *codeloc) +{ + unsigned int *tramp; + + FFI_ASSERT (cif->abi == FFI_GCC_SYSV); + + tramp = (unsigned int *) &closure->tramp[0]; + /* Since ffi_closure is an aligned object, the ffi trampoline is + called as an SHcompact code. Sigh. + SHcompact part: + mova @(1,pc),r0; add #1,r0; jmp @r0; nop; + SHmedia part: + movi fnaddr >> 16,r1; shori fnaddr,r1; ptabs/l r1,tr0 + movi cxt >> 16,r1; shori cxt,r1; blink tr0,r63 */ +#ifdef __LITTLE_ENDIAN__ + tramp[0] = 0x7001c701; + tramp[1] = 0x0009402b; +#else + tramp[0] = 0xc7017001; + tramp[1] = 0x402b0009; +#endif + tramp[2] = 0xcc000010 | (((UINT32) ffi_closure_SYSV) >> 16) << 10; + tramp[3] = 0xc8000010 | (((UINT32) ffi_closure_SYSV) & 0xffff) << 10; + tramp[4] = 0x6bf10600; + tramp[5] = 0xcc000010 | (((UINT32) codeloc) >> 16) << 10; + tramp[6] = 0xc8000010 | (((UINT32) codeloc) & 0xffff) << 10; + tramp[7] = 0x4401fff0; + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + + /* Flush the icache. */ + asm volatile ("ocbwb %0,0; synco; icbi %1,0; synci" : : "r" (tramp), + "r"(codeloc)); + + return FFI_OK; +} + +/* Basically the trampoline invokes ffi_closure_SYSV, and on + * entry, r3 holds the address of the closure. + * After storing the registers that could possibly contain + * parameters to be passed into the stack frame and setting + * up space for a return value, ffi_closure_SYSV invokes the + * following helper function to do most of the work. + */ + +int +ffi_closure_helper_SYSV (ffi_closure *closure, UINT64 *rvalue, + UINT64 *pgr, UINT64 *pfr, UINT64 *pst) +{ + void **avalue; + ffi_type **p_arg; + int i, avn; + int greg, freg; + ffi_cif *cif; + int fpair = -1; + + cif = closure->cif; + avalue = alloca (cif->nargs * sizeof (void *)); + + /* Copy the caller's structure return value address so that the closure + returns the data directly to the caller. */ + if (return_type (cif->rtype) == FFI_TYPE_STRUCT) + { + rvalue = (UINT64 *) *pgr; + greg = 1; + } + else + greg = 0; + + freg = 0; + cif = closure->cif; + avn = cif->nargs; + + /* Grab the addresses of the arguments from the stack frame. */ + for (i = 0, p_arg = cif->arg_types; i < avn; i++, p_arg++) + { + size_t z; + void *p; + + z = (*p_arg)->size; + if (z < sizeof (UINT32)) + { + p = pgr + greg++; + + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + case FFI_TYPE_STRUCT: +#ifdef __LITTLE_ENDIAN__ + avalue[i] = p; +#else + avalue[i] = ((char *) p) + sizeof (UINT32) - z; +#endif + break; + + default: + FFI_ASSERT(0); + } + } + else if (z == sizeof (UINT32)) + { + if ((*p_arg)->type == FFI_TYPE_FLOAT) + { + if (freg < NFREGARG - 1) + { + if (fpair >= 0) + { + avalue[i] = (UINT32 *) pfr + fpair; + fpair = -1; + } + else + { +#ifdef __LITTLE_ENDIAN__ + fpair = freg; + avalue[i] = (UINT32 *) pfr + (1 ^ freg); +#else + fpair = 1 ^ freg; + avalue[i] = (UINT32 *) pfr + freg; +#endif + freg += 2; + } + } + else +#ifdef __LITTLE_ENDIAN__ + avalue[i] = pgr + greg; +#else + avalue[i] = (UINT32 *) (pgr + greg) + 1; +#endif + } + else +#ifdef __LITTLE_ENDIAN__ + avalue[i] = pgr + greg; +#else + avalue[i] = (UINT32 *) (pgr + greg) + 1; +#endif + greg++; + } + else if ((*p_arg)->type == FFI_TYPE_DOUBLE) + { + if (freg + 1 >= NFREGARG) + avalue[i] = pgr + greg; + else + { + avalue[i] = pfr + (freg >> 1); + freg += 2; + } + greg++; + } + else + { + int n = (z + sizeof (UINT64) - 1) / sizeof (UINT64); + + avalue[i] = pgr + greg; + greg += n; + } + } + + (closure->fun) (cif, rvalue, avalue, closure->user_data); + + /* Tell ffi_closure_SYSV how to perform return type promotions. */ + return return_type (cif->rtype); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sh64/ffitarget.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sh64/ffitarget.h new file mode 100644 index 000000000..d935b8981 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sh64/ffitarget.h @@ -0,0 +1,53 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + Target configuration macros for SuperH - SHmedia. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +/* ---- Generic type definitions ----------------------------------------- */ + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_SYSV, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_SYSV +} ffi_abi; + +#define FFI_EXTRA_CIF_FIELDS long long flags2 +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TRAMPOLINE_SIZE 32 +#define FFI_NATIVE_RAW_API 0 + +#endif + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sh64/sysv.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sh64/sysv.S new file mode 100644 index 000000000..c4587d5f3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sh64/sysv.S @@ -0,0 +1,539 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 2003, 2004, 2006, 2008 Kaz Kojima + + SuperH SHmedia Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include +#ifdef HAVE_MACHINE_ASM_H +#include +#else +/* XXX these lose for some platforms, I'm sure. */ +#define CNAME(x) x +#define ENTRY(x) .globl CNAME(x); .type CNAME(x),%function; CNAME(x): +#endif + +#ifdef __LITTLE_ENDIAN__ +#define OFS_FLT 0 +#else +#define OFS_FLT 4 +#endif + + .section .text..SHmedia32,"ax" + + # r2: ffi_prep_args + # r3: &ecif + # r4: bytes + # r5: flags + # r6: flags2 + # r7: rvalue + # r8: fn + + # This assumes we are using gas. + .align 5 +ENTRY(ffi_call_SYSV) + # Save registers +.LFB1: + addi.l r15, -48, r15 +.LCFI0: + st.q r15, 40, r32 + st.q r15, 32, r31 + st.q r15, 24, r30 + st.q r15, 16, r29 + st.q r15, 8, r28 + st.l r15, 4, r18 + st.l r15, 0, r14 +.LCFI1: + add.l r15, r63, r14 +.LCFI2: +# add r4, r63, r28 + add r5, r63, r29 + add r6, r63, r30 + add r7, r63, r31 + add r8, r63, r32 + + addi r4, (64 + 7), r4 + andi r4, ~7, r4 + sub.l r15, r4, r15 + + ptabs/l r2, tr0 + add r15, r63, r2 + blink tr0, r18 + + addi r15, 64, r22 + movi 0, r0 + movi 0, r1 + movi -1, r23 + + pt/l 1f, tr1 + bnei/l r29, FFI_TYPE_STRUCT, tr1 + ld.l r15, 0, r19 + addi r15, 8, r15 + addi r0, 1, r0 +1: + +.L_pass: + andi r30, 3, r20 + shlri r30, 2, r30 + + pt/l .L_call_it, tr0 + pt/l .L_pass_i, tr1 + pt/l .L_pass_f, tr2 + + beqi/l r20, FFI_TYPE_VOID, tr0 + beqi/l r20, FFI_TYPE_INT, tr1 + beqi/l r20, FFI_TYPE_FLOAT, tr2 + +.L_pass_d: + addi r0, 1, r0 + pt/l 3f, tr0 + movi 12, r20 + bge/l r1, r20, tr0 + + pt/l .L_pop_d, tr1 + pt/l 2f, tr0 + blink tr1, r63 +2: + addi.l r15, 8, r15 +3: + pt/l .L_pass, tr0 + addi r1, 2, r1 + blink tr0, r63 + +.L_pop_d: + pt/l .L_pop_d_tbl, tr1 + gettr tr1, r20 + shlli r1, 2, r21 + add r20, r21, r20 + ptabs/l r20, tr1 + blink tr1, r63 + +.L_pop_d_tbl: + fld.d r15, 0, dr0 + blink tr0, r63 + fld.d r15, 0, dr2 + blink tr0, r63 + fld.d r15, 0, dr4 + blink tr0, r63 + fld.d r15, 0, dr6 + blink tr0, r63 + fld.d r15, 0, dr8 + blink tr0, r63 + fld.d r15, 0, dr10 + blink tr0, r63 + +.L_pass_f: + addi r0, 1, r0 + pt/l 3f, tr0 + movi 12, r20 + bge/l r1, r20, tr0 + + pt/l .L_pop_f, tr1 + pt/l 2f, tr0 + blink tr1, r63 +2: + addi.l r15, 8, r15 +3: + pt/l .L_pass, tr0 + blink tr0, r63 + +.L_pop_f: + pt/l .L_pop_f_tbl, tr1 + pt/l 5f, tr2 + gettr tr1, r20 + bge/l r23, r63, tr2 + add r1, r63, r23 + shlli r1, 3, r21 + addi r1, 2, r1 + add r20, r21, r20 + ptabs/l r20, tr1 + blink tr1, r63 +5: + addi r23, 1, r21 + movi -1, r23 + shlli r21, 3, r21 + add r20, r21, r20 + ptabs/l r20, tr1 + blink tr1, r63 + +.L_pop_f_tbl: + fld.s r15, OFS_FLT, fr0 + blink tr0, r63 + fld.s r15, OFS_FLT, fr1 + blink tr0, r63 + fld.s r15, OFS_FLT, fr2 + blink tr0, r63 + fld.s r15, OFS_FLT, fr3 + blink tr0, r63 + fld.s r15, OFS_FLT, fr4 + blink tr0, r63 + fld.s r15, OFS_FLT, fr5 + blink tr0, r63 + fld.s r15, OFS_FLT, fr6 + blink tr0, r63 + fld.s r15, OFS_FLT, fr7 + blink tr0, r63 + fld.s r15, OFS_FLT, fr8 + blink tr0, r63 + fld.s r15, OFS_FLT, fr9 + blink tr0, r63 + fld.s r15, OFS_FLT, fr10 + blink tr0, r63 + fld.s r15, OFS_FLT, fr11 + blink tr0, r63 + +.L_pass_i: + pt/l 3f, tr0 + movi 8, r20 + bge/l r0, r20, tr0 + + pt/l .L_pop_i, tr1 + pt/l 2f, tr0 + blink tr1, r63 +2: + addi.l r15, 8, r15 +3: + pt/l .L_pass, tr0 + addi r0, 1, r0 + blink tr0, r63 + +.L_pop_i: + pt/l .L_pop_i_tbl, tr1 + gettr tr1, r20 + shlli r0, 3, r21 + add r20, r21, r20 + ptabs/l r20, tr1 + blink tr1, r63 + +.L_pop_i_tbl: + ld.q r15, 0, r2 + blink tr0, r63 + ld.q r15, 0, r3 + blink tr0, r63 + ld.q r15, 0, r4 + blink tr0, r63 + ld.q r15, 0, r5 + blink tr0, r63 + ld.q r15, 0, r6 + blink tr0, r63 + ld.q r15, 0, r7 + blink tr0, r63 + ld.q r15, 0, r8 + blink tr0, r63 + ld.q r15, 0, r9 + blink tr0, r63 + +.L_call_it: + # call function + pt/l 1f, tr1 + bnei/l r29, FFI_TYPE_STRUCT, tr1 + add r19, r63, r2 +1: + add r22, r63, r15 + ptabs/l r32, tr0 + blink tr0, r18 + + pt/l .L_ret_i, tr0 + pt/l .L_ret_ll, tr1 + pt/l .L_ret_d, tr2 + pt/l .L_ret_f, tr3 + pt/l .L_epilogue, tr4 + + beqi/l r29, FFI_TYPE_INT, tr0 + beqi/l r29, FFI_TYPE_UINT32, tr0 + beqi/l r29, FFI_TYPE_SINT64, tr1 + beqi/l r29, FFI_TYPE_UINT64, tr1 + beqi/l r29, FFI_TYPE_DOUBLE, tr2 + beqi/l r29, FFI_TYPE_FLOAT, tr3 + + pt/l .L_ret_q, tr0 + pt/l .L_ret_h, tr1 + + beqi/l r29, FFI_TYPE_UINT8, tr0 + beqi/l r29, FFI_TYPE_UINT16, tr1 + blink tr4, r63 + +.L_ret_d: + fst.d r31, 0, dr0 + blink tr4, r63 + +.L_ret_ll: + st.q r31, 0, r2 + blink tr4, r63 + +.L_ret_f: + fst.s r31, OFS_FLT, fr0 + blink tr4, r63 + +.L_ret_q: + st.b r31, 0, r2 + blink tr4, r63 + +.L_ret_h: + st.w r31, 0, r2 + blink tr4, r63 + +.L_ret_i: + st.l r31, 0, r2 + # Fall + +.L_epilogue: + # Remove the space we pushed for the args + add r14, r63, r15 + + ld.l r15, 0, r14 + ld.l r15, 4, r18 + ld.q r15, 8, r28 + ld.q r15, 16, r29 + ld.q r15, 24, r30 + ld.q r15, 32, r31 + ld.q r15, 40, r32 + addi.l r15, 48, r15 + ptabs r18, tr0 + blink tr0, r63 + +.LFE1: +.ffi_call_SYSV_end: + .size CNAME(ffi_call_SYSV),.ffi_call_SYSV_end-CNAME(ffi_call_SYSV) + + .align 5 +ENTRY(ffi_closure_SYSV) +.LFB2: + addi.l r15, -136, r15 +.LCFI3: + st.l r15, 12, r18 + st.l r15, 8, r14 + st.l r15, 4, r12 +.LCFI4: + add r15, r63, r14 +.LCFI5: + /* Stack layout: + ... + 64 bytes (register parameters) + 48 bytes (floating register parameters) + 8 bytes (result) + 4 bytes (r18) + 4 bytes (r14) + 4 bytes (r12) + 4 bytes (for align) + <- new stack pointer + */ + fst.d r14, 24, dr0 + fst.d r14, 32, dr2 + fst.d r14, 40, dr4 + fst.d r14, 48, dr6 + fst.d r14, 56, dr8 + fst.d r14, 64, dr10 + st.q r14, 72, r2 + st.q r14, 80, r3 + st.q r14, 88, r4 + st.q r14, 96, r5 + st.q r14, 104, r6 + st.q r14, 112, r7 + st.q r14, 120, r8 + st.q r14, 128, r9 + + add r1, r63, r2 + addi r14, 16, r3 + addi r14, 72, r4 + addi r14, 24, r5 + addi r14, 136, r6 +#ifdef PIC + movi (((datalabel _GLOBAL_OFFSET_TABLE_-(.LPCS0-.)) >> 16) & 65535), r12 + shori ((datalabel _GLOBAL_OFFSET_TABLE_-(.LPCS0-.)) & 65535), r12 +.LPCS0: ptrel/u r12, tr0 + movi ((ffi_closure_helper_SYSV@GOTPLT) & 65535), r1 + gettr tr0, r12 + ldx.l r1, r12, r1 + ptabs r1, tr0 +#else + pt/l ffi_closure_helper_SYSV, tr0 +#endif + blink tr0, r18 + + shlli r2, 1, r1 + movi (((datalabel .L_table) >> 16) & 65535), r2 + shori ((datalabel .L_table) & 65535), r2 + ldx.w r2, r1, r1 + add r1, r2, r1 + pt/l .L_case_v, tr1 + ptabs r1, tr0 + blink tr0, r63 + + .align 2 +.L_table: + .word .L_case_v - datalabel .L_table /* FFI_TYPE_VOID */ + .word .L_case_i - datalabel .L_table /* FFI_TYPE_INT */ + .word .L_case_f - datalabel .L_table /* FFI_TYPE_FLOAT */ + .word .L_case_d - datalabel .L_table /* FFI_TYPE_DOUBLE */ + .word .L_case_d - datalabel .L_table /* FFI_TYPE_LONGDOUBLE */ + .word .L_case_uq - datalabel .L_table /* FFI_TYPE_UINT8 */ + .word .L_case_q - datalabel .L_table /* FFI_TYPE_SINT8 */ + .word .L_case_uh - datalabel .L_table /* FFI_TYPE_UINT16 */ + .word .L_case_h - datalabel .L_table /* FFI_TYPE_SINT16 */ + .word .L_case_i - datalabel .L_table /* FFI_TYPE_UINT32 */ + .word .L_case_i - datalabel .L_table /* FFI_TYPE_SINT32 */ + .word .L_case_ll - datalabel .L_table /* FFI_TYPE_UINT64 */ + .word .L_case_ll - datalabel .L_table /* FFI_TYPE_SINT64 */ + .word .L_case_v - datalabel .L_table /* FFI_TYPE_STRUCT */ + .word .L_case_i - datalabel .L_table /* FFI_TYPE_POINTER */ + + .align 2 +.L_case_d: + fld.d r14, 16, dr0 + blink tr1, r63 +.L_case_f: + fld.s r14, 16, fr0 + blink tr1, r63 +.L_case_ll: + ld.q r14, 16, r2 + blink tr1, r63 +.L_case_i: + ld.l r14, 16, r2 + blink tr1, r63 +.L_case_q: + ld.b r14, 16, r2 + blink tr1, r63 +.L_case_uq: + ld.ub r14, 16, r2 + blink tr1, r63 +.L_case_h: + ld.w r14, 16, r2 + blink tr1, r63 +.L_case_uh: + ld.uw r14, 16, r2 + blink tr1, r63 +.L_case_v: + add.l r14, r63, r15 + ld.l r15, 4, r12 + ld.l r15, 8, r14 + ld.l r15, 12, r18 + addi.l r15, 136, r15 + ptabs r18, tr0 + blink tr0, r63 + +.LFE2: +.ffi_closure_SYSV_end: + .size CNAME(ffi_closure_SYSV),.ffi_closure_SYSV_end-CNAME(ffi_closure_SYSV) + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif + + .section ".eh_frame","aw",@progbits +__FRAME_BEGIN__: + .4byte .LECIE1-.LSCIE1 /* Length of Common Information Entry */ +.LSCIE1: + .4byte 0x0 /* CIE Identifier Tag */ + .byte 0x1 /* CIE Version */ +#ifdef PIC + .ascii "zR\0" /* CIE Augmentation */ +#else + .byte 0x0 /* CIE Augmentation */ +#endif + .uleb128 0x1 /* CIE Code Alignment Factor */ + .sleb128 -4 /* CIE Data Alignment Factor */ + .byte 0x12 /* CIE RA Column */ +#ifdef PIC + .uleb128 0x1 /* Augmentation size */ + .byte 0x10 /* FDE Encoding (pcrel) */ +#endif + .byte 0xc /* DW_CFA_def_cfa */ + .uleb128 0xf + .uleb128 0x0 + .align 2 +.LECIE1: +.LSFDE1: + .4byte datalabel .LEFDE1-datalabel .LASFDE1 /* FDE Length */ +.LASFDE1: + .4byte datalabel .LASFDE1-datalabel __FRAME_BEGIN__ +#ifdef PIC + .4byte .LFB1-. /* FDE initial location */ +#else + .4byte .LFB1 /* FDE initial location */ +#endif + .4byte datalabel .LFE1-datalabel .LFB1 /* FDE address range */ +#ifdef PIC + .uleb128 0x0 /* Augmentation size */ +#endif + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte datalabel .LCFI0-datalabel .LFB1 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .uleb128 0x30 + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte datalabel .LCFI1-datalabel .LCFI0 + .byte 0x8e /* DW_CFA_offset, column 0xe */ + .uleb128 0xc + .byte 0x92 /* DW_CFA_offset, column 0x12 */ + .uleb128 0xb + .byte 0x9c /* DW_CFA_offset, column 0x1c */ + .uleb128 0xa + .byte 0x9d /* DW_CFA_offset, column 0x1d */ + .uleb128 0x8 + .byte 0x9e /* DW_CFA_offset, column 0x1e */ + .uleb128 0x6 + .byte 0x9f /* DW_CFA_offset, column 0x1f */ + .uleb128 0x4 + .byte 0xa0 /* DW_CFA_offset, column 0x20 */ + .uleb128 0x2 + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte datalabel .LCFI2-datalabel .LCFI1 + .byte 0xd /* DW_CFA_def_cfa_register */ + .uleb128 0xe + .align 2 +.LEFDE1: + +.LSFDE3: + .4byte datalabel .LEFDE3-datalabel .LASFDE3 /* FDE Length */ +.LASFDE3: + .4byte datalabel .LASFDE3-datalabel __FRAME_BEGIN__ +#ifdef PIC + .4byte .LFB2-. /* FDE initial location */ +#else + .4byte .LFB2 /* FDE initial location */ +#endif + .4byte datalabel .LFE2-datalabel .LFB2 /* FDE address range */ +#ifdef PIC + .uleb128 0x0 /* Augmentation size */ +#endif + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte datalabel .LCFI3-datalabel .LFB2 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .uleb128 0x88 + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte datalabel .LCFI4-datalabel .LCFI3 + .byte 0x8c /* DW_CFA_offset, column 0xc */ + .uleb128 0x21 + .byte 0x8e /* DW_CFA_offset, column 0xe */ + .uleb128 0x20 + .byte 0x92 /* DW_CFA_offset, column 0x12 */ + .uleb128 0x1f + .byte 0x4 /* DW_CFA_advance_loc4 */ + .4byte datalabel .LCFI5-datalabel .LCFI4 + .byte 0xd /* DW_CFA_def_cfa_register */ + .uleb128 0xe + .align 2 +.LEFDE3: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sparc/ffi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sparc/ffi.c new file mode 100644 index 000000000..1ac5d464e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sparc/ffi.c @@ -0,0 +1,669 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 2011 Anthony Green + Copyright (c) 1996, 2003-2004, 2007-2008 Red Hat, Inc. + + SPARC Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +#include + + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments */ + +void ffi_prep_args_v8(char *stack, extended_cif *ecif) +{ + int i; + void **p_argv; + char *argp; + ffi_type **p_arg; + + /* Skip 16 words for the window save area */ + argp = stack + 16*sizeof(int); + + /* This should only really be done when we are returning a structure, + however, it's faster just to do it all the time... + + if ( ecif->cif->rtype->type == FFI_TYPE_STRUCT ) */ + *(int *) argp = (long)ecif->rvalue; + + /* And 1 word for the structure return value. */ + argp += sizeof(int); + +#ifdef USING_PURIFY + /* Purify will probably complain in our assembly routine, unless we + zero out this memory. */ + + ((int*)argp)[0] = 0; + ((int*)argp)[1] = 0; + ((int*)argp)[2] = 0; + ((int*)argp)[3] = 0; + ((int*)argp)[4] = 0; + ((int*)argp)[5] = 0; +#endif + + p_argv = ecif->avalue; + + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; i; i--, p_arg++) + { + size_t z; + + if ((*p_arg)->type == FFI_TYPE_STRUCT +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + || (*p_arg)->type == FFI_TYPE_LONGDOUBLE +#endif + ) + { + *(unsigned int *) argp = (unsigned long)(* p_argv); + z = sizeof(int); + } + else + { + z = (*p_arg)->size; + if (z < sizeof(int)) + { + z = sizeof(int); + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(signed int *) argp = *(SINT8 *)(* p_argv); + break; + + case FFI_TYPE_UINT8: + *(unsigned int *) argp = *(UINT8 *)(* p_argv); + break; + + case FFI_TYPE_SINT16: + *(signed int *) argp = *(SINT16 *)(* p_argv); + break; + + case FFI_TYPE_UINT16: + *(unsigned int *) argp = *(UINT16 *)(* p_argv); + break; + + default: + FFI_ASSERT(0); + } + } + else + { + memcpy(argp, *p_argv, z); + } + } + p_argv++; + argp += z; + } + + return; +} + +int ffi_prep_args_v9(char *stack, extended_cif *ecif) +{ + int i, ret = 0; + int tmp; + void **p_argv; + char *argp; + ffi_type **p_arg; + + tmp = 0; + + /* Skip 16 words for the window save area */ + argp = stack + 16*sizeof(long long); + +#ifdef USING_PURIFY + /* Purify will probably complain in our assembly routine, unless we + zero out this memory. */ + + ((long long*)argp)[0] = 0; + ((long long*)argp)[1] = 0; + ((long long*)argp)[2] = 0; + ((long long*)argp)[3] = 0; + ((long long*)argp)[4] = 0; + ((long long*)argp)[5] = 0; +#endif + + p_argv = ecif->avalue; + + if (ecif->cif->rtype->type == FFI_TYPE_STRUCT && + ecif->cif->rtype->size > 32) + { + *(unsigned long long *) argp = (unsigned long)ecif->rvalue; + argp += sizeof(long long); + tmp = 1; + } + + for (i = 0, p_arg = ecif->cif->arg_types; i < ecif->cif->nargs; + i++, p_arg++) + { + size_t z; + + z = (*p_arg)->size; + switch ((*p_arg)->type) + { + case FFI_TYPE_STRUCT: + if (z > 16) + { + /* For structures larger than 16 bytes we pass reference. */ + *(unsigned long long *) argp = (unsigned long)* p_argv; + argp += sizeof(long long); + tmp++; + p_argv++; + continue; + } + /* FALLTHROUGH */ + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + case FFI_TYPE_LONGDOUBLE: +#endif + ret = 1; /* We should promote into FP regs as well as integer. */ + break; + } + if (z < sizeof(long long)) + { + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(signed long long *) argp = *(SINT8 *)(* p_argv); + break; + + case FFI_TYPE_UINT8: + *(unsigned long long *) argp = *(UINT8 *)(* p_argv); + break; + + case FFI_TYPE_SINT16: + *(signed long long *) argp = *(SINT16 *)(* p_argv); + break; + + case FFI_TYPE_UINT16: + *(unsigned long long *) argp = *(UINT16 *)(* p_argv); + break; + + case FFI_TYPE_SINT32: + *(signed long long *) argp = *(SINT32 *)(* p_argv); + break; + + case FFI_TYPE_UINT32: + *(unsigned long long *) argp = *(UINT32 *)(* p_argv); + break; + + case FFI_TYPE_FLOAT: + *(float *) (argp + 4) = *(FLOAT32 *)(* p_argv); /* Right justify */ + break; + + case FFI_TYPE_STRUCT: + memcpy(argp, *p_argv, z); + break; + + default: + FFI_ASSERT(0); + } + z = sizeof(long long); + tmp++; + } + else if (z == sizeof(long long)) + { + memcpy(argp, *p_argv, z); + z = sizeof(long long); + tmp++; + } + else + { + if ((tmp & 1) && (*p_arg)->alignment > 8) + { + tmp++; + argp += sizeof(long long); + } + memcpy(argp, *p_argv, z); + z = 2 * sizeof(long long); + tmp += 2; + } + p_argv++; + argp += z; + } + + return ret; +} + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + int wordsize; + + if (cif->abi != FFI_V9) + { + wordsize = 4; + + /* If we are returning a struct, this will already have been added. + Otherwise we need to add it because it's always got to be there! */ + + if (cif->rtype->type != FFI_TYPE_STRUCT) + cif->bytes += wordsize; + + /* sparc call frames require that space is allocated for 6 args, + even if they aren't used. Make that space if necessary. */ + + if (cif->bytes < 4*6+4) + cif->bytes = 4*6+4; + } + else + { + wordsize = 8; + + /* sparc call frames require that space is allocated for 6 args, + even if they aren't used. Make that space if necessary. */ + + if (cif->bytes < 8*6) + cif->bytes = 8*6; + } + + /* Adjust cif->bytes. to include 16 words for the window save area, + and maybe the struct/union return pointer area, */ + + cif->bytes += 16 * wordsize; + + /* The stack must be 2 word aligned, so round bytes up + appropriately. */ + + cif->bytes = ALIGN(cif->bytes, 2 * wordsize); + + /* Set the return type flag */ + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + case FFI_TYPE_LONGDOUBLE: +#endif + cif->flags = cif->rtype->type; + break; + + case FFI_TYPE_STRUCT: + if (cif->abi == FFI_V9 && cif->rtype->size > 32) + cif->flags = FFI_TYPE_VOID; + else + cif->flags = FFI_TYPE_STRUCT; + break; + + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT16: + if (cif->abi == FFI_V9) + cif->flags = FFI_TYPE_INT; + else + cif->flags = cif->rtype->type; + break; + + case FFI_TYPE_SINT64: + case FFI_TYPE_UINT64: + if (cif->abi == FFI_V9) + cif->flags = FFI_TYPE_INT; + else + cif->flags = FFI_TYPE_SINT64; + break; + + default: + cif->flags = FFI_TYPE_INT; + break; + } + return FFI_OK; +} + +int ffi_v9_layout_struct(ffi_type *arg, int off, char *ret, char *intg, char *flt) +{ + ffi_type **ptr = &arg->elements[0]; + + while (*ptr != NULL) + { + if (off & ((*ptr)->alignment - 1)) + off = ALIGN(off, (*ptr)->alignment); + + switch ((*ptr)->type) + { + case FFI_TYPE_STRUCT: + off = ffi_v9_layout_struct(*ptr, off, ret, intg, flt); + off = ALIGN(off, FFI_SIZEOF_ARG); + break; + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + case FFI_TYPE_LONGDOUBLE: +#endif + memmove(ret + off, flt + off, (*ptr)->size); + off += (*ptr)->size; + break; + default: + memmove(ret + off, intg + off, (*ptr)->size); + off += (*ptr)->size; + break; + } + ptr++; + } + return off; +} + + +#ifdef SPARC64 +extern int ffi_call_v9(void *, extended_cif *, unsigned, + unsigned, unsigned *, void (*fn)(void)); +#else +extern int ffi_call_v8(void *, extended_cif *, unsigned, + unsigned, unsigned *, void (*fn)(void)); +#endif + +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + void *rval = rvalue; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + + ecif.rvalue = rvalue; + if (cif->rtype->type == FFI_TYPE_STRUCT) + { + if (cif->rtype->size <= 32) + rval = alloca(64); + else + { + rval = NULL; + if (rvalue == NULL) + ecif.rvalue = alloca(cif->rtype->size); + } + } + + switch (cif->abi) + { + case FFI_V8: +#ifdef SPARC64 + /* We don't yet support calling 32bit code from 64bit */ + FFI_ASSERT(0); +#else + if (rvalue && (cif->rtype->type == FFI_TYPE_STRUCT +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + || cif->flags == FFI_TYPE_LONGDOUBLE +#endif + )) + { + /* For v8, we need an "unimp" with size of returning struct */ + /* behind "call", so we alloc some executable space for it. */ + /* l7 is used, we need to make sure v8.S doesn't use %l7. */ + unsigned int *call_struct = NULL; + ffi_closure_alloc(32, &call_struct); + if (call_struct) + { + unsigned long f = (unsigned long)fn; + call_struct[0] = 0xae10001f; /* mov %i7, %l7 */ + call_struct[1] = 0xbe10000f; /* mov %o7, %i7 */ + call_struct[2] = 0x03000000 | f >> 10; /* sethi %hi(fn), %g1 */ + call_struct[3] = 0x9fc06000 | (f & 0x3ff); /* jmp %g1+%lo(fn), %o7 */ + call_struct[4] = 0x01000000; /* nop */ + if (cif->rtype->size < 0x7f) + call_struct[5] = cif->rtype->size; /* unimp */ + else + call_struct[5] = 0x01000000; /* nop */ + call_struct[6] = 0x81c7e008; /* ret */ + call_struct[7] = 0xbe100017; /* mov %l7, %i7 */ + asm volatile ("iflush %0; iflush %0+8; iflush %0+16; iflush %0+24" : : + "r" (call_struct) : "memory"); + /* SPARC v8 requires 5 instructions for flush to be visible */ + asm volatile ("nop; nop; nop; nop; nop"); + ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes, + cif->flags, rvalue, call_struct); + ffi_closure_free(call_struct); + } + else + { + ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes, + cif->flags, rvalue, fn); + } + } + else + { + ffi_call_v8(ffi_prep_args_v8, &ecif, cif->bytes, + cif->flags, rvalue, fn); + } +#endif + break; + case FFI_V9: +#ifdef SPARC64 + ffi_call_v9(ffi_prep_args_v9, &ecif, cif->bytes, + cif->flags, rval, fn); + if (rvalue && rval && cif->rtype->type == FFI_TYPE_STRUCT) + ffi_v9_layout_struct(cif->rtype, 0, (char *)rvalue, (char *)rval, ((char *)rval)+32); +#else + /* And vice versa */ + FFI_ASSERT(0); +#endif + break; + default: + FFI_ASSERT(0); + break; + } +} + + +#ifdef SPARC64 +extern void ffi_closure_v9(void); +#else +extern void ffi_closure_v8(void); +#endif + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void *user_data, + void *codeloc) +{ + unsigned int *tramp = (unsigned int *) &closure->tramp[0]; + unsigned long fn; +#ifdef SPARC64 + /* Trampoline address is equal to the closure address. We take advantage + of that to reduce the trampoline size by 8 bytes. */ + if (cif->abi != FFI_V9) + return FFI_BAD_ABI; + fn = (unsigned long) ffi_closure_v9; + tramp[0] = 0x83414000; /* rd %pc, %g1 */ + tramp[1] = 0xca586010; /* ldx [%g1+16], %g5 */ + tramp[2] = 0x81c14000; /* jmp %g5 */ + tramp[3] = 0x01000000; /* nop */ + *((unsigned long *) &tramp[4]) = fn; +#else + unsigned long ctx = (unsigned long) codeloc; + if (cif->abi != FFI_V8) + return FFI_BAD_ABI; + fn = (unsigned long) ffi_closure_v8; + tramp[0] = 0x03000000 | fn >> 10; /* sethi %hi(fn), %g1 */ + tramp[1] = 0x05000000 | ctx >> 10; /* sethi %hi(ctx), %g2 */ + tramp[2] = 0x81c06000 | (fn & 0x3ff); /* jmp %g1+%lo(fn) */ + tramp[3] = 0x8410a000 | (ctx & 0x3ff);/* or %g2, %lo(ctx) */ +#endif + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + + /* Flush the Icache. closure is 8 bytes aligned. */ +#ifdef SPARC64 + asm volatile ("flush %0; flush %0+8" : : "r" (closure) : "memory"); +#else + asm volatile ("iflush %0; iflush %0+8" : : "r" (closure) : "memory"); + /* SPARC v8 requires 5 instructions for flush to be visible */ + asm volatile ("nop; nop; nop; nop; nop"); +#endif + + return FFI_OK; +} + +int +ffi_closure_sparc_inner_v8(ffi_closure *closure, + void *rvalue, unsigned long *gpr, unsigned long *scratch) +{ + ffi_cif *cif; + ffi_type **arg_types; + void **avalue; + int i, argn; + + cif = closure->cif; + arg_types = cif->arg_types; + avalue = alloca(cif->nargs * sizeof(void *)); + + /* Copy the caller's structure return address so that the closure + returns the data directly to the caller. */ + if (cif->flags == FFI_TYPE_STRUCT +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + || cif->flags == FFI_TYPE_LONGDOUBLE +#endif + ) + rvalue = (void *) gpr[0]; + + /* Always skip the structure return address. */ + argn = 1; + + /* Grab the addresses of the arguments from the stack frame. */ + for (i = 0; i < cif->nargs; i++) + { + if (arg_types[i]->type == FFI_TYPE_STRUCT +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + || arg_types[i]->type == FFI_TYPE_LONGDOUBLE +#endif + ) + { + /* Straight copy of invisible reference. */ + avalue[i] = (void *)gpr[argn++]; + } + else if ((arg_types[i]->type == FFI_TYPE_DOUBLE + || arg_types[i]->type == FFI_TYPE_SINT64 + || arg_types[i]->type == FFI_TYPE_UINT64) + /* gpr is 8-byte aligned. */ + && (argn % 2) != 0) + { + /* Align on a 8-byte boundary. */ + scratch[0] = gpr[argn]; + scratch[1] = gpr[argn+1]; + avalue[i] = scratch; + scratch -= 2; + argn += 2; + } + else + { + /* Always right-justify. */ + argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; + avalue[i] = ((char *) &gpr[argn]) - arg_types[i]->size; + } + } + + /* Invoke the closure. */ + (closure->fun) (cif, rvalue, avalue, closure->user_data); + + /* Tell ffi_closure_sparc how to perform return type promotions. */ + return cif->rtype->type; +} + +int +ffi_closure_sparc_inner_v9(ffi_closure *closure, + void *rvalue, unsigned long *gpr, double *fpr) +{ + ffi_cif *cif; + ffi_type **arg_types; + void **avalue; + int i, argn, fp_slot_max; + + cif = closure->cif; + arg_types = cif->arg_types; + avalue = alloca(cif->nargs * sizeof(void *)); + + /* Copy the caller's structure return address so that the closure + returns the data directly to the caller. */ + if (cif->flags == FFI_TYPE_VOID + && cif->rtype->type == FFI_TYPE_STRUCT) + { + rvalue = (void *) gpr[0]; + /* Skip the structure return address. */ + argn = 1; + } + else + argn = 0; + + fp_slot_max = 16 - argn; + + /* Grab the addresses of the arguments from the stack frame. */ + for (i = 0; i < cif->nargs; i++) + { + if (arg_types[i]->type == FFI_TYPE_STRUCT) + { + if (arg_types[i]->size > 16) + { + /* Straight copy of invisible reference. */ + avalue[i] = (void *)gpr[argn++]; + } + else + { + /* Left-justify. */ + ffi_v9_layout_struct(arg_types[i], + 0, + (char *) &gpr[argn], + (char *) &gpr[argn], + (char *) &fpr[argn]); + avalue[i] = &gpr[argn]; + argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; + } + } + else + { + /* Right-justify. */ + argn += ALIGN(arg_types[i]->size, FFI_SIZEOF_ARG) / FFI_SIZEOF_ARG; + + /* Align on a 16-byte boundary. */ +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + if (arg_types[i]->type == FFI_TYPE_LONGDOUBLE && (argn % 2) != 0) + argn++; +#endif + if (i < fp_slot_max + && (arg_types[i]->type == FFI_TYPE_FLOAT + || arg_types[i]->type == FFI_TYPE_DOUBLE +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + || arg_types[i]->type == FFI_TYPE_LONGDOUBLE +#endif + )) + avalue[i] = ((char *) &fpr[argn]) - arg_types[i]->size; + else + avalue[i] = ((char *) &gpr[argn]) - arg_types[i]->size; + } + } + + /* Invoke the closure. */ + (closure->fun) (cif, rvalue, avalue, closure->user_data); + + /* Tell ffi_closure_sparc how to perform return type promotions. */ + return cif->rtype->type; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sparc/ffitarget.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sparc/ffitarget.h new file mode 100644 index 000000000..51275cb72 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sparc/ffitarget.h @@ -0,0 +1,68 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 1996-2003 Red Hat, Inc. + Target configuration macros for SPARC. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +/* ---- System specific configurations ----------------------------------- */ + +#if defined(__arch64__) || defined(__sparcv9) +#ifndef SPARC64 +#define SPARC64 +#endif +#endif + +#ifndef LIBFFI_ASM +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + FFI_V8, + FFI_V8PLUS, + FFI_V9, + FFI_LAST_ABI, +#ifdef SPARC64 + FFI_DEFAULT_ABI = FFI_V9 +#else + FFI_DEFAULT_ABI = FFI_V8 +#endif +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_NATIVE_RAW_API 0 + +#ifdef SPARC64 +#define FFI_TRAMPOLINE_SIZE 24 +#else +#define FFI_TRAMPOLINE_SIZE 16 +#endif + +#endif + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sparc/v8.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sparc/v8.S new file mode 100644 index 000000000..2c4eb60a0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sparc/v8.S @@ -0,0 +1,313 @@ +/* ----------------------------------------------------------------------- + v8.S - Copyright (c) 1996, 1997, 2003, 2004, 2008 Red Hat, Inc. + + SPARC Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + +#define STACKFRAME 96 /* Minimum stack framesize for SPARC */ +#define ARGS (64+4) /* Offset of register area in frame */ + +.text + .align 8 +.globl ffi_call_v8 +.globl _ffi_call_v8 + +ffi_call_v8: +_ffi_call_v8: +.LLFB1: + save %sp, -STACKFRAME, %sp +.LLCFI0: + + sub %sp, %i2, %sp ! alloca() space in stack for frame to set up + add %sp, STACKFRAME, %l0 ! %l0 has start of + ! frame to set up + + mov %l0, %o0 ! call routine to set up frame + call %i0 + mov %i1, %o1 ! (delay) + + ld [%l0+ARGS], %o0 ! call foreign function + ld [%l0+ARGS+4], %o1 + ld [%l0+ARGS+8], %o2 + ld [%l0+ARGS+12], %o3 + ld [%l0+ARGS+16], %o4 + ld [%l0+ARGS+20], %o5 + call %i5 + mov %l0, %sp ! (delay) switch to frame + nop ! STRUCT returning functions skip 12 instead of 8 bytes + + ! If the return value pointer is NULL, assume no return value. + tst %i4 + bz done + nop + + cmp %i3, FFI_TYPE_INT + be,a done + st %o0, [%i4] ! (delay) + + cmp %i3, FFI_TYPE_FLOAT + be,a done + st %f0, [%i4+0] ! (delay) + + cmp %i3, FFI_TYPE_DOUBLE + be,a double + st %f0, [%i4+0] ! (delay) + + cmp %i3, FFI_TYPE_SINT8 + be,a sint8 + sll %o0, 24, %o0 ! (delay) + + cmp %i3, FFI_TYPE_UINT8 + be,a uint8 + sll %o0, 24, %o0 ! (delay) + + cmp %i3, FFI_TYPE_SINT16 + be,a sint16 + sll %o0, 16, %o0 ! (delay) + + cmp %i3, FFI_TYPE_UINT16 + be,a uint16 + sll %o0, 16, %o0 ! (delay) + + cmp %i3, FFI_TYPE_SINT64 + be,a longlong + st %o0, [%i4+0] ! (delay) +done: + ret + restore + +double: + st %f1, [%i4+4] + ret + restore + +sint8: + sra %o0, 24, %o0 + st %o0, [%i4+0] + ret + restore + +uint8: + srl %o0, 24, %o0 + st %o0, [%i4+0] + ret + restore + +sint16: + sra %o0, 16, %o0 + st %o0, [%i4+0] + ret + restore + +uint16: + srl %o0, 16, %o0 + st %o0, [%i4+0] + ret + restore + +longlong: + st %o1, [%i4+4] + ret + restore +.LLFE1: + +.ffi_call_v8_end: + .size ffi_call_v8,.ffi_call_v8_end-ffi_call_v8 + + +#undef STACKFRAME +#define STACKFRAME 104 /* 16*4 register window + + 1*4 struct return + + 6*4 args backing store + + 3*4 locals */ + +/* ffi_closure_v8(...) + + Receives the closure argument in %g2. */ + + .text + .align 8 + .globl ffi_closure_v8 + +ffi_closure_v8: +#ifdef HAVE_AS_REGISTER_PSEUDO_OP + .register %g2, #scratch +#endif +.LLFB2: + ! Reserve frame space for all arguments in case + ! we need to align them on a 8-byte boundary. + ld [%g2+FFI_TRAMPOLINE_SIZE], %g1 + ld [%g1+4], %g1 + sll %g1, 3, %g1 + add %g1, STACKFRAME, %g1 + ! %g1 == STACKFRAME + 8*nargs + neg %g1 + save %sp, %g1, %sp +.LLCFI1: + + ! Store all of the potential argument registers in va_list format. + st %i0, [%fp+68+0] + st %i1, [%fp+68+4] + st %i2, [%fp+68+8] + st %i3, [%fp+68+12] + st %i4, [%fp+68+16] + st %i5, [%fp+68+20] + + ! Call ffi_closure_sparc_inner to do the bulk of the work. + mov %g2, %o0 + add %fp, -8, %o1 + add %fp, 64, %o2 + call ffi_closure_sparc_inner_v8 + add %fp, -16, %o3 + + ! Load up the return value in the proper type. + ! See ffi_prep_cif_machdep for the list of cases. + cmp %o0, FFI_TYPE_VOID + be done1 + + cmp %o0, FFI_TYPE_INT + be done1 + ld [%fp-8], %i0 + + cmp %o0, FFI_TYPE_FLOAT + be,a done1 + ld [%fp-8], %f0 + + cmp %o0, FFI_TYPE_DOUBLE + be,a done1 + ldd [%fp-8], %f0 + +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + cmp %o0, FFI_TYPE_LONGDOUBLE + be done2 +#endif + + cmp %o0, FFI_TYPE_STRUCT + be done2 + + cmp %o0, FFI_TYPE_SINT64 + be,a done1 + ldd [%fp-8], %i0 + + ld [%fp-8], %i0 +done1: + jmp %i7+8 + restore +done2: + ! Skip 'unimp'. + jmp %i7+12 + restore +.LLFE2: + +.ffi_closure_v8_end: + .size ffi_closure_v8,.ffi_closure_v8_end-ffi_closure_v8 + +#ifdef SPARC64 +#define WS 8 +#define nword xword +#define uanword uaxword +#else +#define WS 4 +#define nword long +#define uanword uaword +#endif + +#ifdef HAVE_RO_EH_FRAME + .section ".eh_frame",#alloc +#else + .section ".eh_frame",#alloc,#write +#endif +.LLframe1: + .uaword .LLECIE1-.LLSCIE1 ! Length of Common Information Entry +.LLSCIE1: + .uaword 0x0 ! CIE Identifier Tag + .byte 0x1 ! CIE Version + .ascii "zR\0" ! CIE Augmentation + .byte 0x1 ! uleb128 0x1; CIE Code Alignment Factor + .byte 0x80-WS ! sleb128 -WS; CIE Data Alignment Factor + .byte 0xf ! CIE RA Column + .byte 0x1 ! uleb128 0x1; Augmentation size +#ifdef HAVE_AS_SPARC_UA_PCREL + .byte 0x1b ! FDE Encoding (pcrel sdata4) +#else + .byte 0x50 ! FDE Encoding (aligned absolute) +#endif + .byte 0xc ! DW_CFA_def_cfa + .byte 0xe ! uleb128 0xe + .byte 0x0 ! uleb128 0x0 + .align WS +.LLECIE1: +.LLSFDE1: + .uaword .LLEFDE1-.LLASFDE1 ! FDE Length +.LLASFDE1: + .uaword .LLASFDE1-.LLframe1 ! FDE CIE offset +#ifdef HAVE_AS_SPARC_UA_PCREL + .uaword %r_disp32(.LLFB1) + .uaword .LLFE1-.LLFB1 ! FDE address range +#else + .align WS + .nword .LLFB1 + .uanword .LLFE1-.LLFB1 ! FDE address range +#endif + .byte 0x0 ! uleb128 0x0; Augmentation size + .byte 0x4 ! DW_CFA_advance_loc4 + .uaword .LLCFI0-.LLFB1 + .byte 0xd ! DW_CFA_def_cfa_register + .byte 0x1e ! uleb128 0x1e + .byte 0x2d ! DW_CFA_GNU_window_save + .byte 0x9 ! DW_CFA_register + .byte 0xf ! uleb128 0xf + .byte 0x1f ! uleb128 0x1f + .align WS +.LLEFDE1: +.LLSFDE2: + .uaword .LLEFDE2-.LLASFDE2 ! FDE Length +.LLASFDE2: + .uaword .LLASFDE2-.LLframe1 ! FDE CIE offset +#ifdef HAVE_AS_SPARC_UA_PCREL + .uaword %r_disp32(.LLFB2) + .uaword .LLFE2-.LLFB2 ! FDE address range +#else + .align WS + .nword .LLFB2 + .uanword .LLFE2-.LLFB2 ! FDE address range +#endif + .byte 0x0 ! uleb128 0x0; Augmentation size + .byte 0x4 ! DW_CFA_advance_loc4 + .uaword .LLCFI1-.LLFB2 + .byte 0xd ! DW_CFA_def_cfa_register + .byte 0x1e ! uleb128 0x1e + .byte 0x2d ! DW_CFA_GNU_window_save + .byte 0x9 ! DW_CFA_register + .byte 0xf ! uleb128 0xf + .byte 0x1f ! uleb128 0x1f + .align WS +.LLEFDE2: + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sparc/v9.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sparc/v9.S new file mode 100644 index 000000000..489ff0293 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/sparc/v9.S @@ -0,0 +1,307 @@ +/* ----------------------------------------------------------------------- + v9.S - Copyright (c) 2000, 2003, 2004, 2008 Red Hat, Inc. + + SPARC 64-bit Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#define LIBFFI_ASM +#include +#include + +#ifdef SPARC64 +/* Only compile this in for 64bit builds, because otherwise the object file + will have inproper architecture due to used instructions. */ + +#define STACKFRAME 128 /* Minimum stack framesize for SPARC */ +#define STACK_BIAS 2047 +#define ARGS (128) /* Offset of register area in frame */ + +.text + .align 8 +.globl ffi_call_v9 +.globl _ffi_call_v9 + +ffi_call_v9: +_ffi_call_v9: +.LLFB1: + save %sp, -STACKFRAME, %sp +.LLCFI0: + + sub %sp, %i2, %sp ! alloca() space in stack for frame to set up + add %sp, STACKFRAME+STACK_BIAS, %l0 ! %l0 has start of + ! frame to set up + + mov %l0, %o0 ! call routine to set up frame + call %i0 + mov %i1, %o1 ! (delay) + brz,pt %o0, 1f + ldx [%l0+ARGS], %o0 ! call foreign function + + ldd [%l0+ARGS], %f0 + ldd [%l0+ARGS+8], %f2 + ldd [%l0+ARGS+16], %f4 + ldd [%l0+ARGS+24], %f6 + ldd [%l0+ARGS+32], %f8 + ldd [%l0+ARGS+40], %f10 + ldd [%l0+ARGS+48], %f12 + ldd [%l0+ARGS+56], %f14 + ldd [%l0+ARGS+64], %f16 + ldd [%l0+ARGS+72], %f18 + ldd [%l0+ARGS+80], %f20 + ldd [%l0+ARGS+88], %f22 + ldd [%l0+ARGS+96], %f24 + ldd [%l0+ARGS+104], %f26 + ldd [%l0+ARGS+112], %f28 + ldd [%l0+ARGS+120], %f30 + +1: ldx [%l0+ARGS+8], %o1 + ldx [%l0+ARGS+16], %o2 + ldx [%l0+ARGS+24], %o3 + ldx [%l0+ARGS+32], %o4 + ldx [%l0+ARGS+40], %o5 + call %i5 + sub %l0, STACK_BIAS, %sp ! (delay) switch to frame + + ! If the return value pointer is NULL, assume no return value. + brz,pn %i4, done + nop + + cmp %i3, FFI_TYPE_INT + be,a,pt %icc, done + stx %o0, [%i4+0] ! (delay) + + cmp %i3, FFI_TYPE_FLOAT + be,a,pn %icc, done + st %f0, [%i4+0] ! (delay) + + cmp %i3, FFI_TYPE_DOUBLE + be,a,pn %icc, done + std %f0, [%i4+0] ! (delay) + + cmp %i3, FFI_TYPE_STRUCT + be,pn %icc, dostruct + + cmp %i3, FFI_TYPE_LONGDOUBLE + bne,pt %icc, done + nop + std %f0, [%i4+0] + std %f2, [%i4+8] + +done: ret + restore + +dostruct: + /* This will not work correctly for unions. */ + stx %o0, [%i4+0] + stx %o1, [%i4+8] + stx %o2, [%i4+16] + stx %o3, [%i4+24] + std %f0, [%i4+32] + std %f2, [%i4+40] + std %f4, [%i4+48] + std %f6, [%i4+56] + ret + restore +.LLFE1: + +.ffi_call_v9_end: + .size ffi_call_v9,.ffi_call_v9_end-ffi_call_v9 + + +#undef STACKFRAME +#define STACKFRAME 336 /* 16*8 register window + + 6*8 args backing store + + 20*8 locals */ +#define FP %fp+STACK_BIAS + +/* ffi_closure_v9(...) + + Receives the closure argument in %g1. */ + + .text + .align 8 + .globl ffi_closure_v9 + +ffi_closure_v9: +.LLFB2: + save %sp, -STACKFRAME, %sp +.LLCFI1: + + ! Store all of the potential argument registers in va_list format. + stx %i0, [FP+128+0] + stx %i1, [FP+128+8] + stx %i2, [FP+128+16] + stx %i3, [FP+128+24] + stx %i4, [FP+128+32] + stx %i5, [FP+128+40] + + ! Store possible floating point argument registers too. + std %f0, [FP-128] + std %f2, [FP-120] + std %f4, [FP-112] + std %f6, [FP-104] + std %f8, [FP-96] + std %f10, [FP-88] + std %f12, [FP-80] + std %f14, [FP-72] + std %f16, [FP-64] + std %f18, [FP-56] + std %f20, [FP-48] + std %f22, [FP-40] + std %f24, [FP-32] + std %f26, [FP-24] + std %f28, [FP-16] + std %f30, [FP-8] + + ! Call ffi_closure_sparc_inner to do the bulk of the work. + mov %g1, %o0 + add %fp, STACK_BIAS-160, %o1 + add %fp, STACK_BIAS+128, %o2 + call ffi_closure_sparc_inner_v9 + add %fp, STACK_BIAS-128, %o3 + + ! Load up the return value in the proper type. + ! See ffi_prep_cif_machdep for the list of cases. + cmp %o0, FFI_TYPE_VOID + be,pn %icc, done1 + + cmp %o0, FFI_TYPE_INT + be,pn %icc, integer + + cmp %o0, FFI_TYPE_FLOAT + be,a,pn %icc, done1 + ld [FP-160], %f0 + + cmp %o0, FFI_TYPE_DOUBLE + be,a,pn %icc, done1 + ldd [FP-160], %f0 + +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE + cmp %o0, FFI_TYPE_LONGDOUBLE + be,a,pn %icc, longdouble1 + ldd [FP-160], %f0 +#endif + + ! FFI_TYPE_STRUCT + ldx [FP-152], %i1 + ldx [FP-144], %i2 + ldx [FP-136], %i3 + ldd [FP-160], %f0 + ldd [FP-152], %f2 + ldd [FP-144], %f4 + ldd [FP-136], %f6 + +integer: + ldx [FP-160], %i0 + +done1: + ret + restore + +#if FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE +longdouble1: + ldd [FP-152], %f2 + ret + restore +#endif +.LLFE2: + +.ffi_closure_v9_end: + .size ffi_closure_v9,.ffi_closure_v9_end-ffi_closure_v9 + +#ifdef HAVE_RO_EH_FRAME + .section ".eh_frame",#alloc +#else + .section ".eh_frame",#alloc,#write +#endif +.LLframe1: + .uaword .LLECIE1-.LLSCIE1 ! Length of Common Information Entry +.LLSCIE1: + .uaword 0x0 ! CIE Identifier Tag + .byte 0x1 ! CIE Version + .ascii "zR\0" ! CIE Augmentation + .byte 0x1 ! uleb128 0x1; CIE Code Alignment Factor + .byte 0x78 ! sleb128 -8; CIE Data Alignment Factor + .byte 0xf ! CIE RA Column + .byte 0x1 ! uleb128 0x1; Augmentation size +#ifdef HAVE_AS_SPARC_UA_PCREL + .byte 0x1b ! FDE Encoding (pcrel sdata4) +#else + .byte 0x50 ! FDE Encoding (aligned absolute) +#endif + .byte 0xc ! DW_CFA_def_cfa + .byte 0xe ! uleb128 0xe + .byte 0xff,0xf ! uleb128 0x7ff + .align 8 +.LLECIE1: +.LLSFDE1: + .uaword .LLEFDE1-.LLASFDE1 ! FDE Length +.LLASFDE1: + .uaword .LLASFDE1-.LLframe1 ! FDE CIE offset +#ifdef HAVE_AS_SPARC_UA_PCREL + .uaword %r_disp32(.LLFB1) + .uaword .LLFE1-.LLFB1 ! FDE address range +#else + .align 8 + .xword .LLFB1 + .uaxword .LLFE1-.LLFB1 ! FDE address range +#endif + .byte 0x0 ! uleb128 0x0; Augmentation size + .byte 0x4 ! DW_CFA_advance_loc4 + .uaword .LLCFI0-.LLFB1 + .byte 0xd ! DW_CFA_def_cfa_register + .byte 0x1e ! uleb128 0x1e + .byte 0x2d ! DW_CFA_GNU_window_save + .byte 0x9 ! DW_CFA_register + .byte 0xf ! uleb128 0xf + .byte 0x1f ! uleb128 0x1f + .align 8 +.LLEFDE1: +.LLSFDE2: + .uaword .LLEFDE2-.LLASFDE2 ! FDE Length +.LLASFDE2: + .uaword .LLASFDE2-.LLframe1 ! FDE CIE offset +#ifdef HAVE_AS_SPARC_UA_PCREL + .uaword %r_disp32(.LLFB2) + .uaword .LLFE2-.LLFB2 ! FDE address range +#else + .align 8 + .xword .LLFB2 + .uaxword .LLFE2-.LLFB2 ! FDE address range +#endif + .byte 0x0 ! uleb128 0x0; Augmentation size + .byte 0x4 ! DW_CFA_advance_loc4 + .uaword .LLCFI1-.LLFB2 + .byte 0xd ! DW_CFA_def_cfa_register + .byte 0x1e ! uleb128 0x1e + .byte 0x2d ! DW_CFA_GNU_window_save + .byte 0x9 ! DW_CFA_register + .byte 0xf ! uleb128 0xf + .byte 0x1f ! uleb128 0x1f + .align 8 +.LLEFDE2: +#endif + +#ifdef __linux__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/types.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/types.c new file mode 100644 index 000000000..0a11eb0fb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/types.c @@ -0,0 +1,77 @@ +/* ----------------------------------------------------------------------- + types.c - Copyright (c) 1996, 1998 Red Hat, Inc. + + Predefined ffi_types needed by libffi. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +/* Hide the basic type definitions from the header file, so that we + can redefine them here as "const". */ +#define LIBFFI_HIDE_BASIC_TYPES + +#include +#include + +/* Type definitions */ + +#define FFI_TYPEDEF(name, type, id) \ +struct struct_align_##name { \ + char c; \ + type x; \ +}; \ +const ffi_type ffi_type_##name = { \ + sizeof(type), \ + offsetof(struct struct_align_##name, x), \ + id, NULL \ +} + +/* Size and alignment are fake here. They must not be 0. */ +const ffi_type ffi_type_void = { + 1, 1, FFI_TYPE_VOID, NULL +}; + +FFI_TYPEDEF(uint8, UINT8, FFI_TYPE_UINT8); +FFI_TYPEDEF(sint8, SINT8, FFI_TYPE_SINT8); +FFI_TYPEDEF(uint16, UINT16, FFI_TYPE_UINT16); +FFI_TYPEDEF(sint16, SINT16, FFI_TYPE_SINT16); +FFI_TYPEDEF(uint32, UINT32, FFI_TYPE_UINT32); +FFI_TYPEDEF(sint32, SINT32, FFI_TYPE_SINT32); +FFI_TYPEDEF(uint64, UINT64, FFI_TYPE_UINT64); +FFI_TYPEDEF(sint64, SINT64, FFI_TYPE_SINT64); + +FFI_TYPEDEF(pointer, void*, FFI_TYPE_POINTER); + +FFI_TYPEDEF(float, float, FFI_TYPE_FLOAT); +FFI_TYPEDEF(double, double, FFI_TYPE_DOUBLE); + +#ifdef __alpha__ +/* Even if we're not configured to default to 128-bit long double, + maintain binary compatibility, as -mlong-double-128 can be used + at any time. */ +/* Validate the hard-coded number below. */ +# if defined(__LONG_DOUBLE_128__) && FFI_TYPE_LONGDOUBLE != 4 +# error FFI_TYPE_LONGDOUBLE out of date +# endif +const ffi_type ffi_type_longdouble = { 16, 16, 4, NULL }; +#elif FFI_TYPE_LONGDOUBLE != FFI_TYPE_DOUBLE +FFI_TYPEDEF(longdouble, long double, FFI_TYPE_LONGDOUBLE); +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/darwin.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/darwin.S new file mode 100644 index 000000000..8f0f0707a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/darwin.S @@ -0,0 +1,444 @@ +/* ----------------------------------------------------------------------- + darwin.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005 Red Hat, Inc. + Copyright (C) 2008 Free Software Foundation, Inc. + + X86 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- + */ + +#ifndef __x86_64__ + +#define LIBFFI_ASM +#include +#include + +.text + +.globl _ffi_prep_args + + .align 4 +.globl _ffi_call_SYSV + +_ffi_call_SYSV: +.LFB1: + pushl %ebp +.LCFI0: + movl %esp,%ebp +.LCFI1: + subl $8,%esp + /* Make room for all of the new args. */ + movl 16(%ebp),%ecx + subl %ecx,%esp + + movl %esp,%eax + + /* Place all of the ffi_prep_args in position */ + subl $8,%esp + pushl 12(%ebp) + pushl %eax + call *8(%ebp) + + /* Return stack to previous state and call the function */ + addl $16,%esp + + call *28(%ebp) + + /* Load %ecx with the return type code */ + movl 20(%ebp),%ecx + + /* Protect %esi. We're going to pop it in the epilogue. */ + pushl %esi + + /* If the return value pointer is NULL, assume no return value. */ + cmpl $0,24(%ebp) + jne 0f + + /* Even if there is no space for the return value, we are + obliged to handle floating-point values. */ + cmpl $FFI_TYPE_FLOAT,%ecx + jne noretval + fstp %st(0) + + jmp epilogue +0: + .align 4 + call 1f +.Lstore_table: + .long noretval-.Lstore_table /* FFI_TYPE_VOID */ + .long retint-.Lstore_table /* FFI_TYPE_INT */ + .long retfloat-.Lstore_table /* FFI_TYPE_FLOAT */ + .long retdouble-.Lstore_table /* FFI_TYPE_DOUBLE */ + .long retlongdouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */ + .long retuint8-.Lstore_table /* FFI_TYPE_UINT8 */ + .long retsint8-.Lstore_table /* FFI_TYPE_SINT8 */ + .long retuint16-.Lstore_table /* FFI_TYPE_UINT16 */ + .long retsint16-.Lstore_table /* FFI_TYPE_SINT16 */ + .long retint-.Lstore_table /* FFI_TYPE_UINT32 */ + .long retint-.Lstore_table /* FFI_TYPE_SINT32 */ + .long retint64-.Lstore_table /* FFI_TYPE_UINT64 */ + .long retint64-.Lstore_table /* FFI_TYPE_SINT64 */ + .long retstruct-.Lstore_table /* FFI_TYPE_STRUCT */ + .long retint-.Lstore_table /* FFI_TYPE_POINTER */ + .long retstruct1b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_1B */ + .long retstruct2b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_2B */ +1: + pop %esi + add (%esi, %ecx, 4), %esi + jmp *%esi + + /* Sign/zero extend as appropriate. */ +retsint8: + movsbl %al, %eax + jmp retint + +retsint16: + movswl %ax, %eax + jmp retint + +retuint8: + movzbl %al, %eax + jmp retint + +retuint16: + movzwl %ax, %eax + jmp retint + +retfloat: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + fstps (%ecx) + jmp epilogue + +retdouble: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + fstpl (%ecx) + jmp epilogue + +retlongdouble: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + fstpt (%ecx) + jmp epilogue + +retint64: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + movl %eax,0(%ecx) + movl %edx,4(%ecx) + jmp epilogue + +retstruct1b: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + movb %al,0(%ecx) + jmp epilogue + +retstruct2b: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + movw %ax,0(%ecx) + jmp epilogue + +retint: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + movl %eax,0(%ecx) + +retstruct: + /* Nothing to do! */ + +noretval: +epilogue: + popl %esi + movl %ebp,%esp + popl %ebp + ret + +.LFE1: +.ffi_call_SYSV_end: + + .align 4 +FFI_HIDDEN (ffi_closure_SYSV) +.globl _ffi_closure_SYSV + +_ffi_closure_SYSV: +.LFB2: + pushl %ebp +.LCFI2: + movl %esp, %ebp +.LCFI3: + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) /* resp */ + leal 8(%ebp), %edx + movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ + leal -12(%ebp), %edx + movl %edx, (%esp) /* &resp */ + movl %ebx, 8(%esp) +.LCFI7: + call L_ffi_closure_SYSV_inner$stub + movl 8(%esp), %ebx + movl -12(%ebp), %ecx + cmpl $FFI_TYPE_INT, %eax + je .Lcls_retint + + /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, + FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ + cmpl $FFI_TYPE_UINT64, %eax + jge 0f + cmpl $FFI_TYPE_UINT8, %eax + jge .Lcls_retint + +0: cmpl $FFI_TYPE_FLOAT, %eax + je .Lcls_retfloat + cmpl $FFI_TYPE_DOUBLE, %eax + je .Lcls_retdouble + cmpl $FFI_TYPE_LONGDOUBLE, %eax + je .Lcls_retldouble + cmpl $FFI_TYPE_SINT64, %eax + je .Lcls_retllong + cmpl $FFI_TYPE_SMALL_STRUCT_1B, %eax + je .Lcls_retstruct1b + cmpl $FFI_TYPE_SMALL_STRUCT_2B, %eax + je .Lcls_retstruct2b + cmpl $FFI_TYPE_STRUCT, %eax + je .Lcls_retstruct +.Lcls_epilogue: + movl %ebp, %esp + popl %ebp + ret +.Lcls_retint: + movl (%ecx), %eax + jmp .Lcls_epilogue +.Lcls_retfloat: + flds (%ecx) + jmp .Lcls_epilogue +.Lcls_retdouble: + fldl (%ecx) + jmp .Lcls_epilogue +.Lcls_retldouble: + fldt (%ecx) + jmp .Lcls_epilogue +.Lcls_retllong: + movl (%ecx), %eax + movl 4(%ecx), %edx + jmp .Lcls_epilogue +.Lcls_retstruct1b: + movsbl (%ecx), %eax + jmp .Lcls_epilogue +.Lcls_retstruct2b: + movswl (%ecx), %eax + jmp .Lcls_epilogue +.Lcls_retstruct: + lea -8(%ebp),%esp + movl %ebp, %esp + popl %ebp + ret $4 +.LFE2: + +#if !FFI_NO_RAW_API + +#define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3) +#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) +#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) +#define CIF_FLAGS_OFFSET 20 + + .align 4 +FFI_HIDDEN (ffi_closure_raw_SYSV) +.globl _ffi_closure_raw_SYSV + +_ffi_closure_raw_SYSV: +.LFB3: + pushl %ebp +.LCFI4: + movl %esp, %ebp +.LCFI5: + pushl %esi +.LCFI6: + subl $36, %esp + movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ + movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ + movl %edx, 12(%esp) /* user_data */ + leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ + movl %edx, 8(%esp) /* raw_args */ + leal -24(%ebp), %edx + movl %edx, 4(%esp) /* &res */ + movl %esi, (%esp) /* cif */ + call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */ + movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */ + cmpl $FFI_TYPE_INT, %eax + je .Lrcls_retint + + /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, + FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ + cmpl $FFI_TYPE_UINT64, %eax + jge 0f + cmpl $FFI_TYPE_UINT8, %eax + jge .Lrcls_retint +0: + cmpl $FFI_TYPE_FLOAT, %eax + je .Lrcls_retfloat + cmpl $FFI_TYPE_DOUBLE, %eax + je .Lrcls_retdouble + cmpl $FFI_TYPE_LONGDOUBLE, %eax + je .Lrcls_retldouble + cmpl $FFI_TYPE_SINT64, %eax + je .Lrcls_retllong +.Lrcls_epilogue: + addl $36, %esp + popl %esi + popl %ebp + ret +.Lrcls_retint: + movl -24(%ebp), %eax + jmp .Lrcls_epilogue +.Lrcls_retfloat: + flds -24(%ebp) + jmp .Lrcls_epilogue +.Lrcls_retdouble: + fldl -24(%ebp) + jmp .Lrcls_epilogue +.Lrcls_retldouble: + fldt -24(%ebp) + jmp .Lrcls_epilogue +.Lrcls_retllong: + movl -24(%ebp), %eax + movl -20(%ebp), %edx + jmp .Lrcls_epilogue +.LFE3: +#endif + +.section __IMPORT,__jump_table,symbol_stubs,self_modifying_code+pure_instructions,5 +L_ffi_closure_SYSV_inner$stub: + .indirect_symbol _ffi_closure_SYSV_inner + hlt ; hlt ; hlt ; hlt ; hlt + + +.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support +EH_frame1: + .set L$set$0,LECIE1-LSCIE1 + .long L$set$0 +LSCIE1: + .long 0x0 + .byte 0x1 + .ascii "zR\0" + .byte 0x1 + .byte 0x7c + .byte 0x8 + .byte 0x1 + .byte 0x10 + .byte 0xc + .byte 0x5 + .byte 0x4 + .byte 0x88 + .byte 0x1 + .align 2 +LECIE1: +.globl _ffi_call_SYSV.eh +_ffi_call_SYSV.eh: +LSFDE1: + .set L$set$1,LEFDE1-LASFDE1 + .long L$set$1 +LASFDE1: + .long LASFDE1-EH_frame1 + .long .LFB1-. + .set L$set$2,.LFE1-.LFB1 + .long L$set$2 + .byte 0x0 + .byte 0x4 + .set L$set$3,.LCFI0-.LFB1 + .long L$set$3 + .byte 0xe + .byte 0x8 + .byte 0x84 + .byte 0x2 + .byte 0x4 + .set L$set$4,.LCFI1-.LCFI0 + .long L$set$4 + .byte 0xd + .byte 0x4 + .align 2 +LEFDE1: +.globl _ffi_closure_SYSV.eh +_ffi_closure_SYSV.eh: +LSFDE2: + .set L$set$5,LEFDE2-LASFDE2 + .long L$set$5 +LASFDE2: + .long LASFDE2-EH_frame1 + .long .LFB2-. + .set L$set$6,.LFE2-.LFB2 + .long L$set$6 + .byte 0x0 + .byte 0x4 + .set L$set$7,.LCFI2-.LFB2 + .long L$set$7 + .byte 0xe + .byte 0x8 + .byte 0x84 + .byte 0x2 + .byte 0x4 + .set L$set$8,.LCFI3-.LCFI2 + .long L$set$8 + .byte 0xd + .byte 0x4 + .align 2 +LEFDE2: + +#if !FFI_NO_RAW_API + +.globl _ffi_closure_raw_SYSV.eh +_ffi_closure_raw_SYSV.eh: +LSFDE3: + .set L$set$10,LEFDE3-LASFDE3 + .long L$set$10 +LASFDE3: + .long LASFDE3-EH_frame1 + .long .LFB3-. + .set L$set$11,.LFE3-.LFB3 + .long L$set$11 + .byte 0x0 + .byte 0x4 + .set L$set$12,.LCFI4-.LFB3 + .long L$set$12 + .byte 0xe + .byte 0x8 + .byte 0x84 + .byte 0x2 + .byte 0x4 + .set L$set$13,.LCFI5-.LCFI4 + .long L$set$13 + .byte 0xd + .byte 0x4 + .byte 0x4 + .set L$set$14,.LCFI6-.LCFI5 + .long L$set$14 + .byte 0x85 + .byte 0x3 + .align 2 +LEFDE3: + +#endif + +#endif /* ifndef __x86_64__ */ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/darwin64.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/darwin64.S new file mode 100644 index 000000000..2f7394ef4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/darwin64.S @@ -0,0 +1,416 @@ +/* ----------------------------------------------------------------------- + darwin64.S - Copyright (c) 2006 Free Software Foundation, Inc. + Copyright (c) 2008 Red Hat, Inc. + derived from unix64.S + + x86-64 Foreign Function Interface for Darwin. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, EXPRESS + OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR + OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#ifdef __x86_64__ +#define LIBFFI_ASM +#include +#include + + .file "darwin64.S" +.text + +/* ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, + void *raddr, void (*fnaddr)(void)); + + Bit o trickiness here -- ARGS+BYTES is the base of the stack frame + for this function. This has been allocated by ffi_call. We also + deallocate some of the stack that has been alloca'd. */ + + .align 3 + .globl _ffi_call_unix64 + +_ffi_call_unix64: +LUW0: + movq (%rsp), %r10 /* Load return address. */ + leaq (%rdi, %rsi), %rax /* Find local stack base. */ + movq %rdx, (%rax) /* Save flags. */ + movq %rcx, 8(%rax) /* Save raddr. */ + movq %rbp, 16(%rax) /* Save old frame pointer. */ + movq %r10, 24(%rax) /* Relocate return address. */ + movq %rax, %rbp /* Finalize local stack frame. */ +LUW1: + movq %rdi, %r10 /* Save a copy of the register area. */ + movq %r8, %r11 /* Save a copy of the target fn. */ + movl %r9d, %eax /* Set number of SSE registers. */ + + /* Load up all argument registers. */ + movq (%r10), %rdi + movq 8(%r10), %rsi + movq 16(%r10), %rdx + movq 24(%r10), %rcx + movq 32(%r10), %r8 + movq 40(%r10), %r9 + testl %eax, %eax + jnz Lload_sse +Lret_from_load_sse: + + /* Deallocate the reg arg area. */ + leaq 176(%r10), %rsp + + /* Call the user function. */ + call *%r11 + + /* Deallocate stack arg area; local stack frame in redzone. */ + leaq 24(%rbp), %rsp + + movq 0(%rbp), %rcx /* Reload flags. */ + movq 8(%rbp), %rdi /* Reload raddr. */ + movq 16(%rbp), %rbp /* Reload old frame pointer. */ +LUW2: + + /* The first byte of the flags contains the FFI_TYPE. */ + movzbl %cl, %r10d + leaq Lstore_table(%rip), %r11 + movslq (%r11, %r10, 4), %r10 + addq %r11, %r10 + jmp *%r10 + +Lstore_table: + .long Lst_void-Lstore_table /* FFI_TYPE_VOID */ + .long Lst_sint32-Lstore_table /* FFI_TYPE_INT */ + .long Lst_float-Lstore_table /* FFI_TYPE_FLOAT */ + .long Lst_double-Lstore_table /* FFI_TYPE_DOUBLE */ + .long Lst_ldouble-Lstore_table /* FFI_TYPE_LONGDOUBLE */ + .long Lst_uint8-Lstore_table /* FFI_TYPE_UINT8 */ + .long Lst_sint8-Lstore_table /* FFI_TYPE_SINT8 */ + .long Lst_uint16-Lstore_table /* FFI_TYPE_UINT16 */ + .long Lst_sint16-Lstore_table /* FFI_TYPE_SINT16 */ + .long Lst_uint32-Lstore_table /* FFI_TYPE_UINT32 */ + .long Lst_sint32-Lstore_table /* FFI_TYPE_SINT32 */ + .long Lst_int64-Lstore_table /* FFI_TYPE_UINT64 */ + .long Lst_int64-Lstore_table /* FFI_TYPE_SINT64 */ + .long Lst_struct-Lstore_table /* FFI_TYPE_STRUCT */ + .long Lst_int64-Lstore_table /* FFI_TYPE_POINTER */ + + .text + .align 3 +Lst_void: + ret + .align 3 +Lst_uint8: + movzbq %al, %rax + movq %rax, (%rdi) + ret + .align 3 +Lst_sint8: + movsbq %al, %rax + movq %rax, (%rdi) + ret + .align 3 +Lst_uint16: + movzwq %ax, %rax + movq %rax, (%rdi) + .align 3 +Lst_sint16: + movswq %ax, %rax + movq %rax, (%rdi) + ret + .align 3 +Lst_uint32: + movl %eax, %eax + movq %rax, (%rdi) + .align 3 +Lst_sint32: + cltq + movq %rax, (%rdi) + ret + .align 3 +Lst_int64: + movq %rax, (%rdi) + ret + .align 3 +Lst_float: + movss %xmm0, (%rdi) + ret + .align 3 +Lst_double: + movsd %xmm0, (%rdi) + ret +Lst_ldouble: + fstpt (%rdi) + ret + .align 3 +Lst_struct: + leaq -20(%rsp), %rsi /* Scratch area in redzone. */ + + /* We have to locate the values now, and since we don't want to + write too much data into the user's return value, we spill the + value to a 16 byte scratch area first. Bits 8, 9, and 10 + control where the values are located. Only one of the three + bits will be set; see ffi_prep_cif_machdep for the pattern. */ + movd %xmm0, %r10 + movd %xmm1, %r11 + testl $0x100, %ecx + cmovnz %rax, %rdx + cmovnz %r10, %rax + testl $0x200, %ecx + cmovnz %r10, %rdx + testl $0x400, %ecx + cmovnz %r10, %rax + cmovnz %r11, %rdx + movq %rax, (%rsi) + movq %rdx, 8(%rsi) + + /* Bits 12-31 contain the true size of the structure. Copy from + the scratch area to the true destination. */ + shrl $12, %ecx + rep movsb + ret + + /* Many times we can avoid loading any SSE registers at all. + It's not worth an indirect jump to load the exact set of + SSE registers needed; zero or all is a good compromise. */ + .align 3 +LUW3: +Lload_sse: + movdqa 48(%r10), %xmm0 + movdqa 64(%r10), %xmm1 + movdqa 80(%r10), %xmm2 + movdqa 96(%r10), %xmm3 + movdqa 112(%r10), %xmm4 + movdqa 128(%r10), %xmm5 + movdqa 144(%r10), %xmm6 + movdqa 160(%r10), %xmm7 + jmp Lret_from_load_sse + +LUW4: + .align 3 + .globl _ffi_closure_unix64 + +_ffi_closure_unix64: +LUW5: + /* The carry flag is set by the trampoline iff SSE registers + are used. Don't clobber it before the branch instruction. */ + leaq -200(%rsp), %rsp +LUW6: + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %rdx, 16(%rsp) + movq %rcx, 24(%rsp) + movq %r8, 32(%rsp) + movq %r9, 40(%rsp) + jc Lsave_sse +Lret_from_save_sse: + + movq %r10, %rdi + leaq 176(%rsp), %rsi + movq %rsp, %rdx + leaq 208(%rsp), %rcx + call _ffi_closure_unix64_inner + + /* Deallocate stack frame early; return value is now in redzone. */ + addq $200, %rsp +LUW7: + + /* The first byte of the return value contains the FFI_TYPE. */ + movzbl %al, %r10d + leaq Lload_table(%rip), %r11 + movslq (%r11, %r10, 4), %r10 + addq %r11, %r10 + jmp *%r10 + +Lload_table: + .long Lld_void-Lload_table /* FFI_TYPE_VOID */ + .long Lld_int32-Lload_table /* FFI_TYPE_INT */ + .long Lld_float-Lload_table /* FFI_TYPE_FLOAT */ + .long Lld_double-Lload_table /* FFI_TYPE_DOUBLE */ + .long Lld_ldouble-Lload_table /* FFI_TYPE_LONGDOUBLE */ + .long Lld_int8-Lload_table /* FFI_TYPE_UINT8 */ + .long Lld_int8-Lload_table /* FFI_TYPE_SINT8 */ + .long Lld_int16-Lload_table /* FFI_TYPE_UINT16 */ + .long Lld_int16-Lload_table /* FFI_TYPE_SINT16 */ + .long Lld_int32-Lload_table /* FFI_TYPE_UINT32 */ + .long Lld_int32-Lload_table /* FFI_TYPE_SINT32 */ + .long Lld_int64-Lload_table /* FFI_TYPE_UINT64 */ + .long Lld_int64-Lload_table /* FFI_TYPE_SINT64 */ + .long Lld_struct-Lload_table /* FFI_TYPE_STRUCT */ + .long Lld_int64-Lload_table /* FFI_TYPE_POINTER */ + + .text + .align 3 +Lld_void: + ret + .align 3 +Lld_int8: + movzbl -24(%rsp), %eax + ret + .align 3 +Lld_int16: + movzwl -24(%rsp), %eax + ret + .align 3 +Lld_int32: + movl -24(%rsp), %eax + ret + .align 3 +Lld_int64: + movq -24(%rsp), %rax + ret + .align 3 +Lld_float: + movss -24(%rsp), %xmm0 + ret + .align 3 +Lld_double: + movsd -24(%rsp), %xmm0 + ret + .align 3 +Lld_ldouble: + fldt -24(%rsp) + ret + .align 3 +Lld_struct: + /* There are four possibilities here, %rax/%rdx, %xmm0/%rax, + %rax/%xmm0, %xmm0/%xmm1. We collapse two by always loading + both rdx and xmm1 with the second word. For the remaining, + bit 8 set means xmm0 gets the second word, and bit 9 means + that rax gets the second word. */ + movq -24(%rsp), %rcx + movq -16(%rsp), %rdx + movq -16(%rsp), %xmm1 + testl $0x100, %eax + cmovnz %rdx, %rcx + movd %rcx, %xmm0 + testl $0x200, %eax + movq -24(%rsp), %rax + cmovnz %rdx, %rax + ret + + /* See the comment above Lload_sse; the same logic applies here. */ + .align 3 +LUW8: +Lsave_sse: + movdqa %xmm0, 48(%rsp) + movdqa %xmm1, 64(%rsp) + movdqa %xmm2, 80(%rsp) + movdqa %xmm3, 96(%rsp) + movdqa %xmm4, 112(%rsp) + movdqa %xmm5, 128(%rsp) + movdqa %xmm6, 144(%rsp) + movdqa %xmm7, 160(%rsp) + jmp Lret_from_save_sse + +LUW9: +.section __TEXT,__eh_frame,coalesced,no_toc+strip_static_syms+live_support +EH_frame1: + .set L$set$0,LECIE1-LSCIE1 /* CIE Length */ + .long L$set$0 +LSCIE1: + .long 0x0 /* CIE Identifier Tag */ + .byte 0x1 /* CIE Version */ + .ascii "zR\0" /* CIE Augmentation */ + .byte 0x1 /* uleb128 0x1; CIE Code Alignment Factor */ + .byte 0x78 /* sleb128 -8; CIE Data Alignment Factor */ + .byte 0x10 /* CIE RA Column */ + .byte 0x1 /* uleb128 0x1; Augmentation size */ + .byte 0x10 /* FDE Encoding (pcrel sdata4) */ + .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ + .byte 0x7 /* uleb128 0x7 */ + .byte 0x8 /* uleb128 0x8 */ + .byte 0x90 /* DW_CFA_offset, column 0x10 */ + .byte 0x1 + .align 3 +LECIE1: + .globl _ffi_call_unix64.eh +_ffi_call_unix64.eh: +LSFDE1: + .set L$set$1,LEFDE1-LASFDE1 /* FDE Length */ + .long L$set$1 +LASFDE1: + .long LASFDE1-EH_frame1 /* FDE CIE offset */ + .quad LUW0-. /* FDE initial location */ + .set L$set$2,LUW4-LUW0 /* FDE address range */ + .quad L$set$2 + .byte 0x0 /* Augmentation size */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .set L$set$3,LUW1-LUW0 + .long L$set$3 + + /* New stack frame based off rbp. This is a itty bit of unwind + trickery in that the CFA *has* changed. There is no easy way + to describe it correctly on entry to the function. Fortunately, + it doesn't matter too much since at all points we can correctly + unwind back to ffi_call. Note that the location to which we + moved the return address is (the new) CFA-8, so from the + perspective of the unwind info, it hasn't moved. */ + .byte 0xc /* DW_CFA_def_cfa, %rbp offset 32 */ + .byte 0x6 + .byte 0x20 + .byte 0x80+6 /* DW_CFA_offset, %rbp offset 2*-8 */ + .byte 0x2 + .byte 0xa /* DW_CFA_remember_state */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .set L$set$4,LUW2-LUW1 + .long L$set$4 + .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ + .byte 0x7 + .byte 0x8 + .byte 0xc0+6 /* DW_CFA_restore, %rbp */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .set L$set$5,LUW3-LUW2 + .long L$set$5 + .byte 0xb /* DW_CFA_restore_state */ + + .align 3 +LEFDE1: + .globl _ffi_closure_unix64.eh +_ffi_closure_unix64.eh: +LSFDE3: + .set L$set$6,LEFDE3-LASFDE3 /* FDE Length */ + .long L$set$6 +LASFDE3: + .long LASFDE3-EH_frame1 /* FDE CIE offset */ + .quad LUW5-. /* FDE initial location */ + .set L$set$7,LUW9-LUW5 /* FDE address range */ + .quad L$set$7 + .byte 0x0 /* Augmentation size */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .set L$set$8,LUW6-LUW5 + .long L$set$8 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 208,1 /* uleb128 208 */ + .byte 0xa /* DW_CFA_remember_state */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .set L$set$9,LUW7-LUW6 + .long L$set$9 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x8 + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .set L$set$10,LUW8-LUW7 + .long L$set$10 + .byte 0xb /* DW_CFA_restore_state */ + + .align 3 +LEFDE3: + .subsections_via_symbols + +#endif /* __x86_64__ */ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/ffi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/ffi.c new file mode 100644 index 000000000..34f9c66a9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/ffi.c @@ -0,0 +1,644 @@ +/* ----------------------------------------------------------------------- + ffi.c - Copyright (c) 1996, 1998, 1999, 2001, 2007, 2008 Red Hat, Inc. + Copyright (c) 2002 Ranjit Mathew + Copyright (c) 2002 Bo Thorsen + Copyright (c) 2002 Roger Sayle + Copyright (C) 2008, 2010 Free Software Foundation, Inc. + + x86 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#if !defined(__x86_64__) || defined(_WIN64) + +#ifdef _WIN64 +#include +#endif + +#include +#include + +#include + +/* ffi_prep_args is called by the assembly routine once stack space + has been allocated for the function's arguments */ + +void ffi_prep_args(char *stack, extended_cif *ecif) +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + argp = stack; + + if (ecif->cif->flags == FFI_TYPE_STRUCT +#ifdef X86_WIN64 + && (ecif->cif->rtype->size != 1 && ecif->cif->rtype->size != 2 + && ecif->cif->rtype->size != 4 && ecif->cif->rtype->size != 8) +#endif + ) + { + *(void **) argp = ecif->rvalue; + argp += sizeof(void*); + } + + p_argv = ecif->avalue; + + for (i = ecif->cif->nargs, p_arg = ecif->cif->arg_types; + i != 0; + i--, p_arg++) + { + size_t z; + + /* Align if necessary */ + if ((sizeof(void*) - 1) & (size_t) argp) + argp = (char *) ALIGN(argp, sizeof(void*)); + + z = (*p_arg)->size; +#ifdef X86_WIN64 + if (z > sizeof(ffi_arg) + || ((*p_arg)->type == FFI_TYPE_STRUCT + && (z != 1 && z != 2 && z != 4 && z != 8)) +#if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE + || ((*p_arg)->type == FFI_TYPE_LONGDOUBLE) +#endif + ) + { + z = sizeof(ffi_arg); + *(void **)argp = *p_argv; + } + else if ((*p_arg)->type == FFI_TYPE_FLOAT) + { + memcpy(argp, *p_argv, z); + } + else +#endif + if (z < sizeof(ffi_arg)) + { + z = sizeof(ffi_arg); + switch ((*p_arg)->type) + { + case FFI_TYPE_SINT8: + *(ffi_sarg *) argp = (ffi_sarg)*(SINT8 *)(* p_argv); + break; + + case FFI_TYPE_UINT8: + *(ffi_arg *) argp = (ffi_arg)*(UINT8 *)(* p_argv); + break; + + case FFI_TYPE_SINT16: + *(ffi_sarg *) argp = (ffi_sarg)*(SINT16 *)(* p_argv); + break; + + case FFI_TYPE_UINT16: + *(ffi_arg *) argp = (ffi_arg)*(UINT16 *)(* p_argv); + break; + + case FFI_TYPE_SINT32: + *(ffi_sarg *) argp = (ffi_sarg)*(SINT32 *)(* p_argv); + break; + + case FFI_TYPE_UINT32: + *(ffi_arg *) argp = (ffi_arg)*(UINT32 *)(* p_argv); + break; + + case FFI_TYPE_STRUCT: + *(ffi_arg *) argp = *(ffi_arg *)(* p_argv); + break; + + default: + FFI_ASSERT(0); + } + } + else + { + memcpy(argp, *p_argv, z); + } + p_argv++; +#ifdef X86_WIN64 + argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1); +#else + argp += z; +#endif + } + + return; +} + +/* Perform machine dependent cif processing */ +ffi_status ffi_prep_cif_machdep(ffi_cif *cif) +{ + unsigned int i; + ffi_type **ptr; + + /* Set the return type flag */ + switch (cif->rtype->type) + { + case FFI_TYPE_VOID: + case FFI_TYPE_UINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT8: + case FFI_TYPE_SINT16: +#ifdef X86_WIN64 + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: +#endif + case FFI_TYPE_SINT64: + case FFI_TYPE_FLOAT: + case FFI_TYPE_DOUBLE: +#ifndef X86_WIN64 +#if FFI_TYPE_DOUBLE != FFI_TYPE_LONGDOUBLE + case FFI_TYPE_LONGDOUBLE: +#endif +#endif + cif->flags = (unsigned) cif->rtype->type; + break; + + case FFI_TYPE_UINT64: +#ifdef X86_WIN64 + case FFI_TYPE_POINTER: +#endif + cif->flags = FFI_TYPE_SINT64; + break; + + case FFI_TYPE_STRUCT: +#ifndef X86 + if (cif->rtype->size == 1) + { + cif->flags = FFI_TYPE_SMALL_STRUCT_1B; /* same as char size */ + } + else if (cif->rtype->size == 2) + { + cif->flags = FFI_TYPE_SMALL_STRUCT_2B; /* same as short size */ + } + else if (cif->rtype->size == 4) + { +#ifdef X86_WIN64 + cif->flags = FFI_TYPE_SMALL_STRUCT_4B; +#else + cif->flags = FFI_TYPE_INT; /* same as int type */ +#endif + } + else if (cif->rtype->size == 8) + { + cif->flags = FFI_TYPE_SINT64; /* same as int64 type */ + } + else +#endif + { + cif->flags = FFI_TYPE_STRUCT; + /* allocate space for return value pointer */ + cif->bytes += ALIGN(sizeof(void*), FFI_SIZEOF_ARG); + } + break; + + default: +#ifdef X86_WIN64 + cif->flags = FFI_TYPE_SINT64; + break; + case FFI_TYPE_INT: + cif->flags = FFI_TYPE_SINT32; +#else + cif->flags = FFI_TYPE_INT; +#endif + break; + } + + for (ptr = cif->arg_types, i = cif->nargs; i > 0; i--, ptr++) + { + if (((*ptr)->alignment - 1) & cif->bytes) + cif->bytes = ALIGN(cif->bytes, (*ptr)->alignment); + cif->bytes += ALIGN((*ptr)->size, FFI_SIZEOF_ARG); + } + +#ifdef X86_WIN64 + /* ensure space for storing four registers */ + cif->bytes += 4 * sizeof(ffi_arg); +#endif + +#ifdef X86_DARWIN + cif->bytes = (cif->bytes + 15) & ~0xF; +#endif + + return FFI_OK; +} + +#ifdef X86_WIN64 +extern int +ffi_call_win64(void (*)(char *, extended_cif *), extended_cif *, + unsigned, unsigned, unsigned *, void (*fn)(void)); +#elif defined(X86_WIN32) +extern void +ffi_call_win32(void (*)(char *, extended_cif *), extended_cif *, + unsigned, unsigned, unsigned *, void (*fn)(void)); +#else +extern void ffi_call_SYSV(void (*)(char *, extended_cif *), extended_cif *, + unsigned, unsigned, unsigned *, void (*fn)(void)); +#endif + +void ffi_call(ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + extended_cif ecif; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + +#ifdef X86_WIN64 + if (rvalue == NULL + && cif->flags == FFI_TYPE_STRUCT + && cif->rtype->size != 1 && cif->rtype->size != 2 + && cif->rtype->size != 4 && cif->rtype->size != 8) + { + ecif.rvalue = alloca((cif->rtype->size + 0xF) & ~0xF); + } +#else + if (rvalue == NULL + && cif->flags == FFI_TYPE_STRUCT) + { + ecif.rvalue = alloca(cif->rtype->size); + } +#endif + else + ecif.rvalue = rvalue; + + + switch (cif->abi) + { +#ifdef X86_WIN64 + case FFI_WIN64: + ffi_call_win64(ffi_prep_args, &ecif, cif->bytes, + cif->flags, ecif.rvalue, fn); + break; +#elif defined(X86_WIN32) + case FFI_SYSV: + case FFI_STDCALL: + ffi_call_win32(ffi_prep_args, &ecif, cif->bytes, cif->flags, + ecif.rvalue, fn); + break; +#else + case FFI_SYSV: + ffi_call_SYSV(ffi_prep_args, &ecif, cif->bytes, cif->flags, ecif.rvalue, + fn); + break; +#endif + default: + FFI_ASSERT(0); + break; + } +} + + +/** private members **/ + +/* The following __attribute__((regparm(1))) decorations will have no effect + on MSVC - standard cdecl convention applies. */ +static void ffi_prep_incoming_args_SYSV (char *stack, void **ret, + void** args, ffi_cif* cif); +void FFI_HIDDEN ffi_closure_SYSV (ffi_closure *) + __attribute__ ((regparm(1))); +unsigned int FFI_HIDDEN ffi_closure_SYSV_inner (ffi_closure *, void **, void *) + __attribute__ ((regparm(1))); +void FFI_HIDDEN ffi_closure_raw_SYSV (ffi_raw_closure *) + __attribute__ ((regparm(1))); +#ifdef X86_WIN32 +void FFI_HIDDEN ffi_closure_STDCALL (ffi_closure *) + __attribute__ ((regparm(1))); +#endif +#ifdef X86_WIN64 +void FFI_HIDDEN ffi_closure_win64 (ffi_closure *); +#endif + +/* This function is jumped to by the trampoline */ + +#ifdef X86_WIN64 +void * FFI_HIDDEN +ffi_closure_win64_inner (ffi_closure *closure, void *args) { + ffi_cif *cif; + void **arg_area; + void *result; + void *resp = &result; + + cif = closure->cif; + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + + /* this call will initialize ARG_AREA, such that each + * element in that array points to the corresponding + * value on the stack; and if the function returns + * a structure, it will change RESP to point to the + * structure return address. */ + + ffi_prep_incoming_args_SYSV(args, &resp, arg_area, cif); + + (closure->fun) (cif, resp, arg_area, closure->user_data); + + /* The result is returned in rax. This does the right thing for + result types except for floats; we have to 'mov xmm0, rax' in the + caller to correct this. + TODO: structure sizes of 3 5 6 7 are returned by reference, too!!! + */ + return cif->rtype->size > sizeof(void *) ? resp : *(void **)resp; +} + +#else +unsigned int FFI_HIDDEN __attribute__ ((regparm(1))) +ffi_closure_SYSV_inner (ffi_closure *closure, void **respp, void *args) +{ + /* our various things... */ + ffi_cif *cif; + void **arg_area; + + cif = closure->cif; + arg_area = (void**) alloca (cif->nargs * sizeof (void*)); + + /* this call will initialize ARG_AREA, such that each + * element in that array points to the corresponding + * value on the stack; and if the function returns + * a structure, it will change RESP to point to the + * structure return address. */ + + ffi_prep_incoming_args_SYSV(args, respp, arg_area, cif); + + (closure->fun) (cif, *respp, arg_area, closure->user_data); + + return cif->flags; +} +#endif /* !X86_WIN64 */ + +static void +ffi_prep_incoming_args_SYSV(char *stack, void **rvalue, void **avalue, + ffi_cif *cif) +{ + register unsigned int i; + register void **p_argv; + register char *argp; + register ffi_type **p_arg; + + argp = stack; + +#ifdef X86_WIN64 + if (cif->rtype->size > sizeof(ffi_arg) + || (cif->flags == FFI_TYPE_STRUCT + && (cif->rtype->size != 1 && cif->rtype->size != 2 + && cif->rtype->size != 4 && cif->rtype->size != 8))) { + *rvalue = *(void **) argp; + argp += sizeof(void *); + } +#else + if ( cif->flags == FFI_TYPE_STRUCT ) { + *rvalue = *(void **) argp; + argp += sizeof(void *); + } +#endif + + p_argv = avalue; + + for (i = cif->nargs, p_arg = cif->arg_types; (i != 0); i--, p_arg++) + { + size_t z; + + /* Align if necessary */ + if ((sizeof(void*) - 1) & (size_t) argp) { + argp = (char *) ALIGN(argp, sizeof(void*)); + } + +#ifdef X86_WIN64 + if ((*p_arg)->size > sizeof(ffi_arg) + || ((*p_arg)->type == FFI_TYPE_STRUCT + && ((*p_arg)->size != 1 && (*p_arg)->size != 2 + && (*p_arg)->size != 4 && (*p_arg)->size != 8))) + { + z = sizeof(void *); + *p_argv = *(void **)argp; + } + else +#endif + { + z = (*p_arg)->size; + + /* because we're little endian, this is what it turns into. */ + + *p_argv = (void*) argp; + } + + p_argv++; +#ifdef X86_WIN64 + argp += (z + sizeof(void*) - 1) & ~(sizeof(void*) - 1); +#else + argp += z; +#endif + } + + return; +} + +#define FFI_INIT_TRAMPOLINE_WIN64(TRAMP,FUN,CTX,MASK) \ +{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ + void* __fun = (void*)(FUN); \ + void* __ctx = (void*)(CTX); \ + *(unsigned char*) &__tramp[0] = 0x41; \ + *(unsigned char*) &__tramp[1] = 0xbb; \ + *(unsigned int*) &__tramp[2] = MASK; /* mov $mask, %r11 */ \ + *(unsigned char*) &__tramp[6] = 0x48; \ + *(unsigned char*) &__tramp[7] = 0xb8; \ + *(void**) &__tramp[8] = __ctx; /* mov __ctx, %rax */ \ + *(unsigned char *) &__tramp[16] = 0x49; \ + *(unsigned char *) &__tramp[17] = 0xba; \ + *(void**) &__tramp[18] = __fun; /* mov __fun, %r10 */ \ + *(unsigned char *) &__tramp[26] = 0x41; \ + *(unsigned char *) &__tramp[27] = 0xff; \ + *(unsigned char *) &__tramp[28] = 0xe2; /* jmp %r10 */ \ + } + +/* How to make a trampoline. Derived from gcc/config/i386/i386.c. */ + +#define FFI_INIT_TRAMPOLINE(TRAMP,FUN,CTX) \ +{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ + unsigned int __fun = (unsigned int)(FUN); \ + unsigned int __ctx = (unsigned int)(CTX); \ + unsigned int __dis = __fun - (__ctx + 10); \ + *(unsigned char*) &__tramp[0] = 0xb8; \ + *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ + *(unsigned char *) &__tramp[5] = 0xe9; \ + *(unsigned int*) &__tramp[6] = __dis; /* jmp __fun */ \ + } + +#define FFI_INIT_TRAMPOLINE_STDCALL(TRAMP,FUN,CTX,SIZE) \ +{ unsigned char *__tramp = (unsigned char*)(TRAMP); \ + unsigned int __fun = (unsigned int)(FUN); \ + unsigned int __ctx = (unsigned int)(CTX); \ + unsigned int __dis = __fun - (__ctx + 10); \ + unsigned short __size = (unsigned short)(SIZE); \ + *(unsigned char*) &__tramp[0] = 0xb8; \ + *(unsigned int*) &__tramp[1] = __ctx; /* movl __ctx, %eax */ \ + *(unsigned char *) &__tramp[5] = 0xe8; \ + *(unsigned int*) &__tramp[6] = __dis; /* call __fun */ \ + *(unsigned char *) &__tramp[10] = 0xc2; \ + *(unsigned short*) &__tramp[11] = __size; /* ret __size */ \ + } + +/* the cif must already be prep'ed */ + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,void**,void*), + void *user_data, + void *codeloc) +{ +#ifdef X86_WIN64 +#define ISFLOAT(IDX) (cif->arg_types[IDX]->type == FFI_TYPE_FLOAT || cif->arg_types[IDX]->type == FFI_TYPE_DOUBLE) +#define FLAG(IDX) (cif->nargs>(IDX)&&ISFLOAT(IDX)?(1<<(IDX)):0) + if (cif->abi == FFI_WIN64) + { + int mask = FLAG(0)|FLAG(1)|FLAG(2)|FLAG(3); + FFI_INIT_TRAMPOLINE_WIN64 (&closure->tramp[0], + &ffi_closure_win64, + codeloc, mask); + /* make sure we can execute here */ + } +#else + if (cif->abi == FFI_SYSV) + { + FFI_INIT_TRAMPOLINE (&closure->tramp[0], + &ffi_closure_SYSV, + (void*)codeloc); + } +#ifdef X86_WIN32 + else if (cif->abi == FFI_STDCALL) + { + FFI_INIT_TRAMPOLINE_STDCALL (&closure->tramp[0], + &ffi_closure_STDCALL, + (void*)codeloc, cif->bytes); + } +#endif /* X86_WIN32 */ +#endif /* !X86_WIN64 */ + else + { + return FFI_BAD_ABI; + } + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + +/* ------- Native raw API support -------------------------------- */ + +#if !FFI_NO_RAW_API + +ffi_status +ffi_prep_raw_closure_loc (ffi_raw_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*,void*,ffi_raw*,void*), + void *user_data, + void *codeloc) +{ + int i; + + if (cif->abi != FFI_SYSV) { + return FFI_BAD_ABI; + } + + /* we currently don't support certain kinds of arguments for raw + closures. This should be implemented by a separate assembly + language routine, since it would require argument processing, + something we don't do now for performance. */ + + for (i = cif->nargs-1; i >= 0; i--) + { + FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_STRUCT); + FFI_ASSERT (cif->arg_types[i]->type != FFI_TYPE_LONGDOUBLE); + } + + + FFI_INIT_TRAMPOLINE (&closure->tramp[0], &ffi_closure_raw_SYSV, + codeloc); + + closure->cif = cif; + closure->user_data = user_data; + closure->fun = fun; + + return FFI_OK; +} + +static void +ffi_prep_args_raw(char *stack, extended_cif *ecif) +{ + memcpy (stack, ecif->avalue, ecif->cif->bytes); +} + +/* we borrow this routine from libffi (it must be changed, though, to + * actually call the function passed in the first argument. as of + * libffi-1.20, this is not the case.) + */ + +void +ffi_raw_call(ffi_cif *cif, void (*fn)(void), void *rvalue, ffi_raw *fake_avalue) +{ + extended_cif ecif; + void **avalue = (void **)fake_avalue; + + ecif.cif = cif; + ecif.avalue = avalue; + + /* If the return value is a struct and we don't have a return */ + /* value address then we need to make one */ + + if ((rvalue == NULL) && + (cif->rtype->type == FFI_TYPE_STRUCT)) + { + ecif.rvalue = alloca(cif->rtype->size); + } + else + ecif.rvalue = rvalue; + + + switch (cif->abi) + { +#ifdef X86_WIN32 + case FFI_SYSV: + case FFI_STDCALL: + ffi_call_win32(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags, + ecif.rvalue, fn); + break; +#else + case FFI_SYSV: + ffi_call_SYSV(ffi_prep_args_raw, &ecif, cif->bytes, cif->flags, + ecif.rvalue, fn); + break; +#endif + default: + FFI_ASSERT(0); + break; + } +} + +#endif + +#endif /* !__x86_64__ || X86_WIN64 */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/ffi64.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/ffi64.c new file mode 100644 index 000000000..c8eb455ba --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/ffi64.c @@ -0,0 +1,635 @@ +/* ----------------------------------------------------------------------- + ffi64.c - Copyright (c) 20011 Anthony Green + Copyright (c) 2008, 2010 Red Hat, Inc. + Copyright (c) 2002, 2007 Bo Thorsen + + x86-64 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#include +#include + +#include +#include + +#ifdef __x86_64__ + +#define MAX_GPR_REGS 6 +#define MAX_SSE_REGS 8 + +struct register_args +{ + /* Registers for argument passing. */ + UINT64 gpr[MAX_GPR_REGS]; + __int128_t sse[MAX_SSE_REGS]; +}; + +extern void ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, + void *raddr, void (*fnaddr)(void), unsigned ssecount); + +/* All reference to register classes here is identical to the code in + gcc/config/i386/i386.c. Do *not* change one without the other. */ + +/* Register class used for passing given 64bit part of the argument. + These represent classes as documented by the PS ABI, with the + exception of SSESF, SSEDF classes, that are basically SSE class, + just gcc will use SF or DFmode move instead of DImode to avoid + reformatting penalties. + + Similary we play games with INTEGERSI_CLASS to use cheaper SImode moves + whenever possible (upper half does contain padding). */ +enum x86_64_reg_class + { + X86_64_NO_CLASS, + X86_64_INTEGER_CLASS, + X86_64_INTEGERSI_CLASS, + X86_64_SSE_CLASS, + X86_64_SSESF_CLASS, + X86_64_SSEDF_CLASS, + X86_64_SSEUP_CLASS, + X86_64_X87_CLASS, + X86_64_X87UP_CLASS, + X86_64_COMPLEX_X87_CLASS, + X86_64_MEMORY_CLASS + }; + +#define MAX_CLASSES 4 + +#define SSE_CLASS_P(X) ((X) >= X86_64_SSE_CLASS && X <= X86_64_SSEUP_CLASS) + +/* x86-64 register passing implementation. See x86-64 ABI for details. Goal + of this code is to classify each 8bytes of incoming argument by the register + class and assign registers accordingly. */ + +/* Return the union class of CLASS1 and CLASS2. + See the x86-64 PS ABI for details. */ + +static enum x86_64_reg_class +merge_classes (enum x86_64_reg_class class1, enum x86_64_reg_class class2) +{ + /* Rule #1: If both classes are equal, this is the resulting class. */ + if (class1 == class2) + return class1; + + /* Rule #2: If one of the classes is NO_CLASS, the resulting class is + the other class. */ + if (class1 == X86_64_NO_CLASS) + return class2; + if (class2 == X86_64_NO_CLASS) + return class1; + + /* Rule #3: If one of the classes is MEMORY, the result is MEMORY. */ + if (class1 == X86_64_MEMORY_CLASS || class2 == X86_64_MEMORY_CLASS) + return X86_64_MEMORY_CLASS; + + /* Rule #4: If one of the classes is INTEGER, the result is INTEGER. */ + if ((class1 == X86_64_INTEGERSI_CLASS && class2 == X86_64_SSESF_CLASS) + || (class2 == X86_64_INTEGERSI_CLASS && class1 == X86_64_SSESF_CLASS)) + return X86_64_INTEGERSI_CLASS; + if (class1 == X86_64_INTEGER_CLASS || class1 == X86_64_INTEGERSI_CLASS + || class2 == X86_64_INTEGER_CLASS || class2 == X86_64_INTEGERSI_CLASS) + return X86_64_INTEGER_CLASS; + + /* Rule #5: If one of the classes is X87, X87UP, or COMPLEX_X87 class, + MEMORY is used. */ + if (class1 == X86_64_X87_CLASS + || class1 == X86_64_X87UP_CLASS + || class1 == X86_64_COMPLEX_X87_CLASS + || class2 == X86_64_X87_CLASS + || class2 == X86_64_X87UP_CLASS + || class2 == X86_64_COMPLEX_X87_CLASS) + return X86_64_MEMORY_CLASS; + + /* Rule #6: Otherwise class SSE is used. */ + return X86_64_SSE_CLASS; +} + +/* Classify the argument of type TYPE and mode MODE. + CLASSES will be filled by the register class used to pass each word + of the operand. The number of words is returned. In case the parameter + should be passed in memory, 0 is returned. As a special case for zero + sized containers, classes[0] will be NO_CLASS and 1 is returned. + + See the x86-64 PS ABI for details. +*/ +static int +classify_argument (ffi_type *type, enum x86_64_reg_class classes[], + size_t byte_offset) +{ + switch (type->type) + { + case FFI_TYPE_UINT8: + case FFI_TYPE_SINT8: + case FFI_TYPE_UINT16: + case FFI_TYPE_SINT16: + case FFI_TYPE_UINT32: + case FFI_TYPE_SINT32: + case FFI_TYPE_UINT64: + case FFI_TYPE_SINT64: + case FFI_TYPE_POINTER: + { + int size = byte_offset + type->size; + + if (size <= 4) + { + classes[0] = X86_64_INTEGERSI_CLASS; + return 1; + } + else if (size <= 8) + { + classes[0] = X86_64_INTEGER_CLASS; + return 1; + } + else if (size <= 12) + { + classes[0] = X86_64_INTEGER_CLASS; + classes[1] = X86_64_INTEGERSI_CLASS; + return 2; + } + else if (size <= 16) + { + classes[0] = classes[1] = X86_64_INTEGERSI_CLASS; + return 2; + } + else + FFI_ASSERT (0); + } + case FFI_TYPE_FLOAT: + if (!(byte_offset % 8)) + classes[0] = X86_64_SSESF_CLASS; + else + classes[0] = X86_64_SSE_CLASS; + return 1; + case FFI_TYPE_DOUBLE: + classes[0] = X86_64_SSEDF_CLASS; + return 1; + case FFI_TYPE_LONGDOUBLE: + classes[0] = X86_64_X87_CLASS; + classes[1] = X86_64_X87UP_CLASS; + return 2; + case FFI_TYPE_STRUCT: + { + const int UNITS_PER_WORD = 8; + int words = (type->size + UNITS_PER_WORD - 1) / UNITS_PER_WORD; + ffi_type **ptr; + int i; + enum x86_64_reg_class subclasses[MAX_CLASSES]; + + /* If the struct is larger than 32 bytes, pass it on the stack. */ + if (type->size > 32) + return 0; + + for (i = 0; i < words; i++) + classes[i] = X86_64_NO_CLASS; + + /* Zero sized arrays or structures are NO_CLASS. We return 0 to + signalize memory class, so handle it as special case. */ + if (!words) + { + classes[0] = X86_64_NO_CLASS; + return 1; + } + + /* Merge the fields of structure. */ + for (ptr = type->elements; *ptr != NULL; ptr++) + { + int num; + + byte_offset = ALIGN (byte_offset, (*ptr)->alignment); + + num = classify_argument (*ptr, subclasses, byte_offset % 8); + if (num == 0) + return 0; + for (i = 0; i < num; i++) + { + int pos = byte_offset / 8; + classes[i + pos] = + merge_classes (subclasses[i], classes[i + pos]); + } + + byte_offset += (*ptr)->size; + } + + if (words > 2) + { + /* When size > 16 bytes, if the first one isn't + X86_64_SSE_CLASS or any other ones aren't + X86_64_SSEUP_CLASS, everything should be passed in + memory. */ + if (classes[0] != X86_64_SSE_CLASS) + return 0; + + for (i = 1; i < words; i++) + if (classes[i] != X86_64_SSEUP_CLASS) + return 0; + } + + /* Final merger cleanup. */ + for (i = 0; i < words; i++) + { + /* If one class is MEMORY, everything should be passed in + memory. */ + if (classes[i] == X86_64_MEMORY_CLASS) + return 0; + + /* The X86_64_SSEUP_CLASS should be always preceded by + X86_64_SSE_CLASS or X86_64_SSEUP_CLASS. */ + if (classes[i] == X86_64_SSEUP_CLASS + && classes[i - 1] != X86_64_SSE_CLASS + && classes[i - 1] != X86_64_SSEUP_CLASS) + { + /* The first one should never be X86_64_SSEUP_CLASS. */ + FFI_ASSERT (i != 0); + classes[i] = X86_64_SSE_CLASS; + } + + /* If X86_64_X87UP_CLASS isn't preceded by X86_64_X87_CLASS, + everything should be passed in memory. */ + if (classes[i] == X86_64_X87UP_CLASS + && (classes[i - 1] != X86_64_X87_CLASS)) + { + /* The first one should never be X86_64_X87UP_CLASS. */ + FFI_ASSERT (i != 0); + return 0; + } + } + return words; + } + + default: + FFI_ASSERT(0); + } + return 0; /* Never reached. */ +} + +/* Examine the argument and return set number of register required in each + class. Return zero iff parameter should be passed in memory, otherwise + the number of registers. */ + +static int +examine_argument (ffi_type *type, enum x86_64_reg_class classes[MAX_CLASSES], + _Bool in_return, int *pngpr, int *pnsse) +{ + int i, n, ngpr, nsse; + + n = classify_argument (type, classes, 0); + if (n == 0) + return 0; + + ngpr = nsse = 0; + for (i = 0; i < n; ++i) + switch (classes[i]) + { + case X86_64_INTEGER_CLASS: + case X86_64_INTEGERSI_CLASS: + ngpr++; + break; + case X86_64_SSE_CLASS: + case X86_64_SSESF_CLASS: + case X86_64_SSEDF_CLASS: + nsse++; + break; + case X86_64_NO_CLASS: + case X86_64_SSEUP_CLASS: + break; + case X86_64_X87_CLASS: + case X86_64_X87UP_CLASS: + case X86_64_COMPLEX_X87_CLASS: + return in_return != 0; + default: + abort (); + } + + *pngpr = ngpr; + *pnsse = nsse; + + return n; +} + +/* Perform machine dependent cif processing. */ + +ffi_status +ffi_prep_cif_machdep (ffi_cif *cif) +{ + int gprcount, ssecount, i, avn, n, ngpr, nsse, flags; + enum x86_64_reg_class classes[MAX_CLASSES]; + size_t bytes; + + gprcount = ssecount = 0; + + flags = cif->rtype->type; + if (flags != FFI_TYPE_VOID) + { + n = examine_argument (cif->rtype, classes, 1, &ngpr, &nsse); + if (n == 0) + { + /* The return value is passed in memory. A pointer to that + memory is the first argument. Allocate a register for it. */ + gprcount++; + /* We don't have to do anything in asm for the return. */ + flags = FFI_TYPE_VOID; + } + else if (flags == FFI_TYPE_STRUCT) + { + /* Mark which registers the result appears in. */ + _Bool sse0 = SSE_CLASS_P (classes[0]); + _Bool sse1 = n == 2 && SSE_CLASS_P (classes[1]); + if (sse0 && !sse1) + flags |= 1 << 8; + else if (!sse0 && sse1) + flags |= 1 << 9; + else if (sse0 && sse1) + flags |= 1 << 10; + /* Mark the true size of the structure. */ + flags |= cif->rtype->size << 12; + } + } + + /* Go over all arguments and determine the way they should be passed. + If it's in a register and there is space for it, let that be so. If + not, add it's size to the stack byte count. */ + for (bytes = 0, i = 0, avn = cif->nargs; i < avn; i++) + { + if (examine_argument (cif->arg_types[i], classes, 0, &ngpr, &nsse) == 0 + || gprcount + ngpr > MAX_GPR_REGS + || ssecount + nsse > MAX_SSE_REGS) + { + long align = cif->arg_types[i]->alignment; + + if (align < 8) + align = 8; + + bytes = ALIGN (bytes, align); + bytes += cif->arg_types[i]->size; + } + else + { + gprcount += ngpr; + ssecount += nsse; + } + } + if (ssecount) + flags |= 1 << 11; + cif->flags = flags; + cif->bytes = ALIGN (bytes, 8); + + return FFI_OK; +} + +void +ffi_call (ffi_cif *cif, void (*fn)(void), void *rvalue, void **avalue) +{ + enum x86_64_reg_class classes[MAX_CLASSES]; + char *stack, *argp; + ffi_type **arg_types; + int gprcount, ssecount, ngpr, nsse, i, avn; + _Bool ret_in_memory; + struct register_args *reg_args; + + /* Can't call 32-bit mode from 64-bit mode. */ + FFI_ASSERT (cif->abi == FFI_UNIX64); + + /* If the return value is a struct and we don't have a return value + address then we need to make one. Note the setting of flags to + VOID above in ffi_prep_cif_machdep. */ + ret_in_memory = (cif->rtype->type == FFI_TYPE_STRUCT + && (cif->flags & 0xff) == FFI_TYPE_VOID); + if (rvalue == NULL && ret_in_memory) + rvalue = alloca (cif->rtype->size); + + /* Allocate the space for the arguments, plus 4 words of temp space. */ + stack = alloca (sizeof (struct register_args) + cif->bytes + 4*8); + reg_args = (struct register_args *) stack; + argp = stack + sizeof (struct register_args); + + gprcount = ssecount = 0; + + /* If the return value is passed in memory, add the pointer as the + first integer argument. */ + if (ret_in_memory) + reg_args->gpr[gprcount++] = (long) rvalue; + + avn = cif->nargs; + arg_types = cif->arg_types; + + for (i = 0; i < avn; ++i) + { + size_t size = arg_types[i]->size; + int n; + + n = examine_argument (arg_types[i], classes, 0, &ngpr, &nsse); + if (n == 0 + || gprcount + ngpr > MAX_GPR_REGS + || ssecount + nsse > MAX_SSE_REGS) + { + long align = arg_types[i]->alignment; + + /* Stack arguments are *always* at least 8 byte aligned. */ + if (align < 8) + align = 8; + + /* Pass this argument in memory. */ + argp = (void *) ALIGN (argp, align); + memcpy (argp, avalue[i], size); + argp += size; + } + else + { + /* The argument is passed entirely in registers. */ + char *a = (char *) avalue[i]; + int j; + + for (j = 0; j < n; j++, a += 8, size -= 8) + { + switch (classes[j]) + { + case X86_64_INTEGER_CLASS: + case X86_64_INTEGERSI_CLASS: + reg_args->gpr[gprcount] = 0; + memcpy (®_args->gpr[gprcount], a, size < 8 ? size : 8); + gprcount++; + break; + case X86_64_SSE_CLASS: + case X86_64_SSEDF_CLASS: + reg_args->sse[ssecount++] = *(UINT64 *) a; + break; + case X86_64_SSESF_CLASS: + reg_args->sse[ssecount++] = *(UINT32 *) a; + break; + default: + abort(); + } + } + } + } + + ffi_call_unix64 (stack, cif->bytes + sizeof (struct register_args), + cif->flags, rvalue, fn, ssecount); +} + + +extern void ffi_closure_unix64(void); + +ffi_status +ffi_prep_closure_loc (ffi_closure* closure, + ffi_cif* cif, + void (*fun)(ffi_cif*, void*, void**, void*), + void *user_data, + void *codeloc) +{ + volatile unsigned short *tramp; + + /* Sanity check on the cif ABI. */ + { + int abi = cif->abi; + if (UNLIKELY (! (abi > FFI_FIRST_ABI && abi < FFI_LAST_ABI))) + return FFI_BAD_ABI; + } + + tramp = (volatile unsigned short *) &closure->tramp[0]; + + tramp[0] = 0xbb49; /* mov , %r11 */ + *(void * volatile *) &tramp[1] = ffi_closure_unix64; + tramp[5] = 0xba49; /* mov , %r10 */ + *(void * volatile *) &tramp[6] = codeloc; + + /* Set the carry bit iff the function uses any sse registers. + This is clc or stc, together with the first byte of the jmp. */ + tramp[10] = cif->flags & (1 << 11) ? 0x49f9 : 0x49f8; + + tramp[11] = 0xe3ff; /* jmp *%r11 */ + + closure->cif = cif; + closure->fun = fun; + closure->user_data = user_data; + + return FFI_OK; +} + +int +ffi_closure_unix64_inner(ffi_closure *closure, void *rvalue, + struct register_args *reg_args, char *argp) +{ + ffi_cif *cif; + void **avalue; + ffi_type **arg_types; + long i, avn; + int gprcount, ssecount, ngpr, nsse; + int ret; + + cif = closure->cif; + avalue = alloca(cif->nargs * sizeof(void *)); + gprcount = ssecount = 0; + + ret = cif->rtype->type; + if (ret != FFI_TYPE_VOID) + { + enum x86_64_reg_class classes[MAX_CLASSES]; + int n = examine_argument (cif->rtype, classes, 1, &ngpr, &nsse); + if (n == 0) + { + /* The return value goes in memory. Arrange for the closure + return value to go directly back to the original caller. */ + rvalue = (void *) reg_args->gpr[gprcount++]; + /* We don't have to do anything in asm for the return. */ + ret = FFI_TYPE_VOID; + } + else if (ret == FFI_TYPE_STRUCT && n == 2) + { + /* Mark which register the second word of the structure goes in. */ + _Bool sse0 = SSE_CLASS_P (classes[0]); + _Bool sse1 = SSE_CLASS_P (classes[1]); + if (!sse0 && sse1) + ret |= 1 << 8; + else if (sse0 && !sse1) + ret |= 1 << 9; + } + } + + avn = cif->nargs; + arg_types = cif->arg_types; + + for (i = 0; i < avn; ++i) + { + enum x86_64_reg_class classes[MAX_CLASSES]; + int n; + + n = examine_argument (arg_types[i], classes, 0, &ngpr, &nsse); + if (n == 0 + || gprcount + ngpr > MAX_GPR_REGS + || ssecount + nsse > MAX_SSE_REGS) + { + long align = arg_types[i]->alignment; + + /* Stack arguments are *always* at least 8 byte aligned. */ + if (align < 8) + align = 8; + + /* Pass this argument in memory. */ + argp = (void *) ALIGN (argp, align); + avalue[i] = argp; + argp += arg_types[i]->size; + } + /* If the argument is in a single register, or two consecutive + integer registers, then we can use that address directly. */ + else if (n == 1 + || (n == 2 && !(SSE_CLASS_P (classes[0]) + || SSE_CLASS_P (classes[1])))) + { + /* The argument is in a single register. */ + if (SSE_CLASS_P (classes[0])) + { + avalue[i] = ®_args->sse[ssecount]; + ssecount += n; + } + else + { + avalue[i] = ®_args->gpr[gprcount]; + gprcount += n; + } + } + /* Otherwise, allocate space to make them consecutive. */ + else + { + char *a = alloca (16); + int j; + + avalue[i] = a; + for (j = 0; j < n; j++, a += 8) + { + if (SSE_CLASS_P (classes[j])) + memcpy (a, ®_args->sse[ssecount++], 8); + else + memcpy (a, ®_args->gpr[gprcount++], 8); + } + } + } + + /* Invoke the closure. */ + closure->fun (cif, rvalue, avalue, closure->user_data); + + /* Tell assembly how to perform return type promotions. */ + return ret; +} + +#endif /* __x86_64__ */ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/ffitarget.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/ffitarget.h new file mode 100644 index 000000000..542e6d470 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/ffitarget.h @@ -0,0 +1,121 @@ +/* -----------------------------------------------------------------*-C-*- + ffitarget.h - Copyright (c) 1996-2003, 2010 Red Hat, Inc. + Copyright (C) 2008 Free Software Foundation, Inc. + + Target configuration macros for x86 and x86-64. + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + + ----------------------------------------------------------------------- */ + +#ifndef LIBFFI_TARGET_H +#define LIBFFI_TARGET_H + +/* ---- System specific configurations ----------------------------------- */ + +/* For code common to all platforms on x86 and x86_64. */ +#define X86_ANY + +#if defined (X86_64) && defined (__i386__) +#undef X86_64 +#define X86 +#endif + +#ifdef X86_WIN64 +#define FFI_SIZEOF_ARG 8 +#define USE_BUILTIN_FFS 0 /* not yet implemented in mingw-64 */ +#endif + +/* ---- Generic type definitions ----------------------------------------- */ + +#ifndef LIBFFI_ASM +#ifdef X86_WIN64 +#ifdef _MSC_VER +typedef unsigned __int64 ffi_arg; +typedef __int64 ffi_sarg; +#else +typedef unsigned long long ffi_arg; +typedef long long ffi_sarg; +#endif +#else +typedef unsigned long ffi_arg; +typedef signed long ffi_sarg; +#endif + +typedef enum ffi_abi { + FFI_FIRST_ABI = 0, + + /* ---- Intel x86 Win32 ---------- */ +#ifdef X86_WIN32 + FFI_SYSV, + FFI_STDCALL, + FFI_LAST_ABI, + /* TODO: Add fastcall support for the sake of completeness */ + FFI_DEFAULT_ABI = FFI_SYSV + +#elif defined(X86_WIN64) + FFI_WIN64, + FFI_LAST_ABI, + FFI_DEFAULT_ABI = FFI_WIN64 + +#else + /* ---- Intel x86 and AMD x86-64 - */ + FFI_SYSV, + FFI_UNIX64, /* Unix variants all use the same ABI for x86-64 */ + FFI_LAST_ABI, +#if defined(__i386__) || defined(__i386) + FFI_DEFAULT_ABI = FFI_SYSV +#else + FFI_DEFAULT_ABI = FFI_UNIX64 +#endif +#endif +} ffi_abi; +#endif + +/* ---- Definitions for closures ----------------------------------------- */ + +#define FFI_CLOSURES 1 +#define FFI_TYPE_SMALL_STRUCT_1B (FFI_TYPE_LAST + 1) +#define FFI_TYPE_SMALL_STRUCT_2B (FFI_TYPE_LAST + 2) +#define FFI_TYPE_SMALL_STRUCT_4B (FFI_TYPE_LAST + 3) + +#if defined (X86_64) || (defined (__x86_64__) && defined (X86_DARWIN)) +#define FFI_TRAMPOLINE_SIZE 24 +#define FFI_NATIVE_RAW_API 0 +#else +#ifdef X86_WIN32 +#define FFI_TRAMPOLINE_SIZE 13 +#else +#ifdef X86_WIN64 +#define FFI_TRAMPOLINE_SIZE 29 +#define FFI_NATIVE_RAW_API 0 +#define FFI_NO_RAW_API 1 +#else +#define FFI_TRAMPOLINE_SIZE 10 +#endif +#endif +#ifndef X86_WIN64 +#define FFI_NATIVE_RAW_API 1 /* x86 has native raw api support */ +#endif +#endif + +#endif + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/freebsd.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/freebsd.S new file mode 100644 index 000000000..afde51316 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/freebsd.S @@ -0,0 +1,458 @@ +/* ----------------------------------------------------------------------- + freebsd.S - Copyright (c) 1996, 1998, 2001, 2002, 2003, 2005 Red Hat, Inc. + Copyright (c) 2008 Björn König + + X86 Foreign Function Interface for FreeBSD + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. +----------------------------------------------------------------------- */ + +#ifndef __x86_64__ + +#define LIBFFI_ASM +#include +#include + +.text + +.globl ffi_prep_args + + .align 4 +.globl ffi_call_SYSV + .type ffi_call_SYSV,@function + +ffi_call_SYSV: +.LFB1: + pushl %ebp +.LCFI0: + movl %esp,%ebp +.LCFI1: + /* Make room for all of the new args. */ + movl 16(%ebp),%ecx + subl %ecx,%esp + + movl %esp,%eax + + /* Place all of the ffi_prep_args in position */ + pushl 12(%ebp) + pushl %eax + call *8(%ebp) + + /* Return stack to previous state and call the function */ + addl $8,%esp + + call *28(%ebp) + + /* Load %ecx with the return type code */ + movl 20(%ebp),%ecx + + /* Protect %esi. We're going to pop it in the epilogue. */ + pushl %esi + + /* If the return value pointer is NULL, assume no return value. */ + cmpl $0,24(%ebp) + jne 0f + + /* Even if there is no space for the return value, we are + obliged to handle floating-point values. */ + cmpl $FFI_TYPE_FLOAT,%ecx + jne noretval + fstp %st(0) + + jmp epilogue + +0: + call 1f + +.Lstore_table: + .long noretval-.Lstore_table /* FFI_TYPE_VOID */ + .long retint-.Lstore_table /* FFI_TYPE_INT */ + .long retfloat-.Lstore_table /* FFI_TYPE_FLOAT */ + .long retdouble-.Lstore_table /* FFI_TYPE_DOUBLE */ + .long retlongdouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */ + .long retuint8-.Lstore_table /* FFI_TYPE_UINT8 */ + .long retsint8-.Lstore_table /* FFI_TYPE_SINT8 */ + .long retuint16-.Lstore_table /* FFI_TYPE_UINT16 */ + .long retsint16-.Lstore_table /* FFI_TYPE_SINT16 */ + .long retint-.Lstore_table /* FFI_TYPE_UINT32 */ + .long retint-.Lstore_table /* FFI_TYPE_SINT32 */ + .long retint64-.Lstore_table /* FFI_TYPE_UINT64 */ + .long retint64-.Lstore_table /* FFI_TYPE_SINT64 */ + .long retstruct-.Lstore_table /* FFI_TYPE_STRUCT */ + .long retint-.Lstore_table /* FFI_TYPE_POINTER */ + .long retstruct1b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_1B */ + .long retstruct2b-.Lstore_table /* FFI_TYPE_SMALL_STRUCT_2B */ + +1: + pop %esi + add (%esi, %ecx, 4), %esi + jmp *%esi + + /* Sign/zero extend as appropriate. */ +retsint8: + movsbl %al, %eax + jmp retint + +retsint16: + movswl %ax, %eax + jmp retint + +retuint8: + movzbl %al, %eax + jmp retint + +retuint16: + movzwl %ax, %eax + jmp retint + +retfloat: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + fstps (%ecx) + jmp epilogue + +retdouble: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + fstpl (%ecx) + jmp epilogue + +retlongdouble: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + fstpt (%ecx) + jmp epilogue + +retint64: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + movl %eax,0(%ecx) + movl %edx,4(%ecx) + jmp epilogue + +retstruct1b: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + movb %al,0(%ecx) + jmp epilogue + +retstruct2b: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + movw %ax,0(%ecx) + jmp epilogue + +retint: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + movl %eax,0(%ecx) + +retstruct: + /* Nothing to do! */ + +noretval: +epilogue: + popl %esi + movl %ebp,%esp + popl %ebp + ret +.LFE1: +.ffi_call_SYSV_end: + .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV + + .align 4 +FFI_HIDDEN (ffi_closure_SYSV) +.globl ffi_closure_SYSV + .type ffi_closure_SYSV, @function + +ffi_closure_SYSV: +.LFB2: + pushl %ebp +.LCFI2: + movl %esp, %ebp +.LCFI3: + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) /* resp */ + leal 8(%ebp), %edx + movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ + leal -12(%ebp), %edx + movl %edx, (%esp) /* &resp */ +#if defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE || !defined __PIC__ + call ffi_closure_SYSV_inner +#else + movl %ebx, 8(%esp) +.LCFI7: + call 1f +1: popl %ebx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx + call ffi_closure_SYSV_inner@PLT + movl 8(%esp), %ebx +#endif + movl -12(%ebp), %ecx + cmpl $FFI_TYPE_INT, %eax + je .Lcls_retint + + /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, + FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ + cmpl $FFI_TYPE_UINT64, %eax + jge 0f + cmpl $FFI_TYPE_UINT8, %eax + jge .Lcls_retint + +0: cmpl $FFI_TYPE_FLOAT, %eax + je .Lcls_retfloat + cmpl $FFI_TYPE_DOUBLE, %eax + je .Lcls_retdouble + cmpl $FFI_TYPE_LONGDOUBLE, %eax + je .Lcls_retldouble + cmpl $FFI_TYPE_SINT64, %eax + je .Lcls_retllong + cmpl $FFI_TYPE_SMALL_STRUCT_1B, %eax + je .Lcls_retstruct1b + cmpl $FFI_TYPE_SMALL_STRUCT_2B, %eax + je .Lcls_retstruct2b + cmpl $FFI_TYPE_STRUCT, %eax + je .Lcls_retstruct +.Lcls_epilogue: + movl %ebp, %esp + popl %ebp + ret +.Lcls_retint: + movl (%ecx), %eax + jmp .Lcls_epilogue +.Lcls_retfloat: + flds (%ecx) + jmp .Lcls_epilogue +.Lcls_retdouble: + fldl (%ecx) + jmp .Lcls_epilogue +.Lcls_retldouble: + fldt (%ecx) + jmp .Lcls_epilogue +.Lcls_retllong: + movl (%ecx), %eax + movl 4(%ecx), %edx + jmp .Lcls_epilogue +.Lcls_retstruct1b: + movsbl (%ecx), %eax + jmp .Lcls_epilogue +.Lcls_retstruct2b: + movswl (%ecx), %eax + jmp .Lcls_epilogue +.Lcls_retstruct: + movl %ebp, %esp + popl %ebp + ret $4 +.LFE2: + .size ffi_closure_SYSV, .-ffi_closure_SYSV + +#if !FFI_NO_RAW_API + +#define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3) +#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) +#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) +#define CIF_FLAGS_OFFSET 20 + + .align 4 +FFI_HIDDEN (ffi_closure_raw_SYSV) +.globl ffi_closure_raw_SYSV + .type ffi_closure_raw_SYSV, @function + +ffi_closure_raw_SYSV: +.LFB3: + pushl %ebp +.LCFI4: + movl %esp, %ebp +.LCFI5: + pushl %esi +.LCFI6: + subl $36, %esp + movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ + movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ + movl %edx, 12(%esp) /* user_data */ + leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ + movl %edx, 8(%esp) /* raw_args */ + leal -24(%ebp), %edx + movl %edx, 4(%esp) /* &res */ + movl %esi, (%esp) /* cif */ + call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */ + movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */ + cmpl $FFI_TYPE_INT, %eax + je .Lrcls_retint + + /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, + FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ + cmpl $FFI_TYPE_UINT64, %eax + jge 0f + cmpl $FFI_TYPE_UINT8, %eax + jge .Lrcls_retint +0: + cmpl $FFI_TYPE_FLOAT, %eax + je .Lrcls_retfloat + cmpl $FFI_TYPE_DOUBLE, %eax + je .Lrcls_retdouble + cmpl $FFI_TYPE_LONGDOUBLE, %eax + je .Lrcls_retldouble + cmpl $FFI_TYPE_SINT64, %eax + je .Lrcls_retllong +.Lrcls_epilogue: + addl $36, %esp + popl %esi + popl %ebp + ret +.Lrcls_retint: + movl -24(%ebp), %eax + jmp .Lrcls_epilogue +.Lrcls_retfloat: + flds -24(%ebp) + jmp .Lrcls_epilogue +.Lrcls_retdouble: + fldl -24(%ebp) + jmp .Lrcls_epilogue +.Lrcls_retldouble: + fldt -24(%ebp) + jmp .Lrcls_epilogue +.Lrcls_retllong: + movl -24(%ebp), %eax + movl -20(%ebp), %edx + jmp .Lrcls_epilogue +.LFE3: + .size ffi_closure_raw_SYSV, .-ffi_closure_raw_SYSV +#endif + + .section .eh_frame,EH_FRAME_FLAGS,@progbits +.Lframe1: + .long .LECIE1-.LSCIE1 /* Length of Common Information Entry */ +.LSCIE1: + .long 0x0 /* CIE Identifier Tag */ + .byte 0x1 /* CIE Version */ +#ifdef __PIC__ + .ascii "zR\0" /* CIE Augmentation */ +#else + .ascii "\0" /* CIE Augmentation */ +#endif + .byte 0x1 /* .uleb128 0x1; CIE Code Alignment Factor */ + .byte 0x7c /* .sleb128 -4; CIE Data Alignment Factor */ + .byte 0x8 /* CIE RA Column */ +#ifdef __PIC__ + .byte 0x1 /* .uleb128 0x1; Augmentation size */ + .byte 0x1b /* FDE Encoding (pcrel sdata4) */ +#endif + .byte 0xc /* DW_CFA_def_cfa */ + .byte 0x4 /* .uleb128 0x4 */ + .byte 0x4 /* .uleb128 0x4 */ + .byte 0x88 /* DW_CFA_offset, column 0x8 */ + .byte 0x1 /* .uleb128 0x1 */ + .align 4 +.LECIE1: +.LSFDE1: + .long .LEFDE1-.LASFDE1 /* FDE Length */ +.LASFDE1: + .long .LASFDE1-.Lframe1 /* FDE CIE offset */ +#ifdef __PIC__ + .long .LFB1-. /* FDE initial location */ +#else + .long .LFB1 /* FDE initial location */ +#endif + .long .LFE1-.LFB1 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI0-.LFB1 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 */ + .byte 0x2 /* .uleb128 0x2 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI1-.LCFI0 + .byte 0xd /* DW_CFA_def_cfa_register */ + .byte 0x5 /* .uleb128 0x5 */ + .align 4 +.LEFDE1: +.LSFDE2: + .long .LEFDE2-.LASFDE2 /* FDE Length */ +.LASFDE2: + .long .LASFDE2-.Lframe1 /* FDE CIE offset */ +#ifdef __PIC__ + .long .LFB2-. /* FDE initial location */ +#else + .long .LFB2 +#endif + .long .LFE2-.LFB2 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI2-.LFB2 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 */ + .byte 0x2 /* .uleb128 0x2 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI3-.LCFI2 + .byte 0xd /* DW_CFA_def_cfa_register */ + .byte 0x5 /* .uleb128 0x5 */ +#if !defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE && defined __PIC__ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI7-.LCFI3 + .byte 0x83 /* DW_CFA_offset, column 0x3 */ + .byte 0xa /* .uleb128 0xa */ +#endif + .align 4 +.LEFDE2: + +#if !FFI_NO_RAW_API + +.LSFDE3: + .long .LEFDE3-.LASFDE3 /* FDE Length */ +.LASFDE3: + .long .LASFDE3-.Lframe1 /* FDE CIE offset */ +#ifdef __PIC__ + .long .LFB3-. /* FDE initial location */ +#else + .long .LFB3 +#endif + .long .LFE3-.LFB3 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI4-.LFB3 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 */ + .byte 0x2 /* .uleb128 0x2 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI5-.LCFI4 + .byte 0xd /* DW_CFA_def_cfa_register */ + .byte 0x5 /* .uleb128 0x5 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI6-.LCFI5 + .byte 0x86 /* DW_CFA_offset, column 0x6 */ + .byte 0x3 /* .uleb128 0x3 */ + .align 4 +.LEFDE3: + +#endif + +#endif /* ifndef __x86_64__ */ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/sysv.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/sysv.S new file mode 100644 index 000000000..f108dd80d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/sysv.S @@ -0,0 +1,468 @@ +/* ----------------------------------------------------------------------- + sysv.S - Copyright (c) 1996, 1998, 2001-2003, 2005, 2008, 2010 Red Hat, Inc. + + X86 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#ifndef __x86_64__ + +#define LIBFFI_ASM +#include +#include + +.text + +.globl ffi_prep_args + + .align 4 +.globl ffi_call_SYSV + .type ffi_call_SYSV,@function + +ffi_call_SYSV: +.LFB1: + pushl %ebp +.LCFI0: + movl %esp,%ebp +.LCFI1: + /* Make room for all of the new args. */ + movl 16(%ebp),%ecx + subl %ecx,%esp + + /* Align the stack pointer to 16-bytes */ + andl $0xfffffff0, %esp + + movl %esp,%eax + + /* Place all of the ffi_prep_args in position */ + pushl 12(%ebp) + pushl %eax + call *8(%ebp) + + /* Return stack to previous state and call the function */ + addl $8,%esp + + call *28(%ebp) + + /* Load %ecx with the return type code */ + movl 20(%ebp),%ecx + + /* Protect %esi. We're going to pop it in the epilogue. */ + pushl %esi + + /* If the return value pointer is NULL, assume no return value. */ + cmpl $0,24(%ebp) + jne 0f + + /* Even if there is no space for the return value, we are + obliged to handle floating-point values. */ + cmpl $FFI_TYPE_FLOAT,%ecx + jne noretval + fstp %st(0) + + jmp epilogue + +0: + call 1f + +.Lstore_table: + .long noretval-.Lstore_table /* FFI_TYPE_VOID */ + .long retint-.Lstore_table /* FFI_TYPE_INT */ + .long retfloat-.Lstore_table /* FFI_TYPE_FLOAT */ + .long retdouble-.Lstore_table /* FFI_TYPE_DOUBLE */ + .long retlongdouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */ + .long retuint8-.Lstore_table /* FFI_TYPE_UINT8 */ + .long retsint8-.Lstore_table /* FFI_TYPE_SINT8 */ + .long retuint16-.Lstore_table /* FFI_TYPE_UINT16 */ + .long retsint16-.Lstore_table /* FFI_TYPE_SINT16 */ + .long retint-.Lstore_table /* FFI_TYPE_UINT32 */ + .long retint-.Lstore_table /* FFI_TYPE_SINT32 */ + .long retint64-.Lstore_table /* FFI_TYPE_UINT64 */ + .long retint64-.Lstore_table /* FFI_TYPE_SINT64 */ + .long retstruct-.Lstore_table /* FFI_TYPE_STRUCT */ + .long retint-.Lstore_table /* FFI_TYPE_POINTER */ + +1: + pop %esi + add (%esi, %ecx, 4), %esi + jmp *%esi + + /* Sign/zero extend as appropriate. */ +retsint8: + movsbl %al, %eax + jmp retint + +retsint16: + movswl %ax, %eax + jmp retint + +retuint8: + movzbl %al, %eax + jmp retint + +retuint16: + movzwl %ax, %eax + jmp retint + +retfloat: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + fstps (%ecx) + jmp epilogue + +retdouble: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + fstpl (%ecx) + jmp epilogue + +retlongdouble: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + fstpt (%ecx) + jmp epilogue + +retint64: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + movl %eax,0(%ecx) + movl %edx,4(%ecx) + jmp epilogue + +retint: + /* Load %ecx with the pointer to storage for the return value */ + movl 24(%ebp),%ecx + movl %eax,0(%ecx) + +retstruct: + /* Nothing to do! */ + +noretval: +epilogue: + popl %esi + movl %ebp,%esp + popl %ebp + ret +.LFE1: +.ffi_call_SYSV_end: + .size ffi_call_SYSV,.ffi_call_SYSV_end-ffi_call_SYSV + + .align 4 +FFI_HIDDEN (ffi_closure_SYSV) +.globl ffi_closure_SYSV + .type ffi_closure_SYSV, @function + +ffi_closure_SYSV: +.LFB2: + pushl %ebp +.LCFI2: + movl %esp, %ebp +.LCFI3: + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) /* resp */ + leal 8(%ebp), %edx + movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ + leal -12(%ebp), %edx + movl %edx, (%esp) /* &resp */ +#if defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE || !defined __PIC__ + call ffi_closure_SYSV_inner +#else + movl %ebx, 8(%esp) +.LCFI7: + call 1f +1: popl %ebx + addl $_GLOBAL_OFFSET_TABLE_+[.-1b], %ebx + call ffi_closure_SYSV_inner@PLT + movl 8(%esp), %ebx +#endif + movl -12(%ebp), %ecx + cmpl $FFI_TYPE_INT, %eax + je .Lcls_retint + + /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, + FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ + cmpl $FFI_TYPE_UINT64, %eax + jge 0f + cmpl $FFI_TYPE_UINT8, %eax + jge .Lcls_retint + +0: cmpl $FFI_TYPE_FLOAT, %eax + je .Lcls_retfloat + cmpl $FFI_TYPE_DOUBLE, %eax + je .Lcls_retdouble + cmpl $FFI_TYPE_LONGDOUBLE, %eax + je .Lcls_retldouble + cmpl $FFI_TYPE_SINT64, %eax + je .Lcls_retllong + cmpl $FFI_TYPE_STRUCT, %eax + je .Lcls_retstruct +.Lcls_epilogue: + movl %ebp, %esp + popl %ebp + ret +.Lcls_retint: + movl (%ecx), %eax + jmp .Lcls_epilogue +.Lcls_retfloat: + flds (%ecx) + jmp .Lcls_epilogue +.Lcls_retdouble: + fldl (%ecx) + jmp .Lcls_epilogue +.Lcls_retldouble: + fldt (%ecx) + jmp .Lcls_epilogue +.Lcls_retllong: + movl (%ecx), %eax + movl 4(%ecx), %edx + jmp .Lcls_epilogue +.Lcls_retstruct: + movl %ebp, %esp + popl %ebp + ret $4 +.LFE2: + .size ffi_closure_SYSV, .-ffi_closure_SYSV + +#if !FFI_NO_RAW_API + +/* Precalculate for e.g. the Solaris 10/x86 assembler. */ +#if FFI_TRAMPOLINE_SIZE == 10 +#define RAW_CLOSURE_CIF_OFFSET 12 +#define RAW_CLOSURE_FUN_OFFSET 16 +#define RAW_CLOSURE_USER_DATA_OFFSET 20 +#elif FFI_TRAMPOLINE_SIZE == 24 +#define RAW_CLOSURE_CIF_OFFSET 24 +#define RAW_CLOSURE_FUN_OFFSET 28 +#define RAW_CLOSURE_USER_DATA_OFFSET 32 +#else +#define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3) +#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) +#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) +#endif +#define CIF_FLAGS_OFFSET 20 + + .align 4 +FFI_HIDDEN (ffi_closure_raw_SYSV) +.globl ffi_closure_raw_SYSV + .type ffi_closure_raw_SYSV, @function + +ffi_closure_raw_SYSV: +.LFB3: + pushl %ebp +.LCFI4: + movl %esp, %ebp +.LCFI5: + pushl %esi +.LCFI6: + subl $36, %esp + movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ + movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ + movl %edx, 12(%esp) /* user_data */ + leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ + movl %edx, 8(%esp) /* raw_args */ + leal -24(%ebp), %edx + movl %edx, 4(%esp) /* &res */ + movl %esi, (%esp) /* cif */ + call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */ + movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */ + cmpl $FFI_TYPE_INT, %eax + je .Lrcls_retint + + /* Handle FFI_TYPE_UINT8, FFI_TYPE_SINT8, FFI_TYPE_UINT16, + FFI_TYPE_SINT16, FFI_TYPE_UINT32, FFI_TYPE_SINT32. */ + cmpl $FFI_TYPE_UINT64, %eax + jge 0f + cmpl $FFI_TYPE_UINT8, %eax + jge .Lrcls_retint +0: + cmpl $FFI_TYPE_FLOAT, %eax + je .Lrcls_retfloat + cmpl $FFI_TYPE_DOUBLE, %eax + je .Lrcls_retdouble + cmpl $FFI_TYPE_LONGDOUBLE, %eax + je .Lrcls_retldouble + cmpl $FFI_TYPE_SINT64, %eax + je .Lrcls_retllong +.Lrcls_epilogue: + addl $36, %esp + popl %esi + popl %ebp + ret +.Lrcls_retint: + movl -24(%ebp), %eax + jmp .Lrcls_epilogue +.Lrcls_retfloat: + flds -24(%ebp) + jmp .Lrcls_epilogue +.Lrcls_retdouble: + fldl -24(%ebp) + jmp .Lrcls_epilogue +.Lrcls_retldouble: + fldt -24(%ebp) + jmp .Lrcls_epilogue +.Lrcls_retllong: + movl -24(%ebp), %eax + movl -20(%ebp), %edx + jmp .Lrcls_epilogue +.LFE3: + .size ffi_closure_raw_SYSV, .-ffi_closure_raw_SYSV +#endif + +#if defined __PIC__ +# if defined __sun__ && defined __svr4__ +/* 32-bit Solaris 2/x86 uses datarel encoding for PIC. GNU ld before 2.22 + doesn't correctly sort .eh_frame_hdr with mixed encodings, so match this. */ +# define FDE_ENCODING 0x30 /* datarel */ +# define FDE_ENCODE(X) X@GOTOFF +# else +# define FDE_ENCODING 0x1b /* pcrel sdata4 */ +# if defined HAVE_AS_X86_PCREL +# define FDE_ENCODE(X) X-. +# else +# define FDE_ENCODE(X) X@rel +# endif +# endif +#else +# define FDE_ENCODING 0 /* absolute */ +# define FDE_ENCODE(X) X +#endif + + .section .eh_frame,EH_FRAME_FLAGS,@progbits +.Lframe1: + .long .LECIE1-.LSCIE1 /* Length of Common Information Entry */ +.LSCIE1: + .long 0x0 /* CIE Identifier Tag */ + .byte 0x1 /* CIE Version */ +#ifdef HAVE_AS_ASCII_PSEUDO_OP +#ifdef __PIC__ + .ascii "zR\0" /* CIE Augmentation */ +#else + .ascii "\0" /* CIE Augmentation */ +#endif +#elif defined HAVE_AS_STRING_PSEUDO_OP +#ifdef __PIC__ + .string "zR" /* CIE Augmentation */ +#else + .string "" /* CIE Augmentation */ +#endif +#else +#error missing .ascii/.string +#endif + .byte 0x1 /* .uleb128 0x1; CIE Code Alignment Factor */ + .byte 0x7c /* .sleb128 -4; CIE Data Alignment Factor */ + .byte 0x8 /* CIE RA Column */ +#ifdef __PIC__ + .byte 0x1 /* .uleb128 0x1; Augmentation size */ + .byte FDE_ENCODING +#endif + .byte 0xc /* DW_CFA_def_cfa */ + .byte 0x4 /* .uleb128 0x4 */ + .byte 0x4 /* .uleb128 0x4 */ + .byte 0x88 /* DW_CFA_offset, column 0x8 */ + .byte 0x1 /* .uleb128 0x1 */ + .align 4 +.LECIE1: +.LSFDE1: + .long .LEFDE1-.LASFDE1 /* FDE Length */ +.LASFDE1: + .long .LASFDE1-.Lframe1 /* FDE CIE offset */ + .long FDE_ENCODE(.LFB1) /* FDE initial location */ + .long .LFE1-.LFB1 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI0-.LFB1 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 */ + .byte 0x2 /* .uleb128 0x2 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI1-.LCFI0 + .byte 0xd /* DW_CFA_def_cfa_register */ + .byte 0x5 /* .uleb128 0x5 */ + .align 4 +.LEFDE1: +.LSFDE2: + .long .LEFDE2-.LASFDE2 /* FDE Length */ +.LASFDE2: + .long .LASFDE2-.Lframe1 /* FDE CIE offset */ + .long FDE_ENCODE(.LFB2) /* FDE initial location */ + .long .LFE2-.LFB2 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI2-.LFB2 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 */ + .byte 0x2 /* .uleb128 0x2 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI3-.LCFI2 + .byte 0xd /* DW_CFA_def_cfa_register */ + .byte 0x5 /* .uleb128 0x5 */ +#if !defined HAVE_HIDDEN_VISIBILITY_ATTRIBUTE && defined __PIC__ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI7-.LCFI3 + .byte 0x83 /* DW_CFA_offset, column 0x3 */ + .byte 0xa /* .uleb128 0xa */ +#endif + .align 4 +.LEFDE2: + +#if !FFI_NO_RAW_API + +.LSFDE3: + .long .LEFDE3-.LASFDE3 /* FDE Length */ +.LASFDE3: + .long .LASFDE3-.Lframe1 /* FDE CIE offset */ + .long FDE_ENCODE(.LFB3) /* FDE initial location */ + .long .LFE3-.LFB3 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI4-.LFB3 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 */ + .byte 0x2 /* .uleb128 0x2 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI5-.LCFI4 + .byte 0xd /* DW_CFA_def_cfa_register */ + .byte 0x5 /* .uleb128 0x5 */ + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI6-.LCFI5 + .byte 0x86 /* DW_CFA_offset, column 0x6 */ + .byte 0x3 /* .uleb128 0x3 */ + .align 4 +.LEFDE3: + +#endif + +#endif /* ifndef __x86_64__ */ + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/unix64.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/unix64.S new file mode 100644 index 000000000..7a6619a54 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/unix64.S @@ -0,0 +1,426 @@ +/* ----------------------------------------------------------------------- + unix64.S - Copyright (c) 2002 Bo Thorsen + Copyright (c) 2008 Red Hat, Inc + + x86-64 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- */ + +#ifdef __x86_64__ +#define LIBFFI_ASM +#include +#include + +.text + +/* ffi_call_unix64 (void *args, unsigned long bytes, unsigned flags, + void *raddr, void (*fnaddr)(void)); + + Bit o trickiness here -- ARGS+BYTES is the base of the stack frame + for this function. This has been allocated by ffi_call. We also + deallocate some of the stack that has been alloca'd. */ + + .align 2 + .globl ffi_call_unix64 + .type ffi_call_unix64,@function + +ffi_call_unix64: +.LUW0: + movq (%rsp), %r10 /* Load return address. */ + leaq (%rdi, %rsi), %rax /* Find local stack base. */ + movq %rdx, (%rax) /* Save flags. */ + movq %rcx, 8(%rax) /* Save raddr. */ + movq %rbp, 16(%rax) /* Save old frame pointer. */ + movq %r10, 24(%rax) /* Relocate return address. */ + movq %rax, %rbp /* Finalize local stack frame. */ +.LUW1: + movq %rdi, %r10 /* Save a copy of the register area. */ + movq %r8, %r11 /* Save a copy of the target fn. */ + movl %r9d, %eax /* Set number of SSE registers. */ + + /* Load up all argument registers. */ + movq (%r10), %rdi + movq 8(%r10), %rsi + movq 16(%r10), %rdx + movq 24(%r10), %rcx + movq 32(%r10), %r8 + movq 40(%r10), %r9 + testl %eax, %eax + jnz .Lload_sse +.Lret_from_load_sse: + + /* Deallocate the reg arg area. */ + leaq 176(%r10), %rsp + + /* Call the user function. */ + call *%r11 + + /* Deallocate stack arg area; local stack frame in redzone. */ + leaq 24(%rbp), %rsp + + movq 0(%rbp), %rcx /* Reload flags. */ + movq 8(%rbp), %rdi /* Reload raddr. */ + movq 16(%rbp), %rbp /* Reload old frame pointer. */ +.LUW2: + + /* The first byte of the flags contains the FFI_TYPE. */ + movzbl %cl, %r10d + leaq .Lstore_table(%rip), %r11 + movslq (%r11, %r10, 4), %r10 + addq %r11, %r10 + jmp *%r10 + +.Lstore_table: + .long .Lst_void-.Lstore_table /* FFI_TYPE_VOID */ + .long .Lst_sint32-.Lstore_table /* FFI_TYPE_INT */ + .long .Lst_float-.Lstore_table /* FFI_TYPE_FLOAT */ + .long .Lst_double-.Lstore_table /* FFI_TYPE_DOUBLE */ + .long .Lst_ldouble-.Lstore_table /* FFI_TYPE_LONGDOUBLE */ + .long .Lst_uint8-.Lstore_table /* FFI_TYPE_UINT8 */ + .long .Lst_sint8-.Lstore_table /* FFI_TYPE_SINT8 */ + .long .Lst_uint16-.Lstore_table /* FFI_TYPE_UINT16 */ + .long .Lst_sint16-.Lstore_table /* FFI_TYPE_SINT16 */ + .long .Lst_uint32-.Lstore_table /* FFI_TYPE_UINT32 */ + .long .Lst_sint32-.Lstore_table /* FFI_TYPE_SINT32 */ + .long .Lst_int64-.Lstore_table /* FFI_TYPE_UINT64 */ + .long .Lst_int64-.Lstore_table /* FFI_TYPE_SINT64 */ + .long .Lst_struct-.Lstore_table /* FFI_TYPE_STRUCT */ + .long .Lst_int64-.Lstore_table /* FFI_TYPE_POINTER */ + + .align 2 +.Lst_void: + ret + .align 2 + +.Lst_uint8: + movzbq %al, %rax + movq %rax, (%rdi) + ret + .align 2 +.Lst_sint8: + movsbq %al, %rax + movq %rax, (%rdi) + ret + .align 2 +.Lst_uint16: + movzwq %ax, %rax + movq %rax, (%rdi) + .align 2 +.Lst_sint16: + movswq %ax, %rax + movq %rax, (%rdi) + ret + .align 2 +.Lst_uint32: + movl %eax, %eax + movq %rax, (%rdi) + .align 2 +.Lst_sint32: + cltq + movq %rax, (%rdi) + ret + .align 2 +.Lst_int64: + movq %rax, (%rdi) + ret + + .align 2 +.Lst_float: + movss %xmm0, (%rdi) + ret + .align 2 +.Lst_double: + movsd %xmm0, (%rdi) + ret +.Lst_ldouble: + fstpt (%rdi) + ret + + .align 2 +.Lst_struct: + leaq -20(%rsp), %rsi /* Scratch area in redzone. */ + + /* We have to locate the values now, and since we don't want to + write too much data into the user's return value, we spill the + value to a 16 byte scratch area first. Bits 8, 9, and 10 + control where the values are located. Only one of the three + bits will be set; see ffi_prep_cif_machdep for the pattern. */ + movd %xmm0, %r10 + movd %xmm1, %r11 + testl $0x100, %ecx + cmovnz %rax, %rdx + cmovnz %r10, %rax + testl $0x200, %ecx + cmovnz %r10, %rdx + testl $0x400, %ecx + cmovnz %r10, %rax + cmovnz %r11, %rdx + movq %rax, (%rsi) + movq %rdx, 8(%rsi) + + /* Bits 12-31 contain the true size of the structure. Copy from + the scratch area to the true destination. */ + shrl $12, %ecx + rep movsb + ret + + /* Many times we can avoid loading any SSE registers at all. + It's not worth an indirect jump to load the exact set of + SSE registers needed; zero or all is a good compromise. */ + .align 2 +.LUW3: +.Lload_sse: + movdqa 48(%r10), %xmm0 + movdqa 64(%r10), %xmm1 + movdqa 80(%r10), %xmm2 + movdqa 96(%r10), %xmm3 + movdqa 112(%r10), %xmm4 + movdqa 128(%r10), %xmm5 + movdqa 144(%r10), %xmm6 + movdqa 160(%r10), %xmm7 + jmp .Lret_from_load_sse + +.LUW4: + .size ffi_call_unix64,.-ffi_call_unix64 + + .align 2 + .globl ffi_closure_unix64 + .type ffi_closure_unix64,@function + +ffi_closure_unix64: +.LUW5: + /* The carry flag is set by the trampoline iff SSE registers + are used. Don't clobber it before the branch instruction. */ + leaq -200(%rsp), %rsp +.LUW6: + movq %rdi, (%rsp) + movq %rsi, 8(%rsp) + movq %rdx, 16(%rsp) + movq %rcx, 24(%rsp) + movq %r8, 32(%rsp) + movq %r9, 40(%rsp) + jc .Lsave_sse +.Lret_from_save_sse: + + movq %r10, %rdi + leaq 176(%rsp), %rsi + movq %rsp, %rdx + leaq 208(%rsp), %rcx + call ffi_closure_unix64_inner@PLT + + /* Deallocate stack frame early; return value is now in redzone. */ + addq $200, %rsp +.LUW7: + + /* The first byte of the return value contains the FFI_TYPE. */ + movzbl %al, %r10d + leaq .Lload_table(%rip), %r11 + movslq (%r11, %r10, 4), %r10 + addq %r11, %r10 + jmp *%r10 + +.Lload_table: + .long .Lld_void-.Lload_table /* FFI_TYPE_VOID */ + .long .Lld_int32-.Lload_table /* FFI_TYPE_INT */ + .long .Lld_float-.Lload_table /* FFI_TYPE_FLOAT */ + .long .Lld_double-.Lload_table /* FFI_TYPE_DOUBLE */ + .long .Lld_ldouble-.Lload_table /* FFI_TYPE_LONGDOUBLE */ + .long .Lld_int8-.Lload_table /* FFI_TYPE_UINT8 */ + .long .Lld_int8-.Lload_table /* FFI_TYPE_SINT8 */ + .long .Lld_int16-.Lload_table /* FFI_TYPE_UINT16 */ + .long .Lld_int16-.Lload_table /* FFI_TYPE_SINT16 */ + .long .Lld_int32-.Lload_table /* FFI_TYPE_UINT32 */ + .long .Lld_int32-.Lload_table /* FFI_TYPE_SINT32 */ + .long .Lld_int64-.Lload_table /* FFI_TYPE_UINT64 */ + .long .Lld_int64-.Lload_table /* FFI_TYPE_SINT64 */ + .long .Lld_struct-.Lload_table /* FFI_TYPE_STRUCT */ + .long .Lld_int64-.Lload_table /* FFI_TYPE_POINTER */ + + .align 2 +.Lld_void: + ret + + .align 2 +.Lld_int8: + movzbl -24(%rsp), %eax + ret + .align 2 +.Lld_int16: + movzwl -24(%rsp), %eax + ret + .align 2 +.Lld_int32: + movl -24(%rsp), %eax + ret + .align 2 +.Lld_int64: + movq -24(%rsp), %rax + ret + + .align 2 +.Lld_float: + movss -24(%rsp), %xmm0 + ret + .align 2 +.Lld_double: + movsd -24(%rsp), %xmm0 + ret + .align 2 +.Lld_ldouble: + fldt -24(%rsp) + ret + + .align 2 +.Lld_struct: + /* There are four possibilities here, %rax/%rdx, %xmm0/%rax, + %rax/%xmm0, %xmm0/%xmm1. We collapse two by always loading + both rdx and xmm1 with the second word. For the remaining, + bit 8 set means xmm0 gets the second word, and bit 9 means + that rax gets the second word. */ + movq -24(%rsp), %rcx + movq -16(%rsp), %rdx + movq -16(%rsp), %xmm1 + testl $0x100, %eax + cmovnz %rdx, %rcx + movd %rcx, %xmm0 + testl $0x200, %eax + movq -24(%rsp), %rax + cmovnz %rdx, %rax + ret + + /* See the comment above .Lload_sse; the same logic applies here. */ + .align 2 +.LUW8: +.Lsave_sse: + movdqa %xmm0, 48(%rsp) + movdqa %xmm1, 64(%rsp) + movdqa %xmm2, 80(%rsp) + movdqa %xmm3, 96(%rsp) + movdqa %xmm4, 112(%rsp) + movdqa %xmm5, 128(%rsp) + movdqa %xmm6, 144(%rsp) + movdqa %xmm7, 160(%rsp) + jmp .Lret_from_save_sse + +.LUW9: + .size ffi_closure_unix64,.-ffi_closure_unix64 + +#ifdef HAVE_AS_X86_64_UNWIND_SECTION_TYPE + .section .eh_frame,"a",@unwind +#else + .section .eh_frame,"a",@progbits +#endif +.Lframe1: + .long .LECIE1-.LSCIE1 /* CIE Length */ +.LSCIE1: + .long 0 /* CIE Identifier Tag */ + .byte 1 /* CIE Version */ + .ascii "zR\0" /* CIE Augmentation */ + .uleb128 1 /* CIE Code Alignment Factor */ + .sleb128 -8 /* CIE Data Alignment Factor */ + .byte 0x10 /* CIE RA Column */ + .uleb128 1 /* Augmentation size */ + .byte 0x1b /* FDE Encoding (pcrel sdata4) */ + .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ + .uleb128 7 + .uleb128 8 + .byte 0x80+16 /* DW_CFA_offset, %rip offset 1*-8 */ + .uleb128 1 + .align 8 +.LECIE1: +.LSFDE1: + .long .LEFDE1-.LASFDE1 /* FDE Length */ +.LASFDE1: + .long .LASFDE1-.Lframe1 /* FDE CIE offset */ +#if HAVE_AS_X86_PCREL + .long .LUW0-. /* FDE initial location */ +#else + .long .LUW0@rel +#endif + .long .LUW4-.LUW0 /* FDE address range */ + .uleb128 0x0 /* Augmentation size */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LUW1-.LUW0 + + /* New stack frame based off rbp. This is a itty bit of unwind + trickery in that the CFA *has* changed. There is no easy way + to describe it correctly on entry to the function. Fortunately, + it doesn't matter too much since at all points we can correctly + unwind back to ffi_call. Note that the location to which we + moved the return address is (the new) CFA-8, so from the + perspective of the unwind info, it hasn't moved. */ + .byte 0xc /* DW_CFA_def_cfa, %rbp offset 32 */ + .uleb128 6 + .uleb128 32 + .byte 0x80+6 /* DW_CFA_offset, %rbp offset 2*-8 */ + .uleb128 2 + .byte 0xa /* DW_CFA_remember_state */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LUW2-.LUW1 + .byte 0xc /* DW_CFA_def_cfa, %rsp offset 8 */ + .uleb128 7 + .uleb128 8 + .byte 0xc0+6 /* DW_CFA_restore, %rbp */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LUW3-.LUW2 + .byte 0xb /* DW_CFA_restore_state */ + + .align 8 +.LEFDE1: +.LSFDE3: + .long .LEFDE3-.LASFDE3 /* FDE Length */ +.LASFDE3: + .long .LASFDE3-.Lframe1 /* FDE CIE offset */ +#if HAVE_AS_X86_PCREL + .long .LUW5-. /* FDE initial location */ +#else + .long .LUW5@rel +#endif + .long .LUW9-.LUW5 /* FDE address range */ + .uleb128 0x0 /* Augmentation size */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LUW6-.LUW5 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .uleb128 208 + .byte 0xa /* DW_CFA_remember_state */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LUW7-.LUW6 + .byte 0xe /* DW_CFA_def_cfa_offset */ + .uleb128 8 + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LUW8-.LUW7 + .byte 0xb /* DW_CFA_restore_state */ + + .align 8 +.LEFDE3: + +#endif /* __x86_64__ */ + +#if defined __ELF__ && defined __linux__ + .section .note.GNU-stack,"",@progbits +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/win32.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/win32.S new file mode 100644 index 000000000..06c893fba --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/win32.S @@ -0,0 +1,1065 @@ +/* ----------------------------------------------------------------------- + win32.S - Copyright (c) 1996, 1998, 2001, 2002, 2009 Red Hat, Inc. + Copyright (c) 2001 John Beniton + Copyright (c) 2002 Ranjit Mathew + Copyright (c) 2009 Daniel Witte + + + X86 Foreign Function Interface + + Permission is hereby granted, free of charge, to any person obtaining + a copy of this software and associated documentation files (the + ``Software''), to deal in the Software without restriction, including + without limitation the rights to use, copy, modify, merge, publish, + distribute, sublicense, and/or sell copies of the Software, and to + permit persons to whom the Software is furnished to do so, subject to + the following conditions: + + The above copyright notice and this permission notice shall be included + in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED ``AS IS'', WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + DEALINGS IN THE SOFTWARE. + ----------------------------------------------------------------------- + */ + +#define LIBFFI_ASM +#include +#include + +#ifdef _MSC_VER + +.386 +.MODEL FLAT, C + +EXTRN ffi_closure_SYSV_inner:NEAR + +_TEXT SEGMENT + +ffi_call_win32 PROC NEAR, + ffi_prep_args : NEAR PTR DWORD, + ecif : NEAR PTR DWORD, + cif_bytes : DWORD, + cif_flags : DWORD, + rvalue : NEAR PTR DWORD, + fn : NEAR PTR DWORD + + ;; Make room for all of the new args. + mov ecx, cif_bytes + sub esp, ecx + + mov eax, esp + + ;; Place all of the ffi_prep_args in position + push ecif + push eax + call ffi_prep_args + + ;; Return stack to previous state and call the function + add esp, 8 + + call fn + + ;; cdecl: we restore esp in the epilogue, so there's no need to + ;; remove the space we pushed for the args. + ;; stdcall: the callee has already cleaned the stack. + + ;; Load ecx with the return type code + mov ecx, cif_flags + + ;; If the return value pointer is NULL, assume no return value. + cmp rvalue, 0 + jne ca_jumptable + + ;; Even if there is no space for the return value, we are + ;; obliged to handle floating-point values. + cmp ecx, FFI_TYPE_FLOAT + jne ca_epilogue + fstp st(0) + + jmp ca_epilogue + +ca_jumptable: + jmp [ca_jumpdata + 4 * ecx] +ca_jumpdata: + ;; Do not insert anything here between label and jump table. + dd offset ca_epilogue ;; FFI_TYPE_VOID + dd offset ca_retint ;; FFI_TYPE_INT + dd offset ca_retfloat ;; FFI_TYPE_FLOAT + dd offset ca_retdouble ;; FFI_TYPE_DOUBLE + dd offset ca_retlongdouble ;; FFI_TYPE_LONGDOUBLE + dd offset ca_retint8 ;; FFI_TYPE_UINT8 + dd offset ca_retint8 ;; FFI_TYPE_SINT8 + dd offset ca_retint16 ;; FFI_TYPE_UINT16 + dd offset ca_retint16 ;; FFI_TYPE_SINT16 + dd offset ca_retint ;; FFI_TYPE_UINT32 + dd offset ca_retint ;; FFI_TYPE_SINT32 + dd offset ca_retint64 ;; FFI_TYPE_UINT64 + dd offset ca_retint64 ;; FFI_TYPE_SINT64 + dd offset ca_epilogue ;; FFI_TYPE_STRUCT + dd offset ca_retint ;; FFI_TYPE_POINTER + dd offset ca_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B + dd offset ca_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B + dd offset ca_retint ;; FFI_TYPE_SMALL_STRUCT_4B + +ca_retint8: + ;; Load %ecx with the pointer to storage for the return value + mov ecx, rvalue + mov [ecx + 0], al + jmp ca_epilogue + +ca_retint16: + ;; Load %ecx with the pointer to storage for the return value + mov ecx, rvalue + mov [ecx + 0], ax + jmp ca_epilogue + +ca_retint: + ;; Load %ecx with the pointer to storage for the return value + mov ecx, rvalue + mov [ecx + 0], eax + jmp ca_epilogue + +ca_retint64: + ;; Load %ecx with the pointer to storage for the return value + mov ecx, rvalue + mov [ecx + 0], eax + mov [ecx + 4], edx + jmp ca_epilogue + +ca_retfloat: + ;; Load %ecx with the pointer to storage for the return value + mov ecx, rvalue + fstp DWORD PTR [ecx] + jmp ca_epilogue + +ca_retdouble: + ;; Load %ecx with the pointer to storage for the return value + mov ecx, rvalue + fstp QWORD PTR [ecx] + jmp ca_epilogue + +ca_retlongdouble: + ;; Load %ecx with the pointer to storage for the return value + mov ecx, rvalue + fstp TBYTE PTR [ecx] + jmp ca_epilogue + +ca_epilogue: + ;; Epilogue code is autogenerated. + ret +ffi_call_win32 ENDP + +ffi_closure_SYSV PROC NEAR + ;; the ffi_closure ctx is passed in eax by the trampoline. + + sub esp, 40 + lea edx, [ebp - 24] + mov [ebp - 12], edx ;; resp + lea edx, [ebp + 8] + mov [esp + 8], edx ;; args + lea edx, [ebp - 12] + mov [esp + 4], edx ;; &resp + mov [esp], eax ;; closure + call ffi_closure_SYSV_inner + mov ecx, [ebp - 12] + +cs_jumptable: + jmp [cs_jumpdata + 4 * eax] +cs_jumpdata: + ;; Do not insert anything here between the label and jump table. + dd offset cs_epilogue ;; FFI_TYPE_VOID + dd offset cs_retint ;; FFI_TYPE_INT + dd offset cs_retfloat ;; FFI_TYPE_FLOAT + dd offset cs_retdouble ;; FFI_TYPE_DOUBLE + dd offset cs_retlongdouble ;; FFI_TYPE_LONGDOUBLE + dd offset cs_retint8 ;; FFI_TYPE_UINT8 + dd offset cs_retint8 ;; FFI_TYPE_SINT8 + dd offset cs_retint16 ;; FFI_TYPE_UINT16 + dd offset cs_retint16 ;; FFI_TYPE_SINT16 + dd offset cs_retint ;; FFI_TYPE_UINT32 + dd offset cs_retint ;; FFI_TYPE_SINT32 + dd offset cs_retint64 ;; FFI_TYPE_UINT64 + dd offset cs_retint64 ;; FFI_TYPE_SINT64 + dd offset cs_retstruct ;; FFI_TYPE_STRUCT + dd offset cs_retint ;; FFI_TYPE_POINTER + dd offset cs_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B + dd offset cs_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B + dd offset cs_retint ;; FFI_TYPE_SMALL_STRUCT_4B + +cs_retint8: + mov al, [ecx] + jmp cs_epilogue + +cs_retint16: + mov ax, [ecx] + jmp cs_epilogue + +cs_retint: + mov eax, [ecx] + jmp cs_epilogue + +cs_retint64: + mov eax, [ecx + 0] + mov edx, [ecx + 4] + jmp cs_epilogue + +cs_retfloat: + fld DWORD PTR [ecx] + jmp cs_epilogue + +cs_retdouble: + fld QWORD PTR [ecx] + jmp cs_epilogue + +cs_retlongdouble: + fld TBYTE PTR [ecx] + jmp cs_epilogue + +cs_retstruct: + ;; Caller expects us to pop struct return value pointer hidden arg. + ;; Epilogue code is autogenerated. + ret 4 + +cs_epilogue: + ;; Epilogue code is autogenerated. + ret +ffi_closure_SYSV ENDP + +#if !FFI_NO_RAW_API + +#define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) AND NOT 3) +#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) +#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) +#define CIF_FLAGS_OFFSET 20 + +ffi_closure_raw_SYSV PROC NEAR USES esi + ;; the ffi_closure ctx is passed in eax by the trampoline. + + sub esp, 40 + mov esi, [eax + RAW_CLOSURE_CIF_OFFSET] ;; closure->cif + mov edx, [eax + RAW_CLOSURE_USER_DATA_OFFSET] ;; closure->user_data + mov [esp + 12], edx ;; user_data + lea edx, [ebp + 8] + mov [esp + 8], edx ;; raw_args + lea edx, [ebp - 24] + mov [esp + 4], edx ;; &res + mov [esp], esi ;; cif + call DWORD PTR [eax + RAW_CLOSURE_FUN_OFFSET] ;; closure->fun + mov eax, [esi + CIF_FLAGS_OFFSET] ;; cif->flags + lea ecx, [ebp - 24] + +cr_jumptable: + jmp [cr_jumpdata + 4 * eax] +cr_jumpdata: + ;; Do not insert anything here between the label and jump table. + dd offset cr_epilogue ;; FFI_TYPE_VOID + dd offset cr_retint ;; FFI_TYPE_INT + dd offset cr_retfloat ;; FFI_TYPE_FLOAT + dd offset cr_retdouble ;; FFI_TYPE_DOUBLE + dd offset cr_retlongdouble ;; FFI_TYPE_LONGDOUBLE + dd offset cr_retint8 ;; FFI_TYPE_UINT8 + dd offset cr_retint8 ;; FFI_TYPE_SINT8 + dd offset cr_retint16 ;; FFI_TYPE_UINT16 + dd offset cr_retint16 ;; FFI_TYPE_SINT16 + dd offset cr_retint ;; FFI_TYPE_UINT32 + dd offset cr_retint ;; FFI_TYPE_SINT32 + dd offset cr_retint64 ;; FFI_TYPE_UINT64 + dd offset cr_retint64 ;; FFI_TYPE_SINT64 + dd offset cr_epilogue ;; FFI_TYPE_STRUCT + dd offset cr_retint ;; FFI_TYPE_POINTER + dd offset cr_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B + dd offset cr_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B + dd offset cr_retint ;; FFI_TYPE_SMALL_STRUCT_4B + +cr_retint8: + mov al, [ecx] + jmp cr_epilogue + +cr_retint16: + mov ax, [ecx] + jmp cr_epilogue + +cr_retint: + mov eax, [ecx] + jmp cr_epilogue + +cr_retint64: + mov eax, [ecx + 0] + mov edx, [ecx + 4] + jmp cr_epilogue + +cr_retfloat: + fld DWORD PTR [ecx] + jmp cr_epilogue + +cr_retdouble: + fld QWORD PTR [ecx] + jmp cr_epilogue + +cr_retlongdouble: + fld TBYTE PTR [ecx] + jmp cr_epilogue + +cr_epilogue: + ;; Epilogue code is autogenerated. + ret +ffi_closure_raw_SYSV ENDP + +#endif /* !FFI_NO_RAW_API */ + +ffi_closure_STDCALL PROC NEAR + ;; the ffi_closure ctx is passed in eax by the trampoline. + + sub esp, 40 + lea edx, [ebp - 24] + mov [ebp - 12], edx ;; resp + lea edx, [ebp + 12] ;; account for stub return address on stack + mov [esp + 8], edx ;; args + lea edx, [ebp - 12] + mov [esp + 4], edx ;; &resp + mov [esp], eax ;; closure + call ffi_closure_SYSV_inner + mov ecx, [ebp - 12] + +cd_jumptable: + jmp [cd_jumpdata + 4 * eax] +cd_jumpdata: + ;; Do not insert anything here between the label and jump table. + dd offset cd_epilogue ;; FFI_TYPE_VOID + dd offset cd_retint ;; FFI_TYPE_INT + dd offset cd_retfloat ;; FFI_TYPE_FLOAT + dd offset cd_retdouble ;; FFI_TYPE_DOUBLE + dd offset cd_retlongdouble ;; FFI_TYPE_LONGDOUBLE + dd offset cd_retint8 ;; FFI_TYPE_UINT8 + dd offset cd_retint8 ;; FFI_TYPE_SINT8 + dd offset cd_retint16 ;; FFI_TYPE_UINT16 + dd offset cd_retint16 ;; FFI_TYPE_SINT16 + dd offset cd_retint ;; FFI_TYPE_UINT32 + dd offset cd_retint ;; FFI_TYPE_SINT32 + dd offset cd_retint64 ;; FFI_TYPE_UINT64 + dd offset cd_retint64 ;; FFI_TYPE_SINT64 + dd offset cd_epilogue ;; FFI_TYPE_STRUCT + dd offset cd_retint ;; FFI_TYPE_POINTER + dd offset cd_retint8 ;; FFI_TYPE_SMALL_STRUCT_1B + dd offset cd_retint16 ;; FFI_TYPE_SMALL_STRUCT_2B + dd offset cd_retint ;; FFI_TYPE_SMALL_STRUCT_4B + +cd_retint8: + mov al, [ecx] + jmp cd_epilogue + +cd_retint16: + mov ax, [ecx] + jmp cd_epilogue + +cd_retint: + mov eax, [ecx] + jmp cd_epilogue + +cd_retint64: + mov eax, [ecx + 0] + mov edx, [ecx + 4] + jmp cd_epilogue + +cd_retfloat: + fld DWORD PTR [ecx] + jmp cd_epilogue + +cd_retdouble: + fld QWORD PTR [ecx] + jmp cd_epilogue + +cd_retlongdouble: + fld TBYTE PTR [ecx] + jmp cd_epilogue + +cd_epilogue: + ;; Epilogue code is autogenerated. + ret +ffi_closure_STDCALL ENDP + +_TEXT ENDS +END + +#else + + .text + + # This assumes we are using gas. + .balign 16 + .globl _ffi_call_win32 +#ifndef __OS2__ + .def _ffi_call_win32; .scl 2; .type 32; .endef +#endif +_ffi_call_win32: +.LFB1: + pushl %ebp +.LCFI0: + movl %esp,%ebp +.LCFI1: + # Make room for all of the new args. + movl 16(%ebp),%ecx + subl %ecx,%esp + + movl %esp,%eax + + # Place all of the ffi_prep_args in position + pushl 12(%ebp) + pushl %eax + call *8(%ebp) + + # Return stack to previous state and call the function + addl $8,%esp + + # FIXME: Align the stack to a 128-bit boundary to avoid + # potential performance hits. + + call *28(%ebp) + + # stdcall functions pop arguments off the stack themselves + + # Load %ecx with the return type code + movl 20(%ebp),%ecx + + # If the return value pointer is NULL, assume no return value. + cmpl $0,24(%ebp) + jne 0f + + # Even if there is no space for the return value, we are + # obliged to handle floating-point values. + cmpl $FFI_TYPE_FLOAT,%ecx + jne .Lnoretval + fstp %st(0) + + jmp .Lepilogue + +0: + call 1f + # Do not insert anything here between the call and the jump table. +.Lstore_table: + .long .Lnoretval /* FFI_TYPE_VOID */ + .long .Lretint /* FFI_TYPE_INT */ + .long .Lretfloat /* FFI_TYPE_FLOAT */ + .long .Lretdouble /* FFI_TYPE_DOUBLE */ + .long .Lretlongdouble /* FFI_TYPE_LONGDOUBLE */ + .long .Lretuint8 /* FFI_TYPE_UINT8 */ + .long .Lretsint8 /* FFI_TYPE_SINT8 */ + .long .Lretuint16 /* FFI_TYPE_UINT16 */ + .long .Lretsint16 /* FFI_TYPE_SINT16 */ + .long .Lretint /* FFI_TYPE_UINT32 */ + .long .Lretint /* FFI_TYPE_SINT32 */ + .long .Lretint64 /* FFI_TYPE_UINT64 */ + .long .Lretint64 /* FFI_TYPE_SINT64 */ + .long .Lretstruct /* FFI_TYPE_STRUCT */ + .long .Lretint /* FFI_TYPE_POINTER */ + .long .Lretstruct1b /* FFI_TYPE_SMALL_STRUCT_1B */ + .long .Lretstruct2b /* FFI_TYPE_SMALL_STRUCT_2B */ + .long .Lretstruct4b /* FFI_TYPE_SMALL_STRUCT_4B */ +1: + add %ecx, %ecx + add %ecx, %ecx + add (%esp),%ecx + add $4, %esp + jmp *(%ecx) + + /* Sign/zero extend as appropriate. */ +.Lretsint8: + movsbl %al, %eax + jmp .Lretint + +.Lretsint16: + movswl %ax, %eax + jmp .Lretint + +.Lretuint8: + movzbl %al, %eax + jmp .Lretint + +.Lretuint16: + movzwl %ax, %eax + jmp .Lretint + +.Lretint: + # Load %ecx with the pointer to storage for the return value + movl 24(%ebp),%ecx + movl %eax,0(%ecx) + jmp .Lepilogue + +.Lretfloat: + # Load %ecx with the pointer to storage for the return value + movl 24(%ebp),%ecx + fstps (%ecx) + jmp .Lepilogue + +.Lretdouble: + # Load %ecx with the pointer to storage for the return value + movl 24(%ebp),%ecx + fstpl (%ecx) + jmp .Lepilogue + +.Lretlongdouble: + # Load %ecx with the pointer to storage for the return value + movl 24(%ebp),%ecx + fstpt (%ecx) + jmp .Lepilogue + +.Lretint64: + # Load %ecx with the pointer to storage for the return value + movl 24(%ebp),%ecx + movl %eax,0(%ecx) + movl %edx,4(%ecx) + jmp .Lepilogue + +.Lretstruct1b: + # Load %ecx with the pointer to storage for the return value + movl 24(%ebp),%ecx + movb %al,0(%ecx) + jmp .Lepilogue + +.Lretstruct2b: + # Load %ecx with the pointer to storage for the return value + movl 24(%ebp),%ecx + movw %ax,0(%ecx) + jmp .Lepilogue + +.Lretstruct4b: + # Load %ecx with the pointer to storage for the return value + movl 24(%ebp),%ecx + movl %eax,0(%ecx) + jmp .Lepilogue + +.Lretstruct: + # Nothing to do! + +.Lnoretval: +.Lepilogue: + movl %ebp,%esp + popl %ebp + ret +.ffi_call_win32_end: +.LFE1: + + # This assumes we are using gas. + .balign 16 + .globl _ffi_closure_SYSV +#ifndef __OS2__ + .def _ffi_closure_SYSV; .scl 2; .type 32; .endef +#endif +_ffi_closure_SYSV: +.LFB3: + pushl %ebp +.LCFI4: + movl %esp, %ebp +.LCFI5: + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) /* resp */ + leal 8(%ebp), %edx + movl %edx, 4(%esp) /* args = __builtin_dwarf_cfa () */ + leal -12(%ebp), %edx + movl %edx, (%esp) /* &resp */ + call _ffi_closure_SYSV_inner + movl -12(%ebp), %ecx + +0: + call 1f + # Do not insert anything here between the call and the jump table. +.Lcls_store_table: + .long .Lcls_noretval /* FFI_TYPE_VOID */ + .long .Lcls_retint /* FFI_TYPE_INT */ + .long .Lcls_retfloat /* FFI_TYPE_FLOAT */ + .long .Lcls_retdouble /* FFI_TYPE_DOUBLE */ + .long .Lcls_retldouble /* FFI_TYPE_LONGDOUBLE */ + .long .Lcls_retuint8 /* FFI_TYPE_UINT8 */ + .long .Lcls_retsint8 /* FFI_TYPE_SINT8 */ + .long .Lcls_retuint16 /* FFI_TYPE_UINT16 */ + .long .Lcls_retsint16 /* FFI_TYPE_SINT16 */ + .long .Lcls_retint /* FFI_TYPE_UINT32 */ + .long .Lcls_retint /* FFI_TYPE_SINT32 */ + .long .Lcls_retllong /* FFI_TYPE_UINT64 */ + .long .Lcls_retllong /* FFI_TYPE_SINT64 */ + .long .Lcls_retstruct /* FFI_TYPE_STRUCT */ + .long .Lcls_retint /* FFI_TYPE_POINTER */ + .long .Lcls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */ + .long .Lcls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */ + .long .Lcls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */ + +1: + add %eax, %eax + add %eax, %eax + add (%esp),%eax + add $4, %esp + jmp *(%eax) + + /* Sign/zero extend as appropriate. */ +.Lcls_retsint8: + movsbl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retsint16: + movswl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retuint8: + movzbl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retuint16: + movzwl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retint: + movl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retfloat: + flds (%ecx) + jmp .Lcls_epilogue + +.Lcls_retdouble: + fldl (%ecx) + jmp .Lcls_epilogue + +.Lcls_retldouble: + fldt (%ecx) + jmp .Lcls_epilogue + +.Lcls_retllong: + movl (%ecx), %eax + movl 4(%ecx), %edx + jmp .Lcls_epilogue + +.Lcls_retstruct1: + movsbl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retstruct2: + movswl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retstruct4: + movl (%ecx), %eax + jmp .Lcls_epilogue + +.Lcls_retstruct: + # Caller expects us to pop struct return value pointer hidden arg. + movl %ebp, %esp + popl %ebp + ret $0x4 + +.Lcls_noretval: +.Lcls_epilogue: + movl %ebp, %esp + popl %ebp + ret +.ffi_closure_SYSV_end: +.LFE3: + +#if !FFI_NO_RAW_API + +#define RAW_CLOSURE_CIF_OFFSET ((FFI_TRAMPOLINE_SIZE + 3) & ~3) +#define RAW_CLOSURE_FUN_OFFSET (RAW_CLOSURE_CIF_OFFSET + 4) +#define RAW_CLOSURE_USER_DATA_OFFSET (RAW_CLOSURE_FUN_OFFSET + 4) +#define CIF_FLAGS_OFFSET 20 + + # This assumes we are using gas. + .balign 16 + .globl _ffi_closure_raw_SYSV +#ifndef __OS2__ + .def _ffi_closure_raw_SYSV; .scl 2; .type 32; .endef +#endif +_ffi_closure_raw_SYSV: +.LFB4: + pushl %ebp +.LCFI6: + movl %esp, %ebp +.LCFI7: + pushl %esi +.LCFI8: + subl $36, %esp + movl RAW_CLOSURE_CIF_OFFSET(%eax), %esi /* closure->cif */ + movl RAW_CLOSURE_USER_DATA_OFFSET(%eax), %edx /* closure->user_data */ + movl %edx, 12(%esp) /* user_data */ + leal 8(%ebp), %edx /* __builtin_dwarf_cfa () */ + movl %edx, 8(%esp) /* raw_args */ + leal -24(%ebp), %edx + movl %edx, 4(%esp) /* &res */ + movl %esi, (%esp) /* cif */ + call *RAW_CLOSURE_FUN_OFFSET(%eax) /* closure->fun */ + movl CIF_FLAGS_OFFSET(%esi), %eax /* rtype */ +0: + call 1f + # Do not insert anything here between the call and the jump table. +.Lrcls_store_table: + .long .Lrcls_noretval /* FFI_TYPE_VOID */ + .long .Lrcls_retint /* FFI_TYPE_INT */ + .long .Lrcls_retfloat /* FFI_TYPE_FLOAT */ + .long .Lrcls_retdouble /* FFI_TYPE_DOUBLE */ + .long .Lrcls_retldouble /* FFI_TYPE_LONGDOUBLE */ + .long .Lrcls_retuint8 /* FFI_TYPE_UINT8 */ + .long .Lrcls_retsint8 /* FFI_TYPE_SINT8 */ + .long .Lrcls_retuint16 /* FFI_TYPE_UINT16 */ + .long .Lrcls_retsint16 /* FFI_TYPE_SINT16 */ + .long .Lrcls_retint /* FFI_TYPE_UINT32 */ + .long .Lrcls_retint /* FFI_TYPE_SINT32 */ + .long .Lrcls_retllong /* FFI_TYPE_UINT64 */ + .long .Lrcls_retllong /* FFI_TYPE_SINT64 */ + .long .Lrcls_retstruct /* FFI_TYPE_STRUCT */ + .long .Lrcls_retint /* FFI_TYPE_POINTER */ + .long .Lrcls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */ + .long .Lrcls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */ + .long .Lrcls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */ +1: + add %eax, %eax + add %eax, %eax + add (%esp),%eax + add $4, %esp + jmp *(%eax) + + /* Sign/zero extend as appropriate. */ +.Lrcls_retsint8: + movsbl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retsint16: + movswl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retuint8: + movzbl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retuint16: + movzwl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retint: + movl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retfloat: + flds -24(%ebp) + jmp .Lrcls_epilogue + +.Lrcls_retdouble: + fldl -24(%ebp) + jmp .Lrcls_epilogue + +.Lrcls_retldouble: + fldt -24(%ebp) + jmp .Lrcls_epilogue + +.Lrcls_retllong: + movl -24(%ebp), %eax + movl -20(%ebp), %edx + jmp .Lrcls_epilogue + +.Lrcls_retstruct1: + movsbl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retstruct2: + movswl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retstruct4: + movl -24(%ebp), %eax + jmp .Lrcls_epilogue + +.Lrcls_retstruct: + # Nothing to do! + +.Lrcls_noretval: +.Lrcls_epilogue: + addl $36, %esp + popl %esi + popl %ebp + ret +.ffi_closure_raw_SYSV_end: +.LFE4: + +#endif /* !FFI_NO_RAW_API */ + + # This assumes we are using gas. + .balign 16 + .globl _ffi_closure_STDCALL +#ifndef __OS2__ + .def _ffi_closure_STDCALL; .scl 2; .type 32; .endef +#endif +_ffi_closure_STDCALL: +.LFB5: + pushl %ebp +.LCFI9: + movl %esp, %ebp +.LCFI10: + subl $40, %esp + leal -24(%ebp), %edx + movl %edx, -12(%ebp) /* resp */ + leal 12(%ebp), %edx /* account for stub return address on stack */ + movl %edx, 4(%esp) /* args */ + leal -12(%ebp), %edx + movl %edx, (%esp) /* &resp */ + call _ffi_closure_SYSV_inner + movl -12(%ebp), %ecx +0: + call 1f + # Do not insert anything here between the call and the jump table. +.Lscls_store_table: + .long .Lscls_noretval /* FFI_TYPE_VOID */ + .long .Lscls_retint /* FFI_TYPE_INT */ + .long .Lscls_retfloat /* FFI_TYPE_FLOAT */ + .long .Lscls_retdouble /* FFI_TYPE_DOUBLE */ + .long .Lscls_retldouble /* FFI_TYPE_LONGDOUBLE */ + .long .Lscls_retuint8 /* FFI_TYPE_UINT8 */ + .long .Lscls_retsint8 /* FFI_TYPE_SINT8 */ + .long .Lscls_retuint16 /* FFI_TYPE_UINT16 */ + .long .Lscls_retsint16 /* FFI_TYPE_SINT16 */ + .long .Lscls_retint /* FFI_TYPE_UINT32 */ + .long .Lscls_retint /* FFI_TYPE_SINT32 */ + .long .Lscls_retllong /* FFI_TYPE_UINT64 */ + .long .Lscls_retllong /* FFI_TYPE_SINT64 */ + .long .Lscls_retstruct /* FFI_TYPE_STRUCT */ + .long .Lscls_retint /* FFI_TYPE_POINTER */ + .long .Lscls_retstruct1 /* FFI_TYPE_SMALL_STRUCT_1B */ + .long .Lscls_retstruct2 /* FFI_TYPE_SMALL_STRUCT_2B */ + .long .Lscls_retstruct4 /* FFI_TYPE_SMALL_STRUCT_4B */ +1: + add %eax, %eax + add %eax, %eax + add (%esp),%eax + add $4, %esp + jmp *(%eax) + + /* Sign/zero extend as appropriate. */ +.Lscls_retsint8: + movsbl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retsint16: + movswl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retuint8: + movzbl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retuint16: + movzwl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retint: + movl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retfloat: + flds (%ecx) + jmp .Lscls_epilogue + +.Lscls_retdouble: + fldl (%ecx) + jmp .Lscls_epilogue + +.Lscls_retldouble: + fldt (%ecx) + jmp .Lscls_epilogue + +.Lscls_retllong: + movl (%ecx), %eax + movl 4(%ecx), %edx + jmp .Lscls_epilogue + +.Lscls_retstruct1: + movsbl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retstruct2: + movswl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retstruct4: + movl (%ecx), %eax + jmp .Lscls_epilogue + +.Lscls_retstruct: + # Nothing to do! + +.Lscls_noretval: +.Lscls_epilogue: + movl %ebp, %esp + popl %ebp + ret +.ffi_closure_STDCALL_end: +.LFE5: + +#ifndef __OS2__ + .section .eh_frame,"w" +#endif +.Lframe1: +.LSCIE1: + .long .LECIE1-.LASCIE1 /* Length of Common Information Entry */ +.LASCIE1: + .long 0x0 /* CIE Identifier Tag */ + .byte 0x1 /* CIE Version */ +#ifdef __PIC__ + .ascii "zR\0" /* CIE Augmentation */ +#else + .ascii "\0" /* CIE Augmentation */ +#endif + .byte 0x1 /* .uleb128 0x1; CIE Code Alignment Factor */ + .byte 0x7c /* .sleb128 -4; CIE Data Alignment Factor */ + .byte 0x8 /* CIE RA Column */ +#ifdef __PIC__ + .byte 0x1 /* .uleb128 0x1; Augmentation size */ + .byte 0x1b /* FDE Encoding (pcrel sdata4) */ +#endif + .byte 0xc /* DW_CFA_def_cfa CFA = r4 + 4 = 4(%esp) */ + .byte 0x4 /* .uleb128 0x4 */ + .byte 0x4 /* .uleb128 0x4 */ + .byte 0x88 /* DW_CFA_offset, column 0x8 %eip at CFA + 1 * -4 */ + .byte 0x1 /* .uleb128 0x1 */ + .align 4 +.LECIE1: + +.LSFDE1: + .long .LEFDE1-.LASFDE1 /* FDE Length */ +.LASFDE1: + .long .LASFDE1-.Lframe1 /* FDE CIE offset */ +#if defined __PIC__ && defined HAVE_AS_X86_PCREL + .long .LFB1-. /* FDE initial location */ +#else + .long .LFB1 +#endif + .long .LFE1-.LFB1 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + /* DW_CFA_xxx CFI instructions go here. */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI0-.LFB1 + .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ + .byte 0x2 /* .uleb128 0x2 */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI1-.LCFI0 + .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ + .byte 0x5 /* .uleb128 0x5 */ + + /* End of DW_CFA_xxx CFI instructions. */ + .align 4 +.LEFDE1: + + +.LSFDE3: + .long .LEFDE3-.LASFDE3 /* FDE Length */ +.LASFDE3: + .long .LASFDE3-.Lframe1 /* FDE CIE offset */ +#if defined __PIC__ && defined HAVE_AS_X86_PCREL + .long .LFB3-. /* FDE initial location */ +#else + .long .LFB3 +#endif + .long .LFE3-.LFB3 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + /* DW_CFA_xxx CFI instructions go here. */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI4-.LFB3 + .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ + .byte 0x2 /* .uleb128 0x2 */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI5-.LCFI4 + .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ + .byte 0x5 /* .uleb128 0x5 */ + + /* End of DW_CFA_xxx CFI instructions. */ + .align 4 +.LEFDE3: + +#if !FFI_NO_RAW_API + +.LSFDE4: + .long .LEFDE4-.LASFDE4 /* FDE Length */ +.LASFDE4: + .long .LASFDE4-.Lframe1 /* FDE CIE offset */ +#if defined __PIC__ && defined HAVE_AS_X86_PCREL + .long .LFB4-. /* FDE initial location */ +#else + .long .LFB4 +#endif + .long .LFE4-.LFB4 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + /* DW_CFA_xxx CFI instructions go here. */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI6-.LFB4 + .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ + .byte 0x2 /* .uleb128 0x2 */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI7-.LCFI6 + .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ + .byte 0x5 /* .uleb128 0x5 */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI8-.LCFI7 + .byte 0x86 /* DW_CFA_offset, column 0x6 %esi at CFA + 3 * -4 */ + .byte 0x3 /* .uleb128 0x3 */ + + /* End of DW_CFA_xxx CFI instructions. */ + .align 4 +.LEFDE4: + +#endif /* !FFI_NO_RAW_API */ + +.LSFDE5: + .long .LEFDE5-.LASFDE5 /* FDE Length */ +.LASFDE5: + .long .LASFDE5-.Lframe1 /* FDE CIE offset */ +#if defined __PIC__ && defined HAVE_AS_X86_PCREL + .long .LFB5-. /* FDE initial location */ +#else + .long .LFB5 +#endif + .long .LFE5-.LFB5 /* FDE address range */ +#ifdef __PIC__ + .byte 0x0 /* .uleb128 0x0; Augmentation size */ +#endif + /* DW_CFA_xxx CFI instructions go here. */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI9-.LFB5 + .byte 0xe /* DW_CFA_def_cfa_offset CFA = r4 + 8 = 8(%esp) */ + .byte 0x8 /* .uleb128 0x8 */ + .byte 0x85 /* DW_CFA_offset, column 0x5 %ebp at CFA + 2 * -4 */ + .byte 0x2 /* .uleb128 0x2 */ + + .byte 0x4 /* DW_CFA_advance_loc4 */ + .long .LCFI10-.LCFI9 + .byte 0xd /* DW_CFA_def_cfa_register CFA = r5 = %ebp */ + .byte 0x5 /* .uleb128 0x5 */ + + /* End of DW_CFA_xxx CFI instructions. */ + .align 4 +.LEFDE5: + +#endif /* !_MSC_VER */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/win64.S b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/win64.S new file mode 100644 index 000000000..fcdb270fa --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/src/x86/win64.S @@ -0,0 +1,468 @@ +#define LIBFFI_ASM +#include +#include + +/* Constants for ffi_call_win64 */ +#define STACK 0 +#define PREP_ARGS_FN 32 +#define ECIF 40 +#define CIF_BYTES 48 +#define CIF_FLAGS 56 +#define RVALUE 64 +#define FN 72 + +/* ffi_call_win64 (void (*prep_args_fn)(char *, extended_cif *), + extended_cif *ecif, unsigned bytes, unsigned flags, + unsigned *rvalue, void (*fn)()); + */ + +#ifdef _MSC_VER +PUBLIC ffi_call_win64 + +EXTRN __chkstk:NEAR +EXTRN ffi_closure_win64_inner:NEAR + +_TEXT SEGMENT + +;;; ffi_closure_win64 will be called with these registers set: +;;; rax points to 'closure' +;;; r11 contains a bit mask that specifies which of the +;;; first four parameters are float or double +;;; +;;; It must move the parameters passed in registers to their stack location, +;;; call ffi_closure_win64_inner for the actual work, then return the result. +;;; +ffi_closure_win64 PROC FRAME + ;; copy register arguments onto stack + test r11, 1 + jne first_is_float + mov QWORD PTR [rsp+8], rcx + jmp second +first_is_float: + movlpd QWORD PTR [rsp+8], xmm0 + +second: + test r11, 2 + jne second_is_float + mov QWORD PTR [rsp+16], rdx + jmp third +second_is_float: + movlpd QWORD PTR [rsp+16], xmm1 + +third: + test r11, 4 + jne third_is_float + mov QWORD PTR [rsp+24], r8 + jmp fourth +third_is_float: + movlpd QWORD PTR [rsp+24], xmm2 + +fourth: + test r11, 8 + jne fourth_is_float + mov QWORD PTR [rsp+32], r9 + jmp done +fourth_is_float: + movlpd QWORD PTR [rsp+32], xmm3 + +done: + .ALLOCSTACK 40 + sub rsp, 40 + .ENDPROLOG + mov rcx, rax ; context is first parameter + mov rdx, rsp ; stack is second parameter + add rdx, 48 ; point to start of arguments + mov rax, ffi_closure_win64_inner + call rax ; call the real closure function + add rsp, 40 + movd xmm0, rax ; If the closure returned a float, + ; ffi_closure_win64_inner wrote it to rax + ret 0 +ffi_closure_win64 ENDP + +ffi_call_win64 PROC FRAME + ;; copy registers onto stack + mov QWORD PTR [rsp+32], r9 + mov QWORD PTR [rsp+24], r8 + mov QWORD PTR [rsp+16], rdx + mov QWORD PTR [rsp+8], rcx + .PUSHREG rbp + push rbp + .ALLOCSTACK 48 + sub rsp, 48 ; 00000030H + .SETFRAME rbp, 32 + lea rbp, QWORD PTR [rsp+32] + .ENDPROLOG + + mov eax, DWORD PTR CIF_BYTES[rbp] + add rax, 15 + and rax, -16 + call __chkstk + sub rsp, rax + lea rax, QWORD PTR [rsp+32] + mov QWORD PTR STACK[rbp], rax + + mov rdx, QWORD PTR ECIF[rbp] + mov rcx, QWORD PTR STACK[rbp] + call QWORD PTR PREP_ARGS_FN[rbp] + + mov rsp, QWORD PTR STACK[rbp] + + movlpd xmm3, QWORD PTR [rsp+24] + movd r9, xmm3 + + movlpd xmm2, QWORD PTR [rsp+16] + movd r8, xmm2 + + movlpd xmm1, QWORD PTR [rsp+8] + movd rdx, xmm1 + + movlpd xmm0, QWORD PTR [rsp] + movd rcx, xmm0 + + call QWORD PTR FN[rbp] +ret_struct4b$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_4B + jne ret_struct2b$ + + mov rcx, QWORD PTR RVALUE[rbp] + mov DWORD PTR [rcx], eax + jmp ret_void$ + +ret_struct2b$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_2B + jne ret_struct1b$ + + mov rcx, QWORD PTR RVALUE[rbp] + mov WORD PTR [rcx], ax + jmp ret_void$ + +ret_struct1b$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SMALL_STRUCT_1B + jne ret_uint8$ + + mov rcx, QWORD PTR RVALUE[rbp] + mov BYTE PTR [rcx], al + jmp ret_void$ + +ret_uint8$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT8 + jne ret_sint8$ + + mov rcx, QWORD PTR RVALUE[rbp] + movzx rax, al + mov QWORD PTR [rcx], rax + jmp ret_void$ + +ret_sint8$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT8 + jne ret_uint16$ + + mov rcx, QWORD PTR RVALUE[rbp] + movsx rax, al + mov QWORD PTR [rcx], rax + jmp ret_void$ + +ret_uint16$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT16 + jne ret_sint16$ + + mov rcx, QWORD PTR RVALUE[rbp] + movzx rax, ax + mov QWORD PTR [rcx], rax + jmp SHORT ret_void$ + +ret_sint16$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT16 + jne ret_uint32$ + + mov rcx, QWORD PTR RVALUE[rbp] + movsx rax, ax + mov QWORD PTR [rcx], rax + jmp SHORT ret_void$ + +ret_uint32$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_UINT32 + jne ret_sint32$ + + mov rcx, QWORD PTR RVALUE[rbp] + mov eax, eax + mov QWORD PTR [rcx], rax + jmp SHORT ret_void$ + +ret_sint32$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT32 + jne ret_float$ + + mov rcx, QWORD PTR RVALUE[rbp] + cdqe + mov QWORD PTR [rcx], rax + jmp SHORT ret_void$ + +ret_float$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_FLOAT + jne SHORT ret_double$ + + mov rax, QWORD PTR RVALUE[rbp] + movss DWORD PTR [rax], xmm0 + jmp SHORT ret_void$ + +ret_double$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_DOUBLE + jne SHORT ret_sint64$ + + mov rax, QWORD PTR RVALUE[rbp] + movlpd QWORD PTR [rax], xmm0 + jmp SHORT ret_void$ + +ret_sint64$: + cmp DWORD PTR CIF_FLAGS[rbp], FFI_TYPE_SINT64 + jne ret_void$ + + mov rcx, QWORD PTR RVALUE[rbp] + mov QWORD PTR [rcx], rax + jmp SHORT ret_void$ + +ret_void$: + xor rax, rax + + lea rsp, QWORD PTR [rbp+16] + pop rbp + ret 0 +ffi_call_win64 ENDP +_TEXT ENDS +END + +#else + +#ifdef SYMBOL_UNDERSCORE +#define SYMBOL_NAME(name) _##name +#else +#define SYMBOL_NAME(name) name +#endif + +.text + +.extern SYMBOL_NAME(ffi_closure_win64_inner) + +# ffi_closure_win64 will be called with these registers set: +# rax points to 'closure' +# r11 contains a bit mask that specifies which of the +# first four parameters are float or double +# +# It must move the parameters passed in registers to their stack location, +# call ffi_closure_win64_inner for the actual work, then return the result. +# + .balign 16 + .globl SYMBOL_NAME(ffi_closure_win64) +SYMBOL_NAME(ffi_closure_win64): + # copy register arguments onto stack + test $1,%r11 + jne .Lfirst_is_float + mov %rcx, 8(%rsp) + jmp .Lsecond +.Lfirst_is_float: + movlpd %xmm0, 8(%rsp) + +.Lsecond: + test $2, %r11 + jne .Lsecond_is_float + mov %rdx, 16(%rsp) + jmp .Lthird +.Lsecond_is_float: + movlpd %xmm1, 16(%rsp) + +.Lthird: + test $4, %r11 + jne .Lthird_is_float + mov %r8,24(%rsp) + jmp .Lfourth +.Lthird_is_float: + movlpd %xmm2, 24(%rsp) + +.Lfourth: + test $8, %r11 + jne .Lfourth_is_float + mov %r9, 32(%rsp) + jmp .Ldone +.Lfourth_is_float: + movlpd %xmm3, 32(%rsp) + +.Ldone: +#.ALLOCSTACK 40 + sub $40, %rsp +#.ENDPROLOG + mov %rax, %rcx # context is first parameter + mov %rsp, %rdx # stack is second parameter + add $48, %rdx # point to start of arguments + mov $SYMBOL_NAME(ffi_closure_win64_inner), %rax + callq *%rax # call the real closure function + add $40, %rsp + movq %rax, %xmm0 # If the closure returned a float, + # ffi_closure_win64_inner wrote it to rax + retq +.ffi_closure_win64_end: + + .balign 16 + .globl SYMBOL_NAME(ffi_call_win64) +SYMBOL_NAME(ffi_call_win64): + # copy registers onto stack + mov %r9,32(%rsp) + mov %r8,24(%rsp) + mov %rdx,16(%rsp) + mov %rcx,8(%rsp) + #.PUSHREG rbp + push %rbp + #.ALLOCSTACK 48 + sub $48,%rsp + #.SETFRAME rbp, 32 + lea 32(%rsp),%rbp + #.ENDPROLOG + + mov CIF_BYTES(%rbp),%eax + add $15, %rax + and $-16, %rax + cmpq $0x1000, %rax + jb Lch_done +Lch_probe: + subq $0x1000,%rsp + orl $0x0, (%rsp) + subq $0x1000,%rax + cmpq $0x1000,%rax + ja Lch_probe +Lch_done: + subq %rax, %rsp + orl $0x0, (%rsp) + lea 32(%rsp), %rax + mov %rax, STACK(%rbp) + + mov ECIF(%rbp), %rdx + mov STACK(%rbp), %rcx + callq *PREP_ARGS_FN(%rbp) + + mov STACK(%rbp), %rsp + + movlpd 24(%rsp), %xmm3 + movd %xmm3, %r9 + + movlpd 16(%rsp), %xmm2 + movd %xmm2, %r8 + + movlpd 8(%rsp), %xmm1 + movd %xmm1, %rdx + + movlpd (%rsp), %xmm0 + movd %xmm0, %rcx + + callq *FN(%rbp) +.Lret_struct4b: + cmpl $FFI_TYPE_SMALL_STRUCT_4B, CIF_FLAGS(%rbp) + jne .Lret_struct2b + + mov RVALUE(%rbp), %rcx + mov %eax, (%rcx) + jmp .Lret_void + +.Lret_struct2b: + cmpl $FFI_TYPE_SMALL_STRUCT_2B, CIF_FLAGS(%rbp) + jne .Lret_struct1b + + mov RVALUE(%rbp), %rcx + mov %ax, (%rcx) + jmp .Lret_void + +.Lret_struct1b: + cmpl $FFI_TYPE_SMALL_STRUCT_1B, CIF_FLAGS(%rbp) + jne .Lret_uint8 + + mov RVALUE(%rbp), %rcx + mov %al, (%rcx) + jmp .Lret_void + +.Lret_uint8: + cmpl $FFI_TYPE_UINT8, CIF_FLAGS(%rbp) + jne .Lret_sint8 + + mov RVALUE(%rbp), %rcx + movzbq %al, %rax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_sint8: + cmpl $FFI_TYPE_SINT8, CIF_FLAGS(%rbp) + jne .Lret_uint16 + + mov RVALUE(%rbp), %rcx + movsbq %al, %rax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_uint16: + cmpl $FFI_TYPE_UINT16, CIF_FLAGS(%rbp) + jne .Lret_sint16 + + mov RVALUE(%rbp), %rcx + movzwq %ax, %rax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_sint16: + cmpl $FFI_TYPE_SINT16, CIF_FLAGS(%rbp) + jne .Lret_uint32 + + mov RVALUE(%rbp), %rcx + movswq %ax, %rax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_uint32: + cmpl $FFI_TYPE_UINT32, CIF_FLAGS(%rbp) + jne .Lret_sint32 + + mov RVALUE(%rbp), %rcx + movl %eax, %eax + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_sint32: + cmpl $FFI_TYPE_SINT32, CIF_FLAGS(%rbp) + jne .Lret_float + + mov RVALUE(%rbp), %rcx + cltq + movq %rax, (%rcx) + jmp .Lret_void + +.Lret_float: + cmpl $FFI_TYPE_FLOAT, CIF_FLAGS(%rbp) + jne .Lret_double + + mov RVALUE(%rbp), %rax + movss %xmm0, (%rax) + jmp .Lret_void + +.Lret_double: + cmpl $FFI_TYPE_DOUBLE, CIF_FLAGS(%rbp) + jne .Lret_sint64 + + mov RVALUE(%rbp), %rax + movlpd %xmm0, (%rax) + jmp .Lret_void + +.Lret_sint64: + cmpl $FFI_TYPE_SINT64, CIF_FLAGS(%rbp) + jne .Lret_void + + mov RVALUE(%rbp), %rcx + mov %rax, (%rcx) + jmp .Lret_void + +.Lret_void: + xor %rax, %rax + + lea 16(%rbp), %rsp + pop %rbp + retq +.ffi_call_win64_end: +#endif /* !_MSC_VER */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/Makefile.am b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/Makefile.am new file mode 100644 index 000000000..cfd1df437 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/Makefile.am @@ -0,0 +1,80 @@ +## Process this file with automake to produce Makefile.in. + +AUTOMAKE_OPTIONS = foreign dejagnu + +# Setup the testing framework, if you have one +EXPECT = `if [ -f $(top_builddir)/../expect/expect ] ; then \ + echo $(top_builddir)/../expect/expect ; \ + else echo expect ; fi` + +RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \ + echo $(top_srcdir)/../dejagnu/runtest ; \ + else echo runtest; fi` + +AM_RUNTESTFLAGS = + +CLEANFILES = *.exe core* *.log *.sum + +EXTRA_DIST = libffi.special/special.exp \ +libffi.special/unwindtest_ffi_call.cc libffi.special/unwindtest.cc \ +libffi.special/ffitestcxx.h config/default.exp lib/target-libpath.exp \ +lib/libffi.exp lib/wrapper.exp libffi.call/float.c \ +libffi.call/cls_multi_schar.c libffi.call/float3.c \ +libffi.call/cls_3_1byte.c libffi.call/stret_large2.c \ +libffi.call/cls_5_1_byte.c libffi.call/stret_medium.c \ +libffi.call/promotion.c libffi.call/cls_dbls_struct.c \ +libffi.call/nested_struct.c libffi.call/closure_fn1.c \ +libffi.call/cls_4_1byte.c libffi.call/cls_float.c \ +libffi.call/cls_2byte.c libffi.call/closure_fn4.c \ +libffi.call/return_fl2.c libffi.call/nested_struct7.c \ +libffi.call/cls_uint.c libffi.call/cls_align_sint64.c \ +libffi.call/float1.c libffi.call/cls_19byte.c \ +libffi.call/nested_struct1.c libffi.call/cls_4byte.c \ +libffi.call/return_fl1.c libffi.call/cls_align_pointer.c \ +libffi.call/nested_struct4.c libffi.call/nested_struct3.c \ +libffi.call/struct7.c libffi.call/nested_struct9.c \ +libffi.call/cls_sshort.c libffi.call/cls_ulonglong.c \ +libffi.call/cls_pointer_stack.c libffi.call/cls_multi_uchar.c \ +libffi.call/testclosure.c libffi.call/cls_3byte1.c \ +libffi.call/struct6.c libffi.call/return_uc.c libffi.call/return_ll1.c \ +libffi.call/cls_ushort.c libffi.call/stret_medium2.c \ +libffi.call/cls_multi_ushortchar.c libffi.call/return_dbl2.c \ +libffi.call/closure_loc_fn0.c libffi.call/return_sc.c \ +libffi.call/nested_struct8.c libffi.call/cls_7_1_byte.c \ +libffi.call/return_ll.c libffi.call/cls_pointer.c \ +libffi.call/err_bad_abi.c libffi.call/return_dbl1.c \ +libffi.call/call.exp libffi.call/ffitest.h libffi.call/strlen.c \ +libffi.call/return_sl.c libffi.call/cls_1_1byte.c \ +libffi.call/struct1.c libffi.call/cls_64byte.c libffi.call/return_ul.c \ +libffi.call/cls_double.c libffi.call/many_win32.c \ +libffi.call/cls_16byte.c libffi.call/cls_align_double.c \ +libffi.call/cls_align_uint16.c libffi.call/cls_9byte1.c \ +libffi.call/cls_multi_sshortchar.c libffi.call/cls_multi_ushort.c \ +libffi.call/closure_stdcall.c libffi.call/return_fl.c \ +libffi.call/strlen_win32.c libffi.call/return_ldl.c \ +libffi.call/cls_align_float.c libffi.call/struct3.c \ +libffi.call/cls_uchar.c libffi.call/cls_sint.c libffi.call/float2.c \ +libffi.call/cls_align_longdouble_split.c \ +libffi.call/cls_longdouble_va.c libffi.call/cls_multi_sshort.c \ +libffi.call/stret_large.c libffi.call/cls_align_sint16.c \ +libffi.call/nested_struct6.c libffi.call/cls_5byte.c \ +libffi.call/return_dbl.c libffi.call/cls_20byte.c \ +libffi.call/cls_8byte.c libffi.call/pyobjc-tc.c \ +libffi.call/cls_24byte.c libffi.call/cls_align_longdouble_split2.c \ +libffi.call/cls_6_1_byte.c libffi.call/cls_schar.c \ +libffi.call/cls_18byte.c libffi.call/closure_fn3.c \ +libffi.call/err_bad_typedef.c libffi.call/closure_fn2.c \ +libffi.call/struct2.c libffi.call/cls_3byte2.c \ +libffi.call/cls_align_longdouble.c libffi.call/cls_20byte1.c \ +libffi.call/return_fl3.c libffi.call/cls_align_uint32.c \ +libffi.call/problem1.c libffi.call/float4.c \ +libffi.call/cls_align_uint64.c libffi.call/struct9.c \ +libffi.call/closure_fn5.c libffi.call/cls_align_sint32.c \ +libffi.call/closure_fn0.c libffi.call/closure_fn6.c \ +libffi.call/struct4.c libffi.call/nested_struct2.c \ +libffi.call/cls_6byte.c libffi.call/cls_7byte.c libffi.call/many.c \ +libffi.call/struct8.c libffi.call/negint.c libffi.call/struct5.c \ +libffi.call/cls_12byte.c libffi.call/cls_double_va.c \ +libffi.call/cls_longdouble.c libffi.call/cls_9byte2.c \ +libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ +libffi.call/huge_struct.c diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/Makefile.in b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/Makefile.in new file mode 100644 index 000000000..53de9c0c6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/Makefile.in @@ -0,0 +1,500 @@ +# Makefile.in generated by automake 1.11.1 from Makefile.am. +# @configure_input@ + +# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, +# 2003, 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, +# Inc. +# This Makefile.in is free software; the Free Software Foundation +# gives unlimited permission to copy and/or distribute it, +# with or without modifications, as long as this notice is preserved. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY, to the extent permitted by law; without +# even the implied warranty of MERCHANTABILITY or FITNESS FOR A +# PARTICULAR PURPOSE. + +@SET_MAKE@ +VPATH = @srcdir@ +pkgdatadir = $(datadir)/@PACKAGE@ +pkgincludedir = $(includedir)/@PACKAGE@ +pkglibdir = $(libdir)/@PACKAGE@ +pkglibexecdir = $(libexecdir)/@PACKAGE@ +am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd +install_sh_DATA = $(install_sh) -c -m 644 +install_sh_PROGRAM = $(install_sh) -c +install_sh_SCRIPT = $(install_sh) -c +INSTALL_HEADER = $(INSTALL_DATA) +transform = $(program_transform_name) +NORMAL_INSTALL = : +PRE_INSTALL = : +POST_INSTALL = : +NORMAL_UNINSTALL = : +PRE_UNINSTALL = : +POST_UNINSTALL = : +build_triplet = @build@ +host_triplet = @host@ +target_triplet = @target@ +subdir = testsuite +DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in +ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 +am__aclocal_m4_deps = $(top_srcdir)/m4/ax_cc_maxopt.m4 \ + $(top_srcdir)/m4/ax_cflags_warn_all.m4 \ + $(top_srcdir)/m4/ax_check_compiler_flags.m4 \ + $(top_srcdir)/m4/ax_compiler_vendor.m4 \ + $(top_srcdir)/m4/ax_configure_args.m4 \ + $(top_srcdir)/m4/ax_enable_builddir.m4 \ + $(top_srcdir)/m4/ax_gcc_archflag.m4 \ + $(top_srcdir)/m4/ax_gcc_x86_cpuid.m4 \ + $(top_srcdir)/m4/libtool.m4 $(top_srcdir)/m4/ltoptions.m4 \ + $(top_srcdir)/m4/ltsugar.m4 $(top_srcdir)/m4/ltversion.m4 \ + $(top_srcdir)/m4/lt~obsolete.m4 $(top_srcdir)/acinclude.m4 \ + $(top_srcdir)/configure.ac +am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \ + $(ACLOCAL_M4) +mkinstalldirs = $(install_sh) -d +CONFIG_HEADER = $(top_builddir)/fficonfig.h +CONFIG_CLEAN_FILES = +CONFIG_CLEAN_VPATH_FILES = +SOURCES = +DIST_SOURCES = +DEJATOOL = $(PACKAGE) +RUNTESTDEFAULTFLAGS = --tool $$tool --srcdir $$srcdir +DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) +ACLOCAL = @ACLOCAL@ +ALLOCA = @ALLOCA@ +AMTAR = @AMTAR@ +AM_LTLDFLAGS = @AM_LTLDFLAGS@ +AM_RUNTESTFLAGS = +AR = @AR@ +AUTOCONF = @AUTOCONF@ +AUTOHEADER = @AUTOHEADER@ +AUTOMAKE = @AUTOMAKE@ +AWK = @AWK@ +CC = @CC@ +CCAS = @CCAS@ +CCASDEPMODE = @CCASDEPMODE@ +CCASFLAGS = @CCASFLAGS@ +CCDEPMODE = @CCDEPMODE@ +CFLAGS = @CFLAGS@ +CPP = @CPP@ +CPPFLAGS = @CPPFLAGS@ +CYGPATH_W = @CYGPATH_W@ +DEFS = @DEFS@ +DEPDIR = @DEPDIR@ +DLLTOOL = @DLLTOOL@ +DSYMUTIL = @DSYMUTIL@ +DUMPBIN = @DUMPBIN@ +ECHO_C = @ECHO_C@ +ECHO_N = @ECHO_N@ +ECHO_T = @ECHO_T@ +EGREP = @EGREP@ +EXEEXT = @EXEEXT@ +FFI_EXEC_TRAMPOLINE_TABLE = @FFI_EXEC_TRAMPOLINE_TABLE@ +FGREP = @FGREP@ +GREP = @GREP@ +HAVE_LONG_DOUBLE = @HAVE_LONG_DOUBLE@ +INSTALL = @INSTALL@ +INSTALL_DATA = @INSTALL_DATA@ +INSTALL_PROGRAM = @INSTALL_PROGRAM@ +INSTALL_SCRIPT = @INSTALL_SCRIPT@ +INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@ +LD = @LD@ +LDFLAGS = @LDFLAGS@ +LIBOBJS = @LIBOBJS@ +LIBS = @LIBS@ +LIBTOOL = @LIBTOOL@ +LIPO = @LIPO@ +LN_S = @LN_S@ +LTLIBOBJS = @LTLIBOBJS@ +MAINT = @MAINT@ +MAKEINFO = @MAKEINFO@ +MANIFEST_TOOL = @MANIFEST_TOOL@ +MKDIR_P = @MKDIR_P@ +NM = @NM@ +NMEDIT = @NMEDIT@ +OBJDUMP = @OBJDUMP@ +OBJEXT = @OBJEXT@ +OTOOL = @OTOOL@ +OTOOL64 = @OTOOL64@ +PACKAGE = @PACKAGE@ +PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@ +PACKAGE_NAME = @PACKAGE_NAME@ +PACKAGE_STRING = @PACKAGE_STRING@ +PACKAGE_TARNAME = @PACKAGE_TARNAME@ +PACKAGE_URL = @PACKAGE_URL@ +PACKAGE_VERSION = @PACKAGE_VERSION@ +PATH_SEPARATOR = @PATH_SEPARATOR@ +PRTDIAG = @PRTDIAG@ +RANLIB = @RANLIB@ +SED = @SED@ +SET_MAKE = @SET_MAKE@ +SHELL = @SHELL@ +STRIP = @STRIP@ +TARGET = @TARGET@ +TARGETDIR = @TARGETDIR@ +VERSION = @VERSION@ +abs_builddir = @abs_builddir@ +abs_srcdir = @abs_srcdir@ +abs_top_builddir = @abs_top_builddir@ +abs_top_srcdir = @abs_top_srcdir@ +ac_ct_AR = @ac_ct_AR@ +ac_ct_CC = @ac_ct_CC@ +ac_ct_DUMPBIN = @ac_ct_DUMPBIN@ +am__include = @am__include@ +am__leading_dot = @am__leading_dot@ +am__quote = @am__quote@ +am__tar = @am__tar@ +am__untar = @am__untar@ +ax_enable_builddir_sed = @ax_enable_builddir_sed@ +bindir = @bindir@ +build = @build@ +build_alias = @build_alias@ +build_cpu = @build_cpu@ +build_os = @build_os@ +build_vendor = @build_vendor@ +builddir = @builddir@ +datadir = @datadir@ +datarootdir = @datarootdir@ +docdir = @docdir@ +dvidir = @dvidir@ +exec_prefix = @exec_prefix@ +host = @host@ +host_alias = @host_alias@ +host_cpu = @host_cpu@ +host_os = @host_os@ +host_vendor = @host_vendor@ +htmldir = @htmldir@ +includedir = @includedir@ +infodir = @infodir@ +install_sh = @install_sh@ +libdir = @libdir@ +libexecdir = @libexecdir@ +localedir = @localedir@ +localstatedir = @localstatedir@ +mandir = @mandir@ +mkdir_p = @mkdir_p@ +oldincludedir = @oldincludedir@ +pdfdir = @pdfdir@ +prefix = @prefix@ +program_transform_name = @program_transform_name@ +psdir = @psdir@ +sbindir = @sbindir@ +sharedstatedir = @sharedstatedir@ +srcdir = @srcdir@ +sys_symbol_underscore = @sys_symbol_underscore@ +sysconfdir = @sysconfdir@ +target = @target@ +target_alias = @target_alias@ +target_cpu = @target_cpu@ +target_os = @target_os@ +target_vendor = @target_vendor@ +toolexecdir = @toolexecdir@ +toolexeclibdir = @toolexeclibdir@ +top_build_prefix = @top_build_prefix@ +top_builddir = @top_builddir@ +top_srcdir = @top_srcdir@ +AUTOMAKE_OPTIONS = foreign dejagnu + +# Setup the testing framework, if you have one +EXPECT = `if [ -f $(top_builddir)/../expect/expect ] ; then \ + echo $(top_builddir)/../expect/expect ; \ + else echo expect ; fi` + +RUNTEST = `if [ -f $(top_srcdir)/../dejagnu/runtest ] ; then \ + echo $(top_srcdir)/../dejagnu/runtest ; \ + else echo runtest; fi` + +CLEANFILES = *.exe core* *.log *.sum +EXTRA_DIST = libffi.special/special.exp \ +libffi.special/unwindtest_ffi_call.cc libffi.special/unwindtest.cc \ +libffi.special/ffitestcxx.h config/default.exp lib/target-libpath.exp \ +lib/libffi.exp lib/wrapper.exp libffi.call/float.c \ +libffi.call/cls_multi_schar.c libffi.call/float3.c \ +libffi.call/cls_3_1byte.c libffi.call/stret_large2.c \ +libffi.call/cls_5_1_byte.c libffi.call/stret_medium.c \ +libffi.call/promotion.c libffi.call/cls_dbls_struct.c \ +libffi.call/nested_struct.c libffi.call/closure_fn1.c \ +libffi.call/cls_4_1byte.c libffi.call/cls_float.c \ +libffi.call/cls_2byte.c libffi.call/closure_fn4.c \ +libffi.call/return_fl2.c libffi.call/nested_struct7.c \ +libffi.call/cls_uint.c libffi.call/cls_align_sint64.c \ +libffi.call/float1.c libffi.call/cls_19byte.c \ +libffi.call/nested_struct1.c libffi.call/cls_4byte.c \ +libffi.call/return_fl1.c libffi.call/cls_align_pointer.c \ +libffi.call/nested_struct4.c libffi.call/nested_struct3.c \ +libffi.call/struct7.c libffi.call/nested_struct9.c \ +libffi.call/cls_sshort.c libffi.call/cls_ulonglong.c \ +libffi.call/cls_pointer_stack.c libffi.call/cls_multi_uchar.c \ +libffi.call/testclosure.c libffi.call/cls_3byte1.c \ +libffi.call/struct6.c libffi.call/return_uc.c libffi.call/return_ll1.c \ +libffi.call/cls_ushort.c libffi.call/stret_medium2.c \ +libffi.call/cls_multi_ushortchar.c libffi.call/return_dbl2.c \ +libffi.call/closure_loc_fn0.c libffi.call/return_sc.c \ +libffi.call/nested_struct8.c libffi.call/cls_7_1_byte.c \ +libffi.call/return_ll.c libffi.call/cls_pointer.c \ +libffi.call/err_bad_abi.c libffi.call/return_dbl1.c \ +libffi.call/call.exp libffi.call/ffitest.h libffi.call/strlen.c \ +libffi.call/return_sl.c libffi.call/cls_1_1byte.c \ +libffi.call/struct1.c libffi.call/cls_64byte.c libffi.call/return_ul.c \ +libffi.call/cls_double.c libffi.call/many_win32.c \ +libffi.call/cls_16byte.c libffi.call/cls_align_double.c \ +libffi.call/cls_align_uint16.c libffi.call/cls_9byte1.c \ +libffi.call/cls_multi_sshortchar.c libffi.call/cls_multi_ushort.c \ +libffi.call/closure_stdcall.c libffi.call/return_fl.c \ +libffi.call/strlen_win32.c libffi.call/return_ldl.c \ +libffi.call/cls_align_float.c libffi.call/struct3.c \ +libffi.call/cls_uchar.c libffi.call/cls_sint.c libffi.call/float2.c \ +libffi.call/cls_align_longdouble_split.c \ +libffi.call/cls_longdouble_va.c libffi.call/cls_multi_sshort.c \ +libffi.call/stret_large.c libffi.call/cls_align_sint16.c \ +libffi.call/nested_struct6.c libffi.call/cls_5byte.c \ +libffi.call/return_dbl.c libffi.call/cls_20byte.c \ +libffi.call/cls_8byte.c libffi.call/pyobjc-tc.c \ +libffi.call/cls_24byte.c libffi.call/cls_align_longdouble_split2.c \ +libffi.call/cls_6_1_byte.c libffi.call/cls_schar.c \ +libffi.call/cls_18byte.c libffi.call/closure_fn3.c \ +libffi.call/err_bad_typedef.c libffi.call/closure_fn2.c \ +libffi.call/struct2.c libffi.call/cls_3byte2.c \ +libffi.call/cls_align_longdouble.c libffi.call/cls_20byte1.c \ +libffi.call/return_fl3.c libffi.call/cls_align_uint32.c \ +libffi.call/problem1.c libffi.call/float4.c \ +libffi.call/cls_align_uint64.c libffi.call/struct9.c \ +libffi.call/closure_fn5.c libffi.call/cls_align_sint32.c \ +libffi.call/closure_fn0.c libffi.call/closure_fn6.c \ +libffi.call/struct4.c libffi.call/nested_struct2.c \ +libffi.call/cls_6byte.c libffi.call/cls_7byte.c libffi.call/many.c \ +libffi.call/struct8.c libffi.call/negint.c libffi.call/struct5.c \ +libffi.call/cls_12byte.c libffi.call/cls_double_va.c \ +libffi.call/cls_longdouble.c libffi.call/cls_9byte2.c \ +libffi.call/nested_struct10.c libffi.call/nested_struct5.c \ +libffi.call/huge_struct.c + +all: all-am + +.SUFFIXES: +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) + @for dep in $?; do \ + case '$(am__configure_deps)' in \ + *$$dep*) \ + ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \ + && { if test -f $@; then exit 0; else break; fi; }; \ + exit 1;; \ + esac; \ + done; \ + echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign testsuite/Makefile'; \ + $(am__cd) $(top_srcdir) && \ + $(AUTOMAKE) --foreign testsuite/Makefile +.PRECIOUS: Makefile +Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status + @case '$?' in \ + *config.status*) \ + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \ + *) \ + echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \ + cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \ + esac; + +$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh + +$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) + cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh +$(am__aclocal_m4_deps): + +mostlyclean-libtool: + -rm -f *.lo + +clean-libtool: + -rm -rf .libs _libs +tags: TAGS +TAGS: + +ctags: CTAGS +CTAGS: + + +check-DEJAGNU: site.exp + srcdir=`$(am__cd) $(srcdir) && pwd`; export srcdir; \ + EXPECT=$(EXPECT); export EXPECT; \ + runtest=$(RUNTEST); \ + if $(SHELL) -c "$$runtest --version" > /dev/null 2>&1; then \ + exit_status=0; l='$(DEJATOOL)'; for tool in $$l; do \ + if $$runtest $(AM_RUNTESTFLAGS) $(RUNTESTDEFAULTFLAGS) $(RUNTESTFLAGS); \ + then :; else exit_status=1; fi; \ + done; \ + else echo "WARNING: could not find \`runtest'" 1>&2; :;\ + fi; \ + exit $$exit_status +site.exp: Makefile + @echo 'Making a new site.exp file...' + @echo '## these variables are automatically generated by make ##' >site.tmp + @echo '# Do not edit here. If you wish to override these values' >>site.tmp + @echo '# edit the last section' >>site.tmp + @echo 'set srcdir $(srcdir)' >>site.tmp + @echo "set objdir `pwd`" >>site.tmp + @echo 'set build_alias "$(build_alias)"' >>site.tmp + @echo 'set build_triplet $(build_triplet)' >>site.tmp + @echo 'set host_alias "$(host_alias)"' >>site.tmp + @echo 'set host_triplet $(host_triplet)' >>site.tmp + @echo 'set target_alias "$(target_alias)"' >>site.tmp + @echo 'set target_triplet $(target_triplet)' >>site.tmp + @echo '## All variables above are generated by configure. Do Not Edit ##' >>site.tmp + @test ! -f site.exp || \ + sed '1,/^## All variables above are.*##/ d' site.exp >> site.tmp + @-rm -f site.bak + @test ! -f site.exp || mv site.exp site.bak + @mv site.tmp site.exp + +distclean-DEJAGNU: + -rm -f site.exp site.bak + -l='$(DEJATOOL)'; for tool in $$l; do \ + rm -f $$tool.sum $$tool.log; \ + done + +distdir: $(DISTFILES) + @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ + list='$(DISTFILES)'; \ + dist_files=`for file in $$list; do echo $$file; done | \ + sed -e "s|^$$srcdirstrip/||;t" \ + -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \ + case $$dist_files in \ + */*) $(MKDIR_P) `echo "$$dist_files" | \ + sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \ + sort -u` ;; \ + esac; \ + for file in $$dist_files; do \ + if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \ + if test -d $$d/$$file; then \ + dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \ + if test -d "$(distdir)/$$file"; then \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \ + cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \ + find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \ + fi; \ + cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \ + else \ + test -f "$(distdir)/$$file" \ + || cp -p $$d/$$file "$(distdir)/$$file" \ + || exit 1; \ + fi; \ + done +check-am: all-am + $(MAKE) $(AM_MAKEFLAGS) check-DEJAGNU +check: check-am +all-am: Makefile +installdirs: +install: install-am +install-exec: install-exec-am +install-data: install-data-am +uninstall: uninstall-am + +install-am: all-am + @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am + +installcheck: installcheck-am +install-strip: + $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \ + install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \ + `test -z '$(STRIP)' || \ + echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install +mostlyclean-generic: + +clean-generic: + -test -z "$(CLEANFILES)" || rm -f $(CLEANFILES) + +distclean-generic: + -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES) + -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES) + +maintainer-clean-generic: + @echo "This command is intended for maintainers to use" + @echo "it deletes files that may require special tools to rebuild." +clean: clean-am + +clean-am: clean-generic clean-libtool mostlyclean-am + +distclean: distclean-am + -rm -f Makefile +distclean-am: clean-am distclean-DEJAGNU distclean-generic + +dvi: dvi-am + +dvi-am: + +html: html-am + +html-am: + +info: info-am + +info-am: + +install-data-am: + +install-dvi: install-dvi-am + +install-dvi-am: + +install-exec-am: + +install-html: install-html-am + +install-html-am: + +install-info: install-info-am + +install-info-am: + +install-man: + +install-pdf: install-pdf-am + +install-pdf-am: + +install-ps: install-ps-am + +install-ps-am: + +installcheck-am: + +maintainer-clean: maintainer-clean-am + -rm -f Makefile +maintainer-clean-am: distclean-am maintainer-clean-generic + +mostlyclean: mostlyclean-am + +mostlyclean-am: mostlyclean-generic mostlyclean-libtool + +pdf: pdf-am + +pdf-am: + +ps: ps-am + +ps-am: + +uninstall-am: + +.MAKE: check-am install-am install-strip + +.PHONY: all all-am check check-DEJAGNU check-am clean clean-generic \ + clean-libtool distclean distclean-DEJAGNU distclean-generic \ + distclean-libtool distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am install-dvi \ + install-dvi-am install-exec install-exec-am install-html \ + install-html-am install-info install-info-am install-man \ + install-pdf install-pdf-am install-ps install-ps-am \ + install-strip installcheck installcheck-am installdirs \ + maintainer-clean maintainer-clean-generic mostlyclean \ + mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \ + uninstall uninstall-am + + +# Tell versions [3.59,3.63) of GNU make to not export all variables. +# Otherwise a system limit (for SysV at least) may be exceeded. +.NOEXPORT: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/config/default.exp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/config/default.exp new file mode 100644 index 000000000..90967cccc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/config/default.exp @@ -0,0 +1 @@ +load_lib "standard.exp" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/lib/libffi-dg.exp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/lib/libffi-dg.exp new file mode 100644 index 000000000..304d2f550 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/lib/libffi-dg.exp @@ -0,0 +1,300 @@ +# Copyright (C) 2003, 2005, 2008, 2009 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +proc load_gcc_lib { filename } { + global srcdir + load_file $srcdir/lib/$filename +} + +load_lib dg.exp +load_lib libgloss.exp +load_gcc_lib target-libpath.exp +load_gcc_lib wrapper.exp + + +# Define libffi callbacks for dg.exp. + +proc libffi-dg-test-1 { target_compile prog do_what extra_tool_flags } { + + # To get all \n in dg-output test strings to match printf output + # in a system that outputs it as \015\012 (i.e. not just \012), we + # need to change all \n into \r?\n. As there is no dejagnu flag + # or hook to do that, we simply change the text being tested. + # Unfortunately, we have to know that the variable is called + # dg-output-text and lives in the caller of libffi-dg-test, which + # is two calls up. Overriding proc dg-output would be longer and + # would necessarily have the same assumption. + upvar 2 dg-output-text output_match + + if { [llength $output_match] > 1 } { + regsub -all "\n" [lindex $output_match 1] "\r?\n" x + set output_match [lreplace $output_match 1 1 $x] + } + + # Set up the compiler flags, based on what we're going to do. + + set options [list] + switch $do_what { + "compile" { + set compile_type "assembly" + set output_file "[file rootname [file tail $prog]].s" + } + "link" { + set compile_type "executable" + set output_file "[file rootname [file tail $prog]].exe" + # The following line is needed for targets like the i960 where + # the default output file is b.out. Sigh. + } + "run" { + set compile_type "executable" + # FIXME: "./" is to cope with "." not being in $PATH. + # Should this be handled elsewhere? + # YES. + set output_file "./[file rootname [file tail $prog]].exe" + # This is the only place where we care if an executable was + # created or not. If it was, dg.exp will try to run it. + remote_file build delete $output_file; + } + default { + perror "$do_what: not a valid dg-do keyword" + return "" + } + } + + if { $extra_tool_flags != "" } { + lappend options "additional_flags=$extra_tool_flags" + } + + set comp_output [libffi_target_compile "$prog" "$output_file" "$compile_type" $options]; + + + return [list $comp_output $output_file] +} + + +proc libffi-dg-test { prog do_what extra_tool_flags } { + return [libffi-dg-test-1 target_compile $prog $do_what $extra_tool_flags] +} + +proc libffi-init { args } { + global gluefile wrap_flags; + global srcdir + global blddirffi + global objdir + global TOOL_OPTIONS + global tool + global libffi_include + global libffi_link_flags + global tool_root_dir + global ld_library_path + + set blddirffi [pwd]/.. + verbose "libffi $blddirffi" + + set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] + if {$gccdir != ""} { + set gccdir [file dirname $gccdir] + } + verbose "gccdir $gccdir" + + set ld_library_path "." + append ld_library_path ":${gccdir}" + + set compiler "${gccdir}/xgcc" + if { [is_remote host] == 0 && [which $compiler] != 0 } { + foreach i "[exec $compiler --print-multi-lib]" { + set mldir "" + regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir + set mldir [string trimright $mldir "\;@"] + if { "$mldir" == "." } { + continue + } + if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } { + append ld_library_path ":${gccdir}/${mldir}" + } + } + } + # add the library path for libffi. + append ld_library_path ":${blddirffi}/.libs" + + verbose "ld_library_path: $ld_library_path" + + # Point to the Libffi headers in libffi. + set libffi_include "${blddirffi}/include" + verbose "libffi_include $libffi_include" + + set libffi_dir "${blddirffi}/.libs" + verbose "libffi_dir $libffi_dir" + if { $libffi_dir != "" } { + set libffi_dir [file dirname ${libffi_dir}] + set libffi_link_flags "-L${libffi_dir}/.libs" + } + + set_ld_library_path_env_vars + libffi_maybe_build_wrapper "${objdir}/testglue.o" +} + +proc libffi_exit { } { + global gluefile; + + if [info exists gluefile] { + file_on_build delete $gluefile; + unset gluefile; + } +} + +proc libffi_target_compile { source dest type options } { + global gluefile wrap_flags; + global srcdir + global blddirffi + global TOOL_OPTIONS + global libffi_link_flags + global libffi_include + global target_triplet + + + if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } { + lappend options "libs=${gluefile}" + lappend options "ldflags=$wrap_flags" + } + + # TOOL_OPTIONS must come first, so that it doesn't override testcase + # specific options. + if [info exists TOOL_OPTIONS] { + lappend options [concat "additional_flags=$TOOL_OPTIONS" $options]; + } + + # search for ffi_mips.h in srcdir, too + lappend options "additional_flags=-I${libffi_include} -I${srcdir}/../include -I${libffi_include}/.." + lappend options "additional_flags=${libffi_link_flags}" + + # Darwin needs a stack execution allowed flag. + + if { [istarget "*-*-darwin9*"] || [istarget "*-*-darwin1*"] + || [istarget "*-*-darwin2*"] } { + lappend options "additional_flags=-Wl,-allow_stack_execute" + } + + # If you're building the compiler with --prefix set to a place + # where it's not yet installed, then the linker won't be able to + # find the libgcc used by libffi.dylib. We could pass the + # -dylib_file option, but that's complicated, and it's much easier + # to just make the linker find libgcc using -L options. + if { [string match "*-*-darwin*" $target_triplet] } { + lappend options "libs= -shared-libgcc" + } + + if { [string match "*-*-openbsd*" $target_triplet] } { + lappend options "libs= -lpthread" + } + + lappend options "libs= -lffi" + + verbose "options: $options" + return [target_compile $source $dest $type $options] +} + +# Utility routines. + +# +# search_for -- looks for a string match in a file +# +proc search_for { file pattern } { + set fd [open $file r] + while { [gets $fd cur_line]>=0 } { + if [string match "*$pattern*" $cur_line] then { + close $fd + return 1 + } + } + close $fd + return 0 +} + +# Modified dg-runtest that can cycle through a list of optimization options +# as c-torture does. +proc libffi-dg-runtest { testcases default-extra-flags } { + global runtests + + foreach test $testcases { + # If we're only testing specific files and this isn't one of + # them, skip it. + if ![runtest_file_p $runtests $test] { + continue + } + + # Look for a loop within the source code - if we don't find one, + # don't pass -funroll[-all]-loops. + global torture_with_loops torture_without_loops + if [expr [search_for $test "for*("]+[search_for $test "while*("]] { + set option_list $torture_with_loops + } else { + set option_list $torture_without_loops + } + + set nshort [file tail [file dirname $test]]/[file tail $test] + + foreach flags $option_list { + verbose "Testing $nshort, $flags" 1 + dg-test $test $flags ${default-extra-flags} + } + } +} + + +# Like check_conditional_xfail, but callable from a dg test. + +proc dg-xfail-if { args } { + set args [lreplace $args 0 0] + set selector "target [join [lindex $args 1]]" + if { [dg-process-target $selector] == "S" } { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data $args + } +} + + +# We need to make sure that additional_files and additional_sources +# are both cleared out after every test. It is not enough to clear +# them out *before* the next test run because gcc-target-compile gets +# run directly from some .exp files (outside of any test). (Those +# uses should eventually be eliminated.) + +# Because the DG framework doesn't provide a hook that is run at the +# end of a test, we must replace dg-test with a wrapper. + +if { [info procs saved-dg-test] == [list] } { + rename dg-test saved-dg-test + + proc dg-test { args } { + global additional_files + global additional_sources + global errorInfo + + if { [ catch { eval saved-dg-test $args } errmsg ] } { + set saved_info $errorInfo + set additional_files "" + set additional_sources "" + error $errmsg $saved_info + } + set additional_files "" + set additional_sources "" + } +} + +# Local Variables: +# tcl-indent-level:4 +# End: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/lib/libffi.exp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/lib/libffi.exp new file mode 100644 index 000000000..4a65ed195 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/lib/libffi.exp @@ -0,0 +1,350 @@ +# Copyright (C) 2003, 2005, 2008, 2009, 2010, 2011 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING3. If not see +# . + +proc load_gcc_lib { filename } { + global srcdir + load_file $srcdir/lib/$filename +} + +load_lib dg.exp +load_lib libgloss.exp +load_gcc_lib target-libpath.exp +load_gcc_lib wrapper.exp + + +# Define libffi callbacks for dg.exp. + +proc libffi-dg-test-1 { target_compile prog do_what extra_tool_flags } { + + # To get all \n in dg-output test strings to match printf output + # in a system that outputs it as \015\012 (i.e. not just \012), we + # need to change all \n into \r?\n. As there is no dejagnu flag + # or hook to do that, we simply change the text being tested. + # Unfortunately, we have to know that the variable is called + # dg-output-text and lives in the caller of libffi-dg-test, which + # is two calls up. Overriding proc dg-output would be longer and + # would necessarily have the same assumption. + upvar 2 dg-output-text output_match + + if { [llength $output_match] > 1 } { + regsub -all "\n" [lindex $output_match 1] "\r?\n" x + set output_match [lreplace $output_match 1 1 $x] + } + + # Set up the compiler flags, based on what we're going to do. + + set options [list] + switch $do_what { + "compile" { + set compile_type "assembly" + set output_file "[file rootname [file tail $prog]].s" + } + "link" { + set compile_type "executable" + set output_file "[file rootname [file tail $prog]].exe" + # The following line is needed for targets like the i960 where + # the default output file is b.out. Sigh. + } + "run" { + set compile_type "executable" + # FIXME: "./" is to cope with "." not being in $PATH. + # Should this be handled elsewhere? + # YES. + set output_file "./[file rootname [file tail $prog]].exe" + # This is the only place where we care if an executable was + # created or not. If it was, dg.exp will try to run it. + remote_file build delete $output_file; + } + default { + perror "$do_what: not a valid dg-do keyword" + return "" + } + } + + if { $extra_tool_flags != "" } { + lappend options "additional_flags=$extra_tool_flags" + } + + set comp_output [libffi_target_compile "$prog" "$output_file" "$compile_type" $options]; + + + return [list $comp_output $output_file] +} + + +proc libffi-dg-test { prog do_what extra_tool_flags } { + return [libffi-dg-test-1 target_compile $prog $do_what $extra_tool_flags] +} + +proc libffi-init { args } { + global gluefile wrap_flags; + global srcdir + global blddirffi + global objdir + global TOOL_OPTIONS + global tool + global libffi_include + global libffi_link_flags + global tool_root_dir + global ld_library_path + + set blddirffi [pwd]/.. + verbose "libffi $blddirffi" + + set gccdir [lookfor_file $tool_root_dir gcc/libgcc.a] + if {$gccdir != ""} { + set gccdir [file dirname $gccdir] + } + verbose "gccdir $gccdir" + + set ld_library_path "." + append ld_library_path ":${gccdir}" + + set compiler "${gccdir}/xgcc" + if { [is_remote host] == 0 && [which $compiler] != 0 } { + foreach i "[exec $compiler --print-multi-lib]" { + set mldir "" + regexp -- "\[a-z0-9=_/\.-\]*;" $i mldir + set mldir [string trimright $mldir "\;@"] + if { "$mldir" == "." } { + continue + } + if { [llength [glob -nocomplain ${gccdir}/${mldir}/libgcc_s*.so.*]] >= 1 } { + append ld_library_path ":${gccdir}/${mldir}" + } + } + } + # add the library path for libffi. + append ld_library_path ":${blddirffi}/.libs" + + verbose "ld_library_path: $ld_library_path" + + # Point to the Libffi headers in libffi. + set libffi_include "${blddirffi}/include" + verbose "libffi_include $libffi_include" + + set libffi_dir "${blddirffi}/.libs" + verbose "libffi_dir $libffi_dir" + if { $libffi_dir != "" } { + set libffi_dir [file dirname ${libffi_dir}] + set libffi_link_flags "-L${libffi_dir}/.libs" + } + + set_ld_library_path_env_vars + libffi_maybe_build_wrapper "${objdir}/testglue.o" +} + +proc libffi_exit { } { + global gluefile; + + if [info exists gluefile] { + file_on_build delete $gluefile; + unset gluefile; + } +} + +proc libffi_target_compile { source dest type options } { + global gluefile wrap_flags; + global srcdir + global blddirffi + global TOOL_OPTIONS + global libffi_link_flags + global libffi_include + global target_triplet + + + if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } { + lappend options "libs=${gluefile}" + lappend options "ldflags=$wrap_flags" + } + + # TOOL_OPTIONS must come first, so that it doesn't override testcase + # specific options. + if [info exists TOOL_OPTIONS] { + lappend options [concat "additional_flags=$TOOL_OPTIONS" $options]; + } + + # search for ffi_mips.h in srcdir, too + lappend options "additional_flags=-I${libffi_include} -I${srcdir}/../include -I${libffi_include}/.." + lappend options "additional_flags=${libffi_link_flags}" + + # Darwin needs a stack execution allowed flag. + + if { [istarget "*-*-darwin9*"] || [istarget "*-*-darwin1*"] + || [istarget "*-*-darwin2*"] } { + lappend options "additional_flags=-Wl,-allow_stack_execute" + } + + # If you're building the compiler with --prefix set to a place + # where it's not yet installed, then the linker won't be able to + # find the libgcc used by libffi.dylib. We could pass the + # -dylib_file option, but that's complicated, and it's much easier + # to just make the linker find libgcc using -L options. + if { [string match "*-*-darwin*" $target_triplet] } { + lappend options "libs= -shared-libgcc" + } + + if { [string match "*-*-openbsd*" $target_triplet] } { + lappend options "libs= -lpthread" + } + + lappend options "libs= -lffi" + + verbose "options: $options" + return [target_compile $source $dest $type $options] +} + +# Utility routines. + +# +# search_for -- looks for a string match in a file +# +proc search_for { file pattern } { + set fd [open $file r] + while { [gets $fd cur_line]>=0 } { + if [string match "*$pattern*" $cur_line] then { + close $fd + return 1 + } + } + close $fd + return 0 +} + +# Modified dg-runtest that can cycle through a list of optimization options +# as c-torture does. +proc libffi-dg-runtest { testcases default-extra-flags } { + global runtests + + foreach test $testcases { + # If we're only testing specific files and this isn't one of + # them, skip it. + if ![runtest_file_p $runtests $test] { + continue + } + + # Look for a loop within the source code - if we don't find one, + # don't pass -funroll[-all]-loops. + global torture_with_loops torture_without_loops + if [expr [search_for $test "for*("]+[search_for $test "while*("]] { + set option_list $torture_with_loops + } else { + set option_list $torture_without_loops + } + + set nshort [file tail [file dirname $test]]/[file tail $test] + + foreach flags $option_list { + verbose "Testing $nshort, $flags" 1 + dg-test $test $flags ${default-extra-flags} + } + } +} + + +# Like check_conditional_xfail, but callable from a dg test. + +proc dg-xfail-if { args } { + set args [lreplace $args 0 0] + set selector "target [join [lindex $args 1]]" + if { [dg-process-target $selector] == "S" } { + global compiler_conditional_xfail_data + set compiler_conditional_xfail_data $args + } +} + +proc check-flags { args } { + + # The args are within another list; pull them out. + set args [lindex $args 0] + + # The next two arguments are optional. If they were not specified, + # use the defaults. + if { [llength $args] == 2 } { + lappend $args [list "*"] + } + if { [llength $args] == 3 } { + lappend $args [list ""] + } + + # If the option strings are the defaults, or the same as the + # defaults, there is no need to call check_conditional_xfail to + # compare them to the actual options. + if { [string compare [lindex $args 2] "*"] == 0 + && [string compare [lindex $args 3] "" ] == 0 } { + set result 1 + } else { + # The target list might be an effective-target keyword, so replace + # the original list with "*-*-*", since we already know it matches. + set result [check_conditional_xfail [lreplace $args 1 1 "*-*-*"]] + } + + return $result +} + +proc dg-skip-if { args } { + # Verify the number of arguments. The last two are optional. + set args [lreplace $args 0 0] + if { [llength $args] < 2 || [llength $args] > 4 } { + error "dg-skip-if 2: need 2, 3, or 4 arguments" + } + + # Don't bother if we're already skipping the test. + upvar dg-do-what dg-do-what + if { [lindex ${dg-do-what} 1] == "N" } { + return + } + + set selector [list target [lindex $args 1]] + if { [dg-process-target $selector] == "S" } { + if [check-flags $args] { + upvar dg-do-what dg-do-what + set dg-do-what [list [lindex ${dg-do-what} 0] "N" "P"] + } + } +} + +# We need to make sure that additional_files and additional_sources +# are both cleared out after every test. It is not enough to clear +# them out *before* the next test run because gcc-target-compile gets +# run directly from some .exp files (outside of any test). (Those +# uses should eventually be eliminated.) + +# Because the DG framework doesn't provide a hook that is run at the +# end of a test, we must replace dg-test with a wrapper. + +if { [info procs saved-dg-test] == [list] } { + rename dg-test saved-dg-test + + proc dg-test { args } { + global additional_files + global additional_sources + global errorInfo + + if { [ catch { eval saved-dg-test $args } errmsg ] } { + set saved_info $errorInfo + set additional_files "" + set additional_sources "" + error $errmsg $saved_info + } + set additional_files "" + set additional_sources "" + } +} + +# Local Variables: +# tcl-indent-level:4 +# End: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp new file mode 100644 index 000000000..8999aa479 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/lib/target-libpath.exp @@ -0,0 +1,263 @@ +# Copyright (C) 2004, 2005, 2007 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# This file was contributed by John David Anglin (dave.anglin@nrc-cnrc.gc.ca) + +set orig_environment_saved 0 +set orig_ld_library_path_saved 0 +set orig_ld_run_path_saved 0 +set orig_shlib_path_saved 0 +set orig_ld_libraryn32_path_saved 0 +set orig_ld_library64_path_saved 0 +set orig_ld_library_path_32_saved 0 +set orig_ld_library_path_64_saved 0 +set orig_dyld_library_path_saved 0 + + +####################################### +# proc set_ld_library_path_env_vars { } +####################################### + +proc set_ld_library_path_env_vars { } { + global ld_library_path + global orig_environment_saved + global orig_ld_library_path_saved + global orig_ld_run_path_saved + global orig_shlib_path_saved + global orig_ld_libraryn32_path_saved + global orig_ld_library64_path_saved + global orig_ld_library_path_32_saved + global orig_ld_library_path_64_saved + global orig_dyld_library_path_saved + global orig_ld_library_path + global orig_ld_run_path + global orig_shlib_path + global orig_ld_libraryn32_path + global orig_ld_library64_path + global orig_ld_library_path_32 + global orig_ld_library_path_64 + global orig_dyld_library_path + global GCC_EXEC_PREFIX + + # Set the relocated compiler prefix, but only if the user hasn't specified one. + if { [info exists GCC_EXEC_PREFIX] && ![info exists env(GCC_EXEC_PREFIX)] } { + setenv GCC_EXEC_PREFIX "$GCC_EXEC_PREFIX" + } + + # Setting the ld library path causes trouble when testing cross-compilers. + if { [is_remote target] } { + return + } + + if { $orig_environment_saved == 0 } { + global env + + set orig_environment_saved 1 + + # Save the original environment. + if [info exists env(LD_LIBRARY_PATH)] { + set orig_ld_library_path "$env(LD_LIBRARY_PATH)" + set orig_ld_library_path_saved 1 + } + if [info exists env(LD_RUN_PATH)] { + set orig_ld_run_path "$env(LD_RUN_PATH)" + set orig_ld_run_path_saved 1 + } + if [info exists env(SHLIB_PATH)] { + set orig_shlib_path "$env(SHLIB_PATH)" + set orig_shlib_path_saved 1 + } + if [info exists env(LD_LIBRARYN32_PATH)] { + set orig_ld_libraryn32_path "$env(LD_LIBRARYN32_PATH)" + set orig_ld_libraryn32_path_saved 1 + } + if [info exists env(LD_LIBRARY64_PATH)] { + set orig_ld_library64_path "$env(LD_LIBRARY64_PATH)" + set orig_ld_library64_path_saved 1 + } + if [info exists env(LD_LIBRARY_PATH_32)] { + set orig_ld_library_path_32 "$env(LD_LIBRARY_PATH_32)" + set orig_ld_library_path_32_saved 1 + } + if [info exists env(LD_LIBRARY_PATH_64)] { + set orig_ld_library_path_64 "$env(LD_LIBRARY_PATH_64)" + set orig_ld_library_path_64_saved 1 + } + if [info exists env(DYLD_LIBRARY_PATH)] { + set orig_dyld_library_path "$env(DYLD_LIBRARY_PATH)" + set orig_dyld_library_path_saved 1 + } + } + + # We need to set ld library path in the environment. Currently, + # unix.exp doesn't set the environment correctly for all systems. + # It only sets SHLIB_PATH and LD_LIBRARY_PATH when it executes a + # program. We also need the environment set for compilations, etc. + # + # On IRIX 6, we have to set variables akin to LD_LIBRARY_PATH, but + # called LD_LIBRARYN32_PATH (for the N32 ABI) and LD_LIBRARY64_PATH + # (for the 64-bit ABI). The same applies to Darwin (DYLD_LIBRARY_PATH), + # Solaris 32 bit (LD_LIBRARY_PATH_32), Solaris 64 bit (LD_LIBRARY_PATH_64), + # and HP-UX (SHLIB_PATH). In some cases, the variables are independent + # of LD_LIBRARY_PATH, and in other cases LD_LIBRARY_PATH is used if the + # variable is not defined. + # + # Doing this is somewhat of a hack as ld_library_path gets repeated in + # SHLIB_PATH and LD_LIBRARY_PATH when unix_load sets these variables. + if { $orig_ld_library_path_saved } { + setenv LD_LIBRARY_PATH "$ld_library_path:$orig_ld_library_path" + } else { + setenv LD_LIBRARY_PATH "$ld_library_path" + } + if { $orig_ld_run_path_saved } { + setenv LD_RUN_PATH "$ld_library_path:$orig_ld_run_path" + } else { + setenv LD_RUN_PATH "$ld_library_path" + } + # The default shared library dynamic path search for 64-bit + # HP-UX executables searches LD_LIBRARY_PATH before SHLIB_PATH. + # LD_LIBRARY_PATH isn't used for 32-bit executables. Thus, we + # set LD_LIBRARY_PATH and SHLIB_PATH as if they were independent. + if { $orig_shlib_path_saved } { + setenv SHLIB_PATH "$ld_library_path:$orig_shlib_path" + } else { + setenv SHLIB_PATH "$ld_library_path" + } + if { $orig_ld_libraryn32_path_saved } { + setenv LD_LIBRARYN32_PATH "$ld_library_path:$orig_ld_libraryn32_path" + } elseif { $orig_ld_library_path_saved } { + setenv LD_LIBRARYN32_PATH "$ld_library_path:$orig_ld_library_path" + } else { + setenv LD_LIBRARYN32_PATH "$ld_library_path" + } + if { $orig_ld_library64_path_saved } { + setenv LD_LIBRARY64_PATH "$ld_library_path:$orig_ld_library64_path" + } elseif { $orig_ld_library_path_saved } { + setenv LD_LIBRARY64_PATH "$ld_library_path:$orig_ld_library_path" + } else { + setenv LD_LIBRARY64_PATH "$ld_library_path" + } + if { $orig_ld_library_path_32_saved } { + setenv LD_LIBRARY_PATH_32 "$ld_library_path:$orig_ld_library_path_32" + } elseif { $orig_ld_library_path_saved } { + setenv LD_LIBRARY_PATH_32 "$ld_library_path:$orig_ld_library_path" + } else { + setenv LD_LIBRARY_PATH_32 "$ld_library_path" + } + if { $orig_ld_library_path_64_saved } { + setenv LD_LIBRARY_PATH_64 "$ld_library_path:$orig_ld_library_path_64" + } elseif { $orig_ld_library_path_saved } { + setenv LD_LIBRARY_PATH_64 "$ld_library_path:$orig_ld_library_path" + } else { + setenv LD_LIBRARY_PATH_64 "$ld_library_path" + } + if { $orig_dyld_library_path_saved } { + setenv DYLD_LIBRARY_PATH "$ld_library_path:$orig_dyld_library_path" + } else { + setenv DYLD_LIBRARY_PATH "$ld_library_path" + } + + verbose -log "set_ld_library_path_env_vars: ld_library_path=$ld_library_path" +} + +####################################### +# proc restore_ld_library_path_env_vars { } +####################################### + +proc restore_ld_library_path_env_vars { } { + global orig_environment_saved + global orig_ld_library_path_saved + global orig_ld_run_path_saved + global orig_shlib_path_saved + global orig_ld_libraryn32_path_saved + global orig_ld_library64_path_saved + global orig_ld_library_path_32_saved + global orig_ld_library_path_64_saved + global orig_dyld_library_path_saved + global orig_ld_library_path + global orig_ld_run_path + global orig_shlib_path + global orig_ld_libraryn32_path + global orig_ld_library64_path + global orig_ld_library_path_32 + global orig_ld_library_path_64 + global orig_dyld_library_path + + if { $orig_environment_saved == 0 } { + return + } + + if { $orig_ld_library_path_saved } { + setenv LD_LIBRARY_PATH "$orig_ld_library_path" + } elseif [info exists env(LD_LIBRARY_PATH)] { + unsetenv LD_LIBRARY_PATH + } + if { $orig_ld_run_path_saved } { + setenv LD_RUN_PATH "$orig_ld_run_path" + } elseif [info exists env(LD_RUN_PATH)] { + unsetenv LD_RUN_PATH + } + if { $orig_shlib_path_saved } { + setenv SHLIB_PATH "$orig_shlib_path" + } elseif [info exists env(SHLIB_PATH)] { + unsetenv SHLIB_PATH + } + if { $orig_ld_libraryn32_path_saved } { + setenv LD_LIBRARYN32_PATH "$orig_ld_libraryn32_path" + } elseif [info exists env(LD_LIBRARYN32_PATH)] { + unsetenv LD_LIBRARYN32_PATH + } + if { $orig_ld_library64_path_saved } { + setenv LD_LIBRARY64_PATH "$orig_ld_library64_path" + } elseif [info exists env(LD_LIBRARY64_PATH)] { + unsetenv LD_LIBRARY64_PATH + } + if { $orig_ld_library_path_32_saved } { + setenv LD_LIBRARY_PATH_32 "$orig_ld_library_path_32" + } elseif [info exists env(LD_LIBRARY_PATH_32)] { + unsetenv LD_LIBRARY_PATH_32 + } + if { $orig_ld_library_path_64_saved } { + setenv LD_LIBRARY_PATH_64 "$orig_ld_library_path_64" + } elseif [info exists env(LD_LIBRARY_PATH_64)] { + unsetenv LD_LIBRARY_PATH_64 + } + if { $orig_dyld_library_path_saved } { + setenv DYLD_LIBRARY_PATH "$orig_dyld_library_path" + } elseif [info exists env(DYLD_LIBRARY_PATH)] { + unsetenv DYLD_LIBRARY_PATH + } +} + +####################################### +# proc get_shlib_extension { } +####################################### + +proc get_shlib_extension { } { + global shlib_ext + + if { [ istarget *-*-darwin* ] } { + set shlib_ext "dylib" + } elseif { [ istarget *-*-cygwin* ] || [ istarget *-*-mingw* ] } { + set shlib_ext "dll" + } elseif { [ istarget hppa*-*-hpux* ] } { + set shlib_ext "sl" + } else { + set shlib_ext "so" + } + return $shlib_ext +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/lib/wrapper.exp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/lib/wrapper.exp new file mode 100644 index 000000000..4e5ae435a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/lib/wrapper.exp @@ -0,0 +1,45 @@ +# Copyright (C) 2004, 2007 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with GCC; see the file COPYING3. If not see +# . + +# This file contains GCC-specifics for status wrappers for test programs. + +# ${tool}_maybe_build_wrapper -- Build wrapper object if the target +# needs it. FILENAME is the path to the wrapper file. If there are +# additional arguments, they are command-line options to provide to +# the compiler when compiling FILENAME. + +proc ${tool}_maybe_build_wrapper { filename args } { + global gluefile wrap_flags + + if { [target_info needs_status_wrapper] != "" \ + && [target_info needs_status_wrapper] != "0" \ + && ![info exists gluefile] } { + set saved_wrap_compile_flags [target_info wrap_compile_flags] + set flags [join $args " "] + # The wrapper code may contain code that gcc objects on. This + # became true for dejagnu-1.4.4. The set of warnings and code + # that gcc objects on may change, so just make sure -w is always + # passed to turn off all warnings. + set_currtarget_info wrap_compile_flags \ + "$saved_wrap_compile_flags -w $flags" + set result [build_wrapper $filename] + set_currtarget_info wrap_compile_flags "$saved_wrap_compile_flags" + if { $result != "" } { + set gluefile [lindex $result 0] + set wrap_flags [lindex $result 1] + } + } +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/call.exp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/call.exp new file mode 100644 index 000000000..26acd813c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/call.exp @@ -0,0 +1,32 @@ +# Copyright (C) 2003, 2006, 2009, 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING3. If not see +# . + +dg-init +libffi-init + +global srcdir subdir + +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O0 -W -Wall" "" +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2" "" +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O3" "" +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-Os" "" +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] "-O2 -fomit-frame-pointer" "" + +dg-finish + +# Local Variables: +# tcl-indent-level:4 +# End: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn0.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn0.c new file mode 100644 index 000000000..a579ff6c9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn0.c @@ -0,0 +1,89 @@ +/* Area: closure_call + Purpose: Check multiple values passing from different type. + Also, exceed the limit of gpr and fpr registers on PowerPC + Darwin. + Limitations: none. + PR: none. + Originator: 20030828 */ + + + + +/* { dg-do run } */ +#include "ffitest.h" + +static void +closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata) +{ + *(ffi_arg*)resp = + (int)*(unsigned long long *)args[0] + (int)(*(int *)args[1]) + + (int)(*(unsigned long long *)args[2]) + (int)*(int *)args[3] + + (int)(*(signed short *)args[4]) + + (int)(*(unsigned long long *)args[5]) + + (int)*(int *)args[6] + (int)(*(int *)args[7]) + + (int)(*(double *)args[8]) + (int)*(int *)args[9] + + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + + (int)*(int *)args[12] + (int)(*(int *)args[13]) + + (int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata; + + printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", + (int)*(unsigned long long *)args[0], (int)(*(int *)args[1]), + (int)(*(unsigned long long *)args[2]), + (int)*(int *)args[3], (int)(*(signed short *)args[4]), + (int)(*(unsigned long long *)args[5]), + (int)*(int *)args[6], (int)(*(int *)args[7]), + (int)(*(double *)args[8]), (int)*(int *)args[9], + (int)(*(int *)args[10]), (int)(*(float *)args[11]), + (int)*(int *)args[12], (int)(*(int *)args[13]), + (int)(*(int *)args[14]),*(int *)args[15], + (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); + +} + +typedef int (*closure_test_type0)(unsigned long long, int, unsigned long long, + int, signed short, unsigned long long, int, + int, double, int, int, float, int, int, + int, int); + +int main (void) +{ + ffi_cif cif; + void * code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[17]; + int res; + + cl_arg_types[0] = &ffi_type_uint64; + cl_arg_types[1] = &ffi_type_sint; + cl_arg_types[2] = &ffi_type_uint64; + cl_arg_types[3] = &ffi_type_sint; + cl_arg_types[4] = &ffi_type_sshort; + cl_arg_types[5] = &ffi_type_uint64; + cl_arg_types[6] = &ffi_type_sint; + cl_arg_types[7] = &ffi_type_sint; + cl_arg_types[8] = &ffi_type_double; + cl_arg_types[9] = &ffi_type_sint; + cl_arg_types[10] = &ffi_type_sint; + cl_arg_types[11] = &ffi_type_float; + cl_arg_types[12] = &ffi_type_sint; + cl_arg_types[13] = &ffi_type_sint; + cl_arg_types[14] = &ffi_type_sint; + cl_arg_types[15] = &ffi_type_sint; + cl_arg_types[16] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, + &ffi_type_sint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0, + (void *) 3 /* userdata */, code) == FFI_OK); + + res = (*((closure_test_type0)code)) + (1LL, 2, 3LL, 4, 127, 429LL, 7, 8, 9.5, 10, 11, 12, 13, + 19, 21, 1); + /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ + printf("res: %d\n",res); + /* { dg-output "\nres: 680" } */ + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn1.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn1.c new file mode 100644 index 000000000..91231738c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn1.c @@ -0,0 +1,81 @@ +/* Area: closure_call. + Purpose: Check multiple values passing from different type. + Also, exceed the limit of gpr and fpr registers on PowerPC + Darwin. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + + +static void closure_test_fn1(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata) +{ + *(ffi_arg*)resp = + (int)*(float *)args[0] +(int)(*(float *)args[1]) + + (int)(*(float *)args[2]) + (int)*(float *)args[3] + + (int)(*(signed short *)args[4]) + (int)(*(float *)args[5]) + + (int)*(float *)args[6] + (int)(*(int *)args[7]) + + (int)(*(double*)args[8]) + (int)*(int *)args[9] + + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + + (int)*(int *)args[12] + (int)(*(int *)args[13]) + + (int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata; + + printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", + (int)*(float *)args[0], (int)(*(float *)args[1]), + (int)(*(float *)args[2]), (int)*(float *)args[3], + (int)(*(signed short *)args[4]), (int)(*(float *)args[5]), + (int)*(float *)args[6], (int)(*(int *)args[7]), + (int)(*(double *)args[8]), (int)*(int *)args[9], + (int)(*(int *)args[10]), (int)(*(float *)args[11]), + (int)*(int *)args[12], (int)(*(int *)args[13]), + (int)(*(int *)args[14]), *(int *)args[15], + (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); +} + +typedef int (*closure_test_type1)(float, float, float, float, signed short, + float, float, int, double, int, int, float, + int, int, int, int); +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[17]; + int res; + + cl_arg_types[0] = &ffi_type_float; + cl_arg_types[1] = &ffi_type_float; + cl_arg_types[2] = &ffi_type_float; + cl_arg_types[3] = &ffi_type_float; + cl_arg_types[4] = &ffi_type_sshort; + cl_arg_types[5] = &ffi_type_float; + cl_arg_types[6] = &ffi_type_float; + cl_arg_types[7] = &ffi_type_sint; + cl_arg_types[8] = &ffi_type_double; + cl_arg_types[9] = &ffi_type_sint; + cl_arg_types[10] = &ffi_type_sint; + cl_arg_types[11] = &ffi_type_float; + cl_arg_types[12] = &ffi_type_sint; + cl_arg_types[13] = &ffi_type_sint; + cl_arg_types[14] = &ffi_type_sint; + cl_arg_types[15] = &ffi_type_sint; + cl_arg_types[16] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, + &ffi_type_sint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn1, + (void *) 3 /* userdata */, code) == FFI_OK); + + res = (*((closure_test_type1)code)) + (1.1, 2.2, 3.3, 4.4, 127, 5.5, 6.6, 8, 9, 10, 11, 12.0, 13, + 19, 21, 1); + /* { dg-output "1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */ + printf("res: %d\n",res); + /* { dg-output "\nres: 255" } */ + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn2.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn2.c new file mode 100644 index 000000000..08ff9d922 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn2.c @@ -0,0 +1,81 @@ +/* Area: closure_call + Purpose: Check multiple values passing from different type. + Also, exceed the limit of gpr and fpr registers on PowerPC + Darwin. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +static void closure_test_fn2(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata) +{ + *(ffi_arg*)resp = + (int)*(double *)args[0] +(int)(*(double *)args[1]) + + (int)(*(double *)args[2]) + (int)*(double *)args[3] + + (int)(*(signed short *)args[4]) + (int)(*(double *)args[5]) + + (int)*(double *)args[6] + (int)(*(int *)args[7]) + + (int)(*(double *)args[8]) + (int)*(int *)args[9] + + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + + (int)*(int *)args[12] + (int)(*(float *)args[13]) + + (int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata; + + printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", + (int)*(double *)args[0], (int)(*(double *)args[1]), + (int)(*(double *)args[2]), (int)*(double *)args[3], + (int)(*(signed short *)args[4]), (int)(*(double *)args[5]), + (int)*(double *)args[6], (int)(*(int *)args[7]), + (int)(*(double*)args[8]), (int)*(int *)args[9], + (int)(*(int *)args[10]), (int)(*(float *)args[11]), + (int)*(int *)args[12], (int)(*(float *)args[13]), + (int)(*(int *)args[14]), *(int *)args[15], (int)(intptr_t)userdata, + (int)*(ffi_arg *)resp); +} + +typedef int (*closure_test_type2)(double, double, double, double, signed short, + double, double, int, double, int, int, float, + int, float, int, int); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[17]; + int res; + + cl_arg_types[0] = &ffi_type_double; + cl_arg_types[1] = &ffi_type_double; + cl_arg_types[2] = &ffi_type_double; + cl_arg_types[3] = &ffi_type_double; + cl_arg_types[4] = &ffi_type_sshort; + cl_arg_types[5] = &ffi_type_double; + cl_arg_types[6] = &ffi_type_double; + cl_arg_types[7] = &ffi_type_sint; + cl_arg_types[8] = &ffi_type_double; + cl_arg_types[9] = &ffi_type_sint; + cl_arg_types[10] = &ffi_type_sint; + cl_arg_types[11] = &ffi_type_float; + cl_arg_types[12] = &ffi_type_sint; + cl_arg_types[13] = &ffi_type_float; + cl_arg_types[14] = &ffi_type_sint; + cl_arg_types[15] = &ffi_type_sint; + cl_arg_types[16] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, + &ffi_type_sint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn2, + (void *) 3 /* userdata */, code) == FFI_OK); + + res = (*((closure_test_type2)code)) + (1, 2, 3, 4, 127, 5, 6, 8, 9, 10, 11, 12.0, 13, + 19.0, 21, 1); + /* { dg-output "1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */ + printf("res: %d\n",res); + /* { dg-output "\nres: 255" } */ + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn3.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn3.c new file mode 100644 index 000000000..9b54d805c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn3.c @@ -0,0 +1,82 @@ +/* Area: closure_call + Purpose: Check multiple values passing from different type. + Also, exceed the limit of gpr and fpr registers on PowerPC + Darwin. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +static void closure_test_fn3(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata) + { + *(ffi_arg*)resp = + (int)*(float *)args[0] +(int)(*(float *)args[1]) + + (int)(*(float *)args[2]) + (int)*(float *)args[3] + + (int)(*(float *)args[4]) + (int)(*(float *)args[5]) + + (int)*(float *)args[6] + (int)(*(float *)args[7]) + + (int)(*(double *)args[8]) + (int)*(int *)args[9] + + (int)(*(float *)args[10]) + (int)(*(float *)args[11]) + + (int)*(int *)args[12] + (int)(*(float *)args[13]) + + (int)(*(float *)args[14]) + *(int *)args[15] + (intptr_t)userdata; + + printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", + (int)*(float *)args[0], (int)(*(float *)args[1]), + (int)(*(float *)args[2]), (int)*(float *)args[3], + (int)(*(float *)args[4]), (int)(*(float *)args[5]), + (int)*(float *)args[6], (int)(*(float *)args[7]), + (int)(*(double *)args[8]), (int)*(int *)args[9], + (int)(*(float *)args[10]), (int)(*(float *)args[11]), + (int)*(int *)args[12], (int)(*(float *)args[13]), + (int)(*(float *)args[14]), *(int *)args[15], (int)(intptr_t)userdata, + (int)*(ffi_arg *)resp); + + } + +typedef int (*closure_test_type3)(float, float, float, float, float, float, + float, float, double, int, float, float, int, + float, float, int); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[17]; + int res; + + cl_arg_types[0] = &ffi_type_float; + cl_arg_types[1] = &ffi_type_float; + cl_arg_types[2] = &ffi_type_float; + cl_arg_types[3] = &ffi_type_float; + cl_arg_types[4] = &ffi_type_float; + cl_arg_types[5] = &ffi_type_float; + cl_arg_types[6] = &ffi_type_float; + cl_arg_types[7] = &ffi_type_float; + cl_arg_types[8] = &ffi_type_double; + cl_arg_types[9] = &ffi_type_sint; + cl_arg_types[10] = &ffi_type_float; + cl_arg_types[11] = &ffi_type_float; + cl_arg_types[12] = &ffi_type_sint; + cl_arg_types[13] = &ffi_type_float; + cl_arg_types[14] = &ffi_type_float; + cl_arg_types[15] = &ffi_type_sint; + cl_arg_types[16] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, + &ffi_type_sint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn3, + (void *) 3 /* userdata */, code) == FFI_OK); + + res = (*((closure_test_type3)code)) + (1.1, 2.2, 3.3, 4.4, 5.5, 6.6, 7.7, 8.8, 9, 10, 11.11, 12.0, 13, + 19.19, 21.21, 1); + /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 19 21 1 3: 135" } */ + printf("res: %d\n",res); + /* { dg-output "\nres: 135" } */ + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn4.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn4.c new file mode 100644 index 000000000..d4a1530b0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn4.c @@ -0,0 +1,89 @@ +/* Area: closure_call + Purpose: Check multiple long long values passing. + Also, exceed the limit of gpr and fpr registers on PowerPC + Darwin. + Limitations: none. + PR: none. + Originator: 20031026 */ + +/* { dg-do run } */ + +#include "ffitest.h" + +static void +closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata) +{ + *(ffi_arg*)resp = + (int)*(unsigned long long *)args[0] + (int)*(unsigned long long *)args[1] + + (int)*(unsigned long long *)args[2] + (int)*(unsigned long long *)args[3] + + (int)*(unsigned long long *)args[4] + (int)*(unsigned long long *)args[5] + + (int)*(unsigned long long *)args[6] + (int)*(unsigned long long *)args[7] + + (int)*(unsigned long long *)args[8] + (int)*(unsigned long long *)args[9] + + (int)*(unsigned long long *)args[10] + + (int)*(unsigned long long *)args[11] + + (int)*(unsigned long long *)args[12] + + (int)*(unsigned long long *)args[13] + + (int)*(unsigned long long *)args[14] + + *(int *)args[15] + (intptr_t)userdata; + + printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", + (int)*(unsigned long long *)args[0], + (int)*(unsigned long long *)args[1], + (int)*(unsigned long long *)args[2], + (int)*(unsigned long long *)args[3], + (int)*(unsigned long long *)args[4], + (int)*(unsigned long long *)args[5], + (int)*(unsigned long long *)args[6], + (int)*(unsigned long long *)args[7], + (int)*(unsigned long long *)args[8], + (int)*(unsigned long long *)args[9], + (int)*(unsigned long long *)args[10], + (int)*(unsigned long long *)args[11], + (int)*(unsigned long long *)args[12], + (int)*(unsigned long long *)args[13], + (int)*(unsigned long long *)args[14], + *(int *)args[15], + (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); + +} + +typedef int (*closure_test_type0)(unsigned long long, unsigned long long, + unsigned long long, unsigned long long, + unsigned long long, unsigned long long, + unsigned long long, unsigned long long, + unsigned long long, unsigned long long, + unsigned long long, unsigned long long, + unsigned long long, unsigned long long, + unsigned long long, int); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[17]; + int i, res; + + for (i = 0; i < 15; i++) { + cl_arg_types[i] = &ffi_type_uint64; + } + cl_arg_types[15] = &ffi_type_sint; + cl_arg_types[16] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, + &ffi_type_sint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0, + (void *) 3 /* userdata */, code) == FFI_OK); + + res = (*((closure_test_type0)code)) + (1LL, 2LL, 3LL, 4LL, 127LL, 429LL, 7LL, 8LL, 9LL, 10LL, 11LL, 12LL, + 13LL, 19LL, 21LL, 1); + /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ + printf("res: %d\n",res); + /* { dg-output "\nres: 680" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn5.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn5.c new file mode 100644 index 000000000..99074426c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn5.c @@ -0,0 +1,92 @@ +/* Area: closure_call + Purpose: Check multiple long long values passing. + Exceed the limit of gpr registers on PowerPC + Darwin. + Limitations: none. + PR: none. + Originator: 20031026 */ + +/* { dg-do run } */ +#include "ffitest.h" + +static void +closure_test_fn5(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata) +{ + *(ffi_arg*)resp = + (int)*(unsigned long long *)args[0] + (int)*(unsigned long long *)args[1] + + (int)*(unsigned long long *)args[2] + (int)*(unsigned long long *)args[3] + + (int)*(unsigned long long *)args[4] + (int)*(unsigned long long *)args[5] + + (int)*(unsigned long long *)args[6] + (int)*(unsigned long long *)args[7] + + (int)*(unsigned long long *)args[8] + (int)*(unsigned long long *)args[9] + + (int)*(int *)args[10] + + (int)*(unsigned long long *)args[11] + + (int)*(unsigned long long *)args[12] + + (int)*(unsigned long long *)args[13] + + (int)*(unsigned long long *)args[14] + + *(int *)args[15] + (intptr_t)userdata; + + printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", + (int)*(unsigned long long *)args[0], + (int)*(unsigned long long *)args[1], + (int)*(unsigned long long *)args[2], + (int)*(unsigned long long *)args[3], + (int)*(unsigned long long *)args[4], + (int)*(unsigned long long *)args[5], + (int)*(unsigned long long *)args[6], + (int)*(unsigned long long *)args[7], + (int)*(unsigned long long *)args[8], + (int)*(unsigned long long *)args[9], + (int)*(int *)args[10], + (int)*(unsigned long long *)args[11], + (int)*(unsigned long long *)args[12], + (int)*(unsigned long long *)args[13], + (int)*(unsigned long long *)args[14], + *(int *)args[15], + (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); + +} + +typedef int (*closure_test_type0)(unsigned long long, unsigned long long, + unsigned long long, unsigned long long, + unsigned long long, unsigned long long, + unsigned long long, unsigned long long, + unsigned long long, unsigned long long, + int, unsigned long long, + unsigned long long, unsigned long long, + unsigned long long, int); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[17]; + int i, res; + + for (i = 0; i < 10; i++) { + cl_arg_types[i] = &ffi_type_uint64; + } + cl_arg_types[10] = &ffi_type_sint; + for (i = 11; i < 15; i++) { + cl_arg_types[i] = &ffi_type_uint64; + } + cl_arg_types[15] = &ffi_type_sint; + cl_arg_types[16] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, + &ffi_type_sint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn5, + (void *) 3 /* userdata */, code) == FFI_OK); + + res = (*((closure_test_type0)code)) + (1LL, 2LL, 3LL, 4LL, 127LL, 429LL, 7LL, 8LL, 9LL, 10LL, 11, 12LL, + 13LL, 19LL, 21LL, 1); + /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ + printf("res: %d\n",res); + /* { dg-output "\nres: 680" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn6.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn6.c new file mode 100644 index 000000000..73c54fd6b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_fn6.c @@ -0,0 +1,90 @@ +/* Area: closure_call + Purpose: Check multiple values passing from different type. + Also, exceed the limit of gpr and fpr registers on PowerPC. + Limitations: none. + PR: PR23404 + Originator: 20050830 */ + +/* { dg-do run } */ +#include "ffitest.h" + +static void +closure_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata) +{ + *(ffi_arg*)resp = + (int)*(unsigned long long *)args[0] + + (int)(*(unsigned long long *)args[1]) + + (int)(*(unsigned long long *)args[2]) + + (int)*(unsigned long long *)args[3] + + (int)(*(int *)args[4]) + (int)(*(double *)args[5]) + + (int)*(double *)args[6] + (int)(*(float *)args[7]) + + (int)(*(double *)args[8]) + (int)*(double *)args[9] + + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + + (int)*(int *)args[12] + (int)(*(int *)args[13]) + + (int)(*(double *)args[14]) + (int)*(double *)args[15] + + (intptr_t)userdata; + + printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", + (int)*(unsigned long long *)args[0], + (int)(*(unsigned long long *)args[1]), + (int)(*(unsigned long long *)args[2]), + (int)*(unsigned long long *)args[3], + (int)(*(int *)args[4]), (int)(*(double *)args[5]), + (int)*(double *)args[6], (int)(*(float *)args[7]), + (int)(*(double *)args[8]), (int)*(double *)args[9], + (int)(*(int *)args[10]), (int)(*(float *)args[11]), + (int)*(int *)args[12], (int)(*(int *)args[13]), + (int)(*(double *)args[14]), (int)(*(double *)args[15]), + (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); + +} + +typedef int (*closure_test_type0)(unsigned long long, + unsigned long long, + unsigned long long, + unsigned long long, + int, double, double, float, double, double, + int, float, int, int, double, double); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[17]; + int res; + + cl_arg_types[0] = &ffi_type_uint64; + cl_arg_types[1] = &ffi_type_uint64; + cl_arg_types[2] = &ffi_type_uint64; + cl_arg_types[3] = &ffi_type_uint64; + cl_arg_types[4] = &ffi_type_sint; + cl_arg_types[5] = &ffi_type_double; + cl_arg_types[6] = &ffi_type_double; + cl_arg_types[7] = &ffi_type_float; + cl_arg_types[8] = &ffi_type_double; + cl_arg_types[9] = &ffi_type_double; + cl_arg_types[10] = &ffi_type_sint; + cl_arg_types[11] = &ffi_type_float; + cl_arg_types[12] = &ffi_type_sint; + cl_arg_types[13] = &ffi_type_sint; + cl_arg_types[14] = &ffi_type_double; + cl_arg_types[15] = &ffi_type_double; + cl_arg_types[16] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, + &ffi_type_sint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn0, + (void *) 3 /* userdata */, code) == FFI_OK); + + res = (*((closure_test_type0)code)) + (1, 2, 3, 4, 127, 429., 7., 8., 9.5, 10., 11, 12., 13, + 19, 21., 1.); + /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ + printf("res: %d\n",res); + /* { dg-output "\nres: 680" } */ + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_loc_fn0.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_loc_fn0.c new file mode 100644 index 000000000..b3afa0bbd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_loc_fn0.c @@ -0,0 +1,95 @@ +/* Area: closure_call + Purpose: Check multiple values passing from different type. + Also, exceed the limit of gpr and fpr registers on PowerPC + Darwin. + Limitations: none. + PR: none. + Originator: 20030828 */ + + + + +/* { dg-do run } */ +#include "ffitest.h" + +static void +closure_loc_test_fn0(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata) +{ + *(ffi_arg*)resp = + (int)*(unsigned long long *)args[0] + (int)(*(int *)args[1]) + + (int)(*(unsigned long long *)args[2]) + (int)*(int *)args[3] + + (int)(*(signed short *)args[4]) + + (int)(*(unsigned long long *)args[5]) + + (int)*(int *)args[6] + (int)(*(int *)args[7]) + + (int)(*(double *)args[8]) + (int)*(int *)args[9] + + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + + (int)*(int *)args[12] + (int)(*(int *)args[13]) + + (int)(*(int *)args[14]) + *(int *)args[15] + (intptr_t)userdata; + + printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", + (int)*(unsigned long long *)args[0], (int)(*(int *)args[1]), + (int)(*(unsigned long long *)args[2]), + (int)*(int *)args[3], (int)(*(signed short *)args[4]), + (int)(*(unsigned long long *)args[5]), + (int)*(int *)args[6], (int)(*(int *)args[7]), + (int)(*(double *)args[8]), (int)*(int *)args[9], + (int)(*(int *)args[10]), (int)(*(float *)args[11]), + (int)*(int *)args[12], (int)(*(int *)args[13]), + (int)(*(int *)args[14]),*(int *)args[15], + (int)(intptr_t)userdata, (int)*(ffi_arg *)resp); + +} + +typedef int (*closure_loc_test_type0)(unsigned long long, int, unsigned long long, + int, signed short, unsigned long long, int, + int, double, int, int, float, int, int, + int, int); + +int main (void) +{ + ffi_cif cif; + ffi_closure *pcl; + ffi_type * cl_arg_types[17]; + int res; + void *codeloc; + + cl_arg_types[0] = &ffi_type_uint64; + cl_arg_types[1] = &ffi_type_sint; + cl_arg_types[2] = &ffi_type_uint64; + cl_arg_types[3] = &ffi_type_sint; + cl_arg_types[4] = &ffi_type_sshort; + cl_arg_types[5] = &ffi_type_uint64; + cl_arg_types[6] = &ffi_type_sint; + cl_arg_types[7] = &ffi_type_sint; + cl_arg_types[8] = &ffi_type_double; + cl_arg_types[9] = &ffi_type_sint; + cl_arg_types[10] = &ffi_type_sint; + cl_arg_types[11] = &ffi_type_float; + cl_arg_types[12] = &ffi_type_sint; + cl_arg_types[13] = &ffi_type_sint; + cl_arg_types[14] = &ffi_type_sint; + cl_arg_types[15] = &ffi_type_sint; + cl_arg_types[16] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, + &ffi_type_sint, cl_arg_types) == FFI_OK); + + pcl = ffi_closure_alloc(sizeof(ffi_closure), &codeloc); + CHECK(pcl != NULL); + CHECK(codeloc != NULL); + + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_loc_test_fn0, + (void *) 3 /* userdata */, codeloc) == FFI_OK); + + CHECK(memcmp(pcl, codeloc, sizeof(*pcl)) == 0); + + res = (*((closure_loc_test_type0)codeloc)) + (1LL, 2, 3LL, 4, 127, 429LL, 7, 8, 9.5, 10, 11, 12, 13, + 19, 21, 1); + /* { dg-output "1 2 3 4 127 429 7 8 9 10 11 12 13 19 21 1 3: 680" } */ + printf("res: %d\n",res); + /* { dg-output "\nres: 680" } */ + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_stdcall.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_stdcall.c new file mode 100644 index 000000000..6bfcc1fbb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/closure_stdcall.c @@ -0,0 +1,64 @@ +/* Area: closure_call (stdcall convention) + Purpose: Check handling when caller expects stdcall callee + Limitations: none. + PR: none. + Originator: */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ +#include "ffitest.h" + +static void +closure_test_stdcall(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata) +{ + *(ffi_arg*)resp = + (int)*(int *)args[0] + (int)(*(int *)args[1]) + + (int)(*(int *)args[2]) + (int)(*(int *)args[3]) + + (int)(intptr_t)userdata; + + printf("%d %d %d %d: %d\n", + (int)*(int *)args[0], (int)(*(int *)args[1]), + (int)(*(int *)args[2]), (int)(*(int *)args[3]), + (int)*(ffi_arg *)resp); + +} + +typedef int (__stdcall *closure_test_type0)(int, int, int, int); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[17]; + int res; + void* sp_pre; + void* sp_post; + char buf[1024]; + + cl_arg_types[0] = &ffi_type_uint; + cl_arg_types[1] = &ffi_type_uint; + cl_arg_types[2] = &ffi_type_uint; + cl_arg_types[3] = &ffi_type_uint; + cl_arg_types[4] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 4, + &ffi_type_sint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_stdcall, + (void *) 3 /* userdata */, code) == FFI_OK); + + asm volatile (" movl %%esp,%0" : "=g" (sp_pre)); + res = (*(closure_test_type0)code)(0, 1, 2, 3); + asm volatile (" movl %%esp,%0" : "=g" (sp_post)); + /* { dg-output "0 1 2 3: 9" } */ + + printf("res: %d\n",res); + /* { dg-output "\nres: 9" } */ + + sprintf(buf, "mismatch: pre=%p vs post=%p", sp_pre, sp_post); + printf("stack pointer %s\n", (sp_pre == sp_post ? "match" : buf)); + /* { dg-output "\nstack pointer match" } */ + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_12byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_12byte.c new file mode 100644 index 000000000..f0a334fa7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_12byte.c @@ -0,0 +1,94 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_12byte { + int a; + int b; + int c; +} cls_struct_12byte; + +cls_struct_12byte cls_struct_12byte_fn(struct cls_struct_12byte b1, + struct cls_struct_12byte b2) +{ + struct cls_struct_12byte result; + + result.a = b1.a + b2.a; + result.b = b1.b + b2.b; + result.c = b1.c + b2.c; + + printf("%d %d %d %d %d %d: %d %d %d\n", b1.a, b1.b, b1.c, b2.a, b2.b, b2.c, + result.a, result.b, result.c); + + return result; +} + +static void cls_struct_12byte_gn(ffi_cif* cif __UNUSED__, void* resp, + void** args , void* userdata __UNUSED__) +{ + struct cls_struct_12byte b1, b2; + + b1 = *(struct cls_struct_12byte*)(args[0]); + b2 = *(struct cls_struct_12byte*)(args[1]); + + *(cls_struct_12byte*)resp = cls_struct_12byte_fn(b1, b2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_12byte h_dbl = { 7, 4, 9 }; + struct cls_struct_12byte j_dbl = { 1, 5, 3 }; + struct cls_struct_12byte res_dbl; + + cls_struct_fields[0] = &ffi_type_sint; + cls_struct_fields[1] = &ffi_type_sint; + cls_struct_fields[2] = &ffi_type_sint; + cls_struct_fields[3] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &h_dbl; + args_dbl[1] = &j_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_12byte_fn), &res_dbl, args_dbl); + /* { dg-output "7 4 9 1 5 3: 8 9 12" } */ + printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 8 9 12" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_12byte_gn, NULL, code) == FFI_OK); + + res_dbl.a = 0; + res_dbl.b = 0; + res_dbl.c = 0; + + res_dbl = ((cls_struct_12byte(*)(cls_struct_12byte, cls_struct_12byte))(code))(h_dbl, j_dbl); + /* { dg-output "\n7 4 9 1 5 3: 8 9 12" } */ + printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 8 9 12" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_16byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_16byte.c new file mode 100644 index 000000000..9b9292ab0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_16byte.c @@ -0,0 +1,95 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Depending on the ABI. Check overlapping. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_16byte { + int a; + double b; + int c; +} cls_struct_16byte; + +cls_struct_16byte cls_struct_16byte_fn(struct cls_struct_16byte b1, + struct cls_struct_16byte b2) +{ + struct cls_struct_16byte result; + + result.a = b1.a + b2.a; + result.b = b1.b + b2.b; + result.c = b1.c + b2.c; + + printf("%d %g %d %d %g %d: %d %g %d\n", b1.a, b1.b, b1.c, b2.a, b2.b, b2.c, + result.a, result.b, result.c); + + return result; +} + +static void cls_struct_16byte_gn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + struct cls_struct_16byte b1, b2; + + b1 = *(struct cls_struct_16byte*)(args[0]); + b2 = *(struct cls_struct_16byte*)(args[1]); + + *(cls_struct_16byte*)resp = cls_struct_16byte_fn(b1, b2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_16byte h_dbl = { 7, 8.0, 9 }; + struct cls_struct_16byte j_dbl = { 1, 9.0, 3 }; + struct cls_struct_16byte res_dbl; + + cls_struct_fields[0] = &ffi_type_sint; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = &ffi_type_sint; + cls_struct_fields[3] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &h_dbl; + args_dbl[1] = &j_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_16byte_fn), &res_dbl, args_dbl); + /* { dg-output "7 8 9 1 9 3: 8 17 12" } */ + printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 8 17 12" } */ + + res_dbl.a = 0; + res_dbl.b = 0.0; + res_dbl.c = 0; + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_16byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_16byte(*)(cls_struct_16byte, cls_struct_16byte))(code))(h_dbl, j_dbl); + /* { dg-output "\n7 8 9 1 9 3: 8 17 12" } */ + printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 8 17 12" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_18byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_18byte.c new file mode 100644 index 000000000..40c8c6d96 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_18byte.c @@ -0,0 +1,96 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Depending on the ABI. Double alignment check on darwin. + Limitations: none. + PR: none. + Originator: 20030915 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_18byte { + double a; + unsigned char b; + unsigned char c; + double d; +} cls_struct_18byte; + +cls_struct_18byte cls_struct_18byte_fn(struct cls_struct_18byte a1, + struct cls_struct_18byte a2) +{ + struct cls_struct_18byte result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + result.d = a1.d + a2.d; + + + printf("%g %d %d %g %g %d %d %g: %g %d %d %g\n", a1.a, a1.b, a1.c, a1.d, + a2.a, a2.b, a2.c, a2.d, + result.a, result.b, result.c, result.d); + return result; +} + +static void +cls_struct_18byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct cls_struct_18byte a1, a2; + + a1 = *(struct cls_struct_18byte*)(args[0]); + a2 = *(struct cls_struct_18byte*)(args[1]); + + *(cls_struct_18byte*)resp = cls_struct_18byte_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[3]; + ffi_type* cls_struct_fields[5]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[3]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_18byte g_dbl = { 1.0, 127, 126, 3.0 }; + struct cls_struct_18byte f_dbl = { 4.0, 125, 124, 5.0 }; + struct cls_struct_18byte res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_uchar; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = &ffi_type_double; + cls_struct_fields[4] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_18byte_fn), &res_dbl, args_dbl); + /* { dg-output "1 127 126 3 4 125 124 5: 5 252 250 8" } */ + printf("res: %g %d %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); + /* { dg-output "\nres: 5 252 250 8" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_18byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_18byte(*)(cls_struct_18byte, cls_struct_18byte))(code))(g_dbl, f_dbl); + /* { dg-output "\n1 127 126 3 4 125 124 5: 5 252 250 8" } */ + printf("res: %g %d %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); + /* { dg-output "\nres: 5 252 250 8" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_19byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_19byte.c new file mode 100644 index 000000000..aa6424818 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_19byte.c @@ -0,0 +1,102 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Depending on the ABI. Double alignment check on darwin. + Limitations: none. + PR: none. + Originator: 20030915 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_19byte { + double a; + unsigned char b; + unsigned char c; + double d; + unsigned char e; +} cls_struct_19byte; + +cls_struct_19byte cls_struct_19byte_fn(struct cls_struct_19byte a1, + struct cls_struct_19byte a2) +{ + struct cls_struct_19byte result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + result.d = a1.d + a2.d; + result.e = a1.e + a2.e; + + + printf("%g %d %d %g %d %g %d %d %g %d: %g %d %d %g %d\n", + a1.a, a1.b, a1.c, a1.d, a1.e, + a2.a, a2.b, a2.c, a2.d, a2.e, + result.a, result.b, result.c, result.d, result.e); + return result; +} + +static void +cls_struct_19byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct cls_struct_19byte a1, a2; + + a1 = *(struct cls_struct_19byte*)(args[0]); + a2 = *(struct cls_struct_19byte*)(args[1]); + + *(cls_struct_19byte*)resp = cls_struct_19byte_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[3]; + ffi_type* cls_struct_fields[6]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[3]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_19byte g_dbl = { 1.0, 127, 126, 3.0, 120 }; + struct cls_struct_19byte f_dbl = { 4.0, 125, 124, 5.0, 119 }; + struct cls_struct_19byte res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_uchar; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = &ffi_type_double; + cls_struct_fields[4] = &ffi_type_uchar; + cls_struct_fields[5] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_19byte_fn), &res_dbl, args_dbl); + /* { dg-output "1 127 126 3 120 4 125 124 5 119: 5 252 250 8 239" } */ + printf("res: %g %d %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e); + /* { dg-output "\nres: 5 252 250 8 239" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_19byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_19byte(*)(cls_struct_19byte, cls_struct_19byte))(code))(g_dbl, f_dbl); + /* { dg-output "\n1 127 126 3 120 4 125 124 5 119: 5 252 250 8 239" } */ + printf("res: %g %d %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e); + /* { dg-output "\nres: 5 252 250 8 239" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_1_1byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_1_1byte.c new file mode 100644 index 000000000..b9402d678 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_1_1byte.c @@ -0,0 +1,89 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Especially with small structures which may fit in one + register. Depending on the ABI. + Limitations: none. + PR: none. + Originator: 20030902 */ + + + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_1_1byte { + unsigned char a; +} cls_struct_1_1byte; + +cls_struct_1_1byte cls_struct_1_1byte_fn(struct cls_struct_1_1byte a1, + struct cls_struct_1_1byte a2) +{ + struct cls_struct_1_1byte result; + + result.a = a1.a + a2.a; + + printf("%d %d: %d\n", a1.a, a2.a, result.a); + + return result; +} + +static void +cls_struct_1_1byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_1_1byte a1, a2; + + a1 = *(struct cls_struct_1_1byte*)(args[0]); + a2 = *(struct cls_struct_1_1byte*)(args[1]); + + *(cls_struct_1_1byte*)resp = cls_struct_1_1byte_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[2]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_1_1byte g_dbl = { 12 }; + struct cls_struct_1_1byte f_dbl = { 178 }; + struct cls_struct_1_1byte res_dbl; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_1_1byte_fn), &res_dbl, args_dbl); + /* { dg-output "12 178: 190" } */ + printf("res: %d\n", res_dbl.a); + /* { dg-output "\nres: 190" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_1_1byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_1_1byte(*)(cls_struct_1_1byte, cls_struct_1_1byte))(code))(g_dbl, f_dbl); + /* { dg-output "\n12 178: 190" } */ + printf("res: %d\n", res_dbl.a); + /* { dg-output "\nres: 190" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte.c new file mode 100644 index 000000000..80dd7ac93 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte.c @@ -0,0 +1,91 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Depending on the ABI. Check overlapping. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_20byte { + double a; + double b; + int c; +} cls_struct_20byte; + +cls_struct_20byte cls_struct_20byte_fn(struct cls_struct_20byte a1, + struct cls_struct_20byte a2) +{ + struct cls_struct_20byte result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + + printf("%g %g %d %g %g %d: %g %g %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, + result.a, result.b, result.c); + return result; +} + +static void +cls_struct_20byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct cls_struct_20byte a1, a2; + + a1 = *(struct cls_struct_20byte*)(args[0]); + a2 = *(struct cls_struct_20byte*)(args[1]); + + *(cls_struct_20byte*)resp = cls_struct_20byte_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_20byte g_dbl = { 1.0, 2.0, 3 }; + struct cls_struct_20byte f_dbl = { 4.0, 5.0, 7 }; + struct cls_struct_20byte res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = &ffi_type_sint; + cls_struct_fields[3] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_20byte_fn), &res_dbl, args_dbl); + /* { dg-output "1 2 3 4 5 7: 5 7 10" } */ + printf("res: %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 5 7 10" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_20byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(code))(g_dbl, f_dbl); + /* { dg-output "\n1 2 3 4 5 7: 5 7 10" } */ + printf("res: %g %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 5 7 10" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte1.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte1.c new file mode 100644 index 000000000..50bcbbf83 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte1.c @@ -0,0 +1,93 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Depending on the ABI. Check overlapping. + Limitations: none. + PR: none. + Originator: 20030828 */ + + + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_20byte { + int a; + double b; + double c; +} cls_struct_20byte; + +cls_struct_20byte cls_struct_20byte_fn(struct cls_struct_20byte a1, + struct cls_struct_20byte a2) +{ + struct cls_struct_20byte result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + + printf("%d %g %g %d %g %g: %d %g %g\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, + result.a, result.b, result.c); + return result; +} + +static void +cls_struct_20byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct cls_struct_20byte a1, a2; + + a1 = *(struct cls_struct_20byte*)(args[0]); + a2 = *(struct cls_struct_20byte*)(args[1]); + + *(cls_struct_20byte*)resp = cls_struct_20byte_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[3]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[3]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_20byte g_dbl = { 1, 2.0, 3.0 }; + struct cls_struct_20byte f_dbl = { 4, 5.0, 7.0 }; + struct cls_struct_20byte res_dbl; + + cls_struct_fields[0] = &ffi_type_sint; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = &ffi_type_double; + cls_struct_fields[3] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_20byte_fn), &res_dbl, args_dbl); + /* { dg-output "1 2 3 4 5 7: 5 7 10" } */ + printf("res: %d %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 5 7 10" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_20byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_20byte(*)(cls_struct_20byte, cls_struct_20byte))(code))(g_dbl, f_dbl); + /* { dg-output "\n1 2 3 4 5 7: 5 7 10" } */ + printf("res: %d %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 5 7 10" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_24byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_24byte.c new file mode 100644 index 000000000..46a6eb4d3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_24byte.c @@ -0,0 +1,113 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Depending on the ABI. Check overlapping. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_24byte { + double a; + double b; + int c; + float d; +} cls_struct_24byte; + +cls_struct_24byte cls_struct_24byte_fn(struct cls_struct_24byte b0, + struct cls_struct_24byte b1, + struct cls_struct_24byte b2, + struct cls_struct_24byte b3) +{ + struct cls_struct_24byte result; + + result.a = b0.a + b1.a + b2.a + b3.a; + result.b = b0.b + b1.b + b2.b + b3.b; + result.c = b0.c + b1.c + b2.c + b3.c; + result.d = b0.d + b1.d + b2.d + b3.d; + + printf("%g %g %d %g %g %g %d %g %g %g %d %g %g %g %d %g: %g %g %d %g\n", + b0.a, b0.b, b0.c, b0.d, + b1.a, b1.b, b1.c, b1.d, + b2.a, b2.b, b2.c, b2.d, + b3.a, b3.b, b3.c, b2.d, + result.a, result.b, result.c, result.d); + + return result; +} + +static void +cls_struct_24byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct cls_struct_24byte b0, b1, b2, b3; + + b0 = *(struct cls_struct_24byte*)(args[0]); + b1 = *(struct cls_struct_24byte*)(args[1]); + b2 = *(struct cls_struct_24byte*)(args[2]); + b3 = *(struct cls_struct_24byte*)(args[3]); + + *(cls_struct_24byte*)resp = cls_struct_24byte_fn(b0, b1, b2, b3); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[5]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_24byte e_dbl = { 9.0, 2.0, 6, 5.0 }; + struct cls_struct_24byte f_dbl = { 1.0, 2.0, 3, 7.0 }; + struct cls_struct_24byte g_dbl = { 4.0, 5.0, 7, 9.0 }; + struct cls_struct_24byte h_dbl = { 8.0, 6.0, 1, 4.0 }; + struct cls_struct_24byte res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = &ffi_type_sint; + cls_struct_fields[3] = &ffi_type_float; + cls_struct_fields[4] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = &cls_struct_type; + dbl_arg_types[3] = &cls_struct_type; + dbl_arg_types[4] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = &h_dbl; + args_dbl[4] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_24byte_fn), &res_dbl, args_dbl); + /* { dg-output "9 2 6 5 1 2 3 7 4 5 7 9 8 6 1 9: 22 15 17 25" } */ + printf("res: %g %g %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); + /* { dg-output "\nres: 22 15 17 25" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_24byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_24byte(*)(cls_struct_24byte, + cls_struct_24byte, + cls_struct_24byte, + cls_struct_24byte)) + (code))(e_dbl, f_dbl, g_dbl, h_dbl); + /* { dg-output "\n9 2 6 5 1 2 3 7 4 5 7 9 8 6 1 9: 22 15 17 25" } */ + printf("res: %g %g %d %g\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); + /* { dg-output "\nres: 22 15 17 25" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_2byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_2byte.c new file mode 100644 index 000000000..101e130a1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_2byte.c @@ -0,0 +1,90 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Especially with small structures which may fit in one + register. Depending on the ABI. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_2byte { + unsigned char a; + unsigned char b; +} cls_struct_2byte; + +cls_struct_2byte cls_struct_2byte_fn(struct cls_struct_2byte a1, + struct cls_struct_2byte a2) +{ + struct cls_struct_2byte result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + + printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); + + return result; +} + +static void +cls_struct_2byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_2byte a1, a2; + + a1 = *(struct cls_struct_2byte*)(args[0]); + a2 = *(struct cls_struct_2byte*)(args[1]); + + *(cls_struct_2byte*)resp = cls_struct_2byte_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_2byte g_dbl = { 12, 127 }; + struct cls_struct_2byte f_dbl = { 1, 13 }; + struct cls_struct_2byte res_dbl; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = &ffi_type_uchar; + cls_struct_fields[2] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_2byte_fn), &res_dbl, args_dbl); + /* { dg-output "12 127 1 13: 13 140" } */ + printf("res: %d %d\n", res_dbl.a, res_dbl.b); + /* { dg-output "\nres: 13 140" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_2byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_2byte(*)(cls_struct_2byte, cls_struct_2byte))(code))(g_dbl, f_dbl); + /* { dg-output "\n12 127 1 13: 13 140" } */ + printf("res: %d %d\n", res_dbl.a, res_dbl.b); + /* { dg-output "\nres: 13 140" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_3_1byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_3_1byte.c new file mode 100644 index 000000000..fc780c30d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_3_1byte.c @@ -0,0 +1,95 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Especially with small structures which may fit in one + register. Depending on the ABI. + Limitations: none. + PR: none. + Originator: 20030902 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_3_1byte { + unsigned char a; + unsigned char b; + unsigned char c; +} cls_struct_3_1byte; + +cls_struct_3_1byte cls_struct_3_1byte_fn(struct cls_struct_3_1byte a1, + struct cls_struct_3_1byte a2) +{ + struct cls_struct_3_1byte result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + + printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, + a2.a, a2.b, a2.c, + result.a, result.b, result.c); + + return result; +} + +static void +cls_struct_3_1byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_3_1byte a1, a2; + + a1 = *(struct cls_struct_3_1byte*)(args[0]); + a2 = *(struct cls_struct_3_1byte*)(args[1]); + + *(cls_struct_3_1byte*)resp = cls_struct_3_1byte_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_3_1byte g_dbl = { 12, 13, 14 }; + struct cls_struct_3_1byte f_dbl = { 178, 179, 180 }; + struct cls_struct_3_1byte res_dbl; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = &ffi_type_uchar; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_3_1byte_fn), &res_dbl, args_dbl); + /* { dg-output "12 13 14 178 179 180: 190 192 194" } */ + printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 190 192 194" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3_1byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_3_1byte(*)(cls_struct_3_1byte, cls_struct_3_1byte))(code))(g_dbl, f_dbl); + /* { dg-output "\n12 13 14 178 179 180: 190 192 194" } */ + printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 190 192 194" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte1.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte1.c new file mode 100644 index 000000000..5705ce387 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte1.c @@ -0,0 +1,90 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Especially with small structures which may fit in one + register. Depending on the ABI. Check overlapping. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_3byte { + unsigned short a; + unsigned char b; +} cls_struct_3byte; + +cls_struct_3byte cls_struct_3byte_fn(struct cls_struct_3byte a1, + struct cls_struct_3byte a2) +{ + struct cls_struct_3byte result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + + printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); + + return result; +} + +static void +cls_struct_3byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_3byte a1, a2; + + a1 = *(struct cls_struct_3byte*)(args[0]); + a2 = *(struct cls_struct_3byte*)(args[1]); + + *(cls_struct_3byte*)resp = cls_struct_3byte_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_3byte g_dbl = { 12, 119 }; + struct cls_struct_3byte f_dbl = { 1, 15 }; + struct cls_struct_3byte res_dbl; + + cls_struct_fields[0] = &ffi_type_ushort; + cls_struct_fields[1] = &ffi_type_uchar; + cls_struct_fields[2] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_3byte_fn), &res_dbl, args_dbl); + /* { dg-output "12 119 1 15: 13 134" } */ + printf("res: %d %d\n", res_dbl.a, res_dbl.b); + /* { dg-output "\nres: 13 134" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_3byte(*)(cls_struct_3byte, cls_struct_3byte))(code))(g_dbl, f_dbl); + /* { dg-output "\n12 119 1 15: 13 134" } */ + printf("res: %d %d\n", res_dbl.a, res_dbl.b); + /* { dg-output "\nres: 13 134" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte2.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte2.c new file mode 100644 index 000000000..01770a075 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte2.c @@ -0,0 +1,90 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Especially with small structures which may fit in one + register. Depending on the ABI. Check overlapping. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_3byte_1 { + unsigned char a; + unsigned short b; +} cls_struct_3byte_1; + +cls_struct_3byte_1 cls_struct_3byte_fn1(struct cls_struct_3byte_1 a1, + struct cls_struct_3byte_1 a2) +{ + struct cls_struct_3byte_1 result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + + printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); + + return result; +} + +static void +cls_struct_3byte_gn1(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_3byte_1 a1, a2; + + a1 = *(struct cls_struct_3byte_1*)(args[0]); + a2 = *(struct cls_struct_3byte_1*)(args[1]); + + *(cls_struct_3byte_1*)resp = cls_struct_3byte_fn1(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_3byte_1 g_dbl = { 15, 125 }; + struct cls_struct_3byte_1 f_dbl = { 9, 19 }; + struct cls_struct_3byte_1 res_dbl; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = &ffi_type_ushort; + cls_struct_fields[2] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_3byte_fn1), &res_dbl, args_dbl); + /* { dg-output "15 125 9 19: 24 144" } */ + printf("res: %d %d\n", res_dbl.a, res_dbl.b); + /* { dg-output "\nres: 24 144" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_3byte_gn1, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_3byte_1(*)(cls_struct_3byte_1, cls_struct_3byte_1))(code))(g_dbl, f_dbl); + /* { dg-output "\n15 125 9 19: 24 144" } */ + printf("res: %d %d\n", res_dbl.a, res_dbl.b); + /* { dg-output "\nres: 24 144" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_4_1byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_4_1byte.c new file mode 100644 index 000000000..f3806d7ba --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_4_1byte.c @@ -0,0 +1,98 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Especially with small structures which may fit in one + register. Depending on the ABI. + Limitations: none. + PR: none. + Originator: 20030902 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_4_1byte { + unsigned char a; + unsigned char b; + unsigned char c; + unsigned char d; +} cls_struct_4_1byte; + +cls_struct_4_1byte cls_struct_4_1byte_fn(struct cls_struct_4_1byte a1, + struct cls_struct_4_1byte a2) +{ + struct cls_struct_4_1byte result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + result.d = a1.d + a2.d; + + printf("%d %d %d %d %d %d %d %d: %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d, + a2.a, a2.b, a2.c, a2.d, + result.a, result.b, result.c, result.d); + + return result; +} + +static void +cls_struct_4_1byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_4_1byte a1, a2; + + a1 = *(struct cls_struct_4_1byte*)(args[0]); + a2 = *(struct cls_struct_4_1byte*)(args[1]); + + *(cls_struct_4_1byte*)resp = cls_struct_4_1byte_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[5]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_4_1byte g_dbl = { 12, 13, 14, 15 }; + struct cls_struct_4_1byte f_dbl = { 178, 179, 180, 181 }; + struct cls_struct_4_1byte res_dbl; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = &ffi_type_uchar; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = &ffi_type_uchar; + cls_struct_fields[4] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_4_1byte_fn), &res_dbl, args_dbl); + /* { dg-output "12 13 14 15 178 179 180 181: 190 192 194 196" } */ + printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); + /* { dg-output "\nres: 190 192 194 196" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_4_1byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_4_1byte(*)(cls_struct_4_1byte, cls_struct_4_1byte))(code))(g_dbl, f_dbl); + /* { dg-output "\n12 13 14 15 178 179 180 181: 190 192 194 196" } */ + printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); + /* { dg-output "\nres: 190 192 194 196" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_4byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_4byte.c new file mode 100644 index 000000000..a1aba3c09 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_4byte.c @@ -0,0 +1,90 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Depending on the ABI. Check overlapping. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ + +#include "ffitest.h" + +typedef struct cls_struct_4byte { + unsigned short a; + unsigned short b; +} cls_struct_4byte; + +cls_struct_4byte cls_struct_4byte_fn(struct cls_struct_4byte a1, + struct cls_struct_4byte a2) +{ + struct cls_struct_4byte result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + + printf("%d %d %d %d: %d %d\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); + + return result; +} + +static void +cls_struct_4byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_4byte a1, a2; + + a1 = *(struct cls_struct_4byte*)(args[0]); + a2 = *(struct cls_struct_4byte*)(args[1]); + + *(cls_struct_4byte*)resp = cls_struct_4byte_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_4byte g_dbl = { 127, 120 }; + struct cls_struct_4byte f_dbl = { 12, 128 }; + struct cls_struct_4byte res_dbl; + + cls_struct_fields[0] = &ffi_type_ushort; + cls_struct_fields[1] = &ffi_type_ushort; + cls_struct_fields[2] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_4byte_fn), &res_dbl, args_dbl); + /* { dg-output "127 120 12 128: 139 248" } */ + printf("res: %d %d\n", res_dbl.a, res_dbl.b); + /* { dg-output "\nres: 139 248" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_4byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_4byte(*)(cls_struct_4byte, cls_struct_4byte))(code))(g_dbl, f_dbl); + /* { dg-output "\n127 120 12 128: 139 248" } */ + printf("res: %d %d\n", res_dbl.a, res_dbl.b); + /* { dg-output "\nres: 139 248" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_5_1_byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_5_1_byte.c new file mode 100644 index 000000000..2ceba3ddb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_5_1_byte.c @@ -0,0 +1,109 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Depending on the ABI. Check overlapping. + Limitations: none. + PR: none. + Originator: 20050708 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_5byte { + unsigned char a; + unsigned char b; + unsigned char c; + unsigned char d; + unsigned char e; +} cls_struct_5byte; + +cls_struct_5byte cls_struct_5byte_fn(struct cls_struct_5byte a1, + struct cls_struct_5byte a2) +{ + struct cls_struct_5byte result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + result.d = a1.d + a2.d; + result.e = a1.e + a2.e; + + printf("%d %d %d %d %d %d %d %d %d %d: %d %d %d %d %d\n", + a1.a, a1.b, a1.c, a1.d, a1.e, + a2.a, a2.b, a2.c, a2.d, a2.e, + result.a, result.b, result.c, result.d, result.e); + + return result; +} + +static void +cls_struct_5byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_5byte a1, a2; + + a1 = *(struct cls_struct_5byte*)(args[0]); + a2 = *(struct cls_struct_5byte*)(args[1]); + + *(cls_struct_5byte*)resp = cls_struct_5byte_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[6]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_5byte g_dbl = { 127, 120, 1, 3, 4 }; + struct cls_struct_5byte f_dbl = { 12, 128, 9, 3, 4 }; + struct cls_struct_5byte res_dbl = { 0, 0, 0, 0, 0 }; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = &ffi_type_uchar; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = &ffi_type_uchar; + cls_struct_fields[4] = &ffi_type_uchar; + cls_struct_fields[5] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_5byte_fn), &res_dbl, args_dbl); + /* { dg-output "127 120 1 3 4 12 128 9 3 4: 139 248 10 6 8" } */ + printf("res: %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e); + /* { dg-output "\nres: 139 248 10 6 8" } */ + + res_dbl.a = 0; + res_dbl.b = 0; + res_dbl.c = 0; + res_dbl.d = 0; + res_dbl.e = 0; + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_5byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(code))(g_dbl, f_dbl); + /* { dg-output "\n127 120 1 3 4 12 128 9 3 4: 139 248 10 6 8" } */ + printf("res: %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e); + /* { dg-output "\nres: 139 248 10 6 8" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_5byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_5byte.c new file mode 100644 index 000000000..61d595c2b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_5byte.c @@ -0,0 +1,98 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Depending on the ABI. Check overlapping. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_5byte { + unsigned short a; + unsigned short b; + unsigned char c; +} cls_struct_5byte; + +cls_struct_5byte cls_struct_5byte_fn(struct cls_struct_5byte a1, + struct cls_struct_5byte a2) +{ + struct cls_struct_5byte result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + + printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, + a2.a, a2.b, a2.c, + result.a, result.b, result.c); + + return result; +} + +static void +cls_struct_5byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_5byte a1, a2; + + a1 = *(struct cls_struct_5byte*)(args[0]); + a2 = *(struct cls_struct_5byte*)(args[1]); + + *(cls_struct_5byte*)resp = cls_struct_5byte_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_5byte g_dbl = { 127, 120, 1 }; + struct cls_struct_5byte f_dbl = { 12, 128, 9 }; + struct cls_struct_5byte res_dbl = { 0, 0, 0 }; + + cls_struct_fields[0] = &ffi_type_ushort; + cls_struct_fields[1] = &ffi_type_ushort; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_5byte_fn), &res_dbl, args_dbl); + /* { dg-output "127 120 1 12 128 9: 139 248 10" } */ + printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 139 248 10" } */ + + res_dbl.a = 0; + res_dbl.b = 0; + res_dbl.c = 0; + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_5byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_5byte(*)(cls_struct_5byte, cls_struct_5byte))(code))(g_dbl, f_dbl); + /* { dg-output "\n127 120 1 12 128 9: 139 248 10" } */ + printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 139 248 10" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_64byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_64byte.c new file mode 100644 index 000000000..576ebe0cc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_64byte.c @@ -0,0 +1,124 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Depending on the ABI. Check bigger struct which overlaps + the gp and fp register count on Darwin/AIX/ppc64. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_64byte { + double a; + double b; + double c; + double d; + double e; + double f; + double g; + double h; +} cls_struct_64byte; + +cls_struct_64byte cls_struct_64byte_fn(struct cls_struct_64byte b0, + struct cls_struct_64byte b1, + struct cls_struct_64byte b2, + struct cls_struct_64byte b3) +{ + struct cls_struct_64byte result; + + result.a = b0.a + b1.a + b2.a + b3.a; + result.b = b0.b + b1.b + b2.b + b3.b; + result.c = b0.c + b1.c + b2.c + b3.c; + result.d = b0.d + b1.d + b2.d + b3.d; + result.e = b0.e + b1.e + b2.e + b3.e; + result.f = b0.f + b1.f + b2.f + b3.f; + result.g = b0.g + b1.g + b2.g + b3.g; + result.h = b0.h + b1.h + b2.h + b3.h; + + printf("%g %g %g %g %g %g %g %g\n", result.a, result.b, result.c, + result.d, result.e, result.f, result.g, result.h); + + return result; +} + +static void +cls_struct_64byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct cls_struct_64byte b0, b1, b2, b3; + + b0 = *(struct cls_struct_64byte*)(args[0]); + b1 = *(struct cls_struct_64byte*)(args[1]); + b2 = *(struct cls_struct_64byte*)(args[2]); + b3 = *(struct cls_struct_64byte*)(args[3]); + + *(cls_struct_64byte*)resp = cls_struct_64byte_fn(b0, b1, b2, b3); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[9]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_64byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0 }; + struct cls_struct_64byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0 }; + struct cls_struct_64byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0 }; + struct cls_struct_64byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0 }; + struct cls_struct_64byte res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = &ffi_type_double; + cls_struct_fields[3] = &ffi_type_double; + cls_struct_fields[4] = &ffi_type_double; + cls_struct_fields[5] = &ffi_type_double; + cls_struct_fields[6] = &ffi_type_double; + cls_struct_fields[7] = &ffi_type_double; + cls_struct_fields[8] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = &cls_struct_type; + dbl_arg_types[3] = &cls_struct_type; + dbl_arg_types[4] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = &h_dbl; + args_dbl[4] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_64byte_fn), &res_dbl, args_dbl); + /* { dg-output "22 15 17 25 6 13 19 18" } */ + printf("res: %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_64byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_64byte(*)(cls_struct_64byte, + cls_struct_64byte, + cls_struct_64byte, + cls_struct_64byte)) + (code))(e_dbl, f_dbl, g_dbl, h_dbl); + /* { dg-output "\n22 15 17 25 6 13 19 18" } */ + printf("res: %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_6_1_byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_6_1_byte.c new file mode 100644 index 000000000..9f2eff68c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_6_1_byte.c @@ -0,0 +1,113 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Depending on the ABI. Check overlapping. + Limitations: none. + PR: none. + Originator: 20050708 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_6byte { + unsigned char a; + unsigned char b; + unsigned char c; + unsigned char d; + unsigned char e; + unsigned char f; +} cls_struct_6byte; + +cls_struct_6byte cls_struct_6byte_fn(struct cls_struct_6byte a1, + struct cls_struct_6byte a2) +{ + struct cls_struct_6byte result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + result.d = a1.d + a2.d; + result.e = a1.e + a2.e; + result.f = a1.f + a2.f; + + printf("%d %d %d %d %d %d %d %d %d %d %d %d: %d %d %d %d %d %d\n", + a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, + a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, + result.a, result.b, result.c, result.d, result.e, result.f); + + return result; +} + +static void +cls_struct_6byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_6byte a1, a2; + + a1 = *(struct cls_struct_6byte*)(args[0]); + a2 = *(struct cls_struct_6byte*)(args[1]); + + *(cls_struct_6byte*)resp = cls_struct_6byte_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[7]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_6byte g_dbl = { 127, 120, 1, 3, 4, 5 }; + struct cls_struct_6byte f_dbl = { 12, 128, 9, 3, 4, 5 }; + struct cls_struct_6byte res_dbl = { 0, 0, 0, 0, 0, 0 }; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = &ffi_type_uchar; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = &ffi_type_uchar; + cls_struct_fields[4] = &ffi_type_uchar; + cls_struct_fields[5] = &ffi_type_uchar; + cls_struct_fields[6] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_6byte_fn), &res_dbl, args_dbl); + /* { dg-output "127 120 1 3 4 5 12 128 9 3 4 5: 139 248 10 6 8 10" } */ + printf("res: %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e, res_dbl.f); + /* { dg-output "\nres: 139 248 10 6 8 10" } */ + + res_dbl.a = 0; + res_dbl.b = 0; + res_dbl.c = 0; + res_dbl.d = 0; + res_dbl.e = 0; + res_dbl.f = 0; + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_6byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(code))(g_dbl, f_dbl); + /* { dg-output "\n127 120 1 3 4 5 12 128 9 3 4 5: 139 248 10 6 8 10" } */ + printf("res: %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e, res_dbl.f); + /* { dg-output "\nres: 139 248 10 6 8 10" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_6byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_6byte.c new file mode 100644 index 000000000..73257b098 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_6byte.c @@ -0,0 +1,99 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Depending on the ABI. Check overlapping. + Limitations: none. + PR: none. + Originator: 20030828 */ + + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_6byte { + unsigned short a; + unsigned short b; + unsigned char c; + unsigned char d; +} cls_struct_6byte; + +cls_struct_6byte cls_struct_6byte_fn(struct cls_struct_6byte a1, + struct cls_struct_6byte a2) +{ + struct cls_struct_6byte result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + result.d = a1.d + a2.d; + + printf("%d %d %d %d %d %d %d %d: %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d, + a2.a, a2.b, a2.c, a2.d, + result.a, result.b, result.c, result.d); + + return result; +} + +static void +cls_struct_6byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_6byte a1, a2; + + a1 = *(struct cls_struct_6byte*)(args[0]); + a2 = *(struct cls_struct_6byte*)(args[1]); + + *(cls_struct_6byte*)resp = cls_struct_6byte_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[5]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_6byte g_dbl = { 127, 120, 1, 128 }; + struct cls_struct_6byte f_dbl = { 12, 128, 9, 127 }; + struct cls_struct_6byte res_dbl; + + cls_struct_fields[0] = &ffi_type_ushort; + cls_struct_fields[1] = &ffi_type_ushort; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = &ffi_type_uchar; + cls_struct_fields[4] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_6byte_fn), &res_dbl, args_dbl); + /* { dg-output "127 120 1 128 12 128 9 127: 139 248 10 255" } */ + printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); + /* { dg-output "\nres: 139 248 10 255" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_6byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_6byte(*)(cls_struct_6byte, cls_struct_6byte))(code))(g_dbl, f_dbl); + /* { dg-output "\n127 120 1 128 12 128 9 127: 139 248 10 255" } */ + printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); + /* { dg-output "\nres: 139 248 10 255" } */ + + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_7_1_byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_7_1_byte.c new file mode 100644 index 000000000..50d09c9da --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_7_1_byte.c @@ -0,0 +1,117 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Depending on the ABI. Check overlapping. + Limitations: none. + PR: none. + Originator: 20050708 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_7byte { + unsigned char a; + unsigned char b; + unsigned char c; + unsigned char d; + unsigned char e; + unsigned char f; + unsigned char g; +} cls_struct_7byte; + +cls_struct_7byte cls_struct_7byte_fn(struct cls_struct_7byte a1, + struct cls_struct_7byte a2) +{ + struct cls_struct_7byte result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + result.d = a1.d + a2.d; + result.e = a1.e + a2.e; + result.f = a1.f + a2.f; + result.g = a1.g + a2.g; + + printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d %d %d %d %d %d %d\n", + a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, + a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, a2.g, + result.a, result.b, result.c, result.d, result.e, result.f, result.g); + + return result; +} + +static void +cls_struct_7byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_7byte a1, a2; + + a1 = *(struct cls_struct_7byte*)(args[0]); + a2 = *(struct cls_struct_7byte*)(args[1]); + + *(cls_struct_7byte*)resp = cls_struct_7byte_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[8]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_7byte g_dbl = { 127, 120, 1, 3, 4, 5, 6 }; + struct cls_struct_7byte f_dbl = { 12, 128, 9, 3, 4, 5, 6 }; + struct cls_struct_7byte res_dbl = { 0, 0, 0, 0, 0, 0, 0 }; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = &ffi_type_uchar; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = &ffi_type_uchar; + cls_struct_fields[4] = &ffi_type_uchar; + cls_struct_fields[5] = &ffi_type_uchar; + cls_struct_fields[6] = &ffi_type_uchar; + cls_struct_fields[7] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_7byte_fn), &res_dbl, args_dbl); + /* { dg-output "127 120 1 3 4 5 6 12 128 9 3 4 5 6: 139 248 10 6 8 10 12" } */ + printf("res: %d %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); + /* { dg-output "\nres: 139 248 10 6 8 10 12" } */ + + res_dbl.a = 0; + res_dbl.b = 0; + res_dbl.c = 0; + res_dbl.d = 0; + res_dbl.e = 0; + res_dbl.f = 0; + res_dbl.g = 0; + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_7byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(code))(g_dbl, f_dbl); + /* { dg-output "\n127 120 1 3 4 5 6 12 128 9 3 4 5 6: 139 248 10 6 8 10 12" } */ + printf("res: %d %d %d %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); + /* { dg-output "\nres: 139 248 10 6 8 10 12" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_7byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_7byte.c new file mode 100644 index 000000000..f5c000031 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_7byte.c @@ -0,0 +1,97 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Depending on the ABI. Check overlapping. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_7byte { + unsigned short a; + unsigned short b; + unsigned char c; + unsigned short d; +} cls_struct_7byte; + +cls_struct_7byte cls_struct_7byte_fn(struct cls_struct_7byte a1, + struct cls_struct_7byte a2) +{ + struct cls_struct_7byte result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + result.d = a1.d + a2.d; + + printf("%d %d %d %d %d %d %d %d: %d %d %d %d\n", a1.a, a1.b, a1.c, a1.d, + a2.a, a2.b, a2.c, a2.d, + result.a, result.b, result.c, result.d); + + return result; +} + +static void +cls_struct_7byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_7byte a1, a2; + + a1 = *(struct cls_struct_7byte*)(args[0]); + a2 = *(struct cls_struct_7byte*)(args[1]); + + *(cls_struct_7byte*)resp = cls_struct_7byte_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[5]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_7byte g_dbl = { 127, 120, 1, 254 }; + struct cls_struct_7byte f_dbl = { 12, 128, 9, 255 }; + struct cls_struct_7byte res_dbl; + + cls_struct_fields[0] = &ffi_type_ushort; + cls_struct_fields[1] = &ffi_type_ushort; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = &ffi_type_ushort; + cls_struct_fields[4] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_7byte_fn), &res_dbl, args_dbl); + /* { dg-output "127 120 1 254 12 128 9 255: 139 248 10 509" } */ + printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); + /* { dg-output "\nres: 139 248 10 509" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_7byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_7byte(*)(cls_struct_7byte, cls_struct_7byte))(code))(g_dbl, f_dbl); + /* { dg-output "\n127 120 1 254 12 128 9 255: 139 248 10 509" } */ + printf("res: %d %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c, res_dbl.d); + /* { dg-output "\nres: 139 248 10 509" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_8byte.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_8byte.c new file mode 100644 index 000000000..4aa99d12e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_8byte.c @@ -0,0 +1,88 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Depending on the ABI. Check overlapping. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_8byte { + int a; + float b; +} cls_struct_8byte; + +cls_struct_8byte cls_struct_8byte_fn(struct cls_struct_8byte a1, + struct cls_struct_8byte a2) +{ + struct cls_struct_8byte result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + + printf("%d %g %d %g: %d %g\n", a1.a, a1.b, a2.a, a2.b, result.a, result.b); + + return result; +} + +static void +cls_struct_8byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_8byte a1, a2; + + a1 = *(struct cls_struct_8byte*)(args[0]); + a2 = *(struct cls_struct_8byte*)(args[1]); + + *(cls_struct_8byte*)resp = cls_struct_8byte_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_8byte g_dbl = { 1, 2.0 }; + struct cls_struct_8byte f_dbl = { 4, 5.0 }; + struct cls_struct_8byte res_dbl; + + cls_struct_fields[0] = &ffi_type_sint; + cls_struct_fields[1] = &ffi_type_float; + cls_struct_fields[2] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_8byte_fn), &res_dbl, args_dbl); + /* { dg-output "1 2 4 5: 5 7" } */ + printf("res: %d %g\n", res_dbl.a, res_dbl.b); + /* { dg-output "\nres: 5 7" } */ + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_8byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_8byte(*)(cls_struct_8byte, cls_struct_8byte))(code))(g_dbl, f_dbl); + /* { dg-output "\n1 2 4 5: 5 7" } */ + printf("res: %d %g\n", res_dbl.a, res_dbl.b); + /* { dg-output "\nres: 5 7" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte1.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte1.c new file mode 100644 index 000000000..cc5e9d6c4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte1.c @@ -0,0 +1,90 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Depending on the ABI. Darwin/AIX do double-word + alignment of the struct if the first element is a double. + Check that it does not here. + Limitations: none. + PR: none. + Originator: 20030914 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_9byte { + int a; + double b; +} cls_struct_9byte; + +cls_struct_9byte cls_struct_9byte_fn(struct cls_struct_9byte b1, + struct cls_struct_9byte b2) +{ + struct cls_struct_9byte result; + + result.a = b1.a + b2.a; + result.b = b1.b + b2.b; + + printf("%d %g %d %g: %d %g\n", b1.a, b1.b, b2.a, b2.b, + result.a, result.b); + + return result; +} + +static void cls_struct_9byte_gn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + struct cls_struct_9byte b1, b2; + + b1 = *(struct cls_struct_9byte*)(args[0]); + b2 = *(struct cls_struct_9byte*)(args[1]); + + *(cls_struct_9byte*)resp = cls_struct_9byte_fn(b1, b2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[3]; + ffi_type* cls_struct_fields[3]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[3]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_9byte h_dbl = { 7, 8.0}; + struct cls_struct_9byte j_dbl = { 1, 9.0}; + struct cls_struct_9byte res_dbl; + + cls_struct_fields[0] = &ffi_type_sint; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &h_dbl; + args_dbl[1] = &j_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_9byte_fn), &res_dbl, args_dbl); + /* { dg-output "7 8 1 9: 8 17" } */ + printf("res: %d %g\n", res_dbl.a, res_dbl.b); + /* { dg-output "\nres: 8 17" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_9byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(code))(h_dbl, j_dbl); + /* { dg-output "\n7 8 1 9: 8 17" } */ + printf("res: %d %g\n", res_dbl.a, res_dbl.b); + /* { dg-output "\nres: 8 17" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte2.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte2.c new file mode 100644 index 000000000..5c0ba0d4b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte2.c @@ -0,0 +1,91 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Depending on the ABI. Darwin/AIX do double-word + alignment of the struct if the first element is a double. + Check that it does here. + Limitations: none. + PR: none. + Originator: 20030914 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_9byte { + double a; + int b; +} cls_struct_9byte; + +cls_struct_9byte cls_struct_9byte_fn(struct cls_struct_9byte b1, + struct cls_struct_9byte b2) +{ + struct cls_struct_9byte result; + + result.a = b1.a + b2.a; + result.b = b1.b + b2.b; + + printf("%g %d %g %d: %g %d\n", b1.a, b1.b, b2.a, b2.b, + result.a, result.b); + + return result; +} + +static void cls_struct_9byte_gn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + struct cls_struct_9byte b1, b2; + + b1 = *(struct cls_struct_9byte*)(args[0]); + b2 = *(struct cls_struct_9byte*)(args[1]); + + *(cls_struct_9byte*)resp = cls_struct_9byte_fn(b1, b2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[3]; + ffi_type* cls_struct_fields[3]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[3]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_9byte h_dbl = { 7.0, 8}; + struct cls_struct_9byte j_dbl = { 1.0, 9}; + struct cls_struct_9byte res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_sint; + cls_struct_fields[2] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &h_dbl; + args_dbl[1] = &j_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_9byte_fn), &res_dbl, args_dbl); + /* { dg-output "7 8 1 9: 8 17" } */ + printf("res: %g %d\n", res_dbl.a, res_dbl.b); + /* { dg-output "\nres: 8 17" } */ + + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_9byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_9byte(*)(cls_struct_9byte, cls_struct_9byte))(code))(h_dbl, j_dbl); + /* { dg-output "\n7 8 1 9: 8 17" } */ + printf("res: %g %d\n", res_dbl.a, res_dbl.b); + /* { dg-output "\nres: 8 17" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_double.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_double.c new file mode 100644 index 000000000..22b94d5a0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_double.c @@ -0,0 +1,93 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure alignment of double. + Limitations: none. + PR: none. + Originator: 20031203 */ + + + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_align { + unsigned char a; + double b; + unsigned char c; +} cls_struct_align; + +cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, + struct cls_struct_align a2) +{ + struct cls_struct_align result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + + printf("%d %g %d %d %g %d: %d %g %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); + + return result; +} + +static void +cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_align a1, a2; + + a1 = *(struct cls_struct_align*)(args[0]); + a2 = *(struct cls_struct_align*)(args[1]); + + *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); + /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); + /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %g %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_float.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_float.c new file mode 100644 index 000000000..62637f21d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_float.c @@ -0,0 +1,91 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure alignment of float. + Limitations: none. + PR: none. + Originator: 20031203 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_align { + unsigned char a; + float b; + unsigned char c; +} cls_struct_align; + +cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, + struct cls_struct_align a2) +{ + struct cls_struct_align result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + + printf("%d %g %d %d %g %d: %d %g %d\n", a1.a, (double)a1.b, a1.c, a2.a, (double)a2.b, a2.c, result.a, (double)result.b, result.c); + + return result; +} + +static void +cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_align a1, a2; + + a1 = *(struct cls_struct_align*)(args[0]); + a2 = *(struct cls_struct_align*)(args[1]); + + *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = &ffi_type_float; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); + /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); + /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble.c new file mode 100644 index 000000000..af380603c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble.c @@ -0,0 +1,92 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure alignment of long double. + Limitations: none. + PR: none. + Originator: 20031203 */ + +/* { dg-do run } */ + +#include "ffitest.h" + +typedef struct cls_struct_align { + unsigned char a; + long double b; + unsigned char c; +} cls_struct_align; + +cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, + struct cls_struct_align a2) +{ + struct cls_struct_align result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + + printf("%d %g %d %d %g %d: %d %g %d\n", a1.a, (double)a1.b, a1.c, a2.a, (double)a2.b, a2.c, result.a, (double)result.b, result.c); + + return result; +} + +static void +cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_align a1, a2; + + a1 = *(struct cls_struct_align*)(args[0]); + a2 = *(struct cls_struct_align*)(args[1]); + + *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = &ffi_type_longdouble; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); + /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); + /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %g %d\n", res_dbl.a, (double)res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split.c new file mode 100644 index 000000000..a3732bd0f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split.c @@ -0,0 +1,134 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure alignment of long double. + Limitations: none. + PR: none. + Originator: 20031203 */ + +/* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ +/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ +/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ + +#include "ffitest.h" + +typedef struct cls_struct_align { + long double a; + long double b; + long double c; + long double d; + long double e; + long double f; + long double g; +} cls_struct_align; + +cls_struct_align cls_struct_align_fn( + cls_struct_align a1, + cls_struct_align a2) +{ + struct cls_struct_align r; + + r.a = a1.a + a2.a; + r.b = a1.b + a2.b; + r.c = a1.c + a2.c; + r.d = a1.d + a2.d; + r.e = a1.e + a2.e; + r.f = a1.f + a2.f; + r.g = a1.g + a2.g; + + printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg: " + "%Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", + a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, + a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, a2.g, + r.a, r.b, r.c, r.d, r.e, r.f, r.g); + + return r; +} + +cls_struct_align cls_struct_align_fn2( + cls_struct_align a1) +{ + struct cls_struct_align r; + + r.a = a1.a + 1; + r.b = a1.b + 1; + r.c = a1.c + 1; + r.d = a1.d + 1; + r.e = a1.e + 1; + r.f = a1.f + 1; + r.g = a1.g + 1; + + printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg: " + "%Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", + a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, + r.a, r.b, r.c, r.d, r.e, r.f, r.g); + + return r; +} + +static void +cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct cls_struct_align a1, a2; + + a1 = *(struct cls_struct_align*)(args[0]); + a2 = *(struct cls_struct_align*)(args[1]); + + *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[3]; + ffi_type* cls_struct_fields[8]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[3]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; + struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; + struct cls_struct_align res_dbl; + + cls_struct_fields[0] = &ffi_type_longdouble; + cls_struct_fields[1] = &ffi_type_longdouble; + cls_struct_fields[2] = &ffi_type_longdouble; + cls_struct_fields[3] = &ffi_type_longdouble; + cls_struct_fields[4] = &ffi_type_longdouble; + cls_struct_fields[5] = &ffi_type_longdouble; + cls_struct_fields[6] = &ffi_type_longdouble; + cls_struct_fields[7] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); + /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ + printf("res: %Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); + /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); + /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ + printf("res: %Lg %Lg %Lg %Lg %Lg %Lg %Lg\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); + /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c new file mode 100644 index 000000000..63a0f7633 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c @@ -0,0 +1,117 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure alignment of long double. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/18/2007 +*/ + +/* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-do run { xfail strongarm*-*-* } } */ +/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ +/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ + +#include "ffitest.h" + +typedef struct cls_struct_align { + long double a; + long double b; + long double c; + long double d; + long double e; + double f; + long double g; +} cls_struct_align; + +cls_struct_align cls_struct_align_fn( + cls_struct_align a1, + cls_struct_align a2) +{ + struct cls_struct_align r; + + r.a = a1.a + a2.a; + r.b = a1.b + a2.b; + r.c = a1.c + a2.c; + r.d = a1.d + a2.d; + r.e = a1.e + a2.e; + r.f = a1.f + a2.f; + r.g = a1.g + a2.g; + + printf("%Lg %Lg %Lg %Lg %Lg %g %Lg %Lg %Lg %Lg %Lg %Lg %g %Lg: " + "%Lg %Lg %Lg %Lg %Lg %g %Lg\n", + a1.a, a1.b, a1.c, a1.d, a1.e, a1.f, a1.g, + a2.a, a2.b, a2.c, a2.d, a2.e, a2.f, a2.g, + r.a, r.b, r.c, r.d, r.e, r.f, r.g); + + return r; +} + +static void +cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct cls_struct_align a1, a2; + + a1 = *(struct cls_struct_align*)(args[0]); + a2 = *(struct cls_struct_align*)(args[1]); + + *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[3]; + ffi_type* cls_struct_fields[8]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[3]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_align g_dbl = { 1, 2, 3, 4, 5, 6, 7 }; + struct cls_struct_align f_dbl = { 8, 9, 10, 11, 12, 13, 14 }; + struct cls_struct_align res_dbl; + + cls_struct_fields[0] = &ffi_type_longdouble; + cls_struct_fields[1] = &ffi_type_longdouble; + cls_struct_fields[2] = &ffi_type_longdouble; + cls_struct_fields[3] = &ffi_type_longdouble; + cls_struct_fields[4] = &ffi_type_longdouble; + cls_struct_fields[5] = &ffi_type_double; + cls_struct_fields[6] = &ffi_type_longdouble; + cls_struct_fields[7] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); + /* { dg-output "1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ + printf("res: %Lg %Lg %Lg %Lg %Lg %g %Lg\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); + /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); + /* { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 12 13 14: 9 11 13 15 17 19 21" } */ + printf("res: %Lg %Lg %Lg %Lg %Lg %g %Lg\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g); + /* { dg-output "\nres: 9 11 13 15 17 19 21" } */ + + exit(0); +} + + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_pointer.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_pointer.c new file mode 100644 index 000000000..cbc4f953f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_pointer.c @@ -0,0 +1,95 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure alignment of pointer. + Limitations: none. + PR: none. + Originator: 20031203 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_align { + unsigned char a; + void *b; + unsigned char c; +} cls_struct_align; + +cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, + struct cls_struct_align a2) +{ + struct cls_struct_align result; + + result.a = a1.a + a2.a; + result.b = (void *)((uintptr_t)a1.b + (uintptr_t)a2.b); + result.c = a1.c + a2.c; + + printf("%d %" PRIuPTR " %d %d %" PRIuPTR " %d: %d %" PRIuPTR " %d\n", + a1.a, (uintptr_t)a1.b, a1.c, + a2.a, (uintptr_t)a2.b, a2.c, + result.a, (uintptr_t)result.b, + result.c); + + return result; +} + +static void +cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_align a1, a2; + + a1 = *(struct cls_struct_align*)(args[0]); + a2 = *(struct cls_struct_align*)(args[1]); + + *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_align g_dbl = { 12, (void *)4951, 127 }; + struct cls_struct_align f_dbl = { 1, (void *)9320, 13 }; + struct cls_struct_align res_dbl; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = &ffi_type_pointer; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); + /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); + /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %" PRIuPTR " %d\n", res_dbl.a, (uintptr_t)res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint16.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint16.c new file mode 100644 index 000000000..383ea41d5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint16.c @@ -0,0 +1,91 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure alignment of sint16. + Limitations: none. + PR: none. + Originator: 20031203 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_align { + unsigned char a; + signed short b; + unsigned char c; +} cls_struct_align; + +cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, + struct cls_struct_align a2) +{ + struct cls_struct_align result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + + printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); + + return result; +} + +static void +cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_align a1, a2; + + a1 = *(struct cls_struct_align*)(args[0]); + a2 = *(struct cls_struct_align*)(args[1]); + + *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = &ffi_type_sshort; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); + /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); + /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint32.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint32.c new file mode 100644 index 000000000..705d78cfa --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint32.c @@ -0,0 +1,91 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure alignment of sint32. + Limitations: none. + PR: none. + Originator: 20031203 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_align { + unsigned char a; + signed int b; + unsigned char c; +} cls_struct_align; + +cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, + struct cls_struct_align a2) +{ + struct cls_struct_align result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + + printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); + + return result; +} + +static void +cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_align a1, a2; + + a1 = *(struct cls_struct_align*)(args[0]); + a2 = *(struct cls_struct_align*)(args[1]); + + *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = &ffi_type_sint; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); + /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); + /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint64.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint64.c new file mode 100644 index 000000000..31d53aff0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint64.c @@ -0,0 +1,92 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure alignment of sint64. + Limitations: none. + PR: none. + Originator: 20031203 */ + +/* { dg-do run } */ +/* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ +#include "ffitest.h" + +typedef struct cls_struct_align { + unsigned char a; + signed long long b; + unsigned char c; +} cls_struct_align; + +cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, + struct cls_struct_align a2) +{ + struct cls_struct_align result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + + printf("%d %" PRIdLL " %d %d %" PRIdLL " %d: %d %" PRIdLL " %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); + + return result; +} + +static void +cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_align a1, a2; + + a1 = *(struct cls_struct_align*)(args[0]); + a2 = *(struct cls_struct_align*)(args[1]); + + *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = &ffi_type_sint64; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); + /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); + /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint16.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint16.c new file mode 100644 index 000000000..cb6b74821 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint16.c @@ -0,0 +1,91 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure alignment of uint16. + Limitations: none. + PR: none. + Originator: 20031203 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_align { + unsigned char a; + unsigned short b; + unsigned char c; +} cls_struct_align; + +cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, + struct cls_struct_align a2) +{ + struct cls_struct_align result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + + printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); + + return result; +} + +static void +cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_align a1, a2; + + a1 = *(struct cls_struct_align*)(args[0]); + a2 = *(struct cls_struct_align*)(args[1]); + + *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = &ffi_type_ushort; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); + /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); + /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint32.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint32.c new file mode 100644 index 000000000..e453d3e5d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint32.c @@ -0,0 +1,91 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure alignment of uint32. + Limitations: none. + PR: none. + Originator: 20031203 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_align { + unsigned char a; + unsigned int b; + unsigned char c; +} cls_struct_align; + +cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, + struct cls_struct_align a2) +{ + struct cls_struct_align result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + + printf("%d %d %d %d %d %d: %d %d %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); + + return result; +} + +static void +cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_align a1, a2; + + a1 = *(struct cls_struct_align*)(args[0]); + a2 = *(struct cls_struct_align*)(args[1]); + + *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = &ffi_type_uint; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); + /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); + /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %d %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint64.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint64.c new file mode 100644 index 000000000..495c79f4e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint64.c @@ -0,0 +1,93 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure alignment of uint64. + Limitations: none. + PR: none. + Originator: 20031203 */ + + +/* { dg-do run } */ +/* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ +#include "ffitest.h" + +typedef struct cls_struct_align { + unsigned char a; + unsigned long long b; + unsigned char c; +} cls_struct_align; + +cls_struct_align cls_struct_align_fn(struct cls_struct_align a1, + struct cls_struct_align a2) +{ + struct cls_struct_align result; + + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + + printf("%d %" PRIdLL " %d %d %" PRIdLL " %d: %d %" PRIdLL " %d\n", a1.a, a1.b, a1.c, a2.a, a2.b, a2.c, result.a, result.b, result.c); + + return result; +} + +static void +cls_struct_align_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + + struct cls_struct_align a1, a2; + + a1 = *(struct cls_struct_align*)(args[0]); + a2 = *(struct cls_struct_align*)(args[1]); + + *(cls_struct_align*)resp = cls_struct_align_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[4]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct cls_struct_align g_dbl = { 12, 4951, 127 }; + struct cls_struct_align f_dbl = { 1, 9320, 13 }; + struct cls_struct_align res_dbl; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = &ffi_type_uint64; + cls_struct_fields[2] = &ffi_type_uchar; + cls_struct_fields[3] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &g_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_align_fn), &res_dbl, args_dbl); + /* { dg-output "12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_align_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_align(*)(cls_struct_align, cls_struct_align))(code))(g_dbl, f_dbl); + /* { dg-output "\n12 4951 127 1 9320 13: 13 14271 140" } */ + printf("res: %d %" PRIdLL " %d\n", res_dbl.a, res_dbl.b, res_dbl.c); + /* { dg-output "\nres: 13 14271 140" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_dbls_struct.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_dbls_struct.c new file mode 100644 index 000000000..660dabb88 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_dbls_struct.c @@ -0,0 +1,66 @@ +/* Area: ffi_call, closure_call + Purpose: Check double arguments in structs. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/23/2007 */ + +/* { dg-do run } */ + +#include "ffitest.h" + +typedef struct Dbls { + double x; + double y; +} Dbls; + +void +closure_test_fn(Dbls p) +{ + printf("%.1f %.1f\n", p.x, p.y); +} + +void +closure_test_gn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, + void** args, void* userdata __UNUSED__) +{ + closure_test_fn(*(Dbls*)args[0]); +} + +int main(int argc __UNUSED__, char** argv __UNUSED__) +{ + ffi_cif cif; + + void *code; + ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type* cl_arg_types[1]; + + ffi_type ts1_type; + ffi_type* ts1_type_elements[4]; + + ts1_type.size = 0; + ts1_type.alignment = 0; + ts1_type.type = FFI_TYPE_STRUCT; + ts1_type.elements = ts1_type_elements; + + ts1_type_elements[0] = &ffi_type_double; + ts1_type_elements[1] = &ffi_type_double; + ts1_type_elements[2] = NULL; + + cl_arg_types[0] = &ts1_type; + + Dbls arg = { 1.0, 2.0 }; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_void, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_gn, NULL, code) == FFI_OK); + + ((void*(*)(Dbls))(code))(arg); + /* { dg-output "1.0 2.0\n" } */ + + closure_test_fn(arg); + /* { dg-output "1.0 2.0\n" } */ + + return 0; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_double.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_double.c new file mode 100644 index 000000000..84ad4cb7d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_double.c @@ -0,0 +1,43 @@ +/* Area: closure_call + Purpose: Check return value double. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +static void cls_ret_double_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) + { + *(double *)resp = *(double *)args[0]; + + printf("%f: %f\n",*(double *)args[0], + *(double *)resp); + } +typedef double (*cls_ret_double)(double); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[2]; + double res; + + cl_arg_types[0] = &ffi_type_double; + cl_arg_types[1] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_double, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_double_fn, NULL, code) == FFI_OK); + + res = (*((cls_ret_double)code))(21474.789); + /* { dg-output "21474.789000: 21474.789000" } */ + printf("res: %.6f\n", res); + /* { dg-output "\nres: 21474.789000" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_double_va.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_double_va.c new file mode 100644 index 000000000..e769caf47 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_double_va.c @@ -0,0 +1,60 @@ +/* Area: ffi_call, closure_call + Purpose: Test doubles passed in variable argument lists. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/6/2007 */ + +/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ +/* { dg-output "" { xfail avr32*-*-* } } */ +/* { dg-output "" { xfail mips-sgi-irix6* } } PR libffi/46660 */ +/* { dg-skip-if "" arm*-*-* { "-mfloat-abi=hard" } { "" } } */ + +#include "ffitest.h" + +static void +cls_double_va_fn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + char* format = *(char**)args[0]; + double doubleValue = *(double*)args[1]; + + *(ffi_arg*)resp = printf(format, doubleValue); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args[3]; + ffi_type* arg_types[3]; + + char* format = "%.1f\n"; + double doubleArg = 7; + ffi_arg res = 0; + + arg_types[0] = &ffi_type_pointer; + arg_types[1] = &ffi_type_double; + arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, + arg_types) == FFI_OK); + + args[0] = &format; + args[1] = &doubleArg; + args[2] = NULL; + + ffi_call(&cif, FFI_FN(printf), &res, args); + // { dg-output "7.0" } + printf("res: %d\n", (int) res); + // { dg-output "\nres: 4" } + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_double_va_fn, NULL, code) == FFI_OK); + + res = ((int(*)(char*, double))(code))(format, doubleArg); + // { dg-output "\n7.0" } + printf("res: %d\n", (int) res); + // { dg-output "\nres: 4" } + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_float.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_float.c new file mode 100644 index 000000000..0090fed90 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_float.c @@ -0,0 +1,42 @@ +/* Area: closure_call + Purpose: Check return value float. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +static void cls_ret_float_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) + { + *(float *)resp = *(float *)args[0]; + + printf("%g: %g\n",*(float *)args[0], + *(float *)resp); + } + +typedef float (*cls_ret_float)(float); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[2]; + float res; + + cl_arg_types[0] = &ffi_type_float; + cl_arg_types[1] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_float, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_float_fn, NULL, code) == FFI_OK); + res = ((((cls_ret_float)code)(-2122.12))); + /* { dg-output "\\-2122.12: \\-2122.12" } */ + printf("res: %.6f\n", res); + /* { dg-output "\nres: \-2122.120117" } */ + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble.c new file mode 100644 index 000000000..e6bac1f83 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble.c @@ -0,0 +1,105 @@ +/* Area: ffi_call, closure_call + Purpose: Check long double arguments. + Limitations: none. + PR: none. + Originator: Blake Chaffin */ + +/* { dg-excess-errors "no long double format" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-do run { xfail arm*-*-* strongarm*-*-* xscale*-*-* } } */ +/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ +/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ + +#include "ffitest.h" + +long double cls_ldouble_fn( + long double a1, + long double a2, + long double a3, + long double a4, + long double a5, + long double a6, + long double a7, + long double a8) +{ + long double r = a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8; + + printf("%Lg %Lg %Lg %Lg %Lg %Lg %Lg %Lg: %Lg\n", + a1, a2, a3, a4, a5, a6, a7, a8, r); + + return r; +} + +static void +cls_ldouble_gn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + long double a1 = *(long double*)args[0]; + long double a2 = *(long double*)args[1]; + long double a3 = *(long double*)args[2]; + long double a4 = *(long double*)args[3]; + long double a5 = *(long double*)args[4]; + long double a6 = *(long double*)args[5]; + long double a7 = *(long double*)args[6]; + long double a8 = *(long double*)args[7]; + + *(long double*)resp = cls_ldouble_fn( + a1, a2, a3, a4, a5, a6, a7, a8); +} + +int main(void) +{ + ffi_cif cif; + void* code; + ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args[9]; + ffi_type* arg_types[9]; + long double res = 0; + + long double arg1 = 1; + long double arg2 = 2; + long double arg3 = 3; + long double arg4 = 4; + long double arg5 = 5; + long double arg6 = 6; + long double arg7 = 7; + long double arg8 = 8; + + arg_types[0] = &ffi_type_longdouble; + arg_types[1] = &ffi_type_longdouble; + arg_types[2] = &ffi_type_longdouble; + arg_types[3] = &ffi_type_longdouble; + arg_types[4] = &ffi_type_longdouble; + arg_types[5] = &ffi_type_longdouble; + arg_types[6] = &ffi_type_longdouble; + arg_types[7] = &ffi_type_longdouble; + arg_types[8] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 8, &ffi_type_longdouble, + arg_types) == FFI_OK); + + args[0] = &arg1; + args[1] = &arg2; + args[2] = &arg3; + args[3] = &arg4; + args[4] = &arg5; + args[5] = &arg6; + args[6] = &arg7; + args[7] = &arg8; + args[8] = NULL; + + ffi_call(&cif, FFI_FN(cls_ldouble_fn), &res, args); + /* { dg-output "1 2 3 4 5 6 7 8: 36" } */ + printf("res: %Lg\n", res); + /* { dg-output "\nres: 36" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ldouble_gn, NULL, code) == FFI_OK); + + res = ((long double(*)(long double, long double, long double, long double, + long double, long double, long double, long double))(code))(arg1, arg2, + arg3, arg4, arg5, arg6, arg7, arg8); + /* { dg-output "\n1 2 3 4 5 6 7 8: 36" } */ + printf("res: %Lg\n", res); + /* { dg-output "\nres: 36" } */ + + return 0; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble_va.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble_va.c new file mode 100644 index 000000000..07780ede4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble_va.c @@ -0,0 +1,60 @@ +/* Area: ffi_call, closure_call + Purpose: Test long doubles passed in variable argument lists. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/6/2007 */ + +/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ +/* { dg-output "" { xfail avr32*-*-* x86_64-*-mingw* } } */ +/* { dg-output "" { xfail mips-sgi-irix6* } } PR libffi/46660 */ +/* { dg-skip-if "" arm*-*-* { "-mfloat-abi=hard" } { "" } } */ + +#include "ffitest.h" + +static void +cls_longdouble_va_fn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + char* format = *(char**)args[0]; + long double ldValue = *(long double*)args[1]; + + *(ffi_arg*)resp = printf(format, ldValue); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args[3]; + ffi_type* arg_types[3]; + + char* format = "%.1Lf\n"; + long double ldArg = 7; + ffi_arg res = 0; + + arg_types[0] = &ffi_type_pointer; + arg_types[1] = &ffi_type_longdouble; + arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_sint, + arg_types) == FFI_OK); + + args[0] = &format; + args[1] = &ldArg; + args[2] = NULL; + + ffi_call(&cif, FFI_FN(printf), &res, args); + // { dg-output "7.0" } + printf("res: %d\n", (int) res); + // { dg-output "\nres: 4" } + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_longdouble_va_fn, NULL, code) == FFI_OK); + + res = ((int(*)(char*, long double))(code))(format, ldArg); + // { dg-output "\n7.0" } + printf("res: %d\n", (int) res); + // { dg-output "\nres: 4" } + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_schar.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_schar.c new file mode 100644 index 000000000..71df7b651 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_schar.c @@ -0,0 +1,74 @@ +/* Area: ffi_call, closure_call + Purpose: Check passing of multiple signed char values. + Limitations: none. + PR: PR13221. + Originator: 20031129 */ + +/* { dg-do run } */ +#include "ffitest.h" + +signed char test_func_fn(signed char a1, signed char a2) +{ + signed char result; + + result = a1 + a2; + + printf("%d %d: %d\n", a1, a2, result); + + return result; + +} + +static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, + void *data __UNUSED__) +{ + signed char a1, a2; + + a1 = *(signed char *)avals[0]; + a2 = *(signed char *)avals[1]; + + *(ffi_arg *)rval = test_func_fn(a1, a2); + +} + +typedef signed char (*test_type)(signed char, signed char); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void * args_dbl[3]; + ffi_type * cl_arg_types[3]; + ffi_arg res_call; + signed char a, b, res_closure; + + a = 2; + b = 125; + + args_dbl[0] = &a; + args_dbl[1] = &b; + args_dbl[2] = NULL; + + cl_arg_types[0] = &ffi_type_schar; + cl_arg_types[1] = &ffi_type_schar; + cl_arg_types[2] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, + &ffi_type_schar, cl_arg_types) == FFI_OK); + + ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); + /* { dg-output "2 125: 127" } */ + printf("res: %d\n", (signed char)res_call); + /* { dg-output "\nres: 127" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); + + res_closure = (*((test_type)code))(2, 125); + /* { dg-output "\n2 125: 127" } */ + printf("res: %d\n", res_closure); + /* { dg-output "\nres: 127" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshort.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshort.c new file mode 100644 index 000000000..4c3915326 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshort.c @@ -0,0 +1,74 @@ +/* Area: ffi_call, closure_call + Purpose: Check passing of multiple signed short values. + Limitations: none. + PR: PR13221. + Originator: 20031129 */ + +/* { dg-do run } */ +#include "ffitest.h" + +signed short test_func_fn(signed short a1, signed short a2) +{ + signed short result; + + result = a1 + a2; + + printf("%d %d: %d\n", a1, a2, result); + + return result; + +} + +static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, + void *data __UNUSED__) +{ + signed short a1, a2; + + a1 = *(signed short *)avals[0]; + a2 = *(signed short *)avals[1]; + + *(ffi_arg *)rval = test_func_fn(a1, a2); + +} + +typedef signed short (*test_type)(signed short, signed short); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void * args_dbl[3]; + ffi_type * cl_arg_types[3]; + ffi_arg res_call; + unsigned short a, b, res_closure; + + a = 2; + b = 32765; + + args_dbl[0] = &a; + args_dbl[1] = &b; + args_dbl[2] = NULL; + + cl_arg_types[0] = &ffi_type_sshort; + cl_arg_types[1] = &ffi_type_sshort; + cl_arg_types[2] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, + &ffi_type_sshort, cl_arg_types) == FFI_OK); + + ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); + /* { dg-output "2 32765: 32767" } */ + printf("res: %d\n", (unsigned short)res_call); + /* { dg-output "\nres: 32767" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); + + res_closure = (*((test_type)code))(2, 32765); + /* { dg-output "\n2 32765: 32767" } */ + printf("res: %d\n", res_closure); + /* { dg-output "\nres: 32767" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshortchar.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshortchar.c new file mode 100644 index 000000000..1c3aeb5a6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshortchar.c @@ -0,0 +1,86 @@ +/* Area: ffi_call, closure_call + Purpose: Check passing of multiple signed short/char values. + Limitations: none. + PR: PR13221. + Originator: 20031129 */ + +/* { dg-do run } */ +#include "ffitest.h" + +signed short test_func_fn(signed char a1, signed short a2, + signed char a3, signed short a4) +{ + signed short result; + + result = a1 + a2 + a3 + a4; + + printf("%d %d %d %d: %d\n", a1, a2, a3, a4, result); + + return result; + +} + +static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, + void *data __UNUSED__) +{ + signed char a1, a3; + signed short a2, a4; + + a1 = *(signed char *)avals[0]; + a2 = *(signed short *)avals[1]; + a3 = *(signed char *)avals[2]; + a4 = *(signed short *)avals[3]; + + *(ffi_arg *)rval = test_func_fn(a1, a2, a3, a4); + +} + +typedef signed short (*test_type)(signed char, signed short, + signed char, signed short); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void * args_dbl[5]; + ffi_type * cl_arg_types[5]; + ffi_arg res_call; + signed char a, c; + signed short b, d, res_closure; + + a = 1; + b = 32765; + c = 127; + d = -128; + + args_dbl[0] = &a; + args_dbl[1] = &b; + args_dbl[2] = &c; + args_dbl[3] = &d; + args_dbl[4] = NULL; + + cl_arg_types[0] = &ffi_type_schar; + cl_arg_types[1] = &ffi_type_sshort; + cl_arg_types[2] = &ffi_type_schar; + cl_arg_types[3] = &ffi_type_sshort; + cl_arg_types[4] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, + &ffi_type_sshort, cl_arg_types) == FFI_OK); + + ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); + /* { dg-output "1 32765 127 -128: 32765" } */ + printf("res: %d\n", (signed short)res_call); + /* { dg-output "\nres: 32765" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); + + res_closure = (*((test_type)code))(1, 32765, 127, -128); + /* { dg-output "\n1 32765 127 -128: 32765" } */ + printf("res: %d\n", res_closure); + /* { dg-output "\nres: 32765" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_uchar.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_uchar.c new file mode 100644 index 000000000..009c02c72 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_uchar.c @@ -0,0 +1,91 @@ +/* Area: ffi_call, closure_call + Purpose: Check passing of multiple unsigned char values. + Limitations: none. + PR: PR13221. + Originator: 20031129 */ + +/* { dg-do run } */ +#include "ffitest.h" + +unsigned char test_func_fn(unsigned char a1, unsigned char a2, + unsigned char a3, unsigned char a4) +{ + unsigned char result; + + result = a1 + a2 + a3 + a4; + + printf("%d %d %d %d: %d\n", a1, a2, a3, a4, result); + + return result; + +} + +static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, + void *data __UNUSED__) +{ + unsigned char a1, a2, a3, a4; + + a1 = *(unsigned char *)avals[0]; + a2 = *(unsigned char *)avals[1]; + a3 = *(unsigned char *)avals[2]; + a4 = *(unsigned char *)avals[3]; + + *(ffi_arg *)rval = test_func_fn(a1, a2, a3, a4); + +} + +typedef unsigned char (*test_type)(unsigned char, unsigned char, + unsigned char, unsigned char); + +void test_func(ffi_cif *cif __UNUSED__, void *rval __UNUSED__, void **avals, + void *data __UNUSED__) +{ + printf("%d %d %d %d\n", *(unsigned char *)avals[0], + *(unsigned char *)avals[1], *(unsigned char *)avals[2], + *(unsigned char *)avals[3]); +} +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void * args_dbl[5]; + ffi_type * cl_arg_types[5]; + ffi_arg res_call; + unsigned char a, b, c, d, res_closure; + + a = 1; + b = 2; + c = 127; + d = 125; + + args_dbl[0] = &a; + args_dbl[1] = &b; + args_dbl[2] = &c; + args_dbl[3] = &d; + args_dbl[4] = NULL; + + cl_arg_types[0] = &ffi_type_uchar; + cl_arg_types[1] = &ffi_type_uchar; + cl_arg_types[2] = &ffi_type_uchar; + cl_arg_types[3] = &ffi_type_uchar; + cl_arg_types[4] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, + &ffi_type_uchar, cl_arg_types) == FFI_OK); + + ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); + /* { dg-output "1 2 127 125: 255" } */ + printf("res: %d\n", (unsigned char)res_call); + /* { dg-output "\nres: 255" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); + + res_closure = (*((test_type)code))(1, 2, 127, 125); + /* { dg-output "\n1 2 127 125: 255" } */ + printf("res: %d\n", res_closure); + /* { dg-output "\nres: 255" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushort.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushort.c new file mode 100644 index 000000000..dd10ca734 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushort.c @@ -0,0 +1,74 @@ +/* Area: ffi_call, closure_call + Purpose: Check passing of multiple unsigned short values. + Limitations: none. + PR: PR13221. + Originator: 20031129 */ + +/* { dg-do run } */ +#include "ffitest.h" + +unsigned short test_func_fn(unsigned short a1, unsigned short a2) +{ + unsigned short result; + + result = a1 + a2; + + printf("%d %d: %d\n", a1, a2, result); + + return result; + +} + +static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, + void *data __UNUSED__) +{ + unsigned short a1, a2; + + a1 = *(unsigned short *)avals[0]; + a2 = *(unsigned short *)avals[1]; + + *(ffi_arg *)rval = test_func_fn(a1, a2); + +} + +typedef unsigned short (*test_type)(unsigned short, unsigned short); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void * args_dbl[3]; + ffi_type * cl_arg_types[3]; + ffi_arg res_call; + unsigned short a, b, res_closure; + + a = 2; + b = 32765; + + args_dbl[0] = &a; + args_dbl[1] = &b; + args_dbl[2] = NULL; + + cl_arg_types[0] = &ffi_type_ushort; + cl_arg_types[1] = &ffi_type_ushort; + cl_arg_types[2] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, + &ffi_type_ushort, cl_arg_types) == FFI_OK); + + ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); + /* { dg-output "2 32765: 32767" } */ + printf("res: %d\n", (unsigned short)res_call); + /* { dg-output "\nres: 32767" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); + + res_closure = (*((test_type)code))(2, 32765); + /* { dg-output "\n2 32765: 32767" } */ + printf("res: %d\n", res_closure); + /* { dg-output "\nres: 32767" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushortchar.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushortchar.c new file mode 100644 index 000000000..2588e97f9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushortchar.c @@ -0,0 +1,86 @@ +/* Area: ffi_call, closure_call + Purpose: Check passing of multiple unsigned short/char values. + Limitations: none. + PR: PR13221. + Originator: 20031129 */ + +/* { dg-do run } */ +#include "ffitest.h" + +unsigned short test_func_fn(unsigned char a1, unsigned short a2, + unsigned char a3, unsigned short a4) +{ + unsigned short result; + + result = a1 + a2 + a3 + a4; + + printf("%d %d %d %d: %d\n", a1, a2, a3, a4, result); + + return result; + +} + +static void test_func_gn(ffi_cif *cif __UNUSED__, void *rval, void **avals, + void *data __UNUSED__) +{ + unsigned char a1, a3; + unsigned short a2, a4; + + a1 = *(unsigned char *)avals[0]; + a2 = *(unsigned short *)avals[1]; + a3 = *(unsigned char *)avals[2]; + a4 = *(unsigned short *)avals[3]; + + *(ffi_arg *)rval = test_func_fn(a1, a2, a3, a4); + +} + +typedef unsigned short (*test_type)(unsigned char, unsigned short, + unsigned char, unsigned short); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void * args_dbl[5]; + ffi_type * cl_arg_types[5]; + ffi_arg res_call; + unsigned char a, c; + unsigned short b, d, res_closure; + + a = 1; + b = 2; + c = 127; + d = 128; + + args_dbl[0] = &a; + args_dbl[1] = &b; + args_dbl[2] = &c; + args_dbl[3] = &d; + args_dbl[4] = NULL; + + cl_arg_types[0] = &ffi_type_uchar; + cl_arg_types[1] = &ffi_type_ushort; + cl_arg_types[2] = &ffi_type_uchar; + cl_arg_types[3] = &ffi_type_ushort; + cl_arg_types[4] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, + &ffi_type_ushort, cl_arg_types) == FFI_OK); + + ffi_call(&cif, FFI_FN(test_func_fn), &res_call, args_dbl); + /* { dg-output "1 2 127 128: 258" } */ + printf("res: %d\n", (unsigned short)res_call); + /* { dg-output "\nres: 258" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, test_func_gn, NULL, code) == FFI_OK); + + res_closure = (*((test_type)code))(1, 2, 127, 128); + /* { dg-output "\n1 2 127 128: 258" } */ + printf("res: %d\n", res_closure); + /* { dg-output "\nres: 258" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer.c new file mode 100644 index 000000000..cf0399343 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer.c @@ -0,0 +1,74 @@ +/* Area: ffi_call, closure_call + Purpose: Check pointer arguments. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/6/2007 */ + +/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +void* cls_pointer_fn(void* a1, void* a2) +{ + void* result = (void*)((intptr_t)a1 + (intptr_t)a2); + + printf("0x%08x 0x%08x: 0x%08x\n", + (unsigned int)(uintptr_t) a1, + (unsigned int)(uintptr_t) a2, + (unsigned int)(uintptr_t) result); + + return result; +} + +static void +cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + void* a1 = *(void**)(args[0]); + void* a2 = *(void**)(args[1]); + + *(void**)resp = cls_pointer_fn(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args[3]; +// ffi_type cls_pointer_type; + ffi_type* arg_types[3]; + +/* cls_pointer_type.size = sizeof(void*); + cls_pointer_type.alignment = 0; + cls_pointer_type.type = FFI_TYPE_POINTER; + cls_pointer_type.elements = NULL;*/ + + void* arg1 = (void*)0x12345678; + void* arg2 = (void*)0x89abcdef; + ffi_arg res = 0; + + arg_types[0] = &ffi_type_pointer; + arg_types[1] = &ffi_type_pointer; + arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_pointer, + arg_types) == FFI_OK); + + args[0] = &arg1; + args[1] = &arg2; + args[2] = NULL; + + ffi_call(&cif, FFI_FN(cls_pointer_fn), &res, args); + /* { dg-output "0x12345678 0x89abcdef: 0x9be02467" } */ + printf("res: 0x%08x\n", (unsigned int) res); + /* { dg-output "\nres: 0x9be02467" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); + + res = (ffi_arg)(uintptr_t)((void*(*)(void*, void*))(code))(arg1, arg2); + /* { dg-output "\n0x12345678 0x89abcdef: 0x9be02467" } */ + printf("res: 0x%08x\n", (unsigned int) res); + /* { dg-output "\nres: 0x9be02467" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer_stack.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer_stack.c new file mode 100644 index 000000000..d631cf848 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer_stack.c @@ -0,0 +1,140 @@ +/* Area: ffi_call, closure_call + Purpose: Check pointer arguments across multiple hideous stack frames. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/7/2007 */ + +/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +static long dummyVar; + +long dummy_func( + long double a1, char b1, + long double a2, char b2, + long double a3, char b3, + long double a4, char b4) +{ + return a1 + b1 + a2 + b2 + a3 + b3 + a4 + b4; +} + +void* cls_pointer_fn2(void* a1, void* a2) +{ + long double trample1 = (intptr_t)a1 + (intptr_t)a2; + char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0]; + long double trample3 = (intptr_t)trample1 + (intptr_t)a1; + char trample4 = trample2 + ((char*)&a1)[1]; + long double trample5 = (intptr_t)trample3 + (intptr_t)a2; + char trample6 = trample4 + ((char*)&a2)[1]; + long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; + char trample8 = trample6 + trample2; + + dummyVar = dummy_func(trample1, trample2, trample3, trample4, + trample5, trample6, trample7, trample8); + + void* result = (void*)((intptr_t)a1 + (intptr_t)a2); + + printf("0x%08x 0x%08x: 0x%08x\n", + (unsigned int)(uintptr_t) a1, + (unsigned int)(uintptr_t) a2, + (unsigned int)(uintptr_t) result); + + return result; +} + +void* cls_pointer_fn1(void* a1, void* a2) +{ + long double trample1 = (intptr_t)a1 + (intptr_t)a2; + char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0]; + long double trample3 = (intptr_t)trample1 + (intptr_t)a1; + char trample4 = trample2 + ((char*)&a1)[1]; + long double trample5 = (intptr_t)trample3 + (intptr_t)a2; + char trample6 = trample4 + ((char*)&a2)[1]; + long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; + char trample8 = trample6 + trample2; + + dummyVar = dummy_func(trample1, trample2, trample3, trample4, + trample5, trample6, trample7, trample8); + + void* result = (void*)((intptr_t)a1 + (intptr_t)a2); + + printf("0x%08x 0x%08x: 0x%08x\n", + (unsigned int)(intptr_t) a1, + (unsigned int)(intptr_t) a2, + (unsigned int)(intptr_t) result); + + result = cls_pointer_fn2(result, a1); + + return result; +} + +static void +cls_pointer_gn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + void* a1 = *(void**)(args[0]); + void* a2 = *(void**)(args[1]); + + long double trample1 = (intptr_t)a1 + (intptr_t)a2; + char trample2 = ((char*)&a1)[0] + ((char*)&a2)[0]; + long double trample3 = (intptr_t)trample1 + (intptr_t)a1; + char trample4 = trample2 + ((char*)&a1)[1]; + long double trample5 = (intptr_t)trample3 + (intptr_t)a2; + char trample6 = trample4 + ((char*)&a2)[1]; + long double trample7 = (intptr_t)trample5 + (intptr_t)trample1; + char trample8 = trample6 + trample2; + + dummyVar = dummy_func(trample1, trample2, trample3, trample4, + trample5, trample6, trample7, trample8); + + *(void**)resp = cls_pointer_fn1(a1, a2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure* pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args[3]; +// ffi_type cls_pointer_type; + ffi_type* arg_types[3]; + +/* cls_pointer_type.size = sizeof(void*); + cls_pointer_type.alignment = 0; + cls_pointer_type.type = FFI_TYPE_POINTER; + cls_pointer_type.elements = NULL;*/ + + void* arg1 = (void*)0x01234567; + void* arg2 = (void*)0x89abcdef; + ffi_arg res = 0; + + arg_types[0] = &ffi_type_pointer; + arg_types[1] = &ffi_type_pointer; + arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ffi_type_pointer, + arg_types) == FFI_OK); + + args[0] = &arg1; + args[1] = &arg2; + args[2] = NULL; + + printf("\n"); + ffi_call(&cif, FFI_FN(cls_pointer_fn1), &res, args); + + printf("res: 0x%08x\n", (unsigned int) res); + // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } + // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } + // { dg-output "\nres: 0x8bf258bd" } + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_pointer_gn, NULL, code) == FFI_OK); + + res = (ffi_arg)(uintptr_t)((void*(*)(void*, void*))(code))(arg1, arg2); + + printf("res: 0x%08x\n", (unsigned int) res); + // { dg-output "\n0x01234567 0x89abcdef: 0x8acf1356" } + // { dg-output "\n0x8acf1356 0x01234567: 0x8bf258bd" } + // { dg-output "\nres: 0x8bf258bd" } + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_schar.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_schar.c new file mode 100644 index 000000000..82986b172 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_schar.c @@ -0,0 +1,44 @@ +/* Area: closure_call + Purpose: Check return value schar. + Limitations: none. + PR: none. + Originator: 20031108 */ + + + +/* { dg-do run } */ +#include "ffitest.h" + +static void cls_ret_schar_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + *(ffi_arg*)resp = *(signed char *)args[0]; + printf("%d: %d\n",*(signed char *)args[0], + (int)*(ffi_arg *)(resp)); +} +typedef signed char (*cls_ret_schar)(signed char); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[2]; + signed char res; + + cl_arg_types[0] = &ffi_type_schar; + cl_arg_types[1] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_schar, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_schar_fn, NULL, code) == FFI_OK); + + res = (*((cls_ret_schar)code))(127); + /* { dg-output "127: 127" } */ + printf("res: %d\n", res); + /* { dg-output "\nres: 127" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_sint.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_sint.c new file mode 100644 index 000000000..c7e13b73a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_sint.c @@ -0,0 +1,42 @@ +/* Area: closure_call + Purpose: Check return value sint32. + Limitations: none. + PR: none. + Originator: 20031108 */ + +/* { dg-do run } */ +#include "ffitest.h" + +static void cls_ret_sint_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + *(ffi_arg*)resp = *(signed int *)args[0]; + printf("%d: %d\n",*(signed int *)args[0], + (int)*(ffi_arg *)(resp)); +} +typedef signed int (*cls_ret_sint)(signed int); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[2]; + signed int res; + + cl_arg_types[0] = &ffi_type_sint; + cl_arg_types[1] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_sint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_sint_fn, NULL, code) == FFI_OK); + + res = (*((cls_ret_sint)code))(65534); + /* { dg-output "65534: 65534" } */ + printf("res: %d\n",res); + /* { dg-output "\nres: 65534" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_sshort.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_sshort.c new file mode 100644 index 000000000..846d57ed1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_sshort.c @@ -0,0 +1,42 @@ +/* Area: closure_call + Purpose: Check return value sshort. + Limitations: none. + PR: none. + Originator: 20031108 */ + +/* { dg-do run } */ +#include "ffitest.h" + +static void cls_ret_sshort_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + *(ffi_arg*)resp = *(signed short *)args[0]; + printf("%d: %d\n",*(signed short *)args[0], + (int)*(ffi_arg *)(resp)); +} +typedef signed short (*cls_ret_sshort)(signed short); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[2]; + signed short res; + + cl_arg_types[0] = &ffi_type_sshort; + cl_arg_types[1] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_sshort, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_sshort_fn, NULL, code) == FFI_OK); + + res = (*((cls_ret_sshort)code))(255); + /* { dg-output "255: 255" } */ + printf("res: %d\n",res); + /* { dg-output "\nres: 255" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar.c new file mode 100644 index 000000000..c1317e795 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar.c @@ -0,0 +1,42 @@ +/* Area: closure_call + Purpose: Check return value uchar. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +static void cls_ret_uchar_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + *(ffi_arg*)resp = *(unsigned char *)args[0]; + printf("%d: %d\n",*(unsigned char *)args[0], + (int)*(ffi_arg *)(resp)); +} +typedef unsigned char (*cls_ret_uchar)(unsigned char); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[2]; + unsigned char res; + + cl_arg_types[0] = &ffi_type_uchar; + cl_arg_types[1] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_uchar, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_uchar_fn, NULL, code) == FFI_OK); + + res = (*((cls_ret_uchar)code))(127); + /* { dg-output "127: 127" } */ + printf("res: %d\n",res); + /* { dg-output "\nres: 127" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_uint.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_uint.c new file mode 100644 index 000000000..885cff5c3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_uint.c @@ -0,0 +1,43 @@ +/* Area: closure_call + Purpose: Check return value uint. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +static void cls_ret_uint_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + *(ffi_arg *)resp = *(unsigned int *)args[0]; + + printf("%d: %d\n",*(unsigned int *)args[0], + (int)*(ffi_arg *)(resp)); +} +typedef unsigned int (*cls_ret_uint)(unsigned int); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[2]; + unsigned int res; + + cl_arg_types[0] = &ffi_type_uint; + cl_arg_types[1] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_uint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_uint_fn, NULL, code) == FFI_OK); + + res = (*((cls_ret_uint)code))(2147483647); + /* { dg-output "2147483647: 2147483647" } */ + printf("res: %d\n",res); + /* { dg-output "\nres: 2147483647" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_ulonglong.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_ulonglong.c new file mode 100644 index 000000000..235ab44ff --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_ulonglong.c @@ -0,0 +1,47 @@ +/* Area: closure_call + Purpose: Check return value long long. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +/* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ +#include "ffitest.h" + +static void cls_ret_ulonglong_fn(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) +{ + *(unsigned long long *)resp= *(unsigned long long *)args[0]; + + printf("%" PRIuLL ": %" PRIuLL "\n",*(unsigned long long *)args[0], + *(unsigned long long *)(resp)); +} +typedef unsigned long long (*cls_ret_ulonglong)(unsigned long long); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[2]; + unsigned long long res; + + cl_arg_types[0] = &ffi_type_uint64; + cl_arg_types[1] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_uint64, cl_arg_types) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ulonglong_fn, NULL, code) == FFI_OK); + res = (*((cls_ret_ulonglong)code))(214LL); + /* { dg-output "214: 214" } */ + printf("res: %" PRIdLL "\n", res); + /* { dg-output "\nres: 214" } */ + + res = (*((cls_ret_ulonglong)code))(9223372035854775808LL); + /* { dg-output "\n9223372035854775808: 9223372035854775808" } */ + printf("res: %" PRIdLL "\n", res); + /* { dg-output "\nres: 9223372035854775808" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort.c new file mode 100644 index 000000000..a00100e07 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort.c @@ -0,0 +1,43 @@ +/* Area: closure_call + Purpose: Check return value ushort. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +static void cls_ret_ushort_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + *(ffi_arg*)resp = *(unsigned short *)args[0]; + + printf("%d: %d\n",*(unsigned short *)args[0], + (int)*(ffi_arg *)(resp)); +} +typedef unsigned short (*cls_ret_ushort)(unsigned short); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[2]; + unsigned short res; + + cl_arg_types[0] = &ffi_type_ushort; + cl_arg_types[1] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_ushort, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_ret_ushort_fn, NULL, code) == FFI_OK); + + res = (*((cls_ret_ushort)code))(65535); + /* { dg-output "65535: 65535" } */ + printf("res: %d\n",res); + /* { dg-output "\nres: 65535" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_abi.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_abi.c new file mode 100644 index 000000000..f5a73179e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_abi.c @@ -0,0 +1,36 @@ +/* Area: ffi_prep_cif, ffi_prep_closure + Purpose: Test error return for bad ABIs. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/6/2007 */ + +/* { dg-do run } */ + +#include "ffitest.h" + +static void +dummy_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, + void** args __UNUSED__, void* userdata __UNUSED__) +{} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type* arg_types[1]; + + arg_types[0] = NULL; + + CHECK(ffi_prep_cif(&cif, 255, 0, &ffi_type_void, + arg_types) == FFI_BAD_ABI); + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &ffi_type_void, + arg_types) == FFI_OK); + + cif.abi= 255; + + CHECK(ffi_prep_closure_loc(pcl, &cif, dummy_fn, NULL, code) == FFI_BAD_ABI); + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c new file mode 100644 index 000000000..253927392 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c @@ -0,0 +1,26 @@ +/* Area: ffi_prep_cif + Purpose: Test error return for bad typedefs. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/6/2007 */ + +/* { dg-do run } */ + +#include "ffitest.h" + +int main (void) +{ + ffi_cif cif; + ffi_type* arg_types[1]; + + arg_types[0] = NULL; + + ffi_type badType = ffi_type_void; + + badType.size = 0; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, &badType, + arg_types) == FFI_BAD_TYPEDEF); + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h new file mode 100644 index 000000000..0e95e164f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h @@ -0,0 +1,153 @@ +#include +#include +#include +#include +#include +#include "fficonfig.h" + +#if defined HAVE_STDINT_H +#include +#endif + +#if defined HAVE_INTTYPES_H +#include +#endif + +#define MAX_ARGS 256 + +#define CHECK(x) !(x) ? abort() : 0 + +/* Define __UNUSED__ that also other compilers than gcc can run the tests. */ +#undef __UNUSED__ +#if defined(__GNUC__) +#define __UNUSED__ __attribute__((__unused__)) +#else +#define __UNUSED__ +#endif + +/* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a + file open. */ +#ifdef HAVE_MMAP_ANON +# undef HAVE_MMAP_DEV_ZERO + +# include +# ifndef MAP_FAILED +# define MAP_FAILED -1 +# endif +# if !defined (MAP_ANONYMOUS) && defined (MAP_ANON) +# define MAP_ANONYMOUS MAP_ANON +# endif +# define USING_MMAP + +#endif + +#ifdef HAVE_MMAP_DEV_ZERO + +# include +# ifndef MAP_FAILED +# define MAP_FAILED -1 +# endif +# define USING_MMAP + +#endif + +/* MinGW kludge. */ +#ifdef _WIN64 +#define PRIdLL "I64d" +#define PRIuLL "I64u" +#else +#define PRIdLL "lld" +#define PRIuLL "llu" +#endif + +/* Tru64 UNIX kludge. */ +#if defined(__alpha__) && defined(__osf__) +/* Tru64 UNIX V4.0 doesn't support %lld/%lld, but long is 64-bit. */ +#undef PRIdLL +#define PRIdLL "ld" +#undef PRIuLL +#define PRIuLL "lu" +#define PRId8 "hd" +#define PRIu8 "hu" +#define PRId64 "ld" +#define PRIu64 "lu" +#define PRIuPTR "lu" +#endif + +/* PA HP-UX kludge. */ +#if defined(__hppa__) && defined(__hpux__) && !defined(PRIuPTR) +#define PRIuPTR "lu" +#endif + +/* IRIX kludge. */ +#if defined(__sgi) +/* IRIX 6.5 provides all definitions, but only for C99 + compilations. */ +#define PRId8 "hhd" +#define PRIu8 "hhu" +#if (_MIPS_SZLONG == 32) +#define PRId64 "lld" +#define PRIu64 "llu" +#endif +/* This doesn't match , which always has "lld" here, but the + arguments are uint64_t, int64_t, which are unsigned long, long for + 64-bit in . */ +#if (_MIPS_SZLONG == 64) +#define PRId64 "ld" +#define PRIu64 "lu" +#endif +/* This doesn't match , which has "u" here, but the arguments + are uintptr_t, which is always unsigned long. */ +#define PRIuPTR "lu" +#endif + +/* Solaris < 10 kludge. */ +#if defined(__sun__) && defined(__svr4__) && !defined(PRIuPTR) +#if defined(__arch64__) || defined (__x86_64__) +#define PRIuPTR "lu" +#else +#define PRIuPTR "u" +#endif +#endif + +#ifdef USING_MMAP +static inline void * +allocate_mmap (size_t size) +{ + void *page; +#if defined (HAVE_MMAP_DEV_ZERO) + static int dev_zero_fd = -1; +#endif + +#ifdef HAVE_MMAP_DEV_ZERO + if (dev_zero_fd == -1) + { + dev_zero_fd = open ("/dev/zero", O_RDONLY); + if (dev_zero_fd == -1) + { + perror ("open /dev/zero: %m"); + exit (1); + } + } +#endif + + +#ifdef HAVE_MMAP_ANON + page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); +#endif +#ifdef HAVE_MMAP_DEV_ZERO + page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE, dev_zero_fd, 0); +#endif + + if (page == (void *) MAP_FAILED) + { + perror ("virtual memory exhausted"); + exit (1); + } + + return page; +} + +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/float.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/float.c new file mode 100644 index 000000000..fbc272d84 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/float.c @@ -0,0 +1,59 @@ +/* Area: ffi_call + Purpose: Check return value float. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ + +#include "ffitest.h" + +static int floating(int a, float b, double c, long double d) +{ + int i; + + i = (int) ((float)a/b + ((float)c/(float)d)); + + return i; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_arg rint; + + float f; + signed int si1; + double d; + long double ld; + + args[0] = &ffi_type_sint; + values[0] = &si1; + args[1] = &ffi_type_float; + values[1] = &f; + args[2] = &ffi_type_double; + values[2] = &d; + args[3] = &ffi_type_longdouble; + values[3] = &ld; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, + &ffi_type_sint, args) == FFI_OK); + + si1 = 6; + f = 3.14159; + d = (double)1.0/(double)3.0; + ld = 2.71828182846L; + + floating (si1, f, d, ld); + + ffi_call(&cif, FFI_FN(floating), &rint, values); + + printf ("%d vs %d\n", (int)rint, floating (si1, f, d, ld)); + + CHECK((int)rint == floating(si1, f, d, ld)); + + exit (0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/float1.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/float1.c new file mode 100644 index 000000000..991d059fe --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/float1.c @@ -0,0 +1,58 @@ +/* Area: ffi_call + Purpose: Check return value double. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" +#include "float.h" + +typedef union +{ + double d; + unsigned char c[sizeof (double)]; +} value_type; + +#define CANARY 0xba + +static double dblit(float f) +{ + return f/3.0; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + float f; + value_type result[2]; + unsigned int i; + + args[0] = &ffi_type_float; + values[0] = &f; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_double, args) == FFI_OK); + + f = 3.14159; + + /* Put a canary in the return array. This is a regression test for + a buffer overrun. */ + memset(result[1].c, CANARY, sizeof (double)); + + ffi_call(&cif, FFI_FN(dblit), &result[0].d, values); + + /* These are not always the same!! Check for a reasonable delta */ + + CHECK(result[0].d - dblit(f) < DBL_EPSILON); + + /* Check the canary. */ + for (i = 0; i < sizeof (double); ++i) + CHECK(result[1].c[i] == CANARY); + + exit(0); + +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/float2.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/float2.c new file mode 100644 index 000000000..a0b296cf4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/float2.c @@ -0,0 +1,58 @@ +/* Area: ffi_call + Purpose: Check return value long double. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-excess-errors "fails" { target x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ + +#include "ffitest.h" +#include "float.h" + +static long double ldblit(float f) +{ + return (long double) (((long double) f)/ (long double) 3.0); +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + float f; + long double ld; + + args[0] = &ffi_type_float; + values[0] = &f; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_longdouble, args) == FFI_OK); + + f = 3.14159; + +#if 1 + /* This is ifdef'd out for now. long double support under SunOS/gcc + is pretty much non-existent. You'll get the odd bus error in library + routines like printf(). */ + printf ("%Lf\n", ldblit(f)); +#endif + ld = 666; + ffi_call(&cif, FFI_FN(ldblit), &ld, values); + +#if 1 + /* This is ifdef'd out for now. long double support under SunOS/gcc + is pretty much non-existent. You'll get the odd bus error in library + routines like printf(). */ + printf ("%Lf, %Lf, %Lf, %Lf\n", ld, ldblit(f), ld - ldblit(f), LDBL_EPSILON); +#endif + + /* These are not always the same!! Check for a reasonable delta */ + if (ld - ldblit(f) < LDBL_EPSILON) + puts("long double return value tests ok!"); + else + CHECK(0); + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/float3.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/float3.c new file mode 100644 index 000000000..76bd5f287 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/float3.c @@ -0,0 +1,72 @@ +/* Area: ffi_call + Purpose: Check float arguments with different orders. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ + +#include "ffitest.h" +#include "float.h" + +static double floating_1(float a, double b, long double c) +{ + return (double) a + b + (double) c; +} + +static double floating_2(long double a, double b, float c) +{ + return (double) a + b + (double) c; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + double rd; + + float f; + double d; + long double ld; + + args[0] = &ffi_type_float; + values[0] = &f; + args[1] = &ffi_type_double; + values[1] = &d; + args[2] = &ffi_type_longdouble; + values[2] = &ld; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, + &ffi_type_double, args) == FFI_OK); + + f = 3.14159; + d = (double)1.0/(double)3.0; + ld = 2.71828182846L; + + floating_1 (f, d, ld); + + ffi_call(&cif, FFI_FN(floating_1), &rd, values); + + CHECK(rd - floating_1(f, d, ld) < DBL_EPSILON); + + args[0] = &ffi_type_longdouble; + values[0] = &ld; + args[1] = &ffi_type_double; + values[1] = &d; + args[2] = &ffi_type_float; + values[2] = &f; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, + &ffi_type_double, args) == FFI_OK); + + floating_2 (ld, d, f); + + ffi_call(&cif, FFI_FN(floating_2), &rd, values); + + CHECK(rd - floating_2(ld, d, f) < DBL_EPSILON); + + exit (0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/float4.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/float4.c new file mode 100644 index 000000000..0dd6d85e7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/float4.c @@ -0,0 +1,62 @@ +/* Area: ffi_call + Purpose: Check denorm double value. + Limitations: none. + PR: PR26483. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +/* { dg-options "-mieee" { target alpha*-*-* } } */ + +#include "ffitest.h" +#include "float.h" + +typedef union +{ + double d; + unsigned char c[sizeof (double)]; +} value_type; + +#define CANARY 0xba + +static double dblit(double d) +{ + return d; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + double d; + value_type result[2]; + unsigned int i; + + args[0] = &ffi_type_double; + values[0] = &d; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_double, args) == FFI_OK); + + d = DBL_MIN / 2; + + /* Put a canary in the return array. This is a regression test for + a buffer overrun. */ + memset(result[1].c, CANARY, sizeof (double)); + + ffi_call(&cif, FFI_FN(dblit), &result[0].d, values); + + /* The standard delta check doesn't work for denorms. Since we didn't do + any arithmetic, we should get the original result back, and hence an + exact check should be OK here. */ + + CHECK(result[0].d == dblit(d)); + + /* Check the canary. */ + for (i = 0; i < sizeof (double); ++i) + CHECK(result[1].c[i] == CANARY); + + exit(0); + +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/huge_struct.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/huge_struct.c new file mode 100644 index 000000000..e04e1d58a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/huge_struct.c @@ -0,0 +1,342 @@ +/* Area: ffi_call, closure_call + Purpose: Check large structure returns. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/18/2007 +*/ + +/* { dg-excess-errors "" { target x86_64-*-mingw* x86_64-*-cygwin* } } */ +/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ +/* { dg-options -mlong-double-128 { target powerpc64*-*-linux* } } */ +/* { dg-output "" { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ + +#include "ffitest.h" + +typedef struct BigStruct{ + uint8_t a; + int8_t b; + uint16_t c; + int16_t d; + uint32_t e; + int32_t f; + uint64_t g; + int64_t h; + float i; + double j; + long double k; + char* l; + uint8_t m; + int8_t n; + uint16_t o; + int16_t p; + uint32_t q; + int32_t r; + uint64_t s; + int64_t t; + float u; + double v; + long double w; + char* x; + uint8_t y; + int8_t z; + uint16_t aa; + int16_t bb; + uint32_t cc; + int32_t dd; + uint64_t ee; + int64_t ff; + float gg; + double hh; + long double ii; + char* jj; + uint8_t kk; + int8_t ll; + uint16_t mm; + int16_t nn; + uint32_t oo; + int32_t pp; + uint64_t qq; + int64_t rr; + float ss; + double tt; + long double uu; + char* vv; + uint8_t ww; + int8_t xx; +} BigStruct; + +BigStruct +test_large_fn( + uint8_t ui8_1, + int8_t si8_1, + uint16_t ui16_1, + int16_t si16_1, + uint32_t ui32_1, + int32_t si32_1, + uint64_t ui64_1, + int64_t si64_1, + float f_1, + double d_1, + long double ld_1, + char* p_1, + uint8_t ui8_2, + int8_t si8_2, + uint16_t ui16_2, + int16_t si16_2, + uint32_t ui32_2, + int32_t si32_2, + uint64_t ui64_2, + int64_t si64_2, + float f_2, + double d_2, + long double ld_2, + char* p_2, + uint8_t ui8_3, + int8_t si8_3, + uint16_t ui16_3, + int16_t si16_3, + uint32_t ui32_3, + int32_t si32_3, + uint64_t ui64_3, + int64_t si64_3, + float f_3, + double d_3, + long double ld_3, + char* p_3, + uint8_t ui8_4, + int8_t si8_4, + uint16_t ui16_4, + int16_t si16_4, + uint32_t ui32_4, + int32_t si32_4, + uint64_t ui64_4, + int64_t si64_4, + float f_4, + double d_4, + long double ld_4, + char* p_4, + uint8_t ui8_5, + int8_t si8_5) +{ + BigStruct retVal = { + ui8_1 + 1, si8_1 + 1, ui16_1 + 1, si16_1 + 1, ui32_1 + 1, si32_1 + 1, + ui64_1 + 1, si64_1 + 1, f_1 + 1, d_1 + 1, ld_1 + 1, (char*)((intptr_t)p_1 + 1), + ui8_2 + 2, si8_2 + 2, ui16_2 + 2, si16_2 + 2, ui32_2 + 2, si32_2 + 2, + ui64_2 + 2, si64_2 + 2, f_2 + 2, d_2 + 2, ld_2 + 2, (char*)((intptr_t)p_2 + 2), + ui8_3 + 3, si8_3 + 3, ui16_3 + 3, si16_3 + 3, ui32_3 + 3, si32_3 + 3, + ui64_3 + 3, si64_3 + 3, f_3 + 3, d_3 + 3, ld_3 + 3, (char*)((intptr_t)p_3 + 3), + ui8_4 + 4, si8_4 + 4, ui16_4 + 4, si16_4 + 4, ui32_4 + 4, si32_4 + 4, + ui64_4 + 4, si64_4 + 4, f_4 + 4, d_4 + 4, ld_4 + 4, (char*)((intptr_t)p_4 + 4), + ui8_5 + 5, si8_5 + 5}; + + printf("%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " + "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " + "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " + "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx %" PRIu8 " %" PRId8 ": " + "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " + "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " + "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " + "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx %" PRIu8 " %" PRId8 "\n", + ui8_1, si8_1, ui16_1, si16_1, ui32_1, si32_1, ui64_1, si64_1, f_1, d_1, ld_1, (unsigned long)p_1, + ui8_2, si8_2, ui16_2, si16_2, ui32_2, si32_2, ui64_2, si64_2, f_2, d_2, ld_2, (unsigned long)p_2, + ui8_3, si8_3, ui16_3, si16_3, ui32_3, si32_3, ui64_3, si64_3, f_3, d_3, ld_3, (unsigned long)p_3, + ui8_4, si8_4, ui16_4, si16_4, ui32_4, si32_4, ui64_4, si64_4, f_4, d_4, ld_4, (unsigned long)p_4, ui8_5, si8_5, + retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f, + retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, (unsigned long)retVal.l, + retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r, + retVal.s, retVal.t, retVal.u, retVal.v, retVal.w, (unsigned long)retVal.x, + retVal.y, retVal.z, retVal.aa, retVal.bb, retVal.cc, retVal.dd, + retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj, + retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, + retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx); + + return retVal; +} + +static void +cls_large_fn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) +{ + uint8_t ui8_1 = *(uint8_t*)args[0]; + int8_t si8_1 = *(int8_t*)args[1]; + uint16_t ui16_1 = *(uint16_t*)args[2]; + int16_t si16_1 = *(int16_t*)args[3]; + uint32_t ui32_1 = *(uint32_t*)args[4]; + int32_t si32_1 = *(int32_t*)args[5]; + uint64_t ui64_1 = *(uint64_t*)args[6]; + int64_t si64_1 = *(int64_t*)args[7]; + float f_1 = *(float*)args[8]; + double d_1 = *(double*)args[9]; + long double ld_1 = *(long double*)args[10]; + char* p_1 = *(char**)args[11]; + uint8_t ui8_2 = *(uint8_t*)args[12]; + int8_t si8_2 = *(int8_t*)args[13]; + uint16_t ui16_2 = *(uint16_t*)args[14]; + int16_t si16_2 = *(int16_t*)args[15]; + uint32_t ui32_2 = *(uint32_t*)args[16]; + int32_t si32_2 = *(int32_t*)args[17]; + uint64_t ui64_2 = *(uint64_t*)args[18]; + int64_t si64_2 = *(int64_t*)args[19]; + float f_2 = *(float*)args[20]; + double d_2 = *(double*)args[21]; + long double ld_2 = *(long double*)args[22]; + char* p_2 = *(char**)args[23]; + uint8_t ui8_3 = *(uint8_t*)args[24]; + int8_t si8_3 = *(int8_t*)args[25]; + uint16_t ui16_3 = *(uint16_t*)args[26]; + int16_t si16_3 = *(int16_t*)args[27]; + uint32_t ui32_3 = *(uint32_t*)args[28]; + int32_t si32_3 = *(int32_t*)args[29]; + uint64_t ui64_3 = *(uint64_t*)args[30]; + int64_t si64_3 = *(int64_t*)args[31]; + float f_3 = *(float*)args[32]; + double d_3 = *(double*)args[33]; + long double ld_3 = *(long double*)args[34]; + char* p_3 = *(char**)args[35]; + uint8_t ui8_4 = *(uint8_t*)args[36]; + int8_t si8_4 = *(int8_t*)args[37]; + uint16_t ui16_4 = *(uint16_t*)args[38]; + int16_t si16_4 = *(int16_t*)args[39]; + uint32_t ui32_4 = *(uint32_t*)args[40]; + int32_t si32_4 = *(int32_t*)args[41]; + uint64_t ui64_4 = *(uint64_t*)args[42]; + int64_t si64_4 = *(int64_t*)args[43]; + float f_4 = *(float*)args[44]; + double d_4 = *(double*)args[45]; + long double ld_4 = *(long double*)args[46]; + char* p_4 = *(char**)args[47]; + uint8_t ui8_5 = *(uint8_t*)args[48]; + int8_t si8_5 = *(int8_t*)args[49]; + + *(BigStruct*)resp = test_large_fn( + ui8_1, si8_1, ui16_1, si16_1, ui32_1, si32_1, ui64_1, si64_1, f_1, d_1, ld_1, p_1, + ui8_2, si8_2, ui16_2, si16_2, ui32_2, si32_2, ui64_2, si64_2, f_2, d_2, ld_2, p_2, + ui8_3, si8_3, ui16_3, si16_3, ui32_3, si32_3, ui64_3, si64_3, f_3, d_3, ld_3, p_3, + ui8_4, si8_4, ui16_4, si16_4, ui32_4, si32_4, ui64_4, si64_4, f_4, d_4, ld_4, p_4, + ui8_5, si8_5); +} + +int +main(int argc __UNUSED__, const char** argv __UNUSED__) +{ + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + + ffi_cif cif; + ffi_type* argTypes[51]; + void* argValues[51]; + + ffi_type ret_struct_type; + ffi_type* st_fields[51]; + BigStruct retVal; + + memset (&retVal, 0, sizeof(retVal)); + + ret_struct_type.size = 0; + ret_struct_type.alignment = 0; + ret_struct_type.type = FFI_TYPE_STRUCT; + ret_struct_type.elements = st_fields; + + st_fields[0] = st_fields[12] = st_fields[24] = st_fields[36] = st_fields[48] = &ffi_type_uint8; + st_fields[1] = st_fields[13] = st_fields[25] = st_fields[37] = st_fields[49] = &ffi_type_sint8; + st_fields[2] = st_fields[14] = st_fields[26] = st_fields[38] = &ffi_type_uint16; + st_fields[3] = st_fields[15] = st_fields[27] = st_fields[39] = &ffi_type_sint16; + st_fields[4] = st_fields[16] = st_fields[28] = st_fields[40] = &ffi_type_uint32; + st_fields[5] = st_fields[17] = st_fields[29] = st_fields[41] = &ffi_type_sint32; + st_fields[6] = st_fields[18] = st_fields[30] = st_fields[42] = &ffi_type_uint64; + st_fields[7] = st_fields[19] = st_fields[31] = st_fields[43] = &ffi_type_sint64; + st_fields[8] = st_fields[20] = st_fields[32] = st_fields[44] = &ffi_type_float; + st_fields[9] = st_fields[21] = st_fields[33] = st_fields[45] = &ffi_type_double; + st_fields[10] = st_fields[22] = st_fields[34] = st_fields[46] = &ffi_type_longdouble; + st_fields[11] = st_fields[23] = st_fields[35] = st_fields[47] = &ffi_type_pointer; + + st_fields[50] = NULL; + + uint8_t ui8 = 1; + int8_t si8 = 2; + uint16_t ui16 = 3; + int16_t si16 = 4; + uint32_t ui32 = 5; + int32_t si32 = 6; + uint64_t ui64 = 7; + int64_t si64 = 8; + float f = 9; + double d = 10; + long double ld = 11; + char* p = (char*)0x12345678; + + argTypes[0] = argTypes[12] = argTypes[24] = argTypes[36] = argTypes[48] = &ffi_type_uint8; + argValues[0] = argValues[12] = argValues[24] = argValues[36] = argValues[48] = &ui8; + argTypes[1] = argTypes[13] = argTypes[25] = argTypes[37] = argTypes[49] = &ffi_type_sint8; + argValues[1] = argValues[13] = argValues[25] = argValues[37] = argValues[49] = &si8; + argTypes[2] = argTypes[14] = argTypes[26] = argTypes[38] = &ffi_type_uint16; + argValues[2] = argValues[14] = argValues[26] = argValues[38] = &ui16; + argTypes[3] = argTypes[15] = argTypes[27] = argTypes[39] = &ffi_type_sint16; + argValues[3] = argValues[15] = argValues[27] = argValues[39] = &si16; + argTypes[4] = argTypes[16] = argTypes[28] = argTypes[40] = &ffi_type_uint32; + argValues[4] = argValues[16] = argValues[28] = argValues[40] = &ui32; + argTypes[5] = argTypes[17] = argTypes[29] = argTypes[41] = &ffi_type_sint32; + argValues[5] = argValues[17] = argValues[29] = argValues[41] = &si32; + argTypes[6] = argTypes[18] = argTypes[30] = argTypes[42] = &ffi_type_uint64; + argValues[6] = argValues[18] = argValues[30] = argValues[42] = &ui64; + argTypes[7] = argTypes[19] = argTypes[31] = argTypes[43] = &ffi_type_sint64; + argValues[7] = argValues[19] = argValues[31] = argValues[43] = &si64; + argTypes[8] = argTypes[20] = argTypes[32] = argTypes[44] = &ffi_type_float; + argValues[8] = argValues[20] = argValues[32] = argValues[44] = &f; + argTypes[9] = argTypes[21] = argTypes[33] = argTypes[45] = &ffi_type_double; + argValues[9] = argValues[21] = argValues[33] = argValues[45] = &d; + argTypes[10] = argTypes[22] = argTypes[34] = argTypes[46] = &ffi_type_longdouble; + argValues[10] = argValues[22] = argValues[34] = argValues[46] = &ld; + argTypes[11] = argTypes[23] = argTypes[35] = argTypes[47] = &ffi_type_pointer; + argValues[11] = argValues[23] = argValues[35] = argValues[47] = &p; + + argTypes[50] = NULL; + argValues[50] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 50, &ret_struct_type, argTypes) == FFI_OK); + + ffi_call(&cif, FFI_FN(test_large_fn), &retVal, argValues); + // { dg-output "1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } + printf("res: %" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " + "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " + "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " + "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx %" PRIu8 " %" PRId8 "\n", + retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f, + retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, (unsigned long)retVal.l, + retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r, + retVal.s, retVal.t, retVal.u, retVal.v, retVal.w, (unsigned long)retVal.x, + retVal.y, retVal.z, retVal.aa, retVal.bb, retVal.cc, retVal.dd, + retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj, + retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, + retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx); + // { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_large_fn, NULL, code) == FFI_OK); + + retVal = ((BigStruct(*)( + uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, + uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, + uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, + uint8_t, int8_t, uint16_t, int16_t, uint32_t, int32_t, uint64_t, int64_t, float, double, long double, char*, + uint8_t, int8_t))(code))( + ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, + ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, + ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, + ui8, si8, ui16, si16, ui32, si32, ui64, si64, f, d, ld, p, + ui8, si8); + // { dg-output "\n1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2 3 4 5 6 7 8 9 10 11 0x12345678 1 2: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } + printf("res: %" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " + "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " + "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx " + "%" PRIu8 " %" PRId8 " %hu %hd %u %d %" PRIu64 " %" PRId64 " %.0f %.0f %.0Lf %#lx %" PRIu8 " %" PRId8 "\n", + retVal.a, retVal.b, retVal.c, retVal.d, retVal.e, retVal.f, + retVal.g, retVal.h, retVal.i, retVal.j, retVal.k, (unsigned long)retVal.l, + retVal.m, retVal.n, retVal.o, retVal.p, retVal.q, retVal.r, + retVal.s, retVal.t, retVal.u, retVal.v, retVal.w, (unsigned long)retVal.x, + retVal.y, retVal.z, retVal.aa, retVal.bb, retVal.cc, retVal.dd, + retVal.ee, retVal.ff, retVal.gg, retVal.hh, retVal.ii, (unsigned long)retVal.jj, + retVal.kk, retVal.ll, retVal.mm, retVal.nn, retVal.oo, retVal.pp, + retVal.qq, retVal.rr, retVal.ss, retVal.tt, retVal.uu, (unsigned long)retVal.vv, retVal.ww, retVal.xx); + // { dg-output "\nres: 2 3 4 5 6 7 8 9 10 11 12 0x12345679 3 4 5 6 7 8 9 10 11 12 13 0x1234567a 4 5 6 7 8 9 10 11 12 13 14 0x1234567b 5 6 7 8 9 10 11 12 13 14 15 0x1234567c 6 7" } + + return 0; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/many.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/many.c new file mode 100644 index 000000000..4869ba9dd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/many.c @@ -0,0 +1,69 @@ +/* Area: ffi_call + Purpose: Check return value float, with many arguments + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" + +#include + +static float many(float f1, + float f2, + float f3, + float f4, + float f5, + float f6, + float f7, + float f8, + float f9, + float f10, + float f11, + float f12, + float f13) +{ +#if 0 + printf("%f %f %f %f %f %f %f %f %f %f %f %f %f\n", + (double) f1, (double) f2, (double) f3, (double) f4, (double) f5, + (double) f6, (double) f7, (double) f8, (double) f9, (double) f10, + (double) f11, (double) f12, (double) f13); +#endif + + return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13); +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[13]; + void *values[13]; + float fa[13]; + float f, ff; + int i; + + for (i = 0; i < 13; i++) + { + args[i] = &ffi_type_float; + values[i] = &fa[i]; + fa[i] = (float) i; + } + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 13, + &ffi_type_float, args) == FFI_OK); + + ffi_call(&cif, FFI_FN(many), &f, values); + + ff = many(fa[0], fa[1], + fa[2], fa[3], + fa[4], fa[5], + fa[6], fa[7], + fa[8], fa[9], + fa[10],fa[11],fa[12]); + + if (f - ff < FLT_EPSILON) + exit(0); + else + abort(); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/many_win32.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/many_win32.c new file mode 100644 index 000000000..1b2633227 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/many_win32.c @@ -0,0 +1,63 @@ +/* Area: ffi_call + Purpose: Check stdcall many call on X86_WIN32 systems. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ + +#include "ffitest.h" +#include + +static float __attribute__((stdcall)) stdcall_many(float f1, + float f2, + float f3, + float f4, + float f5, + float f6, + float f7, + float f8, + float f9, + float f10, + float f11, + float f12, + float f13) +{ + return ((f1/f2+f3/f4+f5/f6+f7/f8+f9/f10+f11/f12) * f13); +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[13]; + void *values[13]; + float fa[13]; + float f, ff; + unsigned long ul; + + for (ul = 0; ul < 13; ul++) + { + args[ul] = &ffi_type_float; + values[ul] = &fa[ul]; + fa[ul] = (float) ul; + } + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 13, + &ffi_type_float, args) == FFI_OK); + + ff = stdcall_many(fa[0], fa[1], + fa[2], fa[3], + fa[4], fa[5], + fa[6], fa[7], + fa[8], fa[9], + fa[10], fa[11], fa[12]); + + ffi_call(&cif, FFI_FN(stdcall_many), &f, values); + + if (f - ff < FLT_EPSILON) + printf("stdcall many arg tests ok!\n"); + else + CHECK(0); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/negint.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/negint.c new file mode 100644 index 000000000..316811302 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/negint.c @@ -0,0 +1,53 @@ +/* Area: ffi_call + Purpose: Check that negative integers are passed correctly. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +/* { dg-options -O2 } */ + +#include "ffitest.h" + +static int checking(int a, short b, signed char c) +{ + + return (a < 0 && b < 0 && c < 0); +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_arg rint; + + signed int si; + signed short ss; + signed char sc; + + args[0] = &ffi_type_sint; + values[0] = &si; + args[1] = &ffi_type_sshort; + values[1] = &ss; + args[2] = &ffi_type_schar; + values[2] = ≻ + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, + &ffi_type_sint, args) == FFI_OK); + + si = -6; + ss = -12; + sc = -1; + + checking (si, ss, sc); + + ffi_call(&cif, FFI_FN(checking), &rint, values); + + printf ("%d vs %d\n", (int)rint, checking (si, ss, sc)); + + CHECK(rint != 0); + + exit (0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct.c new file mode 100644 index 000000000..8aa527ede --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct.c @@ -0,0 +1,152 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Contains structs as parameter of the struct itself. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_16byte1 { + double a; + float b; + int c; +} cls_struct_16byte1; + +typedef struct cls_struct_16byte2 { + int ii; + double dd; + float ff; +} cls_struct_16byte2; + +typedef struct cls_struct_combined { + cls_struct_16byte1 d; + cls_struct_16byte2 e; +} cls_struct_combined; + +cls_struct_combined cls_struct_combined_fn(struct cls_struct_16byte1 b0, + struct cls_struct_16byte2 b1, + struct cls_struct_combined b2) +{ + struct cls_struct_combined result; + + result.d.a = b0.a + b1.dd + b2.d.a; + result.d.b = b0.b + b1.ff + b2.d.b; + result.d.c = b0.c + b1.ii + b2.d.c; + result.e.ii = b0.c + b1.ii + b2.e.ii; + result.e.dd = b0.a + b1.dd + b2.e.dd; + result.e.ff = b0.b + b1.ff + b2.e.ff; + + printf("%g %g %d %d %g %g %g %g %d %d %g %g: %g %g %d %d %g %g\n", + b0.a, b0.b, b0.c, + b1.ii, b1.dd, b1.ff, + b2.d.a, b2.d.b, b2.d.c, + b2.e.ii, b2.e.dd, b2.e.ff, + result.d.a, result.d.b, result.d.c, + result.e.ii, result.e.dd, result.e.ff); + + return result; +} + +static void +cls_struct_combined_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct cls_struct_16byte1 b0; + struct cls_struct_16byte2 b1; + struct cls_struct_combined b2; + + b0 = *(struct cls_struct_16byte1*)(args[0]); + b1 = *(struct cls_struct_16byte2*)(args[1]); + b2 = *(struct cls_struct_combined*)(args[2]); + + + *(cls_struct_combined*)resp = cls_struct_combined_fn(b0, b1, b2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[5]; + ffi_type* cls_struct_fields1[5]; + ffi_type* cls_struct_fields2[5]; + ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + cls_struct_type1.size = 0; + cls_struct_type1.alignment = 0; + cls_struct_type1.type = FFI_TYPE_STRUCT; + cls_struct_type1.elements = cls_struct_fields1; + + cls_struct_type2.size = 0; + cls_struct_type2.alignment = 0; + cls_struct_type2.type = FFI_TYPE_STRUCT; + cls_struct_type2.elements = cls_struct_fields2; + + struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6}; + struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0}; + struct cls_struct_combined g_dbl = {{4.0, 5.0, 6}, + {3, 1.0, 8.0}}; + struct cls_struct_combined res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_float; + cls_struct_fields[2] = &ffi_type_sint; + cls_struct_fields[3] = NULL; + + cls_struct_fields1[0] = &ffi_type_sint; + cls_struct_fields1[1] = &ffi_type_double; + cls_struct_fields1[2] = &ffi_type_float; + cls_struct_fields1[3] = NULL; + + cls_struct_fields2[0] = &cls_struct_type; + cls_struct_fields2[1] = &cls_struct_type1; + cls_struct_fields2[2] = NULL; + + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type1; + dbl_arg_types[2] = &cls_struct_type2; + dbl_arg_types[3] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type2, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_combined_fn), &res_dbl, args_dbl); + /* { dg-output "9 2 6 1 2 3 4 5 6 3 1 8: 15 10 13 10 12 13" } */ + CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a)); + CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b)); + CHECK( res_dbl.d.c == (e_dbl.c + f_dbl.ii + g_dbl.d.c)); + CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); + CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); + CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_combined_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_combined(*)(cls_struct_16byte1, + cls_struct_16byte2, + cls_struct_combined)) + (code))(e_dbl, f_dbl, g_dbl); + /* { dg-output "\n9 2 6 1 2 3 4 5 6 3 1 8: 15 10 13 10 12 13" } */ + CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a)); + CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b)); + CHECK( res_dbl.d.c == (e_dbl.c + f_dbl.ii + g_dbl.d.c)); + CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); + CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); + CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct1.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct1.c new file mode 100644 index 000000000..2a9f515cd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct1.c @@ -0,0 +1,161 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Contains structs as parameter of the struct itself. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_16byte1 { + double a; + float b; + int c; +} cls_struct_16byte1; + +typedef struct cls_struct_16byte2 { + int ii; + double dd; + float ff; +} cls_struct_16byte2; + +typedef struct cls_struct_combined { + cls_struct_16byte1 d; + cls_struct_16byte2 e; +} cls_struct_combined; + +cls_struct_combined cls_struct_combined_fn(struct cls_struct_16byte1 b0, + struct cls_struct_16byte2 b1, + struct cls_struct_combined b2, + struct cls_struct_16byte1 b3) +{ + struct cls_struct_combined result; + + result.d.a = b0.a + b1.dd + b2.d.a; + result.d.b = b0.b + b1.ff + b2.d.b; + result.d.c = b0.c + b1.ii + b2.d.c; + result.e.ii = b0.c + b1.ii + b2.e.ii; + result.e.dd = b0.a + b1.dd + b2.e.dd; + result.e.ff = b0.b + b1.ff + b2.e.ff; + + printf("%g %g %d %d %g %g %g %g %d %d %g %g %g %g %d: %g %g %d %d %g %g\n", + b0.a, b0.b, b0.c, + b1.ii, b1.dd, b1.ff, + b2.d.a, b2.d.b, b2.d.c, + b2.e.ii, b2.e.dd, b2.e.ff, + b3.a, b3.b, b3.c, + result.d.a, result.d.b, result.d.c, + result.e.ii, result.e.dd, result.e.ff); + + return result; +} + +static void +cls_struct_combined_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct cls_struct_16byte1 b0; + struct cls_struct_16byte2 b1; + struct cls_struct_combined b2; + struct cls_struct_16byte1 b3; + + b0 = *(struct cls_struct_16byte1*)(args[0]); + b1 = *(struct cls_struct_16byte2*)(args[1]); + b2 = *(struct cls_struct_combined*)(args[2]); + b3 = *(struct cls_struct_16byte1*)(args[3]); + + + *(cls_struct_combined*)resp = cls_struct_combined_fn(b0, b1, b2, b3); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[5]; + ffi_type* cls_struct_fields1[5]; + ffi_type* cls_struct_fields2[5]; + ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + cls_struct_type1.size = 0; + cls_struct_type1.alignment = 0; + cls_struct_type1.type = FFI_TYPE_STRUCT; + cls_struct_type1.elements = cls_struct_fields1; + + cls_struct_type2.size = 0; + cls_struct_type2.alignment = 0; + cls_struct_type2.type = FFI_TYPE_STRUCT; + cls_struct_type2.elements = cls_struct_fields2; + + struct cls_struct_16byte1 e_dbl = { 9.0, 2.0, 6}; + struct cls_struct_16byte2 f_dbl = { 1, 2.0, 3.0}; + struct cls_struct_combined g_dbl = {{4.0, 5.0, 6}, + {3, 1.0, 8.0}}; + struct cls_struct_16byte1 h_dbl = { 3.0, 2.0, 4}; + struct cls_struct_combined res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_float; + cls_struct_fields[2] = &ffi_type_sint; + cls_struct_fields[3] = NULL; + + cls_struct_fields1[0] = &ffi_type_sint; + cls_struct_fields1[1] = &ffi_type_double; + cls_struct_fields1[2] = &ffi_type_float; + cls_struct_fields1[3] = NULL; + + cls_struct_fields2[0] = &cls_struct_type; + cls_struct_fields2[1] = &cls_struct_type1; + cls_struct_fields2[2] = NULL; + + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type1; + dbl_arg_types[2] = &cls_struct_type2; + dbl_arg_types[3] = &cls_struct_type; + dbl_arg_types[4] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type2, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = &h_dbl; + args_dbl[4] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_combined_fn), &res_dbl, args_dbl); + /* { dg-output "9 2 6 1 2 3 4 5 6 3 1 8 3 2 4: 15 10 13 10 12 13" } */ + CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a)); + CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b)); + CHECK( res_dbl.d.c == (e_dbl.c + f_dbl.ii + g_dbl.d.c)); + CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); + CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); + CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_combined_gn, NULL, code) == FFI_OK); + + res_dbl = ((cls_struct_combined(*)(cls_struct_16byte1, + cls_struct_16byte2, + cls_struct_combined, + cls_struct_16byte1)) + (code))(e_dbl, f_dbl, g_dbl, h_dbl); + /* { dg-output "\n9 2 6 1 2 3 4 5 6 3 1 8 3 2 4: 15 10 13 10 12 13" } */ + CHECK( res_dbl.d.a == (e_dbl.a + f_dbl.dd + g_dbl.d.a)); + CHECK( res_dbl.d.b == (e_dbl.b + f_dbl.ff + g_dbl.d.b)); + CHECK( res_dbl.d.c == (e_dbl.c + f_dbl.ii + g_dbl.d.c)); + CHECK( res_dbl.e.ii == (e_dbl.c + f_dbl.ii + g_dbl.e.ii)); + CHECK( res_dbl.e.dd == (e_dbl.a + f_dbl.dd + g_dbl.e.dd)); + CHECK( res_dbl.e.ff == (e_dbl.b + f_dbl.ff + g_dbl.e.ff)); + // CHECK( 1 == 0); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct10.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct10.c new file mode 100644 index 000000000..d6a718bdd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct10.c @@ -0,0 +1,133 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Contains structs as parameter of the struct itself. + Sample taken from Alan Modras patch to src/prep_cif.c. + Limitations: none. + PR: none. + Originator: 20051010 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct A { + unsigned long long a; + unsigned char b; +} A; + +typedef struct B { + unsigned char y; + struct A x; + unsigned int z; +} B; + +typedef struct C { + unsigned long long d; + unsigned char e; +} C; + +static B B_fn(struct A b2, struct B b3, struct C b4) +{ + struct B result; + + result.x.a = b2.a + b3.x.a + b3.z + b4.d; + result.x.b = b2.b + b3.x.b + b3.y + b4.e; + result.y = b2.b + b3.x.b + b4.e; + + printf("%d %d %d %d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, + (int)b3.x.a, b3.x.b, b3.y, b3.z, (int)b4.d, b4.e, + (int)result.x.a, result.x.b, result.y); + + return result; +} + +static void +B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct A b0; + struct B b1; + struct C b2; + + b0 = *(struct A*)(args[0]); + b1 = *(struct B*)(args[1]); + b2 = *(struct C*)(args[2]); + + *(B*)resp = B_fn(b0, b1, b2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[4]; + ffi_type* cls_struct_fields[3]; + ffi_type* cls_struct_fields1[4]; + ffi_type* cls_struct_fields2[3]; + ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; + ffi_type* dbl_arg_types[4]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + cls_struct_type1.size = 0; + cls_struct_type1.alignment = 0; + cls_struct_type1.type = FFI_TYPE_STRUCT; + cls_struct_type1.elements = cls_struct_fields1; + + cls_struct_type2.size = 0; + cls_struct_type2.alignment = 0; + cls_struct_type2.type = FFI_TYPE_STRUCT; + cls_struct_type2.elements = cls_struct_fields2; + + struct A e_dbl = { 1LL, 7}; + struct B f_dbl = { 99, {12LL , 127}, 255}; + struct C g_dbl = { 2LL, 9}; + + struct B res_dbl; + + cls_struct_fields[0] = &ffi_type_uint64; + cls_struct_fields[1] = &ffi_type_uchar; + cls_struct_fields[2] = NULL; + + cls_struct_fields1[0] = &ffi_type_uchar; + cls_struct_fields1[1] = &cls_struct_type; + cls_struct_fields1[2] = &ffi_type_uint; + cls_struct_fields1[3] = NULL; + + cls_struct_fields2[0] = &ffi_type_uint64; + cls_struct_fields2[1] = &ffi_type_uchar; + cls_struct_fields2[2] = NULL; + + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type1; + dbl_arg_types[2] = &cls_struct_type2; + dbl_arg_types[3] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type1, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = NULL; + + ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); + /* { dg-output "1 7 12 127 99 255 2 9: 270 242 143" } */ + CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + f_dbl.z + g_dbl.d)); + CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); + CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); + + CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); + + res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); + /* { dg-output "\n1 7 12 127 99 255 2 9: 270 242 143" } */ + CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + f_dbl.z + g_dbl.d)); + CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); + CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct2.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct2.c new file mode 100644 index 000000000..de1584c18 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct2.c @@ -0,0 +1,110 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Contains structs as parameter of the struct itself. + Sample taken from Alan Modras patch to src/prep_cif.c. + Limitations: none. + PR: none. + Originator: 20030911 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct A { + unsigned long a; + unsigned char b; +} A; + +typedef struct B { + struct A x; + unsigned char y; +} B; + +B B_fn(struct A b0, struct B b1) +{ + struct B result; + + result.x.a = b0.a + b1.x.a; + result.x.b = b0.b + b1.x.b + b1.y; + result.y = b0.b + b1.x.b; + + printf("%lu %d %lu %d %d: %lu %d %d\n", b0.a, b0.b, b1.x.a, b1.x.b, b1.y, + result.x.a, result.x.b, result.y); + + return result; +} + +static void +B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct A b0; + struct B b1; + + b0 = *(struct A*)(args[0]); + b1 = *(struct B*)(args[1]); + + *(B*)resp = B_fn(b0, b1); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[3]; + ffi_type* cls_struct_fields[3]; + ffi_type* cls_struct_fields1[3]; + ffi_type cls_struct_type, cls_struct_type1; + ffi_type* dbl_arg_types[3]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + cls_struct_type1.size = 0; + cls_struct_type1.alignment = 0; + cls_struct_type1.type = FFI_TYPE_STRUCT; + cls_struct_type1.elements = cls_struct_fields1; + + struct A e_dbl = { 1, 7}; + struct B f_dbl = {{12 , 127}, 99}; + + struct B res_dbl; + + cls_struct_fields[0] = &ffi_type_ulong; + cls_struct_fields[1] = &ffi_type_uchar; + cls_struct_fields[2] = NULL; + + cls_struct_fields1[0] = &cls_struct_type; + cls_struct_fields1[1] = &ffi_type_uchar; + cls_struct_fields1[2] = NULL; + + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type1; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); + /* { dg-output "1 7 12 127 99: 13 233 134" } */ + CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); + CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); + CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); + + CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); + + res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); + /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ + CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); + CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); + CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct3.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct3.c new file mode 100644 index 000000000..58aa85362 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct3.c @@ -0,0 +1,111 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Contains structs as parameter of the struct itself. + Sample taken from Alan Modras patch to src/prep_cif.c. + Limitations: none. + PR: none. + Originator: 20030911 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct A { + unsigned long long a; + unsigned char b; +} A; + +typedef struct B { + struct A x; + unsigned char y; +} B; + +B B_fn(struct A b0, struct B b1) +{ + struct B result; + + result.x.a = b0.a + b1.x.a; + result.x.b = b0.b + b1.x.b + b1.y; + result.y = b0.b + b1.x.b; + + printf("%d %d %d %d %d: %d %d %d\n", (int)b0.a, b0.b, + (int)b1.x.a, b1.x.b, b1.y, + (int)result.x.a, result.x.b, result.y); + + return result; +} + +static void +B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct A b0; + struct B b1; + + b0 = *(struct A*)(args[0]); + b1 = *(struct B*)(args[1]); + + *(B*)resp = B_fn(b0, b1); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[3]; + ffi_type* cls_struct_fields[3]; + ffi_type* cls_struct_fields1[3]; + ffi_type cls_struct_type, cls_struct_type1; + ffi_type* dbl_arg_types[3]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + cls_struct_type1.size = 0; + cls_struct_type1.alignment = 0; + cls_struct_type1.type = FFI_TYPE_STRUCT; + cls_struct_type1.elements = cls_struct_fields1; + + struct A e_dbl = { 1LL, 7}; + struct B f_dbl = {{12LL , 127}, 99}; + + struct B res_dbl; + + cls_struct_fields[0] = &ffi_type_uint64; + cls_struct_fields[1] = &ffi_type_uchar; + cls_struct_fields[2] = NULL; + + cls_struct_fields1[0] = &cls_struct_type; + cls_struct_fields1[1] = &ffi_type_uchar; + cls_struct_fields1[2] = NULL; + + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type1; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); + /* { dg-output "1 7 12 127 99: 13 233 134" } */ + CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); + CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); + CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); + + + CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); + + res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); + /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ + CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); + CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); + CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct4.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct4.c new file mode 100644 index 000000000..98e491e65 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct4.c @@ -0,0 +1,111 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Contains structs as parameter of the struct itself. + Sample taken from Alan Modras patch to src/prep_cif.c. + Limitations: none. + PR: PR 25630. + Originator: 20051010 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct A { + double a; + unsigned char b; +} A; + +typedef struct B { + struct A x; + unsigned char y; +} B; + +static B B_fn(struct A b2, struct B b3) +{ + struct B result; + + result.x.a = b2.a + b3.x.a; + result.x.b = b2.b + b3.x.b + b3.y; + result.y = b2.b + b3.x.b; + + printf("%d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, + (int)b3.x.a, b3.x.b, b3.y, + (int)result.x.a, result.x.b, result.y); + + return result; +} + +static void +B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct A b0; + struct B b1; + + b0 = *(struct A*)(args[0]); + b1 = *(struct B*)(args[1]); + + *(B*)resp = B_fn(b0, b1); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[3]; + ffi_type* cls_struct_fields[3]; + ffi_type* cls_struct_fields1[3]; + ffi_type cls_struct_type, cls_struct_type1; + ffi_type* dbl_arg_types[3]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + cls_struct_type1.size = 0; + cls_struct_type1.alignment = 0; + cls_struct_type1.type = FFI_TYPE_STRUCT; + cls_struct_type1.elements = cls_struct_fields1; + + struct A e_dbl = { 1.0, 7}; + struct B f_dbl = {{12.0 , 127}, 99}; + + struct B res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_uchar; + cls_struct_fields[2] = NULL; + + cls_struct_fields1[0] = &cls_struct_type; + cls_struct_fields1[1] = &ffi_type_uchar; + cls_struct_fields1[2] = NULL; + + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type1; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); + /* { dg-output "1 7 12 127 99: 13 233 134" } */ + CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); + CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); + CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); + + CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); + + res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); + /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ + CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); + CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); + CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct5.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct5.c new file mode 100644 index 000000000..d8e3537d5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct5.c @@ -0,0 +1,112 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Contains structs as parameter of the struct itself. + Sample taken from Alan Modras patch to src/prep_cif.c. + Limitations: none. + PR: none. + Originator: 20051010 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct A { + long double a; + unsigned char b; +} A; + +typedef struct B { + struct A x; + unsigned char y; +} B; + +static B B_fn(struct A b2, struct B b3) +{ + struct B result; + + result.x.a = b2.a + b3.x.a; + result.x.b = b2.b + b3.x.b + b3.y; + result.y = b2.b + b3.x.b; + + printf("%d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, + (int)b3.x.a, b3.x.b, b3.y, + (int)result.x.a, result.x.b, result.y); + + return result; +} + +static void +B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct A b0; + struct B b1; + + b0 = *(struct A*)(args[0]); + b1 = *(struct B*)(args[1]); + + *(B*)resp = B_fn(b0, b1); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[3]; + ffi_type* cls_struct_fields[3]; + ffi_type* cls_struct_fields1[3]; + ffi_type cls_struct_type, cls_struct_type1; + ffi_type* dbl_arg_types[3]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + cls_struct_type1.size = 0; + cls_struct_type1.alignment = 0; + cls_struct_type1.type = FFI_TYPE_STRUCT; + cls_struct_type1.elements = cls_struct_fields1; + + struct A e_dbl = { 1.0, 7}; + struct B f_dbl = {{12.0 , 127}, 99}; + + struct B res_dbl; + + cls_struct_fields[0] = &ffi_type_longdouble; + cls_struct_fields[1] = &ffi_type_uchar; + cls_struct_fields[2] = NULL; + + cls_struct_fields1[0] = &cls_struct_type; + cls_struct_fields1[1] = &ffi_type_uchar; + cls_struct_fields1[2] = NULL; + + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type1; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); + /* { dg-output "1 7 12 127 99: 13 233 134" } */ + CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); + CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); + CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); + + + CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); + + res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); + /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ + CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); + CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); + CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct6.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct6.c new file mode 100644 index 000000000..2f2b25a15 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct6.c @@ -0,0 +1,131 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Contains structs as parameter of the struct itself. + Sample taken from Alan Modras patch to src/prep_cif.c. + Limitations: none. + PR: PR 25630. + Originator: 20051010 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct A { + double a; + unsigned char b; +} A; + +typedef struct B { + struct A x; + unsigned char y; +} B; + +typedef struct C { + long d; + unsigned char e; +} C; + +static B B_fn(struct A b2, struct B b3, struct C b4) +{ + struct B result; + + result.x.a = b2.a + b3.x.a + b4.d; + result.x.b = b2.b + b3.x.b + b3.y + b4.e; + result.y = b2.b + b3.x.b + b4.e; + + printf("%d %d %d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, + (int)b3.x.a, b3.x.b, b3.y, (int)b4.d, b4.e, + (int)result.x.a, result.x.b, result.y); + + return result; +} + +static void +B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct A b0; + struct B b1; + struct C b2; + + b0 = *(struct A*)(args[0]); + b1 = *(struct B*)(args[1]); + b2 = *(struct C*)(args[2]); + + *(B*)resp = B_fn(b0, b1, b2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[4]; + ffi_type* cls_struct_fields[3]; + ffi_type* cls_struct_fields1[3]; + ffi_type* cls_struct_fields2[3]; + ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; + ffi_type* dbl_arg_types[4]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + cls_struct_type1.size = 0; + cls_struct_type1.alignment = 0; + cls_struct_type1.type = FFI_TYPE_STRUCT; + cls_struct_type1.elements = cls_struct_fields1; + + cls_struct_type2.size = 0; + cls_struct_type2.alignment = 0; + cls_struct_type2.type = FFI_TYPE_STRUCT; + cls_struct_type2.elements = cls_struct_fields2; + + struct A e_dbl = { 1.0, 7}; + struct B f_dbl = {{12.0 , 127}, 99}; + struct C g_dbl = { 2, 9}; + + struct B res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_uchar; + cls_struct_fields[2] = NULL; + + cls_struct_fields1[0] = &cls_struct_type; + cls_struct_fields1[1] = &ffi_type_uchar; + cls_struct_fields1[2] = NULL; + + cls_struct_fields2[0] = &ffi_type_slong; + cls_struct_fields2[1] = &ffi_type_uchar; + cls_struct_fields2[2] = NULL; + + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type1; + dbl_arg_types[2] = &cls_struct_type2; + dbl_arg_types[3] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type1, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = NULL; + + ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); + /* { dg-output "1 7 12 127 99 2 9: 15 242 143" } */ + CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); + CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); + CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); + + CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); + + res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); + /* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */ + CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); + CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); + CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct7.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct7.c new file mode 100644 index 000000000..14c70239e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct7.c @@ -0,0 +1,111 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Contains structs as parameter of the struct itself. + Sample taken from Alan Modras patch to src/prep_cif.c. + Limitations: none. + PR: none. + Originator: 20051010 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct A { + unsigned long long a; + unsigned char b; +} A; + +typedef struct B { + struct A x; + unsigned char y; +} B; + +static B B_fn(struct A b2, struct B b3) +{ + struct B result; + + result.x.a = b2.a + b3.x.a; + result.x.b = b2.b + b3.x.b + b3.y; + result.y = b2.b + b3.x.b; + + printf("%d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, + (int)b3.x.a, b3.x.b, b3.y, + (int)result.x.a, result.x.b, result.y); + + return result; +} + +static void +B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct A b0; + struct B b1; + + b0 = *(struct A*)(args[0]); + b1 = *(struct B*)(args[1]); + + *(B*)resp = B_fn(b0, b1); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[3]; + ffi_type* cls_struct_fields[3]; + ffi_type* cls_struct_fields1[3]; + ffi_type cls_struct_type, cls_struct_type1; + ffi_type* dbl_arg_types[3]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + cls_struct_type1.size = 0; + cls_struct_type1.alignment = 0; + cls_struct_type1.type = FFI_TYPE_STRUCT; + cls_struct_type1.elements = cls_struct_fields1; + + struct A e_dbl = { 1LL, 7}; + struct B f_dbl = {{12.0 , 127}, 99}; + + struct B res_dbl; + + cls_struct_fields[0] = &ffi_type_uint64; + cls_struct_fields[1] = &ffi_type_uchar; + cls_struct_fields[2] = NULL; + + cls_struct_fields1[0] = &cls_struct_type; + cls_struct_fields1[1] = &ffi_type_uchar; + cls_struct_fields1[2] = NULL; + + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type1; + dbl_arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &cls_struct_type1, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = NULL; + + ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); + /* { dg-output "1 7 12 127 99: 13 233 134" } */ + CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); + CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); + CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); + + CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); + + res_dbl = ((B(*)(A, B))(code))(e_dbl, f_dbl); + /* { dg-output "\n1 7 12 127 99: 13 233 134" } */ + CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a)); + CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y)); + CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b)); + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct8.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct8.c new file mode 100644 index 000000000..bb77ead8d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct8.c @@ -0,0 +1,131 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Contains structs as parameter of the struct itself. + Sample taken from Alan Modras patch to src/prep_cif.c. + Limitations: none. + PR: none. + Originator: 20051010 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct A { + unsigned long long a; + unsigned char b; +} A; + +typedef struct B { + struct A x; + unsigned char y; +} B; + +typedef struct C { + unsigned long long d; + unsigned char e; +} C; + +static B B_fn(struct A b2, struct B b3, struct C b4) +{ + struct B result; + + result.x.a = b2.a + b3.x.a + b4.d; + result.x.b = b2.b + b3.x.b + b3.y + b4.e; + result.y = b2.b + b3.x.b + b4.e; + + printf("%d %d %d %d %d %d %d: %d %d %d\n", (int)b2.a, b2.b, + (int)b3.x.a, b3.x.b, b3.y, (int)b4.d, b4.e, + (int)result.x.a, result.x.b, result.y); + + return result; +} + +static void +B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct A b0; + struct B b1; + struct C b2; + + b0 = *(struct A*)(args[0]); + b1 = *(struct B*)(args[1]); + b2 = *(struct C*)(args[2]); + + *(B*)resp = B_fn(b0, b1, b2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[4]; + ffi_type* cls_struct_fields[3]; + ffi_type* cls_struct_fields1[3]; + ffi_type* cls_struct_fields2[3]; + ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; + ffi_type* dbl_arg_types[4]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + cls_struct_type1.size = 0; + cls_struct_type1.alignment = 0; + cls_struct_type1.type = FFI_TYPE_STRUCT; + cls_struct_type1.elements = cls_struct_fields1; + + cls_struct_type2.size = 0; + cls_struct_type2.alignment = 0; + cls_struct_type2.type = FFI_TYPE_STRUCT; + cls_struct_type2.elements = cls_struct_fields2; + + struct A e_dbl = { 1LL, 7}; + struct B f_dbl = {{12LL , 127}, 99}; + struct C g_dbl = { 2LL, 9}; + + struct B res_dbl; + + cls_struct_fields[0] = &ffi_type_uint64; + cls_struct_fields[1] = &ffi_type_uchar; + cls_struct_fields[2] = NULL; + + cls_struct_fields1[0] = &cls_struct_type; + cls_struct_fields1[1] = &ffi_type_uchar; + cls_struct_fields1[2] = NULL; + + cls_struct_fields2[0] = &ffi_type_uint64; + cls_struct_fields2[1] = &ffi_type_uchar; + cls_struct_fields2[2] = NULL; + + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type1; + dbl_arg_types[2] = &cls_struct_type2; + dbl_arg_types[3] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type1, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = NULL; + + ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); + /* { dg-output "1 7 12 127 99 2 9: 15 242 143" } */ + CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); + CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); + CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); + + CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); + + res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); + /* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */ + CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); + CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); + CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct9.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct9.c new file mode 100644 index 000000000..e9f541c83 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/nested_struct9.c @@ -0,0 +1,131 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Contains structs as parameter of the struct itself. + Sample taken from Alan Modras patch to src/prep_cif.c. + Limitations: none. + PR: none. + Originator: 20051010 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct A { + unsigned char a; + unsigned long long b; +} A; + +typedef struct B { + struct A x; + unsigned char y; +} B; + +typedef struct C { + unsigned long d; + unsigned char e; +} C; + +static B B_fn(struct A b2, struct B b3, struct C b4) +{ + struct B result; + + result.x.a = b2.a + b3.x.a + b4.d; + result.x.b = b2.b + b3.x.b + b3.y + b4.e; + result.y = b2.b + b3.x.b + b4.e; + + printf("%d %d %d %d %d %d %d: %d %d %d\n", b2.a, (int)b2.b, + b3.x.a, (int)b3.x.b, b3.y, (int)b4.d, b4.e, + result.x.a, (int)result.x.b, result.y); + + return result; +} + +static void +B_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct A b0; + struct B b1; + struct C b2; + + b0 = *(struct A*)(args[0]); + b1 = *(struct B*)(args[1]); + b2 = *(struct C*)(args[2]); + + *(B*)resp = B_fn(b0, b1, b2); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[4]; + ffi_type* cls_struct_fields[3]; + ffi_type* cls_struct_fields1[3]; + ffi_type* cls_struct_fields2[3]; + ffi_type cls_struct_type, cls_struct_type1, cls_struct_type2; + ffi_type* dbl_arg_types[4]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + cls_struct_type1.size = 0; + cls_struct_type1.alignment = 0; + cls_struct_type1.type = FFI_TYPE_STRUCT; + cls_struct_type1.elements = cls_struct_fields1; + + cls_struct_type2.size = 0; + cls_struct_type2.alignment = 0; + cls_struct_type2.type = FFI_TYPE_STRUCT; + cls_struct_type2.elements = cls_struct_fields2; + + struct A e_dbl = { 1, 7LL}; + struct B f_dbl = {{12.0 , 127}, 99}; + struct C g_dbl = { 2, 9}; + + struct B res_dbl; + + cls_struct_fields[0] = &ffi_type_uchar; + cls_struct_fields[1] = &ffi_type_uint64; + cls_struct_fields[2] = NULL; + + cls_struct_fields1[0] = &cls_struct_type; + cls_struct_fields1[1] = &ffi_type_uchar; + cls_struct_fields1[2] = NULL; + + cls_struct_fields2[0] = &ffi_type_ulong; + cls_struct_fields2[1] = &ffi_type_uchar; + cls_struct_fields2[2] = NULL; + + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type1; + dbl_arg_types[2] = &cls_struct_type2; + dbl_arg_types[3] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, &cls_struct_type1, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = NULL; + + ffi_call(&cif, FFI_FN(B_fn), &res_dbl, args_dbl); + /* { dg-output "1 7 12 127 99 2 9: 15 242 143" } */ + CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); + CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); + CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); + + CHECK(ffi_prep_closure_loc(pcl, &cif, B_gn, NULL, code) == FFI_OK); + + res_dbl = ((B(*)(A, B, C))(code))(e_dbl, f_dbl, g_dbl); + /* { dg-output "\n1 7 12 127 99 2 9: 15 242 143" } */ + CHECK( res_dbl.x.a == (e_dbl.a + f_dbl.x.a + g_dbl.d)); + CHECK( res_dbl.x.b == (e_dbl.b + f_dbl.x.b + f_dbl.y + g_dbl.e)); + CHECK( res_dbl.y == (e_dbl.b + f_dbl.x.b + g_dbl.e)); + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/problem1.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/problem1.c new file mode 100644 index 000000000..6a91555a1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/problem1.c @@ -0,0 +1,90 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure passing with different structure size. + Limitations: none. + PR: none. + Originator: 20030828 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct my_ffi_struct { + double a; + double b; + double c; +} my_ffi_struct; + +my_ffi_struct callee(struct my_ffi_struct a1, struct my_ffi_struct a2) +{ + struct my_ffi_struct result; + result.a = a1.a + a2.a; + result.b = a1.b + a2.b; + result.c = a1.c + a2.c; + + + printf("%g %g %g %g %g %g: %g %g %g\n", a1.a, a1.b, a1.c, + a2.a, a2.b, a2.c, result.a, result.b, result.c); + + return result; +} + +void stub(ffi_cif* cif __UNUSED__, void* resp, void** args, + void* userdata __UNUSED__) +{ + struct my_ffi_struct a1; + struct my_ffi_struct a2; + + a1 = *(struct my_ffi_struct*)(args[0]); + a2 = *(struct my_ffi_struct*)(args[1]); + + *(my_ffi_struct *)resp = callee(a1, a2); +} + + +int main(void) +{ + ffi_type* my_ffi_struct_fields[4]; + ffi_type my_ffi_struct_type; + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args[4]; + ffi_type* arg_types[3]; + + struct my_ffi_struct g = { 1.0, 2.0, 3.0 }; + struct my_ffi_struct f = { 1.0, 2.0, 3.0 }; + struct my_ffi_struct res; + + my_ffi_struct_type.size = 0; + my_ffi_struct_type.alignment = 0; + my_ffi_struct_type.type = FFI_TYPE_STRUCT; + my_ffi_struct_type.elements = my_ffi_struct_fields; + + my_ffi_struct_fields[0] = &ffi_type_double; + my_ffi_struct_fields[1] = &ffi_type_double; + my_ffi_struct_fields[2] = &ffi_type_double; + my_ffi_struct_fields[3] = NULL; + + arg_types[0] = &my_ffi_struct_type; + arg_types[1] = &my_ffi_struct_type; + arg_types[2] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &my_ffi_struct_type, + arg_types) == FFI_OK); + + args[0] = &g; + args[1] = &f; + args[2] = NULL; + ffi_call(&cif, FFI_FN(callee), &res, args); + /* { dg-output "1 2 3 1 2 3: 2 4 6" } */ + printf("res: %g %g %g\n", res.a, res.b, res.c); + /* { dg-output "\nres: 2 4 6" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, stub, NULL, code) == FFI_OK); + + res = ((my_ffi_struct(*)(struct my_ffi_struct, struct my_ffi_struct))(code))(g, f); + /* { dg-output "\n1 2 3 1 2 3: 2 4 6" } */ + printf("res: %g %g %g\n", res.a, res.b, res.c); + /* { dg-output "\nres: 2 4 6" } */ + + exit(0);; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/promotion.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/promotion.c new file mode 100644 index 000000000..44561615d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/promotion.c @@ -0,0 +1,59 @@ +/* Area: ffi_call + Purpose: Promotion test. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" +static int promotion(signed char sc, signed short ss, + unsigned char uc, unsigned short us) +{ + int r = (int) sc + (int) ss + (int) uc + (int) us; + + return r; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_arg rint; + signed char sc; + unsigned char uc; + signed short ss; + unsigned short us; + unsigned long ul; + + args[0] = &ffi_type_schar; + args[1] = &ffi_type_sshort; + args[2] = &ffi_type_uchar; + args[3] = &ffi_type_ushort; + values[0] = ≻ + values[1] = &ss; + values[2] = &uc; + values[3] = &us; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, + &ffi_type_sint, args) == FFI_OK); + + us = 0; + ul = 0; + + for (sc = (signed char) -127; + sc <= (signed char) 120; sc += 1) + for (ss = -30000; ss <= 30000; ss += 10000) + for (uc = (unsigned char) 0; + uc <= (unsigned char) 200; uc += 20) + for (us = 0; us <= 60000; us += 10000) + { + ul++; + ffi_call(&cif, FFI_FN(promotion), &rint, values); + CHECK((int)rint == (signed char) sc + (signed short) ss + + (unsigned char) uc + (unsigned short) us); + } + printf("%lu promotion tests run\n", ul); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/pyobjc-tc.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/pyobjc-tc.c new file mode 100644 index 000000000..e29bd6c28 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/pyobjc-tc.c @@ -0,0 +1,114 @@ +/* Area: ffi_call + Purpose: Check different structures. + Limitations: none. + PR: none. + Originator: Ronald Oussoren 20030824 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct Point { + float x; + float y; +} Point; + +typedef struct Size { + float h; + float w; +} Size; + +typedef struct Rect { + Point o; + Size s; +} Rect; + +int doit(int o, char* s, Point p, Rect r, int last) +{ + printf("CALLED WITH %d %s {%f %f} {{%f %f} {%f %f}} %d\n", + o, s, p.x, p.y, r.o.x, r.o.y, r.s.h, r.s.w, last); + return 42; +} + + +int main(void) +{ + ffi_type point_type; + ffi_type size_type; + ffi_type rect_type; + ffi_cif cif; + ffi_type* arglist[6]; + void* values[6]; + int r; + + /* + * First set up FFI types for the 3 struct types + */ + + point_type.size = 0; /*sizeof(Point);*/ + point_type.alignment = 0; /*__alignof__(Point);*/ + point_type.type = FFI_TYPE_STRUCT; + point_type.elements = malloc(3 * sizeof(ffi_type*)); + point_type.elements[0] = &ffi_type_float; + point_type.elements[1] = &ffi_type_float; + point_type.elements[2] = NULL; + + size_type.size = 0;/* sizeof(Size);*/ + size_type.alignment = 0;/* __alignof__(Size);*/ + size_type.type = FFI_TYPE_STRUCT; + size_type.elements = malloc(3 * sizeof(ffi_type*)); + size_type.elements[0] = &ffi_type_float; + size_type.elements[1] = &ffi_type_float; + size_type.elements[2] = NULL; + + rect_type.size = 0;/*sizeof(Rect);*/ + rect_type.alignment =0;/* __alignof__(Rect);*/ + rect_type.type = FFI_TYPE_STRUCT; + rect_type.elements = malloc(3 * sizeof(ffi_type*)); + rect_type.elements[0] = &point_type; + rect_type.elements[1] = &size_type; + rect_type.elements[2] = NULL; + + /* + * Create a CIF + */ + arglist[0] = &ffi_type_sint; + arglist[1] = &ffi_type_pointer; + arglist[2] = &point_type; + arglist[3] = &rect_type; + arglist[4] = &ffi_type_sint; + arglist[5] = NULL; + + r = ffi_prep_cif(&cif, FFI_DEFAULT_ABI, + 5, &ffi_type_sint, arglist); + if (r != FFI_OK) { + abort(); + } + + + /* And call the function through the CIF */ + + { + Point p = { 1.0, 2.0 }; + Rect r = { { 9.0, 10.0}, { -1.0, -2.0 } }; + int o = 0; + int l = 42; + char* m = "myMethod"; + ffi_arg result; + + values[0] = &o; + values[1] = &m; + values[2] = &p; + values[3] = &r; + values[4] = &l; + values[5] = NULL; + + printf("CALLING WITH %d %s {%f %f} {{%f %f} {%f %f}} %d\n", + o, m, p.x, p.y, r.o.x, r.o.y, r.s.h, r.s.w, l); + + ffi_call(&cif, FFI_FN(doit), &result, values); + + printf ("The result is %d\n", (int)result); + + } + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c new file mode 100644 index 000000000..1aab403d9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c @@ -0,0 +1,35 @@ +/* Area: ffi_call + Purpose: Check return value double. + Limitations: none. + PR: none. + Originator: 20050212 */ + +/* { dg-do run } */ +#include "ffitest.h" + +static double return_dbl(double dbl) +{ + return 2 * dbl; +} +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + double dbl, rdbl; + + args[0] = &ffi_type_double; + values[0] = &dbl; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_double, args) == FFI_OK); + + for (dbl = -127.3; dbl < 127; dbl++) + { + ffi_call(&cif, FFI_FN(return_dbl), &rdbl, values); + printf ("%f vs %f\n", rdbl, return_dbl(dbl)); + CHECK(rdbl == 2 * dbl); + } + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl1.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl1.c new file mode 100644 index 000000000..0ea5d5055 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl1.c @@ -0,0 +1,43 @@ +/* Area: ffi_call + Purpose: Check return value double. + Limitations: none. + PR: none. + Originator: 20050212 */ + +/* { dg-do run } */ +#include "ffitest.h" + +static double return_dbl(double dbl1, float fl2, unsigned int in3, double dbl4) +{ + return dbl1 + fl2 + in3 + dbl4; +} +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + double dbl1, dbl4, rdbl; + float fl2; + unsigned int in3; + args[0] = &ffi_type_double; + args[1] = &ffi_type_float; + args[2] = &ffi_type_uint; + args[3] = &ffi_type_double; + values[0] = &dbl1; + values[1] = &fl2; + values[2] = &in3; + values[3] = &dbl4; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, + &ffi_type_double, args) == FFI_OK); + dbl1 = 127.0; + fl2 = 128.0; + in3 = 255; + dbl4 = 512.7; + + ffi_call(&cif, FFI_FN(return_dbl), &rdbl, values); + printf ("%f vs %f\n", rdbl, return_dbl(dbl1, fl2, in3, dbl4)); + CHECK(rdbl == dbl1 + fl2 + in3 + dbl4); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl2.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl2.c new file mode 100644 index 000000000..b3818f866 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_dbl2.c @@ -0,0 +1,42 @@ +/* Area: ffi_call + Purpose: Check return value double. + Limitations: none. + PR: none. + Originator: 20050212 */ + +/* { dg-do run } */ +#include "ffitest.h" + +static double return_dbl(double dbl1, double dbl2, unsigned int in3, double dbl4) +{ + return dbl1 + dbl2 + in3 + dbl4; +} +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + double dbl1, dbl2, dbl4, rdbl; + unsigned int in3; + args[0] = &ffi_type_double; + args[1] = &ffi_type_double; + args[2] = &ffi_type_uint; + args[3] = &ffi_type_double; + values[0] = &dbl1; + values[1] = &dbl2; + values[2] = &in3; + values[3] = &dbl4; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, + &ffi_type_double, args) == FFI_OK); + dbl1 = 127.0; + dbl2 = 128.0; + in3 = 255; + dbl4 = 512.7; + + ffi_call(&cif, FFI_FN(return_dbl), &rdbl, values); + printf ("%f vs %f\n", rdbl, return_dbl(dbl1, dbl2, in3, dbl4)); + CHECK(rdbl == dbl1 + dbl2 + in3 + dbl4); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_fl.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_fl.c new file mode 100644 index 000000000..fb8a09e32 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_fl.c @@ -0,0 +1,35 @@ +/* Area: ffi_call + Purpose: Check return value float. + Limitations: none. + PR: none. + Originator: 20050212 */ + +/* { dg-do run } */ +#include "ffitest.h" + +static float return_fl(float fl) +{ + return 2 * fl; +} +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + float fl, rfl; + + args[0] = &ffi_type_float; + values[0] = &fl; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_float, args) == FFI_OK); + + for (fl = -127.0; fl < 127; fl++) + { + ffi_call(&cif, FFI_FN(return_fl), &rfl, values); + printf ("%f vs %f\n", rfl, return_fl(fl)); + CHECK(rfl == 2 * fl); + } + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_fl1.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_fl1.c new file mode 100644 index 000000000..c3d92c283 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_fl1.c @@ -0,0 +1,36 @@ +/* Area: ffi_call + Purpose: Check return value float. + Limitations: none. + PR: none. + Originator: 20050212 */ + +/* { dg-do run } */ +#include "ffitest.h" + +static float return_fl(float fl1, float fl2) +{ + return fl1 + fl2; +} +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + float fl1, fl2, rfl; + + args[0] = &ffi_type_float; + args[1] = &ffi_type_float; + values[0] = &fl1; + values[1] = &fl2; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, + &ffi_type_float, args) == FFI_OK); + fl1 = 127.0; + fl2 = 128.0; + + ffi_call(&cif, FFI_FN(return_fl), &rfl, values); + printf ("%f vs %f\n", rfl, return_fl(fl1, fl2)); + CHECK(rfl == fl1 + fl2); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c new file mode 100644 index 000000000..ddb976cc2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c @@ -0,0 +1,49 @@ +/* Area: ffi_call + Purpose: Check return value float. + Limitations: none. + PR: none. + Originator: 20050212 */ + +/* { dg-do run } */ +#include "ffitest.h" + +/* Use volatile float to avoid false negative on ix86. See PR target/323. */ +static float return_fl(float fl1, float fl2, float fl3, float fl4) +{ + volatile float sum; + + sum = fl1 + fl2 + fl3 + fl4; + return sum; +} +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + float fl1, fl2, fl3, fl4, rfl; + volatile float sum; + + args[0] = &ffi_type_float; + args[1] = &ffi_type_float; + args[2] = &ffi_type_float; + args[3] = &ffi_type_float; + values[0] = &fl1; + values[1] = &fl2; + values[2] = &fl3; + values[3] = &fl4; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, + &ffi_type_float, args) == FFI_OK); + fl1 = 127.0; + fl2 = 128.0; + fl3 = 255.1; + fl4 = 512.7; + + ffi_call(&cif, FFI_FN(return_fl), &rfl, values); + printf ("%f vs %f\n", rfl, return_fl(fl1, fl2, fl3, fl4)); + + sum = fl1 + fl2 + fl3 + fl4; + CHECK(rfl == sum); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_fl3.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_fl3.c new file mode 100644 index 000000000..c37877b18 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_fl3.c @@ -0,0 +1,42 @@ +/* Area: ffi_call + Purpose: Check return value float. + Limitations: none. + PR: none. + Originator: 20050212 */ + +/* { dg-do run } */ +#include "ffitest.h" + +static float return_fl(float fl1, float fl2, unsigned int in3, float fl4) +{ + return fl1 + fl2 + in3 + fl4; +} +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + float fl1, fl2, fl4, rfl; + unsigned int in3; + args[0] = &ffi_type_float; + args[1] = &ffi_type_float; + args[2] = &ffi_type_uint; + args[3] = &ffi_type_float; + values[0] = &fl1; + values[1] = &fl2; + values[2] = &in3; + values[3] = &fl4; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, + &ffi_type_float, args) == FFI_OK); + fl1 = 127.0; + fl2 = 128.0; + in3 = 255; + fl4 = 512.7; + + ffi_call(&cif, FFI_FN(return_fl), &rfl, values); + printf ("%f vs %f\n", rfl, return_fl(fl1, fl2, in3, fl4)); + CHECK(rfl == fl1 + fl2 + in3 + fl4); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c new file mode 100644 index 000000000..5c2fe65ae --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c @@ -0,0 +1,34 @@ +/* Area: ffi_call + Purpose: Check return value long double. + Limitations: none. + PR: none. + Originator: 20071113 */ + +/* { dg-do run { xfail x86_64-*-mingw* x86_64-*-cygwin* } } */ +#include "ffitest.h" + +static long double return_ldl(long double ldl) +{ + return 2*ldl; +} +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + long double ldl, rldl; + + args[0] = &ffi_type_longdouble; + values[0] = &ldl; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_longdouble, args) == FFI_OK); + + for (ldl = -127.0; ldl < 127.0; ldl++) + { + ffi_call(&cif, FFI_FN(return_ldl), &rldl, values); + CHECK(rldl == 2 * ldl); + } + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_ll.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_ll.c new file mode 100644 index 000000000..ea4a1e447 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_ll.c @@ -0,0 +1,41 @@ +/* Area: ffi_call + Purpose: Check return value long long. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" +static long long return_ll(long long ll) +{ + return ll; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + long long rlonglong; + long long ll; + + args[0] = &ffi_type_sint64; + values[0] = ≪ + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_sint64, args) == FFI_OK); + + for (ll = 0LL; ll < 100LL; ll++) + { + ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values); + CHECK(rlonglong == ll); + } + + for (ll = 55555555555000LL; ll < 55555555555100LL; ll++) + { + ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values); + CHECK(rlonglong == ll); + } + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c new file mode 100644 index 000000000..593e8a307 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c @@ -0,0 +1,43 @@ +/* Area: ffi_call + Purpose: Check if long long are passed in the corresponding regs on ppc. + Limitations: none. + PR: 20104. + Originator: 20050222 */ + +/* { dg-do run } */ +/* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ +#include "ffitest.h" +static long long return_ll(int ll0, long long ll1, int ll2) +{ + return ll0 + ll1 + ll2; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + long long rlonglong; + long long ll1; + unsigned ll0, ll2; + + args[0] = &ffi_type_sint; + args[1] = &ffi_type_sint64; + args[2] = &ffi_type_sint; + values[0] = &ll0; + values[1] = &ll1; + values[2] = &ll2; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, + &ffi_type_sint64, args) == FFI_OK); + + ll0 = 11111111; + ll1 = 11111111111000LL; + ll2 = 11111111; + + ffi_call(&cif, FFI_FN(return_ll), &rlonglong, values); + printf("res: %" PRIdLL ", %" PRIdLL "\n", rlonglong, ll0 + ll1 + ll2); + /* { dg-output "res: 11111133333222, 11111133333222" } */ + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c new file mode 100644 index 000000000..19608ee7c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c @@ -0,0 +1,36 @@ +/* Area: ffi_call + Purpose: Check return value signed char. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" + +static signed char return_sc(signed char sc) +{ + return sc; +} +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_arg rint; + signed char sc; + + args[0] = &ffi_type_schar; + values[0] = ≻ + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_schar, args) == FFI_OK); + + for (sc = (signed char) -127; + sc < (signed char) 127; sc++) + { + ffi_call(&cif, FFI_FN(return_sc), &rint, values); + CHECK(rint == (ffi_arg) sc); + } + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c new file mode 100644 index 000000000..f0fd345f7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c @@ -0,0 +1,38 @@ +/* Area: ffi_call + Purpose: Check if long as return type is handled correctly. + Limitations: none. + PR: none. + */ + +/* { dg-do run } */ +#include "ffitest.h" +static long return_sl(long l1, long l2) +{ + return l1 - l2; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_arg res; + unsigned long l1, l2; + + args[0] = &ffi_type_slong; + args[1] = &ffi_type_slong; + values[0] = &l1; + values[1] = &l2; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, + &ffi_type_slong, args) == FFI_OK); + + l1 = 1073741823L; + l2 = 1073741824L; + + ffi_call(&cif, FFI_FN(return_sl), &res, values); + printf("res: %ld, %ld\n", (long)res, l1 - l2); + /* { dg-output "res: -1, -1" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c new file mode 100644 index 000000000..07c45de51 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c @@ -0,0 +1,38 @@ +/* Area: ffi_call + Purpose: Check return value unsigned char. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" + +static unsigned char return_uc(unsigned char uc) +{ + return uc; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_arg rint; + + unsigned char uc; + + args[0] = &ffi_type_uchar; + values[0] = &uc; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_uchar, args) == FFI_OK); + + for (uc = (unsigned char) '\x00'; + uc < (unsigned char) '\xff'; uc++) + { + ffi_call(&cif, FFI_FN(return_uc), &rint, values); + CHECK(rint == (signed int) uc); + } + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c new file mode 100644 index 000000000..12b266f03 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c @@ -0,0 +1,38 @@ +/* Area: ffi_call + Purpose: Check if unsigned long as return type is handled correctly. + Limitations: none. + PR: none. + Originator: 20060724 */ + +/* { dg-do run } */ +#include "ffitest.h" +static unsigned long return_ul(unsigned long ul1, unsigned long ul2) +{ + return ul1 + ul2; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_arg res; + unsigned long ul1, ul2; + + args[0] = &ffi_type_ulong; + args[1] = &ffi_type_ulong; + values[0] = &ul1; + values[1] = &ul2; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, + &ffi_type_ulong, args) == FFI_OK); + + ul1 = 1073741823L; + ul2 = 1073741824L; + + ffi_call(&cif, FFI_FN(return_ul), &res, values); + printf("res: %lu, %lu\n", (unsigned long)res, ul1 + ul2); + /* { dg-output "res: 2147483647, 2147483647" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/stret_large.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/stret_large.c new file mode 100644 index 000000000..23a93b900 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/stret_large.c @@ -0,0 +1,145 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure returning with different structure size. + Depending on the ABI. Check bigger struct which overlaps + the gp and fp register count on Darwin/AIX/ppc64. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/21/2007 */ + +/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +// 13 FPRs: 104 bytes +// 14 FPRs: 112 bytes + +typedef struct struct_108byte { + double a; + double b; + double c; + double d; + double e; + double f; + double g; + double h; + double i; + double j; + double k; + double l; + double m; + int n; +} struct_108byte; + +struct_108byte cls_struct_108byte_fn( + struct_108byte b0, + struct_108byte b1, + struct_108byte b2, + struct_108byte b3) +{ + struct_108byte result; + + result.a = b0.a + b1.a + b2.a + b3.a; + result.b = b0.b + b1.b + b2.b + b3.b; + result.c = b0.c + b1.c + b2.c + b3.c; + result.d = b0.d + b1.d + b2.d + b3.d; + result.e = b0.e + b1.e + b2.e + b3.e; + result.f = b0.f + b1.f + b2.f + b3.f; + result.g = b0.g + b1.g + b2.g + b3.g; + result.h = b0.h + b1.h + b2.h + b3.h; + result.i = b0.i + b1.i + b2.i + b3.i; + result.j = b0.j + b1.j + b2.j + b3.j; + result.k = b0.k + b1.k + b2.k + b3.k; + result.l = b0.l + b1.l + b2.l + b3.l; + result.m = b0.m + b1.m + b2.m + b3.m; + result.n = b0.n + b1.n + b2.n + b3.n; + + printf("%g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", result.a, result.b, result.c, + result.d, result.e, result.f, result.g, result.h, result.i, + result.j, result.k, result.l, result.m, result.n); + + return result; +} + +static void +cls_struct_108byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) +{ + struct_108byte b0, b1, b2, b3; + + b0 = *(struct_108byte*)(args[0]); + b1 = *(struct_108byte*)(args[1]); + b2 = *(struct_108byte*)(args[2]); + b3 = *(struct_108byte*)(args[3]); + + *(struct_108byte*)resp = cls_struct_108byte_fn(b0, b1, b2, b3); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[15]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct_108byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 7 }; + struct_108byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 4 }; + struct_108byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 3 }; + struct_108byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 2 }; + struct_108byte res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = &ffi_type_double; + cls_struct_fields[3] = &ffi_type_double; + cls_struct_fields[4] = &ffi_type_double; + cls_struct_fields[5] = &ffi_type_double; + cls_struct_fields[6] = &ffi_type_double; + cls_struct_fields[7] = &ffi_type_double; + cls_struct_fields[8] = &ffi_type_double; + cls_struct_fields[9] = &ffi_type_double; + cls_struct_fields[10] = &ffi_type_double; + cls_struct_fields[11] = &ffi_type_double; + cls_struct_fields[12] = &ffi_type_double; + cls_struct_fields[13] = &ffi_type_sint32; + cls_struct_fields[14] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = &cls_struct_type; + dbl_arg_types[3] = &cls_struct_type; + dbl_arg_types[4] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = &h_dbl; + args_dbl[4] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_108byte_fn), &res_dbl, args_dbl); + /* { dg-output "22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ + printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, + res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_108byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((struct_108byte(*)(struct_108byte, struct_108byte, + struct_108byte, struct_108byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); + /* { dg-output "\n22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ + printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, + res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 16" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/stret_large2.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/stret_large2.c new file mode 100644 index 000000000..e2599d267 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/stret_large2.c @@ -0,0 +1,148 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure returning with different structure size. + Depending on the ABI. Check bigger struct which overlaps + the gp and fp register count on Darwin/AIX/ppc64. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/21/2007 */ + +/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +// 13 FPRs: 104 bytes +// 14 FPRs: 112 bytes + +typedef struct struct_116byte { + double a; + double b; + double c; + double d; + double e; + double f; + double g; + double h; + double i; + double j; + double k; + double l; + double m; + double n; + int o; +} struct_116byte; + +struct_116byte cls_struct_116byte_fn( + struct_116byte b0, + struct_116byte b1, + struct_116byte b2, + struct_116byte b3) +{ + struct_116byte result; + + result.a = b0.a + b1.a + b2.a + b3.a; + result.b = b0.b + b1.b + b2.b + b3.b; + result.c = b0.c + b1.c + b2.c + b3.c; + result.d = b0.d + b1.d + b2.d + b3.d; + result.e = b0.e + b1.e + b2.e + b3.e; + result.f = b0.f + b1.f + b2.f + b3.f; + result.g = b0.g + b1.g + b2.g + b3.g; + result.h = b0.h + b1.h + b2.h + b3.h; + result.i = b0.i + b1.i + b2.i + b3.i; + result.j = b0.j + b1.j + b2.j + b3.j; + result.k = b0.k + b1.k + b2.k + b3.k; + result.l = b0.l + b1.l + b2.l + b3.l; + result.m = b0.m + b1.m + b2.m + b3.m; + result.n = b0.n + b1.n + b2.n + b3.n; + result.o = b0.o + b1.o + b2.o + b3.o; + + printf("%g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", result.a, result.b, result.c, + result.d, result.e, result.f, result.g, result.h, result.i, + result.j, result.k, result.l, result.m, result.n, result.o); + + return result; +} + +static void +cls_struct_116byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) +{ + struct_116byte b0, b1, b2, b3; + + b0 = *(struct_116byte*)(args[0]); + b1 = *(struct_116byte*)(args[1]); + b2 = *(struct_116byte*)(args[2]); + b3 = *(struct_116byte*)(args[3]); + + *(struct_116byte*)resp = cls_struct_116byte_fn(b0, b1, b2, b3); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[16]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct_116byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 7 }; + struct_116byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0, 5.0, 7.0, 9.0, 1.0, 6.0, 4 }; + struct_116byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 8.0, 6.0, 1.0, 4.0, 0.0, 7.0, 3 }; + struct_116byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 9.0, 2.0, 6.0, 5.0, 3.0, 8.0, 2 }; + struct_116byte res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = &ffi_type_double; + cls_struct_fields[3] = &ffi_type_double; + cls_struct_fields[4] = &ffi_type_double; + cls_struct_fields[5] = &ffi_type_double; + cls_struct_fields[6] = &ffi_type_double; + cls_struct_fields[7] = &ffi_type_double; + cls_struct_fields[8] = &ffi_type_double; + cls_struct_fields[9] = &ffi_type_double; + cls_struct_fields[10] = &ffi_type_double; + cls_struct_fields[11] = &ffi_type_double; + cls_struct_fields[12] = &ffi_type_double; + cls_struct_fields[13] = &ffi_type_double; + cls_struct_fields[14] = &ffi_type_sint32; + cls_struct_fields[15] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = &cls_struct_type; + dbl_arg_types[3] = &cls_struct_type; + dbl_arg_types[4] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = &h_dbl; + args_dbl[4] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_116byte_fn), &res_dbl, args_dbl); + /* { dg-output "22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ + printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, + res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n, res_dbl.o); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_116byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((struct_116byte(*)(struct_116byte, struct_116byte, + struct_116byte, struct_116byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); + /* { dg-output "\n22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ + printf("res: %g %g %g %g %g %g %g %g %g %g %g %g %g %g %d\n", res_dbl.a, res_dbl.b, + res_dbl.c, res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i, + res_dbl.j, res_dbl.k, res_dbl.l, res_dbl.m, res_dbl.n, res_dbl.o); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 22 15 17 25 6 26 16" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium.c new file mode 100644 index 000000000..1fc6a9edd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium.c @@ -0,0 +1,124 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure returning with different structure size. + Depending on the ABI. Check bigger struct which overlaps + the gp and fp register count on Darwin/AIX/ppc64. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/21/2007 */ + +/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ +#include "ffitest.h" + +typedef struct struct_72byte { + double a; + double b; + double c; + double d; + double e; + double f; + double g; + double h; + double i; +} struct_72byte; + +struct_72byte cls_struct_72byte_fn( + struct_72byte b0, + struct_72byte b1, + struct_72byte b2, + struct_72byte b3) +{ + struct_72byte result; + + result.a = b0.a + b1.a + b2.a + b3.a; + result.b = b0.b + b1.b + b2.b + b3.b; + result.c = b0.c + b1.c + b2.c + b3.c; + result.d = b0.d + b1.d + b2.d + b3.d; + result.e = b0.e + b1.e + b2.e + b3.e; + result.f = b0.f + b1.f + b2.f + b3.f; + result.g = b0.g + b1.g + b2.g + b3.g; + result.h = b0.h + b1.h + b2.h + b3.h; + result.i = b0.i + b1.i + b2.i + b3.i; + + printf("%g %g %g %g %g %g %g %g %g\n", result.a, result.b, result.c, + result.d, result.e, result.f, result.g, result.h, result.i); + + return result; +} + +static void +cls_struct_72byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) +{ + struct_72byte b0, b1, b2, b3; + + b0 = *(struct_72byte*)(args[0]); + b1 = *(struct_72byte*)(args[1]); + b2 = *(struct_72byte*)(args[2]); + b3 = *(struct_72byte*)(args[3]); + + *(struct_72byte*)resp = cls_struct_72byte_fn(b0, b1, b2, b3); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[10]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7.0 }; + struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4.0 }; + struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3.0 }; + struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2.0 }; + struct_72byte res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = &ffi_type_double; + cls_struct_fields[3] = &ffi_type_double; + cls_struct_fields[4] = &ffi_type_double; + cls_struct_fields[5] = &ffi_type_double; + cls_struct_fields[6] = &ffi_type_double; + cls_struct_fields[7] = &ffi_type_double; + cls_struct_fields[8] = &ffi_type_double; + cls_struct_fields[9] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = &cls_struct_type; + dbl_arg_types[3] = &cls_struct_type; + dbl_arg_types[4] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = &h_dbl; + args_dbl[4] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_72byte_fn), &res_dbl, args_dbl); + /* { dg-output "22 15 17 25 6 13 19 18 16" } */ + printf("res: %g %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_72byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte, + struct_72byte, struct_72byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); + /* { dg-output "\n22 15 17 25 6 13 19 18 16" } */ + printf("res: %g %g %g %g %g %g %g %g %g\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium2.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium2.c new file mode 100644 index 000000000..cb2f2fba3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/stret_medium2.c @@ -0,0 +1,125 @@ +/* Area: ffi_call, closure_call + Purpose: Check structure returning with different structure size. + Depending on the ABI. Check bigger struct which overlaps + the gp and fp register count on Darwin/AIX/ppc64. + Limitations: none. + PR: none. + Originator: Blake Chaffin 6/21/2007 */ + +/* { dg-do run { xfail strongarm*-*-* xscale*-*-* } } */ +/* { dg-options "-Wno-format" { target alpha*-dec-osf* } } */ +#include "ffitest.h" + +typedef struct struct_72byte { + double a; + double b; + double c; + double d; + double e; + double f; + double g; + double h; + long long i; +} struct_72byte; + +struct_72byte cls_struct_72byte_fn( + struct_72byte b0, + struct_72byte b1, + struct_72byte b2, + struct_72byte b3) +{ + struct_72byte result; + + result.a = b0.a + b1.a + b2.a + b3.a; + result.b = b0.b + b1.b + b2.b + b3.b; + result.c = b0.c + b1.c + b2.c + b3.c; + result.d = b0.d + b1.d + b2.d + b3.d; + result.e = b0.e + b1.e + b2.e + b3.e; + result.f = b0.f + b1.f + b2.f + b3.f; + result.g = b0.g + b1.g + b2.g + b3.g; + result.h = b0.h + b1.h + b2.h + b3.h; + result.i = b0.i + b1.i + b2.i + b3.i; + + printf("%g %g %g %g %g %g %g %g %" PRIdLL "\n", result.a, result.b, result.c, + result.d, result.e, result.f, result.g, result.h, result.i); + + return result; +} + +static void +cls_struct_72byte_gn(ffi_cif* cif __UNUSED__, void* resp, void** args, void* userdata __UNUSED__) +{ + struct_72byte b0, b1, b2, b3; + + b0 = *(struct_72byte*)(args[0]); + b1 = *(struct_72byte*)(args[1]); + b2 = *(struct_72byte*)(args[2]); + b3 = *(struct_72byte*)(args[3]); + + *(struct_72byte*)resp = cls_struct_72byte_fn(b0, b1, b2, b3); +} + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + void* args_dbl[5]; + ffi_type* cls_struct_fields[10]; + ffi_type cls_struct_type; + ffi_type* dbl_arg_types[5]; + + cls_struct_type.size = 0; + cls_struct_type.alignment = 0; + cls_struct_type.type = FFI_TYPE_STRUCT; + cls_struct_type.elements = cls_struct_fields; + + struct_72byte e_dbl = { 9.0, 2.0, 6.0, 5.0, 3.0, 4.0, 8.0, 1.0, 7 }; + struct_72byte f_dbl = { 1.0, 2.0, 3.0, 7.0, 2.0, 5.0, 6.0, 7.0, 4 }; + struct_72byte g_dbl = { 4.0, 5.0, 7.0, 9.0, 1.0, 1.0, 2.0, 9.0, 3 }; + struct_72byte h_dbl = { 8.0, 6.0, 1.0, 4.0, 0.0, 3.0, 3.0, 1.0, 2 }; + struct_72byte res_dbl; + + cls_struct_fields[0] = &ffi_type_double; + cls_struct_fields[1] = &ffi_type_double; + cls_struct_fields[2] = &ffi_type_double; + cls_struct_fields[3] = &ffi_type_double; + cls_struct_fields[4] = &ffi_type_double; + cls_struct_fields[5] = &ffi_type_double; + cls_struct_fields[6] = &ffi_type_double; + cls_struct_fields[7] = &ffi_type_double; + cls_struct_fields[8] = &ffi_type_sint64; + cls_struct_fields[9] = NULL; + + dbl_arg_types[0] = &cls_struct_type; + dbl_arg_types[1] = &cls_struct_type; + dbl_arg_types[2] = &cls_struct_type; + dbl_arg_types[3] = &cls_struct_type; + dbl_arg_types[4] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 4, &cls_struct_type, + dbl_arg_types) == FFI_OK); + + args_dbl[0] = &e_dbl; + args_dbl[1] = &f_dbl; + args_dbl[2] = &g_dbl; + args_dbl[3] = &h_dbl; + args_dbl[4] = NULL; + + ffi_call(&cif, FFI_FN(cls_struct_72byte_fn), &res_dbl, args_dbl); + /* { dg-output "22 15 17 25 6 13 19 18 16" } */ + printf("res: %g %g %g %g %g %g %g %g %" PRIdLL "\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_72byte_gn, NULL, code) == FFI_OK); + + res_dbl = ((struct_72byte(*)(struct_72byte, struct_72byte, + struct_72byte, struct_72byte))(code))(e_dbl, f_dbl, g_dbl, h_dbl); + /* { dg-output "\n22 15 17 25 6 13 19 18 16" } */ + printf("res: %g %g %g %g %g %g %g %g %" PRIdLL "\n", res_dbl.a, res_dbl.b, res_dbl.c, + res_dbl.d, res_dbl.e, res_dbl.f, res_dbl.g, res_dbl.h, res_dbl.i); + /* { dg-output "\nres: 22 15 17 25 6 13 19 18 16" } */ + + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c new file mode 100644 index 000000000..3de45de7a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/strlen.c @@ -0,0 +1,44 @@ +/* Area: ffi_call + Purpose: Check strlen function call. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" + +static size_t my_strlen(char *s) +{ + return (strlen(s)); +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_arg rint; + char *s; + + args[0] = &ffi_type_pointer; + values[0] = (void*) &s; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ffi_type_sint, args) == FFI_OK); + + s = "a"; + ffi_call(&cif, FFI_FN(my_strlen), &rint, values); + CHECK(rint == 1); + + s = "1234567"; + ffi_call(&cif, FFI_FN(my_strlen), &rint, values); + CHECK(rint == 7); + + s = "1234567890123456789012345"; + ffi_call(&cif, FFI_FN(my_strlen), &rint, values); + CHECK(rint == 25); + + exit (0); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/strlen_win32.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/strlen_win32.c new file mode 100644 index 000000000..6fbcc8740 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/strlen_win32.c @@ -0,0 +1,44 @@ +/* Area: ffi_call + Purpose: Check stdcall strlen call on X86_WIN32 systems. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run { target i?86-*-cygwin* i?86-*-mingw* } } */ + +#include "ffitest.h" + +static size_t __attribute__((stdcall)) my_stdcall_strlen(char *s) +{ + return (strlen(s)); +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_arg rint; + char *s; + args[0] = &ffi_type_pointer; + values[0] = (void*) &s; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_STDCALL, 1, + &ffi_type_sint, args) == FFI_OK); + + s = "a"; + ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values); + CHECK(rint == 1); + + s = "1234567"; + ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values); + CHECK(rint == 7); + + s = "1234567890123456789012345"; + ffi_call(&cif, FFI_FN(my_stdcall_strlen), &rint, values); + CHECK(rint == 25); + + printf("stdcall strlen tests passed\n"); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c new file mode 100644 index 000000000..ea76c8544 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct1.c @@ -0,0 +1,65 @@ +/* Area: ffi_call + Purpose: Check structures. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct +{ + unsigned char uc; + double d; + unsigned int ui; +} test_structure_1; + +static test_structure_1 struct1(test_structure_1 ts) +{ + ts.uc++; + ts.d--; + ts.ui++; + + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts1_type; + ffi_type *ts1_type_elements[4]; + ts1_type.size = 0; + ts1_type.alignment = 0; + ts1_type.type = FFI_TYPE_STRUCT; + ts1_type.elements = ts1_type_elements; + ts1_type_elements[0] = &ffi_type_uchar; + ts1_type_elements[1] = &ffi_type_double; + ts1_type_elements[2] = &ffi_type_uint; + ts1_type_elements[3] = NULL; + + test_structure_1 ts1_arg; + /* This is a hack to get a properly aligned result buffer */ + test_structure_1 *ts1_result = + (test_structure_1 *) malloc (sizeof(test_structure_1)); + + args[0] = &ts1_type; + values[0] = &ts1_arg; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ts1_type, args) == FFI_OK); + + ts1_arg.uc = '\x01'; + ts1_arg.d = 3.14159; + ts1_arg.ui = 555; + + ffi_call(&cif, FFI_FN(struct1), ts1_result, values); + + CHECK(ts1_result->ui == 556); + CHECK(ts1_result->d == 3.14159 - 1); + + free (ts1_result); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c new file mode 100644 index 000000000..14bc9fdc6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct2.c @@ -0,0 +1,67 @@ +/* Area: ffi_call + Purpose: Check structures. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct +{ + double d1; + double d2; +} test_structure_2; + +static test_structure_2 struct2(test_structure_2 ts) +{ + ts.d1--; + ts.d2--; + + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + test_structure_2 ts2_arg; + ffi_type ts2_type; + ffi_type *ts2_type_elements[3]; + ts2_type.size = 0; + ts2_type.alignment = 0; + ts2_type.type = FFI_TYPE_STRUCT; + ts2_type.elements = ts2_type_elements; + ts2_type_elements[0] = &ffi_type_double; + ts2_type_elements[1] = &ffi_type_double; + ts2_type_elements[2] = NULL; + + + /* This is a hack to get a properly aligned result buffer */ + test_structure_2 *ts2_result = + (test_structure_2 *) malloc (sizeof(test_structure_2)); + + args[0] = &ts2_type; + values[0] = &ts2_arg; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts2_type, args) == FFI_OK); + + ts2_arg.d1 = 5.55; + ts2_arg.d2 = 6.66; + + printf ("%g\n", ts2_arg.d1); + printf ("%g\n", ts2_arg.d2); + + ffi_call(&cif, FFI_FN(struct2), ts2_result, values); + + printf ("%g\n", ts2_result->d1); + printf ("%g\n", ts2_result->d2); + + CHECK(ts2_result->d1 == 5.55 - 1); + CHECK(ts2_result->d2 == 6.66 - 1); + + free (ts2_result); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c new file mode 100644 index 000000000..e0bb09b07 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct3.c @@ -0,0 +1,59 @@ +/* Area: ffi_call + Purpose: Check structures. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct +{ + int si; +} test_structure_3; + +static test_structure_3 struct3(test_structure_3 ts) +{ + ts.si = -(ts.si*2); + + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + int compare_value; + ffi_type ts3_type; + ffi_type *ts3_type_elements[2]; + ts3_type.size = 0; + ts3_type.alignment = 0; + ts3_type.type = FFI_TYPE_STRUCT; + ts3_type.elements = ts3_type_elements; + ts3_type_elements[0] = &ffi_type_sint; + ts3_type_elements[1] = NULL; + + test_structure_3 ts3_arg; + test_structure_3 *ts3_result = + (test_structure_3 *) malloc (sizeof(test_structure_3)); + + args[0] = &ts3_type; + values[0] = &ts3_arg; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, + &ts3_type, args) == FFI_OK); + + ts3_arg.si = -123; + compare_value = ts3_arg.si; + + ffi_call(&cif, FFI_FN(struct3), ts3_result, values); + + printf ("%d %d\n", ts3_result->si, -(compare_value*2)); + + CHECK(ts3_result->si == -(compare_value*2)); + + free (ts3_result); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c new file mode 100644 index 000000000..0ad0a83ba --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct4.c @@ -0,0 +1,63 @@ +/* Area: ffi_call + Purpose: Check structures. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct +{ + unsigned ui1; + unsigned ui2; + unsigned ui3; +} test_structure_4; + +static test_structure_4 struct4(test_structure_4 ts) +{ + ts.ui3 = ts.ui1 * ts.ui2 * ts.ui3; + + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts4_type; + ffi_type *ts4_type_elements[4]; + ts4_type.size = 0; + ts4_type.alignment = 0; + ts4_type.type = FFI_TYPE_STRUCT; + test_structure_4 ts4_arg; + ts4_type.elements = ts4_type_elements; + ts4_type_elements[0] = &ffi_type_uint; + ts4_type_elements[1] = &ffi_type_uint; + ts4_type_elements[2] = &ffi_type_uint; + ts4_type_elements[3] = NULL; + + + /* This is a hack to get a properly aligned result buffer */ + test_structure_4 *ts4_result = + (test_structure_4 *) malloc (sizeof(test_structure_4)); + + args[0] = &ts4_type; + values[0] = &ts4_arg; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts4_type, args) == FFI_OK); + + ts4_arg.ui1 = 2; + ts4_arg.ui2 = 3; + ts4_arg.ui3 = 4; + + ffi_call (&cif, FFI_FN(struct4), ts4_result, values); + + CHECK(ts4_result->ui3 == 2U * 3U * 4U); + + + free (ts4_result); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c new file mode 100644 index 000000000..c03cc97ac --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct5.c @@ -0,0 +1,65 @@ +/* Area: ffi_call + Purpose: Check structures. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" +typedef struct +{ + char c1; + char c2; +} test_structure_5; + +static test_structure_5 struct5(test_structure_5 ts1, test_structure_5 ts2) +{ + ts1.c1 += ts2.c1; + ts1.c2 -= ts2.c2; + + return ts1; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts5_type; + ffi_type *ts5_type_elements[3]; + ts5_type.size = 0; + ts5_type.alignment = 0; + ts5_type.type = FFI_TYPE_STRUCT; + ts5_type.elements = ts5_type_elements; + ts5_type_elements[0] = &ffi_type_schar; + ts5_type_elements[1] = &ffi_type_schar; + ts5_type_elements[2] = NULL; + + test_structure_5 ts5_arg1, ts5_arg2; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_5 *ts5_result = + (test_structure_5 *) malloc (sizeof(test_structure_5)); + + args[0] = &ts5_type; + args[1] = &ts5_type; + values[0] = &ts5_arg1; + values[1] = &ts5_arg2; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 2, &ts5_type, args) == FFI_OK); + + ts5_arg1.c1 = 2; + ts5_arg1.c2 = 6; + ts5_arg2.c1 = 5; + ts5_arg2.c2 = 3; + + ffi_call (&cif, FFI_FN(struct5), ts5_result, values); + + CHECK(ts5_result->c1 == 7); + CHECK(ts5_result->c2 == 3); + + + free (ts5_result); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c new file mode 100644 index 000000000..83db9afbb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct6.c @@ -0,0 +1,64 @@ +/* Area: ffi_call + Purpose: Check structures. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" +typedef struct +{ + float f; + double d; +} test_structure_6; + +static test_structure_6 struct6 (test_structure_6 ts) +{ + ts.f += 1; + ts.d += 1; + + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts6_type; + ffi_type *ts6_type_elements[3]; + ts6_type.size = 0; + ts6_type.alignment = 0; + ts6_type.type = FFI_TYPE_STRUCT; + ts6_type.elements = ts6_type_elements; + ts6_type_elements[0] = &ffi_type_float; + ts6_type_elements[1] = &ffi_type_double; + ts6_type_elements[2] = NULL; + + + test_structure_6 ts6_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_6 *ts6_result = + (test_structure_6 *) malloc (sizeof(test_structure_6)); + + args[0] = &ts6_type; + values[0] = &ts6_arg; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts6_type, args) == FFI_OK); + + ts6_arg.f = 5.55f; + ts6_arg.d = 6.66; + + printf ("%g\n", ts6_arg.f); + printf ("%g\n", ts6_arg.d); + + ffi_call(&cif, FFI_FN(struct6), ts6_result, values); + + CHECK(ts6_result->f == 5.55f + 1); + CHECK(ts6_result->d == 6.66 + 1); + + free (ts6_result); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c new file mode 100644 index 000000000..58aac4c99 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct7.c @@ -0,0 +1,74 @@ +/* Area: ffi_call + Purpose: Check structures. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" +typedef struct +{ + float f1; + float f2; + double d; +} test_structure_7; + +static test_structure_7 struct7 (test_structure_7 ts) +{ + ts.f1 += 1; + ts.f2 += 1; + ts.d += 1; + + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts7_type; + ffi_type *ts7_type_elements[4]; + ts7_type.size = 0; + ts7_type.alignment = 0; + ts7_type.type = FFI_TYPE_STRUCT; + ts7_type.elements = ts7_type_elements; + ts7_type_elements[0] = &ffi_type_float; + ts7_type_elements[1] = &ffi_type_float; + ts7_type_elements[2] = &ffi_type_double; + ts7_type_elements[3] = NULL; + + + test_structure_7 ts7_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_7 *ts7_result = + (test_structure_7 *) malloc (sizeof(test_structure_7)); + + args[0] = &ts7_type; + values[0] = &ts7_arg; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts7_type, args) == FFI_OK); + + ts7_arg.f1 = 5.55f; + ts7_arg.f2 = 55.5f; + ts7_arg.d = 6.66; + + printf ("%g\n", ts7_arg.f1); + printf ("%g\n", ts7_arg.f2); + printf ("%g\n", ts7_arg.d); + + ffi_call(&cif, FFI_FN(struct7), ts7_result, values); + + printf ("%g\n", ts7_result->f1); + printf ("%g\n", ts7_result->f2); + printf ("%g\n", ts7_result->d); + + CHECK(ts7_result->f1 == 5.55f + 1); + CHECK(ts7_result->f2 == 55.5f + 1); + CHECK(ts7_result->d == 6.66 + 1); + + free (ts7_result); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c new file mode 100644 index 000000000..c773ac7b5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct8.c @@ -0,0 +1,80 @@ +/* Area: ffi_call + Purpose: Check structures. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" +typedef struct +{ + float f1; + float f2; + float f3; + float f4; +} test_structure_8; + +static test_structure_8 struct8 (test_structure_8 ts) +{ + ts.f1 += 1; + ts.f2 += 1; + ts.f3 += 1; + ts.f4 += 1; + + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts8_type; + ffi_type *ts8_type_elements[5]; + ts8_type.size = 0; + ts8_type.alignment = 0; + ts8_type.type = FFI_TYPE_STRUCT; + ts8_type.elements = ts8_type_elements; + ts8_type_elements[0] = &ffi_type_float; + ts8_type_elements[1] = &ffi_type_float; + ts8_type_elements[2] = &ffi_type_float; + ts8_type_elements[3] = &ffi_type_float; + ts8_type_elements[4] = NULL; + + test_structure_8 ts8_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_8 *ts8_result = + (test_structure_8 *) malloc (sizeof(test_structure_8)); + + args[0] = &ts8_type; + values[0] = &ts8_arg; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts8_type, args) == FFI_OK); + + ts8_arg.f1 = 5.55f; + ts8_arg.f2 = 55.5f; + ts8_arg.f3 = -5.55f; + ts8_arg.f4 = -55.5f; + + printf ("%g\n", ts8_arg.f1); + printf ("%g\n", ts8_arg.f2); + printf ("%g\n", ts8_arg.f3); + printf ("%g\n", ts8_arg.f4); + + ffi_call(&cif, FFI_FN(struct8), ts8_result, values); + + printf ("%g\n", ts8_result->f1); + printf ("%g\n", ts8_result->f2); + printf ("%g\n", ts8_result->f3); + printf ("%g\n", ts8_result->f4); + + CHECK(ts8_result->f1 == 5.55f + 1); + CHECK(ts8_result->f2 == 55.5f + 1); + CHECK(ts8_result->f3 == -5.55f + 1); + CHECK(ts8_result->f4 == -55.5f + 1); + + free (ts8_result); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c new file mode 100644 index 000000000..f30091f54 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/struct9.c @@ -0,0 +1,67 @@ +/* Area: ffi_call + Purpose: Check structures. + Limitations: none. + PR: none. + Originator: From the original ffitest.c */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct +{ + float f; + int i; +} test_structure_9; + +static test_structure_9 struct9 (test_structure_9 ts) +{ + ts.f += 1; + ts.i += 1; + + return ts; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_type ts9_type; + ffi_type *ts9_type_elements[3]; + ts9_type.size = 0; + ts9_type.alignment = 0; + ts9_type.type = FFI_TYPE_STRUCT; + ts9_type.elements = ts9_type_elements; + ts9_type_elements[0] = &ffi_type_float; + ts9_type_elements[1] = &ffi_type_sint; + ts9_type_elements[2] = NULL; + + test_structure_9 ts9_arg; + + /* This is a hack to get a properly aligned result buffer */ + test_structure_9 *ts9_result = + (test_structure_9 *) malloc (sizeof(test_structure_9)); + + args[0] = &ts9_type; + values[0] = &ts9_arg; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ts9_type, args) == FFI_OK); + + ts9_arg.f = 5.55f; + ts9_arg.i = 5; + + printf ("%g\n", ts9_arg.f); + printf ("%d\n", ts9_arg.i); + + ffi_call(&cif, FFI_FN(struct9), ts9_result, values); + + printf ("%g\n", ts9_result->f); + printf ("%d\n", ts9_result->i); + + CHECK(ts9_result->f == 5.55f + 1); + CHECK(ts9_result->i == 5 + 1); + + free (ts9_result); + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/testclosure.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/testclosure.c new file mode 100644 index 000000000..161cc8917 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.call/testclosure.c @@ -0,0 +1,70 @@ +/* Area: closure_call + Purpose: Check return value float. + Limitations: none. + PR: 41908. + Originator: 20091102 */ + +/* { dg-do run } */ +#include "ffitest.h" + +typedef struct cls_struct_combined { + float a; + float b; + float c; + float d; +} cls_struct_combined; + +void cls_struct_combined_fn(struct cls_struct_combined arg) +{ + printf("%g %g %g %g\n", + arg.a, arg.b, + arg.c, arg.d); + fflush(stdout); +} + +static void +cls_struct_combined_gn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, + void** args, void* userdata __UNUSED__) +{ + struct cls_struct_combined a0; + + a0 = *(struct cls_struct_combined*)(args[0]); + + cls_struct_combined_fn(a0); +} + + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type* cls_struct_fields0[5]; + ffi_type cls_struct_type0; + ffi_type* dbl_arg_types[5]; + + cls_struct_type0.size = 0; + cls_struct_type0.alignment = 0; + cls_struct_type0.type = FFI_TYPE_STRUCT; + cls_struct_type0.elements = cls_struct_fields0; + + struct cls_struct_combined g_dbl = {4.0, 5.0, 1.0, 8.0}; + + cls_struct_fields0[0] = &ffi_type_float; + cls_struct_fields0[1] = &ffi_type_float; + cls_struct_fields0[2] = &ffi_type_float; + cls_struct_fields0[3] = &ffi_type_float; + cls_struct_fields0[4] = NULL; + + dbl_arg_types[0] = &cls_struct_type0; + dbl_arg_types[1] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, &ffi_type_void, + dbl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, cls_struct_combined_gn, NULL, code) == FFI_OK); + + ((void(*)(cls_struct_combined)) (code))(g_dbl); + /* { dg-output "4 5 1 8" } */ + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h new file mode 100644 index 000000000..83f544284 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h @@ -0,0 +1,96 @@ +#include +#include +#include +#include +#include "fficonfig.h" + +#define MAX_ARGS 256 + + +/* Define __UNUSED__ that also other compilers than gcc can run the tests. */ +#undef __UNUSED__ +#if defined(__GNUC__) +#define __UNUSED__ __attribute__((__unused__)) +#else +#define __UNUSED__ +#endif + +#define CHECK(x) (!(x) ? abort() : (void)0) + +/* Prefer MAP_ANON(YMOUS) to /dev/zero, since we don't need to keep a + file open. */ +#ifdef HAVE_MMAP_ANON +# undef HAVE_MMAP_DEV_ZERO + +# include +# ifndef MAP_FAILED +# define MAP_FAILED -1 +# endif +# if !defined (MAP_ANONYMOUS) && defined (MAP_ANON) +# define MAP_ANONYMOUS MAP_ANON +# endif +# define USING_MMAP + +#endif + +#ifdef HAVE_MMAP_DEV_ZERO + +# include +# ifndef MAP_FAILED +# define MAP_FAILED -1 +# endif +# define USING_MMAP + +#endif + + +/* MinGW kludge. */ +#ifdef _WIN64 +#define PRIdLL "I64d" +#define PRIuLL "I64u" +#else +#define PRIdLL "lld" +#define PRIuLL "llu" +#endif + +#ifdef USING_MMAP +static inline void * +allocate_mmap (size_t size) +{ + void *page; +#if defined (HAVE_MMAP_DEV_ZERO) + static int dev_zero_fd = -1; +#endif + +#ifdef HAVE_MMAP_DEV_ZERO + if (dev_zero_fd == -1) + { + dev_zero_fd = open ("/dev/zero", O_RDONLY); + if (dev_zero_fd == -1) + { + perror ("open /dev/zero: %m"); + exit (1); + } + } +#endif + + +#ifdef HAVE_MMAP_ANON + page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE | MAP_ANONYMOUS, -1, 0); +#endif +#ifdef HAVE_MMAP_DEV_ZERO + page = mmap (NULL, size, PROT_READ | PROT_WRITE | PROT_EXEC, + MAP_PRIVATE, dev_zero_fd, 0); +#endif + + if (page == (char *) MAP_FAILED) + { + perror ("virtual memory exhausted"); + exit (1); + } + + return page; +} + +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.special/special.exp b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.special/special.exp new file mode 100644 index 000000000..74671b1c6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.special/special.exp @@ -0,0 +1,35 @@ +# Copyright (C) 2003, 2006, 2009, 2010 Free Software Foundation, Inc. + +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; see the file COPYING3. If not see +# . + +dg-init +libffi-init + +global srcdir subdir + +global cxx_options + +set cxx_options " -shared-libgcc -lstdc++" + +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O0 -W -Wall" +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O2" +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-O3" +dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.cc]] $cxx_options "-Os" + +dg-finish + +# Local Variables: +# tcl-indent-level:4 +# End: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.special/unwindtest.cc b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.special/unwindtest.cc new file mode 100644 index 000000000..d7ffd4aa2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.special/unwindtest.cc @@ -0,0 +1,124 @@ +/* Area: ffi_closure, unwind info + Purpose: Check if the unwind information is passed correctly. + Limitations: none. + PR: none. + Originator: Jeff Sturm */ + +/* { dg-do run } */ +#include "ffitestcxx.h" + +#if defined HAVE_STDINT_H +#include +#endif + +#if defined HAVE_INTTYPES_H +#include +#endif + +void +closure_test_fn(ffi_cif* cif __UNUSED__, void* resp __UNUSED__, + void** args __UNUSED__, void* userdata __UNUSED__) +{ + throw 9; +} + +typedef void (*closure_test_type)(); + +void closure_test_fn1(ffi_cif* cif __UNUSED__, void* resp, + void** args, void* userdata __UNUSED__) + { + *(ffi_arg*)resp = + (int)*(float *)args[0] +(int)(*(float *)args[1]) + + (int)(*(float *)args[2]) + (int)*(float *)args[3] + + (int)(*(signed short *)args[4]) + (int)(*(float *)args[5]) + + (int)*(float *)args[6] + (int)(*(int *)args[7]) + + (int)(*(double*)args[8]) + (int)*(int *)args[9] + + (int)(*(int *)args[10]) + (int)(*(float *)args[11]) + + (int)*(int *)args[12] + (int)(*(int *)args[13]) + + (int)(*(int *)args[14]) + *(int *)args[15] + (int)(intptr_t)userdata; + + printf("%d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d %d: %d\n", + (int)*(float *)args[0], (int)(*(float *)args[1]), + (int)(*(float *)args[2]), (int)*(float *)args[3], + (int)(*(signed short *)args[4]), (int)(*(float *)args[5]), + (int)*(float *)args[6], (int)(*(int *)args[7]), + (int)(*(double *)args[8]), (int)*(int *)args[9], + (int)(*(int *)args[10]), (int)(*(float *)args[11]), + (int)*(int *)args[12], (int)(*(int *)args[13]), + (int)(*(int *)args[14]), *(int *)args[15], + (int)(intptr_t)userdata, (int)*(ffi_arg*)resp); + + throw (int)*(ffi_arg*)resp; +} + +typedef int (*closure_test_type1)(float, float, float, float, signed short, + float, float, int, double, int, int, float, + int, int, int, int); + +int main (void) +{ + ffi_cif cif; + void *code; + ffi_closure *pcl = (ffi_closure *)ffi_closure_alloc(sizeof(ffi_closure), &code); + ffi_type * cl_arg_types[17]; + + { + cl_arg_types[1] = NULL; + + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 0, + &ffi_type_void, cl_arg_types) == FFI_OK); + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn, NULL, code) == FFI_OK); + + try + { + (*((closure_test_type)(code)))(); + } catch (int exception_code) + { + CHECK(exception_code == 9); + } + + printf("part one OK\n"); + /* { dg-output "part one OK" } */ + } + + { + + cl_arg_types[0] = &ffi_type_float; + cl_arg_types[1] = &ffi_type_float; + cl_arg_types[2] = &ffi_type_float; + cl_arg_types[3] = &ffi_type_float; + cl_arg_types[4] = &ffi_type_sshort; + cl_arg_types[5] = &ffi_type_float; + cl_arg_types[6] = &ffi_type_float; + cl_arg_types[7] = &ffi_type_uint; + cl_arg_types[8] = &ffi_type_double; + cl_arg_types[9] = &ffi_type_uint; + cl_arg_types[10] = &ffi_type_uint; + cl_arg_types[11] = &ffi_type_float; + cl_arg_types[12] = &ffi_type_uint; + cl_arg_types[13] = &ffi_type_uint; + cl_arg_types[14] = &ffi_type_uint; + cl_arg_types[15] = &ffi_type_uint; + cl_arg_types[16] = NULL; + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 16, + &ffi_type_sint, cl_arg_types) == FFI_OK); + + CHECK(ffi_prep_closure_loc(pcl, &cif, closure_test_fn1, + (void *) 3 /* userdata */, code) == FFI_OK); + try + { + (*((closure_test_type1)code)) + (1.1, 2.2, 3.3, 4.4, 127, 5.5, 6.6, 8, 9, 10, 11, 12.0, 13, + 19, 21, 1); + /* { dg-output "\n1 2 3 4 127 5 6 8 9 10 11 12 13 19 21 1 3: 255" } */ + } catch (int exception_code) + { + CHECK(exception_code == 255); + } + printf("part two OK\n"); + /* { dg-output "\npart two OK" } */ + } + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc new file mode 100644 index 000000000..29739cdb1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc @@ -0,0 +1,53 @@ +/* Area: ffi_call, unwind info + Purpose: Check if the unwind information is passed correctly. + Limitations: none. + PR: none. + Originator: Andreas Tobler 20061213 */ + +/* { dg-do run } */ +#include "ffitestcxx.h" + +static int checking(int a __UNUSED__, short b __UNUSED__, + signed char c __UNUSED__) +{ + throw 9; +} + +int main (void) +{ + ffi_cif cif; + ffi_type *args[MAX_ARGS]; + void *values[MAX_ARGS]; + ffi_arg rint; + + signed int si; + signed short ss; + signed char sc; + + args[0] = &ffi_type_sint; + values[0] = &si; + args[1] = &ffi_type_sshort; + values[1] = &ss; + args[2] = &ffi_type_schar; + values[2] = ≻ + + /* Initialize the cif */ + CHECK(ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 3, + &ffi_type_sint, args) == FFI_OK); + + si = -6; + ss = -12; + sc = -1; + { + try + { + ffi_call(&cif, FFI_FN(checking), &rint, values); + } catch (int exception_code) + { + CHECK(exception_code == 9); + } + printf("part one OK\n"); + /* { dg-output "part one OK" } */ + } + exit(0); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/texinfo.tex b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/texinfo.tex new file mode 100644 index 000000000..ff2c40654 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/libffi/texinfo.tex @@ -0,0 +1,7210 @@ +% texinfo.tex -- TeX macros to handle Texinfo files. +% +% Load plain if necessary, i.e., if running under initex. +\expandafter\ifx\csname fmtname\endcsname\relax\input plain\fi +% +\def\texinfoversion{2005-07-05.19} +% +% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995, +% 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software +% Foundation, Inc. +% +% This texinfo.tex file is free software; you can redistribute it and/or +% modify it under the terms of the GNU General Public License as +% published by the Free Software Foundation; either version 2, or (at +% your option) any later version. +% +% This texinfo.tex file is distributed in the hope that it will be +% useful, but WITHOUT ANY WARRANTY; without even the implied warranty +% of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +% General Public License for more details. +% +% You should have received a copy of the GNU General Public License +% along with this texinfo.tex file; see the file COPYING. If not, write +% to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, +% Boston, MA 02110-1301, USA. +% +% As a special exception, when this file is read by TeX when processing +% a Texinfo source document, you may use the result without +% restriction. (This has been our intent since Texinfo was invented.) +% +% Please try the latest version of texinfo.tex before submitting bug +% reports; you can get the latest version from: +% http://www.gnu.org/software/texinfo/ (the Texinfo home page), or +% ftp://tug.org/tex/texinfo.tex +% (and all CTAN mirrors, see http://www.ctan.org). +% The texinfo.tex in any given distribution could well be out +% of date, so if that's what you're using, please check. +% +% Send bug reports to bug-texinfo@gnu.org. Please include including a +% complete document in each bug report with which we can reproduce the +% problem. Patches are, of course, greatly appreciated. +% +% To process a Texinfo manual with TeX, it's most reliable to use the +% texi2dvi shell script that comes with the distribution. For a simple +% manual foo.texi, however, you can get away with this: +% tex foo.texi +% texindex foo.?? +% tex foo.texi +% tex foo.texi +% dvips foo.dvi -o # or whatever; this makes foo.ps. +% The extra TeX runs get the cross-reference information correct. +% Sometimes one run after texindex suffices, and sometimes you need more +% than two; texi2dvi does it as many times as necessary. +% +% It is possible to adapt texinfo.tex for other languages, to some +% extent. You can get the existing language-specific files from the +% full Texinfo distribution. +% +% The GNU Texinfo home page is http://www.gnu.org/software/texinfo. + + +\message{Loading texinfo [version \texinfoversion]:} + +% If in a .fmt file, print the version number +% and turn on active characters that we couldn't do earlier because +% they might have appeared in the input file name. +\everyjob{\message{[Texinfo version \texinfoversion]}% + \catcode`+=\active \catcode`\_=\active} + +\message{Basics,} +\chardef\other=12 + +% We never want plain's \outer definition of \+ in Texinfo. +% For @tex, we can use \tabalign. +\let\+ = \relax + +% Save some plain tex macros whose names we will redefine. +\let\ptexb=\b +\let\ptexbullet=\bullet +\let\ptexc=\c +\let\ptexcomma=\, +\let\ptexdot=\. +\let\ptexdots=\dots +\let\ptexend=\end +\let\ptexequiv=\equiv +\let\ptexexclam=\! +\let\ptexfootnote=\footnote +\let\ptexgtr=> +\let\ptexhat=^ +\let\ptexi=\i +\let\ptexindent=\indent +\let\ptexinsert=\insert +\let\ptexlbrace=\{ +\let\ptexless=< +\let\ptexnewwrite\newwrite +\let\ptexnoindent=\noindent +\let\ptexplus=+ +\let\ptexrbrace=\} +\let\ptexslash=\/ +\let\ptexstar=\* +\let\ptext=\t + +% If this character appears in an error message or help string, it +% starts a new line in the output. +\newlinechar = `^^J + +% Use TeX 3.0's \inputlineno to get the line number, for better error +% messages, but if we're using an old version of TeX, don't do anything. +% +\ifx\inputlineno\thisisundefined + \let\linenumber = \empty % Pre-3.0. +\else + \def\linenumber{l.\the\inputlineno:\space} +\fi + +% Set up fixed words for English if not already set. +\ifx\putwordAppendix\undefined \gdef\putwordAppendix{Appendix}\fi +\ifx\putwordChapter\undefined \gdef\putwordChapter{Chapter}\fi +\ifx\putwordfile\undefined \gdef\putwordfile{file}\fi +\ifx\putwordin\undefined \gdef\putwordin{in}\fi +\ifx\putwordIndexIsEmpty\undefined \gdef\putwordIndexIsEmpty{(Index is empty)}\fi +\ifx\putwordIndexNonexistent\undefined \gdef\putwordIndexNonexistent{(Index is nonexistent)}\fi +\ifx\putwordInfo\undefined \gdef\putwordInfo{Info}\fi +\ifx\putwordInstanceVariableof\undefined \gdef\putwordInstanceVariableof{Instance Variable of}\fi +\ifx\putwordMethodon\undefined \gdef\putwordMethodon{Method on}\fi +\ifx\putwordNoTitle\undefined \gdef\putwordNoTitle{No Title}\fi +\ifx\putwordof\undefined \gdef\putwordof{of}\fi +\ifx\putwordon\undefined \gdef\putwordon{on}\fi +\ifx\putwordpage\undefined \gdef\putwordpage{page}\fi +\ifx\putwordsection\undefined \gdef\putwordsection{section}\fi +\ifx\putwordSection\undefined \gdef\putwordSection{Section}\fi +\ifx\putwordsee\undefined \gdef\putwordsee{see}\fi +\ifx\putwordSee\undefined \gdef\putwordSee{See}\fi +\ifx\putwordShortTOC\undefined \gdef\putwordShortTOC{Short Contents}\fi +\ifx\putwordTOC\undefined \gdef\putwordTOC{Table of Contents}\fi +% +\ifx\putwordMJan\undefined \gdef\putwordMJan{January}\fi +\ifx\putwordMFeb\undefined \gdef\putwordMFeb{February}\fi +\ifx\putwordMMar\undefined \gdef\putwordMMar{March}\fi +\ifx\putwordMApr\undefined \gdef\putwordMApr{April}\fi +\ifx\putwordMMay\undefined \gdef\putwordMMay{May}\fi +\ifx\putwordMJun\undefined \gdef\putwordMJun{June}\fi +\ifx\putwordMJul\undefined \gdef\putwordMJul{July}\fi +\ifx\putwordMAug\undefined \gdef\putwordMAug{August}\fi +\ifx\putwordMSep\undefined \gdef\putwordMSep{September}\fi +\ifx\putwordMOct\undefined \gdef\putwordMOct{October}\fi +\ifx\putwordMNov\undefined \gdef\putwordMNov{November}\fi +\ifx\putwordMDec\undefined \gdef\putwordMDec{December}\fi +% +\ifx\putwordDefmac\undefined \gdef\putwordDefmac{Macro}\fi +\ifx\putwordDefspec\undefined \gdef\putwordDefspec{Special Form}\fi +\ifx\putwordDefvar\undefined \gdef\putwordDefvar{Variable}\fi +\ifx\putwordDefopt\undefined \gdef\putwordDefopt{User Option}\fi +\ifx\putwordDeffunc\undefined \gdef\putwordDeffunc{Function}\fi + +% In some macros, we cannot use the `\? notation---the left quote is +% in some cases the escape char. +\chardef\backChar = `\\ +\chardef\colonChar = `\: +\chardef\commaChar = `\, +\chardef\dotChar = `\. +\chardef\exclamChar= `\! +\chardef\plusChar = `\+ +\chardef\questChar = `\? +\chardef\semiChar = `\; +\chardef\underChar = `\_ + +\chardef\spaceChar = `\ % +\chardef\spacecat = 10 +\def\spaceisspace{\catcode\spaceChar=\spacecat} + +{% for help with debugging. + % example usage: \expandafter\show\activebackslash + \catcode`\! = 0 \catcode`\\ = \active + !global!def!activebackslash{\} +} + +% Ignore a token. +% +\def\gobble#1{} + +% The following is used inside several \edef's. +\def\makecsname#1{\expandafter\noexpand\csname#1\endcsname} + +% Hyphenation fixes. +\hyphenation{ + Flor-i-da Ghost-script Ghost-view Mac-OS Post-Script + ap-pen-dix bit-map bit-maps + data-base data-bases eshell fall-ing half-way long-est man-u-script + man-u-scripts mini-buf-fer mini-buf-fers over-view par-a-digm + par-a-digms rath-er rec-tan-gu-lar ro-bot-ics se-vere-ly set-up spa-ces + spell-ing spell-ings + stand-alone strong-est time-stamp time-stamps which-ever white-space + wide-spread wrap-around +} + +% Margin to add to right of even pages, to left of odd pages. +\newdimen\bindingoffset +\newdimen\normaloffset +\newdimen\pagewidth \newdimen\pageheight + +% For a final copy, take out the rectangles +% that mark overfull boxes (in case you have decided +% that the text looks ok even though it passes the margin). +% +\def\finalout{\overfullrule=0pt} + +% @| inserts a changebar to the left of the current line. It should +% surround any changed text. This approach does *not* work if the +% change spans more than two lines of output. To handle that, we would +% have adopt a much more difficult approach (putting marks into the main +% vertical list for the beginning and end of each change). +% +\def\|{% + % \vadjust can only be used in horizontal mode. + \leavevmode + % + % Append this vertical mode material after the current line in the output. + \vadjust{% + % We want to insert a rule with the height and depth of the current + % leading; that is exactly what \strutbox is supposed to record. + \vskip-\baselineskip + % + % \vadjust-items are inserted at the left edge of the type. So + % the \llap here moves out into the left-hand margin. + \llap{% + % + % For a thicker or thinner bar, change the `1pt'. + \vrule height\baselineskip width1pt + % + % This is the space between the bar and the text. + \hskip 12pt + }% + }% +} + +% Sometimes it is convenient to have everything in the transcript file +% and nothing on the terminal. We don't just call \tracingall here, +% since that produces some useless output on the terminal. We also make +% some effort to order the tracing commands to reduce output in the log +% file; cf. trace.sty in LaTeX. +% +\def\gloggingall{\begingroup \globaldefs = 1 \loggingall \endgroup}% +\def\loggingall{% + \tracingstats2 + \tracingpages1 + \tracinglostchars2 % 2 gives us more in etex + \tracingparagraphs1 + \tracingoutput1 + \tracingmacros2 + \tracingrestores1 + \showboxbreadth\maxdimen \showboxdepth\maxdimen + \ifx\eTeXversion\undefined\else % etex gives us more logging + \tracingscantokens1 + \tracingifs1 + \tracinggroups1 + \tracingnesting2 + \tracingassigns1 + \fi + \tracingcommands3 % 3 gives us more in etex + \errorcontextlines16 +}% + +% add check for \lastpenalty to plain's definitions. If the last thing +% we did was a \nobreak, we don't want to insert more space. +% +\def\smallbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\smallskipamount + \removelastskip\penalty-50\smallskip\fi\fi} +\def\medbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\medskipamount + \removelastskip\penalty-100\medskip\fi\fi} +\def\bigbreak{\ifnum\lastpenalty<10000\par\ifdim\lastskip<\bigskipamount + \removelastskip\penalty-200\bigskip\fi\fi} + +% For @cropmarks command. +% Do @cropmarks to get crop marks. +% +\newif\ifcropmarks +\let\cropmarks = \cropmarkstrue +% +% Dimensions to add cropmarks at corners. +% Added by P. A. MacKay, 12 Nov. 1986 +% +\newdimen\outerhsize \newdimen\outervsize % set by the paper size routines +\newdimen\cornerlong \cornerlong=1pc +\newdimen\cornerthick \cornerthick=.3pt +\newdimen\topandbottommargin \topandbottommargin=.75in + +% Main output routine. +\chardef\PAGE = 255 +\output = {\onepageout{\pagecontents\PAGE}} + +\newbox\headlinebox +\newbox\footlinebox + +% \onepageout takes a vbox as an argument. Note that \pagecontents +% does insertions, but you have to call it yourself. +\def\onepageout#1{% + \ifcropmarks \hoffset=0pt \else \hoffset=\normaloffset \fi + % + \ifodd\pageno \advance\hoffset by \bindingoffset + \else \advance\hoffset by -\bindingoffset\fi + % + % Do this outside of the \shipout so @code etc. will be expanded in + % the headline as they should be, not taken literally (outputting ''code). + \setbox\headlinebox = \vbox{\let\hsize=\pagewidth \makeheadline}% + \setbox\footlinebox = \vbox{\let\hsize=\pagewidth \makefootline}% + % + {% + % Have to do this stuff outside the \shipout because we want it to + % take effect in \write's, yet the group defined by the \vbox ends + % before the \shipout runs. + % + \indexdummies % don't expand commands in the output. + \shipout\vbox{% + % Do this early so pdf references go to the beginning of the page. + \ifpdfmakepagedest \pdfdest name{\the\pageno} xyz\fi + % + \ifcropmarks \vbox to \outervsize\bgroup + \hsize = \outerhsize + \vskip-\topandbottommargin + \vtop to0pt{% + \line{\ewtop\hfil\ewtop}% + \nointerlineskip + \line{% + \vbox{\moveleft\cornerthick\nstop}% + \hfill + \vbox{\moveright\cornerthick\nstop}% + }% + \vss}% + \vskip\topandbottommargin + \line\bgroup + \hfil % center the page within the outer (page) hsize. + \ifodd\pageno\hskip\bindingoffset\fi + \vbox\bgroup + \fi + % + \unvbox\headlinebox + \pagebody{#1}% + \ifdim\ht\footlinebox > 0pt + % Only leave this space if the footline is nonempty. + % (We lessened \vsize for it in \oddfootingxxx.) + % The \baselineskip=24pt in plain's \makefootline has no effect. + \vskip 2\baselineskip + \unvbox\footlinebox + \fi + % + \ifcropmarks + \egroup % end of \vbox\bgroup + \hfil\egroup % end of (centering) \line\bgroup + \vskip\topandbottommargin plus1fill minus1fill + \boxmaxdepth = \cornerthick + \vbox to0pt{\vss + \line{% + \vbox{\moveleft\cornerthick\nsbot}% + \hfill + \vbox{\moveright\cornerthick\nsbot}% + }% + \nointerlineskip + \line{\ewbot\hfil\ewbot}% + }% + \egroup % \vbox from first cropmarks clause + \fi + }% end of \shipout\vbox + }% end of group with \indexdummies + \advancepageno + \ifnum\outputpenalty>-20000 \else\dosupereject\fi +} + +\newinsert\margin \dimen\margin=\maxdimen + +\def\pagebody#1{\vbox to\pageheight{\boxmaxdepth=\maxdepth #1}} +{\catcode`\@ =11 +\gdef\pagecontents#1{\ifvoid\topins\else\unvbox\topins\fi +% marginal hacks, juha@viisa.uucp (Juha Takala) +\ifvoid\margin\else % marginal info is present + \rlap{\kern\hsize\vbox to\z@{\kern1pt\box\margin \vss}}\fi +\dimen@=\dp#1 \unvbox#1 +\ifvoid\footins\else\vskip\skip\footins\footnoterule \unvbox\footins\fi +\ifr@ggedbottom \kern-\dimen@ \vfil \fi} +} + +% Here are the rules for the cropmarks. Note that they are +% offset so that the space between them is truly \outerhsize or \outervsize +% (P. A. MacKay, 12 November, 1986) +% +\def\ewtop{\vrule height\cornerthick depth0pt width\cornerlong} +\def\nstop{\vbox + {\hrule height\cornerthick depth\cornerlong width\cornerthick}} +\def\ewbot{\vrule height0pt depth\cornerthick width\cornerlong} +\def\nsbot{\vbox + {\hrule height\cornerlong depth\cornerthick width\cornerthick}} + +% Parse an argument, then pass it to #1. The argument is the rest of +% the input line (except we remove a trailing comment). #1 should be a +% macro which expects an ordinary undelimited TeX argument. +% +\def\parsearg{\parseargusing{}} +\def\parseargusing#1#2{% + \def\next{#2}% + \begingroup + \obeylines + \spaceisspace + #1% + \parseargline\empty% Insert the \empty token, see \finishparsearg below. +} + +{\obeylines % + \gdef\parseargline#1^^M{% + \endgroup % End of the group started in \parsearg. + \argremovecomment #1\comment\ArgTerm% + }% +} + +% First remove any @comment, then any @c comment. +\def\argremovecomment#1\comment#2\ArgTerm{\argremovec #1\c\ArgTerm} +\def\argremovec#1\c#2\ArgTerm{\argcheckspaces#1\^^M\ArgTerm} + +% Each occurence of `\^^M' or `\^^M' is replaced by a single space. +% +% \argremovec might leave us with trailing space, e.g., +% @end itemize @c foo +% This space token undergoes the same procedure and is eventually removed +% by \finishparsearg. +% +\def\argcheckspaces#1\^^M{\argcheckspacesX#1\^^M \^^M} +\def\argcheckspacesX#1 \^^M{\argcheckspacesY#1\^^M} +\def\argcheckspacesY#1\^^M#2\^^M#3\ArgTerm{% + \def\temp{#3}% + \ifx\temp\empty + % We cannot use \next here, as it holds the macro to run; + % thus we reuse \temp. + \let\temp\finishparsearg + \else + \let\temp\argcheckspaces + \fi + % Put the space token in: + \temp#1 #3\ArgTerm +} + +% If a _delimited_ argument is enclosed in braces, they get stripped; so +% to get _exactly_ the rest of the line, we had to prevent such situation. +% We prepended an \empty token at the very beginning and we expand it now, +% just before passing the control to \next. +% (Similarily, we have to think about #3 of \argcheckspacesY above: it is +% either the null string, or it ends with \^^M---thus there is no danger +% that a pair of braces would be stripped. +% +% But first, we have to remove the trailing space token. +% +\def\finishparsearg#1 \ArgTerm{\expandafter\next\expandafter{#1}} + +% \parseargdef\foo{...} +% is roughly equivalent to +% \def\foo{\parsearg\Xfoo} +% \def\Xfoo#1{...} +% +% Actually, I use \csname\string\foo\endcsname, ie. \\foo, as it is my +% favourite TeX trick. --kasal, 16nov03 + +\def\parseargdef#1{% + \expandafter \doparseargdef \csname\string#1\endcsname #1% +} +\def\doparseargdef#1#2{% + \def#2{\parsearg#1}% + \def#1##1% +} + +% Several utility definitions with active space: +{ + \obeyspaces + \gdef\obeyedspace{ } + + % Make each space character in the input produce a normal interword + % space in the output. Don't allow a line break at this space, as this + % is used only in environments like @example, where each line of input + % should produce a line of output anyway. + % + \gdef\sepspaces{\obeyspaces\let =\tie} + + % If an index command is used in an @example environment, any spaces + % therein should become regular spaces in the raw index file, not the + % expansion of \tie (\leavevmode \penalty \@M \ ). + \gdef\unsepspaces{\let =\space} +} + + +\def\flushcr{\ifx\par\lisppar \def\next##1{}\else \let\next=\relax \fi \next} + +% Define the framework for environments in texinfo.tex. It's used like this: +% +% \envdef\foo{...} +% \def\Efoo{...} +% +% It's the responsibility of \envdef to insert \begingroup before the +% actual body; @end closes the group after calling \Efoo. \envdef also +% defines \thisenv, so the current environment is known; @end checks +% whether the environment name matches. The \checkenv macro can also be +% used to check whether the current environment is the one expected. +% +% Non-false conditionals (@iftex, @ifset) don't fit into this, so they +% are not treated as enviroments; they don't open a group. (The +% implementation of @end takes care not to call \endgroup in this +% special case.) + + +% At runtime, environments start with this: +\def\startenvironment#1{\begingroup\def\thisenv{#1}} +% initialize +\let\thisenv\empty + +% ... but they get defined via ``\envdef\foo{...}'': +\long\def\envdef#1#2{\def#1{\startenvironment#1#2}} +\def\envparseargdef#1#2{\parseargdef#1{\startenvironment#1#2}} + +% Check whether we're in the right environment: +\def\checkenv#1{% + \def\temp{#1}% + \ifx\thisenv\temp + \else + \badenverr + \fi +} + +% Evironment mismatch, #1 expected: +\def\badenverr{% + \errhelp = \EMsimple + \errmessage{This command can appear only \inenvironment\temp, + not \inenvironment\thisenv}% +} +\def\inenvironment#1{% + \ifx#1\empty + out of any environment% + \else + in environment \expandafter\string#1% + \fi +} + +% @end foo executes the definition of \Efoo. +% But first, it executes a specialized version of \checkenv +% +\parseargdef\end{% + \if 1\csname iscond.#1\endcsname + \else + % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03 + \expandafter\checkenv\csname#1\endcsname + \csname E#1\endcsname + \endgroup + \fi +} + +\newhelp\EMsimple{Press RETURN to continue.} + + +%% Simple single-character @ commands + +% @@ prints an @ +% Kludge this until the fonts are right (grr). +\def\@{{\tt\char64}} + +% This is turned off because it was never documented +% and you can use @w{...} around a quote to suppress ligatures. +%% Define @` and @' to be the same as ` and ' +%% but suppressing ligatures. +%\def\`{{`}} +%\def\'{{'}} + +% Used to generate quoted braces. +\def\mylbrace {{\tt\char123}} +\def\myrbrace {{\tt\char125}} +\let\{=\mylbrace +\let\}=\myrbrace +\begingroup + % Definitions to produce \{ and \} commands for indices, + % and @{ and @} for the aux/toc files. + \catcode`\{ = \other \catcode`\} = \other + \catcode`\[ = 1 \catcode`\] = 2 + \catcode`\! = 0 \catcode`\\ = \other + !gdef!lbracecmd[\{]% + !gdef!rbracecmd[\}]% + !gdef!lbraceatcmd[@{]% + !gdef!rbraceatcmd[@}]% +!endgroup + +% @comma{} to avoid , parsing problems. +\let\comma = , + +% Accents: @, @dotaccent @ringaccent @ubaraccent @udotaccent +% Others are defined by plain TeX: @` @' @" @^ @~ @= @u @v @H. +\let\, = \c +\let\dotaccent = \. +\def\ringaccent#1{{\accent23 #1}} +\let\tieaccent = \t +\let\ubaraccent = \b +\let\udotaccent = \d + +% Other special characters: @questiondown @exclamdown @ordf @ordm +% Plain TeX defines: @AA @AE @O @OE @L (plus lowercase versions) @ss. +\def\questiondown{?`} +\def\exclamdown{!`} +\def\ordf{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{a}}} +\def\ordm{\leavevmode\raise1ex\hbox{\selectfonts\lllsize \underbar{o}}} + +% Dotless i and dotless j, used for accents. +\def\imacro{i} +\def\jmacro{j} +\def\dotless#1{% + \def\temp{#1}% + \ifx\temp\imacro \ptexi + \else\ifx\temp\jmacro \j + \else \errmessage{@dotless can be used only with i or j}% + \fi\fi +} + +% The \TeX{} logo, as in plain, but resetting the spacing so that a +% period following counts as ending a sentence. (Idea found in latex.) +% +\edef\TeX{\TeX \spacefactor=1000 } + +% @LaTeX{} logo. Not quite the same results as the definition in +% latex.ltx, since we use a different font for the raised A; it's most +% convenient for us to use an explicitly smaller font, rather than using +% the \scriptstyle font (since we don't reset \scriptstyle and +% \scriptscriptstyle). +% +\def\LaTeX{% + L\kern-.36em + {\setbox0=\hbox{T}% + \vbox to \ht0{\hbox{\selectfonts\lllsize A}\vss}}% + \kern-.15em + \TeX +} + +% Be sure we're in horizontal mode when doing a tie, since we make space +% equivalent to this in @example-like environments. Otherwise, a space +% at the beginning of a line will start with \penalty -- and +% since \penalty is valid in vertical mode, we'd end up putting the +% penalty on the vertical list instead of in the new paragraph. +{\catcode`@ = 11 + % Avoid using \@M directly, because that causes trouble + % if the definition is written into an index file. + \global\let\tiepenalty = \@M + \gdef\tie{\leavevmode\penalty\tiepenalty\ } +} + +% @: forces normal size whitespace following. +\def\:{\spacefactor=1000 } + +% @* forces a line break. +\def\*{\hfil\break\hbox{}\ignorespaces} + +% @/ allows a line break. +\let\/=\allowbreak + +% @. is an end-of-sentence period. +\def\.{.\spacefactor=\endofsentencespacefactor\space} + +% @! is an end-of-sentence bang. +\def\!{!\spacefactor=\endofsentencespacefactor\space} + +% @? is an end-of-sentence query. +\def\?{?\spacefactor=\endofsentencespacefactor\space} + +% @frenchspacing on|off says whether to put extra space after punctuation. +% +\def\onword{on} +\def\offword{off} +% +\parseargdef\frenchspacing{% + \def\temp{#1}% + \ifx\temp\onword \plainfrenchspacing + \else\ifx\temp\offword \plainnonfrenchspacing + \else + \errhelp = \EMsimple + \errmessage{Unknown @frenchspacing option `\temp', must be on/off}% + \fi\fi +} + +% @w prevents a word break. Without the \leavevmode, @w at the +% beginning of a paragraph, when TeX is still in vertical mode, would +% produce a whole line of output instead of starting the paragraph. +\def\w#1{\leavevmode\hbox{#1}} + +% @group ... @end group forces ... to be all on one page, by enclosing +% it in a TeX vbox. We use \vtop instead of \vbox to construct the box +% to keep its height that of a normal line. According to the rules for +% \topskip (p.114 of the TeXbook), the glue inserted is +% max (\topskip - \ht (first item), 0). If that height is large, +% therefore, no glue is inserted, and the space between the headline and +% the text is small, which looks bad. +% +% Another complication is that the group might be very large. This can +% cause the glue on the previous page to be unduly stretched, because it +% does not have much material. In this case, it's better to add an +% explicit \vfill so that the extra space is at the bottom. The +% threshold for doing this is if the group is more than \vfilllimit +% percent of a page (\vfilllimit can be changed inside of @tex). +% +\newbox\groupbox +\def\vfilllimit{0.7} +% +\envdef\group{% + \ifnum\catcode`\^^M=\active \else + \errhelp = \groupinvalidhelp + \errmessage{@group invalid in context where filling is enabled}% + \fi + \startsavinginserts + % + \setbox\groupbox = \vtop\bgroup + % Do @comment since we are called inside an environment such as + % @example, where each end-of-line in the input causes an + % end-of-line in the output. We don't want the end-of-line after + % the `@group' to put extra space in the output. Since @group + % should appear on a line by itself (according to the Texinfo + % manual), we don't worry about eating any user text. + \comment +} +% +% The \vtop produces a box with normal height and large depth; thus, TeX puts +% \baselineskip glue before it, and (when the next line of text is done) +% \lineskip glue after it. Thus, space below is not quite equal to space +% above. But it's pretty close. +\def\Egroup{% + % To get correct interline space between the last line of the group + % and the first line afterwards, we have to propagate \prevdepth. + \endgraf % Not \par, as it may have been set to \lisppar. + \global\dimen1 = \prevdepth + \egroup % End the \vtop. + % \dimen0 is the vertical size of the group's box. + \dimen0 = \ht\groupbox \advance\dimen0 by \dp\groupbox + % \dimen2 is how much space is left on the page (more or less). + \dimen2 = \pageheight \advance\dimen2 by -\pagetotal + % if the group doesn't fit on the current page, and it's a big big + % group, force a page break. + \ifdim \dimen0 > \dimen2 + \ifdim \pagetotal < \vfilllimit\pageheight + \page + \fi + \fi + \box\groupbox + \prevdepth = \dimen1 + \checkinserts +} +% +% TeX puts in an \escapechar (i.e., `@') at the beginning of the help +% message, so this ends up printing `@group can only ...'. +% +\newhelp\groupinvalidhelp{% +group can only be used in environments such as @example,^^J% +where each line of input produces a line of output.} + +% @need space-in-mils +% forces a page break if there is not space-in-mils remaining. + +\newdimen\mil \mil=0.001in + +% Old definition--didn't work. +%\parseargdef\need{\par % +%% This method tries to make TeX break the page naturally +%% if the depth of the box does not fit. +%{\baselineskip=0pt% +%\vtop to #1\mil{\vfil}\kern -#1\mil\nobreak +%\prevdepth=-1000pt +%}} + +\parseargdef\need{% + % Ensure vertical mode, so we don't make a big box in the middle of a + % paragraph. + \par + % + % If the @need value is less than one line space, it's useless. + \dimen0 = #1\mil + \dimen2 = \ht\strutbox + \advance\dimen2 by \dp\strutbox + \ifdim\dimen0 > \dimen2 + % + % Do a \strut just to make the height of this box be normal, so the + % normal leading is inserted relative to the preceding line. + % And a page break here is fine. + \vtop to #1\mil{\strut\vfil}% + % + % TeX does not even consider page breaks if a penalty added to the + % main vertical list is 10000 or more. But in order to see if the + % empty box we just added fits on the page, we must make it consider + % page breaks. On the other hand, we don't want to actually break the + % page after the empty box. So we use a penalty of 9999. + % + % There is an extremely small chance that TeX will actually break the + % page at this \penalty, if there are no other feasible breakpoints in + % sight. (If the user is using lots of big @group commands, which + % almost-but-not-quite fill up a page, TeX will have a hard time doing + % good page breaking, for example.) However, I could not construct an + % example where a page broke at this \penalty; if it happens in a real + % document, then we can reconsider our strategy. + \penalty9999 + % + % Back up by the size of the box, whether we did a page break or not. + \kern -#1\mil + % + % Do not allow a page break right after this kern. + \nobreak + \fi +} + +% @br forces paragraph break (and is undocumented). + +\let\br = \par + +% @page forces the start of a new page. +% +\def\page{\par\vfill\supereject} + +% @exdent text.... +% outputs text on separate line in roman font, starting at standard page margin + +% This records the amount of indent in the innermost environment. +% That's how much \exdent should take out. +\newskip\exdentamount + +% This defn is used inside fill environments such as @defun. +\parseargdef\exdent{\hfil\break\hbox{\kern -\exdentamount{\rm#1}}\hfil\break} + +% This defn is used inside nofill environments such as @example. +\parseargdef\nofillexdent{{\advance \leftskip by -\exdentamount + \leftline{\hskip\leftskip{\rm#1}}}} + +% @inmargin{WHICH}{TEXT} puts TEXT in the WHICH margin next to the current +% paragraph. For more general purposes, use the \margin insertion +% class. WHICH is `l' or `r'. +% +\newskip\inmarginspacing \inmarginspacing=1cm +\def\strutdepth{\dp\strutbox} +% +\def\doinmargin#1#2{\strut\vadjust{% + \nobreak + \kern-\strutdepth + \vtop to \strutdepth{% + \baselineskip=\strutdepth + \vss + % if you have multiple lines of stuff to put here, you'll need to + % make the vbox yourself of the appropriate size. + \ifx#1l% + \llap{\ignorespaces #2\hskip\inmarginspacing}% + \else + \rlap{\hskip\hsize \hskip\inmarginspacing \ignorespaces #2}% + \fi + \null + }% +}} +\def\inleftmargin{\doinmargin l} +\def\inrightmargin{\doinmargin r} +% +% @inmargin{TEXT [, RIGHT-TEXT]} +% (if RIGHT-TEXT is given, use TEXT for left page, RIGHT-TEXT for right; +% else use TEXT for both). +% +\def\inmargin#1{\parseinmargin #1,,\finish} +\def\parseinmargin#1,#2,#3\finish{% not perfect, but better than nothing. + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \def\lefttext{#1}% have both texts + \def\righttext{#2}% + \else + \def\lefttext{#1}% have only one text + \def\righttext{#1}% + \fi + % + \ifodd\pageno + \def\temp{\inrightmargin\righttext}% odd page -> outside is right margin + \else + \def\temp{\inleftmargin\lefttext}% + \fi + \temp +} + +% @include file insert text of that file as input. +% +\def\include{\parseargusing\filenamecatcodes\includezzz} +\def\includezzz#1{% + \pushthisfilestack + \def\thisfile{#1}% + {% + \makevalueexpandable + \def\temp{\input #1 }% + \expandafter + }\temp + \popthisfilestack +} +\def\filenamecatcodes{% + \catcode`\\=\other + \catcode`~=\other + \catcode`^=\other + \catcode`_=\other + \catcode`|=\other + \catcode`<=\other + \catcode`>=\other + \catcode`+=\other + \catcode`-=\other +} + +\def\pushthisfilestack{% + \expandafter\pushthisfilestackX\popthisfilestack\StackTerm +} +\def\pushthisfilestackX{% + \expandafter\pushthisfilestackY\thisfile\StackTerm +} +\def\pushthisfilestackY #1\StackTerm #2\StackTerm {% + \gdef\popthisfilestack{\gdef\thisfile{#1}\gdef\popthisfilestack{#2}}% +} + +\def\popthisfilestack{\errthisfilestackempty} +\def\errthisfilestackempty{\errmessage{Internal error: + the stack of filenames is empty.}} + +\def\thisfile{} + +% @center line +% outputs that line, centered. +% +\parseargdef\center{% + \ifhmode + \let\next\centerH + \else + \let\next\centerV + \fi + \next{\hfil \ignorespaces#1\unskip \hfil}% +} +\def\centerH#1{% + {% + \hfil\break + \advance\hsize by -\leftskip + \advance\hsize by -\rightskip + \line{#1}% + \break + }% +} +\def\centerV#1{\line{\kern\leftskip #1\kern\rightskip}} + +% @sp n outputs n lines of vertical space + +\parseargdef\sp{\vskip #1\baselineskip} + +% @comment ...line which is ignored... +% @c is the same as @comment +% @ignore ... @end ignore is another way to write a comment + +\def\comment{\begingroup \catcode`\^^M=\other% +\catcode`\@=\other \catcode`\{=\other \catcode`\}=\other% +\commentxxx} +{\catcode`\^^M=\other \gdef\commentxxx#1^^M{\endgroup}} + +\let\c=\comment + +% @paragraphindent NCHARS +% We'll use ems for NCHARS, close enough. +% NCHARS can also be the word `asis' or `none'. +% We cannot feasibly implement @paragraphindent asis, though. +% +\def\asisword{asis} % no translation, these are keywords +\def\noneword{none} +% +\parseargdef\paragraphindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \defaultparindent = 0pt + \else + \defaultparindent = #1em + \fi + \fi + \parindent = \defaultparindent +} + +% @exampleindent NCHARS +% We'll use ems for NCHARS like @paragraphindent. +% It seems @exampleindent asis isn't necessary, but +% I preserve it to make it similar to @paragraphindent. +\parseargdef\exampleindent{% + \def\temp{#1}% + \ifx\temp\asisword + \else + \ifx\temp\noneword + \lispnarrowing = 0pt + \else + \lispnarrowing = #1em + \fi + \fi +} + +% @firstparagraphindent WORD +% If WORD is `none', then suppress indentation of the first paragraph +% after a section heading. If WORD is `insert', then do indent at such +% paragraphs. +% +% The paragraph indentation is suppressed or not by calling +% \suppressfirstparagraphindent, which the sectioning commands do. +% We switch the definition of this back and forth according to WORD. +% By default, we suppress indentation. +% +\def\suppressfirstparagraphindent{\dosuppressfirstparagraphindent} +\def\insertword{insert} +% +\parseargdef\firstparagraphindent{% + \def\temp{#1}% + \ifx\temp\noneword + \let\suppressfirstparagraphindent = \dosuppressfirstparagraphindent + \else\ifx\temp\insertword + \let\suppressfirstparagraphindent = \relax + \else + \errhelp = \EMsimple + \errmessage{Unknown @firstparagraphindent option `\temp'}% + \fi\fi +} + +% Here is how we actually suppress indentation. Redefine \everypar to +% \kern backwards by \parindent, and then reset itself to empty. +% +% We also make \indent itself not actually do anything until the next +% paragraph. +% +\gdef\dosuppressfirstparagraphindent{% + \gdef\indent{% + \restorefirstparagraphindent + \indent + }% + \gdef\noindent{% + \restorefirstparagraphindent + \noindent + }% + \global\everypar = {% + \kern -\parindent + \restorefirstparagraphindent + }% +} + +\gdef\restorefirstparagraphindent{% + \global \let \indent = \ptexindent + \global \let \noindent = \ptexnoindent + \global \everypar = {}% +} + + +% @asis just yields its argument. Used with @table, for example. +% +\def\asis#1{#1} + +% @math outputs its argument in math mode. +% +% One complication: _ usually means subscripts, but it could also mean +% an actual _ character, as in @math{@var{some_variable} + 1}. So make +% _ active, and distinguish by seeing if the current family is \slfam, +% which is what @var uses. +{ + \catcode\underChar = \active + \gdef\mathunderscore{% + \catcode\underChar=\active + \def_{\ifnum\fam=\slfam \_\else\sb\fi}% + } +} +% Another complication: we want \\ (and @\) to output a \ character. +% FYI, plain.tex uses \\ as a temporary control sequence (why?), but +% this is not advertised and we don't care. Texinfo does not +% otherwise define @\. +% +% The \mathchar is class=0=ordinary, family=7=ttfam, position=5C=\. +\def\mathbackslash{\ifnum\fam=\ttfam \mathchar"075C \else\backslash \fi} +% +\def\math{% + \tex + \mathunderscore + \let\\ = \mathbackslash + \mathactive + $\finishmath +} +\def\finishmath#1{#1$\endgroup} % Close the group opened by \tex. + +% Some active characters (such as <) are spaced differently in math. +% We have to reset their definitions in case the @math was an argument +% to a command which sets the catcodes (such as @item or @section). +% +{ + \catcode`^ = \active + \catcode`< = \active + \catcode`> = \active + \catcode`+ = \active + \gdef\mathactive{% + \let^ = \ptexhat + \let< = \ptexless + \let> = \ptexgtr + \let+ = \ptexplus + } +} + +% @bullet and @minus need the same treatment as @math, just above. +\def\bullet{$\ptexbullet$} +\def\minus{$-$} + +% @dots{} outputs an ellipsis using the current font. +% We do .5em per period so that it has the same spacing in a typewriter +% font as three actual period characters. +% +\def\dots{% + \leavevmode + \hbox to 1.5em{% + \hskip 0pt plus 0.25fil + .\hfil.\hfil.% + \hskip 0pt plus 0.5fil + }% +} + +% @enddots{} is an end-of-sentence ellipsis. +% +\def\enddots{% + \dots + \spacefactor=\endofsentencespacefactor +} + +% @comma{} is so commas can be inserted into text without messing up +% Texinfo's parsing. +% +\let\comma = , + +% @refill is a no-op. +\let\refill=\relax + +% If working on a large document in chapters, it is convenient to +% be able to disable indexing, cross-referencing, and contents, for test runs. +% This is done with @novalidate (before @setfilename). +% +\newif\iflinks \linkstrue % by default we want the aux files. +\let\novalidate = \linksfalse + +% @setfilename is done at the beginning of every texinfo file. +% So open here the files we need to have open while reading the input. +% This makes it possible to make a .fmt file for texinfo. +\def\setfilename{% + \fixbackslash % Turn off hack to swallow `\input texinfo'. + \iflinks + \tryauxfile + % Open the new aux file. TeX will close it automatically at exit. + \immediate\openout\auxfile=\jobname.aux + \fi % \openindices needs to do some work in any case. + \openindices + \let\setfilename=\comment % Ignore extra @setfilename cmds. + % + % If texinfo.cnf is present on the system, read it. + % Useful for site-wide @afourpaper, etc. + \openin 1 texinfo.cnf + \ifeof 1 \else \input texinfo.cnf \fi + \closein 1 + % + \comment % Ignore the actual filename. +} + +% Called from \setfilename. +% +\def\openindices{% + \newindex{cp}% + \newcodeindex{fn}% + \newcodeindex{vr}% + \newcodeindex{tp}% + \newcodeindex{ky}% + \newcodeindex{pg}% +} + +% @bye. +\outer\def\bye{\pagealignmacro\tracingstats=1\ptexend} + + +\message{pdf,} +% adobe `portable' document format +\newcount\tempnum +\newcount\lnkcount +\newtoks\filename +\newcount\filenamelength +\newcount\pgn +\newtoks\toksA +\newtoks\toksB +\newtoks\toksC +\newtoks\toksD +\newbox\boxA +\newcount\countA +\newif\ifpdf +\newif\ifpdfmakepagedest + +% when pdftex is run in dvi mode, \pdfoutput is defined (so \pdfoutput=1 +% can be set). So we test for \relax and 0 as well as \undefined, +% borrowed from ifpdf.sty. +\ifx\pdfoutput\undefined +\else + \ifx\pdfoutput\relax + \else + \ifcase\pdfoutput + \else + \pdftrue + \fi + \fi +\fi + +% PDF uses PostScript string constants for the names of xref targets, to +% for display in the outlines, and in other places. Thus, we have to +% double any backslashes. Otherwise, a name like "\node" will be +% interpreted as a newline (\n), followed by o, d, e. Not good. +% http://www.ntg.nl/pipermail/ntg-pdftex/2004-July/000654.html +% (and related messages, the final outcome is that it is up to the TeX +% user to double the backslashes and otherwise make the string valid, so +% that's we do). + +% double active backslashes. +% +{\catcode`\@=0 \catcode`\\=\active + @gdef@activebackslash{@catcode`@\=@active @otherbackslash} + @gdef@activebackslashdouble{% + @catcode@backChar=@active + @let\=@doublebackslash} +} + +% To handle parens, we must adopt a different approach, since parens are +% not active characters. hyperref.dtx (which has the same problem as +% us) handles it with this amazing macro to replace tokens. I've +% tinkered with it a little for texinfo, but it's definitely from there. +% +% #1 is the tokens to replace. +% #2 is the replacement. +% #3 is the control sequence with the string. +% +\def\HyPsdSubst#1#2#3{% + \def\HyPsdReplace##1#1##2\END{% + ##1% + \ifx\\##2\\% + \else + #2% + \HyReturnAfterFi{% + \HyPsdReplace##2\END + }% + \fi + }% + \xdef#3{\expandafter\HyPsdReplace#3#1\END}% +} +\long\def\HyReturnAfterFi#1\fi{\fi#1} + +% #1 is a control sequence in which to do the replacements. +\def\backslashparens#1{% + \xdef#1{#1}% redefine it as its expansion; the definition is simply + % \lastnode when called from \setref -> \pdfmkdest. + \HyPsdSubst{(}{\backslashlparen}{#1}% + \HyPsdSubst{)}{\backslashrparen}{#1}% +} + +{\catcode\exclamChar = 0 \catcode\backChar = \other + !gdef!backslashlparen{\(}% + !gdef!backslashrparen{\)}% +} + +\ifpdf + \input pdfcolor + \pdfcatalog{/PageMode /UseOutlines}% + \def\dopdfimage#1#2#3{% + \def\imagewidth{#2}% + \def\imageheight{#3}% + % without \immediate, pdftex seg faults when the same image is + % included twice. (Version 3.14159-pre-1.0-unofficial-20010704.) + \ifnum\pdftexversion < 14 + \immediate\pdfimage + \else + \immediate\pdfximage + \fi + \ifx\empty\imagewidth\else width \imagewidth \fi + \ifx\empty\imageheight\else height \imageheight \fi + \ifnum\pdftexversion<13 + #1.pdf% + \else + {#1.pdf}% + \fi + \ifnum\pdftexversion < 14 \else + \pdfrefximage \pdflastximage + \fi} + \def\pdfmkdest#1{{% + % We have to set dummies so commands such as @code, and characters + % such as \, aren't expanded when present in a section title. + \atdummies + \activebackslashdouble + \def\pdfdestname{#1}% + \backslashparens\pdfdestname + \pdfdest name{\pdfdestname} xyz% + }}% + % + % used to mark target names; must be expandable. + \def\pdfmkpgn#1{#1}% + % + \let\linkcolor = \Blue % was Cyan, but that seems light? + \def\endlink{\Black\pdfendlink} + % Adding outlines to PDF; macros for calculating structure of outlines + % come from Petr Olsak + \def\expnumber#1{\expandafter\ifx\csname#1\endcsname\relax 0% + \else \csname#1\endcsname \fi} + \def\advancenumber#1{\tempnum=\expnumber{#1}\relax + \advance\tempnum by 1 + \expandafter\xdef\csname#1\endcsname{\the\tempnum}} + % + % #1 is the section text, which is what will be displayed in the + % outline by the pdf viewer. #2 is the pdf expression for the number + % of subentries (or empty, for subsubsections). #3 is the node text, + % which might be empty if this toc entry had no corresponding node. + % #4 is the page number + % + \def\dopdfoutline#1#2#3#4{% + % Generate a link to the node text if that exists; else, use the + % page number. We could generate a destination for the section + % text in the case where a section has no node, but it doesn't + % seem worth the trouble, since most documents are normally structured. + \def\pdfoutlinedest{#3}% + \ifx\pdfoutlinedest\empty + \def\pdfoutlinedest{#4}% + \else + % Doubled backslashes in the name. + {\activebackslashdouble \xdef\pdfoutlinedest{#3}% + \backslashparens\pdfoutlinedest}% + \fi + % + % Also double the backslashes in the display string. + {\activebackslashdouble \xdef\pdfoutlinetext{#1}% + \backslashparens\pdfoutlinetext}% + % + \pdfoutline goto name{\pdfmkpgn{\pdfoutlinedest}}#2{\pdfoutlinetext}% + } + % + \def\pdfmakeoutlines{% + \begingroup + % Thanh's hack / proper braces in bookmarks + \edef\mylbrace{\iftrue \string{\else}\fi}\let\{=\mylbrace + \edef\myrbrace{\iffalse{\else\string}\fi}\let\}=\myrbrace + % + % Read toc silently, to get counts of subentries for \pdfoutline. + \def\numchapentry##1##2##3##4{% + \def\thischapnum{##2}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + }% + \def\numsecentry##1##2##3##4{% + \advancenumber{chap\thischapnum}% + \def\thissecnum{##2}% + \def\thissubsecnum{0}% + }% + \def\numsubsecentry##1##2##3##4{% + \advancenumber{sec\thissecnum}% + \def\thissubsecnum{##2}% + }% + \def\numsubsubsecentry##1##2##3##4{% + \advancenumber{subsec\thissubsecnum}% + }% + \def\thischapnum{0}% + \def\thissecnum{0}% + \def\thissubsecnum{0}% + % + % use \def rather than \let here because we redefine \chapentry et + % al. a second time, below. + \def\appentry{\numchapentry}% + \def\appsecentry{\numsecentry}% + \def\appsubsecentry{\numsubsecentry}% + \def\appsubsubsecentry{\numsubsubsecentry}% + \def\unnchapentry{\numchapentry}% + \def\unnsecentry{\numsecentry}% + \def\unnsubsecentry{\numsubsecentry}% + \def\unnsubsubsecentry{\numsubsubsecentry}% + \readdatafile{toc}% + % + % Read toc second time, this time actually producing the outlines. + % The `-' means take the \expnumber as the absolute number of + % subentries, which we calculated on our first read of the .toc above. + % + % We use the node names as the destinations. + \def\numchapentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{chap##2}}{##3}{##4}}% + \def\numsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{sec##2}}{##3}{##4}}% + \def\numsubsecentry##1##2##3##4{% + \dopdfoutline{##1}{count-\expnumber{subsec##2}}{##3}{##4}}% + \def\numsubsubsecentry##1##2##3##4{% count is always zero + \dopdfoutline{##1}{}{##3}{##4}}% + % + % PDF outlines are displayed using system fonts, instead of + % document fonts. Therefore we cannot use special characters, + % since the encoding is unknown. For example, the eogonek from + % Latin 2 (0xea) gets translated to a | character. Info from + % Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100. + % + % xx to do this right, we have to translate 8-bit characters to + % their "best" equivalent, based on the @documentencoding. Right + % now, I guess we'll just let the pdf reader have its way. + \indexnofonts + \setupdatafile + \activebackslash + \input \jobname.toc + \endgroup + } + % + \def\skipspaces#1{\def\PP{#1}\def\D{|}% + \ifx\PP\D\let\nextsp\relax + \else\let\nextsp\skipspaces + \ifx\p\space\else\addtokens{\filename}{\PP}% + \advance\filenamelength by 1 + \fi + \fi + \nextsp} + \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax} + \ifnum\pdftexversion < 14 + \let \startlink \pdfannotlink + \else + \let \startlink \pdfstartlink + \fi + \def\pdfurl#1{% + \begingroup + \normalturnoffactive\def\@{@}% + \makevalueexpandable + \leavevmode\Red + \startlink attr{/Border [0 0 0]}% + user{/Subtype /Link /A << /S /URI /URI (#1) >>}% + \endgroup} + \def\pdfgettoks#1.{\setbox\boxA=\hbox{\toksA={#1.}\toksB={}\maketoks}} + \def\addtokens#1#2{\edef\addtoks{\noexpand#1={\the#1#2}}\addtoks} + \def\adn#1{\addtokens{\toksC}{#1}\global\countA=1\let\next=\maketoks} + \def\poptoks#1#2|ENDTOKS|{\let\first=#1\toksD={#1}\toksA={#2}} + \def\maketoks{% + \expandafter\poptoks\the\toksA|ENDTOKS|\relax + \ifx\first0\adn0 + \else\ifx\first1\adn1 \else\ifx\first2\adn2 \else\ifx\first3\adn3 + \else\ifx\first4\adn4 \else\ifx\first5\adn5 \else\ifx\first6\adn6 + \else\ifx\first7\adn7 \else\ifx\first8\adn8 \else\ifx\first9\adn9 + \else + \ifnum0=\countA\else\makelink\fi + \ifx\first.\let\next=\done\else + \let\next=\maketoks + \addtokens{\toksB}{\the\toksD} + \ifx\first,\addtokens{\toksB}{\space}\fi + \fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \next} + \def\makelink{\addtokens{\toksB}% + {\noexpand\pdflink{\the\toksC}}\toksC={}\global\countA=0} + \def\pdflink#1{% + \startlink attr{/Border [0 0 0]} goto name{\pdfmkpgn{#1}} + \linkcolor #1\endlink} + \def\done{\edef\st{\global\noexpand\toksA={\the\toksB}}\st} +\else + \let\pdfmkdest = \gobble + \let\pdfurl = \gobble + \let\endlink = \relax + \let\linkcolor = \relax + \let\pdfmakeoutlines = \relax +\fi % \ifx\pdfoutput + + +\message{fonts,} + +% Change the current font style to #1, remembering it in \curfontstyle. +% For now, we do not accumulate font styles: @b{@i{foo}} prints foo in +% italics, not bold italics. +% +\def\setfontstyle#1{% + \def\curfontstyle{#1}% not as a control sequence, because we are \edef'd. + \csname ten#1\endcsname % change the current font +} + +% Select #1 fonts with the current style. +% +\def\selectfonts#1{\csname #1fonts\endcsname \csname\curfontstyle\endcsname} + +\def\rm{\fam=0 \setfontstyle{rm}} +\def\it{\fam=\itfam \setfontstyle{it}} +\def\sl{\fam=\slfam \setfontstyle{sl}} +\def\bf{\fam=\bffam \setfontstyle{bf}}\def\bfstylename{bf} +\def\tt{\fam=\ttfam \setfontstyle{tt}} + +% Texinfo sort of supports the sans serif font style, which plain TeX does not. +% So we set up a \sf. +\newfam\sffam +\def\sf{\fam=\sffam \setfontstyle{sf}} +\let\li = \sf % Sometimes we call it \li, not \sf. + +% We don't need math for this font style. +\def\ttsl{\setfontstyle{ttsl}} + +% Default leading. +\newdimen\textleading \textleading = 13.2pt + +% Set the baselineskip to #1, and the lineskip and strut size +% correspondingly. There is no deep meaning behind these magic numbers +% used as factors; they just match (closely enough) what Knuth defined. +% +\def\lineskipfactor{.08333} +\def\strutheightpercent{.70833} +\def\strutdepthpercent {.29167} +% +\def\setleading#1{% + \normalbaselineskip = #1\relax + \normallineskip = \lineskipfactor\normalbaselineskip + \normalbaselines + \setbox\strutbox =\hbox{% + \vrule width0pt height\strutheightpercent\baselineskip + depth \strutdepthpercent \baselineskip + }% +} + +% Set the font macro #1 to the font named #2, adding on the +% specified font prefix (normally `cm'). +% #3 is the font's design size, #4 is a scale factor +\def\setfont#1#2#3#4{\font#1=\fontprefix#2#3 scaled #4} + +% Use cm as the default font prefix. +% To specify the font prefix, you must define \fontprefix +% before you read in texinfo.tex. +\ifx\fontprefix\undefined +\def\fontprefix{cm} +\fi +% Support font families that don't use the same naming scheme as CM. +\def\rmshape{r} +\def\rmbshape{bx} %where the normal face is bold +\def\bfshape{b} +\def\bxshape{bx} +\def\ttshape{tt} +\def\ttbshape{tt} +\def\ttslshape{sltt} +\def\itshape{ti} +\def\itbshape{bxti} +\def\slshape{sl} +\def\slbshape{bxsl} +\def\sfshape{ss} +\def\sfbshape{ss} +\def\scshape{csc} +\def\scbshape{csc} + +% Text fonts (11.2pt, magstep1). +\def\textnominalsize{11pt} +\edef\mainmagstep{\magstephalf} +\setfont\textrm\rmshape{10}{\mainmagstep} +\setfont\texttt\ttshape{10}{\mainmagstep} +\setfont\textbf\bfshape{10}{\mainmagstep} +\setfont\textit\itshape{10}{\mainmagstep} +\setfont\textsl\slshape{10}{\mainmagstep} +\setfont\textsf\sfshape{10}{\mainmagstep} +\setfont\textsc\scshape{10}{\mainmagstep} +\setfont\textttsl\ttslshape{10}{\mainmagstep} +\font\texti=cmmi10 scaled \mainmagstep +\font\textsy=cmsy10 scaled \mainmagstep + +% A few fonts for @defun names and args. +\setfont\defbf\bfshape{10}{\magstep1} +\setfont\deftt\ttshape{10}{\magstep1} +\setfont\defttsl\ttslshape{10}{\magstep1} +\def\df{\let\tentt=\deftt \let\tenbf = \defbf \let\tenttsl=\defttsl \bf} + +% Fonts for indices, footnotes, small examples (9pt). +\def\smallnominalsize{9pt} +\setfont\smallrm\rmshape{9}{1000} +\setfont\smalltt\ttshape{9}{1000} +\setfont\smallbf\bfshape{10}{900} +\setfont\smallit\itshape{9}{1000} +\setfont\smallsl\slshape{9}{1000} +\setfont\smallsf\sfshape{9}{1000} +\setfont\smallsc\scshape{10}{900} +\setfont\smallttsl\ttslshape{10}{900} +\font\smalli=cmmi9 +\font\smallsy=cmsy9 + +% Fonts for small examples (8pt). +\def\smallernominalsize{8pt} +\setfont\smallerrm\rmshape{8}{1000} +\setfont\smallertt\ttshape{8}{1000} +\setfont\smallerbf\bfshape{10}{800} +\setfont\smallerit\itshape{8}{1000} +\setfont\smallersl\slshape{8}{1000} +\setfont\smallersf\sfshape{8}{1000} +\setfont\smallersc\scshape{10}{800} +\setfont\smallerttsl\ttslshape{10}{800} +\font\smalleri=cmmi8 +\font\smallersy=cmsy8 + +% Fonts for title page (20.4pt): +\def\titlenominalsize{20pt} +\setfont\titlerm\rmbshape{12}{\magstep3} +\setfont\titleit\itbshape{10}{\magstep4} +\setfont\titlesl\slbshape{10}{\magstep4} +\setfont\titlett\ttbshape{12}{\magstep3} +\setfont\titlettsl\ttslshape{10}{\magstep4} +\setfont\titlesf\sfbshape{17}{\magstep1} +\let\titlebf=\titlerm +\setfont\titlesc\scbshape{10}{\magstep4} +\font\titlei=cmmi12 scaled \magstep3 +\font\titlesy=cmsy10 scaled \magstep4 +\def\authorrm{\secrm} +\def\authortt{\sectt} + +% Chapter (and unnumbered) fonts (17.28pt). +\def\chapnominalsize{17pt} +\setfont\chaprm\rmbshape{12}{\magstep2} +\setfont\chapit\itbshape{10}{\magstep3} +\setfont\chapsl\slbshape{10}{\magstep3} +\setfont\chaptt\ttbshape{12}{\magstep2} +\setfont\chapttsl\ttslshape{10}{\magstep3} +\setfont\chapsf\sfbshape{17}{1000} +\let\chapbf=\chaprm +\setfont\chapsc\scbshape{10}{\magstep3} +\font\chapi=cmmi12 scaled \magstep2 +\font\chapsy=cmsy10 scaled \magstep3 + +% Section fonts (14.4pt). +\def\secnominalsize{14pt} +\setfont\secrm\rmbshape{12}{\magstep1} +\setfont\secit\itbshape{10}{\magstep2} +\setfont\secsl\slbshape{10}{\magstep2} +\setfont\sectt\ttbshape{12}{\magstep1} +\setfont\secttsl\ttslshape{10}{\magstep2} +\setfont\secsf\sfbshape{12}{\magstep1} +\let\secbf\secrm +\setfont\secsc\scbshape{10}{\magstep2} +\font\seci=cmmi12 scaled \magstep1 +\font\secsy=cmsy10 scaled \magstep2 + +% Subsection fonts (13.15pt). +\def\ssecnominalsize{13pt} +\setfont\ssecrm\rmbshape{12}{\magstephalf} +\setfont\ssecit\itbshape{10}{1315} +\setfont\ssecsl\slbshape{10}{1315} +\setfont\ssectt\ttbshape{12}{\magstephalf} +\setfont\ssecttsl\ttslshape{10}{1315} +\setfont\ssecsf\sfbshape{12}{\magstephalf} +\let\ssecbf\ssecrm +\setfont\ssecsc\scbshape{10}{1315} +\font\sseci=cmmi12 scaled \magstephalf +\font\ssecsy=cmsy10 scaled 1315 + +% Reduced fonts for @acro in text (10pt). +\def\reducednominalsize{10pt} +\setfont\reducedrm\rmshape{10}{1000} +\setfont\reducedtt\ttshape{10}{1000} +\setfont\reducedbf\bfshape{10}{1000} +\setfont\reducedit\itshape{10}{1000} +\setfont\reducedsl\slshape{10}{1000} +\setfont\reducedsf\sfshape{10}{1000} +\setfont\reducedsc\scshape{10}{1000} +\setfont\reducedttsl\ttslshape{10}{1000} +\font\reducedi=cmmi10 +\font\reducedsy=cmsy10 + +% In order for the font changes to affect most math symbols and letters, +% we have to define the \textfont of the standard families. Since +% texinfo doesn't allow for producing subscripts and superscripts except +% in the main text, we don't bother to reset \scriptfont and +% \scriptscriptfont (which would also require loading a lot more fonts). +% +\def\resetmathfonts{% + \textfont0=\tenrm \textfont1=\teni \textfont2=\tensy + \textfont\itfam=\tenit \textfont\slfam=\tensl \textfont\bffam=\tenbf + \textfont\ttfam=\tentt \textfont\sffam=\tensf +} + +% The font-changing commands redefine the meanings of \tenSTYLE, instead +% of just \STYLE. We do this because \STYLE needs to also set the +% current \fam for math mode. Our \STYLE (e.g., \rm) commands hardwire +% \tenSTYLE to set the current font. +% +% Each font-changing command also sets the names \lsize (one size lower) +% and \lllsize (three sizes lower). These relative commands are used in +% the LaTeX logo and acronyms. +% +% This all needs generalizing, badly. +% +\def\textfonts{% + \let\tenrm=\textrm \let\tenit=\textit \let\tensl=\textsl + \let\tenbf=\textbf \let\tentt=\texttt \let\smallcaps=\textsc + \let\tensf=\textsf \let\teni=\texti \let\tensy=\textsy + \let\tenttsl=\textttsl + \def\curfontsize{text}% + \def\lsize{reduced}\def\lllsize{smaller}% + \resetmathfonts \setleading{\textleading}} +\def\titlefonts{% + \let\tenrm=\titlerm \let\tenit=\titleit \let\tensl=\titlesl + \let\tenbf=\titlebf \let\tentt=\titlett \let\smallcaps=\titlesc + \let\tensf=\titlesf \let\teni=\titlei \let\tensy=\titlesy + \let\tenttsl=\titlettsl + \def\curfontsize{title}% + \def\lsize{chap}\def\lllsize{subsec}% + \resetmathfonts \setleading{25pt}} +\def\titlefont#1{{\titlefonts\rm #1}} +\def\chapfonts{% + \let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl + \let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc + \let\tensf=\chapsf \let\teni=\chapi \let\tensy=\chapsy + \let\tenttsl=\chapttsl + \def\curfontsize{chap}% + \def\lsize{sec}\def\lllsize{text}% + \resetmathfonts \setleading{19pt}} +\def\secfonts{% + \let\tenrm=\secrm \let\tenit=\secit \let\tensl=\secsl + \let\tenbf=\secbf \let\tentt=\sectt \let\smallcaps=\secsc + \let\tensf=\secsf \let\teni=\seci \let\tensy=\secsy + \let\tenttsl=\secttsl + \def\curfontsize{sec}% + \def\lsize{subsec}\def\lllsize{reduced}% + \resetmathfonts \setleading{16pt}} +\def\subsecfonts{% + \let\tenrm=\ssecrm \let\tenit=\ssecit \let\tensl=\ssecsl + \let\tenbf=\ssecbf \let\tentt=\ssectt \let\smallcaps=\ssecsc + \let\tensf=\ssecsf \let\teni=\sseci \let\tensy=\ssecsy + \let\tenttsl=\ssecttsl + \def\curfontsize{ssec}% + \def\lsize{text}\def\lllsize{small}% + \resetmathfonts \setleading{15pt}} +\let\subsubsecfonts = \subsecfonts +\def\reducedfonts{% + \let\tenrm=\reducedrm \let\tenit=\reducedit \let\tensl=\reducedsl + \let\tenbf=\reducedbf \let\tentt=\reducedtt \let\reducedcaps=\reducedsc + \let\tensf=\reducedsf \let\teni=\reducedi \let\tensy=\reducedsy + \let\tenttsl=\reducedttsl + \def\curfontsize{reduced}% + \def\lsize{small}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallfonts{% + \let\tenrm=\smallrm \let\tenit=\smallit \let\tensl=\smallsl + \let\tenbf=\smallbf \let\tentt=\smalltt \let\smallcaps=\smallsc + \let\tensf=\smallsf \let\teni=\smalli \let\tensy=\smallsy + \let\tenttsl=\smallttsl + \def\curfontsize{small}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{10.5pt}} +\def\smallerfonts{% + \let\tenrm=\smallerrm \let\tenit=\smallerit \let\tensl=\smallersl + \let\tenbf=\smallerbf \let\tentt=\smallertt \let\smallcaps=\smallersc + \let\tensf=\smallersf \let\teni=\smalleri \let\tensy=\smallersy + \let\tenttsl=\smallerttsl + \def\curfontsize{smaller}% + \def\lsize{smaller}\def\lllsize{smaller}% + \resetmathfonts \setleading{9.5pt}} + +% Set the fonts to use with the @small... environments. +\let\smallexamplefonts = \smallfonts + +% About \smallexamplefonts. If we use \smallfonts (9pt), @smallexample +% can fit this many characters: +% 8.5x11=86 smallbook=72 a4=90 a5=69 +% If we use \scriptfonts (8pt), then we can fit this many characters: +% 8.5x11=90+ smallbook=80 a4=90+ a5=77 +% For me, subjectively, the few extra characters that fit aren't worth +% the additional smallness of 8pt. So I'm making the default 9pt. +% +% By the way, for comparison, here's what fits with @example (10pt): +% 8.5x11=71 smallbook=60 a4=75 a5=58 +% +% I wish the USA used A4 paper. +% --karl, 24jan03. + + +% Set up the default fonts, so we can use them for creating boxes. +% +\textfonts \rm + +% Define these so they can be easily changed for other fonts. +\def\angleleft{$\langle$} +\def\angleright{$\rangle$} + +% Count depth in font-changes, for error checks +\newcount\fontdepth \fontdepth=0 + +% Fonts for short table of contents. +\setfont\shortcontrm\rmshape{12}{1000} +\setfont\shortcontbf\bfshape{10}{\magstep1} % no cmb12 +\setfont\shortcontsl\slshape{12}{1000} +\setfont\shortconttt\ttshape{12}{1000} + +%% Add scribe-like font environments, plus @l for inline lisp (usually sans +%% serif) and @ii for TeX italic + +% \smartitalic{ARG} outputs arg in italics, followed by an italic correction +% unless the following character is such as not to need one. +\def\smartitalicx{\ifx\next,\else\ifx\next-\else\ifx\next.\else + \ptexslash\fi\fi\fi} +\def\smartslanted#1{{\ifusingtt\ttsl\sl #1}\futurelet\next\smartitalicx} +\def\smartitalic#1{{\ifusingtt\ttsl\it #1}\futurelet\next\smartitalicx} + +% like \smartslanted except unconditionally uses \ttsl. +% @var is set to this for defun arguments. +\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx} + +% like \smartslanted except unconditionally use \sl. We never want +% ttsl for book titles, do we? +\def\cite#1{{\sl #1}\futurelet\next\smartitalicx} + +\let\i=\smartitalic +\let\slanted=\smartslanted +\let\var=\smartslanted +\let\dfn=\smartslanted +\let\emph=\smartitalic + +% @b, explicit bold. +\def\b#1{{\bf #1}} +\let\strong=\b + +% @sansserif, explicit sans. +\def\sansserif#1{{\sf #1}} + +% We can't just use \exhyphenpenalty, because that only has effect at +% the end of a paragraph. Restore normal hyphenation at the end of the +% group within which \nohyphenation is presumably called. +% +\def\nohyphenation{\hyphenchar\font = -1 \aftergroup\restorehyphenation} +\def\restorehyphenation{\hyphenchar\font = `- } + +% Set sfcode to normal for the chars that usually have another value. +% Can't use plain's \frenchspacing because it uses the `\x notation, and +% sometimes \x has an active definition that messes things up. +% +\catcode`@=11 + \def\plainfrenchspacing{% + \sfcode\dotChar =\@m \sfcode\questChar=\@m \sfcode\exclamChar=\@m + \sfcode\colonChar=\@m \sfcode\semiChar =\@m \sfcode\commaChar =\@m + \def\endofsentencespacefactor{1000}% for @. and friends + } + \def\plainnonfrenchspacing{% + \sfcode`\.3000\sfcode`\?3000\sfcode`\!3000 + \sfcode`\:2000\sfcode`\;1500\sfcode`\,1250 + \def\endofsentencespacefactor{3000}% for @. and friends + } +\catcode`@=\other +\def\endofsentencespacefactor{3000}% default + +\def\t#1{% + {\tt \rawbackslash \plainfrenchspacing #1}% + \null +} +\def\samp#1{`\tclose{#1}'\null} +\setfont\keyrm\rmshape{8}{1000} +\font\keysy=cmsy9 +\def\key#1{{\keyrm\textfont2=\keysy \leavevmode\hbox{% + \raise0.4pt\hbox{\angleleft}\kern-.08em\vtop{% + \vbox{\hrule\kern-0.4pt + \hbox{\raise0.4pt\hbox{\vphantom{\angleleft}}#1}}% + \kern-0.4pt\hrule}% + \kern-.06em\raise0.4pt\hbox{\angleright}}}} +% The old definition, with no lozenge: +%\def\key #1{{\ttsl \nohyphenation \uppercase{#1}}\null} +\def\ctrl #1{{\tt \rawbackslash \hat}#1} + +% @file, @option are the same as @samp. +\let\file=\samp +\let\option=\samp + +% @code is a modification of @t, +% which makes spaces the same size as normal in the surrounding text. +\def\tclose#1{% + {% + % Change normal interword space to be same as for the current font. + \spaceskip = \fontdimen2\font + % + % Switch to typewriter. + \tt + % + % But `\ ' produces the large typewriter interword space. + \def\ {{\spaceskip = 0pt{} }}% + % + % Turn off hyphenation. + \nohyphenation + % + \rawbackslash + \plainfrenchspacing + #1% + }% + \null +} + +% We *must* turn on hyphenation at `-' and `_' in @code. +% Otherwise, it is too hard to avoid overfull hboxes +% in the Emacs manual, the Library manual, etc. + +% Unfortunately, TeX uses one parameter (\hyphenchar) to control +% both hyphenation at - and hyphenation within words. +% We must therefore turn them both off (\tclose does that) +% and arrange explicitly to hyphenate at a dash. +% -- rms. +{ + \catcode`\-=\active + \catcode`\_=\active + % + \global\def\code{\begingroup + \catcode`\-=\active \catcode`\_=\active + \ifallowcodebreaks + \let-\codedash + \let_\codeunder + \else + \let-\realdash + \let_\realunder + \fi + \codex + } +} + +\def\realdash{-} +\def\codedash{-\discretionary{}{}{}} +\def\codeunder{% + % this is all so @math{@code{var_name}+1} can work. In math mode, _ + % is "active" (mathcode"8000) and \normalunderscore (or \char95, etc.) + % will therefore expand the active definition of _, which is us + % (inside @code that is), therefore an endless loop. + \ifusingtt{\ifmmode + \mathchar"075F % class 0=ordinary, family 7=ttfam, pos 0x5F=_. + \else\normalunderscore \fi + \discretionary{}{}{}}% + {\_}% +} +\def\codex #1{\tclose{#1}\endgroup} + +% An additional complication: the above will allow breaks after, e.g., +% each of the four underscores in __typeof__. This is undesirable in +% some manuals, especially if they don't have long identifiers in +% general. @allowcodebreaks provides a way to control this. +% +\newif\ifallowcodebreaks \allowcodebreakstrue + +\def\keywordtrue{true} +\def\keywordfalse{false} + +\parseargdef\allowcodebreaks{% + \def\txiarg{#1}% + \ifx\txiarg\keywordtrue + \allowcodebreakstrue + \else\ifx\txiarg\keywordfalse + \allowcodebreaksfalse + \else + \errhelp = \EMsimple + \errmessage{Unknown @allowcodebreaks option `\txiarg'}% + \fi\fi +} + +% @kbd is like @code, except that if the argument is just one @key command, +% then @kbd has no effect. + +% @kbdinputstyle -- arg is `distinct' (@kbd uses slanted tty font always), +% `example' (@kbd uses ttsl only inside of @example and friends), +% or `code' (@kbd uses normal tty font always). +\parseargdef\kbdinputstyle{% + \def\txiarg{#1}% + \ifx\txiarg\worddistinct + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\ttsl}% + \else\ifx\txiarg\wordexample + \gdef\kbdexamplefont{\ttsl}\gdef\kbdfont{\tt}% + \else\ifx\txiarg\wordcode + \gdef\kbdexamplefont{\tt}\gdef\kbdfont{\tt}% + \else + \errhelp = \EMsimple + \errmessage{Unknown @kbdinputstyle option `\txiarg'}% + \fi\fi\fi +} +\def\worddistinct{distinct} +\def\wordexample{example} +\def\wordcode{code} + +% Default is `distinct.' +\kbdinputstyle distinct + +\def\xkey{\key} +\def\kbdfoo#1#2#3\par{\def\one{#1}\def\three{#3}\def\threex{??}% +\ifx\one\xkey\ifx\threex\three \key{#2}% +\else{\tclose{\kbdfont\look}}\fi +\else{\tclose{\kbdfont\look}}\fi} + +% For @indicateurl, @env, @command quotes seem unnecessary, so use \code. +\let\indicateurl=\code +\let\env=\code +\let\command=\code + +% @uref (abbreviation for `urlref') takes an optional (comma-separated) +% second argument specifying the text to display and an optional third +% arg as text to display instead of (rather than in addition to) the url +% itself. First (mandatory) arg is the url. Perhaps eventually put in +% a hypertex \special here. +% +\def\uref#1{\douref #1,,,\finish} +\def\douref#1,#2,#3,#4\finish{\begingroup + \unsepspaces + \pdfurl{#1}% + \setbox0 = \hbox{\ignorespaces #3}% + \ifdim\wd0 > 0pt + \unhbox0 % third arg given, show only that + \else + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0 > 0pt + \ifpdf + \unhbox0 % PDF: 2nd arg given, show only it + \else + \unhbox0\ (\code{#1})% DVI: 2nd arg given, show both it and url + \fi + \else + \code{#1}% only url given, so show it + \fi + \fi + \endlink +\endgroup} + +% @url synonym for @uref, since that's how everyone uses it. +% +\let\url=\uref + +% rms does not like angle brackets --karl, 17may97. +% So now @email is just like @uref, unless we are pdf. +% +%\def\email#1{\angleleft{\tt #1}\angleright} +\ifpdf + \def\email#1{\doemail#1,,\finish} + \def\doemail#1,#2,#3\finish{\begingroup + \unsepspaces + \pdfurl{mailto:#1}% + \setbox0 = \hbox{\ignorespaces #2}% + \ifdim\wd0>0pt\unhbox0\else\code{#1}\fi + \endlink + \endgroup} +\else + \let\email=\uref +\fi + +% Check if we are currently using a typewriter font. Since all the +% Computer Modern typewriter fonts have zero interword stretch (and +% shrink), and it is reasonable to expect all typewriter fonts to have +% this property, we can check that font parameter. +% +\def\ifmonospace{\ifdim\fontdimen3\font=0pt } + +% Typeset a dimension, e.g., `in' or `pt'. The only reason for the +% argument is to make the input look right: @dmn{pt} instead of @dmn{}pt. +% +\def\dmn#1{\thinspace #1} + +\def\kbd#1{\def\look{#1}\expandafter\kbdfoo\look??\par} + +% @l was never documented to mean ``switch to the Lisp font'', +% and it is not used as such in any manual I can find. We need it for +% Polish suppressed-l. --karl, 22sep96. +%\def\l#1{{\li #1}\null} + +% Explicit font changes: @r, @sc, undocumented @ii. +\def\r#1{{\rm #1}} % roman font +\def\sc#1{{\smallcaps#1}} % smallcaps font +\def\ii#1{{\it #1}} % italic font + +% @acronym for "FBI", "NATO", and the like. +% We print this one point size smaller, since it's intended for +% all-uppercase. +% +\def\acronym#1{\doacronym #1,,\finish} +\def\doacronym#1,#2,#3\finish{% + {\selectfonts\lsize #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + +% @abbr for "Comput. J." and the like. +% No font change, but don't do end-of-sentence spacing. +% +\def\abbr#1{\doabbr #1,,\finish} +\def\doabbr#1,#2,#3\finish{% + {\plainfrenchspacing #1}% + \def\temp{#2}% + \ifx\temp\empty \else + \space ({\unsepspaces \ignorespaces \temp \unskip})% + \fi +} + +% @pounds{} is a sterling sign, which Knuth put in the CM italic font. +% +\def\pounds{{\it\$}} + +% @euro{} comes from a separate font, depending on the current style. +% We use the free feym* fonts from the eurosym package by Henrik +% Theiling, which support regular, slanted, bold and bold slanted (and +% "outlined" (blackboard board, sort of) versions, which we don't need). +% It is available from http://www.ctan.org/tex-archive/fonts/eurosym. +% +% Although only regular is the truly official Euro symbol, we ignore +% that. The Euro is designed to be slightly taller than the regular +% font height. +% +% feymr - regular +% feymo - slanted +% feybr - bold +% feybo - bold slanted +% +% There is no good (free) typewriter version, to my knowledge. +% A feymr10 euro is ~7.3pt wide, while a normal cmtt10 char is ~5.25pt wide. +% Hmm. +% +% Also doesn't work in math. Do we need to do math with euro symbols? +% Hope not. +% +% +\def\euro{{\eurofont e}} +\def\eurofont{% + % We set the font at each command, rather than predefining it in + % \textfonts and the other font-switching commands, so that + % installations which never need the symbol don't have to have the + % font installed. + % + % There is only one designed size (nominal 10pt), so we always scale + % that to the current nominal size. + % + % By the way, simply using "at 1em" works for cmr10 and the like, but + % does not work for cmbx10 and other extended/shrunken fonts. + % + \def\eurosize{\csname\curfontsize nominalsize\endcsname}% + % + \ifx\curfontstyle\bfstylename + % bold: + \font\thiseurofont = \ifusingit{feybo10}{feybr10} at \eurosize + \else + % regular: + \font\thiseurofont = \ifusingit{feymo10}{feymr10} at \eurosize + \fi + \thiseurofont +} + +% @registeredsymbol - R in a circle. The font for the R should really +% be smaller yet, but lllsize is the best we can do for now. +% Adapted from the plain.tex definition of \copyright. +% +\def\registeredsymbol{% + $^{{\ooalign{\hfil\raise.07ex\hbox{\selectfonts\lllsize R}% + \hfil\crcr\Orb}}% + }$% +} + +% Laurent Siebenmann reports \Orb undefined with: +% Textures 1.7.7 (preloaded format=plain 93.10.14) (68K) 16 APR 2004 02:38 +% so we'll define it if necessary. +% +\ifx\Orb\undefined +\def\Orb{\mathhexbox20D} +\fi + + +\message{page headings,} + +\newskip\titlepagetopglue \titlepagetopglue = 1.5in +\newskip\titlepagebottomglue \titlepagebottomglue = 2pc + +% First the title page. Must do @settitle before @titlepage. +\newif\ifseenauthor +\newif\iffinishedtitlepage + +% Do an implicit @contents or @shortcontents after @end titlepage if the +% user says @setcontentsaftertitlepage or @setshortcontentsaftertitlepage. +% +\newif\ifsetcontentsaftertitlepage + \let\setcontentsaftertitlepage = \setcontentsaftertitlepagetrue +\newif\ifsetshortcontentsaftertitlepage + \let\setshortcontentsaftertitlepage = \setshortcontentsaftertitlepagetrue + +\parseargdef\shorttitlepage{\begingroup\hbox{}\vskip 1.5in \chaprm \centerline{#1}% + \endgroup\page\hbox{}\page} + +\envdef\titlepage{% + % Open one extra group, as we want to close it in the middle of \Etitlepage. + \begingroup + \parindent=0pt \textfonts + % Leave some space at the very top of the page. + \vglue\titlepagetopglue + % No rule at page bottom unless we print one at the top with @title. + \finishedtitlepagetrue + % + % Most title ``pages'' are actually two pages long, with space + % at the top of the second. We don't want the ragged left on the second. + \let\oldpage = \page + \def\page{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + \let\page = \oldpage + \page + \null + }% +} + +\def\Etitlepage{% + \iffinishedtitlepage\else + \finishtitlepage + \fi + % It is important to do the page break before ending the group, + % because the headline and footline are only empty inside the group. + % If we use the new definition of \page, we always get a blank page + % after the title page, which we certainly don't want. + \oldpage + \endgroup + % + % Need this before the \...aftertitlepage checks so that if they are + % in effect the toc pages will come out with page numbers. + \HEADINGSon + % + % If they want short, they certainly want long too. + \ifsetshortcontentsaftertitlepage + \shortcontents + \contents + \global\let\shortcontents = \relax + \global\let\contents = \relax + \fi + % + \ifsetcontentsaftertitlepage + \contents + \global\let\contents = \relax + \global\let\shortcontents = \relax + \fi +} + +\def\finishtitlepage{% + \vskip4pt \hrule height 2pt width \hsize + \vskip\titlepagebottomglue + \finishedtitlepagetrue +} + +%%% Macros to be used within @titlepage: + +\let\subtitlerm=\tenrm +\def\subtitlefont{\subtitlerm \normalbaselineskip = 13pt \normalbaselines} + +\def\authorfont{\authorrm \normalbaselineskip = 16pt \normalbaselines + \let\tt=\authortt} + +\parseargdef\title{% + \checkenv\titlepage + \leftline{\titlefonts\rm #1} + % print a rule at the page bottom also. + \finishedtitlepagefalse + \vskip4pt \hrule height 4pt width \hsize \vskip4pt +} + +\parseargdef\subtitle{% + \checkenv\titlepage + {\subtitlefont \rightline{#1}}% +} + +% @author should come last, but may come many times. +% It can also be used inside @quotation. +% +\parseargdef\author{% + \def\temp{\quotation}% + \ifx\thisenv\temp + \def\quotationauthor{#1}% printed in \Equotation. + \else + \checkenv\titlepage + \ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi + {\authorfont \leftline{#1}}% + \fi +} + + +%%% Set up page headings and footings. + +\let\thispage=\folio + +\newtoks\evenheadline % headline on even pages +\newtoks\oddheadline % headline on odd pages +\newtoks\evenfootline % footline on even pages +\newtoks\oddfootline % footline on odd pages + +% Now make TeX use those variables +\headline={{\textfonts\rm \ifodd\pageno \the\oddheadline + \else \the\evenheadline \fi}} +\footline={{\textfonts\rm \ifodd\pageno \the\oddfootline + \else \the\evenfootline \fi}\HEADINGShook} +\let\HEADINGShook=\relax + +% Commands to set those variables. +% For example, this is what @headings on does +% @evenheading @thistitle|@thispage|@thischapter +% @oddheading @thischapter|@thispage|@thistitle +% @evenfooting @thisfile|| +% @oddfooting ||@thisfile + + +\def\evenheading{\parsearg\evenheadingxxx} +\def\evenheadingxxx #1{\evenheadingyyy #1\|\|\|\|\finish} +\def\evenheadingyyy #1\|#2\|#3\|#4\finish{% +\global\evenheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddheading{\parsearg\oddheadingxxx} +\def\oddheadingxxx #1{\oddheadingyyy #1\|\|\|\|\finish} +\def\oddheadingyyy #1\|#2\|#3\|#4\finish{% +\global\oddheadline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\parseargdef\everyheading{\oddheadingxxx{#1}\evenheadingxxx{#1}}% + +\def\evenfooting{\parsearg\evenfootingxxx} +\def\evenfootingxxx #1{\evenfootingyyy #1\|\|\|\|\finish} +\def\evenfootingyyy #1\|#2\|#3\|#4\finish{% +\global\evenfootline={\rlap{\centerline{#2}}\line{#1\hfil#3}}} + +\def\oddfooting{\parsearg\oddfootingxxx} +\def\oddfootingxxx #1{\oddfootingyyy #1\|\|\|\|\finish} +\def\oddfootingyyy #1\|#2\|#3\|#4\finish{% + \global\oddfootline = {\rlap{\centerline{#2}}\line{#1\hfil#3}}% + % + % Leave some space for the footline. Hopefully ok to assume + % @evenfooting will not be used by itself. + \global\advance\pageheight by -\baselineskip + \global\advance\vsize by -\baselineskip +} + +\parseargdef\everyfooting{\oddfootingxxx{#1}\evenfootingxxx{#1}} + + +% @headings double turns headings on for double-sided printing. +% @headings single turns headings on for single-sided printing. +% @headings off turns them off. +% @headings on same as @headings double, retained for compatibility. +% @headings after turns on double-sided headings after this page. +% @headings doubleafter turns on double-sided headings after this page. +% @headings singleafter turns on single-sided headings after this page. +% By default, they are off at the start of a document, +% and turned `on' after @end titlepage. + +\def\headings #1 {\csname HEADINGS#1\endcsname} + +\def\HEADINGSoff{% +\global\evenheadline={\hfil} \global\evenfootline={\hfil} +\global\oddheadline={\hfil} \global\oddfootline={\hfil}} +\HEADINGSoff +% When we turn headings on, set the page number to 1. +% For double-sided printing, put current file name in lower left corner, +% chapter name on inside top of right hand pages, document +% title on inside top of left hand pages, and page numbers on outside top +% edge of all pages. +\def\HEADINGSdouble{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} +\let\contentsalignmacro = \chappager + +% For single-sided printing, chapter title goes across top left of page, +% page number on top right. +\def\HEADINGSsingle{% +\global\pageno=1 +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} +\def\HEADINGSon{\HEADINGSdouble} + +\def\HEADINGSafter{\let\HEADINGShook=\HEADINGSdoublex} +\let\HEADINGSdoubleafter=\HEADINGSafter +\def\HEADINGSdoublex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\folio\hfil\thistitle}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chapoddpage +} + +\def\HEADINGSsingleafter{\let\HEADINGShook=\HEADINGSsinglex} +\def\HEADINGSsinglex{% +\global\evenfootline={\hfil} +\global\oddfootline={\hfil} +\global\evenheadline={\line{\thischapter\hfil\folio}} +\global\oddheadline={\line{\thischapter\hfil\folio}} +\global\let\contentsalignmacro = \chappager +} + +% Subroutines used in generating headings +% This produces Day Month Year style of output. +% Only define if not already defined, in case a txi-??.tex file has set +% up a different format (e.g., txi-cs.tex does this). +\ifx\today\undefined +\def\today{% + \number\day\space + \ifcase\month + \or\putwordMJan\or\putwordMFeb\or\putwordMMar\or\putwordMApr + \or\putwordMMay\or\putwordMJun\or\putwordMJul\or\putwordMAug + \or\putwordMSep\or\putwordMOct\or\putwordMNov\or\putwordMDec + \fi + \space\number\year} +\fi + +% @settitle line... specifies the title of the document, for headings. +% It generates no output of its own. +\def\thistitle{\putwordNoTitle} +\def\settitle{\parsearg{\gdef\thistitle}} + + +\message{tables,} +% Tables -- @table, @ftable, @vtable, @item(x). + +% default indentation of table text +\newdimen\tableindent \tableindent=.8in +% default indentation of @itemize and @enumerate text +\newdimen\itemindent \itemindent=.3in +% margin between end of table item and start of table text. +\newdimen\itemmargin \itemmargin=.1in + +% used internally for \itemindent minus \itemmargin +\newdimen\itemmax + +% Note @table, @ftable, and @vtable define @item, @itemx, etc., with +% these defs. +% They also define \itemindex +% to index the item name in whatever manner is desired (perhaps none). + +\newif\ifitemxneedsnegativevskip + +\def\itemxpar{\par\ifitemxneedsnegativevskip\nobreak\vskip-\parskip\nobreak\fi} + +\def\internalBitem{\smallbreak \parsearg\itemzzz} +\def\internalBitemx{\itemxpar \parsearg\itemzzz} + +\def\itemzzz #1{\begingroup % + \advance\hsize by -\rightskip + \advance\hsize by -\tableindent + \setbox0=\hbox{\itemindicate{#1}}% + \itemindex{#1}% + \nobreak % This prevents a break before @itemx. + % + % If the item text does not fit in the space we have, put it on a line + % by itself, and do not allow a page break either before or after that + % line. We do not start a paragraph here because then if the next + % command is, e.g., @kindex, the whatsit would get put into the + % horizontal list on a line by itself, resulting in extra blank space. + \ifdim \wd0>\itemmax + % + % Make this a paragraph so we get the \parskip glue and wrapping, + % but leave it ragged-right. + \begingroup + \advance\leftskip by-\tableindent + \advance\hsize by\tableindent + \advance\rightskip by0pt plus1fil + \leavevmode\unhbox0\par + \endgroup + % + % We're going to be starting a paragraph, but we don't want the + % \parskip glue -- logically it's part of the @item we just started. + \nobreak \vskip-\parskip + % + % Stop a page break at the \parskip glue coming up. However, if + % what follows is an environment such as @example, there will be no + % \parskip glue; then the negative vskip we just inserted would + % cause the example and the item to crash together. So we use this + % bizarre value of 10001 as a signal to \aboveenvbreak to insert + % \parskip glue after all. Section titles are handled this way also. + % + \penalty 10001 + \endgroup + \itemxneedsnegativevskipfalse + \else + % The item text fits into the space. Start a paragraph, so that the + % following text (if any) will end up on the same line. + \noindent + % Do this with kerns and \unhbox so that if there is a footnote in + % the item text, it can migrate to the main vertical list and + % eventually be printed. + \nobreak\kern-\tableindent + \dimen0 = \itemmax \advance\dimen0 by \itemmargin \advance\dimen0 by -\wd0 + \unhbox0 + \nobreak\kern\dimen0 + \endgroup + \itemxneedsnegativevskiptrue + \fi +} + +\def\item{\errmessage{@item while not in a list environment}} +\def\itemx{\errmessage{@itemx while not in a list environment}} + +% @table, @ftable, @vtable. +\envdef\table{% + \let\itemindex\gobble + \tablecheck{table}% +} +\envdef\ftable{% + \def\itemindex ##1{\doind {fn}{\code{##1}}}% + \tablecheck{ftable}% +} +\envdef\vtable{% + \def\itemindex ##1{\doind {vr}{\code{##1}}}% + \tablecheck{vtable}% +} +\def\tablecheck#1{% + \ifnum \the\catcode`\^^M=\active + \endgroup + \errmessage{This command won't work in this context; perhaps the problem is + that we are \inenvironment\thisenv}% + \def\next{\doignore{#1}}% + \else + \let\next\tablex + \fi + \next +} +\def\tablex#1{% + \def\itemindicate{#1}% + \parsearg\tabley +} +\def\tabley#1{% + {% + \makevalueexpandable + \edef\temp{\noexpand\tablez #1\space\space\space}% + \expandafter + }\temp \endtablez +} +\def\tablez #1 #2 #3 #4\endtablez{% + \aboveenvbreak + \ifnum 0#1>0 \advance \leftskip by #1\mil \fi + \ifnum 0#2>0 \tableindent=#2\mil \fi + \ifnum 0#3>0 \advance \rightskip by #3\mil \fi + \itemmax=\tableindent + \advance \itemmax by -\itemmargin + \advance \leftskip by \tableindent + \exdentamount=\tableindent + \parindent = 0pt + \parskip = \smallskipamount + \ifdim \parskip=0pt \parskip=2pt \fi + \let\item = \internalBitem + \let\itemx = \internalBitemx +} +\def\Etable{\endgraf\afterenvbreak} +\let\Eftable\Etable +\let\Evtable\Etable +\let\Eitemize\Etable +\let\Eenumerate\Etable + +% This is the counter used by @enumerate, which is really @itemize + +\newcount \itemno + +\envdef\itemize{\parsearg\doitemize} + +\def\doitemize#1{% + \aboveenvbreak + \itemmax=\itemindent + \advance\itemmax by -\itemmargin + \advance\leftskip by \itemindent + \exdentamount=\itemindent + \parindent=0pt + \parskip=\smallskipamount + \ifdim\parskip=0pt \parskip=2pt \fi + \def\itemcontents{#1}% + % @itemize with no arg is equivalent to @itemize @bullet. + \ifx\itemcontents\empty\def\itemcontents{\bullet}\fi + \let\item=\itemizeitem +} + +% Definition of @item while inside @itemize and @enumerate. +% +\def\itemizeitem{% + \advance\itemno by 1 % for enumerations + {\let\par=\endgraf \smallbreak}% reasonable place to break + {% + % If the document has an @itemize directly after a section title, a + % \nobreak will be last on the list, and \sectionheading will have + % done a \vskip-\parskip. In that case, we don't want to zero + % parskip, or the item text will crash with the heading. On the + % other hand, when there is normal text preceding the item (as there + % usually is), we do want to zero parskip, or there would be too much + % space. In that case, we won't have a \nobreak before. At least + % that's the theory. + \ifnum\lastpenalty<10000 \parskip=0in \fi + \noindent + \hbox to 0pt{\hss \itemcontents \kern\itemmargin}% + \vadjust{\penalty 1200}}% not good to break after first line of item. + \flushcr +} + +% \splitoff TOKENS\endmark defines \first to be the first token in +% TOKENS, and \rest to be the remainder. +% +\def\splitoff#1#2\endmark{\def\first{#1}\def\rest{#2}}% + +% Allow an optional argument of an uppercase letter, lowercase letter, +% or number, to specify the first label in the enumerated list. No +% argument is the same as `1'. +% +\envparseargdef\enumerate{\enumeratey #1 \endenumeratey} +\def\enumeratey #1 #2\endenumeratey{% + % If we were given no argument, pretend we were given `1'. + \def\thearg{#1}% + \ifx\thearg\empty \def\thearg{1}\fi + % + % Detect if the argument is a single token. If so, it might be a + % letter. Otherwise, the only valid thing it can be is a number. + % (We will always have one token, because of the test we just made. + % This is a good thing, since \splitoff doesn't work given nothing at + % all -- the first parameter is undelimited.) + \expandafter\splitoff\thearg\endmark + \ifx\rest\empty + % Only one token in the argument. It could still be anything. + % A ``lowercase letter'' is one whose \lccode is nonzero. + % An ``uppercase letter'' is one whose \lccode is both nonzero, and + % not equal to itself. + % Otherwise, we assume it's a number. + % + % We need the \relax at the end of the \ifnum lines to stop TeX from + % continuing to look for a . + % + \ifnum\lccode\expandafter`\thearg=0\relax + \numericenumerate % a number (we hope) + \else + % It's a letter. + \ifnum\lccode\expandafter`\thearg=\expandafter`\thearg\relax + \lowercaseenumerate % lowercase letter + \else + \uppercaseenumerate % uppercase letter + \fi + \fi + \else + % Multiple tokens in the argument. We hope it's a number. + \numericenumerate + \fi +} + +% An @enumerate whose labels are integers. The starting integer is +% given in \thearg. +% +\def\numericenumerate{% + \itemno = \thearg + \startenumeration{\the\itemno}% +} + +% The starting (lowercase) letter is in \thearg. +\def\lowercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more lowercase letters in @enumerate; get a bigger + alphabet}% + \fi + \char\lccode\itemno + }% +} + +% The starting (uppercase) letter is in \thearg. +\def\uppercaseenumerate{% + \itemno = \expandafter`\thearg + \startenumeration{% + % Be sure we're not beyond the end of the alphabet. + \ifnum\itemno=0 + \errmessage{No more uppercase letters in @enumerate; get a bigger + alphabet} + \fi + \char\uccode\itemno + }% +} + +% Call \doitemize, adding a period to the first argument and supplying the +% common last two arguments. Also subtract one from the initial value in +% \itemno, since @item increments \itemno. +% +\def\startenumeration#1{% + \advance\itemno by -1 + \doitemize{#1.}\flushcr +} + +% @alphaenumerate and @capsenumerate are abbreviations for giving an arg +% to @enumerate. +% +\def\alphaenumerate{\enumerate{a}} +\def\capsenumerate{\enumerate{A}} +\def\Ealphaenumerate{\Eenumerate} +\def\Ecapsenumerate{\Eenumerate} + + +% @multitable macros +% Amy Hendrickson, 8/18/94, 3/6/96 +% +% @multitable ... @end multitable will make as many columns as desired. +% Contents of each column will wrap at width given in preamble. Width +% can be specified either with sample text given in a template line, +% or in percent of \hsize, the current width of text on page. + +% Table can continue over pages but will only break between lines. + +% To make preamble: +% +% Either define widths of columns in terms of percent of \hsize: +% @multitable @columnfractions .25 .3 .45 +% @item ... +% +% Numbers following @columnfractions are the percent of the total +% current hsize to be used for each column. You may use as many +% columns as desired. + + +% Or use a template: +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item ... +% using the widest term desired in each column. + +% Each new table line starts with @item, each subsequent new column +% starts with @tab. Empty columns may be produced by supplying @tab's +% with nothing between them for as many times as empty columns are needed, +% ie, @tab@tab@tab will produce two empty columns. + +% @item, @tab do not need to be on their own lines, but it will not hurt +% if they are. + +% Sample multitable: + +% @multitable {Column 1 template} {Column 2 template} {Column 3 template} +% @item first col stuff @tab second col stuff @tab third col +% @item +% first col stuff +% @tab +% second col stuff +% @tab +% third col +% @item first col stuff @tab second col stuff +% @tab Many paragraphs of text may be used in any column. +% +% They will wrap at the width determined by the template. +% @item@tab@tab This will be in third column. +% @end multitable + +% Default dimensions may be reset by user. +% @multitableparskip is vertical space between paragraphs in table. +% @multitableparindent is paragraph indent in table. +% @multitablecolmargin is horizontal space to be left between columns. +% @multitablelinespace is space to leave between table items, baseline +% to baseline. +% 0pt means it depends on current normal line spacing. +% +\newskip\multitableparskip +\newskip\multitableparindent +\newdimen\multitablecolspace +\newskip\multitablelinespace +\multitableparskip=0pt +\multitableparindent=6pt +\multitablecolspace=12pt +\multitablelinespace=0pt + +% Macros used to set up halign preamble: +% +\let\endsetuptable\relax +\def\xendsetuptable{\endsetuptable} +\let\columnfractions\relax +\def\xcolumnfractions{\columnfractions} +\newif\ifsetpercent + +% #1 is the @columnfraction, usually a decimal number like .5, but might +% be just 1. We just use it, whatever it is. +% +\def\pickupwholefraction#1 {% + \global\advance\colcount by 1 + \expandafter\xdef\csname col\the\colcount\endcsname{#1\hsize}% + \setuptable +} + +\newcount\colcount +\def\setuptable#1{% + \def\firstarg{#1}% + \ifx\firstarg\xendsetuptable + \let\go = \relax + \else + \ifx\firstarg\xcolumnfractions + \global\setpercenttrue + \else + \ifsetpercent + \let\go\pickupwholefraction + \else + \global\advance\colcount by 1 + \setbox0=\hbox{#1\unskip\space}% Add a normal word space as a + % separator; typically that is always in the input, anyway. + \expandafter\xdef\csname col\the\colcount\endcsname{\the\wd0}% + \fi + \fi + \ifx\go\pickupwholefraction + % Put the argument back for the \pickupwholefraction call, so + % we'll always have a period there to be parsed. + \def\go{\pickupwholefraction#1}% + \else + \let\go = \setuptable + \fi% + \fi + \go +} + +% multitable-only commands. +% +% @headitem starts a heading row, which we typeset in bold. +% Assignments have to be global since we are inside the implicit group +% of an alignment entry. Note that \everycr resets \everytab. +\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}% +% +% A \tab used to include \hskip1sp. But then the space in a template +% line is not enough. That is bad. So let's go back to just `&' until +% we encounter the problem it was intended to solve again. +% --karl, nathan@acm.org, 20apr99. +\def\tab{\checkenv\multitable &\the\everytab}% + +% @multitable ... @end multitable definitions: +% +\newtoks\everytab % insert after every tab. +% +\envdef\multitable{% + \vskip\parskip + \startsavinginserts + % + % @item within a multitable starts a normal row. + % We use \def instead of \let so that if one of the multitable entries + % contains an @itemize, we don't choke on the \item (seen as \crcr aka + % \endtemplate) expanding \doitemize. + \def\item{\crcr}% + % + \tolerance=9500 + \hbadness=9500 + \setmultitablespacing + \parskip=\multitableparskip + \parindent=\multitableparindent + \overfullrule=0pt + \global\colcount=0 + % + \everycr = {% + \noalign{% + \global\everytab={}% + \global\colcount=0 % Reset the column counter. + % Check for saved footnotes, etc. + \checkinserts + % Keeps underfull box messages off when table breaks over pages. + %\filbreak + % Maybe so, but it also creates really weird page breaks when the + % table breaks over pages. Wouldn't \vfil be better? Wait until the + % problem manifests itself, so it can be fixed for real --karl. + }% + }% + % + \parsearg\domultitable +} +\def\domultitable#1{% + % To parse everything between @multitable and @item: + \setuptable#1 \endsetuptable + % + % This preamble sets up a generic column definition, which will + % be used as many times as user calls for columns. + % \vtop will set a single line and will also let text wrap and + % continue for many paragraphs if desired. + \halign\bgroup &% + \global\advance\colcount by 1 + \multistrut + \vtop{% + % Use the current \colcount to find the correct column width: + \hsize=\expandafter\csname col\the\colcount\endcsname + % + % In order to keep entries from bumping into each other + % we will add a \leftskip of \multitablecolspace to all columns after + % the first one. + % + % If a template has been used, we will add \multitablecolspace + % to the width of each template entry. + % + % If the user has set preamble in terms of percent of \hsize we will + % use that dimension as the width of the column, and the \leftskip + % will keep entries from bumping into each other. Table will start at + % left margin and final column will justify at right margin. + % + % Make sure we don't inherit \rightskip from the outer environment. + \rightskip=0pt + \ifnum\colcount=1 + % The first column will be indented with the surrounding text. + \advance\hsize by\leftskip + \else + \ifsetpercent \else + % If user has not set preamble in terms of percent of \hsize + % we will advance \hsize by \multitablecolspace. + \advance\hsize by \multitablecolspace + \fi + % In either case we will make \leftskip=\multitablecolspace: + \leftskip=\multitablecolspace + \fi + % Ignoring space at the beginning and end avoids an occasional spurious + % blank line, when TeX decides to break the line at the space before the + % box from the multistrut, so the strut ends up on a line by itself. + % For example: + % @multitable @columnfractions .11 .89 + % @item @code{#} + % @tab Legal holiday which is valid in major parts of the whole country. + % Is automatically provided with highlighting sequences respectively + % marking characters. + \noindent\ignorespaces##\unskip\multistrut + }\cr +} +\def\Emultitable{% + \crcr + \egroup % end the \halign + \global\setpercentfalse +} + +\def\setmultitablespacing{% + \def\multistrut{\strut}% just use the standard line spacing + % + % Compute \multitablelinespace (if not defined by user) for use in + % \multitableparskip calculation. We used define \multistrut based on + % this, but (ironically) that caused the spacing to be off. + % See bug-texinfo report from Werner Lemberg, 31 Oct 2004 12:52:20 +0100. +\ifdim\multitablelinespace=0pt +\setbox0=\vbox{X}\global\multitablelinespace=\the\baselineskip +\global\advance\multitablelinespace by-\ht0 +\fi +%% Test to see if parskip is larger than space between lines of +%% table. If not, do nothing. +%% If so, set to same dimension as multitablelinespace. +\ifdim\multitableparskip>\multitablelinespace +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi% +\ifdim\multitableparskip=0pt +\global\multitableparskip=\multitablelinespace +\global\advance\multitableparskip-7pt %% to keep parskip somewhat smaller + %% than skip between lines in the table. +\fi} + + +\message{conditionals,} + +% @iftex, @ifnotdocbook, @ifnothtml, @ifnotinfo, @ifnotplaintext, +% @ifnotxml always succeed. They currently do nothing; we don't +% attempt to check whether the conditionals are properly nested. But we +% have to remember that they are conditionals, so that @end doesn't +% attempt to close an environment group. +% +\def\makecond#1{% + \expandafter\let\csname #1\endcsname = \relax + \expandafter\let\csname iscond.#1\endcsname = 1 +} +\makecond{iftex} +\makecond{ifnotdocbook} +\makecond{ifnothtml} +\makecond{ifnotinfo} +\makecond{ifnotplaintext} +\makecond{ifnotxml} + +% Ignore @ignore, @ifhtml, @ifinfo, and the like. +% +\def\direntry{\doignore{direntry}} +\def\documentdescription{\doignore{documentdescription}} +\def\docbook{\doignore{docbook}} +\def\html{\doignore{html}} +\def\ifdocbook{\doignore{ifdocbook}} +\def\ifhtml{\doignore{ifhtml}} +\def\ifinfo{\doignore{ifinfo}} +\def\ifnottex{\doignore{ifnottex}} +\def\ifplaintext{\doignore{ifplaintext}} +\def\ifxml{\doignore{ifxml}} +\def\ignore{\doignore{ignore}} +\def\menu{\doignore{menu}} +\def\xml{\doignore{xml}} + +% Ignore text until a line `@end #1', keeping track of nested conditionals. +% +% A count to remember the depth of nesting. +\newcount\doignorecount + +\def\doignore#1{\begingroup + % Scan in ``verbatim'' mode: + \catcode`\@ = \other + \catcode`\{ = \other + \catcode`\} = \other + % + % Make sure that spaces turn into tokens that match what \doignoretext wants. + \spaceisspace + % + % Count number of #1's that we've seen. + \doignorecount = 0 + % + % Swallow text until we reach the matching `@end #1'. + \dodoignore{#1}% +} + +{ \catcode`_=11 % We want to use \_STOP_ which cannot appear in texinfo source. + \obeylines % + % + \gdef\dodoignore#1{% + % #1 contains the command name as a string, e.g., `ifinfo'. + % + % Define a command to find the next `@end #1', which must be on a line + % by itself. + \long\def\doignoretext##1^^M@end #1{\doignoretextyyy##1^^M@#1\_STOP_}% + % And this command to find another #1 command, at the beginning of a + % line. (Otherwise, we would consider a line `@c @ifset', for + % example, to count as an @ifset for nesting.) + \long\def\doignoretextyyy##1^^M@#1##2\_STOP_{\doignoreyyy{##2}\_STOP_}% + % + % And now expand that command. + \obeylines % + \doignoretext ^^M% + }% +} + +\def\doignoreyyy#1{% + \def\temp{#1}% + \ifx\temp\empty % Nothing found. + \let\next\doignoretextzzz + \else % Found a nested condition, ... + \advance\doignorecount by 1 + \let\next\doignoretextyyy % ..., look for another. + % If we're here, #1 ends with ^^M\ifinfo (for example). + \fi + \next #1% the token \_STOP_ is present just after this macro. +} + +% We have to swallow the remaining "\_STOP_". +% +\def\doignoretextzzz#1{% + \ifnum\doignorecount = 0 % We have just found the outermost @end. + \let\next\enddoignore + \else % Still inside a nested condition. + \advance\doignorecount by -1 + \let\next\doignoretext % Look for the next @end. + \fi + \next +} + +% Finish off ignored text. +\def\enddoignore{\endgroup\ignorespaces} + + +% @set VAR sets the variable VAR to an empty value. +% @set VAR REST-OF-LINE sets VAR to the value REST-OF-LINE. +% +% Since we want to separate VAR from REST-OF-LINE (which might be +% empty), we can't just use \parsearg; we have to insert a space of our +% own to delimit the rest of the line, and then take it out again if we +% didn't need it. +% We rely on the fact that \parsearg sets \catcode`\ =10. +% +\parseargdef\set{\setyyy#1 \endsetyyy} +\def\setyyy#1 #2\endsetyyy{% + {% + \makevalueexpandable + \def\temp{#2}% + \edef\next{\gdef\makecsname{SET#1}}% + \ifx\temp\empty + \next{}% + \else + \setzzz#2\endsetzzz + \fi + }% +} +% Remove the trailing space \setxxx inserted. +\def\setzzz#1 \endsetzzz{\next{#1}} + +% @clear VAR clears (i.e., unsets) the variable VAR. +% +\parseargdef\clear{% + {% + \makevalueexpandable + \global\expandafter\let\csname SET#1\endcsname=\relax + }% +} + +% @value{foo} gets the text saved in variable foo. +\def\value{\begingroup\makevalueexpandable\valuexxx} +\def\valuexxx#1{\expandablevalue{#1}\endgroup} +{ + \catcode`\- = \active \catcode`\_ = \active + % + \gdef\makevalueexpandable{% + \let\value = \expandablevalue + % We don't want these characters active, ... + \catcode`\-=\other \catcode`\_=\other + % ..., but we might end up with active ones in the argument if + % we're called from @code, as @code{@value{foo-bar_}}, though. + % So \let them to their normal equivalents. + \let-\realdash \let_\normalunderscore + } +} + +% We have this subroutine so that we can handle at least some @value's +% properly in indexes (we call \makevalueexpandable in \indexdummies). +% The command has to be fully expandable (if the variable is set), since +% the result winds up in the index file. This means that if the +% variable's value contains other Texinfo commands, it's almost certain +% it will fail (although perhaps we could fix that with sufficient work +% to do a one-level expansion on the result, instead of complete). +% +\def\expandablevalue#1{% + \expandafter\ifx\csname SET#1\endcsname\relax + {[No value for ``#1'']}% + \message{Variable `#1', used in @value, is not set.}% + \else + \csname SET#1\endcsname + \fi +} + +% @ifset VAR ... @end ifset reads the `...' iff VAR has been defined +% with @set. +% +% To get special treatment of `@end ifset,' call \makeond and the redefine. +% +\makecond{ifset} +\def\ifset{\parsearg{\doifset{\let\next=\ifsetfail}}} +\def\doifset#1#2{% + {% + \makevalueexpandable + \let\next=\empty + \expandafter\ifx\csname SET#2\endcsname\relax + #1% If not set, redefine \next. + \fi + \expandafter + }\next +} +\def\ifsetfail{\doignore{ifset}} + +% @ifclear VAR ... @end ifclear reads the `...' iff VAR has never been +% defined with @set, or has been undefined with @clear. +% +% The `\else' inside the `\doifset' parameter is a trick to reuse the +% above code: if the variable is not set, do nothing, if it is set, +% then redefine \next to \ifclearfail. +% +\makecond{ifclear} +\def\ifclear{\parsearg{\doifset{\else \let\next=\ifclearfail}}} +\def\ifclearfail{\doignore{ifclear}} + +% @dircategory CATEGORY -- specify a category of the dir file +% which this file should belong to. Ignore this in TeX. +\let\dircategory=\comment + +% @defininfoenclose. +\let\definfoenclose=\comment + + +\message{indexing,} +% Index generation facilities + +% Define \newwrite to be identical to plain tex's \newwrite +% except not \outer, so it can be used within macros and \if's. +\edef\newwrite{\makecsname{ptexnewwrite}} + +% \newindex {foo} defines an index named foo. +% It automatically defines \fooindex such that +% \fooindex ...rest of line... puts an entry in the index foo. +% It also defines \fooindfile to be the number of the output channel for +% the file that accumulates this index. The file's extension is foo. +% The name of an index should be no more than 2 characters long +% for the sake of vms. +% +\def\newindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 % Open the file + \fi + \expandafter\xdef\csname#1index\endcsname{% % Define @#1index + \noexpand\doindex{#1}} +} + +% @defindex foo == \newindex{foo} +% +\def\defindex{\parsearg\newindex} + +% Define @defcodeindex, like @defindex except put all entries in @code. +% +\def\defcodeindex{\parsearg\newcodeindex} +% +\def\newcodeindex#1{% + \iflinks + \expandafter\newwrite \csname#1indfile\endcsname + \openout \csname#1indfile\endcsname \jobname.#1 + \fi + \expandafter\xdef\csname#1index\endcsname{% + \noexpand\docodeindex{#1}}% +} + + +% @synindex foo bar makes index foo feed into index bar. +% Do this instead of @defindex foo if you don't want it as a separate index. +% +% @syncodeindex foo bar similar, but put all entries made for index foo +% inside @code. +% +\def\synindex#1 #2 {\dosynindex\doindex{#1}{#2}} +\def\syncodeindex#1 #2 {\dosynindex\docodeindex{#1}{#2}} + +% #1 is \doindex or \docodeindex, #2 the index getting redefined (foo), +% #3 the target index (bar). +\def\dosynindex#1#2#3{% + % Only do \closeout if we haven't already done it, else we'll end up + % closing the target index. + \expandafter \ifx\csname donesynindex#2\endcsname \undefined + % The \closeout helps reduce unnecessary open files; the limit on the + % Acorn RISC OS is a mere 16 files. + \expandafter\closeout\csname#2indfile\endcsname + \expandafter\let\csname\donesynindex#2\endcsname = 1 + \fi + % redefine \fooindfile: + \expandafter\let\expandafter\temp\expandafter=\csname#3indfile\endcsname + \expandafter\let\csname#2indfile\endcsname=\temp + % redefine \fooindex: + \expandafter\xdef\csname#2index\endcsname{\noexpand#1{#3}}% +} + +% Define \doindex, the driver for all \fooindex macros. +% Argument #1 is generated by the calling \fooindex macro, +% and it is "foo", the name of the index. + +% \doindex just uses \parsearg; it calls \doind for the actual work. +% This is because \doind is more useful to call from other macros. + +% There is also \dosubind {index}{topic}{subtopic} +% which makes an entry in a two-level index such as the operation index. + +\def\doindex#1{\edef\indexname{#1}\parsearg\singleindexer} +\def\singleindexer #1{\doind{\indexname}{#1}} + +% like the previous two, but they put @code around the argument. +\def\docodeindex#1{\edef\indexname{#1}\parsearg\singlecodeindexer} +\def\singlecodeindexer #1{\doind{\indexname}{\code{#1}}} + +% Take care of Texinfo commands that can appear in an index entry. +% Since there are some commands we want to expand, and others we don't, +% we have to laboriously prevent expansion for those that we don't. +% +\def\indexdummies{% + \escapechar = `\\ % use backslash in output files. + \def\@{@}% change to @@ when we switch to @ as escape char in index files. + \def\ {\realbackslash\space }% + % Need these in case \tex is in effect and \{ is a \delimiter again. + % But can't use \lbracecmd and \rbracecmd because texindex assumes + % braces and backslashes are used only as delimiters. + \let\{ = \mylbrace + \let\} = \myrbrace + % + % Do the redefinitions. + \commondummies +} + +% For the aux and toc files, @ is the escape character. So we want to +% redefine everything using @ as the escape character (instead of +% \realbackslash, still used for index files). When everything uses @, +% this will be simpler. +% +\def\atdummies{% + \def\@{@@}% + \def\ {@ }% + \let\{ = \lbraceatcmd + \let\} = \rbraceatcmd + % + % Do the redefinitions. + \commondummies +} + +% Called from \indexdummies and \atdummies. +% +\def\commondummies{% + % + % \definedummyword defines \#1 as \string\#1\space, thus effectively + % preventing its expansion. This is used only for control% words, + % not control letters, because the \space would be incorrect for + % control characters, but is needed to separate the control word + % from whatever follows. + % + % For control letters, we have \definedummyletter, which omits the + % space. + % + % These can be used both for control words that take an argument and + % those that do not. If it is followed by {arg} in the input, then + % that will dutifully get written to the index (or wherever). + % + \def\definedummyword ##1{\def##1{\string##1\space}}% + \def\definedummyletter##1{\def##1{\string##1}}% + \let\definedummyaccent\definedummyletter + % + \commondummiesnofonts + % + \definedummyletter\_% + % + % Non-English letters. + \definedummyword\AA + \definedummyword\AE + \definedummyword\L + \definedummyword\OE + \definedummyword\O + \definedummyword\aa + \definedummyword\ae + \definedummyword\l + \definedummyword\oe + \definedummyword\o + \definedummyword\ss + \definedummyword\exclamdown + \definedummyword\questiondown + \definedummyword\ordf + \definedummyword\ordm + % + % Although these internal commands shouldn't show up, sometimes they do. + \definedummyword\bf + \definedummyword\gtr + \definedummyword\hat + \definedummyword\less + \definedummyword\sf + \definedummyword\sl + \definedummyword\tclose + \definedummyword\tt + % + \definedummyword\LaTeX + \definedummyword\TeX + % + % Assorted special characters. + \definedummyword\bullet + \definedummyword\comma + \definedummyword\copyright + \definedummyword\registeredsymbol + \definedummyword\dots + \definedummyword\enddots + \definedummyword\equiv + \definedummyword\error + \definedummyword\euro + \definedummyword\expansion + \definedummyword\minus + \definedummyword\pounds + \definedummyword\point + \definedummyword\print + \definedummyword\result + % + % We want to disable all macros so that they are not expanded by \write. + \macrolist + % + \normalturnoffactive + % + % Handle some cases of @value -- where it does not contain any + % (non-fully-expandable) commands. + \makevalueexpandable +} + +% \commondummiesnofonts: common to \commondummies and \indexnofonts. +% +% Better have this without active chars. +{ + \catcode`\~=\other + \gdef\commondummiesnofonts{% + % Control letters and accents. + \definedummyletter\!% + \definedummyaccent\"% + \definedummyaccent\'% + \definedummyletter\*% + \definedummyaccent\,% + \definedummyletter\.% + \definedummyletter\/% + \definedummyletter\:% + \definedummyaccent\=% + \definedummyletter\?% + \definedummyaccent\^% + \definedummyaccent\`% + \definedummyaccent\~% + \definedummyword\u + \definedummyword\v + \definedummyword\H + \definedummyword\dotaccent + \definedummyword\ringaccent + \definedummyword\tieaccent + \definedummyword\ubaraccent + \definedummyword\udotaccent + \definedummyword\dotless + % + % Texinfo font commands. + \definedummyword\b + \definedummyword\i + \definedummyword\r + \definedummyword\sc + \definedummyword\t + % + % Commands that take arguments. + \definedummyword\acronym + \definedummyword\cite + \definedummyword\code + \definedummyword\command + \definedummyword\dfn + \definedummyword\emph + \definedummyword\env + \definedummyword\file + \definedummyword\kbd + \definedummyword\key + \definedummyword\math + \definedummyword\option + \definedummyword\samp + \definedummyword\strong + \definedummyword\tie + \definedummyword\uref + \definedummyword\url + \definedummyword\var + \definedummyword\verb + \definedummyword\w + } +} + +% \indexnofonts is used when outputting the strings to sort the index +% by, and when constructing control sequence names. It eliminates all +% control sequences and just writes whatever the best ASCII sort string +% would be for a given command (usually its argument). +% +\def\indexnofonts{% + % Accent commands should become @asis. + \def\definedummyaccent##1{\let##1\asis}% + % We can just ignore other control letters. + \def\definedummyletter##1{\let##1\empty}% + % Hopefully, all control words can become @asis. + \let\definedummyword\definedummyaccent + % + \commondummiesnofonts + % + % Don't no-op \tt, since it isn't a user-level command + % and is used in the definitions of the active chars like <, >, |, etc. + % Likewise with the other plain tex font commands. + %\let\tt=\asis + % + \def\ { }% + \def\@{@}% + % how to handle braces? + \def\_{\normalunderscore}% + % + % Non-English letters. + \def\AA{AA}% + \def\AE{AE}% + \def\L{L}% + \def\OE{OE}% + \def\O{O}% + \def\aa{aa}% + \def\ae{ae}% + \def\l{l}% + \def\oe{oe}% + \def\o{o}% + \def\ss{ss}% + \def\exclamdown{!}% + \def\questiondown{?}% + \def\ordf{a}% + \def\ordm{o}% + % + \def\LaTeX{LaTeX}% + \def\TeX{TeX}% + % + % Assorted special characters. + % (The following {} will end up in the sort string, but that's ok.) + \def\bullet{bullet}% + \def\comma{,}% + \def\copyright{copyright}% + \def\registeredsymbol{R}% + \def\dots{...}% + \def\enddots{...}% + \def\equiv{==}% + \def\error{error}% + \def\euro{euro}% + \def\expansion{==>}% + \def\minus{-}% + \def\pounds{pounds}% + \def\point{.}% + \def\print{-|}% + \def\result{=>}% + % + % We need to get rid of all macros, leaving only the arguments (if present). + % Of course this is not nearly correct, but it is the best we can do for now. + % makeinfo does not expand macros in the argument to @deffn, which ends up + % writing an index entry, and texindex isn't prepared for an index sort entry + % that starts with \. + % + % Since macro invocations are followed by braces, we can just redefine them + % to take a single TeX argument. The case of a macro invocation that + % goes to end-of-line is not handled. + % + \macrolist +} + +\let\indexbackslash=0 %overridden during \printindex. +\let\SETmarginindex=\relax % put index entries in margin (undocumented)? + +% Most index entries go through here, but \dosubind is the general case. +% #1 is the index name, #2 is the entry text. +\def\doind#1#2{\dosubind{#1}{#2}{}} + +% Workhorse for all \fooindexes. +% #1 is name of index, #2 is stuff to put there, #3 is subentry -- +% empty if called from \doind, as we usually are (the main exception +% is with most defuns, which call us directly). +% +\def\dosubind#1#2#3{% + \iflinks + {% + % Store the main index entry text (including the third arg). + \toks0 = {#2}% + % If third arg is present, precede it with a space. + \def\thirdarg{#3}% + \ifx\thirdarg\empty \else + \toks0 = \expandafter{\the\toks0 \space #3}% + \fi + % + \edef\writeto{\csname#1indfile\endcsname}% + % + \ifvmode + \dosubindsanitize + \else + \dosubindwrite + \fi + }% + \fi +} + +% Write the entry in \toks0 to the index file: +% +\def\dosubindwrite{% + % Put the index entry in the margin if desired. + \ifx\SETmarginindex\relax\else + \insert\margin{\hbox{\vrule height8pt depth3pt width0pt \the\toks0}}% + \fi + % + % Remember, we are within a group. + \indexdummies % Must do this here, since \bf, etc expand at this stage + \def\backslashcurfont{\indexbackslash}% \indexbackslash isn't defined now + % so it will be output as is; and it will print as backslash. + % + % Process the index entry with all font commands turned off, to + % get the string to sort by. + {\indexnofonts + \edef\temp{\the\toks0}% need full expansion + \xdef\indexsorttmp{\temp}% + }% + % + % Set up the complete index entry, with both the sort key and + % the original text, including any font commands. We write + % three arguments to \entry to the .?? file (four in the + % subentry case), texindex reduces to two when writing the .??s + % sorted result. + \edef\temp{% + \write\writeto{% + \string\entry{\indexsorttmp}{\noexpand\folio}{\the\toks0}}% + }% + \temp +} + +% Take care of unwanted page breaks: +% +% If a skip is the last thing on the list now, preserve it +% by backing up by \lastskip, doing the \write, then inserting +% the skip again. Otherwise, the whatsit generated by the +% \write will make \lastskip zero. The result is that sequences +% like this: +% @end defun +% @tindex whatever +% @defun ... +% will have extra space inserted, because the \medbreak in the +% start of the @defun won't see the skip inserted by the @end of +% the previous defun. +% +% But don't do any of this if we're not in vertical mode. We +% don't want to do a \vskip and prematurely end a paragraph. +% +% Avoid page breaks due to these extra skips, too. +% +% But wait, there is a catch there: +% We'll have to check whether \lastskip is zero skip. \ifdim is not +% sufficient for this purpose, as it ignores stretch and shrink parts +% of the skip. The only way seems to be to check the textual +% representation of the skip. +% +% The following is almost like \def\zeroskipmacro{0.0pt} except that +% the ``p'' and ``t'' characters have catcode \other, not 11 (letter). +% +\edef\zeroskipmacro{\expandafter\the\csname z@skip\endcsname} +% +% ..., ready, GO: +% +\def\dosubindsanitize{% + % \lastskip and \lastpenalty cannot both be nonzero simultaneously. + \skip0 = \lastskip + \edef\lastskipmacro{\the\lastskip}% + \count255 = \lastpenalty + % + % If \lastskip is nonzero, that means the last item was a + % skip. And since a skip is discardable, that means this + % -\skip0 glue we're inserting is preceded by a + % non-discardable item, therefore it is not a potential + % breakpoint, therefore no \nobreak needed. + \ifx\lastskipmacro\zeroskipmacro + \else + \vskip-\skip0 + \fi + % + \dosubindwrite + % + \ifx\lastskipmacro\zeroskipmacro + % If \lastskip was zero, perhaps the last item was a penalty, and + % perhaps it was >=10000, e.g., a \nobreak. In that case, we want + % to re-insert the same penalty (values >10000 are used for various + % signals); since we just inserted a non-discardable item, any + % following glue (such as a \parskip) would be a breakpoint. For example: + % + % @deffn deffn-whatever + % @vindex index-whatever + % Description. + % would allow a break between the index-whatever whatsit + % and the "Description." paragraph. + \ifnum\count255>9999 \penalty\count255 \fi + \else + % On the other hand, if we had a nonzero \lastskip, + % this make-up glue would be preceded by a non-discardable item + % (the whatsit from the \write), so we must insert a \nobreak. + \nobreak\vskip\skip0 + \fi +} + +% The index entry written in the file actually looks like +% \entry {sortstring}{page}{topic} +% or +% \entry {sortstring}{page}{topic}{subtopic} +% The texindex program reads in these files and writes files +% containing these kinds of lines: +% \initial {c} +% before the first topic whose initial is c +% \entry {topic}{pagelist} +% for a topic that is used without subtopics +% \primary {topic} +% for the beginning of a topic that is used with subtopics +% \secondary {subtopic}{pagelist} +% for each subtopic. + +% Define the user-accessible indexing commands +% @findex, @vindex, @kindex, @cindex. + +\def\findex {\fnindex} +\def\kindex {\kyindex} +\def\cindex {\cpindex} +\def\vindex {\vrindex} +\def\tindex {\tpindex} +\def\pindex {\pgindex} + +\def\cindexsub {\begingroup\obeylines\cindexsub} +{\obeylines % +\gdef\cindexsub "#1" #2^^M{\endgroup % +\dosubind{cp}{#2}{#1}}} + +% Define the macros used in formatting output of the sorted index material. + +% @printindex causes a particular index (the ??s file) to get printed. +% It does not print any chapter heading (usually an @unnumbered). +% +\parseargdef\printindex{\begingroup + \dobreak \chapheadingskip{10000}% + % + \smallfonts \rm + \tolerance = 9500 + \everypar = {}% don't want the \kern\-parindent from indentation suppression. + % + % See if the index file exists and is nonempty. + % Change catcode of @ here so that if the index file contains + % \initial {@} + % as its first line, TeX doesn't complain about mismatched braces + % (because it thinks @} is a control sequence). + \catcode`\@ = 11 + \openin 1 \jobname.#1s + \ifeof 1 + % \enddoublecolumns gets confused if there is no text in the index, + % and it loses the chapter title and the aux file entries for the + % index. The easiest way to prevent this problem is to make sure + % there is some text. + \putwordIndexNonexistent + \else + % + % If the index file exists but is empty, then \openin leaves \ifeof + % false. We have to make TeX try to read something from the file, so + % it can discover if there is anything in it. + \read 1 to \temp + \ifeof 1 + \putwordIndexIsEmpty + \else + % Index files are almost Texinfo source, but we use \ as the escape + % character. It would be better to use @, but that's too big a change + % to make right now. + \def\indexbackslash{\backslashcurfont}% + \catcode`\\ = 0 + \escapechar = `\\ + \begindoublecolumns + \input \jobname.#1s + \enddoublecolumns + \fi + \fi + \closein 1 +\endgroup} + +% These macros are used by the sorted index file itself. +% Change them to control the appearance of the index. + +\def\initial#1{{% + % Some minor font changes for the special characters. + \let\tentt=\sectt \let\tt=\sectt \let\sf=\sectt + % + % Remove any glue we may have, we'll be inserting our own. + \removelastskip + % + % We like breaks before the index initials, so insert a bonus. + \nobreak + \vskip 0pt plus 3\baselineskip + \penalty 0 + \vskip 0pt plus -3\baselineskip + % + % Typeset the initial. Making this add up to a whole number of + % baselineskips increases the chance of the dots lining up from column + % to column. It still won't often be perfect, because of the stretch + % we need before each entry, but it's better. + % + % No shrink because it confuses \balancecolumns. + \vskip 1.67\baselineskip plus .5\baselineskip + \leftline{\secbf #1}% + % Do our best not to break after the initial. + \nobreak + \vskip .33\baselineskip plus .1\baselineskip +}} + +% \entry typesets a paragraph consisting of the text (#1), dot leaders, and +% then page number (#2) flushed to the right margin. It is used for index +% and table of contents entries. The paragraph is indented by \leftskip. +% +% A straightforward implementation would start like this: +% \def\entry#1#2{... +% But this frozes the catcodes in the argument, and can cause problems to +% @code, which sets - active. This problem was fixed by a kludge--- +% ``-'' was active throughout whole index, but this isn't really right. +% +% The right solution is to prevent \entry from swallowing the whole text. +% --kasal, 21nov03 +\def\entry{% + \begingroup + % + % Start a new paragraph if necessary, so our assignments below can't + % affect previous text. + \par + % + % Do not fill out the last line with white space. + \parfillskip = 0in + % + % No extra space above this paragraph. + \parskip = 0in + % + % Do not prefer a separate line ending with a hyphen to fewer lines. + \finalhyphendemerits = 0 + % + % \hangindent is only relevant when the entry text and page number + % don't both fit on one line. In that case, bob suggests starting the + % dots pretty far over on the line. Unfortunately, a large + % indentation looks wrong when the entry text itself is broken across + % lines. So we use a small indentation and put up with long leaders. + % + % \hangafter is reset to 1 (which is the value we want) at the start + % of each paragraph, so we need not do anything with that. + \hangindent = 2em + % + % When the entry text needs to be broken, just fill out the first line + % with blank space. + \rightskip = 0pt plus1fil + % + % A bit of stretch before each entry for the benefit of balancing + % columns. + \vskip 0pt plus1pt + % + % Swallow the left brace of the text (first parameter): + \afterassignment\doentry + \let\temp = +} +\def\doentry{% + \bgroup % Instead of the swallowed brace. + \noindent + \aftergroup\finishentry + % And now comes the text of the entry. +} +\def\finishentry#1{% + % #1 is the page number. + % + % The following is kludged to not output a line of dots in the index if + % there are no page numbers. The next person who breaks this will be + % cursed by a Unix daemon. + \def\tempa{{\rm }}% + \def\tempb{#1}% + \edef\tempc{\tempa}% + \edef\tempd{\tempb}% + \ifx\tempc\tempd + \ % + \else + % + % If we must, put the page number on a line of its own, and fill out + % this line with blank space. (The \hfil is overwhelmed with the + % fill leaders glue in \indexdotfill if the page number does fit.) + \hfil\penalty50 + \null\nobreak\indexdotfill % Have leaders before the page number. + % + % The `\ ' here is removed by the implicit \unskip that TeX does as + % part of (the primitive) \par. Without it, a spurious underfull + % \hbox ensues. + \ifpdf + \pdfgettoks#1.% + \ \the\toksA + \else + \ #1% + \fi + \fi + \par + \endgroup +} + +% Like \dotfill except takes at least 1 em. +\def\indexdotfill{\cleaders + \hbox{$\mathsurround=0pt \mkern1.5mu ${\it .}$ \mkern1.5mu$}\hskip 1em plus 1fill} + +\def\primary #1{\line{#1\hfil}} + +\newskip\secondaryindent \secondaryindent=0.5cm +\def\secondary#1#2{{% + \parfillskip=0in + \parskip=0in + \hangindent=1in + \hangafter=1 + \noindent\hskip\secondaryindent\hbox{#1}\indexdotfill + \ifpdf + \pdfgettoks#2.\ \the\toksA % The page number ends the paragraph. + \else + #2 + \fi + \par +}} + +% Define two-column mode, which we use to typeset indexes. +% Adapted from the TeXbook, page 416, which is to say, +% the manmac.tex format used to print the TeXbook itself. +\catcode`\@=11 + +\newbox\partialpage +\newdimen\doublecolumnhsize + +\def\begindoublecolumns{\begingroup % ended by \enddoublecolumns + % Grab any single-column material above us. + \output = {% + % + % Here is a possibility not foreseen in manmac: if we accumulate a + % whole lot of material, we might end up calling this \output + % routine twice in a row (see the doublecol-lose test, which is + % essentially a couple of indexes with @setchapternewpage off). In + % that case we just ship out what is in \partialpage with the normal + % output routine. Generally, \partialpage will be empty when this + % runs and this will be a no-op. See the indexspread.tex test case. + \ifvoid\partialpage \else + \onepageout{\pagecontents\partialpage}% + \fi + % + \global\setbox\partialpage = \vbox{% + % Unvbox the main output page. + \unvbox\PAGE + \kern-\topskip \kern\baselineskip + }% + }% + \eject % run that output routine to set \partialpage + % + % Use the double-column output routine for subsequent pages. + \output = {\doublecolumnout}% + % + % Change the page size parameters. We could do this once outside this + % routine, in each of @smallbook, @afourpaper, and the default 8.5x11 + % format, but then we repeat the same computation. Repeating a couple + % of assignments once per index is clearly meaningless for the + % execution time, so we may as well do it in one place. + % + % First we halve the line length, less a little for the gutter between + % the columns. We compute the gutter based on the line length, so it + % changes automatically with the paper format. The magic constant + % below is chosen so that the gutter has the same value (well, +-<1pt) + % as it did when we hard-coded it. + % + % We put the result in a separate register, \doublecolumhsize, so we + % can restore it in \pagesofar, after \hsize itself has (potentially) + % been clobbered. + % + \doublecolumnhsize = \hsize + \advance\doublecolumnhsize by -.04154\hsize + \divide\doublecolumnhsize by 2 + \hsize = \doublecolumnhsize + % + % Double the \vsize as well. (We don't need a separate register here, + % since nobody clobbers \vsize.) + \vsize = 2\vsize +} + +% The double-column output routine for all double-column pages except +% the last. +% +\def\doublecolumnout{% + \splittopskip=\topskip \splitmaxdepth=\maxdepth + % Get the available space for the double columns -- the normal + % (undoubled) page height minus any material left over from the + % previous page. + \dimen@ = \vsize + \divide\dimen@ by 2 + \advance\dimen@ by -\ht\partialpage + % + % box0 will be the left-hand column, box2 the right. + \setbox0=\vsplit255 to\dimen@ \setbox2=\vsplit255 to\dimen@ + \onepageout\pagesofar + \unvbox255 + \penalty\outputpenalty +} +% +% Re-output the contents of the output page -- any previous material, +% followed by the two boxes we just split, in box0 and box2. +\def\pagesofar{% + \unvbox\partialpage + % + \hsize = \doublecolumnhsize + \wd0=\hsize \wd2=\hsize + \hbox to\pagewidth{\box0\hfil\box2}% +} +% +% All done with double columns. +\def\enddoublecolumns{% + \output = {% + % Split the last of the double-column material. Leave it on the + % current page, no automatic page break. + \balancecolumns + % + % If we end up splitting too much material for the current page, + % though, there will be another page break right after this \output + % invocation ends. Having called \balancecolumns once, we do not + % want to call it again. Therefore, reset \output to its normal + % definition right away. (We hope \balancecolumns will never be + % called on to balance too much material, but if it is, this makes + % the output somewhat more palatable.) + \global\output = {\onepageout{\pagecontents\PAGE}}% + }% + \eject + \endgroup % started in \begindoublecolumns + % + % \pagegoal was set to the doubled \vsize above, since we restarted + % the current page. We're now back to normal single-column + % typesetting, so reset \pagegoal to the normal \vsize (after the + % \endgroup where \vsize got restored). + \pagegoal = \vsize +} +% +% Called at the end of the double column material. +\def\balancecolumns{% + \setbox0 = \vbox{\unvbox255}% like \box255 but more efficient, see p.120. + \dimen@ = \ht0 + \advance\dimen@ by \topskip + \advance\dimen@ by-\baselineskip + \divide\dimen@ by 2 % target to split to + %debug\message{final 2-column material height=\the\ht0, target=\the\dimen@.}% + \splittopskip = \topskip + % Loop until we get a decent breakpoint. + {% + \vbadness = 10000 + \loop + \global\setbox3 = \copy0 + \global\setbox1 = \vsplit3 to \dimen@ + \ifdim\ht3>\dimen@ + \global\advance\dimen@ by 1pt + \repeat + }% + %debug\message{split to \the\dimen@, column heights: \the\ht1, \the\ht3.}% + \setbox0=\vbox to\dimen@{\unvbox1}% + \setbox2=\vbox to\dimen@{\unvbox3}% + % + \pagesofar +} +\catcode`\@ = \other + + +\message{sectioning,} +% Chapters, sections, etc. + +% \unnumberedno is an oxymoron, of course. But we count the unnumbered +% sections so that we can refer to them unambiguously in the pdf +% outlines by their "section number". We avoid collisions with chapter +% numbers by starting them at 10000. (If a document ever has 10000 +% chapters, we're in trouble anyway, I'm sure.) +\newcount\unnumberedno \unnumberedno = 10000 +\newcount\chapno +\newcount\secno \secno=0 +\newcount\subsecno \subsecno=0 +\newcount\subsubsecno \subsubsecno=0 + +% This counter is funny since it counts through charcodes of letters A, B, ... +\newcount\appendixno \appendixno = `\@ +% +% \def\appendixletter{\char\the\appendixno} +% We do the following ugly conditional instead of the above simple +% construct for the sake of pdftex, which needs the actual +% letter in the expansion, not just typeset. +% +\def\appendixletter{% + \ifnum\appendixno=`A A% + \else\ifnum\appendixno=`B B% + \else\ifnum\appendixno=`C C% + \else\ifnum\appendixno=`D D% + \else\ifnum\appendixno=`E E% + \else\ifnum\appendixno=`F F% + \else\ifnum\appendixno=`G G% + \else\ifnum\appendixno=`H H% + \else\ifnum\appendixno=`I I% + \else\ifnum\appendixno=`J J% + \else\ifnum\appendixno=`K K% + \else\ifnum\appendixno=`L L% + \else\ifnum\appendixno=`M M% + \else\ifnum\appendixno=`N N% + \else\ifnum\appendixno=`O O% + \else\ifnum\appendixno=`P P% + \else\ifnum\appendixno=`Q Q% + \else\ifnum\appendixno=`R R% + \else\ifnum\appendixno=`S S% + \else\ifnum\appendixno=`T T% + \else\ifnum\appendixno=`U U% + \else\ifnum\appendixno=`V V% + \else\ifnum\appendixno=`W W% + \else\ifnum\appendixno=`X X% + \else\ifnum\appendixno=`Y Y% + \else\ifnum\appendixno=`Z Z% + % The \the is necessary, despite appearances, because \appendixletter is + % expanded while writing the .toc file. \char\appendixno is not + % expandable, thus it is written literally, thus all appendixes come out + % with the same letter (or @) in the toc without it. + \else\char\the\appendixno + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi + \fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi\fi} + +% Each @chapter defines this as the name of the chapter. +% page headings and footings can use it. @section does likewise. +% However, they are not reliable, because we don't use marks. +\def\thischapter{} +\def\thissection{} + +\newcount\absseclevel % used to calculate proper heading level +\newcount\secbase\secbase=0 % @raisesections/@lowersections modify this count + +% @raisesections: treat @section as chapter, @subsection as section, etc. +\def\raisesections{\global\advance\secbase by -1} +\let\up=\raisesections % original BFox name + +% @lowersections: treat @chapter as section, @section as subsection, etc. +\def\lowersections{\global\advance\secbase by 1} +\let\down=\lowersections % original BFox name + +% we only have subsub. +\chardef\maxseclevel = 3 +% +% A numbered section within an unnumbered changes to unnumbered too. +% To achive this, remember the "biggest" unnum. sec. we are currently in: +\chardef\unmlevel = \maxseclevel +% +% Trace whether the current chapter is an appendix or not: +% \chapheadtype is "N" or "A", unnumbered chapters are ignored. +\def\chapheadtype{N} + +% Choose a heading macro +% #1 is heading type +% #2 is heading level +% #3 is text for heading +\def\genhead#1#2#3{% + % Compute the abs. sec. level: + \absseclevel=#2 + \advance\absseclevel by \secbase + % Make sure \absseclevel doesn't fall outside the range: + \ifnum \absseclevel < 0 + \absseclevel = 0 + \else + \ifnum \absseclevel > 3 + \absseclevel = 3 + \fi + \fi + % The heading type: + \def\headtype{#1}% + \if \headtype U% + \ifnum \absseclevel < \unmlevel + \chardef\unmlevel = \absseclevel + \fi + \else + % Check for appendix sections: + \ifnum \absseclevel = 0 + \edef\chapheadtype{\headtype}% + \else + \if \headtype A\if \chapheadtype N% + \errmessage{@appendix... within a non-appendix chapter}% + \fi\fi + \fi + % Check for numbered within unnumbered: + \ifnum \absseclevel > \unmlevel + \def\headtype{U}% + \else + \chardef\unmlevel = 3 + \fi + \fi + % Now print the heading: + \if \headtype U% + \ifcase\absseclevel + \unnumberedzzz{#3}% + \or \unnumberedseczzz{#3}% + \or \unnumberedsubseczzz{#3}% + \or \unnumberedsubsubseczzz{#3}% + \fi + \else + \if \headtype A% + \ifcase\absseclevel + \appendixzzz{#3}% + \or \appendixsectionzzz{#3}% + \or \appendixsubseczzz{#3}% + \or \appendixsubsubseczzz{#3}% + \fi + \else + \ifcase\absseclevel + \chapterzzz{#3}% + \or \seczzz{#3}% + \or \numberedsubseczzz{#3}% + \or \numberedsubsubseczzz{#3}% + \fi + \fi + \fi + \suppressfirstparagraphindent +} + +% an interface: +\def\numhead{\genhead N} +\def\apphead{\genhead A} +\def\unnmhead{\genhead U} + +% @chapter, @appendix, @unnumbered. Increment top-level counter, reset +% all lower-level sectioning counters to zero. +% +% Also set \chaplevelprefix, which we prepend to @float sequence numbers +% (e.g., figures), q.v. By default (before any chapter), that is empty. +\let\chaplevelprefix = \empty +% +\outer\parseargdef\chapter{\numhead0{#1}} % normally numhead0 calls chapterzzz +\def\chapterzzz#1{% + % section resetting is \global in case the chapter is in a group, such + % as an @include file. + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\chapno by 1 + % + % Used for \float. + \gdef\chaplevelprefix{\the\chapno.}% + \resetallfloatnos + % + \message{\putwordChapter\space \the\chapno}% + % + % Write the actual heading. + \chapmacro{#1}{Ynumbered}{\the\chapno}% + % + % So @section and the like are numbered underneath this chapter. + \global\let\section = \numberedsec + \global\let\subsection = \numberedsubsec + \global\let\subsubsection = \numberedsubsubsec +} + +\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz +\def\appendixzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\appendixno by 1 + \gdef\chaplevelprefix{\appendixletter.}% + \resetallfloatnos + % + \def\appendixnum{\putwordAppendix\space \appendixletter}% + \message{\appendixnum}% + % + \chapmacro{#1}{Yappendix}{\appendixletter}% + % + \global\let\section = \appendixsec + \global\let\subsection = \appendixsubsec + \global\let\subsubsection = \appendixsubsubsec +} + +\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz +\def\unnumberedzzz#1{% + \global\secno=0 \global\subsecno=0 \global\subsubsecno=0 + \global\advance\unnumberedno by 1 + % + % Since an unnumbered has no number, no prefix for figures. + \global\let\chaplevelprefix = \empty + \resetallfloatnos + % + % This used to be simply \message{#1}, but TeX fully expands the + % argument to \message. Therefore, if #1 contained @-commands, TeX + % expanded them. For example, in `@unnumbered The @cite{Book}', TeX + % expanded @cite (which turns out to cause errors because \cite is meant + % to be executed, not expanded). + % + % Anyway, we don't want the fully-expanded definition of @cite to appear + % as a result of the \message, we just want `@cite' itself. We use + % \the to achieve this: TeX expands \the only once, + % simply yielding the contents of . (We also do this for + % the toc entries.) + \toks0 = {#1}% + \message{(\the\toks0)}% + % + \chapmacro{#1}{Ynothing}{\the\unnumberedno}% + % + \global\let\section = \unnumberedsec + \global\let\subsection = \unnumberedsubsec + \global\let\subsubsection = \unnumberedsubsubsec +} + +% @centerchap is like @unnumbered, but the heading is centered. +\outer\parseargdef\centerchap{% + % Well, we could do the following in a group, but that would break + % an assumption that \chapmacro is called at the outermost level. + % Thus we are safer this way: --kasal, 24feb04 + \let\centerparametersmaybe = \centerparameters + \unnmhead0{#1}% + \let\centerparametersmaybe = \relax +} + +% @top is like @unnumbered. +\let\top\unnumbered + +% Sections. +\outer\parseargdef\numberedsec{\numhead1{#1}} % normally calls seczzz +\def\seczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynumbered}{\the\chapno.\the\secno}% +} + +\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz +\def\appendixsectionzzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}% +} +\let\appendixsec\appendixsection + +\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz +\def\unnumberedseczzz#1{% + \global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1 + \sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}% +} + +% Subsections. +\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz +\def\numberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}% +} + +\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz +\def\appendixsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno}% +} + +\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz +\def\unnumberedsubseczzz#1{% + \global\subsubsecno=0 \global\advance\subsecno by 1 + \sectionheading{#1}{subsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno}% +} + +% Subsubsections. +\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz +\def\numberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynumbered}% + {\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz +\def\appendixsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Yappendix}% + {\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz +\def\unnumberedsubsubseczzz#1{% + \global\advance\subsubsecno by 1 + \sectionheading{#1}{subsubsec}{Ynothing}% + {\the\unnumberedno.\the\secno.\the\subsecno.\the\subsubsecno}% +} + +% These macros control what the section commands do, according +% to what kind of chapter we are in (ordinary, appendix, or unnumbered). +% Define them by default for a numbered chapter. +\let\section = \numberedsec +\let\subsection = \numberedsubsec +\let\subsubsection = \numberedsubsubsec + +% Define @majorheading, @heading and @subheading + +% NOTE on use of \vbox for chapter headings, section headings, and such: +% 1) We use \vbox rather than the earlier \line to permit +% overlong headings to fold. +% 2) \hyphenpenalty is set to 10000 because hyphenation in a +% heading is obnoxious; this forbids it. +% 3) Likewise, headings look best if no \parindent is used, and +% if justification is not attempted. Hence \raggedright. + + +\def\majorheading{% + {\advance\chapheadingskip by 10pt \chapbreak }% + \parsearg\chapheadingzzz +} + +\def\chapheading{\chapbreak \parsearg\chapheadingzzz} +\def\chapheadingzzz#1{% + {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}% + \bigskip \par\penalty 200\relax + \suppressfirstparagraphindent +} + +% @heading, @subheading, @subsubheading. +\parseargdef\heading{\sectionheading{#1}{sec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subheading{\sectionheading{#1}{subsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} +\parseargdef\subsubheading{\sectionheading{#1}{subsubsec}{Yomitfromtoc}{} + \suppressfirstparagraphindent} + +% These macros generate a chapter, section, etc. heading only +% (including whitespace, linebreaking, etc. around it), +% given all the information in convenient, parsed form. + +%%% Args are the skip and penalty (usually negative) +\def\dobreak#1#2{\par\ifdim\lastskip<#1\removelastskip\penalty#2\vskip#1\fi} + +%%% Define plain chapter starts, and page on/off switching for it +% Parameter controlling skip before chapter headings (if needed) + +\newskip\chapheadingskip + +\def\chapbreak{\dobreak \chapheadingskip {-4000}} +\def\chappager{\par\vfill\supereject} +\def\chapoddpage{\chappager \ifodd\pageno \else \hbox to 0pt{} \chappager\fi} + +\def\setchapternewpage #1 {\csname CHAPPAG#1\endcsname} + +\def\CHAPPAGoff{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chapbreak +\global\let\pagealignmacro=\chappager} + +\def\CHAPPAGon{% +\global\let\contentsalignmacro = \chappager +\global\let\pchapsepmacro=\chappager +\global\let\pagealignmacro=\chappager +\global\def\HEADINGSon{\HEADINGSsingle}} + +\def\CHAPPAGodd{% +\global\let\contentsalignmacro = \chapoddpage +\global\let\pchapsepmacro=\chapoddpage +\global\let\pagealignmacro=\chapoddpage +\global\def\HEADINGSon{\HEADINGSdouble}} + +\CHAPPAGon + +% Chapter opening. +% +% #1 is the text, #2 is the section type (Ynumbered, Ynothing, +% Yappendix, Yomitfromtoc), #3 the chapter number. +% +% To test against our argument. +\def\Ynothingkeyword{Ynothing} +\def\Yomitfromtockeyword{Yomitfromtoc} +\def\Yappendixkeyword{Yappendix} +% +\def\chapmacro#1#2#3{% + \pchapsepmacro + {% + \chapfonts \rm + % + % Have to define \thissection before calling \donoderef, because the + % xref code eventually uses it. On the other hand, it has to be called + % after \pchapsepmacro, or the headline will change too soon. + \gdef\thissection{#1}% + \gdef\thischaptername{#1}% + % + % Only insert the separating space if we have a chapter/appendix + % number, and don't print the unnumbered ``number''. + \def\temptype{#2}% + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unnchap}% + \gdef\thischapter{#1}% + \else\ifx\temptype\Yomitfromtockeyword + \setbox0 = \hbox{}% contents like unnumbered, but no toc entry + \def\toctype{omit}% + \gdef\thischapter{}% + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{\putwordAppendix{} #3\enspace}% + \def\toctype{app}% + % We don't substitute the actual chapter name into \thischapter + % because we don't want its macros evaluated now. And we don't + % use \thissection because that changes with each section. + % + \xdef\thischapter{\putwordAppendix{} \appendixletter: + \noexpand\thischaptername}% + \else + \setbox0 = \hbox{#3\enspace}% + \def\toctype{numchap}% + \xdef\thischapter{\putwordChapter{} \the\chapno: + \noexpand\thischaptername}% + \fi\fi\fi + % + % Write the toc entry for this chapter. Must come before the + % \donoderef, because we include the current node name in the toc + % entry, and \donoderef resets it to empty. + \writetocentry{\toctype}{#1}{#3}% + % + % For pdftex, we have to write out the node definition (aka, make + % the pdfdest) after any page break, but before the actual text has + % been typeset. If the destination for the pdf outline is after the + % text, then jumping from the outline may wind up with the text not + % being visible, for instance under high magnification. + \donoderef{#2}% + % + % Typeset the actual heading. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \hangindent=\wd0 \centerparametersmaybe + \unhbox0 #1\par}% + }% + \nobreak\bigskip % no page break after a chapter title + \nobreak +} + +% @centerchap -- centered and unnumbered. +\let\centerparametersmaybe = \relax +\def\centerparameters{% + \advance\rightskip by 3\rightskip + \leftskip = \rightskip + \parfillskip = 0pt +} + + +% I don't think this chapter style is supported any more, so I'm not +% updating it with the new noderef stuff. We'll see. --karl, 11aug03. +% +\def\setchapterstyle #1 {\csname CHAPF#1\endcsname} +% +\def\unnchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt\raggedright + \rm #1\hfill}}\bigskip \par\nobreak +} +\def\chfopen #1#2{\chapoddpage {\chapfonts +\vbox to 3in{\vfil \hbox to\hsize{\hfil #2} \hbox to\hsize{\hfil #1} \vfil}}% +\par\penalty 5000 % +} +\def\centerchfopen #1{% +\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000 + \parindent=0pt + \hfill {\rm #1}\hfill}}\bigskip \par\nobreak +} +\def\CHAPFopen{% + \global\let\chapmacro=\chfopen + \global\let\centerchapmacro=\centerchfopen} + + +% Section titles. These macros combine the section number parts and +% call the generic \sectionheading to do the printing. +% +\newskip\secheadingskip +\def\secheadingbreak{\dobreak \secheadingskip{-1000}} + +% Subsection titles. +\newskip\subsecheadingskip +\def\subsecheadingbreak{\dobreak \subsecheadingskip{-500}} + +% Subsubsection titles. +\def\subsubsecheadingskip{\subsecheadingskip} +\def\subsubsecheadingbreak{\subsecheadingbreak} + + +% Print any size, any type, section title. +% +% #1 is the text, #2 is the section level (sec/subsec/subsubsec), #3 is +% the section type for xrefs (Ynumbered, Ynothing, Yappendix), #4 is the +% section number. +% +\def\sectionheading#1#2#3#4{% + {% + % Switch to the right set of fonts. + \csname #2fonts\endcsname \rm + % + % Insert space above the heading. + \csname #2headingbreak\endcsname + % + % Only insert the space after the number if we have a section number. + \def\sectionlevel{#2}% + \def\temptype{#3}% + % + \ifx\temptype\Ynothingkeyword + \setbox0 = \hbox{}% + \def\toctype{unn}% + \gdef\thissection{#1}% + \else\ifx\temptype\Yomitfromtockeyword + % for @headings -- no section number, don't include in toc, + % and don't redefine \thissection. + \setbox0 = \hbox{}% + \def\toctype{omit}% + \let\sectionlevel=\empty + \else\ifx\temptype\Yappendixkeyword + \setbox0 = \hbox{#4\enspace}% + \def\toctype{app}% + \gdef\thissection{#1}% + \else + \setbox0 = \hbox{#4\enspace}% + \def\toctype{num}% + \gdef\thissection{#1}% + \fi\fi\fi + % + % Write the toc entry (before \donoderef). See comments in \chfplain. + \writetocentry{\toctype\sectionlevel}{#1}{#4}% + % + % Write the node reference (= pdf destination for pdftex). + % Again, see comments in \chfplain. + \donoderef{#3}% + % + % Output the actual section heading. + \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright + \hangindent=\wd0 % zero if no section number + \unhbox0 #1}% + }% + % Add extra space after the heading -- half of whatever came above it. + % Don't allow stretch, though. + \kern .5 \csname #2headingskip\endcsname + % + % Do not let the kern be a potential breakpoint, as it would be if it + % was followed by glue. + \nobreak + % + % We'll almost certainly start a paragraph next, so don't let that + % glue accumulate. (Not a breakpoint because it's preceded by a + % discardable item.) + \vskip-\parskip + % + % This is purely so the last item on the list is a known \penalty > + % 10000. This is so \startdefun can avoid allowing breakpoints after + % section headings. Otherwise, it would insert a valid breakpoint between: + % + % @section sec-whatever + % @deffn def-whatever + \penalty 10001 +} + + +\message{toc,} +% Table of contents. +\newwrite\tocfile + +% Write an entry to the toc file, opening it if necessary. +% Called from @chapter, etc. +% +% Example usage: \writetocentry{sec}{Section Name}{\the\chapno.\the\secno} +% We append the current node name (if any) and page number as additional +% arguments for the \{chap,sec,...}entry macros which will eventually +% read this. The node name is used in the pdf outlines as the +% destination to jump to. +% +% We open the .toc file for writing here instead of at @setfilename (or +% any other fixed time) so that @contents can be anywhere in the document. +% But if #1 is `omit', then we don't do anything. This is used for the +% table of contents chapter openings themselves. +% +\newif\iftocfileopened +\def\omitkeyword{omit}% +% +\def\writetocentry#1#2#3{% + \edef\writetoctype{#1}% + \ifx\writetoctype\omitkeyword \else + \iftocfileopened\else + \immediate\openout\tocfile = \jobname.toc + \global\tocfileopenedtrue + \fi + % + \iflinks + {\atdummies + \edef\temp{% + \write\tocfile{@#1entry{#2}{#3}{\lastnode}{\noexpand\folio}}}% + \temp + } + \fi + \fi + % + % Tell \shipout to create a pdf destination on each page, if we're + % writing pdf. These are used in the table of contents. We can't + % just write one on every page because the title pages are numbered + % 1 and 2 (the page numbers aren't printed), and so are the first + % two pages of the document. Thus, we'd have two destinations named + % `1', and two named `2'. + \ifpdf \global\pdfmakepagedesttrue \fi +} + + +% These characters do not print properly in the Computer Modern roman +% fonts, so we must take special care. This is more or less redundant +% with the Texinfo input format setup at the end of this file. +% +\def\activecatcodes{% + \catcode`\"=\active + \catcode`\$=\active + \catcode`\<=\active + \catcode`\>=\active + \catcode`\\=\active + \catcode`\^=\active + \catcode`\_=\active + \catcode`\|=\active + \catcode`\~=\active +} + + +% Read the toc file, which is essentially Texinfo input. +\def\readtocfile{% + \setupdatafile + \activecatcodes + \input \jobname.toc +} + +\newskip\contentsrightmargin \contentsrightmargin=1in +\newcount\savepageno +\newcount\lastnegativepageno \lastnegativepageno = -1 + +% Prepare to read what we've written to \tocfile. +% +\def\startcontents#1{% + % If @setchapternewpage on, and @headings double, the contents should + % start on an odd page, unlike chapters. Thus, we maintain + % \contentsalignmacro in parallel with \pagealignmacro. + % From: Torbjorn Granlund + \contentsalignmacro + \immediate\closeout\tocfile + % + % Don't need to put `Contents' or `Short Contents' in the headline. + % It is abundantly clear what they are. + \def\thischapter{}% + \chapmacro{#1}{Yomitfromtoc}{}% + % + \savepageno = \pageno + \begingroup % Set up to handle contents files properly. + \raggedbottom % Worry more about breakpoints than the bottom. + \advance\hsize by -\contentsrightmargin % Don't use the full line length. + % + % Roman numerals for page numbers. + \ifnum \pageno>0 \global\pageno = \lastnegativepageno \fi +} + + +% Normal (long) toc. +\def\contents{% + \startcontents{\putwordTOC}% + \openin 1 \jobname.toc + \ifeof 1 \else + \readtocfile + \fi + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \ifeof 1 \else + \pdfmakeoutlines + \fi + \closein 1 + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} + +% And just the chapters. +\def\summarycontents{% + \startcontents{\putwordShortTOC}% + % + \let\numchapentry = \shortchapentry + \let\appentry = \shortchapentry + \let\unnchapentry = \shortunnchapentry + % We want a true roman here for the page numbers. + \secfonts + \let\rm=\shortcontrm \let\bf=\shortcontbf + \let\sl=\shortcontsl \let\tt=\shortconttt + \rm + \hyphenpenalty = 10000 + \advance\baselineskip by 1pt % Open it up a little. + \def\numsecentry##1##2##3##4{} + \let\appsecentry = \numsecentry + \let\unnsecentry = \numsecentry + \let\numsubsecentry = \numsecentry + \let\appsubsecentry = \numsecentry + \let\unnsubsecentry = \numsecentry + \let\numsubsubsecentry = \numsecentry + \let\appsubsubsecentry = \numsecentry + \let\unnsubsubsecentry = \numsecentry + \openin 1 \jobname.toc + \ifeof 1 \else + \readtocfile + \fi + \closein 1 + \vfill \eject + \contentsalignmacro % in case @setchapternewpage odd is in effect + \endgroup + \lastnegativepageno = \pageno + \global\pageno = \savepageno +} +\let\shortcontents = \summarycontents + +% Typeset the label for a chapter or appendix for the short contents. +% The arg is, e.g., `A' for an appendix, or `3' for a chapter. +% +\def\shortchaplabel#1{% + % This space should be enough, since a single number is .5em, and the + % widest letter (M) is 1em, at least in the Computer Modern fonts. + % But use \hss just in case. + % (This space doesn't include the extra space that gets added after + % the label; that gets put in by \shortchapentry above.) + % + % We'd like to right-justify chapter numbers, but that looks strange + % with appendix letters. And right-justifying numbers and + % left-justifying letters looks strange when there is less than 10 + % chapters. Have to read the whole toc once to know how many chapters + % there are before deciding ... + \hbox to 1em{#1\hss}% +} + +% These macros generate individual entries in the table of contents. +% The first argument is the chapter or section name. +% The last argument is the page number. +% The arguments in between are the chapter number, section number, ... + +% Chapters, in the main contents. +\def\numchapentry#1#2#3#4{\dochapentry{#2\labelspace#1}{#4}} +% +% Chapters, in the short toc. +% See comments in \dochapentry re vbox and related settings. +\def\shortchapentry#1#2#3#4{% + \tocentry{\shortchaplabel{#2}\labelspace #1}{\doshortpageno\bgroup#4\egroup}% +} + +% Appendices, in the main contents. +% Need the word Appendix, and a fixed-size box. +% +\def\appendixbox#1{% + % We use M since it's probably the widest letter. + \setbox0 = \hbox{\putwordAppendix{} M}% + \hbox to \wd0{\putwordAppendix{} #1\hss}} +% +\def\appentry#1#2#3#4{\dochapentry{\appendixbox{#2}\labelspace#1}{#4}} + +% Unnumbered chapters. +\def\unnchapentry#1#2#3#4{\dochapentry{#1}{#4}} +\def\shortunnchapentry#1#2#3#4{\tocentry{#1}{\doshortpageno\bgroup#4\egroup}} + +% Sections. +\def\numsecentry#1#2#3#4{\dosecentry{#2\labelspace#1}{#4}} +\let\appsecentry=\numsecentry +\def\unnsecentry#1#2#3#4{\dosecentry{#1}{#4}} + +% Subsections. +\def\numsubsecentry#1#2#3#4{\dosubsecentry{#2\labelspace#1}{#4}} +\let\appsubsecentry=\numsubsecentry +\def\unnsubsecentry#1#2#3#4{\dosubsecentry{#1}{#4}} + +% And subsubsections. +\def\numsubsubsecentry#1#2#3#4{\dosubsubsecentry{#2\labelspace#1}{#4}} +\let\appsubsubsecentry=\numsubsubsecentry +\def\unnsubsubsecentry#1#2#3#4{\dosubsubsecentry{#1}{#4}} + +% This parameter controls the indentation of the various levels. +% Same as \defaultparindent. +\newdimen\tocindent \tocindent = 15pt + +% Now for the actual typesetting. In all these, #1 is the text and #2 is the +% page number. +% +% If the toc has to be broken over pages, we want it to be at chapters +% if at all possible; hence the \penalty. +\def\dochapentry#1#2{% + \penalty-300 \vskip1\baselineskip plus.33\baselineskip minus.25\baselineskip + \begingroup + \chapentryfonts + \tocentry{#1}{\dopageno\bgroup#2\egroup}% + \endgroup + \nobreak\vskip .25\baselineskip plus.1\baselineskip +} + +\def\dosecentry#1#2{\begingroup + \secentryfonts \leftskip=\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsecentry#1#2{\begingroup + \subsecentryfonts \leftskip=2\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +\def\dosubsubsecentry#1#2{\begingroup + \subsubsecentryfonts \leftskip=3\tocindent + \tocentry{#1}{\dopageno\bgroup#2\egroup}% +\endgroup} + +% We use the same \entry macro as for the index entries. +\let\tocentry = \entry + +% Space between chapter (or whatever) number and the title. +\def\labelspace{\hskip1em \relax} + +\def\dopageno#1{{\rm #1}} +\def\doshortpageno#1{{\rm #1}} + +\def\chapentryfonts{\secfonts \rm} +\def\secentryfonts{\textfonts} +\def\subsecentryfonts{\textfonts} +\def\subsubsecentryfonts{\textfonts} + + +\message{environments,} +% @foo ... @end foo. + +% @point{}, @result{}, @expansion{}, @print{}, @equiv{}. +% +% Since these characters are used in examples, it should be an even number of +% \tt widths. Each \tt character is 1en, so two makes it 1em. +% +\def\point{$\star$} +\def\result{\leavevmode\raise.15ex\hbox to 1em{\hfil$\Rightarrow$\hfil}} +\def\expansion{\leavevmode\raise.1ex\hbox to 1em{\hfil$\mapsto$\hfil}} +\def\print{\leavevmode\lower.1ex\hbox to 1em{\hfil$\dashv$\hfil}} +\def\equiv{\leavevmode\lower.1ex\hbox to 1em{\hfil$\ptexequiv$\hfil}} + +% The @error{} command. +% Adapted from the TeXbook's \boxit. +% +\newbox\errorbox +% +{\tentt \global\dimen0 = 3em}% Width of the box. +\dimen2 = .55pt % Thickness of rules +% The text. (`r' is open on the right, `e' somewhat less so on the left.) +\setbox0 = \hbox{\kern-.75pt \tensf error\kern-1.5pt} +% +\setbox\errorbox=\hbox to \dimen0{\hfil + \hsize = \dimen0 \advance\hsize by -5.8pt % Space to left+right. + \advance\hsize by -2\dimen2 % Rules. + \vbox{% + \hrule height\dimen2 + \hbox{\vrule width\dimen2 \kern3pt % Space to left of text. + \vtop{\kern2.4pt \box0 \kern2.4pt}% Space above/below. + \kern3pt\vrule width\dimen2}% Space to right. + \hrule height\dimen2} + \hfil} +% +\def\error{\leavevmode\lower.7ex\copy\errorbox} + +% @tex ... @end tex escapes into raw Tex temporarily. +% One exception: @ is still an escape character, so that @end tex works. +% But \@ or @@ will get a plain tex @ character. + +\envdef\tex{% + \catcode `\\=0 \catcode `\{=1 \catcode `\}=2 + \catcode `\$=3 \catcode `\&=4 \catcode `\#=6 + \catcode `\^=7 \catcode `\_=8 \catcode `\~=\active \let~=\tie + \catcode `\%=14 + \catcode `\+=\other + \catcode `\"=\other + \catcode `\|=\other + \catcode `\<=\other + \catcode `\>=\other + \escapechar=`\\ + % + \let\b=\ptexb + \let\bullet=\ptexbullet + \let\c=\ptexc + \let\,=\ptexcomma + \let\.=\ptexdot + \let\dots=\ptexdots + \let\equiv=\ptexequiv + \let\!=\ptexexclam + \let\i=\ptexi + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \let\{=\ptexlbrace + \let\+=\tabalign + \let\}=\ptexrbrace + \let\/=\ptexslash + \let\*=\ptexstar + \let\t=\ptext + \let\frenchspacing=\plainfrenchspacing + % + \def\endldots{\mathinner{\ldots\ldots\ldots\ldots}}% + \def\enddots{\relax\ifmmode\endldots\else$\mathsurround=0pt \endldots\,$\fi}% + \def\@{@}% +} +% There is no need to define \Etex. + +% Define @lisp ... @end lisp. +% @lisp environment forms a group so it can rebind things, +% including the definition of @end lisp (which normally is erroneous). + +% Amount to narrow the margins by for @lisp. +\newskip\lispnarrowing \lispnarrowing=0.4in + +% This is the definition that ^^M gets inside @lisp, @example, and other +% such environments. \null is better than a space, since it doesn't +% have any width. +\def\lisppar{\null\endgraf} + +% This space is always present above and below environments. +\newskip\envskipamount \envskipamount = 0pt + +% Make spacing and below environment symmetrical. We use \parskip here +% to help in doing that, since in @example-like environments \parskip +% is reset to zero; thus the \afterenvbreak inserts no space -- but the +% start of the next paragraph will insert \parskip. +% +\def\aboveenvbreak{{% + % =10000 instead of <10000 because of a special case in \itemzzz and + % \sectionheading, q.v. + \ifnum \lastpenalty=10000 \else + \advance\envskipamount by \parskip + \endgraf + \ifdim\lastskip<\envskipamount + \removelastskip + % it's not a good place to break if the last penalty was \nobreak + % or better ... + \ifnum\lastpenalty<10000 \penalty-50 \fi + \vskip\envskipamount + \fi + \fi +}} + +\let\afterenvbreak = \aboveenvbreak + +% \nonarrowing is a flag. If "set", @lisp etc don't narrow margins; it will +% also clear it, so that its embedded environments do the narrowing again. +\let\nonarrowing=\relax + +% @cartouche ... @end cartouche: draw rectangle w/rounded corners around +% environment contents. +\font\circle=lcircle10 +\newdimen\circthick +\newdimen\cartouter\newdimen\cartinner +\newskip\normbskip\newskip\normpskip\newskip\normlskip +\circthick=\fontdimen8\circle +% +\def\ctl{{\circle\char'013\hskip -6pt}}% 6pt from pl file: 1/2charwidth +\def\ctr{{\hskip 6pt\circle\char'010}} +\def\cbl{{\circle\char'012\hskip -6pt}} +\def\cbr{{\hskip 6pt\circle\char'011}} +\def\carttop{\hbox to \cartouter{\hskip\lskip + \ctl\leaders\hrule height\circthick\hfil\ctr + \hskip\rskip}} +\def\cartbot{\hbox to \cartouter{\hskip\lskip + \cbl\leaders\hrule height\circthick\hfil\cbr + \hskip\rskip}} +% +\newskip\lskip\newskip\rskip + +\envdef\cartouche{% + \ifhmode\par\fi % can't be in the midst of a paragraph. + \startsavinginserts + \lskip=\leftskip \rskip=\rightskip + \leftskip=0pt\rightskip=0pt % we want these *outside*. + \cartinner=\hsize \advance\cartinner by-\lskip + \advance\cartinner by-\rskip + \cartouter=\hsize + \advance\cartouter by 18.4pt % allow for 3pt kerns on either + % side, and for 6pt waste from + % each corner char, and rule thickness + \normbskip=\baselineskip \normpskip=\parskip \normlskip=\lineskip + % Flag to tell @lisp, etc., not to narrow margin. + \let\nonarrowing = t% + \vbox\bgroup + \baselineskip=0pt\parskip=0pt\lineskip=0pt + \carttop + \hbox\bgroup + \hskip\lskip + \vrule\kern3pt + \vbox\bgroup + \kern3pt + \hsize=\cartinner + \baselineskip=\normbskip + \lineskip=\normlskip + \parskip=\normpskip + \vskip -\parskip + \comment % For explanation, see the end of \def\group. +} +\def\Ecartouche{% + \ifhmode\par\fi + \kern3pt + \egroup + \kern3pt\vrule + \hskip\rskip + \egroup + \cartbot + \egroup + \checkinserts +} + + +% This macro is called at the beginning of all the @example variants, +% inside a group. +\def\nonfillstart{% + \aboveenvbreak + \hfuzz = 12pt % Don't be fussy + \sepspaces % Make spaces be word-separators rather than space tokens. + \let\par = \lisppar % don't ignore blank lines + \obeylines % each line of input is a line of output + \parskip = 0pt + \parindent = 0pt + \emergencystretch = 0pt % don't try to avoid overfull boxes + \ifx\nonarrowing\relax + \advance \leftskip by \lispnarrowing + \exdentamount=\lispnarrowing + \else + \let\nonarrowing = \relax + \fi + \let\exdent=\nofillexdent +} + +% If you want all examples etc. small: @set dispenvsize small. +% If you want even small examples the full size: @set dispenvsize nosmall. +% This affects the following displayed environments: +% @example, @display, @format, @lisp +% +\def\smallword{small} +\def\nosmallword{nosmall} +\let\SETdispenvsize\relax +\def\setnormaldispenv{% + \ifx\SETdispenvsize\smallword + \smallexamplefonts \rm + \fi +} +\def\setsmalldispenv{% + \ifx\SETdispenvsize\nosmallword + \else + \smallexamplefonts \rm + \fi +} + +% We often define two environments, @foo and @smallfoo. +% Let's do it by one command: +\def\makedispenv #1#2{ + \expandafter\envdef\csname#1\endcsname {\setnormaldispenv #2} + \expandafter\envdef\csname small#1\endcsname {\setsmalldispenv #2} + \expandafter\let\csname E#1\endcsname \afterenvbreak + \expandafter\let\csname Esmall#1\endcsname \afterenvbreak +} + +% Define two synonyms: +\def\maketwodispenvs #1#2#3{ + \makedispenv{#1}{#3} + \makedispenv{#2}{#3} +} + +% @lisp: indented, narrowed, typewriter font; @example: same as @lisp. +% +% @smallexample and @smalllisp: use smaller fonts. +% Originally contributed by Pavel@xerox. +% +\maketwodispenvs {lisp}{example}{% + \nonfillstart + \tt + \let\kbdfont = \kbdexamplefont % Allow @kbd to do something special. + \gobble % eat return +} + +% @display/@smalldisplay: same as @lisp except keep current font. +% +\makedispenv {display}{% + \nonfillstart + \gobble +} + +% @format/@smallformat: same as @display except don't narrow margins. +% +\makedispenv{format}{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} + +% @flushleft: same as @format, but doesn't obey \SETdispenvsize. +\envdef\flushleft{% + \let\nonarrowing = t% + \nonfillstart + \gobble +} +\let\Eflushleft = \afterenvbreak + +% @flushright. +% +\envdef\flushright{% + \let\nonarrowing = t% + \nonfillstart + \advance\leftskip by 0pt plus 1fill + \gobble +} +\let\Eflushright = \afterenvbreak + + +% @quotation does normal linebreaking (hence we can't use \nonfillstart) +% and narrows the margins. We keep \parskip nonzero in general, since +% we're doing normal filling. So, when using \aboveenvbreak and +% \afterenvbreak, temporarily make \parskip 0. +% +\envdef\quotation{% + {\parskip=0pt \aboveenvbreak}% because \aboveenvbreak inserts \parskip + \parindent=0pt + % + % @cartouche defines \nonarrowing to inhibit narrowing at next level down. + \ifx\nonarrowing\relax + \advance\leftskip by \lispnarrowing + \advance\rightskip by \lispnarrowing + \exdentamount = \lispnarrowing + \else + \let\nonarrowing = \relax + \fi + \parsearg\quotationlabel +} + +% We have retained a nonzero parskip for the environment, since we're +% doing normal filling. +% +\def\Equotation{% + \par + \ifx\quotationauthor\undefined\else + % indent a bit. + \leftline{\kern 2\leftskip \sl ---\quotationauthor}% + \fi + {\parskip=0pt \afterenvbreak}% +} + +% If we're given an argument, typeset it in bold with a colon after. +\def\quotationlabel#1{% + \def\temp{#1}% + \ifx\temp\empty \else + {\bf #1: }% + \fi +} + + +% LaTeX-like @verbatim...@end verbatim and @verb{...} +% If we want to allow any as delimiter, +% we need the curly braces so that makeinfo sees the @verb command, eg: +% `@verbx...x' would look like the '@verbx' command. --janneke@gnu.org +% +% [Knuth]: Donald Ervin Knuth, 1996. The TeXbook. +% +% [Knuth] p.344; only we need to do the other characters Texinfo sets +% active too. Otherwise, they get lost as the first character on a +% verbatim line. +\def\dospecials{% + \do\ \do\\\do\{\do\}\do\$\do\&% + \do\#\do\^\do\^^K\do\_\do\^^A\do\%\do\~% + \do\<\do\>\do\|\do\@\do+\do\"% +} +% +% [Knuth] p. 380 +\def\uncatcodespecials{% + \def\do##1{\catcode`##1=\other}\dospecials} +% +% [Knuth] pp. 380,381,391 +% Disable Spanish ligatures ?` and !` of \tt font +\begingroup + \catcode`\`=\active\gdef`{\relax\lq} +\endgroup +% +% Setup for the @verb command. +% +% Eight spaces for a tab +\begingroup + \catcode`\^^I=\active + \gdef\tabeightspaces{\catcode`\^^I=\active\def^^I{\ \ \ \ \ \ \ \ }} +\endgroup +% +\def\setupverb{% + \tt % easiest (and conventionally used) font for verbatim + \def\par{\leavevmode\endgraf}% + \catcode`\`=\active + \tabeightspaces + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces +} + +% Setup for the @verbatim environment +% +% Real tab expansion +\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount +% +\def\starttabbox{\setbox0=\hbox\bgroup} +\begingroup + \catcode`\^^I=\active + \gdef\tabexpand{% + \catcode`\^^I=\active + \def^^I{\leavevmode\egroup + \dimen0=\wd0 % the width so far, or since the previous tab + \divide\dimen0 by\tabw + \multiply\dimen0 by\tabw % compute previous multiple of \tabw + \advance\dimen0 by\tabw % advance to next multiple of \tabw + \wd0=\dimen0 \box0 \starttabbox + }% + } +\endgroup +\def\setupverbatim{% + \let\nonarrowing = t% + \nonfillstart + % Easiest (and conventionally used) font for verbatim + \tt + \def\par{\leavevmode\egroup\box0\endgraf}% + \catcode`\`=\active + \tabexpand + % Respect line breaks, + % print special symbols as themselves, and + % make each space count + % must do in this order: + \obeylines \uncatcodespecials \sepspaces + \everypar{\starttabbox}% +} + +% Do the @verb magic: verbatim text is quoted by unique +% delimiter characters. Before first delimiter expect a +% right brace, after last delimiter expect closing brace: +% +% \def\doverb'{'#1'}'{#1} +% +% [Knuth] p. 382; only eat outer {} +\begingroup + \catcode`[=1\catcode`]=2\catcode`\{=\other\catcode`\}=\other + \gdef\doverb{#1[\def\next##1#1}[##1\endgroup]\next] +\endgroup +% +\def\verb{\begingroup\setupverb\doverb} +% +% +% Do the @verbatim magic: define the macro \doverbatim so that +% the (first) argument ends when '@end verbatim' is reached, ie: +% +% \def\doverbatim#1@end verbatim{#1} +% +% For Texinfo it's a lot easier than for LaTeX, +% because texinfo's \verbatim doesn't stop at '\end{verbatim}': +% we need not redefine '\', '{' and '}'. +% +% Inspired by LaTeX's verbatim command set [latex.ltx] +% +\begingroup + \catcode`\ =\active + \obeylines % + % ignore everything up to the first ^^M, that's the newline at the end + % of the @verbatim input line itself. Otherwise we get an extra blank + % line in the output. + \xdef\doverbatim#1^^M#2@end verbatim{#2\noexpand\end\gobble verbatim}% + % We really want {...\end verbatim} in the body of the macro, but + % without the active space; thus we have to use \xdef and \gobble. +\endgroup +% +\envdef\verbatim{% + \setupverbatim\doverbatim +} +\let\Everbatim = \afterenvbreak + + +% @verbatiminclude FILE - insert text of file in verbatim environment. +% +\def\verbatiminclude{\parseargusing\filenamecatcodes\doverbatiminclude} +% +\def\doverbatiminclude#1{% + {% + \makevalueexpandable + \setupverbatim + \input #1 + \afterenvbreak + }% +} + +% @copying ... @end copying. +% Save the text away for @insertcopying later. +% +% We save the uninterpreted tokens, rather than creating a box. +% Saving the text in a box would be much easier, but then all the +% typesetting commands (@smallbook, font changes, etc.) have to be done +% beforehand -- and a) we want @copying to be done first in the source +% file; b) letting users define the frontmatter in as flexible order as +% possible is very desirable. +% +\def\copying{\checkenv{}\begingroup\scanargctxt\docopying} +\def\docopying#1@end copying{\endgroup\def\copyingtext{#1}} +% +\def\insertcopying{% + \begingroup + \parindent = 0pt % paragraph indentation looks wrong on title page + \scanexp\copyingtext + \endgroup +} + +\message{defuns,} +% @defun etc. + +\newskip\defbodyindent \defbodyindent=.4in +\newskip\defargsindent \defargsindent=50pt +\newskip\deflastargmargin \deflastargmargin=18pt + +% Start the processing of @deffn: +\def\startdefun{% + \ifnum\lastpenalty<10000 + \medbreak + \else + % If there are two @def commands in a row, we'll have a \nobreak, + % which is there to keep the function description together with its + % header. But if there's nothing but headers, we need to allow a + % break somewhere. Check specifically for penalty 10002, inserted + % by \defargscommonending, instead of 10000, since the sectioning + % commands also insert a nobreak penalty, and we don't want to allow + % a break between a section heading and a defun. + % + \ifnum\lastpenalty=10002 \penalty2000 \fi + % + % Similarly, after a section heading, do not allow a break. + % But do insert the glue. + \medskip % preceded by discardable penalty, so not a breakpoint + \fi + % + \parindent=0in + \advance\leftskip by \defbodyindent + \exdentamount=\defbodyindent +} + +\def\dodefunx#1{% + % First, check whether we are in the right environment: + \checkenv#1% + % + % As above, allow line break if we have multiple x headers in a row. + % It's not a great place, though. + \ifnum\lastpenalty=10002 \penalty3000 \fi + % + % And now, it's time to reuse the body of the original defun: + \expandafter\gobbledefun#1% +} +\def\gobbledefun#1\startdefun{} + +% \printdefunline \deffnheader{text} +% +\def\printdefunline#1#2{% + \begingroup + % call \deffnheader: + #1#2 \endheader + % common ending: + \interlinepenalty = 10000 + \advance\rightskip by 0pt plus 1fil + \endgraf + \nobreak\vskip -\parskip + \penalty 10002 % signal to \startdefun and \dodefunx + % Some of the @defun-type tags do not enable magic parentheses, + % rendering the following check redundant. But we don't optimize. + \checkparencounts + \endgroup +} + +\def\Edefun{\endgraf\medbreak} + +% \makedefun{deffn} creates \deffn, \deffnx and \Edeffn; +% the only thing remainnig is to define \deffnheader. +% +\def\makedefun#1{% + \expandafter\let\csname E#1\endcsname = \Edefun + \edef\temp{\noexpand\domakedefun + \makecsname{#1}\makecsname{#1x}\makecsname{#1header}}% + \temp +} + +% \domakedefun \deffn \deffnx \deffnheader +% +% Define \deffn and \deffnx, without parameters. +% \deffnheader has to be defined explicitly. +% +\def\domakedefun#1#2#3{% + \envdef#1{% + \startdefun + \parseargusing\activeparens{\printdefunline#3}% + }% + \def#2{\dodefunx#1}% + \def#3% +} + +%%% Untyped functions: + +% @deffn category name args +\makedefun{deffn}{\deffngeneral{}} + +% @deffn category class name args +\makedefun{defop}#1 {\defopon{#1\ \putwordon}} + +% \defopon {category on}class name args +\def\defopon#1#2 {\deffngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deffngeneral {subind}category name args +% +\def\deffngeneral#1#2 #3 #4\endheader{% + % Remember that \dosubind{fn}{foo}{} is equivalent to \doind{fn}{foo}. + \dosubind{fn}{\code{#3}}{#1}% + \defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}% +} + +%%% Typed functions: + +% @deftypefn category type name args +\makedefun{deftypefn}{\deftypefngeneral{}} + +% @deftypeop category class type name args +\makedefun{deftypeop}#1 {\deftypeopon{#1\ \putwordon}} + +% \deftypeopon {category on}class type name args +\def\deftypeopon#1#2 {\deftypefngeneral{\putwordon\ \code{#2}}{#1\ \code{#2}} } + +% \deftypefngeneral {subind}category type name args +% +\def\deftypefngeneral#1#2 #3 #4 #5\endheader{% + \dosubind{fn}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Typed variables: + +% @deftypevr category type var args +\makedefun{deftypevr}{\deftypecvgeneral{}} + +% @deftypecv category class type var args +\makedefun{deftypecv}#1 {\deftypecvof{#1\ \putwordof}} + +% \deftypecvof {category of}class type var args +\def\deftypecvof#1#2 {\deftypecvgeneral{\putwordof\ \code{#2}}{#1\ \code{#2}} } + +% \deftypecvgeneral {subind}category type var args +% +\def\deftypecvgeneral#1#2 #3 #4 #5\endheader{% + \dosubind{vr}{\code{#4}}{#1}% + \defname{#2}{#3}{#4}\defunargs{#5\unskip}% +} + +%%% Untyped variables: + +% @defvr category var args +\makedefun{defvr}#1 {\deftypevrheader{#1} {} } + +% @defcv category class var args +\makedefun{defcv}#1 {\defcvof{#1\ \putwordof}} + +% \defcvof {category of}class var args +\def\defcvof#1#2 {\deftypecvof{#1}#2 {} } + +%%% Type: +% @deftp category name args +\makedefun{deftp}#1 #2 #3\endheader{% + \doind{tp}{\code{#2}}% + \defname{#1}{}{#2}\defunargs{#3\unskip}% +} + +% Remaining @defun-like shortcuts: +\makedefun{defun}{\deffnheader{\putwordDeffunc} } +\makedefun{defmac}{\deffnheader{\putwordDefmac} } +\makedefun{defspec}{\deffnheader{\putwordDefspec} } +\makedefun{deftypefun}{\deftypefnheader{\putwordDeffunc} } +\makedefun{defvar}{\defvrheader{\putwordDefvar} } +\makedefun{defopt}{\defvrheader{\putwordDefopt} } +\makedefun{deftypevar}{\deftypevrheader{\putwordDefvar} } +\makedefun{defmethod}{\defopon\putwordMethodon} +\makedefun{deftypemethod}{\deftypeopon\putwordMethodon} +\makedefun{defivar}{\defcvof\putwordInstanceVariableof} +\makedefun{deftypeivar}{\deftypecvof\putwordInstanceVariableof} + +% \defname, which formats the name of the @def (not the args). +% #1 is the category, such as "Function". +% #2 is the return type, if any. +% #3 is the function name. +% +% We are followed by (but not passed) the arguments, if any. +% +\def\defname#1#2#3{% + % Get the values of \leftskip and \rightskip as they were outside the @def... + \advance\leftskip by -\defbodyindent + % + % How we'll format the type name. Putting it in brackets helps + % distinguish it from the body text that may end up on the next line + % just below it. + \def\temp{#1}% + \setbox0=\hbox{\kern\deflastargmargin \ifx\temp\empty\else [\rm\temp]\fi} + % + % Figure out line sizes for the paragraph shape. + % The first line needs space for \box0; but if \rightskip is nonzero, + % we need only space for the part of \box0 which exceeds it: + \dimen0=\hsize \advance\dimen0 by -\wd0 \advance\dimen0 by \rightskip + % The continuations: + \dimen2=\hsize \advance\dimen2 by -\defargsindent + % (plain.tex says that \dimen1 should be used only as global.) + \parshape 2 0in \dimen0 \defargsindent \dimen2 + % + % Put the type name to the right margin. + \noindent + \hbox to 0pt{% + \hfil\box0 \kern-\hsize + % \hsize has to be shortened this way: + \kern\leftskip + % Intentionally do not respect \rightskip, since we need the space. + }% + % + % Allow all lines to be underfull without complaint: + \tolerance=10000 \hbadness=10000 + \exdentamount=\defbodyindent + {% + % defun fonts. We use typewriter by default (used to be bold) because: + % . we're printing identifiers, they should be in tt in principle. + % . in languages with many accents, such as Czech or French, it's + % common to leave accents off identifiers. The result looks ok in + % tt, but exceedingly strange in rm. + % . we don't want -- and --- to be treated as ligatures. + % . this still does not fix the ?` and !` ligatures, but so far no + % one has made identifiers using them :). + \df \tt + \def\temp{#2}% return value type + \ifx\temp\empty\else \tclose{\temp} \fi + #3% output function name + }% + {\rm\enskip}% hskip 0.5 em of \tenrm + % + \boldbrax + % arguments will be output next, if any. +} + +% Print arguments in slanted roman (not ttsl), inconsistently with using +% tt for the name. This is because literal text is sometimes needed in +% the argument list (groff manual), and ttsl and tt are not very +% distinguishable. Prevent hyphenation at `-' chars. +% +\def\defunargs#1{% + % use sl by default (not ttsl), + % tt for the names. + \df \sl \hyphenchar\font=0 + % + % On the other hand, if an argument has two dashes (for instance), we + % want a way to get ttsl. Let's try @var for that. + \let\var=\ttslanted + #1% + \sl\hyphenchar\font=45 +} + +% We want ()&[] to print specially on the defun line. +% +\def\activeparens{% + \catcode`\(=\active \catcode`\)=\active + \catcode`\[=\active \catcode`\]=\active + \catcode`\&=\active +} + +% Make control sequences which act like normal parenthesis chars. +\let\lparen = ( \let\rparen = ) + +% Be sure that we always have a definition for `(', etc. For example, +% if the fn name has parens in it, \boldbrax will not be in effect yet, +% so TeX would otherwise complain about undefined control sequence. +{ + \activeparens + \global\let(=\lparen \global\let)=\rparen + \global\let[=\lbrack \global\let]=\rbrack + \global\let& = \& + + \gdef\boldbrax{\let(=\opnr\let)=\clnr\let[=\lbrb\let]=\rbrb} + \gdef\magicamp{\let&=\amprm} +} + +\newcount\parencount + +% If we encounter &foo, then turn on ()-hacking afterwards +\newif\ifampseen +\def\amprm#1 {\ampseentrue{\bf\ }} + +\def\parenfont{% + \ifampseen + % At the first level, print parens in roman, + % otherwise use the default font. + \ifnum \parencount=1 \rm \fi + \else + % The \sf parens (in \boldbrax) actually are a little bolder than + % the contained text. This is especially needed for [ and ] . + \sf + \fi +} +\def\infirstlevel#1{% + \ifampseen + \ifnum\parencount=1 + #1% + \fi + \fi +} +\def\bfafterword#1 {#1 \bf} + +\def\opnr{% + \global\advance\parencount by 1 + {\parenfont(}% + \infirstlevel \bfafterword +} +\def\clnr{% + {\parenfont)}% + \infirstlevel \sl + \global\advance\parencount by -1 +} + +\newcount\brackcount +\def\lbrb{% + \global\advance\brackcount by 1 + {\bf[}% +} +\def\rbrb{% + {\bf]}% + \global\advance\brackcount by -1 +} + +\def\checkparencounts{% + \ifnum\parencount=0 \else \badparencount \fi + \ifnum\brackcount=0 \else \badbrackcount \fi +} +\def\badparencount{% + \errmessage{Unbalanced parentheses in @def}% + \global\parencount=0 +} +\def\badbrackcount{% + \errmessage{Unbalanced square braces in @def}% + \global\brackcount=0 +} + + +\message{macros,} +% @macro. + +% To do this right we need a feature of e-TeX, \scantokens, +% which we arrange to emulate with a temporary file in ordinary TeX. +\ifx\eTeXversion\undefined + \newwrite\macscribble + \def\scantokens#1{% + \toks0={#1}% + \immediate\openout\macscribble=\jobname.tmp + \immediate\write\macscribble{\the\toks0}% + \immediate\closeout\macscribble + \input \jobname.tmp + } +\fi + +\def\scanmacro#1{% + \begingroup + \newlinechar`\^^M + \let\xeatspaces\eatspaces + % Undo catcode changes of \startcontents and \doprintindex + % When called from @insertcopying or (short)caption, we need active + % backslash to get it printed correctly. Previously, we had + % \catcode`\\=\other instead. We'll see whether a problem appears + % with macro expansion. --kasal, 19aug04 + \catcode`\@=0 \catcode`\\=\active \escapechar=`\@ + % ... and \example + \spaceisspace + % + % Append \endinput to make sure that TeX does not see the ending newline. + % + % I've verified that it is necessary both for e-TeX and for ordinary TeX + % --kasal, 29nov03 + \scantokens{#1\endinput}% + \endgroup +} + +\def\scanexp#1{% + \edef\temp{\noexpand\scanmacro{#1}}% + \temp +} + +\newcount\paramno % Count of parameters +\newtoks\macname % Macro name +\newif\ifrecursive % Is it recursive? + +% List of all defined macros in the form +% \definedummyword\macro1\definedummyword\macro2... +% Currently is also contains all @aliases; the list can be split +% if there is a need. +\def\macrolist{} + +% Add the macro to \macrolist +\def\addtomacrolist#1{\expandafter \addtomacrolistxxx \csname#1\endcsname} +\def\addtomacrolistxxx#1{% + \toks0 = \expandafter{\macrolist\definedummyword#1}% + \xdef\macrolist{\the\toks0}% +} + +% Utility routines. +% This does \let #1 = #2, with \csnames; that is, +% \let \csname#1\endcsname = \csname#2\endcsname +% (except of course we have to play expansion games). +% +\def\cslet#1#2{% + \expandafter\let + \csname#1\expandafter\endcsname + \csname#2\endcsname +} + +% Trim leading and trailing spaces off a string. +% Concepts from aro-bend problem 15 (see CTAN). +{\catcode`\@=11 +\gdef\eatspaces #1{\expandafter\trim@\expandafter{#1 }} +\gdef\trim@ #1{\trim@@ @#1 @ #1 @ @@} +\gdef\trim@@ #1@ #2@ #3@@{\trim@@@\empty #2 @} +\def\unbrace#1{#1} +\unbrace{\gdef\trim@@@ #1 } #2@{#1} +} + +% Trim a single trailing ^^M off a string. +{\catcode`\^^M=\other \catcode`\Q=3% +\gdef\eatcr #1{\eatcra #1Q^^MQ}% +\gdef\eatcra#1^^MQ{\eatcrb#1Q}% +\gdef\eatcrb#1Q#2Q{#1}% +} + +% Macro bodies are absorbed as an argument in a context where +% all characters are catcode 10, 11 or 12, except \ which is active +% (as in normal texinfo). It is necessary to change the definition of \. + +% It's necessary to have hard CRs when the macro is executed. This is +% done by making ^^M (\endlinechar) catcode 12 when reading the macro +% body, and then making it the \newlinechar in \scanmacro. + +\def\scanctxt{% + \catcode`\"=\other + \catcode`\+=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\@=\other + \catcode`\^=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\~=\other +} + +\def\scanargctxt{% + \scanctxt + \catcode`\\=\other + \catcode`\^^M=\other +} + +\def\macrobodyctxt{% + \scanctxt + \catcode`\{=\other + \catcode`\}=\other + \catcode`\^^M=\other + \usembodybackslash +} + +\def\macroargctxt{% + \scanctxt + \catcode`\\=\other +} + +% \mbodybackslash is the definition of \ in @macro bodies. +% It maps \foo\ => \csname macarg.foo\endcsname => #N +% where N is the macro parameter number. +% We define \csname macarg.\endcsname to be \realbackslash, so +% \\ in macro replacement text gets you a backslash. + +{\catcode`@=0 @catcode`@\=@active + @gdef@usembodybackslash{@let\=@mbodybackslash} + @gdef@mbodybackslash#1\{@csname macarg.#1@endcsname} +} +\expandafter\def\csname macarg.\endcsname{\realbackslash} + +\def\macro{\recursivefalse\parsearg\macroxxx} +\def\rmacro{\recursivetrue\parsearg\macroxxx} + +\def\macroxxx#1{% + \getargs{#1}% now \macname is the macname and \argl the arglist + \ifx\argl\empty % no arguments + \paramno=0% + \else + \expandafter\parsemargdef \argl;% + \fi + \if1\csname ismacro.\the\macname\endcsname + \message{Warning: redefining \the\macname}% + \else + \expandafter\ifx\csname \the\macname\endcsname \relax + \else \errmessage{Macro name \the\macname\space already defined}\fi + \global\cslet{macsave.\the\macname}{\the\macname}% + \global\expandafter\let\csname ismacro.\the\macname\endcsname=1% + \addtomacrolist{\the\macname}% + \fi + \begingroup \macrobodyctxt + \ifrecursive \expandafter\parsermacbody + \else \expandafter\parsemacbody + \fi} + +\parseargdef\unmacro{% + \if1\csname ismacro.#1\endcsname + \global\cslet{#1}{macsave.#1}% + \global\expandafter\let \csname ismacro.#1\endcsname=0% + % Remove the macro name from \macrolist: + \begingroup + \expandafter\let\csname#1\endcsname \relax + \let\definedummyword\unmacrodo + \xdef\macrolist{\macrolist}% + \endgroup + \else + \errmessage{Macro #1 not defined}% + \fi +} + +% Called by \do from \dounmacro on each macro. The idea is to omit any +% macro definitions that have been changed to \relax. +% +\def\unmacrodo#1{% + \ifx #1\relax + % remove this + \else + \noexpand\definedummyword \noexpand#1% + \fi +} + +% This makes use of the obscure feature that if the last token of a +% is #, then the preceding argument is delimited by +% an opening brace, and that opening brace is not consumed. +\def\getargs#1{\getargsxxx#1{}} +\def\getargsxxx#1#{\getmacname #1 \relax\getmacargs} +\def\getmacname #1 #2\relax{\macname={#1}} +\def\getmacargs#1{\def\argl{#1}} + +% Parse the optional {params} list. Set up \paramno and \paramlist +% so \defmacro knows what to do. Define \macarg.blah for each blah +% in the params list, to be ##N where N is the position in that list. +% That gets used by \mbodybackslash (above). + +% We need to get `macro parameter char #' into several definitions. +% The technique used is stolen from LaTeX: let \hash be something +% unexpandable, insert that wherever you need a #, and then redefine +% it to # just before using the token list produced. +% +% The same technique is used to protect \eatspaces till just before +% the macro is used. + +\def\parsemargdef#1;{\paramno=0\def\paramlist{}% + \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,} +\def\parsemargdefxxx#1,{% + \if#1;\let\next=\relax + \else \let\next=\parsemargdefxxx + \advance\paramno by 1% + \expandafter\edef\csname macarg.\eatspaces{#1}\endcsname + {\xeatspaces{\hash\the\paramno}}% + \edef\paramlist{\paramlist\hash\the\paramno,}% + \fi\next} + +% These two commands read recursive and nonrecursive macro bodies. +% (They're different since rec and nonrec macros end differently.) + +\long\def\parsemacbody#1@end macro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% +\long\def\parsermacbody#1@end rmacro% +{\xdef\temp{\eatcr{#1}}\endgroup\defmacro}% + +% This defines the macro itself. There are six cases: recursive and +% nonrecursive macros of zero, one, and many arguments. +% Much magic with \expandafter here. +% \xdef is used so that macro definitions will survive the file +% they're defined in; @include reads the file inside a group. +\def\defmacro{% + \let\hash=##% convert placeholders to macro parameter chars + \ifrecursive + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\scanmacro{\temp}}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup\noexpand\scanmacro{\temp}}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{\egroup\noexpand\scanmacro{\temp}}% + \fi + \else + \ifcase\paramno + % 0 + \expandafter\xdef\csname\the\macname\endcsname{% + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \or % 1 + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \noexpand\braceorline + \expandafter\noexpand\csname\the\macname xxx\endcsname}% + \expandafter\xdef\csname\the\macname xxx\endcsname##1{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \else % many + \expandafter\xdef\csname\the\macname\endcsname{% + \bgroup\noexpand\macroargctxt + \expandafter\noexpand\csname\the\macname xx\endcsname}% + \expandafter\xdef\csname\the\macname xx\endcsname##1{% + \expandafter\noexpand\csname\the\macname xxx\endcsname ##1,}% + \expandafter\expandafter + \expandafter\xdef + \expandafter\expandafter + \csname\the\macname xxx\endcsname + \paramlist{% + \egroup + \noexpand\norecurse{\the\macname}% + \noexpand\scanmacro{\temp}\egroup}% + \fi + \fi} + +\def\norecurse#1{\bgroup\cslet{#1}{macsave.#1}} + +% \braceorline decides whether the next nonwhitespace character is a +% {. If so it reads up to the closing }, if not, it reads the whole +% line. Whatever was read is then fed to the next control sequence +% as an argument (by \parsebrace or \parsearg) +\def\braceorline#1{\let\next=#1\futurelet\nchar\braceorlinexxx} +\def\braceorlinexxx{% + \ifx\nchar\bgroup\else + \expandafter\parsearg + \fi \next} + + +% @alias. +% We need some trickery to remove the optional spaces around the equal +% sign. Just make them active and then expand them all to nothing. +\def\alias{\parseargusing\obeyspaces\aliasxxx} +\def\aliasxxx #1{\aliasyyy#1\relax} +\def\aliasyyy #1=#2\relax{% + {% + \expandafter\let\obeyedspace=\empty + \addtomacrolist{#1}% + \xdef\next{\global\let\makecsname{#1}=\makecsname{#2}}% + }% + \next +} + + +\message{cross references,} + +\newwrite\auxfile + +\newif\ifhavexrefs % True if xref values are known. +\newif\ifwarnedxrefs % True if we warned once that they aren't known. + +% @inforef is relatively simple. +\def\inforef #1{\inforefzzz #1,,,,**} +\def\inforefzzz #1,#2,#3,#4**{\putwordSee{} \putwordInfo{} \putwordfile{} \file{\ignorespaces #3{}}, + node \samp{\ignorespaces#1{}}} + +% @node's only job in TeX is to define \lastnode, which is used in +% cross-references. The @node line might or might not have commas, and +% might or might not have spaces before the first comma, like: +% @node foo , bar , ... +% We don't want such trailing spaces in the node name. +% +\parseargdef\node{\checkenv{}\donode #1 ,\finishnodeparse} +% +% also remove a trailing comma, in case of something like this: +% @node Help-Cross, , , Cross-refs +\def\donode#1 ,#2\finishnodeparse{\dodonode #1,\finishnodeparse} +\def\dodonode#1,#2\finishnodeparse{\gdef\lastnode{#1}} + +\let\nwnode=\node +\let\lastnode=\empty + +% Write a cross-reference definition for the current node. #1 is the +% type (Ynumbered, Yappendix, Ynothing). +% +\def\donoderef#1{% + \ifx\lastnode\empty\else + \setref{\lastnode}{#1}% + \global\let\lastnode=\empty + \fi +} + +% @anchor{NAME} -- define xref target at arbitrary point. +% +\newcount\savesfregister +% +\def\savesf{\relax \ifhmode \savesfregister=\spacefactor \fi} +\def\restoresf{\relax \ifhmode \spacefactor=\savesfregister \fi} +\def\anchor#1{\savesf \setref{#1}{Ynothing}\restoresf \ignorespaces} + +% \setref{NAME}{SNT} defines a cross-reference point NAME (a node or an +% anchor), which consists of three parts: +% 1) NAME-title - the current sectioning name taken from \thissection, +% or the anchor name. +% 2) NAME-snt - section number and type, passed as the SNT arg, or +% empty for anchors. +% 3) NAME-pg - the page number. +% +% This is called from \donoderef, \anchor, and \dofloat. In the case of +% floats, there is an additional part, which is not written here: +% 4) NAME-lof - the text as it should appear in a @listoffloats. +% +\def\setref#1#2{% + \pdfmkdest{#1}% + \iflinks + {% + \atdummies % preserve commands, but don't expand them + \edef\writexrdef##1##2{% + \write\auxfile{@xrdef{#1-% #1 of \setref, expanded by the \edef + ##1}{##2}}% these are parameters of \writexrdef + }% + \toks0 = \expandafter{\thissection}% + \immediate \writexrdef{title}{\the\toks0 }% + \immediate \writexrdef{snt}{\csname #2\endcsname}% \Ynumbered etc. + \writexrdef{pg}{\folio}% will be written later, during \shipout + }% + \fi +} + +% @xref, @pxref, and @ref generate cross-references. For \xrefX, #1 is +% the node name, #2 the name of the Info cross-reference, #3 the printed +% node name, #4 the name of the Info file, #5 the name of the printed +% manual. All but the node name can be omitted. +% +\def\pxref#1{\putwordsee{} \xrefX[#1,,,,,,,]} +\def\xref#1{\putwordSee{} \xrefX[#1,,,,,,,]} +\def\ref#1{\xrefX[#1,,,,,,,]} +\def\xrefX[#1,#2,#3,#4,#5,#6]{\begingroup + \unsepspaces + \def\printedmanual{\ignorespaces #5}% + \def\printedrefname{\ignorespaces #3}% + \setbox1=\hbox{\printedmanual\unskip}% + \setbox0=\hbox{\printedrefname\unskip}% + \ifdim \wd0 = 0pt + % No printed node name was explicitly given. + \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax + % Use the node name inside the square brackets. + \def\printedrefname{\ignorespaces #1}% + \else + % Use the actual chapter/section title appear inside + % the square brackets. Use the real section title if we have it. + \ifdim \wd1 > 0pt + % It is in another manual, so we don't have it. + \def\printedrefname{\ignorespaces #1}% + \else + \ifhavexrefs + % We know the real title if we have the xref values. + \def\printedrefname{\refx{#1-title}{}}% + \else + % Otherwise just copy the Info node name. + \def\printedrefname{\ignorespaces #1}% + \fi% + \fi + \fi + \fi + % + % Make link in pdf output. + \ifpdf + \leavevmode + \getfilename{#4}% + {\turnoffactive + % See comments at \activebackslashdouble. + {\activebackslashdouble \xdef\pdfxrefdest{#1}% + \backslashparens\pdfxrefdest}% + % + \ifnum\filenamelength>0 + \startlink attr{/Border [0 0 0]}% + goto file{\the\filename.pdf} name{\pdfxrefdest}% + \else + \startlink attr{/Border [0 0 0]}% + goto name{\pdfmkpgn{\pdfxrefdest}}% + \fi + }% + \linkcolor + \fi + % + % Float references are printed completely differently: "Figure 1.2" + % instead of "[somenode], p.3". We distinguish them by the + % LABEL-title being set to a magic string. + {% + % Have to otherify everything special to allow the \csname to + % include an _ in the xref name, etc. + \indexnofonts + \turnoffactive + \expandafter\global\expandafter\let\expandafter\Xthisreftitle + \csname XR#1-title\endcsname + }% + \iffloat\Xthisreftitle + % If the user specified the print name (third arg) to the ref, + % print it instead of our usual "Figure 1.2". + \ifdim\wd0 = 0pt + \refx{#1-snt}% + \else + \printedrefname + \fi + % + % if the user also gave the printed manual name (fifth arg), append + % "in MANUALNAME". + \ifdim \wd1 > 0pt + \space \putwordin{} \cite{\printedmanual}% + \fi + \else + % node/anchor (non-float) references. + % + % If we use \unhbox0 and \unhbox1 to print the node names, TeX does not + % insert empty discretionaries after hyphens, which means that it will + % not find a line break at a hyphen in a node names. Since some manuals + % are best written with fairly long node names, containing hyphens, this + % is a loss. Therefore, we give the text of the node name again, so it + % is as if TeX is seeing it for the first time. + \ifdim \wd1 > 0pt + \putwordsection{} ``\printedrefname'' \putwordin{} \cite{\printedmanual}% + \else + % _ (for example) has to be the character _ for the purposes of the + % control sequence corresponding to the node, but it has to expand + % into the usual \leavevmode...\vrule stuff for purposes of + % printing. So we \turnoffactive for the \refx-snt, back on for the + % printing, back off for the \refx-pg. + {\turnoffactive + % Only output a following space if the -snt ref is nonempty; for + % @unnumbered and @anchor, it won't be. + \setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}% + \ifdim \wd2 > 0pt \refx{#1-snt}\space\fi + }% + % output the `[mynode]' via a macro so it can be overridden. + \xrefprintnodename\printedrefname + % + % But we always want a comma and a space: + ,\space + % + % output the `page 3'. + \turnoffactive \putwordpage\tie\refx{#1-pg}{}% + \fi + \fi + \endlink +\endgroup} + +% This macro is called from \xrefX for the `[nodename]' part of xref +% output. It's a separate macro only so it can be changed more easily, +% since square brackets don't work well in some documents. Particularly +% one that Bob is working on :). +% +\def\xrefprintnodename#1{[#1]} + +% Things referred to by \setref. +% +\def\Ynothing{} +\def\Yomitfromtoc{} +\def\Ynumbered{% + \ifnum\secno=0 + \putwordChapter@tie \the\chapno + \else \ifnum\subsecno=0 + \putwordSection@tie \the\chapno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno + \else + \putwordSection@tie \the\chapno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} +\def\Yappendix{% + \ifnum\secno=0 + \putwordAppendix@tie @char\the\appendixno{}% + \else \ifnum\subsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno + \else \ifnum\subsubsecno=0 + \putwordSection@tie @char\the\appendixno.\the\secno.\the\subsecno + \else + \putwordSection@tie + @char\the\appendixno.\the\secno.\the\subsecno.\the\subsubsecno + \fi\fi\fi +} + +% Define \refx{NAME}{SUFFIX} to reference a cross-reference string named NAME. +% If its value is nonempty, SUFFIX is output afterward. +% +\def\refx#1#2{% + {% + \indexnofonts + \otherbackslash + \expandafter\global\expandafter\let\expandafter\thisrefX + \csname XR#1\endcsname + }% + \ifx\thisrefX\relax + % If not defined, say something at least. + \angleleft un\-de\-fined\angleright + \iflinks + \ifhavexrefs + \message{\linenumber Undefined cross reference `#1'.}% + \else + \ifwarnedxrefs\else + \global\warnedxrefstrue + \message{Cross reference values unknown; you must run TeX again.}% + \fi + \fi + \fi + \else + % It's defined, so just use it. + \thisrefX + \fi + #2% Output the suffix in any case. +} + +% This is the macro invoked by entries in the aux file. Usually it's +% just a \def (we prepend XR to the control sequence name to avoid +% collisions). But if this is a float type, we have more work to do. +% +\def\xrdef#1#2{% + \expandafter\gdef\csname XR#1\endcsname{#2}% remember this xref value. + % + % Was that xref control sequence that we just defined for a float? + \expandafter\iffloat\csname XR#1\endcsname + % it was a float, and we have the (safe) float type in \iffloattype. + \expandafter\let\expandafter\floatlist + \csname floatlist\iffloattype\endcsname + % + % Is this the first time we've seen this float type? + \expandafter\ifx\floatlist\relax + \toks0 = {\do}% yes, so just \do + \else + % had it before, so preserve previous elements in list. + \toks0 = \expandafter{\floatlist\do}% + \fi + % + % Remember this xref in the control sequence \floatlistFLOATTYPE, + % for later use in \listoffloats. + \expandafter\xdef\csname floatlist\iffloattype\endcsname{\the\toks0{#1}}% + \fi +} + +% Read the last existing aux file, if any. No error if none exists. +% +\def\tryauxfile{% + \openin 1 \jobname.aux + \ifeof 1 \else + \readdatafile{aux}% + \global\havexrefstrue + \fi + \closein 1 +} + +\def\setupdatafile{% + \catcode`\^^@=\other + \catcode`\^^A=\other + \catcode`\^^B=\other + \catcode`\^^C=\other + \catcode`\^^D=\other + \catcode`\^^E=\other + \catcode`\^^F=\other + \catcode`\^^G=\other + \catcode`\^^H=\other + \catcode`\^^K=\other + \catcode`\^^L=\other + \catcode`\^^N=\other + \catcode`\^^P=\other + \catcode`\^^Q=\other + \catcode`\^^R=\other + \catcode`\^^S=\other + \catcode`\^^T=\other + \catcode`\^^U=\other + \catcode`\^^V=\other + \catcode`\^^W=\other + \catcode`\^^X=\other + \catcode`\^^Z=\other + \catcode`\^^[=\other + \catcode`\^^\=\other + \catcode`\^^]=\other + \catcode`\^^^=\other + \catcode`\^^_=\other + % It was suggested to set the catcode of ^ to 7, which would allow ^^e4 etc. + % in xref tags, i.e., node names. But since ^^e4 notation isn't + % supported in the main text, it doesn't seem desirable. Furthermore, + % that is not enough: for node names that actually contain a ^ + % character, we would end up writing a line like this: 'xrdef {'hat + % b-title}{'hat b} and \xrdef does a \csname...\endcsname on the first + % argument, and \hat is not an expandable control sequence. It could + % all be worked out, but why? Either we support ^^ or we don't. + % + % The other change necessary for this was to define \auxhat: + % \def\auxhat{\def^{'hat }}% extra space so ok if followed by letter + % and then to call \auxhat in \setq. + % + \catcode`\^=\other + % + % Special characters. Should be turned off anyway, but... + \catcode`\~=\other + \catcode`\[=\other + \catcode`\]=\other + \catcode`\"=\other + \catcode`\_=\other + \catcode`\|=\other + \catcode`\<=\other + \catcode`\>=\other + \catcode`\$=\other + \catcode`\#=\other + \catcode`\&=\other + \catcode`\%=\other + \catcode`+=\other % avoid \+ for paranoia even though we've turned it off + % + % This is to support \ in node names and titles, since the \ + % characters end up in a \csname. It's easier than + % leaving it active and making its active definition an actual \ + % character. What I don't understand is why it works in the *value* + % of the xrdef. Seems like it should be a catcode12 \, and that + % should not typeset properly. But it works, so I'm moving on for + % now. --karl, 15jan04. + \catcode`\\=\other + % + % Make the characters 128-255 be printing characters. + {% + \count1=128 + \def\loop{% + \catcode\count1=\other + \advance\count1 by 1 + \ifnum \count1<256 \loop \fi + }% + }% + % + % @ is our escape character in .aux files, and we need braces. + \catcode`\{=1 + \catcode`\}=2 + \catcode`\@=0 +} + +\def\readdatafile#1{% +\begingroup + \setupdatafile + \input\jobname.#1 +\endgroup} + +\message{insertions,} +% including footnotes. + +\newcount \footnoteno + +% The trailing space in the following definition for supereject is +% vital for proper filling; pages come out unaligned when you do a +% pagealignmacro call if that space before the closing brace is +% removed. (Generally, numeric constants should always be followed by a +% space to prevent strange expansion errors.) +\def\supereject{\par\penalty -20000\footnoteno =0 } + +% @footnotestyle is meaningful for info output only. +\let\footnotestyle=\comment + +{\catcode `\@=11 +% +% Auto-number footnotes. Otherwise like plain. +\gdef\footnote{% + \let\indent=\ptexindent + \let\noindent=\ptexnoindent + \global\advance\footnoteno by \@ne + \edef\thisfootno{$^{\the\footnoteno}$}% + % + % In case the footnote comes at the end of a sentence, preserve the + % extra spacing after we do the footnote number. + \let\@sf\empty + \ifhmode\edef\@sf{\spacefactor\the\spacefactor}\ptexslash\fi + % + % Remove inadvertent blank space before typesetting the footnote number. + \unskip + \thisfootno\@sf + \dofootnote +}% + +% Don't bother with the trickery in plain.tex to not require the +% footnote text as a parameter. Our footnotes don't need to be so general. +% +% Oh yes, they do; otherwise, @ifset (and anything else that uses +% \parseargline) fails inside footnotes because the tokens are fixed when +% the footnote is read. --karl, 16nov96. +% +\gdef\dofootnote{% + \insert\footins\bgroup + % We want to typeset this text as a normal paragraph, even if the + % footnote reference occurs in (for example) a display environment. + % So reset some parameters. + \hsize=\pagewidth + \interlinepenalty\interfootnotelinepenalty + \splittopskip\ht\strutbox % top baseline for broken footnotes + \splitmaxdepth\dp\strutbox + \floatingpenalty\@MM + \leftskip\z@skip + \rightskip\z@skip + \spaceskip\z@skip + \xspaceskip\z@skip + \parindent\defaultparindent + % + \smallfonts \rm + % + % Because we use hanging indentation in footnotes, a @noindent appears + % to exdent this text, so make it be a no-op. makeinfo does not use + % hanging indentation so @noindent can still be needed within footnote + % text after an @example or the like (not that this is good style). + \let\noindent = \relax + % + % Hang the footnote text off the number. Use \everypar in case the + % footnote extends for more than one paragraph. + \everypar = {\hang}% + \textindent{\thisfootno}% + % + % Don't crash into the line above the footnote text. Since this + % expands into a box, it must come within the paragraph, lest it + % provide a place where TeX can split the footnote. + \footstrut + \futurelet\next\fo@t +} +}%end \catcode `\@=11 + +% In case a @footnote appears in a vbox, save the footnote text and create +% the real \insert just after the vbox finished. Otherwise, the insertion +% would be lost. +% Similarily, if a @footnote appears inside an alignment, save the footnote +% text to a box and make the \insert when a row of the table is finished. +% And the same can be done for other insert classes. --kasal, 16nov03. + +% Replace the \insert primitive by a cheating macro. +% Deeper inside, just make sure that the saved insertions are not spilled +% out prematurely. +% +\def\startsavinginserts{% + \ifx \insert\ptexinsert + \let\insert\saveinsert + \else + \let\checkinserts\relax + \fi +} + +% This \insert replacement works for both \insert\footins{foo} and +% \insert\footins\bgroup foo\egroup, but it doesn't work for \insert27{foo}. +% +\def\saveinsert#1{% + \edef\next{\noexpand\savetobox \makeSAVEname#1}% + \afterassignment\next + % swallow the left brace + \let\temp = +} +\def\makeSAVEname#1{\makecsname{SAVE\expandafter\gobble\string#1}} +\def\savetobox#1{\global\setbox#1 = \vbox\bgroup \unvbox#1} + +\def\checksaveins#1{\ifvoid#1\else \placesaveins#1\fi} + +\def\placesaveins#1{% + \ptexinsert \csname\expandafter\gobblesave\string#1\endcsname + {\box#1}% +} + +% eat @SAVE -- beware, all of them have catcode \other: +{ + \def\dospecials{\do S\do A\do V\do E} \uncatcodespecials % ;-) + \gdef\gobblesave @SAVE{} +} + +% initialization: +\def\newsaveins #1{% + \edef\next{\noexpand\newsaveinsX \makeSAVEname#1}% + \next +} +\def\newsaveinsX #1{% + \csname newbox\endcsname #1% + \expandafter\def\expandafter\checkinserts\expandafter{\checkinserts + \checksaveins #1}% +} + +% initialize: +\let\checkinserts\empty +\newsaveins\footins +\newsaveins\margin + + +% @image. We use the macros from epsf.tex to support this. +% If epsf.tex is not installed and @image is used, we complain. +% +% Check for and read epsf.tex up front. If we read it only at @image +% time, we might be inside a group, and then its definitions would get +% undone and the next image would fail. +\openin 1 = epsf.tex +\ifeof 1 \else + % Do not bother showing banner with epsf.tex v2.7k (available in + % doc/epsf.tex and on ctan). + \def\epsfannounce{\toks0 = }% + \input epsf.tex +\fi +\closein 1 +% +% We will only complain once about lack of epsf.tex. +\newif\ifwarnednoepsf +\newhelp\noepsfhelp{epsf.tex must be installed for images to + work. It is also included in the Texinfo distribution, or you can get + it from ftp://tug.org/tex/epsf.tex.} +% +\def\image#1{% + \ifx\epsfbox\undefined + \ifwarnednoepsf \else + \errhelp = \noepsfhelp + \errmessage{epsf.tex not found, images will be ignored}% + \global\warnednoepsftrue + \fi + \else + \imagexxx #1,,,,,\finish + \fi +} +% +% Arguments to @image: +% #1 is (mandatory) image filename; we tack on .eps extension. +% #2 is (optional) width, #3 is (optional) height. +% #4 is (ignored optional) html alt text. +% #5 is (ignored optional) extension. +% #6 is just the usual extra ignored arg for parsing this stuff. +\newif\ifimagevmode +\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup + \catcode`\^^M = 5 % in case we're inside an example + \normalturnoffactive % allow _ et al. in names + % If the image is by itself, center it. + \ifvmode + \imagevmodetrue + \nobreak\bigskip + % Usually we'll have text after the image which will insert + % \parskip glue, so insert it here too to equalize the space + % above and below. + \nobreak\vskip\parskip + \nobreak + \line\bgroup\hss + \fi + % + % Output the image. + \ifpdf + \dopdfimage{#1}{#2}{#3}% + \else + % \epsfbox itself resets \epsf?size at each figure. + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \epsfxsize=#2\relax \fi + \setbox0 = \hbox{\ignorespaces #3}\ifdim\wd0 > 0pt \epsfysize=#3\relax \fi + \epsfbox{#1.eps}% + \fi + % + \ifimagevmode \hss \egroup \bigbreak \fi % space after the image +\endgroup} + + +% @float FLOATTYPE,LABEL,LOC ... @end float for displayed figures, tables, +% etc. We don't actually implement floating yet, we always include the +% float "here". But it seemed the best name for the future. +% +\envparseargdef\float{\eatcommaspace\eatcommaspace\dofloat#1, , ,\finish} + +% There may be a space before second and/or third parameter; delete it. +\def\eatcommaspace#1, {#1,} + +% #1 is the optional FLOATTYPE, the text label for this float, typically +% "Figure", "Table", "Example", etc. Can't contain commas. If omitted, +% this float will not be numbered and cannot be referred to. +% +% #2 is the optional xref label. Also must be present for the float to +% be referable. +% +% #3 is the optional positioning argument; for now, it is ignored. It +% will somehow specify the positions allowed to float to (here, top, bottom). +% +% We keep a separate counter for each FLOATTYPE, which we reset at each +% chapter-level command. +\let\resetallfloatnos=\empty +% +\def\dofloat#1,#2,#3,#4\finish{% + \let\thiscaption=\empty + \let\thisshortcaption=\empty + % + % don't lose footnotes inside @float. + % + % BEWARE: when the floats start float, we have to issue warning whenever an + % insert appears inside a float which could possibly float. --kasal, 26may04 + % + \startsavinginserts + % + % We can't be used inside a paragraph. + \par + % + \vtop\bgroup + \def\floattype{#1}% + \def\floatlabel{#2}% + \def\floatloc{#3}% we do nothing with this yet. + % + \ifx\floattype\empty + \let\safefloattype=\empty + \else + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + \fi + % + % If label is given but no type, we handle that as the empty type. + \ifx\floatlabel\empty \else + % We want each FLOATTYPE to be numbered separately (Figure 1, + % Table 1, Figure 2, ...). (And if no label, no number.) + % + \expandafter\getfloatno\csname\safefloattype floatno\endcsname + \global\advance\floatno by 1 + % + {% + % This magic value for \thissection is output by \setref as the + % XREFLABEL-title value. \xrefX uses it to distinguish float + % labels (which have a completely different output format) from + % node and anchor labels. And \xrdef uses it to construct the + % lists of floats. + % + \edef\thissection{\floatmagic=\safefloattype}% + \setref{\floatlabel}{Yfloat}% + }% + \fi + % + % start with \parskip glue, I guess. + \vskip\parskip + % + % Don't suppress indentation if a float happens to start a section. + \restorefirstparagraphindent +} + +% we have these possibilities: +% @float Foo,lbl & @caption{Cap}: Foo 1.1: Cap +% @float Foo,lbl & no caption: Foo 1.1 +% @float Foo & @caption{Cap}: Foo: Cap +% @float Foo & no caption: Foo +% @float ,lbl & Caption{Cap}: 1.1: Cap +% @float ,lbl & no caption: 1.1 +% @float & @caption{Cap}: Cap +% @float & no caption: +% +\def\Efloat{% + \let\floatident = \empty + % + % In all cases, if we have a float type, it comes first. + \ifx\floattype\empty \else \def\floatident{\floattype}\fi + % + % If we have an xref label, the number comes next. + \ifx\floatlabel\empty \else + \ifx\floattype\empty \else % if also had float type, need tie first. + \appendtomacro\floatident{\tie}% + \fi + % the number. + \appendtomacro\floatident{\chaplevelprefix\the\floatno}% + \fi + % + % Start the printed caption with what we've constructed in + % \floatident, but keep it separate; we need \floatident again. + \let\captionline = \floatident + % + \ifx\thiscaption\empty \else + \ifx\floatident\empty \else + \appendtomacro\captionline{: }% had ident, so need a colon between + \fi + % + % caption text. + \appendtomacro\captionline{\scanexp\thiscaption}% + \fi + % + % If we have anything to print, print it, with space before. + % Eventually this needs to become an \insert. + \ifx\captionline\empty \else + \vskip.5\parskip + \captionline + % + % Space below caption. + \vskip\parskip + \fi + % + % If have an xref label, write the list of floats info. Do this + % after the caption, to avoid chance of it being a breakpoint. + \ifx\floatlabel\empty \else + % Write the text that goes in the lof to the aux file as + % \floatlabel-lof. Besides \floatident, we include the short + % caption if specified, else the full caption if specified, else nothing. + {% + \atdummies + % since we read the caption text in the macro world, where ^^M + % is turned into a normal character, we have to scan it back, so + % we don't write the literal three characters "^^M" into the aux file. + \scanexp{% + \xdef\noexpand\gtemp{% + \ifx\thisshortcaption\empty + \thiscaption + \else + \thisshortcaption + \fi + }% + }% + \immediate\write\auxfile{@xrdef{\floatlabel-lof}{\floatident + \ifx\gtemp\empty \else : \gtemp \fi}}% + }% + \fi + \egroup % end of \vtop + % + % place the captured inserts + % + % BEWARE: when the floats start float, we have to issue warning whenever an + % insert appears inside a float which could possibly float. --kasal, 26may04 + % + \checkinserts +} + +% Append the tokens #2 to the definition of macro #1, not expanding either. +% +\def\appendtomacro#1#2{% + \expandafter\def\expandafter#1\expandafter{#1#2}% +} + +% @caption, @shortcaption +% +\def\caption{\docaption\thiscaption} +\def\shortcaption{\docaption\thisshortcaption} +\def\docaption{\checkenv\float \bgroup\scanargctxt\defcaption} +\def\defcaption#1#2{\egroup \def#1{#2}} + +% The parameter is the control sequence identifying the counter we are +% going to use. Create it if it doesn't exist and assign it to \floatno. +\def\getfloatno#1{% + \ifx#1\relax + % Haven't seen this figure type before. + \csname newcount\endcsname #1% + % + % Remember to reset this floatno at the next chap. + \expandafter\gdef\expandafter\resetallfloatnos + \expandafter{\resetallfloatnos #1=0 }% + \fi + \let\floatno#1% +} + +% \setref calls this to get the XREFLABEL-snt value. We want an @xref +% to the FLOATLABEL to expand to "Figure 3.1". We call \setref when we +% first read the @float command. +% +\def\Yfloat{\floattype@tie \chaplevelprefix\the\floatno}% + +% Magic string used for the XREFLABEL-title value, so \xrefX can +% distinguish floats from other xref types. +\def\floatmagic{!!float!!} + +% #1 is the control sequence we are passed; we expand into a conditional +% which is true if #1 represents a float ref. That is, the magic +% \thissection value which we \setref above. +% +\def\iffloat#1{\expandafter\doiffloat#1==\finish} +% +% #1 is (maybe) the \floatmagic string. If so, #2 will be the +% (safe) float type for this float. We set \iffloattype to #2. +% +\def\doiffloat#1=#2=#3\finish{% + \def\temp{#1}% + \def\iffloattype{#2}% + \ifx\temp\floatmagic +} + +% @listoffloats FLOATTYPE - print a list of floats like a table of contents. +% +\parseargdef\listoffloats{% + \def\floattype{#1}% floattype + {% + % the floattype might have accents or other special characters, + % but we need to use it in a control sequence name. + \indexnofonts + \turnoffactive + \xdef\safefloattype{\floattype}% + }% + % + % \xrdef saves the floats as a \do-list in \floatlistSAFEFLOATTYPE. + \expandafter\ifx\csname floatlist\safefloattype\endcsname \relax + \ifhavexrefs + % if the user said @listoffloats foo but never @float foo. + \message{\linenumber No `\safefloattype' floats to list.}% + \fi + \else + \begingroup + \leftskip=\tocindent % indent these entries like a toc + \let\do=\listoffloatsdo + \csname floatlist\safefloattype\endcsname + \endgroup + \fi +} + +% This is called on each entry in a list of floats. We're passed the +% xref label, in the form LABEL-title, which is how we save it in the +% aux file. We strip off the -title and look up \XRLABEL-lof, which +% has the text we're supposed to typeset here. +% +% Figures without xref labels will not be included in the list (since +% they won't appear in the aux file). +% +\def\listoffloatsdo#1{\listoffloatsdoentry#1\finish} +\def\listoffloatsdoentry#1-title\finish{{% + % Can't fully expand XR#1-lof because it can contain anything. Just + % pass the control sequence. On the other hand, XR#1-pg is just the + % page number, and we want to fully expand that so we can get a link + % in pdf output. + \toksA = \expandafter{\csname XR#1-lof\endcsname}% + % + % use the same \entry macro we use to generate the TOC and index. + \edef\writeentry{\noexpand\entry{\the\toksA}{\csname XR#1-pg\endcsname}}% + \writeentry +}} + +\message{localization,} +% and i18n. + +% @documentlanguage is usually given very early, just after +% @setfilename. If done too late, it may not override everything +% properly. Single argument is the language abbreviation. +% It would be nice if we could set up a hyphenation file here. +% +\parseargdef\documentlanguage{% + \tex % read txi-??.tex file in plain TeX. + % Read the file if it exists. + \openin 1 txi-#1.tex + \ifeof 1 + \errhelp = \nolanghelp + \errmessage{Cannot read language file txi-#1.tex}% + \else + \input txi-#1.tex + \fi + \closein 1 + \endgroup +} +\newhelp\nolanghelp{The given language definition file cannot be found or +is empty. Maybe you need to install it? In the current directory +should work if nowhere else does.} + + +% @documentencoding should change something in TeX eventually, most +% likely, but for now just recognize it. +\let\documentencoding = \comment + + +% Page size parameters. +% +\newdimen\defaultparindent \defaultparindent = 15pt + +\chapheadingskip = 15pt plus 4pt minus 2pt +\secheadingskip = 12pt plus 3pt minus 2pt +\subsecheadingskip = 9pt plus 2pt minus 2pt + +% Prevent underfull vbox error messages. +\vbadness = 10000 + +% Don't be so finicky about underfull hboxes, either. +\hbadness = 2000 + +% Following George Bush, just get rid of widows and orphans. +\widowpenalty=10000 +\clubpenalty=10000 + +% Use TeX 3.0's \emergencystretch to help line breaking, but if we're +% using an old version of TeX, don't do anything. We want the amount of +% stretch added to depend on the line length, hence the dependence on +% \hsize. We call this whenever the paper size is set. +% +\def\setemergencystretch{% + \ifx\emergencystretch\thisisundefined + % Allow us to assign to \emergencystretch anyway. + \def\emergencystretch{\dimen0}% + \else + \emergencystretch = .15\hsize + \fi +} + +% Parameters in order: 1) textheight; 2) textwidth; +% 3) voffset; 4) hoffset; 5) binding offset; 6) topskip; +% 7) physical page height; 8) physical page width. +% +% We also call \setleading{\textleading}, so the caller should define +% \textleading. The caller should also set \parskip. +% +\def\internalpagesizes#1#2#3#4#5#6#7#8{% + \voffset = #3\relax + \topskip = #6\relax + \splittopskip = \topskip + % + \vsize = #1\relax + \advance\vsize by \topskip + \outervsize = \vsize + \advance\outervsize by 2\topandbottommargin + \pageheight = \vsize + % + \hsize = #2\relax + \outerhsize = \hsize + \advance\outerhsize by 0.5in + \pagewidth = \hsize + % + \normaloffset = #4\relax + \bindingoffset = #5\relax + % + \ifpdf + \pdfpageheight #7\relax + \pdfpagewidth #8\relax + \fi + % + \setleading{\textleading} + % + \parindent = \defaultparindent + \setemergencystretch +} + +% @letterpaper (the default). +\def\letterpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % If page is nothing but text, make it come out even. + \internalpagesizes{46\baselineskip}{6in}% + {\voffset}{.25in}% + {\bindingoffset}{36pt}% + {11in}{8.5in}% +}} + +% Use @smallbook to reset parameters for 7x9.25 trim size. +\def\smallbook{{\globaldefs = 1 + \parskip = 2pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.5in}{5in}% + {\voffset}{.25in}% + {\bindingoffset}{16pt}% + {9.25in}{7in}% + % + \lispnarrowing = 0.3in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .5cm +}} + +% Use @smallerbook to reset parameters for 6x9 trim size. +% (Just testing, parameters still in flux.) +\def\smallerbook{{\globaldefs = 1 + \parskip = 1.5pt plus 1pt + \textleading = 12pt + % + \internalpagesizes{7.4in}{4.8in}% + {-.2in}{-.4in}% + {0pt}{14pt}% + {9in}{6in}% + % + \lispnarrowing = 0.25in + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = .4cm +}} + +% Use @afourpaper to print on European A4 paper. +\def\afourpaper{{\globaldefs = 1 + \parskip = 3pt plus 2pt minus 1pt + \textleading = 13.2pt + % + % Double-side printing via postscript on Laserjet 4050 + % prints double-sided nicely when \bindingoffset=10mm and \hoffset=-6mm. + % To change the settings for a different printer or situation, adjust + % \normaloffset until the front-side and back-side texts align. Then + % do the same for \bindingoffset. You can set these for testing in + % your texinfo source file like this: + % @tex + % \global\normaloffset = -6mm + % \global\bindingoffset = 10mm + % @end tex + \internalpagesizes{51\baselineskip}{160mm} + {\voffset}{\hoffset}% + {\bindingoffset}{44pt}% + {297mm}{210mm}% + % + \tolerance = 700 + \hfuzz = 1pt + \contentsrightmargin = 0pt + \defbodyindent = 5mm +}} + +% Use @afivepaper to print on European A5 paper. +% From romildo@urano.iceb.ufop.br, 2 July 2000. +% He also recommends making @example and @lisp be small. +\def\afivepaper{{\globaldefs = 1 + \parskip = 2pt plus 1pt minus 0.1pt + \textleading = 12.5pt + % + \internalpagesizes{160mm}{120mm}% + {\voffset}{\hoffset}% + {\bindingoffset}{8pt}% + {210mm}{148mm}% + % + \lispnarrowing = 0.2in + \tolerance = 800 + \hfuzz = 1.2pt + \contentsrightmargin = 0pt + \defbodyindent = 2mm + \tableindent = 12mm +}} + +% A specific text layout, 24x15cm overall, intended for A4 paper. +\def\afourlatex{{\globaldefs = 1 + \afourpaper + \internalpagesizes{237mm}{150mm}% + {\voffset}{4.6mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + % + % Must explicitly reset to 0 because we call \afourpaper. + \globaldefs = 0 +}} + +% Use @afourwide to print on A4 paper in landscape format. +\def\afourwide{{\globaldefs = 1 + \afourpaper + \internalpagesizes{241mm}{165mm}% + {\voffset}{-2.95mm}% + {\bindingoffset}{7mm}% + {297mm}{210mm}% + \globaldefs = 0 +}} + +% @pagesizes TEXTHEIGHT[,TEXTWIDTH] +% Perhaps we should allow setting the margins, \topskip, \parskip, +% and/or leading, also. Or perhaps we should compute them somehow. +% +\parseargdef\pagesizes{\pagesizesyyy #1,,\finish} +\def\pagesizesyyy#1,#2,#3\finish{{% + \setbox0 = \hbox{\ignorespaces #2}\ifdim\wd0 > 0pt \hsize=#2\relax \fi + \globaldefs = 1 + % + \parskip = 3pt plus 2pt minus 1pt + \setleading{\textleading}% + % + \dimen0 = #1 + \advance\dimen0 by \voffset + % + \dimen2 = \hsize + \advance\dimen2 by \normaloffset + % + \internalpagesizes{#1}{\hsize}% + {\voffset}{\normaloffset}% + {\bindingoffset}{44pt}% + {\dimen0}{\dimen2}% +}} + +% Set default to letter. +% +\letterpaper + + +\message{and turning on texinfo input format.} + +% Define macros to output various characters with catcode for normal text. +\catcode`\"=\other +\catcode`\~=\other +\catcode`\^=\other +\catcode`\_=\other +\catcode`\|=\other +\catcode`\<=\other +\catcode`\>=\other +\catcode`\+=\other +\catcode`\$=\other +\def\normaldoublequote{"} +\def\normaltilde{~} +\def\normalcaret{^} +\def\normalunderscore{_} +\def\normalverticalbar{|} +\def\normalless{<} +\def\normalgreater{>} +\def\normalplus{+} +\def\normaldollar{$}%$ font-lock fix + +% This macro is used to make a character print one way in \tt +% (where it can probably be output as-is), and another way in other fonts, +% where something hairier probably needs to be done. +% +% #1 is what to print if we are indeed using \tt; #2 is what to print +% otherwise. Since all the Computer Modern typewriter fonts have zero +% interword stretch (and shrink), and it is reasonable to expect all +% typewriter fonts to have this, we can check that font parameter. +% +\def\ifusingtt#1#2{\ifdim \fontdimen3\font=0pt #1\else #2\fi} + +% Same as above, but check for italic font. Actually this also catches +% non-italic slanted fonts since it is impossible to distinguish them from +% italic fonts. But since this is only used by $ and it uses \sl anyway +% this is not a problem. +\def\ifusingit#1#2{\ifdim \fontdimen1\font>0pt #1\else #2\fi} + +% Turn off all special characters except @ +% (and those which the user can use as if they were ordinary). +% Most of these we simply print from the \tt font, but for some, we can +% use math or other variants that look better in normal text. + +\catcode`\"=\active +\def\activedoublequote{{\tt\char34}} +\let"=\activedoublequote +\catcode`\~=\active +\def~{{\tt\char126}} +\chardef\hat=`\^ +\catcode`\^=\active +\def^{{\tt \hat}} + +\catcode`\_=\active +\def_{\ifusingtt\normalunderscore\_} +\let\realunder=_ +% Subroutine for the previous macro. +\def\_{\leavevmode \kern.07em \vbox{\hrule width.3em height.1ex}\kern .07em } + +\catcode`\|=\active +\def|{{\tt\char124}} +\chardef \less=`\< +\catcode`\<=\active +\def<{{\tt \less}} +\chardef \gtr=`\> +\catcode`\>=\active +\def>{{\tt \gtr}} +\catcode`\+=\active +\def+{{\tt \char 43}} +\catcode`\$=\active +\def${\ifusingit{{\sl\$}}\normaldollar}%$ font-lock fix + +% If a .fmt file is being used, characters that might appear in a file +% name cannot be active until we have parsed the command line. +% So turn them off again, and have \everyjob (or @setfilename) turn them on. +% \otherifyactive is called near the end of this file. +\def\otherifyactive{\catcode`+=\other \catcode`\_=\other} + +\catcode`\@=0 + +% \backslashcurfont outputs one backslash character in current font, +% as in \char`\\. +\global\chardef\backslashcurfont=`\\ +\global\let\rawbackslashxx=\backslashcurfont % let existing .??s files work + +% \rawbackslash defines an active \ to do \backslashcurfont. +% \otherbackslash defines an active \ to be a literal `\' character with +% catcode other. +{\catcode`\\=\active + @gdef@rawbackslash{@let\=@backslashcurfont} + @gdef@otherbackslash{@let\=@realbackslash} +} + +% \realbackslash is an actual character `\' with catcode other, and +% \doublebackslash is two of them (for the pdf outlines). +{\catcode`\\=\other @gdef@realbackslash{\} @gdef@doublebackslash{\\}} + +% \normalbackslash outputs one backslash in fixed width font. +\def\normalbackslash{{\tt\backslashcurfont}} + +\catcode`\\=\active + +% Used sometimes to turn off (effectively) the active characters +% even after parsing them. +@def@turnoffactive{% + @let"=@normaldoublequote + @let\=@realbackslash + @let~=@normaltilde + @let^=@normalcaret + @let_=@normalunderscore + @let|=@normalverticalbar + @let<=@normalless + @let>=@normalgreater + @let+=@normalplus + @let$=@normaldollar %$ font-lock fix + @unsepspaces +} + +% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of +% the literal character `\'. (Thus, \ is not expandable when this is in +% effect.) +% +@def@normalturnoffactive{@turnoffactive @let\=@normalbackslash} + +% Make _ and + \other characters, temporarily. +% This is canceled by @fixbackslash. +@otherifyactive + +% If a .fmt file is being used, we don't want the `\input texinfo' to show up. +% That is what \eatinput is for; after that, the `\' should revert to printing +% a backslash. +% +@gdef@eatinput input texinfo{@fixbackslash} +@global@let\ = @eatinput + +% On the other hand, perhaps the file did not have a `\input texinfo'. Then +% the first `\{ in the file would cause an error. This macro tries to fix +% that, assuming it is called before the first `\' could plausibly occur. +% Also turn back on active characters that might appear in the input +% file name, in case not using a pre-dumped format. +% +@gdef@fixbackslash{% + @ifx\@eatinput @let\ = @normalbackslash @fi + @catcode`+=@active + @catcode`@_=@active +} + +% Say @foo, not \foo, in error messages. +@escapechar = `@@ + +% These look ok in all fonts, so just make them not special. +@catcode`@& = @other +@catcode`@# = @other +@catcode`@% = @other + + +@c Local variables: +@c eval: (add-hook 'write-file-hooks 'time-stamp) +@c page-delimiter: "^\\\\message" +@c time-stamp-start: "def\\\\texinfoversion{" +@c time-stamp-format: "%:y-%02m-%02d.%02H" +@c time-stamp-end: "}" +@c End: + +@c vim:sw=2: + +@ignore + arch-tag: e1b36e32-c96e-4135-a41a-0b2efa2ea115 +@end ignore diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/mkmf.log b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/mkmf.log new file mode 100644 index 000000000..62c4656f1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/mkmf.log @@ -0,0 +1,261 @@ +package configuration for libffi is not found +have_header: checking for ffi.h... -------------------- no + +"gcc -o conftest -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -L. -L/Users/tacyas/Eos/util/X86MAC64/lib -L. -L/usr/local/lib -lruby-static -lpthread -ldl -lobjc " +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: int main() {return 0;} +/* end */ + +"gcc -E -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -o conftest.i" +conftest.c:3:10: fatal error: 'ffi.h' file not found +#include + ^ +1 error generated. +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: #include +/* end */ + +-------------------- + +find_header: checking for ffi.h in /usr/local/include,/usr/include/ffi... -------------------- yes + +"gcc -E -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -o conftest.i" +conftest.c:3:10: fatal error: 'ffi.h' file not found +#include + ^ +1 error generated. +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: #include +/* end */ + +"gcc -E -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe -I/usr/local/include conftest.c -o conftest.i" +conftest.c:3:10: fatal error: 'ffi.h' file not found +#include + ^ +1 error generated. +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: #include +/* end */ + +"gcc -E -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe -I/usr/include/ffi conftest.c -o conftest.i" +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: #include +/* end */ + +-------------------- + +have_library: checking for ffi_call() in -lffi... -------------------- yes + +"gcc -o conftest -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -I/usr/include/ffi -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -L. -L/Users/tacyas/Eos/util/X86MAC64/lib -L. -L/usr/local/lib -lruby-static -lffi -lpthread -ldl -lobjc " +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: #include +4: +5: /*top*/ +6: int main() {return 0;} +7: int t() { void ((*volatile p)()); p = (void ((*)()))ffi_call; return 0; } +/* end */ + +-------------------- + +have_func: checking for ffi_prep_closure()... -------------------- yes + +"gcc -o conftest -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -I/usr/include/ffi -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -L. -L/Users/tacyas/Eos/util/X86MAC64/lib -L. -L/usr/local/lib -lffi -lruby-static -lffi -lpthread -ldl -lobjc " +conftest.c:5:53: error: use of undeclared identifier 'ffi_prep_closure' +int t() { void ((*volatile p)()); p = (void ((*)()))ffi_prep_closure; return 0; } + ^ +1 error generated. +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: /*top*/ +4: int main() {return 0;} +5: int t() { void ((*volatile p)()); p = (void ((*)()))ffi_prep_closure; return 0; } +/* end */ + +"gcc -o conftest -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -I/usr/include/ffi -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -L. -L/Users/tacyas/Eos/util/X86MAC64/lib -L. -L/usr/local/lib -lffi -lruby-static -lffi -lpthread -ldl -lobjc " +conftest.c:5:11: warning: implicit declaration of function 'ffi_prep_closure' is invalid in C99 [-Wimplicit-function-declaration] +int t() { ffi_prep_closure(); return 0; } + ^ +1 warning generated. +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: /*top*/ +4: int main() {return 0;} +5: int t() { ffi_prep_closure(); return 0; } +/* end */ + +-------------------- + +have_func: checking for ffi_raw_call()... -------------------- no + +"gcc -o conftest -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -I/usr/include/ffi -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -L. -L/Users/tacyas/Eos/util/X86MAC64/lib -L. -L/usr/local/lib -lffi -lruby-static -lffi -lpthread -ldl -lobjc " +conftest.c:5:53: error: use of undeclared identifier 'ffi_raw_call' +int t() { void ((*volatile p)()); p = (void ((*)()))ffi_raw_call; return 0; } + ^ +1 error generated. +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: /*top*/ +4: int main() {return 0;} +5: int t() { void ((*volatile p)()); p = (void ((*)()))ffi_raw_call; return 0; } +/* end */ + +"gcc -o conftest -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -I/usr/include/ffi -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -L. -L/Users/tacyas/Eos/util/X86MAC64/lib -L. -L/usr/local/lib -lffi -lruby-static -lffi -lpthread -ldl -lobjc " +conftest.c:5:11: warning: implicit declaration of function 'ffi_raw_call' is invalid in C99 [-Wimplicit-function-declaration] +int t() { ffi_raw_call(); return 0; } + ^ +1 warning generated. +Undefined symbols for architecture x86_64: + "_ffi_raw_call", referenced from: + _t in conftest-5820c5.o +ld: symbol(s) not found for architecture x86_64 +clang: error: linker command failed with exit code 1 (use -v to see invocation) +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: /*top*/ +4: int main() {return 0;} +5: int t() { ffi_raw_call(); return 0; } +/* end */ + +-------------------- + +have_func: checking for rb_thread_blocking_region()... -------------------- yes + +"gcc -o conftest -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -I/usr/include/ffi -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -L. -L/Users/tacyas/Eos/util/X86MAC64/lib -L. -L/usr/local/lib -lffi -lruby-static -lffi -lpthread -ldl -lobjc " +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: /*top*/ +4: int main() {return 0;} +5: int t() { void ((*volatile p)()); p = (void ((*)()))rb_thread_blocking_region; return 0; } +/* end */ + +-------------------- + +have_func: checking for rb_thread_call_with_gvl()... -------------------- yes + +"gcc -o conftest -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -I/usr/include/ffi -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -L. -L/Users/tacyas/Eos/util/X86MAC64/lib -L. -L/usr/local/lib -lffi -lruby-static -lffi -lpthread -ldl -lobjc " +conftest.c:5:53: error: use of undeclared identifier 'rb_thread_call_with_gvl' +int t() { void ((*volatile p)()); p = (void ((*)()))rb_thread_call_with_gvl; return 0; } + ^ +1 error generated. +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: /*top*/ +4: int main() {return 0;} +5: int t() { void ((*volatile p)()); p = (void ((*)()))rb_thread_call_with_gvl; return 0; } +/* end */ + +"gcc -o conftest -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -I/usr/include/ffi -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -L. -L/Users/tacyas/Eos/util/X86MAC64/lib -L. -L/usr/local/lib -lffi -lruby-static -lffi -lpthread -ldl -lobjc " +conftest.c:5:11: warning: implicit declaration of function 'rb_thread_call_with_gvl' is invalid in C99 [-Wimplicit-function-declaration] +int t() { rb_thread_call_with_gvl(); return 0; } + ^ +1 warning generated. +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: /*top*/ +4: int main() {return 0;} +5: int t() { rb_thread_call_with_gvl(); return 0; } +/* end */ + +-------------------- + +have_func: checking for rb_thread_call_without_gvl()... -------------------- yes + +"gcc -o conftest -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -I/usr/include/ffi -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -L. -L/Users/tacyas/Eos/util/X86MAC64/lib -L. -L/usr/local/lib -lffi -lruby-static -lffi -lpthread -ldl -lobjc " +conftest.c:5:53: error: use of undeclared identifier 'rb_thread_call_without_gvl' +int t() { void ((*volatile p)()); p = (void ((*)()))rb_thread_call_without_gvl; return 0; } + ^ +1 error generated. +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: /*top*/ +4: int main() {return 0;} +5: int t() { void ((*volatile p)()); p = (void ((*)()))rb_thread_call_without_gvl; return 0; } +/* end */ + +"gcc -o conftest -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -I/usr/include/ffi -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -L. -L/Users/tacyas/Eos/util/X86MAC64/lib -L. -L/usr/local/lib -lffi -lruby-static -lffi -lpthread -ldl -lobjc " +conftest.c:5:11: warning: implicit declaration of function 'rb_thread_call_without_gvl' is invalid in C99 [-Wimplicit-function-declaration] +int t() { rb_thread_call_without_gvl(); return 0; } + ^ +1 warning generated. +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: /*top*/ +4: int main() {return 0;} +5: int t() { rb_thread_call_without_gvl(); return 0; } +/* end */ + +-------------------- + +have_func: checking for ffi_prep_cif_var()... -------------------- no + +"gcc -o conftest -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -I/usr/include/ffi -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -L. -L/Users/tacyas/Eos/util/X86MAC64/lib -L. -L/usr/local/lib -lffi -lruby-static -lffi -lpthread -ldl -lobjc " +conftest.c:5:53: error: use of undeclared identifier 'ffi_prep_cif_var' +int t() { void ((*volatile p)()); p = (void ((*)()))ffi_prep_cif_var; return 0; } + ^ +1 error generated. +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: /*top*/ +4: int main() {return 0;} +5: int t() { void ((*volatile p)()); p = (void ((*)()))ffi_prep_cif_var; return 0; } +/* end */ + +"gcc -o conftest -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -I/usr/include/ffi -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -L. -L/Users/tacyas/Eos/util/X86MAC64/lib -L. -L/usr/local/lib -lffi -lruby-static -lffi -lpthread -ldl -lobjc " +conftest.c:5:11: warning: implicit declaration of function 'ffi_prep_cif_var' is invalid in C99 [-Wimplicit-function-declaration] +int t() { ffi_prep_cif_var(); return 0; } + ^ +1 warning generated. +Undefined symbols for architecture x86_64: + "_ffi_prep_cif_var", referenced from: + _t in conftest-2d023f.o +ld: symbol(s) not found for architecture x86_64 +clang: error: linker command failed with exit code 1 (use -v to see invocation) +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: /*top*/ +4: int main() {return 0;} +5: int t() { ffi_prep_cif_var(); return 0; } +/* end */ + +-------------------- + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/rbffi.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/rbffi.h new file mode 100644 index 000000000..b6fe4774f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/rbffi.h @@ -0,0 +1,57 @@ +/* + * Copyright (c) 2008, 2009, Wayne Meissner + * + * Copyright (c) 2008-2013, Ruby FFI project contributors + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * * Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of the Ruby FFI project nor the + * names of its contributors may be used to endorse or promote products + * derived from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED + * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE + * DISCLAIMED. IN NO EVENT SHALL BE LIABLE FOR ANY + * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES + * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND + * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS + * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef RBFFI_RBFFI_H +#define RBFFI_RBFFI_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define MAX_PARAMETERS (32) + +extern VALUE rbffi_FFIModule; + +extern void rbffi_Type_Init(VALUE ffiModule); +extern void rbffi_Buffer_Init(VALUE ffiModule); +extern void rbffi_Invoker_Init(VALUE ffiModule); +extern void rbffi_Variadic_Init(VALUE ffiModule); +extern void rbffi_DataConverter_Init(VALUE ffiModule); +extern VALUE rbffi_AbstractMemoryClass, rbffi_InvokerClass; +extern int rbffi_type_size(VALUE type); +extern void rbffi_Thread_Init(VALUE moduleFFI); + +#ifdef __cplusplus +} +#endif + +#endif /* RBFFI_RBFFI_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/rbffi_endian.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/rbffi_endian.h new file mode 100644 index 000000000..c108020c2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/rbffi_endian.h @@ -0,0 +1,59 @@ +#ifndef JFFI_ENDIAN_H +#define JFFI_ENDIAN_H + +#ifndef _MSC_VER +#include +#endif + +#include + +#if defined(__linux__) || defined(__CYGWIN__) || defined(__GNU__) || defined(__GLIBC__) +# include +# if !defined(LITTLE_ENDIAN) && defined(__LITTLE_ENDIAN) +# define LITTLE_ENDIAN __LITTLE_ENDIAN +# endif +# if !defined(BIG_ENDIAN) && defined(__BIG_ENDIAN) +# define BIG_ENDIAN __BIG_ENDIAN +# endif +# if !defined(BYTE_ORDER) && defined(__BYTE_ORDER) +# define BYTE_ORDER __BYTE_ORDER +# endif +#endif + +#ifdef __sun +# include +# define LITTLE_ENDIAN 1234 +# define BIG_ENDIAN 4321 +# if defined(_BIG_ENDIAN) +# define BYTE_ORDER BIG_ENDIAN +# elif defined(_LITTLE_ENDIAN) +# define BYTE_ORDER LITTLE_ENDIAN +# else +# error "Cannot determine endian-ness" +# endif +#endif + +#if defined(_AIX) && !defined(BYTE_ORDER) +# define LITTLE_ENDIAN 1234 +# define BIG_ENDIAN 4321 +# if defined(__BIG_ENDIAN__) +# define BYTE_ORDER BIG_ENDIAN +# elif defined(__LITTLE_ENDIAN__) +# define BYTE_ORDER LITTLE_ENDIAN +# else +# error "Cannot determine endian-ness" +# endif +#endif + +#if defined(_WIN32) +# define LITTLE_ENDIAN 1234 +# define BIG_ENDIAN 4321 +# define BYTE_ORDER LITTLE_ENDIAN +#endif + +#if !defined(BYTE_ORDER) || !defined(LITTLE_ENDIAN) || !defined(BIG_ENDIAN) +# error "Cannot determine the endian-ness of this platform" +#endif + +#endif /* JFFI_ENDIAN_H */ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/win32/stdbool.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/win32/stdbool.h new file mode 100644 index 000000000..9130a8b67 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/win32/stdbool.h @@ -0,0 +1,8 @@ +#ifndef FFI_STDBOOL_H +#define FFI_STDBOOL_H + +typedef int bool; +#define true 1 +#define false 0 + +#endif /* FFI_STDBOOL_H */ \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/win32/stdint.h b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/win32/stdint.h new file mode 100644 index 000000000..6ce74572f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ext/ffi_c/win32/stdint.h @@ -0,0 +1,201 @@ +/* stdint.h standard header */ +#if !defined(_MSC_VER) && !defined(INT8_MIN) +#pragma once +#ifndef _STDINT +#define _STDINT +#ifndef RC_INVOKED +#include + +/* NB: assumes + byte has 8 bits + long is 32 bits + pointer can convert to and from long long + long long is longest type + */ + +_C_STD_BEGIN + /* TYPE DEFINITIONS */ +typedef signed char int8_t; +typedef short int16_t; +typedef int int32_t; + +typedef unsigned char uint8_t; +typedef unsigned short uint16_t; +typedef unsigned int uint32_t; + +typedef signed char int_least8_t; +typedef short int_least16_t; +typedef int int_least32_t; + +typedef unsigned char uint_least8_t; +typedef unsigned short uint_least16_t; +typedef unsigned int uint_least32_t; + +typedef char int_fast8_t; +typedef int int_fast16_t; +typedef int int_fast32_t; + +typedef unsigned char uint_fast8_t; +typedef unsigned int uint_fast16_t; +typedef unsigned int uint_fast32_t; + +#ifndef _INTPTR_T_DEFINED + #define _INTPTR_T_DEFINED + #ifdef _WIN64 +typedef __int64 intptr_t; + #else /* _WIN64 */ +typedef _W64 int intptr_t; + #endif /* _WIN64 */ +#endif /* _INTPTR_T_DEFINED */ + +#ifndef _UINTPTR_T_DEFINED + #define _UINTPTR_T_DEFINED + #ifdef _WIN64 +typedef unsigned __int64 uintptr_t; + #else /* _WIN64 */ +typedef _W64 unsigned int uintptr_t; + #endif /* _WIN64 */ +#endif /* _UINTPTR_T_DEFINED */ + +typedef _Longlong int64_t; +typedef _ULonglong uint64_t; + +typedef _Longlong int_least64_t; +typedef _ULonglong uint_least64_t; + +typedef _Longlong int_fast64_t; +typedef _ULonglong uint_fast64_t; + +typedef _Longlong intmax_t; +typedef _ULonglong uintmax_t; + + /* LIMIT MACROS */ +#define INT8_MIN (-0x7f - _C2) +#define INT16_MIN (-0x7fff - _C2) +#define INT32_MIN (-0x7fffffff - _C2) + +#define INT8_MAX 0x7f +#define INT16_MAX 0x7fff +#define INT32_MAX 0x7fffffff +#define UINT8_MAX 0xff +#define UINT16_MAX 0xffff +#define UINT32_MAX 0xffffffff + +#define INT_LEAST8_MIN (-0x7f - _C2) +#define INT_LEAST16_MIN (-0x7fff - _C2) +#define INT_LEAST32_MIN (-0x7fffffff - _C2) + +#define INT_LEAST8_MAX 0x7f +#define INT_LEAST16_MAX 0x7fff +#define INT_LEAST32_MAX 0x7fffffff +#define UINT_LEAST8_MAX 0xff +#define UINT_LEAST16_MAX 0xffff +#define UINT_LEAST32_MAX 0xffffffff + +#define INT_FAST8_MIN (-0x7f - _C2) +#define INT_FAST16_MIN (-0x7fff - _C2) +#define INT_FAST32_MIN (-0x7fffffff - _C2) + +#define INT_FAST8_MAX 0x7f +#define INT_FAST16_MAX 0x7fff +#define INT_FAST32_MAX 0x7fffffff +#define UINT_FAST8_MAX 0xff +#define UINT_FAST16_MAX 0xffff +#define UINT_FAST32_MAX 0xffffffff + + #if _INTPTR == 0 || _INTPTR == 1 +#define INTPTR_MAX 0x7fffffff +#define INTPTR_MIN (-INTPTR_MAX - _C2) +#define UINTPTR_MAX 0xffffffff + + #else /* _INTPTR == 2 */ +#define INTPTR_MIN (-_LLONG_MAX - _C2) +#define INTPTR_MAX _LLONG_MAX +#define UINTPTR_MAX _ULLONG_MAX +#endif /* _INTPTR */ + +#define INT8_C(x) (x) +#define INT16_C(x) (x) +#define INT32_C(x) ((x) + (INT32_MAX - INT32_MAX)) + +#define UINT8_C(x) (x) +#define UINT16_C(x) (x) +#define UINT32_C(x) ((x) + (UINT32_MAX - UINT32_MAX)) + +#ifdef _WIN64 + #define PTRDIFF_MIN INT64_MIN + #define PTRDIFF_MAX INT64_MAX +#else /* _WIN64 */ + #define PTRDIFF_MIN INT32_MIN + #define PTRDIFF_MAX INT32_MAX +#endif /* _WIN64 */ + +#define SIG_ATOMIC_MIN INT32_MIN +#define SIG_ATOMIC_MAX INT32_MAX + +#ifndef SIZE_MAX + #ifdef _WIN64 + #define SIZE_MAX UINT64_MAX + #else /* _WIN64 */ + #define SIZE_MAX UINT32_MAX + #endif /* _WIN64 */ +#endif /* SIZE_MAX */ + +#define WCHAR_MIN 0x0000 +#define WCHAR_MAX 0xffff + +#define WINT_MIN 0x0000 +#define WINT_MAX 0xffff + + #define INT64_MIN (-0x7fffffffffffffff - _C2) + #define INT64_MAX 0x7fffffffffffffff + #define UINT64_MAX 0xffffffffffffffffU + + #define INT_LEAST64_MIN (-0x7fffffffffffffff - _C2) + #define INT_LEAST64_MAX 0x7fffffffffffffff + #define UINT_LEAST64_MAX 0xffffffffffffffffU + + #define INT_FAST64_MIN (-0x7fffffffffffffff - _C2) + #define INT_FAST64_MAX 0x7fffffffffffffff + #define UINT_FAST64_MAX 0xffffffffffffffffU + + #define INTMAX_MIN (-0x7fffffffffffffff - _C2) + #define INTMAX_MAX 0x7fffffffffffffff + #define UINTMAX_MAX 0xffffffffffffffffU + +#define INT64_C(x) ((x) + (INT64_MAX - INT64_MAX)) +#define UINT64_C(x) ((x) + (UINT64_MAX - UINT64_MAX)) +#define INTMAX_C(x) INT64_C(x) +#define UINTMAX_C(x) UINT64_C(x) +_C_STD_END +#endif /* RC_INVOKED */ +#endif /* _STDINT */ + + #if defined(_STD_USING) +using _CSTD int8_t; using _CSTD int16_t; +using _CSTD int32_t; using _CSTD int64_t; + +using _CSTD uint8_t; using _CSTD uint16_t; +using _CSTD uint32_t; using _CSTD uint64_t; + +using _CSTD int_least8_t; using _CSTD int_least16_t; +using _CSTD int_least32_t; using _CSTD int_least64_t; +using _CSTD uint_least8_t; using _CSTD uint_least16_t; +using _CSTD uint_least32_t; using _CSTD uint_least64_t; + +using _CSTD intmax_t; using _CSTD uintmax_t; + +using _CSTD uintptr_t; +using _CSTD intptr_t; + +using _CSTD int_fast8_t; using _CSTD int_fast16_t; +using _CSTD int_fast32_t; using _CSTD int_fast64_t; +using _CSTD uint_fast8_t; using _CSTD uint_fast16_t; +using _CSTD uint_fast32_t; using _CSTD uint_fast64_t; + #endif /* defined(_STD_USING) */ + +/* + * Copyright (c) 1992-2009 by P.J. Plauger. ALL RIGHTS RESERVED. + * Consult your license regarding permissions and restrictions. +V5.20:0009 */ +#endif /* !defined(_MSC_VER) && !defined(INT8_MIN) */ \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ffi.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ffi.gemspec new file mode 100644 index 000000000..957d75b8d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/ffi.gemspec @@ -0,0 +1,23 @@ +require File.expand_path("../lib/#{File.basename(__FILE__, '.gemspec')}/version", __FILE__) + +Gem::Specification.new do |s| + s.name = 'ffi' + s.version = FFI::VERSION + s.author = 'Wayne Meissner' + s.email = 'wmeissner@gmail.com' + s.homepage = 'http://wiki.github.com/ffi/ffi' + s.summary = 'Ruby FFI' + s.description = 'Ruby FFI library' + s.files = %w(ffi.gemspec LICENSE COPYING README.md Rakefile) + Dir.glob("{ext,gen,lib,spec,libtest}/**/*").reject { |f| f =~ /(lib\/[12]\.[089]|\.s?[ao]$|\.bundle|\.dylib$)/ } + s.extensions << 'ext/ffi_c/extconf.rb' + s.has_rdoc = false + s.rdoc_options = %w[--exclude=ext/ffi_c/.*\.o$ --exclude=ffi_c\.(bundle|so)$] + s.license = 'BSD' + s.require_paths << 'ext/ffi_c' + s.required_ruby_version = '>= 1.8.7' + s.add_development_dependency 'rake', '~> 10.1' + s.add_development_dependency 'rake-compiler', '~> 0.9' + s.add_development_dependency 'rake-compiler-dock', '~> 0.4.0' + s.add_development_dependency 'rspec', '~> 2.14.1' + s.add_development_dependency 'rubygems-tasks', "~> 0.2.4" +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/gen/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/gen/Rakefile new file mode 100644 index 000000000..f71a1da5b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/gen/Rakefile @@ -0,0 +1,30 @@ +$LOAD_PATH.unshift File.join(File.dirname(__FILE__), '..', 'lib') +require 'fileutils' +require 'ffi' +require 'ffi/platform' +require 'ffi/tools/types_generator' +types_conf = File.expand_path(File.join(FFI::Platform::CONF_DIR, 'types.conf')) + +logfile = File.join(File.dirname(__FILE__), 'log') + +file types_conf do |task| + options = {} + FileUtils.mkdir_p(File.dirname(task.name), { :mode => 0755 }) + File.open(task.name, File::CREAT|File::TRUNC|File::RDWR, 0644) do |f| + f.puts FFI::TypesGenerator.generate(options) + end + File.open(logfile, 'w') do |log| + log.puts(types_conf) + end +end + +task :default => types_conf do +end + +task :clean do + File.readlines(logfile).each do |file| + file.strip! + rm_f file + end + rm_f logfile +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi.rb new file mode 100644 index 000000000..361e53d70 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi.rb @@ -0,0 +1,20 @@ +if !defined?(RUBY_ENGINE) || RUBY_ENGINE == 'ruby' || RUBY_ENGINE == 'rbx' + Object.send(:remove_const, :FFI) if defined?(::FFI) + begin + require RUBY_VERSION.split('.')[0, 2].join('.') + '/ffi_c' + rescue Exception + require 'ffi_c' + end + + require 'ffi/ffi' + +elsif defined?(RUBY_ENGINE) + # Remove the ffi gem dir from the load path, then reload the internal ffi implementation + $LOAD_PATH.delete(File.dirname(__FILE__)) + $LOAD_PATH.delete(File.join(File.dirname(__FILE__), 'ffi')) + unless $LOADED_FEATURES.nil? + $LOADED_FEATURES.delete(__FILE__) + $LOADED_FEATURES.delete('ffi.rb') + end + require 'ffi.rb' +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/autopointer.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/autopointer.rb new file mode 100644 index 000000000..e6946d867 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/autopointer.rb @@ -0,0 +1,194 @@ +# +# Copyright (C) 2008-2010 Wayne Meissner +# Copyright (C) 2008 Mike Dalessio +# +# This file is part of ruby-ffi. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Ruby FFI project nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +module FFI + class AutoPointer < Pointer + extend DataConverter + + # @overload initialize(pointer, method) + # @param [Pointer] pointer + # @param [Method] method + # @return [self] + # The passed Method will be invoked at GC time. + # @overload initialize(pointer, proc) + # @param [Pointer] pointer + # @return [self] + # The passed Proc will be invoked at GC time (SEE WARNING BELOW!) + # @note WARNING: passing a proc _may_ cause your pointer to never be GC'd, unless you're + # careful to avoid trapping a reference to the pointer in the proc. See the test + # specs for examples. + # @overload initialize(pointer) { |p| ... } + # @param [Pointer] pointer + # @yieldparam [Pointer] p +pointer+ passed to the block + # @return [self] + # The passed block will be invoked at GC time. + # @note WARNING: passing a block will cause your pointer to never be GC'd. This is bad. + # @overload initialize(pointer) + # @param [Pointer] pointer + # @return [self] + # The pointer's release() class method will be invoked at GC time. + # + # @note The safest, and therefore preferred, calling + # idiom is to pass a Method as the second parameter. Example usage: + # + # class PointerHelper + # def self.release(pointer) + # ... + # end + # end + # + # p = AutoPointer.new(other_pointer, PointerHelper.method(:release)) + # + # The above code will cause PointerHelper#release to be invoked at GC time. + # + # @note + # The last calling idiom (only one parameter) is generally only + # going to be useful if you subclass {AutoPointer}, and override + # #release, which by default does nothing. + def initialize(ptr, proc=nil, &block) + super(ptr.type_size, ptr) + raise TypeError, "Invalid pointer" if ptr.nil? || !ptr.kind_of?(Pointer) \ + || ptr.kind_of?(MemoryPointer) || ptr.kind_of?(AutoPointer) + + @releaser = if proc + raise RuntimeError.new("proc must be callable") unless proc.respond_to?(:call) + CallableReleaser.new(ptr, proc) + + else + raise RuntimeError.new("no release method defined") unless self.class.respond_to?(:release) + DefaultReleaser.new(ptr, self.class) + end + + ObjectSpace.define_finalizer(self, @releaser) + self + end + + # @return [nil] + # Free the pointer. + def free + @releaser.free + end + + # @param [Boolean] autorelease + # @return [Boolean] +autorelease+ + # Set +autorelease+ property. See {Pointer Autorelease section at Pointer}. + def autorelease=(autorelease) + @releaser.autorelease=(autorelease) + end + + # @return [Boolean] +autorelease+ + # Get +autorelease+ property. See {Pointer Autorelease section at Pointer}. + def autorelease? + @releaser.autorelease + end + + # @abstract Base class for {AutoPointer}'s releasers. + # + # All subclasses of Releaser should define a +#release(ptr)+ method. + # A releaser is an object in charge of release an {AutoPointer}. + class Releaser + attr_accessor :autorelease + + # @param [Pointer] ptr + # @param [#call] proc + # @return [nil] + # A new instance of Releaser. + def initialize(ptr, proc) + @ptr = ptr + @proc = proc + @autorelease = true + end + + # @return [nil] + # Free pointer. + def free + if @ptr + release(@ptr) + @autorelease = false + @ptr = nil + @proc = nil + end + end + + # @param args + # Release pointer if +autorelease+ is set. + def call(*args) + release(@ptr) if @autorelease && @ptr + end + + end + + # DefaultReleaser is a {Releaser} used when an {AutoPointer} is defined without Proc + # or Method. In this case, the pointer to release must be of a class derived from + # AutoPointer with a +#release+ class method. + class DefaultReleaser < Releaser + # @param [Pointer] ptr + # @return [nil] + # Release +ptr+ by using his #release class method. + def release(ptr) + @proc.release(ptr) + end + end + + # CallableReleaser is a {Releaser} used when an {AutoPointer} is defined with a + # Proc or a Method. + class CallableReleaser < Releaser + # Release +ptr+ by using Proc or Method defined at +ptr+ {AutoPointer#initialize initialization}. + # @param [Pointer] ptr + # @return [nil] + def release(ptr) + @proc.call(ptr) + end + end + + # Return native type of AutoPointer. + # + # Override {DataConverter#native_type}. + # @return [Type::POINTER] + # @raise {RuntimeError} if class does not implement a +#release+ method + def self.native_type + raise RuntimeError.new("no release method defined for #{self.inspect}") unless self.respond_to?(:release) + Type::POINTER + end + + # Create a new AutoPointer. + # + # Override {DataConverter#from_native}. + # @overload self.from_native(ptr, ctx) + # @param [Pointer] ptr + # @param ctx not used. Please set +nil+. + # @return [AutoPointer] + def self.from_native(val, ctx) + self.new(val) + end + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/buffer.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/buffer.rb new file mode 100644 index 000000000..449e45b0d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/buffer.rb @@ -0,0 +1,4 @@ +# +# All the code from this file is now implemented in C. This file remains +# to satisfy any leftover require 'ffi/buffer' in user code +# diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/callback.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/callback.rb new file mode 100644 index 000000000..32d52f721 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/callback.rb @@ -0,0 +1,4 @@ +# +# All the code from this file is now implemented in C. This file remains +# to satisfy any leftover require 'ffi/callback' in user code +# diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/enum.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/enum.rb new file mode 100644 index 000000000..0e84ba7aa --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/enum.rb @@ -0,0 +1,174 @@ +# +# Copyright (C) 2009, 2010 Wayne Meissner +# Copyright (C) 2009 Luc Heinrich +# +# This file is part of ruby-ffi. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Ruby FFI project nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +module FFI + + # An instance of this class permits to manage {Enum}s. In fact, Enums is a collection of {Enum}s. + class Enums + + # @return [nil] + def initialize + @all_enums = Array.new + @tagged_enums = Hash.new + @symbol_map = Hash.new + end + + # @param [Enum] enum + # Add an {Enum} to the collection. + def <<(enum) + @all_enums << enum + @tagged_enums[enum.tag] = enum unless enum.tag.nil? + @symbol_map.merge!(enum.symbol_map) + end + + # @param query enum tag or part of an enum name + # @return [Enum] + # Find a {Enum} in collection. + def find(query) + if @tagged_enums.has_key?(query) + @tagged_enums[query] + else + @all_enums.detect { |enum| enum.symbols.include?(query) } + end + end + + # @param symbol a symbol to find in merge symbol maps of all enums. + # @return a symbol + def __map_symbol(symbol) + @symbol_map[symbol] + end + + end + + # Represents a C enum. + # + # For a C enum: + # enum fruits { + # apple, + # banana, + # orange, + # pineapple + # }; + # are defined this vocabulary: + # * a _symbol_ is a word from the enumeration (ie. _apple_, by example); + # * a _value_ is the value of a symbol in the enumeration (by example, apple has value _0_ and banana _1_). + class Enum + include DataConverter + + attr_reader :tag + attr_reader :native_type + + # @overload initialize(info, tag=nil) + # @param [nil, Enumerable] info + # @param [nil, Symbol] tag enum tag + # @overload initialize(native_type, info, tag=nil) + # @param [FFI::Type] native_type Native type for new Enum + # @param [nil, Enumerable] info symbols and values for new Enum + # @param [nil, Symbol] tag name of new Enum + def initialize(*args) + @native_type = args.first.kind_of?(FFI::Type) ? args.shift : Type::INT + info, @tag = *args + @kv_map = Hash.new + unless info.nil? + last_cst = nil + value = 0 + info.each do |i| + case i + when Symbol + raise ArgumentError, "duplicate enum key" if @kv_map.has_key?(i) + @kv_map[i] = value + last_cst = i + value += 1 + when Integer + @kv_map[last_cst] = i + value = i+1 + end + end + end + @vk_map = @kv_map.invert + end + + # @return [Array] enum symbol names + def symbols + @kv_map.keys + end + + # Get a symbol or a value from the enum. + # @overload [](query) + # Get enum value from symbol. + # @param [Symbol] query + # @return [Integer] + # @overload [](query) + # Get enum symbol from value. + # @param [Integer] query + # @return [Symbol] + def [](query) + case query + when Symbol + @kv_map[query] + when Integer + @vk_map[query] + end + end + alias find [] + + # Get the symbol map. + # @return [Hash] + def symbol_map + @kv_map + end + + alias to_h symbol_map + alias to_hash symbol_map + + # @param [Symbol, Integer, #to_int] val + # @param ctx unused + # @return [Integer] value of a enum symbol + def to_native(val, ctx) + @kv_map[val] || if val.is_a?(Integer) + val + elsif val.respond_to?(:to_int) + val.to_int + else + raise ArgumentError, "invalid enum value, #{val.inspect}" + end + end + + # @param val + # @return symbol name if it exists for +val+. + def from_native(val, ctx) + @vk_map[val] || val + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/errno.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/errno.rb new file mode 100644 index 000000000..de82d891f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/errno.rb @@ -0,0 +1,43 @@ +# +# Copyright (C) 2008-2010 Wayne Meissner +# +# This file is part of ruby-ffi. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Ruby FFI project nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.# + +module FFI + # @return (see FFI::LastError.error) + # @see FFI::LastError.error + def self.errno + FFI::LastError.error + end + # @param error (see FFI::LastError.error=) + # @return (see FFI::LastError.error=) + # @see FFI::LastError.error= + def self.errno=(error) + FFI::LastError.error = error + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/ffi.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/ffi.rb new file mode 100644 index 000000000..11d451f0a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/ffi.rb @@ -0,0 +1,44 @@ +# +# Copyright (C) 2008-2010 JRuby project +# +# This file is part of ruby-ffi. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Ruby FFI project nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +require 'ffi/platform' +require 'ffi/types' +require 'ffi/library' +require 'ffi/errno' +require 'ffi/pointer' +require 'ffi/memorypointer' +require 'ffi/struct' +require 'ffi/union' +require 'ffi/managedstruct' +require 'ffi/callback' +require 'ffi/io' +require 'ffi/autopointer' +require 'ffi/variadic' +require 'ffi/enum' diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/io.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/io.rb new file mode 100644 index 000000000..7fa1cf7fd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/io.rb @@ -0,0 +1,62 @@ +# +# Copyright (C) 2008, 2009 Wayne Meissner +# +# This file is part of ruby-ffi. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Ruby FFI project nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.# + +module FFI + + # This module implements a couple of class methods to play with IO. + module IO + # @param [Integer] fd file decriptor + # @param [String] mode mode string + # @return [::IO] + # Synonym for IO::for_fd. + def self.for_fd(fd, mode = "r") + ::IO.for_fd(fd, mode) + end + + # @param [#read] io io to read from + # @param [AbstractMemory] buf destination for data read from +io+ + # @param [nil, Numeric] len maximul number of bytes to read from +io+. If +nil+, + # read until end of file. + # @return [Numeric] length really read, in bytes + # + # A version of IO#read that reads data from an IO and put then into a native buffer. + # + # This will be optimized at some future time to eliminate the double copy. + # + def self.native_read(io, buf, len) + tmp = io.read(len) + return -1 unless tmp + buf.put_bytes(0, tmp) + tmp.length + end + + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/library.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/library.rb new file mode 100644 index 000000000..9849a3abe --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/library.rb @@ -0,0 +1,524 @@ +# +# Copyright (C) 2008-2010 Wayne Meissner +# +# This file is part of ruby-ffi. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Ruby FFI project nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.# + +module FFI + CURRENT_PROCESS = USE_THIS_PROCESS_AS_LIBRARY = Object.new + + # @param [#to_s] lib library name + # @return [String] library name formatted for current platform + # Transform a generic library name to a platform library name + # @example + # # Linux + # FFI.map_library_name 'c' # -> "libc.so.6" + # FFI.map_library_name 'jpeg' # -> "libjpeg.so" + # # Windows + # FFI.map_library_name 'c' # -> "msvcrt.dll" + # FFI.map_library_name 'jpeg' # -> "jpeg.dll" + def self.map_library_name(lib) + # Mangle the library name to reflect the native library naming conventions + lib = lib.to_s unless lib.kind_of?(String) + lib = Library::LIBC if lib == 'c' + + if lib && File.basename(lib) == lib + lib = Platform::LIBPREFIX + lib unless lib =~ /^#{Platform::LIBPREFIX}/ + r = Platform::IS_GNU ? "\\.so($|\\.[1234567890]+)" : "\\.#{Platform::LIBSUFFIX}$" + lib += ".#{Platform::LIBSUFFIX}" unless lib =~ /#{r}/ + end + + lib + end + + # Exception raised when a function is not found in libraries + class NotFoundError < LoadError + def initialize(function, *libraries) + super("Function '#{function}' not found in [#{libraries[0].nil? ? 'current process' : libraries.join(", ")}]") + end + end + + # This module is the base to use native functions. + # + # A basic usage may be: + # require 'ffi' + # + # module Hello + # extend FFI::Library + # ffi_lib FFI::Library::LIBC + # attach_function 'puts', [ :string ], :int + # end + # + # Hello.puts("Hello, World") + # + # + module Library + CURRENT_PROCESS = FFI::CURRENT_PROCESS + LIBC = FFI::Platform::LIBC + + # @param mod extended object + # @return [nil] + # @raise {RuntimeError} if +mod+ is not a Module + # Test if extended object is a Module. If not, raise RuntimeError. + def self.extended(mod) + raise RuntimeError.new("must only be extended by module") unless mod.kind_of?(Module) + end + + + # @param [Array] names names of libraries to load + # @return [Array] + # @raise {LoadError} if a library cannot be opened + # Load native libraries. + def ffi_lib(*names) + raise LoadError.new("library names list must not be empty") if names.empty? + + lib_flags = defined?(@ffi_lib_flags) ? @ffi_lib_flags : FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_LOCAL + ffi_libs = names.map do |name| + + if name == FFI::CURRENT_PROCESS + FFI::DynamicLibrary.open(nil, FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_LOCAL) + + else + libnames = (name.is_a?(::Array) ? name : [ name ]).map { |n| [ n, FFI.map_library_name(n) ].uniq }.flatten.compact + lib = nil + errors = {} + + libnames.each do |libname| + begin + lib = FFI::DynamicLibrary.open(libname, lib_flags) + break if lib + + rescue Exception => ex + ldscript = false + if ex.message =~ /(([^ \t()])+\.so([^ \t:()])*):([ \t])*(invalid ELF header|file too short|invalid file format)/ + if File.read($1) =~ /(?:GROUP|INPUT) *\( *([^ \)]+)/ + libname = $1 + ldscript = true + end + end + + if ldscript + retry + else + errors[libname] = ex + end + end + end + + if lib.nil? + raise LoadError.new(errors.values.join(".\n")) + end + + # return the found lib + lib + end + end + + @ffi_libs = ffi_libs + end + + # Set the calling convention for {#attach_function} and {#callback} + # + # @see http://en.wikipedia.org/wiki/Stdcall#stdcall + # @note +:stdcall+ is typically used for attaching Windows API functions + # + # @param [Symbol] convention one of +:default+, +:stdcall+ + # @return [Symbol] the new calling convention + def ffi_convention(convention = nil) + @ffi_convention ||= :default + @ffi_convention = convention if convention + @ffi_convention + end + + # @see #ffi_lib + # @return [Array] array of currently loaded FFI libraries + # @raise [LoadError] if no libraries have been loaded (using {#ffi_lib}) + # Get FFI libraries loaded using {#ffi_lib}. + def ffi_libraries + raise LoadError.new("no library specified") if !defined?(@ffi_libs) || @ffi_libs.empty? + @ffi_libs + end + + # Flags used in {#ffi_lib}. + # + # This map allows you to supply symbols to {#ffi_lib_flags} instead of + # the actual constants. + FlagsMap = { + :global => DynamicLibrary::RTLD_GLOBAL, + :local => DynamicLibrary::RTLD_LOCAL, + :lazy => DynamicLibrary::RTLD_LAZY, + :now => DynamicLibrary::RTLD_NOW + } + + # Sets library flags for {#ffi_lib}. + # + # @example + # ffi_lib_flags(:lazy, :local) # => 5 + # + # @param [Symbol, …] flags (see {FlagsMap}) + # @return [Fixnum] the new value + def ffi_lib_flags(*flags) + @ffi_lib_flags = flags.inject(0) { |result, f| result | FlagsMap[f] } + end + + + ## + # @overload attach_function(func, args, returns, options = {}) + # @example attach function without an explicit name + # module Foo + # extend FFI::Library + # ffi_lib FFI::Library::LIBC + # attach_function :malloc, [:size_t], :pointer + # end + # # now callable via Foo.malloc + # @overload attach_function(name, func, args, returns, options = {}) + # @example attach function with an explicit name + # module Bar + # extend FFI::Library + # ffi_lib FFI::Library::LIBC + # attach_function :c_malloc, :malloc, [:size_t], :pointer + # end + # # now callable via Bar.c_malloc + # + # Attach C function +func+ to this module. + # + # + # @param [#to_s] name name of ruby method to attach as + # @param [#to_s] func name of C function to attach + # @param [Array] args an array of types + # @param [Symbol] returns type of return value + # @option options [Boolean] :blocking (@blocking) set to true if the C function is a blocking call + # @option options [Symbol] :convention (:default) calling convention (see {#ffi_convention}) + # @option options [FFI::Enums] :enums + # @option options [Hash] :type_map + # + # @return [FFI::VariadicInvoker] + # + # @raise [FFI::NotFoundError] if +func+ cannot be found in the attached libraries (see {#ffi_lib}) + def attach_function(name, func, args, returns = nil, options = nil) + mname, a2, a3, a4, a5 = name, func, args, returns, options + cname, arg_types, ret_type, opts = (a4 && (a2.is_a?(String) || a2.is_a?(Symbol))) ? [ a2, a3, a4, a5 ] : [ mname.to_s, a2, a3, a4 ] + + # Convert :foo to the native type + arg_types = arg_types.map { |e| find_type(e) } + options = { + :convention => ffi_convention, + :type_map => defined?(@ffi_typedefs) ? @ffi_typedefs : nil, + :blocking => defined?(@blocking) && @blocking, + :enums => defined?(@ffi_enums) ? @ffi_enums : nil, + } + + @blocking = false + options.merge!(opts) if opts && opts.is_a?(Hash) + + # Try to locate the function in any of the libraries + invokers = [] + ffi_libraries.each do |lib| + if invokers.empty? + begin + function = nil + function_names(cname, arg_types).find do |fname| + function = lib.find_function(fname) + end + raise LoadError unless function + + invokers << if arg_types.length > 0 && arg_types[arg_types.length - 1] == FFI::NativeType::VARARGS + VariadicInvoker.new(function, arg_types, find_type(ret_type), options) + + else + Function.new(find_type(ret_type), arg_types, function, options) + end + + rescue LoadError + end + end + end + invoker = invokers.compact.shift + raise FFI::NotFoundError.new(cname.to_s, ffi_libraries.map { |lib| lib.name }) unless invoker + + invoker.attach(self, mname.to_s) + invoker + end + + # @param [#to_s] name function name + # @param [Array] arg_types function's argument types + # @return [Array] + # This function returns a list of possible names to lookup. + # @note Function names on windows may be decorated if they are using stdcall. See + # * http://en.wikipedia.org/wiki/Name_mangling#C_name_decoration_in_Microsoft_Windows + # * http://msdn.microsoft.com/en-us/library/zxk0tw93%28v=VS.100%29.aspx + # * http://en.wikibooks.org/wiki/X86_Disassembly/Calling_Conventions#STDCALL + # Note that decorated names can be overridden via def files. Also note that the + # windows api, although using, doesn't have decorated names. + def function_names(name, arg_types) + result = [name.to_s] + if ffi_convention == :stdcall + # Get the size of each parameter + size = arg_types.inject(0) do |mem, arg| + size = arg.size + # The size must be a multiple of 4 + size += (4 - size) % 4 + mem + size + end + + result << "_#{name.to_s}@#{size}" # win32 + result << "#{name.to_s}@#{size}" # win64 + end + result + end + + # @overload attach_variable(mname, cname, type) + # @param [#to_s] mname name of ruby method to attach as + # @param [#to_s] cname name of C variable to attach + # @param [DataConverter, Struct, Symbol, Type] type C variable's type + # @example + # module Bar + # extend FFI::Library + # ffi_lib 'my_lib' + # attach_variable :c_myvar, :myvar, :long + # end + # # now callable via Bar.c_myvar + # @overload attach_variable(cname, type) + # @param [#to_s] mname name of ruby method to attach as + # @param [DataConverter, Struct, Symbol, Type] type C variable's type + # @example + # module Bar + # extend FFI::Library + # ffi_lib 'my_lib' + # attach_variable :myvar, :long + # end + # # now callable via Bar.myvar + # @return [DynamicLibrary::Symbol] + # @raise {FFI::NotFoundError} if +cname+ cannot be found in libraries + # + # Attach C variable +cname+ to this module. + def attach_variable(mname, a1, a2 = nil) + cname, type = a2 ? [ a1, a2 ] : [ mname.to_s, a1 ] + address = nil + ffi_libraries.each do |lib| + begin + address = lib.find_variable(cname.to_s) + break unless address.nil? + rescue LoadError + end + end + + raise FFI::NotFoundError.new(cname, ffi_libraries) if address.nil? || address.null? + if type.is_a?(Class) && type < FFI::Struct + # If it is a global struct, just attach directly to the pointer + s = type.new(address) + self.module_eval <<-code, __FILE__, __LINE__ + @@ffi_gvar_#{mname} = s + def self.#{mname} + @@ffi_gvar_#{mname} + end + code + + else + sc = Class.new(FFI::Struct) + sc.layout :gvar, find_type(type) + s = sc.new(address) + # + # Attach to this module as mname/mname= + # + self.module_eval <<-code, __FILE__, __LINE__ + @@ffi_gvar_#{mname} = s + def self.#{mname} + @@ffi_gvar_#{mname}[:gvar] + end + def self.#{mname}=(value) + @@ffi_gvar_#{mname}[:gvar] = value + end + code + + end + + address + end + + + # @overload callback(name, params, ret) + # @param name callback name to add to type map + # @param [Array] params array of parameters' types + # @param [DataConverter, Struct, Symbol, Type] ret callback return type + # @overload callback(params, ret) + # @param [Array] params array of parameters' types + # @param [DataConverter, Struct, Symbol, Type] ret callback return type + # @return [FFI::CallbackInfo] + def callback(*args) + raise ArgumentError, "wrong number of arguments" if args.length < 2 || args.length > 3 + name, params, ret = if args.length == 3 + args + else + [ nil, args[0], args[1] ] + end + + native_params = params.map { |e| find_type(e) } + raise ArgumentError, "callbacks cannot have variadic parameters" if native_params.include?(FFI::Type::VARARGS) + options = Hash.new + options[:convention] = ffi_convention + options[:enums] = @ffi_enums if defined?(@ffi_enums) + cb = FFI::CallbackInfo.new(find_type(ret), native_params, options) + + # Add to the symbol -> type map (unless there was no name) + unless name.nil? + typedef cb, name + end + + cb + end + + # Register or get an already registered type definition. + # + # To register a new type definition, +old+ should be a {FFI::Type}. +add+ + # is in this case the type definition. + # + # If +old+ is a {DataConverter}, a {Type::Mapped} is returned. + # + # If +old+ is +:enum+ + # * and +add+ is an +Array+, a call to {#enum} is made with +add+ as single parameter; + # * in others cases, +info+ is used to create a named enum. + # + # If +old+ is a key for type map, #typedef get +old+ type definition. + # + # @param [DataConverter, Symbol, Type] old + # @param [Symbol] add + # @param [Symbol] info + # @return [FFI::Enum, FFI::Type] + def typedef(old, add, info=nil) + @ffi_typedefs = Hash.new unless defined?(@ffi_typedefs) + + @ffi_typedefs[add] = if old.kind_of?(FFI::Type) + old + + elsif @ffi_typedefs.has_key?(old) + @ffi_typedefs[old] + + elsif old.is_a?(DataConverter) + FFI::Type::Mapped.new(old) + + elsif old == :enum + if add.kind_of?(Array) + self.enum(add) + else + self.enum(info, add) + end + + else + FFI.find_type(old) + end + end + + # @overload enum(name, values) + # Create a named enum. + # @example + # enum :foo, [:zero, :one, :two] # named enum + # @param [Symbol] name name for new enum + # @param [Array] values values for enum + # @overload enum(*args) + # Create an unnamed enum. + # @example + # enum :zero, :one, :two # unnamed enum + # @param args values for enum + # @overload enum(values) + # Create an unnamed enum. + # @example + # enum [:zero, :one, :two] # unnamed enum, equivalent to above example + # @param [Array] values values for enum + # @overload enum(native_type, name, values) + # Create a named enum and specify the native type. + # @example + # enum FFI::Type::UINT64, :foo, [:zero, :one, :two] # named enum + # @param [FFI::Type] native_type native type for new enum + # @param [Symbol] name name for new enum + # @param [Array] values values for enum + # @overload enum(native_type, *args) + # Create an unnamed enum and specify the native type. + # @example + # enum FFI::Type::UINT64, :zero, :one, :two # unnamed enum + # @param [FFI::Type] native_type native type for new enum + # @param args values for enum + # @overload enum(native_type, values) + # Create an unnamed enum and specify the native type. + # @example + # enum Type::UINT64, [:zero, :one, :two] # unnamed enum, equivalent to above example + # @param [FFI::Type] native_type native type for new enum + # @param [Array] values values for enum + # @return [FFI::Enum] + # Create a new {FFI::Enum}. + def enum(*args) + native_type = args.first.kind_of?(FFI::Type) ? args.shift : nil + name, values = if args[0].kind_of?(Symbol) && args[1].kind_of?(Array) + [ args[0], args[1] ] + elsif args[0].kind_of?(Array) + [ nil, args[0] ] + else + [ nil, args ] + end + @ffi_enums = FFI::Enums.new unless defined?(@ffi_enums) + @ffi_enums << (e = native_type ? FFI::Enum.new(native_type, values, name) : FFI::Enum.new(values, name)) + + # If called as enum :foo, [ :zero, :one, :two ], add a typedef alias + typedef(e, name) if name + e + end + + # @param name + # @return [FFI::Enum] + # Find an enum by name. + def enum_type(name) + @ffi_enums.find(name) if defined?(@ffi_enums) + end + + # @param symbol + # @return [FFI::Enum] + # Find an enum by a symbol it contains. + def enum_value(symbol) + @ffi_enums.__map_symbol(symbol) + end + + # @param [DataConverter, Type, Struct, Symbol] t type to find + # @return [Type] + # Find a type definition. + def find_type(t) + if t.kind_of?(Type) + t + + elsif defined?(@ffi_typedefs) && @ffi_typedefs.has_key?(t) + @ffi_typedefs[t] + + elsif t.is_a?(Class) && t < Struct + Type::POINTER + + elsif t.is_a?(DataConverter) + # Add a typedef so next time the converter is used, it hits the cache + typedef Type::Mapped.new(t), t + + end || FFI.find_type(t) + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/managedstruct.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/managedstruct.rb new file mode 100644 index 000000000..0536280a9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/managedstruct.rb @@ -0,0 +1,84 @@ +# Copyright (C) 2008 Mike Dalessio +# +# This file is part of ruby-ffi. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Ruby FFI project nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +module FFI + # + # FFI::ManagedStruct allows custom garbage-collection of your FFI::Structs. + # + # The typical use case would be when interacting with a library + # that has a nontrivial memory management design, such as a linked + # list or a binary tree. + # + # When the {Struct} instance is garbage collected, FFI::ManagedStruct will + # invoke the class's release() method during object finalization. + # + # @example Example usage: + # module MyLibrary + # ffi_lib "libmylibrary" + # attach_function :new_dlist, [], :pointer + # attach_function :destroy_dlist, [:pointer], :void + # end + # + # class DoublyLinkedList < FFI::ManagedStruct + # @@@ + # struct do |s| + # s.name 'struct dlist' + # s.include 'dlist.h' + # s.field :head, :pointer + # s.field :tail, :pointer + # end + # @@@ + # + # def self.release ptr + # MyLibrary.destroy_dlist(ptr) + # end + # end + # + # begin + # ptr = DoublyLinkedList.new(MyLibrary.new_dlist) + # # do something with the list + # end + # # struct is out of scope, and will be GC'd using DoublyLinkedList#release + # + # + class ManagedStruct < FFI::Struct + + # @overload initialize(pointer) + # @param [Pointer] pointer + # Create a new ManagedStruct which will invoke the class method #release on + # @overload initialize + # A new instance of FFI::ManagedStruct. + def initialize(pointer=nil) + raise NoMethodError, "release() not implemented for class #{self}" unless self.class.respond_to? :release + raise ArgumentError, "Must supply a pointer to memory for the Struct" unless pointer + super AutoPointer.new(pointer, self.class.method(:release)) + end + + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/memorypointer.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/memorypointer.rb new file mode 100644 index 000000000..9f07bc695 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/memorypointer.rb @@ -0,0 +1 @@ +# This class is now implemented in C diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform.rb new file mode 100644 index 000000000..739345973 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform.rb @@ -0,0 +1,159 @@ +# +# Copyright (C) 2008, 2009 Wayne Meissner +# +# This file is part of ruby-ffi. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Ruby FFI project nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.# + +require 'rbconfig' +module FFI + class PlatformError < LoadError; end + + # This module defines different constants and class methods to play with + # various platforms. + module Platform + OS = case RbConfig::CONFIG['host_os'].downcase + when /linux/ + "linux" + when /darwin/ + "darwin" + when /freebsd/ + "freebsd" + when /netbsd/ + "netbsd" + when /openbsd/ + "openbsd" + when /sunos|solaris/ + "solaris" + when /mingw|mswin/ + "windows" + else + RbConfig::CONFIG['host_os'].downcase + end + + ARCH = case CPU.downcase + when /amd64|x86_64/ + "x86_64" + when /i?86|x86|i86pc/ + "i386" + when /ppc64|powerpc64/ + "powerpc64" + when /ppc|powerpc/ + "powerpc" + else + case RbConfig::CONFIG['host_cpu'] + when /^arm/ + "arm" + else + RbConfig::CONFIG['host_cpu'] + end + end + + private + # @param [String) os + # @return [Boolean] + # Test if current OS is +os+. + def self.is_os(os) + OS == os + end + + NAME = "#{ARCH}-#{OS}" + IS_GNU = defined?(GNU_LIBC) + IS_LINUX = is_os("linux") + IS_MAC = is_os("darwin") + IS_FREEBSD = is_os("freebsd") + IS_NETBSD = is_os("netbsd") + IS_OPENBSD = is_os("openbsd") + IS_SOLARIS = is_os("solaris") + IS_WINDOWS = is_os("windows") + IS_BSD = IS_MAC || IS_FREEBSD || IS_NETBSD || IS_OPENBSD + CONF_DIR = File.join(File.dirname(__FILE__), 'platform', NAME) + + public + + LIBPREFIX = case OS + when /windows/ + '' + when /cygwin/ + 'cyg' + else + 'lib' + end + + LIBSUFFIX = case OS + when /darwin/ + 'dylib' + when /linux|bsd|solaris/ + 'so' + when /windows|cygwin/ + 'dll' + else + # Punt and just assume a sane unix (i.e. anything but AIX) + 'so' + end + + LIBC = if IS_WINDOWS + RbConfig::CONFIG['RUBY_SO_NAME'].split('-')[-2] + '.dll' + elsif IS_GNU + GNU_LIBC + elsif OS == 'cygwin' + "cygwin1.dll" + else + "#{LIBPREFIX}c.#{LIBSUFFIX}" + end + + # Test if current OS is a *BSD (include MAC) + # @return [Boolean] + def self.bsd? + IS_BSD + end + + # Test if current OS is Windows + # @return [Boolean] + def self.windows? + IS_WINDOWS + end + + # Test if current OS is Mac OS + # @return [Boolean] + def self.mac? + IS_MAC + end + + # Test if current OS is Solaris (Sun OS) + # @return [Boolean] + def self.solaris? + IS_SOLARIS + end + + # Test if current OS is a unix OS + # @return [Boolean] + def self.unix? + !IS_WINDOWS + end + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/aarch64-linux/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/aarch64-linux/types.conf new file mode 100644 index 000000000..072c41933 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/aarch64-linux/types.conf @@ -0,0 +1,104 @@ +rbx.platform.typedef.__u_char = uchar +rbx.platform.typedef.__u_short = ushort +rbx.platform.typedef.__u_int = uint +rbx.platform.typedef.__u_long = ulong +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long +rbx.platform.typedef.__uint64_t = ulong +rbx.platform.typedef.__quad_t = long +rbx.platform.typedef.__u_quad_t = ulong +rbx.platform.typedef.__dev_t = ulong +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__ino_t = ulong +rbx.platform.typedef.__ino64_t = ulong +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = uint +rbx.platform.typedef.__off_t = long +rbx.platform.typedef.__off64_t = long +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__clock_t = long +rbx.platform.typedef.__rlim_t = ulong +rbx.platform.typedef.__rlim64_t = ulong +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__time_t = long +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = long +rbx.platform.typedef.__daddr_t = int +rbx.platform.typedef.__key_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__timer_t = pointer +rbx.platform.typedef.__blksize_t = int +rbx.platform.typedef.__blkcnt_t = long +rbx.platform.typedef.__blkcnt64_t = long +rbx.platform.typedef.__fsblkcnt_t = ulong +rbx.platform.typedef.__fsblkcnt64_t = ulong +rbx.platform.typedef.__fsfilcnt_t = ulong +rbx.platform.typedef.__fsfilcnt64_t = ulong +rbx.platform.typedef.__fsword_t = long +rbx.platform.typedef.__ssize_t = long +rbx.platform.typedef.__syscall_slong_t = long +rbx.platform.typedef.__syscall_ulong_t = ulong +rbx.platform.typedef.__loff_t = long +rbx.platform.typedef.*__qaddr_t = long +rbx.platform.typedef.*__caddr_t = char +rbx.platform.typedef.__intptr_t = long +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.quad_t = long +rbx.platform.typedef.u_quad_t = ulong +rbx.platform.typedef.loff_t = long +rbx.platform.typedef.ino_t = ulong +rbx.platform.typedef.dev_t = ulong +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = uint +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.off_t = long +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ssize_t = long +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.key_t = int +rbx.platform.typedef.clock_t = long +rbx.platform.typedef.time_t = long +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.timer_t = pointer +rbx.platform.typedef.size_t = ulong +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.register_t = long +rbx.platform.typedef.__sig_atomic_t = int +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.__fd_mask = long +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.blksize_t = int +rbx.platform.typedef.blkcnt_t = long +rbx.platform.typedef.fsblkcnt_t = ulong +rbx.platform.typedef.fsfilcnt_t = ulong +rbx.platform.typedef.pthread_t = ulong +rbx.platform.typedef.pthread_key_t = uint +rbx.platform.typedef.pthread_once_t = int +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.sa_family_t = ushort +rbx.platform.typedef.rlim_t = ulong +rbx.platform.typedef.__rlimit_resource_t = int +rbx.platform.typedef.__rusage_who_t = int +rbx.platform.typedef.__priority_which_t = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/arm-linux/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/arm-linux/types.conf new file mode 100644 index 000000000..e9a923b5f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/arm-linux/types.conf @@ -0,0 +1,104 @@ +rbx.platform.typedef.__u_char = uchar +rbx.platform.typedef.__u_short = ushort +rbx.platform.typedef.__u_int = uint +rbx.platform.typedef.__u_long = ulong +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long_long +rbx.platform.typedef.__uint64_t = ulong_long +rbx.platform.typedef.__quad_t = long_long +rbx.platform.typedef.__u_quad_t = ulong_long +rbx.platform.typedef.__dev_t = ulong_long +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__in_addr_t = uint +rbx.platform.typedef.__in_port_t = ushort +rbx.platform.typedef.__ino_t = ulong +rbx.platform.typedef.__ino64_t = ulong_long +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = uint +rbx.platform.typedef.__off_t = long +rbx.platform.typedef.__off64_t = long_long +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__clock_t = long +rbx.platform.typedef.__rlim_t = ulong +rbx.platform.typedef.__rlim64_t = ulong_long +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__time_t = long +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = long +rbx.platform.typedef.__daddr_t = int +rbx.platform.typedef.__swblk_t = long +rbx.platform.typedef.__key_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__timer_t = pointer +rbx.platform.typedef.__blksize_t = long +rbx.platform.typedef.__blkcnt_t = long +rbx.platform.typedef.__blkcnt64_t = long_long +rbx.platform.typedef.__fsblkcnt_t = ulong +rbx.platform.typedef.__fsblkcnt64_t = ulong_long +rbx.platform.typedef.__fsfilcnt_t = ulong +rbx.platform.typedef.__fsfilcnt64_t = ulong_long +rbx.platform.typedef.__ssize_t = int +rbx.platform.typedef.__loff_t = long_long +rbx.platform.typedef.*__qaddr_t = long_long +rbx.platform.typedef.*__caddr_t = char +rbx.platform.typedef.__intptr_t = int +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.quad_t = long_long +rbx.platform.typedef.u_quad_t = ulong_long +rbx.platform.typedef.loff_t = long_long +rbx.platform.typedef.ino_t = ulong_long +rbx.platform.typedef.dev_t = ulong_long +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = uint +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ssize_t = int +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.key_t = int +rbx.platform.typedef.clock_t = long +rbx.platform.typedef.time_t = long +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.timer_t = pointer +rbx.platform.typedef.size_t = uint +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.register_t = long +rbx.platform.typedef.__sig_atomic_t = int +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.__fd_mask = long +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.blksize_t = long +rbx.platform.typedef.blkcnt_t = long_long +rbx.platform.typedef.fsblkcnt_t = ulong_long +rbx.platform.typedef.fsfilcnt_t = ulong_long +rbx.platform.typedef.pthread_t = ulong +rbx.platform.typedef.pthread_key_t = uint +rbx.platform.typedef.pthread_once_t = int +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.sa_family_t = ushort +rbx.platform.typedef.rlim_t = ulong_long +rbx.platform.typedef.__rlimit_resource_t = int +rbx.platform.typedef.__rusage_who_t = int +rbx.platform.typedef.__priority_which_t = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-cygwin/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-cygwin/types.conf new file mode 100755 index 000000000..cd3cc381c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-cygwin/types.conf @@ -0,0 +1,3 @@ +rbx.platform.typedef.size_t = uint +rbx.platform.typedef.ptrdiff_t = int +rbx.platform.typedef.ssize_t = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-darwin/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-darwin/types.conf new file mode 100644 index 000000000..6b9313e5e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-darwin/types.conf @@ -0,0 +1,100 @@ +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long_long +rbx.platform.typedef.__uint64_t = ulong_long +rbx.platform.typedef.__darwin_intptr_t = long +rbx.platform.typedef.__darwin_natural_t = uint +rbx.platform.typedef.__darwin_ct_rune_t = int +rbx.platform.typedef.__darwin_ptrdiff_t = int +rbx.platform.typedef.__darwin_size_t = ulong +rbx.platform.typedef.__darwin_wchar_t = int +rbx.platform.typedef.__darwin_rune_t = int +rbx.platform.typedef.__darwin_wint_t = int +rbx.platform.typedef.__darwin_clock_t = ulong +rbx.platform.typedef.__darwin_socklen_t = uint +rbx.platform.typedef.__darwin_ssize_t = long +rbx.platform.typedef.__darwin_time_t = long +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.register_t = int +rbx.platform.typedef.intptr_t = long +rbx.platform.typedef.uintptr_t = ulong +rbx.platform.typedef.user_addr_t = ulong_long +rbx.platform.typedef.user_size_t = ulong_long +rbx.platform.typedef.user_ssize_t = long_long +rbx.platform.typedef.user_long_t = long_long +rbx.platform.typedef.user_ulong_t = ulong_long +rbx.platform.typedef.user_time_t = long_long +rbx.platform.typedef.syscall_arg_t = ulong_long +rbx.platform.typedef.__darwin_blkcnt_t = long_long +rbx.platform.typedef.__darwin_blksize_t = int +rbx.platform.typedef.__darwin_dev_t = int +rbx.platform.typedef.__darwin_fsblkcnt_t = uint +rbx.platform.typedef.__darwin_fsfilcnt_t = uint +rbx.platform.typedef.__darwin_gid_t = uint +rbx.platform.typedef.__darwin_id_t = uint +rbx.platform.typedef.__darwin_ino64_t = ulong_long +rbx.platform.typedef.__darwin_ino_t = ulong_long +rbx.platform.typedef.__darwin_mach_port_name_t = uint +rbx.platform.typedef.__darwin_mach_port_t = uint +rbx.platform.typedef.__darwin_mode_t = ushort +rbx.platform.typedef.__darwin_off_t = long_long +rbx.platform.typedef.__darwin_pid_t = int +rbx.platform.typedef.__darwin_pthread_key_t = ulong +rbx.platform.typedef.__darwin_sigset_t = uint +rbx.platform.typedef.__darwin_suseconds_t = int +rbx.platform.typedef.__darwin_uid_t = uint +rbx.platform.typedef.__darwin_useconds_t = uint +rbx.platform.typedef.__darwin_uuid_t[16] = uchar +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.u_quad_t = ulong_long +rbx.platform.typedef.quad_t = long_long +rbx.platform.typedef.qaddr_t = pointer +rbx.platform.typedef.caddr_t = string +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.dev_t = int +rbx.platform.typedef.fixpt_t = uint +rbx.platform.typedef.blkcnt_t = long_long +rbx.platform.typedef.blksize_t = int +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.in_addr_t = uint +rbx.platform.typedef.in_port_t = ushort +rbx.platform.typedef.ino_t = ulong_long +rbx.platform.typedef.ino64_t = ulong_long +rbx.platform.typedef.key_t = int +rbx.platform.typedef.mode_t = ushort +rbx.platform.typedef.nlink_t = ushort +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.segsz_t = int +rbx.platform.typedef.swblk_t = int +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.clock_t = ulong +rbx.platform.typedef.size_t = ulong +rbx.platform.typedef.ssize_t = long +rbx.platform.typedef.time_t = long +rbx.platform.typedef.useconds_t = uint +rbx.platform.typedef.suseconds_t = int +rbx.platform.typedef.fd_mask = int +rbx.platform.typedef.pthread_key_t = ulong +rbx.platform.typedef.fsblkcnt_t = uint +rbx.platform.typedef.fsfilcnt_t = uint +rbx.platform.typedef.sa_family_t = uchar +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.rlim_t = ulong_long diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-freebsd/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-freebsd/types.conf new file mode 100644 index 000000000..3e7b20dd5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-freebsd/types.conf @@ -0,0 +1,152 @@ +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long_long +rbx.platform.typedef.__uint64_t = ulong_long +rbx.platform.typedef.__clock_t = ulong +rbx.platform.typedef.__cpumask_t = uint +rbx.platform.typedef.__critical_t = int +rbx.platform.typedef.__intfptr_t = int +rbx.platform.typedef.__intmax_t = long_long +rbx.platform.typedef.__intptr_t = int +rbx.platform.typedef.__int_fast8_t = int +rbx.platform.typedef.__int_fast16_t = int +rbx.platform.typedef.__int_fast32_t = int +rbx.platform.typedef.__int_fast64_t = long_long +rbx.platform.typedef.__int_least8_t = char +rbx.platform.typedef.__int_least16_t = short +rbx.platform.typedef.__int_least32_t = int +rbx.platform.typedef.__int_least64_t = long_long +rbx.platform.typedef.__ptrdiff_t = int +rbx.platform.typedef.__register_t = int +rbx.platform.typedef.__segsz_t = int +rbx.platform.typedef.__size_t = uint +rbx.platform.typedef.__ssize_t = int +rbx.platform.typedef.__time_t = int +rbx.platform.typedef.__uintfptr_t = uint +rbx.platform.typedef.__uintmax_t = ulong_long +rbx.platform.typedef.__uintptr_t = uint +rbx.platform.typedef.__uint_fast8_t = uint +rbx.platform.typedef.__uint_fast16_t = uint +rbx.platform.typedef.__uint_fast32_t = uint +rbx.platform.typedef.__uint_fast64_t = ulong_long +rbx.platform.typedef.__uint_least8_t = uchar +rbx.platform.typedef.__uint_least16_t = ushort +rbx.platform.typedef.__uint_least32_t = uint +rbx.platform.typedef.__uint_least64_t = ulong_long +rbx.platform.typedef.__u_register_t = uint +rbx.platform.typedef.__vm_offset_t = uint +rbx.platform.typedef.__vm_ooffset_t = long_long +rbx.platform.typedef.__vm_paddr_t = uint +rbx.platform.typedef.__vm_pindex_t = ulong_long +rbx.platform.typedef.__vm_size_t = uint +rbx.platform.typedef.__blksize_t = uint +rbx.platform.typedef.__blkcnt_t = long_long +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__fflags_t = uint +rbx.platform.typedef.__fsblkcnt_t = ulong_long +rbx.platform.typedef.__fsfilcnt_t = ulong_long +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__id_t = long_long +rbx.platform.typedef.__ino_t = uint +rbx.platform.typedef.__key_t = long +rbx.platform.typedef.__lwpid_t = int +rbx.platform.typedef.__mode_t = ushort +rbx.platform.typedef.__accmode_t = int +rbx.platform.typedef.__nl_item = int +rbx.platform.typedef.__nlink_t = ushort +rbx.platform.typedef.__off_t = long_long +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__rlim_t = long_long +rbx.platform.typedef.__sa_family_t = uchar +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.__suseconds_t = long +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__cpuwhich_t = int +rbx.platform.typedef.__cpulevel_t = int +rbx.platform.typedef.__cpusetid_t = int +rbx.platform.typedef.__ct_rune_t = int +rbx.platform.typedef.__rune_t = int +rbx.platform.typedef.__wchar_t = int +rbx.platform.typedef.__wint_t = int +rbx.platform.typedef.__wint_t = int +rbx.platform.typedef.__dev_t = uint +rbx.platform.typedef.__fixpt_t = uint +rbx.platform.typedef.pthread_key_t = int +rbx.platform.typedef.*) = pointer +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.uint8_t = uchar +rbx.platform.typedef.uint16_t = ushort +rbx.platform.typedef.uint32_t = uint +rbx.platform.typedef.uint64_t = ulong_long +rbx.platform.typedef.intptr_t = int +rbx.platform.typedef.uintptr_t = uint +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.u_quad_t = ulong_long +rbx.platform.typedef.quad_t = long_long +rbx.platform.typedef.qaddr_t = pointer +rbx.platform.typedef.caddr_t = string +rbx.platform.typedef.c_caddr_t = pointer +rbx.platform.typedef.blksize_t = uint +rbx.platform.typedef.cpuwhich_t = int +rbx.platform.typedef.cpulevel_t = int +rbx.platform.typedef.cpusetid_t = int +rbx.platform.typedef.blkcnt_t = long_long +rbx.platform.typedef.clock_t = ulong +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.cpumask_t = uint +rbx.platform.typedef.critical_t = int +rbx.platform.typedef.daddr_t = long_long +rbx.platform.typedef.dev_t = uint +rbx.platform.typedef.fflags_t = uint +rbx.platform.typedef.fixpt_t = uint +rbx.platform.typedef.fsblkcnt_t = ulong_long +rbx.platform.typedef.fsfilcnt_t = ulong_long +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.in_addr_t = uint +rbx.platform.typedef.in_port_t = ushort +rbx.platform.typedef.id_t = long_long +rbx.platform.typedef.ino_t = uint +rbx.platform.typedef.key_t = long +rbx.platform.typedef.lwpid_t = int +rbx.platform.typedef.mode_t = ushort +rbx.platform.typedef.accmode_t = int +rbx.platform.typedef.nlink_t = ushort +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.register_t = int +rbx.platform.typedef.rlim_t = long_long +rbx.platform.typedef.segsz_t = int +rbx.platform.typedef.size_t = uint +rbx.platform.typedef.ssize_t = int +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.time_t = int +rbx.platform.typedef.u_register_t = uint +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.useconds_t = uint +rbx.platform.typedef.vm_offset_t = uint +rbx.platform.typedef.vm_ooffset_t = long_long +rbx.platform.typedef.vm_paddr_t = uint +rbx.platform.typedef.vm_pindex_t = ulong_long +rbx.platform.typedef.vm_size_t = uint +rbx.platform.typedef.__fd_mask = ulong +rbx.platform.typedef.fd_mask = ulong +rbx.platform.typedef.sa_family_t = uchar +rbx.platform.typedef.socklen_t = uint + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-gnu/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-gnu/types.conf new file mode 100644 index 000000000..f9169c29a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-gnu/types.conf @@ -0,0 +1,107 @@ +rbx.platform.typedef.__u_char = uchar +rbx.platform.typedef.__u_short = ushort +rbx.platform.typedef.__u_int = uint +rbx.platform.typedef.__u_long = ulong +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long_long +rbx.platform.typedef.__uint64_t = ulong_long +rbx.platform.typedef.__quad_t = long_long +rbx.platform.typedef.__u_quad_t = ulong_long +rbx.platform.typedef.__dev_t = uint +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__ino_t = ulong +rbx.platform.typedef.__ino64_t = ulong_long +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = uint +rbx.platform.typedef.__off_t = long +rbx.platform.typedef.__off64_t = long_long +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__fsid_t = ulong_long +rbx.platform.typedef.__clock_t = long +rbx.platform.typedef.__rlim_t = ulong +rbx.platform.typedef.__rlim64_t = ulong_long +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__time_t = long +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = long +rbx.platform.typedef.__daddr_t = int +rbx.platform.typedef.__swblk_t = long +rbx.platform.typedef.__key_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__timer_t = int +rbx.platform.typedef.__blksize_t = long +rbx.platform.typedef.__blkcnt_t = long +rbx.platform.typedef.__blkcnt64_t = long_long +rbx.platform.typedef.__fsblkcnt_t = ulong +rbx.platform.typedef.__fsblkcnt64_t = ulong_long +rbx.platform.typedef.__fsfilcnt_t = ulong +rbx.platform.typedef.__fsfilcnt64_t = ulong_long +rbx.platform.typedef.__ssize_t = int +rbx.platform.typedef.__loff_t = long_long +rbx.platform.typedef.*__qaddr_t = long_long +rbx.platform.typedef.*__caddr_t = char +rbx.platform.typedef.__intptr_t = int +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.quad_t = long_long +rbx.platform.typedef.u_quad_t = ulong_long +rbx.platform.typedef.fsid_t = ulong_long +rbx.platform.typedef.loff_t = long_long +rbx.platform.typedef.ino_t = ulong_long +rbx.platform.typedef.dev_t = uint +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = uint +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ssize_t = int +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.key_t = int +rbx.platform.typedef.clock_t = long +rbx.platform.typedef.time_t = long +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.timer_t = int +rbx.platform.typedef.size_t = uint +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.register_t = long +rbx.platform.typedef.__sig_atomic_t = int +rbx.platform.typedef.__sigset_t = ulong +rbx.platform.typedef.sigset_t = ulong +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.__fd_mask = long +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.blksize_t = long +rbx.platform.typedef.blkcnt_t = long_long +rbx.platform.typedef.fsblkcnt_t = ulong_long +rbx.platform.typedef.fsfilcnt_t = ulong_long +rbx.platform.typedef.__pthread_t = int +rbx.platform.typedef.pthread_t = int +rbx.platform.typedef.__pthread_key = int +rbx.platform.typedef.pthread_key_t = int +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.sa_family_t = uchar +rbx.platform.typedef.rlim_t = ulong_long +rbx.platform.typedef.__rlimit_resource_t = int +rbx.platform.typedef.__rusage_who_t = int +rbx.platform.typedef.__priority_which_t = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-linux/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-linux/types.conf new file mode 100644 index 000000000..c46a1342e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-linux/types.conf @@ -0,0 +1,103 @@ +rbx.platform.typedef.__u_char = uchar +rbx.platform.typedef.__u_short = ushort +rbx.platform.typedef.__u_int = uint +rbx.platform.typedef.__u_long = ulong +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long_long +rbx.platform.typedef.__uint64_t = ulong_long +rbx.platform.typedef.__quad_t = long_long +rbx.platform.typedef.__u_quad_t = ulong_long +rbx.platform.typedef.__dev_t = ulong_long +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__ino_t = ulong +rbx.platform.typedef.__ino64_t = ulong_long +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = uint +rbx.platform.typedef.__off_t = long +rbx.platform.typedef.__off64_t = long_long +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__clock_t = long +rbx.platform.typedef.__rlim_t = ulong +rbx.platform.typedef.__rlim64_t = ulong_long +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__time_t = long +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = long +rbx.platform.typedef.__daddr_t = int +rbx.platform.typedef.__swblk_t = long +rbx.platform.typedef.__key_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__timer_t = pointer +rbx.platform.typedef.blksize_t = long +rbx.platform.typedef.__blksize_t = long +rbx.platform.typedef.__blkcnt_t = long +rbx.platform.typedef.__blkcnt64_t = long_long +rbx.platform.typedef.__fsblkcnt_t = ulong +rbx.platform.typedef.__fsblkcnt64_t = ulong_long +rbx.platform.typedef.__fsfilcnt_t = ulong +rbx.platform.typedef.__fsfilcnt64_t = ulong_long +rbx.platform.typedef.__ssize_t = int +rbx.platform.typedef.__loff_t = long_long +rbx.platform.typedef.*__qaddr_t = long_long +rbx.platform.typedef.*__caddr_t = char +rbx.platform.typedef.__intptr_t = int +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.quad_t = long_long +rbx.platform.typedef.u_quad_t = ulong_long +rbx.platform.typedef.loff_t = long_long +rbx.platform.typedef.ino_t = ulong_long +rbx.platform.typedef.dev_t = ulong_long +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.in_addr_t = uint +rbx.platform.typedef.in_port_t = ushort +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = uint +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ssize_t = int +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.key_t = int +rbx.platform.typedef.time_t = long +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.timer_t = pointer +rbx.platform.typedef.size_t = uint +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.register_t = long +rbx.platform.typedef.__sig_atomic_t = int +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.__fd_mask = long +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.blkcnt_t = long_long +rbx.platform.typedef.fsblkcnt_t = ulong_long +rbx.platform.typedef.fsfilcnt_t = ulong_long +rbx.platform.typedef.pthread_t = ulong +rbx.platform.typedef.pthread_key_t = uint +rbx.platform.typedef.pthread_once_t = int +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.sa_family_t = ushort +rbx.platform.typedef.rlim_t = ulong_long +rbx.platform.typedef.__rlimit_resource_t = int +rbx.platform.typedef.__rusage_who_t = int +rbx.platform.typedef.__priority_which_t = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-netbsd/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-netbsd/types.conf new file mode 100644 index 000000000..33bd12b90 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-netbsd/types.conf @@ -0,0 +1,126 @@ +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long_long +rbx.platform.typedef.__uint64_t = ulong_long +rbx.platform.typedef.__int_least8_t = char +rbx.platform.typedef.__uint_least8_t = uchar +rbx.platform.typedef.__int_least16_t = short +rbx.platform.typedef.__uint_least16_t = ushort +rbx.platform.typedef.__int_least32_t = int +rbx.platform.typedef.__uint_least32_t = uint +rbx.platform.typedef.__int_least64_t = long_long +rbx.platform.typedef.__uint_least64_t = ulong_long +rbx.platform.typedef.__int_fast8_t = int +rbx.platform.typedef.__uint_fast8_t = uint +rbx.platform.typedef.__int_fast16_t = int +rbx.platform.typedef.__uint_fast16_t = uint +rbx.platform.typedef.__int_fast32_t = int +rbx.platform.typedef.__uint_fast32_t = uint +rbx.platform.typedef.__int_fast64_t = long_long +rbx.platform.typedef.__uint_fast64_t = ulong_long +rbx.platform.typedef.__intptr_t = long +rbx.platform.typedef.__uintptr_t = ulong +rbx.platform.typedef.__intmax_t = long_long +rbx.platform.typedef.__uintmax_t = ulong_long +rbx.platform.typedef.__register_t = int +rbx.platform.typedef.__vaddr_t = ulong +rbx.platform.typedef.__paddr_t = ulong +rbx.platform.typedef.__vsize_t = ulong +rbx.platform.typedef.__psize_t = ulong +rbx.platform.typedef.__clock_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__off_t = long_long +rbx.platform.typedef.__ptrdiff_t = long +rbx.platform.typedef.__size_t = ulong +rbx.platform.typedef.__ssize_t = long +rbx.platform.typedef.__time_t = int +rbx.platform.typedef.__timer_t = int +rbx.platform.typedef.__wchar_t = int +rbx.platform.typedef.__wint_t = int +rbx.platform.typedef.__rune_t = int +rbx.platform.typedef.__wctrans_t = pointer +rbx.platform.typedef.__wctype_t = pointer +rbx.platform.typedef.__cpuid_t = ulong +rbx.platform.typedef.__dev_t = int +rbx.platform.typedef.__fixpt_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__in_addr_t = uint +rbx.platform.typedef.__in_port_t = ushort +rbx.platform.typedef.__ino_t = uint +rbx.platform.typedef.__key_t = long +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = uint +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__rlim_t = ulong_long +rbx.platform.typedef.__sa_family_t = uchar +rbx.platform.typedef.__segsz_t = int +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.__swblk_t = int +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = int +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.unchar = uchar +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.cpuid_t = ulong +rbx.platform.typedef.register_t = int +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.uint8_t = uchar +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.uint16_t = ushort +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.uint32_t = uint +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.uint64_t = ulong_long +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.quad_t = long_long +rbx.platform.typedef.u_quad_t = ulong_long +rbx.platform.typedef.qaddr_t = pointer +rbx.platform.typedef.vaddr_t = ulong +rbx.platform.typedef.paddr_t = ulong +rbx.platform.typedef.vsize_t = ulong +rbx.platform.typedef.psize_t = ulong +rbx.platform.typedef.caddr_t = string +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.daddr32_t = int +rbx.platform.typedef.daddr64_t = long_long +rbx.platform.typedef.dev_t = int +rbx.platform.typedef.fixpt_t = uint +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ino_t = uint +rbx.platform.typedef.key_t = long +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = uint +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.rlim_t = ulong_long +rbx.platform.typedef.segsz_t = int +rbx.platform.typedef.swblk_t = int +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.useconds_t = uint +rbx.platform.typedef.suseconds_t = int +rbx.platform.typedef.in_addr_t = uint +rbx.platform.typedef.in_port_t = ushort +rbx.platform.typedef.sa_family_t = uchar +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.clock_t = int +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.size_t = ulong +rbx.platform.typedef.ssize_t = long +rbx.platform.typedef.time_t = int +rbx.platform.typedef.timer_t = int +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.__fd_mask = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-openbsd/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-openbsd/types.conf new file mode 100644 index 000000000..c4df68adb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-openbsd/types.conf @@ -0,0 +1,128 @@ +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long_long +rbx.platform.typedef.__uint64_t = ulong_long +rbx.platform.typedef.__int_least8_t = char +rbx.platform.typedef.__uint_least8_t = uchar +rbx.platform.typedef.__int_least16_t = short +rbx.platform.typedef.__uint_least16_t = ushort +rbx.platform.typedef.__int_least32_t = int +rbx.platform.typedef.__uint_least32_t = uint +rbx.platform.typedef.__int_least64_t = long_long +rbx.platform.typedef.__uint_least64_t = ulong_long +rbx.platform.typedef.__int_fast8_t = int +rbx.platform.typedef.__uint_fast8_t = uint +rbx.platform.typedef.__int_fast16_t = int +rbx.platform.typedef.__uint_fast16_t = uint +rbx.platform.typedef.__int_fast32_t = int +rbx.platform.typedef.__uint_fast32_t = uint +rbx.platform.typedef.__int_fast64_t = long_long +rbx.platform.typedef.__uint_fast64_t = ulong_long +rbx.platform.typedef.__intptr_t = long +rbx.platform.typedef.__uintptr_t = ulong +rbx.platform.typedef.__intmax_t = long_long +rbx.platform.typedef.__uintmax_t = ulong_long +rbx.platform.typedef.__register_t = int +rbx.platform.typedef.__vaddr_t = ulong +rbx.platform.typedef.__paddr_t = ulong +rbx.platform.typedef.__vsize_t = ulong +rbx.platform.typedef.__psize_t = ulong +rbx.platform.typedef.__clock_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__off_t = long_long +rbx.platform.typedef.__ptrdiff_t = long +rbx.platform.typedef.__size_t = ulong +rbx.platform.typedef.__ssize_t = long +rbx.platform.typedef.__time_t = int +rbx.platform.typedef.__timer_t = int +rbx.platform.typedef.__wchar_t = int +rbx.platform.typedef.__wint_t = int +rbx.platform.typedef.__rune_t = int +rbx.platform.typedef.__wctrans_t = pointer +rbx.platform.typedef.__wctype_t = pointer +rbx.platform.typedef.__cpuid_t = ulong +rbx.platform.typedef.__dev_t = int +rbx.platform.typedef.__fixpt_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__in_addr_t = uint +rbx.platform.typedef.__in_port_t = ushort +rbx.platform.typedef.__ino_t = uint +rbx.platform.typedef.__key_t = long +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = uint +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__rlim_t = ulong_long +rbx.platform.typedef.__sa_family_t = uchar +rbx.platform.typedef.__segsz_t = int +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.__swblk_t = int +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = int +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.unchar = uchar +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.cpuid_t = ulong +rbx.platform.typedef.register_t = int +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.uint8_t = uchar +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.uint16_t = ushort +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.uint32_t = uint +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.uint64_t = ulong_long +rbx.platform.typedef.intptr_t = long +rbx.platform.typedef.uintptr_t = ulong +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.quad_t = long_long +rbx.platform.typedef.u_quad_t = ulong_long +rbx.platform.typedef.qaddr_t = pointer +rbx.platform.typedef.vaddr_t = ulong +rbx.platform.typedef.paddr_t = ulong +rbx.platform.typedef.vsize_t = ulong +rbx.platform.typedef.psize_t = ulong +rbx.platform.typedef.caddr_t = string +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.daddr32_t = int +rbx.platform.typedef.daddr64_t = long_long +rbx.platform.typedef.dev_t = int +rbx.platform.typedef.fixpt_t = uint +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ino_t = uint +rbx.platform.typedef.key_t = long +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = uint +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.rlim_t = ulong_long +rbx.platform.typedef.segsz_t = int +rbx.platform.typedef.swblk_t = int +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.useconds_t = uint +rbx.platform.typedef.suseconds_t = int +rbx.platform.typedef.in_addr_t = uint +rbx.platform.typedef.in_port_t = ushort +rbx.platform.typedef.sa_family_t = uchar +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.clock_t = int +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.size_t = ulong +rbx.platform.typedef.ssize_t = long +rbx.platform.typedef.time_t = int +rbx.platform.typedef.timer_t = int +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.__fd_mask = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-solaris/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-solaris/types.conf new file mode 100644 index 000000000..a5851000e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-solaris/types.conf @@ -0,0 +1,122 @@ +rbx.platform.typedef.lock_t = uchar +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.uint8_t = uchar +rbx.platform.typedef.uint16_t = ushort +rbx.platform.typedef.uint32_t = uint +rbx.platform.typedef.uint64_t = ulong_long +rbx.platform.typedef.intmax_t = long_long +rbx.platform.typedef.uintmax_t = ulong_long +rbx.platform.typedef.intptr_t = int +rbx.platform.typedef.uintptr_t = uint +rbx.platform.typedef.int_fast8_t = char +rbx.platform.typedef.int_fast16_t = int +rbx.platform.typedef.int_fast32_t = int +rbx.platform.typedef.int_fast64_t = long_long +rbx.platform.typedef.uint_fast8_t = uchar +rbx.platform.typedef.uint_fast16_t = uint +rbx.platform.typedef.uint_fast32_t = uint +rbx.platform.typedef.uint_fast64_t = ulong_long +rbx.platform.typedef.int_least8_t = char +rbx.platform.typedef.int_least16_t = short +rbx.platform.typedef.int_least32_t = int +rbx.platform.typedef.int_least64_t = long_long +rbx.platform.typedef.uint_least8_t = uchar +rbx.platform.typedef.uint_least16_t = ushort +rbx.platform.typedef.uint_least32_t = uint +rbx.platform.typedef.uint_least64_t = ulong_long +rbx.platform.typedef.longlong_t = long_long +rbx.platform.typedef.u_longlong_t = ulong_long +rbx.platform.typedef.t_scalar_t = long +rbx.platform.typedef.t_uscalar_t = ulong +rbx.platform.typedef.uchar_t = uchar +rbx.platform.typedef.ushort_t = ushort +rbx.platform.typedef.uint_t = uint +rbx.platform.typedef.ulong_t = ulong +rbx.platform.typedef.*caddr_t = char +rbx.platform.typedef.daddr_t = long +rbx.platform.typedef.cnt_t = short +rbx.platform.typedef.ptrdiff_t = int +rbx.platform.typedef.pfn_t = ulong +rbx.platform.typedef.pgcnt_t = ulong +rbx.platform.typedef.spgcnt_t = long +rbx.platform.typedef.use_t = uchar +rbx.platform.typedef.sysid_t = short +rbx.platform.typedef.index_t = short +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.off64_t = long_long +rbx.platform.typedef.ino_t = ulong_long +rbx.platform.typedef.blkcnt_t = long_long +rbx.platform.typedef.fsblkcnt_t = ulong_long +rbx.platform.typedef.fsfilcnt_t = ulong_long +rbx.platform.typedef.ino64_t = ulong_long +rbx.platform.typedef.blkcnt64_t = long_long +rbx.platform.typedef.fsblkcnt64_t = ulong_long +rbx.platform.typedef.fsfilcnt64_t = ulong_long +rbx.platform.typedef.blksize_t = long +rbx.platform.typedef.pad64_t = long_long +rbx.platform.typedef.upad64_t = ulong_long +rbx.platform.typedef.offset_t = long_long +rbx.platform.typedef.u_offset_t = ulong_long +rbx.platform.typedef.len_t = ulong_long +rbx.platform.typedef.diskaddr_t = ulong_long +rbx.platform.typedef.k_fltset_t = uint +rbx.platform.typedef.id_t = long +rbx.platform.typedef.lgrp_id_t = long +rbx.platform.typedef.useconds_t = uint +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.major_t = ulong +rbx.platform.typedef.minor_t = ulong +rbx.platform.typedef.pri_t = short +rbx.platform.typedef.cpu_flag_t = ushort +rbx.platform.typedef.o_mode_t = ushort +rbx.platform.typedef.o_dev_t = short +rbx.platform.typedef.o_uid_t = ushort +rbx.platform.typedef.o_gid_t = ushort +rbx.platform.typedef.o_nlink_t = short +rbx.platform.typedef.o_pid_t = short +rbx.platform.typedef.o_ino_t = ushort +rbx.platform.typedef.key_t = int +rbx.platform.typedef.mode_t = ulong +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.datalink_id_t = uint +rbx.platform.typedef.taskid_t = long +rbx.platform.typedef.projid_t = long +rbx.platform.typedef.poolid_t = long +rbx.platform.typedef.zoneid_t = long +rbx.platform.typedef.ctid_t = long +rbx.platform.typedef.pthread_t = uint +rbx.platform.typedef.pthread_key_t = uint +rbx.platform.typedef.dev_t = ulong +rbx.platform.typedef.nlink_t = ulong +rbx.platform.typedef.pid_t = long +rbx.platform.typedef.size_t = uint +rbx.platform.typedef.ssize_t = int +rbx.platform.typedef.time_t = long +rbx.platform.typedef.clock_t = long +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.timer_t = int +rbx.platform.typedef.unchar = uchar +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.hrtime_t = long_long +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.fds_mask = long +rbx.platform.typedef.sa_family_t = ushort +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.nfds_t = ulong +rbx.platform.typedef.disp_lock_t = uchar +rbx.platform.typedef.model_t = uint +rbx.platform.typedef.in_port_t = ushort +rbx.platform.typedef.in_addr_t = uint +rbx.platform.typedef.ipaddr_t = uint +rbx.platform.typedef.rlim_t = ulong_long +rbx.platform.typedef.rlim64_t = ulong_long diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-windows/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-windows/types.conf new file mode 100644 index 000000000..38168bee4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/i386-windows/types.conf @@ -0,0 +1,105 @@ +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int_least16_t = short +rbx.platform.typedef.__uint_least16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int_least32_t = int +rbx.platform.typedef.__uint_least32_t = uint +rbx.platform.typedef.__int64_t = long_long +rbx.platform.typedef.__uint64_t = ulong_long +rbx.platform.typedef._off_t = long +rbx.platform.typedef._off64_t = long_long +rbx.platform.typedef._ssize_t = int +rbx.platform.typedef.wint_t = uint +rbx.platform.typedef.ptrdiff_t = int +rbx.platform.typedef.size_t = uint +rbx.platform.typedef.__off_t = long +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__loff_t = long_long +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.clock_t = ulong +rbx.platform.typedef.time_t = long +rbx.platform.typedef.daddr_t = long +rbx.platform.typedef.caddr_t = string +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.ssize_t = int +rbx.platform.typedef.nlink_t = ushort +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.clockid_t = ulong +rbx.platform.typedef.timer_t = ulong +rbx.platform.typedef.useconds_t = ulong +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = long +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.uint8_t = uchar +rbx.platform.typedef.uint16_t = ushort +rbx.platform.typedef.uint32_t = ulong +rbx.platform.typedef.uint64_t = ulong_long +rbx.platform.typedef.int_least8_t = char +rbx.platform.typedef.int_least16_t = short +rbx.platform.typedef.int_least32_t = long +rbx.platform.typedef.int_least64_t = long_long +rbx.platform.typedef.uint_least8_t = uchar +rbx.platform.typedef.uint_least16_t = ushort +rbx.platform.typedef.uint_least32_t = ulong +rbx.platform.typedef.uint_least64_t = ulong_long +rbx.platform.typedef.int_fast8_t = char +rbx.platform.typedef.int_fast16_t = long +rbx.platform.typedef.int_fast32_t = long +rbx.platform.typedef.int_fast64_t = long_long +rbx.platform.typedef.uint_fast8_t = uchar +rbx.platform.typedef.uint_fast16_t = ulong +rbx.platform.typedef.uint_fast32_t = ulong +rbx.platform.typedef.uint_fast64_t = ulong_long +rbx.platform.typedef.intptr_t = long +rbx.platform.typedef.uintptr_t = ulong +rbx.platform.typedef.intmax_t = long_long +rbx.platform.typedef.uintmax_t = ulong_long +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.loff_t = long_long +rbx.platform.typedef.__dev16_t = short +rbx.platform.typedef.__dev32_t = ulong +rbx.platform.typedef.dev_t = ulong +rbx.platform.typedef.blksize_t = long +rbx.platform.typedef.__blkcnt32_t = long +rbx.platform.typedef.__blkcnt64_t = long_long +rbx.platform.typedef.blkcnt_t = long_long +rbx.platform.typedef.fsblkcnt_t = ulong +rbx.platform.typedef.fsfilcnt_t = ulong +rbx.platform.typedef.__uid16_t = ushort +rbx.platform.typedef.__uid32_t = ulong +rbx.platform.typedef.uid_t = ulong +rbx.platform.typedef.__gid16_t = ushort +rbx.platform.typedef.__gid32_t = ulong +rbx.platform.typedef.gid_t = ulong +rbx.platform.typedef.__ino32_t = ulong +rbx.platform.typedef.__ino64_t = ulong_long +rbx.platform.typedef.ino_t = ulong_long +rbx.platform.typedef.id_t = ulong +rbx.platform.typedef.key_t = long_long +rbx.platform.typedef.vm_offset_t = ulong +rbx.platform.typedef.vm_size_t = ulong +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.register_t = int +rbx.platform.typedef.*addr_t = char +rbx.platform.typedef.socklen_t = int +rbx.platform.typedef.sa_family_t = ushort +rbx.platform.typedef.__ULong = ulong +rbx.platform.typedef._fpos_t = long +rbx.platform.typedef._fpos64_t = long_long +rbx.platform.typedef.sigset_t = ulong +rbx.platform.typedef.sig_atomic_t = int +rbx.platform.typedef.rlim_t = ulong diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/ia64-linux/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/ia64-linux/types.conf new file mode 100644 index 000000000..70e44e8c6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/ia64-linux/types.conf @@ -0,0 +1,104 @@ +rbx.platform.typedef.__u_char = uchar +rbx.platform.typedef.__u_short = ushort +rbx.platform.typedef.__u_int = uint +rbx.platform.typedef.__u_long = ulong +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long +rbx.platform.typedef.__uint64_t = ulong +rbx.platform.typedef.__quad_t = long +rbx.platform.typedef.__u_quad_t = ulong +rbx.platform.typedef.__dev_t = ulong +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__in_addr_t = uint +rbx.platform.typedef.__in_port_t = ushort +rbx.platform.typedef.__ino_t = ulong +rbx.platform.typedef.__ino64_t = ulong +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = ulong +rbx.platform.typedef.__off_t = long +rbx.platform.typedef.__off64_t = long +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__clock_t = long +rbx.platform.typedef.__rlim_t = ulong +rbx.platform.typedef.__rlim64_t = ulong +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__time_t = long +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = long +rbx.platform.typedef.__daddr_t = int +rbx.platform.typedef.__swblk_t = long +rbx.platform.typedef.__key_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__timer_t = pointer +rbx.platform.typedef.__blksize_t = long +rbx.platform.typedef.__blkcnt_t = long +rbx.platform.typedef.__blkcnt64_t = long +rbx.platform.typedef.__fsblkcnt_t = ulong +rbx.platform.typedef.__fsblkcnt64_t = ulong +rbx.platform.typedef.__fsfilcnt_t = ulong +rbx.platform.typedef.__fsfilcnt64_t = ulong +rbx.platform.typedef.__ssize_t = long +rbx.platform.typedef.__loff_t = long +rbx.platform.typedef.*__qaddr_t = long +rbx.platform.typedef.*__caddr_t = char +rbx.platform.typedef.__intptr_t = long +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.quad_t = long +rbx.platform.typedef.u_quad_t = ulong +rbx.platform.typedef.loff_t = long +rbx.platform.typedef.ino_t = ulong +rbx.platform.typedef.dev_t = ulong +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = ulong +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.off_t = long +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ssize_t = long +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.key_t = int +rbx.platform.typedef.clock_t = long +rbx.platform.typedef.time_t = long +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.timer_t = pointer +rbx.platform.typedef.size_t = ulong +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.register_t = long +rbx.platform.typedef.__sig_atomic_t = int +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.__fd_mask = long +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.blksize_t = long +rbx.platform.typedef.blkcnt_t = long +rbx.platform.typedef.fsblkcnt_t = ulong +rbx.platform.typedef.fsfilcnt_t = ulong +rbx.platform.typedef.pthread_t = ulong +rbx.platform.typedef.pthread_key_t = uint +rbx.platform.typedef.pthread_once_t = int +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.sa_family_t = ushort +rbx.platform.typedef.rlim_t = ulong +rbx.platform.typedef.__rlimit_resource_t = int +rbx.platform.typedef.__rusage_who_t = int +rbx.platform.typedef.__priority_which_t = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/mips-linux/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/mips-linux/types.conf new file mode 100644 index 000000000..ad4ced04a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/mips-linux/types.conf @@ -0,0 +1,102 @@ +rbx.platform.typedef.__u_char = uchar +rbx.platform.typedef.__u_short = ushort +rbx.platform.typedef.__u_int = uint +rbx.platform.typedef.__u_long = ulong +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long_long +rbx.platform.typedef.__uint64_t = ulong_long +rbx.platform.typedef.__quad_t = long_long +rbx.platform.typedef.__u_quad_t = ulong_long +rbx.platform.typedef.__dev_t = ulong_long +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__ino_t = ulong +rbx.platform.typedef.__ino64_t = ulong_long +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = uint +rbx.platform.typedef.__off_t = long +rbx.platform.typedef.__off64_t = long_long +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__clock_t = long +rbx.platform.typedef.__rlim_t = ulong +rbx.platform.typedef.__rlim64_t = ulong_long +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__time_t = long +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = long +rbx.platform.typedef.__daddr_t = int +rbx.platform.typedef.__swblk_t = long +rbx.platform.typedef.__key_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__timer_t = pointer +rbx.platform.typedef.__blksize_t = long +rbx.platform.typedef.__blkcnt_t = long +rbx.platform.typedef.__blkcnt64_t = long_long +rbx.platform.typedef.__fsblkcnt_t = ulong +rbx.platform.typedef.__fsblkcnt64_t = ulong_long +rbx.platform.typedef.__fsfilcnt_t = ulong +rbx.platform.typedef.__fsfilcnt64_t = ulong_long +rbx.platform.typedef.__ssize_t = int +rbx.platform.typedef.__loff_t = long_long +rbx.platform.typedef.*__qaddr_t = long_long +rbx.platform.typedef.*__caddr_t = char +rbx.platform.typedef.__intptr_t = int +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.quad_t = long_long +rbx.platform.typedef.u_quad_t = ulong_long +rbx.platform.typedef.loff_t = long_long +rbx.platform.typedef.ino_t = ulong_long +rbx.platform.typedef.dev_t = ulong_long +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = uint +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ssize_t = int +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.key_t = int +rbx.platform.typedef.clock_t = long +rbx.platform.typedef.time_t = long +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.timer_t = pointer +rbx.platform.typedef.size_t = uint +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.register_t = long +rbx.platform.typedef.__sig_atomic_t = int +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.__fd_mask = long +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.blksize_t = long +rbx.platform.typedef.blkcnt_t = long_long +rbx.platform.typedef.fsblkcnt_t = ulong_long +rbx.platform.typedef.fsfilcnt_t = ulong_long +rbx.platform.typedef.pthread_t = ulong +rbx.platform.typedef.pthread_key_t = uint +rbx.platform.typedef.pthread_once_t = int +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.sa_family_t = ushort +rbx.platform.typedef.rlim_t = ulong_long +rbx.platform.typedef.__rlimit_resource_t = int +rbx.platform.typedef.__rusage_who_t = int +rbx.platform.typedef.__priority_which_t = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/mips64el-linux/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/mips64el-linux/types.conf new file mode 100644 index 000000000..3feb704f7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/mips64el-linux/types.conf @@ -0,0 +1,104 @@ +rbx.platform.typedef.__u_char = uchar +rbx.platform.typedef.__u_short = ushort +rbx.platform.typedef.__u_int = uint +rbx.platform.typedef.__u_long = ulong +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long +rbx.platform.typedef.__uint64_t = ulong +rbx.platform.typedef.__quad_t = long +rbx.platform.typedef.__u_quad_t = ulong +rbx.platform.typedef.__dev_t = ulong +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__ino_t = ulong +rbx.platform.typedef.__ino64_t = ulong +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = ulong +rbx.platform.typedef.__off_t = long +rbx.platform.typedef.__off64_t = long +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__clock_t = long +rbx.platform.typedef.__rlim_t = ulong +rbx.platform.typedef.__rlim64_t = ulong +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__time_t = long +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = long +rbx.platform.typedef.__daddr_t = int +rbx.platform.typedef.__key_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__timer_t = pointer +rbx.platform.typedef.__blksize_t = long +rbx.platform.typedef.__blkcnt_t = long +rbx.platform.typedef.__blkcnt64_t = long +rbx.platform.typedef.__fsblkcnt_t = ulong +rbx.platform.typedef.__fsblkcnt64_t = ulong +rbx.platform.typedef.__fsfilcnt_t = ulong +rbx.platform.typedef.__fsfilcnt64_t = ulong +rbx.platform.typedef.__fsword_t = long +rbx.platform.typedef.__ssize_t = long +rbx.platform.typedef.__syscall_slong_t = long +rbx.platform.typedef.__syscall_ulong_t = ulong +rbx.platform.typedef.__loff_t = long +rbx.platform.typedef.*__qaddr_t = long +rbx.platform.typedef.*__caddr_t = char +rbx.platform.typedef.__intptr_t = long +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.quad_t = long +rbx.platform.typedef.u_quad_t = ulong +rbx.platform.typedef.loff_t = long +rbx.platform.typedef.ino_t = ulong +rbx.platform.typedef.dev_t = ulong +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = ulong +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.off_t = long +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ssize_t = long +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.key_t = int +rbx.platform.typedef.clock_t = long +rbx.platform.typedef.time_t = long +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.timer_t = pointer +rbx.platform.typedef.size_t = ulong +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.register_t = long +rbx.platform.typedef.__sig_atomic_t = int +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.__fd_mask = long +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.blksize_t = long +rbx.platform.typedef.blkcnt_t = long +rbx.platform.typedef.fsblkcnt_t = ulong +rbx.platform.typedef.fsfilcnt_t = ulong +rbx.platform.typedef.pthread_t = ulong +rbx.platform.typedef.pthread_key_t = uint +rbx.platform.typedef.pthread_once_t = int +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.sa_family_t = ushort +rbx.platform.typedef.rlim_t = ulong +rbx.platform.typedef.__rlimit_resource_t = int +rbx.platform.typedef.__rusage_who_t = int +rbx.platform.typedef.__priority_which_t = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/mipsel-linux/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/mipsel-linux/types.conf new file mode 100644 index 000000000..ad4ced04a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/mipsel-linux/types.conf @@ -0,0 +1,102 @@ +rbx.platform.typedef.__u_char = uchar +rbx.platform.typedef.__u_short = ushort +rbx.platform.typedef.__u_int = uint +rbx.platform.typedef.__u_long = ulong +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long_long +rbx.platform.typedef.__uint64_t = ulong_long +rbx.platform.typedef.__quad_t = long_long +rbx.platform.typedef.__u_quad_t = ulong_long +rbx.platform.typedef.__dev_t = ulong_long +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__ino_t = ulong +rbx.platform.typedef.__ino64_t = ulong_long +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = uint +rbx.platform.typedef.__off_t = long +rbx.platform.typedef.__off64_t = long_long +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__clock_t = long +rbx.platform.typedef.__rlim_t = ulong +rbx.platform.typedef.__rlim64_t = ulong_long +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__time_t = long +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = long +rbx.platform.typedef.__daddr_t = int +rbx.platform.typedef.__swblk_t = long +rbx.platform.typedef.__key_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__timer_t = pointer +rbx.platform.typedef.__blksize_t = long +rbx.platform.typedef.__blkcnt_t = long +rbx.platform.typedef.__blkcnt64_t = long_long +rbx.platform.typedef.__fsblkcnt_t = ulong +rbx.platform.typedef.__fsblkcnt64_t = ulong_long +rbx.platform.typedef.__fsfilcnt_t = ulong +rbx.platform.typedef.__fsfilcnt64_t = ulong_long +rbx.platform.typedef.__ssize_t = int +rbx.platform.typedef.__loff_t = long_long +rbx.platform.typedef.*__qaddr_t = long_long +rbx.platform.typedef.*__caddr_t = char +rbx.platform.typedef.__intptr_t = int +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.quad_t = long_long +rbx.platform.typedef.u_quad_t = ulong_long +rbx.platform.typedef.loff_t = long_long +rbx.platform.typedef.ino_t = ulong_long +rbx.platform.typedef.dev_t = ulong_long +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = uint +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ssize_t = int +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.key_t = int +rbx.platform.typedef.clock_t = long +rbx.platform.typedef.time_t = long +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.timer_t = pointer +rbx.platform.typedef.size_t = uint +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.register_t = long +rbx.platform.typedef.__sig_atomic_t = int +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.__fd_mask = long +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.blksize_t = long +rbx.platform.typedef.blkcnt_t = long_long +rbx.platform.typedef.fsblkcnt_t = ulong_long +rbx.platform.typedef.fsfilcnt_t = ulong_long +rbx.platform.typedef.pthread_t = ulong +rbx.platform.typedef.pthread_key_t = uint +rbx.platform.typedef.pthread_once_t = int +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.sa_family_t = ushort +rbx.platform.typedef.rlim_t = ulong_long +rbx.platform.typedef.__rlimit_resource_t = int +rbx.platform.typedef.__rusage_who_t = int +rbx.platform.typedef.__priority_which_t = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/powerpc-aix/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/powerpc-aix/types.conf new file mode 100644 index 000000000..30ee66b25 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/powerpc-aix/types.conf @@ -0,0 +1,180 @@ +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.uint8_t = uchar +rbx.platform.typedef.uint16_t = ushort +rbx.platform.typedef.uint32_t = uint +rbx.platform.typedef.uint64_t = ulong_long +rbx.platform.typedef.intmax_t = long_long +rbx.platform.typedef.uintmax_t = ulong_long +rbx.platform.typedef.intptr_t = long +rbx.platform.typedef.uintptr_t = ulong +rbx.platform.typedef.int_least8_t = char +rbx.platform.typedef.int_least16_t = short +rbx.platform.typedef.int_least32_t = int +rbx.platform.typedef.int_least64_t = long_long +rbx.platform.typedef.uint_least8_t = uchar +rbx.platform.typedef.uint_least16_t = ushort +rbx.platform.typedef.uint_least32_t = uint +rbx.platform.typedef.uint_least64_t = ulong_long +rbx.platform.typedef.int_fast8_t = char +rbx.platform.typedef.int_fast16_t = short +rbx.platform.typedef.int_fast32_t = int +rbx.platform.typedef.uint_fast8_t = uchar +rbx.platform.typedef.uint_fast16_t = ushort +rbx.platform.typedef.uint_fast32_t = uint +rbx.platform.typedef.int_fast64_t = long_long +rbx.platform.typedef.uint_fast64_t = ulong_long +rbx.platform.typedef.wchar_t = ushort +rbx.platform.typedef.intfast_t = int +rbx.platform.typedef.uintfast_t = uint +rbx.platform.typedef.__long32_t = long +rbx.platform.typedef.__ulong32_t = ulong +rbx.platform.typedef.__long64_t = int +rbx.platform.typedef.__ulong64_t = uint +rbx.platform.typedef.int32long64_t = int +rbx.platform.typedef.uint32long64_t = uint +rbx.platform.typedef.long32int64_t = long +rbx.platform.typedef.ulong32int64_t = ulong +rbx.platform.typedef.int8 = char +rbx.platform.typedef.int16 = short +rbx.platform.typedef.int32 = int +rbx.platform.typedef.int64 = long_long +rbx.platform.typedef.u_int8 = uchar +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16 = ushort +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32 = uint +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64 = ulong_long +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.ptrdiff_t = long +rbx.platform.typedef.wctype_t = uint +rbx.platform.typedef.fpos_t = long +rbx.platform.typedef.fpos64_t = long_long +rbx.platform.typedef.time_t = int +rbx.platform.typedef.clock_t = int +rbx.platform.typedef.size_t = ulong +rbx.platform.typedef.uchar_t = uchar +rbx.platform.typedef.ushort_t = ushort +rbx.platform.typedef.uint_t = uint +rbx.platform.typedef.ulong_t = ulong +rbx.platform.typedef.ssize_t = long +rbx.platform.typedef.level_t = int +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.daddr32_t = int +rbx.platform.typedef.daddr64_t = long_long +rbx.platform.typedef.caddr_t = string +rbx.platform.typedef.ino_t = uint +rbx.platform.typedef.ino32_t = uint +rbx.platform.typedef.ino64_t = ulong_long +rbx.platform.typedef.cnt_t = short +rbx.platform.typedef.dev_t = uint +rbx.platform.typedef.dev32_t = uint +rbx.platform.typedef.dev64_t = ulong_long +rbx.platform.typedef.chan_t = int +rbx.platform.typedef.time32_t = int +rbx.platform.typedef.pid32_t = int +rbx.platform.typedef.tid32_t = int +rbx.platform.typedef.pid64_t = ulong_long +rbx.platform.typedef.tid64_t = ulong_long +rbx.platform.typedef.time64_t = long_long +rbx.platform.typedef.__ptr32 = pointer +rbx.platform.typedef.__cptr32 = string +rbx.platform.typedef.soff_t = int +rbx.platform.typedef.off_t = long +rbx.platform.typedef.off64_t = long_long +rbx.platform.typedef.paddr_t = long +rbx.platform.typedef.key_t = int +rbx.platform.typedef.timer_t = int +rbx.platform.typedef.timer32_t = int +rbx.platform.typedef.timer64_t = long_long +rbx.platform.typedef.nlink_t = short +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.mid_t = pointer +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.tid_t = int +rbx.platform.typedef.slab_t[12] = char +rbx.platform.typedef.mtyp_t = long +rbx.platform.typedef.boolean_t = int +rbx.platform.typedef.crid_t = int +rbx.platform.typedef.blkcnt_t = int +rbx.platform.typedef.blksize_t = int +rbx.platform.typedef.blkcnt32_t = int +rbx.platform.typedef.blksize32_t = int +rbx.platform.typedef.blkcnt64_t = ulong_long +rbx.platform.typedef.blksize64_t = ulong_long +rbx.platform.typedef.fsblkcnt_t = ulong +rbx.platform.typedef.fsfilcnt_t = ulong +rbx.platform.typedef.wint_t = int +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.useconds_t = uint +rbx.platform.typedef.suseconds_t = int +rbx.platform.typedef.clockid_t = long_long +rbx.platform.typedef.signal_t = int +rbx.platform.typedef.pthread_t = uint +rbx.platform.typedef.pthread_key_t = uint +rbx.platform.typedef.vmid_t = long +rbx.platform.typedef.vmhandle_t = ulong +rbx.platform.typedef.vmid32_t = int +rbx.platform.typedef.vmhandle32_t = uint +rbx.platform.typedef.kvmid_t = long +rbx.platform.typedef.kvmhandle_t = ulong +rbx.platform.typedef.vmid64_t = long_long +rbx.platform.typedef.rpn64_t = long_long +rbx.platform.typedef.cnt64_t = long_long +rbx.platform.typedef.psize_t = long_long +rbx.platform.typedef.vmidx_t = int +rbx.platform.typedef.vmfkey_t = uint +rbx.platform.typedef.vmprkey_t = uint +rbx.platform.typedef.vmkey_t = int +rbx.platform.typedef.vmhwkey_t = int +rbx.platform.typedef.vpn_t = int +rbx.platform.typedef.rpn_t = int +rbx.platform.typedef.ptex_t = ulong +rbx.platform.typedef.swhatx_t = ulong +rbx.platform.typedef.esid_t = uint +rbx.platform.typedef.aptx_t = ushort +rbx.platform.typedef.pdtx_t = int +rbx.platform.typedef.psx_t = short +rbx.platform.typedef.pshift_t = ushort +rbx.platform.typedef.sshift_t = ushort +rbx.platform.typedef.unidx_t = int +rbx.platform.typedef.snidx_t = int +rbx.platform.typedef.vmnodeidx_t = int +rbx.platform.typedef.kvpn_t = int +rbx.platform.typedef.krpn_t = int +rbx.platform.typedef.vmsize_t = int +rbx.platform.typedef.vmm_lock_t = int +rbx.platform.typedef.ureg_t = ulong +rbx.platform.typedef.vmlpghandle_t = ulong +rbx.platform.typedef.ext_t = int +rbx.platform.typedef.va_list = string +rbx.platform.typedef.__ptr64 = ulong_long +rbx.platform.typedef.__cptr64 = ulong_long +rbx.platform.typedef.UniChar = ushort +rbx.platform.typedef.UTF32Char = uint +rbx.platform.typedef.uchar = uchar +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.swblk_t = int +rbx.platform.typedef.offset_t = long_long +rbx.platform.typedef.ssize64_t = long_long +rbx.platform.typedef.longlong_t = long_long +rbx.platform.typedef.u_longlong_t = ulong_long +rbx.platform.typedef.class_id_t = uint +rbx.platform.typedef.liobn_t = uint +rbx.platform.typedef.unit_addr_t = ulong_long +rbx.platform.typedef.size64_t = ulong_long +rbx.platform.typedef.socklen_t = ulong +rbx.platform.typedef.sa_family_t = uchar +rbx.platform.typedef.rlim_t = ulong +rbx.platform.typedef.rlim64_t = ulong_long diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/powerpc-darwin/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/powerpc-darwin/types.conf new file mode 100644 index 000000000..6b9313e5e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/powerpc-darwin/types.conf @@ -0,0 +1,100 @@ +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long_long +rbx.platform.typedef.__uint64_t = ulong_long +rbx.platform.typedef.__darwin_intptr_t = long +rbx.platform.typedef.__darwin_natural_t = uint +rbx.platform.typedef.__darwin_ct_rune_t = int +rbx.platform.typedef.__darwin_ptrdiff_t = int +rbx.platform.typedef.__darwin_size_t = ulong +rbx.platform.typedef.__darwin_wchar_t = int +rbx.platform.typedef.__darwin_rune_t = int +rbx.platform.typedef.__darwin_wint_t = int +rbx.platform.typedef.__darwin_clock_t = ulong +rbx.platform.typedef.__darwin_socklen_t = uint +rbx.platform.typedef.__darwin_ssize_t = long +rbx.platform.typedef.__darwin_time_t = long +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.register_t = int +rbx.platform.typedef.intptr_t = long +rbx.platform.typedef.uintptr_t = ulong +rbx.platform.typedef.user_addr_t = ulong_long +rbx.platform.typedef.user_size_t = ulong_long +rbx.platform.typedef.user_ssize_t = long_long +rbx.platform.typedef.user_long_t = long_long +rbx.platform.typedef.user_ulong_t = ulong_long +rbx.platform.typedef.user_time_t = long_long +rbx.platform.typedef.syscall_arg_t = ulong_long +rbx.platform.typedef.__darwin_blkcnt_t = long_long +rbx.platform.typedef.__darwin_blksize_t = int +rbx.platform.typedef.__darwin_dev_t = int +rbx.platform.typedef.__darwin_fsblkcnt_t = uint +rbx.platform.typedef.__darwin_fsfilcnt_t = uint +rbx.platform.typedef.__darwin_gid_t = uint +rbx.platform.typedef.__darwin_id_t = uint +rbx.platform.typedef.__darwin_ino64_t = ulong_long +rbx.platform.typedef.__darwin_ino_t = ulong_long +rbx.platform.typedef.__darwin_mach_port_name_t = uint +rbx.platform.typedef.__darwin_mach_port_t = uint +rbx.platform.typedef.__darwin_mode_t = ushort +rbx.platform.typedef.__darwin_off_t = long_long +rbx.platform.typedef.__darwin_pid_t = int +rbx.platform.typedef.__darwin_pthread_key_t = ulong +rbx.platform.typedef.__darwin_sigset_t = uint +rbx.platform.typedef.__darwin_suseconds_t = int +rbx.platform.typedef.__darwin_uid_t = uint +rbx.platform.typedef.__darwin_useconds_t = uint +rbx.platform.typedef.__darwin_uuid_t[16] = uchar +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.u_quad_t = ulong_long +rbx.platform.typedef.quad_t = long_long +rbx.platform.typedef.qaddr_t = pointer +rbx.platform.typedef.caddr_t = string +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.dev_t = int +rbx.platform.typedef.fixpt_t = uint +rbx.platform.typedef.blkcnt_t = long_long +rbx.platform.typedef.blksize_t = int +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.in_addr_t = uint +rbx.platform.typedef.in_port_t = ushort +rbx.platform.typedef.ino_t = ulong_long +rbx.platform.typedef.ino64_t = ulong_long +rbx.platform.typedef.key_t = int +rbx.platform.typedef.mode_t = ushort +rbx.platform.typedef.nlink_t = ushort +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.segsz_t = int +rbx.platform.typedef.swblk_t = int +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.clock_t = ulong +rbx.platform.typedef.size_t = ulong +rbx.platform.typedef.ssize_t = long +rbx.platform.typedef.time_t = long +rbx.platform.typedef.useconds_t = uint +rbx.platform.typedef.suseconds_t = int +rbx.platform.typedef.fd_mask = int +rbx.platform.typedef.pthread_key_t = ulong +rbx.platform.typedef.fsblkcnt_t = uint +rbx.platform.typedef.fsfilcnt_t = uint +rbx.platform.typedef.sa_family_t = uchar +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.rlim_t = ulong_long diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/powerpc-linux/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/powerpc-linux/types.conf new file mode 100644 index 000000000..76014cd25 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/powerpc-linux/types.conf @@ -0,0 +1,100 @@ +rbx.platform.typedef.__u_char = uchar +rbx.platform.typedef.__u_short = ushort +rbx.platform.typedef.__u_int = uint +rbx.platform.typedef.__u_long = ulong +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long_long +rbx.platform.typedef.__uint64_t = ulong_long +rbx.platform.typedef.__quad_t = long_long +rbx.platform.typedef.__u_quad_t = ulong_long +rbx.platform.typedef.__dev_t = ulong_long +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__ino_t = ulong +rbx.platform.typedef.__ino64_t = ulong_long +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = uint +rbx.platform.typedef.__off_t = long +rbx.platform.typedef.__off64_t = long_long +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__clock_t = long +rbx.platform.typedef.__rlim_t = ulong +rbx.platform.typedef.__rlim64_t = ulong_long +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__time_t = long +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = long +rbx.platform.typedef.__daddr_t = int +rbx.platform.typedef.__swblk_t = long +rbx.platform.typedef.__key_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__timer_t = pointer +rbx.platform.typedef.__blksize_t = long +rbx.platform.typedef.__blkcnt_t = long +rbx.platform.typedef.__blkcnt64_t = long_long +rbx.platform.typedef.__fsblkcnt_t = ulong +rbx.platform.typedef.__fsblkcnt64_t = ulong_long +rbx.platform.typedef.__fsfilcnt_t = ulong +rbx.platform.typedef.__fsfilcnt64_t = ulong_long +rbx.platform.typedef.__ssize_t = int +rbx.platform.typedef.__loff_t = long_long +rbx.platform.typedef.*__qaddr_t = long_long +rbx.platform.typedef.*__caddr_t = char +rbx.platform.typedef.__intptr_t = int +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.quad_t = long_long +rbx.platform.typedef.u_quad_t = ulong_long +rbx.platform.typedef.loff_t = long_long +rbx.platform.typedef.ino_t = ulong_long +rbx.platform.typedef.dev_t = ulong_long +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = uint +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ssize_t = int +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.key_t = int +rbx.platform.typedef.time_t = long +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.timer_t = pointer +rbx.platform.typedef.size_t = uint +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.register_t = long +rbx.platform.typedef.__sig_atomic_t = int +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.__fd_mask = long +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.blkcnt_t = long_long +rbx.platform.typedef.fsblkcnt_t = ulong_long +rbx.platform.typedef.fsfilcnt_t = ulong_long +rbx.platform.typedef.pthread_t = ulong +rbx.platform.typedef.pthread_key_t = uint +rbx.platform.typedef.pthread_once_t = int +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.sa_family_t = ushort +rbx.platform.typedef.rlim_t = ulong_long +rbx.platform.typedef.__rlimit_resource_t = int +rbx.platform.typedef.__rusage_who_t = int +rbx.platform.typedef.__priority_which_t = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/powerpc64-linux/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/powerpc64-linux/types.conf new file mode 100644 index 000000000..3feb704f7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/powerpc64-linux/types.conf @@ -0,0 +1,104 @@ +rbx.platform.typedef.__u_char = uchar +rbx.platform.typedef.__u_short = ushort +rbx.platform.typedef.__u_int = uint +rbx.platform.typedef.__u_long = ulong +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long +rbx.platform.typedef.__uint64_t = ulong +rbx.platform.typedef.__quad_t = long +rbx.platform.typedef.__u_quad_t = ulong +rbx.platform.typedef.__dev_t = ulong +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__ino_t = ulong +rbx.platform.typedef.__ino64_t = ulong +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = ulong +rbx.platform.typedef.__off_t = long +rbx.platform.typedef.__off64_t = long +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__clock_t = long +rbx.platform.typedef.__rlim_t = ulong +rbx.platform.typedef.__rlim64_t = ulong +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__time_t = long +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = long +rbx.platform.typedef.__daddr_t = int +rbx.platform.typedef.__key_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__timer_t = pointer +rbx.platform.typedef.__blksize_t = long +rbx.platform.typedef.__blkcnt_t = long +rbx.platform.typedef.__blkcnt64_t = long +rbx.platform.typedef.__fsblkcnt_t = ulong +rbx.platform.typedef.__fsblkcnt64_t = ulong +rbx.platform.typedef.__fsfilcnt_t = ulong +rbx.platform.typedef.__fsfilcnt64_t = ulong +rbx.platform.typedef.__fsword_t = long +rbx.platform.typedef.__ssize_t = long +rbx.platform.typedef.__syscall_slong_t = long +rbx.platform.typedef.__syscall_ulong_t = ulong +rbx.platform.typedef.__loff_t = long +rbx.platform.typedef.*__qaddr_t = long +rbx.platform.typedef.*__caddr_t = char +rbx.platform.typedef.__intptr_t = long +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.quad_t = long +rbx.platform.typedef.u_quad_t = ulong +rbx.platform.typedef.loff_t = long +rbx.platform.typedef.ino_t = ulong +rbx.platform.typedef.dev_t = ulong +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = ulong +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.off_t = long +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ssize_t = long +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.key_t = int +rbx.platform.typedef.clock_t = long +rbx.platform.typedef.time_t = long +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.timer_t = pointer +rbx.platform.typedef.size_t = ulong +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.register_t = long +rbx.platform.typedef.__sig_atomic_t = int +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.__fd_mask = long +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.blksize_t = long +rbx.platform.typedef.blkcnt_t = long +rbx.platform.typedef.fsblkcnt_t = ulong +rbx.platform.typedef.fsfilcnt_t = ulong +rbx.platform.typedef.pthread_t = ulong +rbx.platform.typedef.pthread_key_t = uint +rbx.platform.typedef.pthread_once_t = int +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.sa_family_t = ushort +rbx.platform.typedef.rlim_t = ulong +rbx.platform.typedef.__rlimit_resource_t = int +rbx.platform.typedef.__rusage_who_t = int +rbx.platform.typedef.__priority_which_t = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/s390-linux/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/s390-linux/types.conf new file mode 100644 index 000000000..1cc79ee80 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/s390-linux/types.conf @@ -0,0 +1,102 @@ +rbx.platform.typedef.__u_char = uchar +rbx.platform.typedef.__u_short = ushort +rbx.platform.typedef.__u_int = uint +rbx.platform.typedef.__u_long = ulong +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long_long +rbx.platform.typedef.__uint64_t = ulong_long +rbx.platform.typedef.__quad_t = long_long +rbx.platform.typedef.__u_quad_t = ulong_long +rbx.platform.typedef.__dev_t = ulong_long +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__ino_t = ulong +rbx.platform.typedef.__ino64_t = ulong_long +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = uint +rbx.platform.typedef.__off_t = long +rbx.platform.typedef.__off64_t = long_long +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__clock_t = long +rbx.platform.typedef.__rlim_t = ulong +rbx.platform.typedef.__rlim64_t = ulong_long +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__time_t = long +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = long +rbx.platform.typedef.__daddr_t = int +rbx.platform.typedef.__swblk_t = long +rbx.platform.typedef.__key_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__timer_t = pointer +rbx.platform.typedef.__blksize_t = long +rbx.platform.typedef.__blkcnt_t = long +rbx.platform.typedef.__blkcnt64_t = long_long +rbx.platform.typedef.__fsblkcnt_t = ulong +rbx.platform.typedef.__fsblkcnt64_t = ulong_long +rbx.platform.typedef.__fsfilcnt_t = ulong +rbx.platform.typedef.__fsfilcnt64_t = ulong_long +rbx.platform.typedef.__ssize_t = long +rbx.platform.typedef.__loff_t = long_long +rbx.platform.typedef.*__qaddr_t = long_long +rbx.platform.typedef.*__caddr_t = char +rbx.platform.typedef.__intptr_t = int +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.quad_t = long_long +rbx.platform.typedef.u_quad_t = ulong_long +rbx.platform.typedef.loff_t = long_long +rbx.platform.typedef.ino_t = ulong_long +rbx.platform.typedef.dev_t = ulong_long +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = uint +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ssize_t = long +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.key_t = int +rbx.platform.typedef.clock_t = long +rbx.platform.typedef.time_t = long +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.timer_t = pointer +rbx.platform.typedef.size_t = ulong +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.register_t = long +rbx.platform.typedef.__sig_atomic_t = int +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.__fd_mask = long +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.blksize_t = long +rbx.platform.typedef.blkcnt_t = long_long +rbx.platform.typedef.fsblkcnt_t = ulong_long +rbx.platform.typedef.fsfilcnt_t = ulong_long +rbx.platform.typedef.pthread_t = ulong +rbx.platform.typedef.pthread_key_t = uint +rbx.platform.typedef.pthread_once_t = int +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.sa_family_t = ushort +rbx.platform.typedef.rlim_t = ulong_long +rbx.platform.typedef.__rlimit_resource_t = int +rbx.platform.typedef.__rusage_who_t = int +rbx.platform.typedef.__priority_which_t = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/s390x-linux/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/s390x-linux/types.conf new file mode 100644 index 000000000..f4c8cec61 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/s390x-linux/types.conf @@ -0,0 +1,102 @@ +rbx.platform.typedef.__u_char = uchar +rbx.platform.typedef.__u_short = ushort +rbx.platform.typedef.__u_int = uint +rbx.platform.typedef.__u_long = ulong +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long +rbx.platform.typedef.__uint64_t = ulong +rbx.platform.typedef.__quad_t = long +rbx.platform.typedef.__u_quad_t = ulong +rbx.platform.typedef.__dev_t = ulong +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__ino_t = ulong +rbx.platform.typedef.__ino64_t = ulong +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = ulong +rbx.platform.typedef.__off_t = long +rbx.platform.typedef.__off64_t = long +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__clock_t = long +rbx.platform.typedef.__rlim_t = ulong +rbx.platform.typedef.__rlim64_t = ulong +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__time_t = long +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = long +rbx.platform.typedef.__daddr_t = int +rbx.platform.typedef.__swblk_t = long +rbx.platform.typedef.__key_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__timer_t = pointer +rbx.platform.typedef.__blksize_t = long +rbx.platform.typedef.__blkcnt_t = long +rbx.platform.typedef.__blkcnt64_t = long +rbx.platform.typedef.__fsblkcnt_t = ulong +rbx.platform.typedef.__fsblkcnt64_t = ulong +rbx.platform.typedef.__fsfilcnt_t = ulong +rbx.platform.typedef.__fsfilcnt64_t = ulong +rbx.platform.typedef.__ssize_t = long +rbx.platform.typedef.__loff_t = long +rbx.platform.typedef.*__qaddr_t = long +rbx.platform.typedef.*__caddr_t = char +rbx.platform.typedef.__intptr_t = long +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.quad_t = long +rbx.platform.typedef.u_quad_t = ulong +rbx.platform.typedef.loff_t = long +rbx.platform.typedef.ino_t = ulong +rbx.platform.typedef.dev_t = ulong +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = ulong +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.off_t = long +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ssize_t = long +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.key_t = int +rbx.platform.typedef.clock_t = long +rbx.platform.typedef.time_t = long +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.timer_t = pointer +rbx.platform.typedef.size_t = ulong +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.register_t = long +rbx.platform.typedef.__sig_atomic_t = int +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.__fd_mask = long +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.blksize_t = long +rbx.platform.typedef.blkcnt_t = long +rbx.platform.typedef.fsblkcnt_t = ulong +rbx.platform.typedef.fsfilcnt_t = ulong +rbx.platform.typedef.pthread_t = ulong +rbx.platform.typedef.pthread_key_t = uint +rbx.platform.typedef.pthread_once_t = int +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.sa_family_t = ushort +rbx.platform.typedef.rlim_t = ulong +rbx.platform.typedef.__rlimit_resource_t = int +rbx.platform.typedef.__rusage_who_t = int +rbx.platform.typedef.__priority_which_t = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/sparc-linux/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/sparc-linux/types.conf new file mode 100644 index 000000000..1882298ea --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/sparc-linux/types.conf @@ -0,0 +1,102 @@ +rbx.platform.typedef.__u_char = uchar +rbx.platform.typedef.__u_short = ushort +rbx.platform.typedef.__u_int = uint +rbx.platform.typedef.__u_long = ulong +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long_long +rbx.platform.typedef.__uint64_t = ulong_long +rbx.platform.typedef.__quad_t = long_long +rbx.platform.typedef.__u_quad_t = ulong_long +rbx.platform.typedef.__dev_t = ulong_long +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__ino_t = ulong +rbx.platform.typedef.__ino64_t = ulong_long +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = uint +rbx.platform.typedef.__off_t = long +rbx.platform.typedef.__off64_t = long_long +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__clock_t = long +rbx.platform.typedef.__rlim_t = ulong +rbx.platform.typedef.__rlim64_t = ulong_long +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__time_t = long +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = int +rbx.platform.typedef.__daddr_t = int +rbx.platform.typedef.__swblk_t = long +rbx.platform.typedef.__key_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__timer_t = pointer +rbx.platform.typedef.__blksize_t = long +rbx.platform.typedef.__blkcnt_t = long +rbx.platform.typedef.__blkcnt64_t = long_long +rbx.platform.typedef.__fsblkcnt_t = ulong +rbx.platform.typedef.__fsblkcnt64_t = ulong_long +rbx.platform.typedef.__fsfilcnt_t = ulong +rbx.platform.typedef.__fsfilcnt64_t = ulong_long +rbx.platform.typedef.__ssize_t = int +rbx.platform.typedef.__loff_t = long_long +rbx.platform.typedef.*__qaddr_t = long_long +rbx.platform.typedef.*__caddr_t = char +rbx.platform.typedef.__intptr_t = int +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.quad_t = long_long +rbx.platform.typedef.u_quad_t = ulong_long +rbx.platform.typedef.loff_t = long_long +rbx.platform.typedef.ino_t = ulong_long +rbx.platform.typedef.dev_t = ulong_long +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = uint +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ssize_t = int +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.key_t = int +rbx.platform.typedef.clock_t = long +rbx.platform.typedef.time_t = long +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.timer_t = pointer +rbx.platform.typedef.size_t = uint +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.register_t = long +rbx.platform.typedef.__sig_atomic_t = int +rbx.platform.typedef.suseconds_t = int +rbx.platform.typedef.__fd_mask = long +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.blksize_t = long +rbx.platform.typedef.blkcnt_t = long_long +rbx.platform.typedef.fsblkcnt_t = ulong_long +rbx.platform.typedef.fsfilcnt_t = ulong_long +rbx.platform.typedef.pthread_t = ulong +rbx.platform.typedef.pthread_key_t = uint +rbx.platform.typedef.pthread_once_t = int +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.sa_family_t = ushort +rbx.platform.typedef.rlim_t = ulong_long +rbx.platform.typedef.__rlimit_resource_t = int +rbx.platform.typedef.__rusage_who_t = int +rbx.platform.typedef.__priority_which_t = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/sparc-solaris/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/sparc-solaris/types.conf new file mode 100644 index 000000000..c03c1446e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/sparc-solaris/types.conf @@ -0,0 +1,128 @@ +rbx.platform.typedef.lock_t = uchar +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.uint8_t = uchar +rbx.platform.typedef.uint16_t = ushort +rbx.platform.typedef.uint32_t = uint +rbx.platform.typedef.uint64_t = ulong_long +rbx.platform.typedef.intmax_t = long_long +rbx.platform.typedef.uintmax_t = ulong_long +rbx.platform.typedef.intptr_t = int +rbx.platform.typedef.uintptr_t = uint +rbx.platform.typedef.int_fast8_t = char +rbx.platform.typedef.int_fast16_t = int +rbx.platform.typedef.int_fast32_t = int +rbx.platform.typedef.int_fast64_t = long_long +rbx.platform.typedef.uint_fast8_t = uchar +rbx.platform.typedef.uint_fast16_t = uint +rbx.platform.typedef.uint_fast32_t = uint +rbx.platform.typedef.uint_fast64_t = ulong_long +rbx.platform.typedef.int_least8_t = char +rbx.platform.typedef.int_least16_t = short +rbx.platform.typedef.int_least32_t = int +rbx.platform.typedef.int_least64_t = long_long +rbx.platform.typedef.uint_least8_t = uchar +rbx.platform.typedef.uint_least16_t = ushort +rbx.platform.typedef.uint_least32_t = uint +rbx.platform.typedef.uint_least64_t = ulong_long +rbx.platform.typedef.longlong_t = long_long +rbx.platform.typedef.u_longlong_t = ulong_long +rbx.platform.typedef.t_scalar_t = long +rbx.platform.typedef.t_uscalar_t = ulong +rbx.platform.typedef.uchar_t = uchar +rbx.platform.typedef.ushort_t = ushort +rbx.platform.typedef.uint_t = uint +rbx.platform.typedef.ulong_t = ulong +rbx.platform.typedef.*caddr_t = char +rbx.platform.typedef.daddr_t = long +rbx.platform.typedef.cnt_t = short +rbx.platform.typedef.ptrdiff_t = int +rbx.platform.typedef.pfn_t = ulong +rbx.platform.typedef.pgcnt_t = ulong +rbx.platform.typedef.spgcnt_t = long +rbx.platform.typedef.use_t = uchar +rbx.platform.typedef.sysid_t = short +rbx.platform.typedef.index_t = short +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.off64_t = long_long +rbx.platform.typedef.ino_t = ulong_long +rbx.platform.typedef.blkcnt_t = long_long +rbx.platform.typedef.fsblkcnt_t = ulong_long +rbx.platform.typedef.fsfilcnt_t = ulong_long +rbx.platform.typedef.ino64_t = ulong_long +rbx.platform.typedef.blkcnt64_t = long_long +rbx.platform.typedef.fsblkcnt64_t = ulong_long +rbx.platform.typedef.fsfilcnt64_t = ulong_long +rbx.platform.typedef.blksize_t = long +rbx.platform.typedef.pad64_t = long_long +rbx.platform.typedef.upad64_t = ulong_long +rbx.platform.typedef.offset_t = long_long +rbx.platform.typedef.u_offset_t = ulong_long +rbx.platform.typedef.len_t = ulong_long +rbx.platform.typedef.diskaddr_t = ulong_long +rbx.platform.typedef.k_fltset_t = uint +rbx.platform.typedef.id_t = long +rbx.platform.typedef.useconds_t = uint +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.major_t = ulong +rbx.platform.typedef.minor_t = ulong +rbx.platform.typedef.pri_t = short +rbx.platform.typedef.cpu_flag_t = ushort +rbx.platform.typedef.o_mode_t = ushort +rbx.platform.typedef.o_dev_t = short +rbx.platform.typedef.o_uid_t = ushort +rbx.platform.typedef.o_gid_t = ushort +rbx.platform.typedef.o_nlink_t = short +rbx.platform.typedef.o_pid_t = short +rbx.platform.typedef.o_ino_t = ushort +rbx.platform.typedef.key_t = int +rbx.platform.typedef.mode_t = ulong +rbx.platform.typedef.uid_t = long +rbx.platform.typedef.gid_t = long +rbx.platform.typedef.taskid_t = long +rbx.platform.typedef.projid_t = long +rbx.platform.typedef.poolid_t = long +rbx.platform.typedef.zoneid_t = long +rbx.platform.typedef.ctid_t = long +rbx.platform.typedef.pthread_t = uint +rbx.platform.typedef.pthread_key_t = uint +rbx.platform.typedef.dev_t = ulong +rbx.platform.typedef.nlink_t = ulong +rbx.platform.typedef.pid_t = long +rbx.platform.typedef.size_t = uint +rbx.platform.typedef.ssize_t = int +rbx.platform.typedef.time_t = long +rbx.platform.typedef.clock_t = long +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.timer_t = int +rbx.platform.typedef.unchar = uchar +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.hrtime_t = long_long +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.fds_mask = long +rbx.platform.typedef.sa_family_t = ushort +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.Psocklen_t = pointer +rbx.platform.typedef.disp_lock_t = uchar +rbx.platform.typedef.rlim_t = ulong_long +rbx.platform.typedef.rlim64_t = ulong_long +rbx.platform.typedef.kid_t = int +rbx.platform.typedef.int) = pointer +rbx.platform.typedef.size_t) = pointer +rbx.platform.typedef.int) = pointer +rbx.platform.typedef.avl_index_t = uint +rbx.platform.typedef.() = pointer +rbx.platform.typedef.nfds_t = ulong +rbx.platform.typedef.model_t = uint +rbx.platform.typedef.ts_t = long_long +rbx.platform.typedef.in_port_t = ushort +rbx.platform.typedef.in_addr_t = uint +rbx.platform.typedef.ipaddr_t = uint diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/sparcv9-solaris/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/sparcv9-solaris/types.conf new file mode 100644 index 000000000..c03c1446e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/sparcv9-solaris/types.conf @@ -0,0 +1,128 @@ +rbx.platform.typedef.lock_t = uchar +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.uint8_t = uchar +rbx.platform.typedef.uint16_t = ushort +rbx.platform.typedef.uint32_t = uint +rbx.platform.typedef.uint64_t = ulong_long +rbx.platform.typedef.intmax_t = long_long +rbx.platform.typedef.uintmax_t = ulong_long +rbx.platform.typedef.intptr_t = int +rbx.platform.typedef.uintptr_t = uint +rbx.platform.typedef.int_fast8_t = char +rbx.platform.typedef.int_fast16_t = int +rbx.platform.typedef.int_fast32_t = int +rbx.platform.typedef.int_fast64_t = long_long +rbx.platform.typedef.uint_fast8_t = uchar +rbx.platform.typedef.uint_fast16_t = uint +rbx.platform.typedef.uint_fast32_t = uint +rbx.platform.typedef.uint_fast64_t = ulong_long +rbx.platform.typedef.int_least8_t = char +rbx.platform.typedef.int_least16_t = short +rbx.platform.typedef.int_least32_t = int +rbx.platform.typedef.int_least64_t = long_long +rbx.platform.typedef.uint_least8_t = uchar +rbx.platform.typedef.uint_least16_t = ushort +rbx.platform.typedef.uint_least32_t = uint +rbx.platform.typedef.uint_least64_t = ulong_long +rbx.platform.typedef.longlong_t = long_long +rbx.platform.typedef.u_longlong_t = ulong_long +rbx.platform.typedef.t_scalar_t = long +rbx.platform.typedef.t_uscalar_t = ulong +rbx.platform.typedef.uchar_t = uchar +rbx.platform.typedef.ushort_t = ushort +rbx.platform.typedef.uint_t = uint +rbx.platform.typedef.ulong_t = ulong +rbx.platform.typedef.*caddr_t = char +rbx.platform.typedef.daddr_t = long +rbx.platform.typedef.cnt_t = short +rbx.platform.typedef.ptrdiff_t = int +rbx.platform.typedef.pfn_t = ulong +rbx.platform.typedef.pgcnt_t = ulong +rbx.platform.typedef.spgcnt_t = long +rbx.platform.typedef.use_t = uchar +rbx.platform.typedef.sysid_t = short +rbx.platform.typedef.index_t = short +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.off64_t = long_long +rbx.platform.typedef.ino_t = ulong_long +rbx.platform.typedef.blkcnt_t = long_long +rbx.platform.typedef.fsblkcnt_t = ulong_long +rbx.platform.typedef.fsfilcnt_t = ulong_long +rbx.platform.typedef.ino64_t = ulong_long +rbx.platform.typedef.blkcnt64_t = long_long +rbx.platform.typedef.fsblkcnt64_t = ulong_long +rbx.platform.typedef.fsfilcnt64_t = ulong_long +rbx.platform.typedef.blksize_t = long +rbx.platform.typedef.pad64_t = long_long +rbx.platform.typedef.upad64_t = ulong_long +rbx.platform.typedef.offset_t = long_long +rbx.platform.typedef.u_offset_t = ulong_long +rbx.platform.typedef.len_t = ulong_long +rbx.platform.typedef.diskaddr_t = ulong_long +rbx.platform.typedef.k_fltset_t = uint +rbx.platform.typedef.id_t = long +rbx.platform.typedef.useconds_t = uint +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.major_t = ulong +rbx.platform.typedef.minor_t = ulong +rbx.platform.typedef.pri_t = short +rbx.platform.typedef.cpu_flag_t = ushort +rbx.platform.typedef.o_mode_t = ushort +rbx.platform.typedef.o_dev_t = short +rbx.platform.typedef.o_uid_t = ushort +rbx.platform.typedef.o_gid_t = ushort +rbx.platform.typedef.o_nlink_t = short +rbx.platform.typedef.o_pid_t = short +rbx.platform.typedef.o_ino_t = ushort +rbx.platform.typedef.key_t = int +rbx.platform.typedef.mode_t = ulong +rbx.platform.typedef.uid_t = long +rbx.platform.typedef.gid_t = long +rbx.platform.typedef.taskid_t = long +rbx.platform.typedef.projid_t = long +rbx.platform.typedef.poolid_t = long +rbx.platform.typedef.zoneid_t = long +rbx.platform.typedef.ctid_t = long +rbx.platform.typedef.pthread_t = uint +rbx.platform.typedef.pthread_key_t = uint +rbx.platform.typedef.dev_t = ulong +rbx.platform.typedef.nlink_t = ulong +rbx.platform.typedef.pid_t = long +rbx.platform.typedef.size_t = uint +rbx.platform.typedef.ssize_t = int +rbx.platform.typedef.time_t = long +rbx.platform.typedef.clock_t = long +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.timer_t = int +rbx.platform.typedef.unchar = uchar +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.hrtime_t = long_long +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.fds_mask = long +rbx.platform.typedef.sa_family_t = ushort +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.Psocklen_t = pointer +rbx.platform.typedef.disp_lock_t = uchar +rbx.platform.typedef.rlim_t = ulong_long +rbx.platform.typedef.rlim64_t = ulong_long +rbx.platform.typedef.kid_t = int +rbx.platform.typedef.int) = pointer +rbx.platform.typedef.size_t) = pointer +rbx.platform.typedef.int) = pointer +rbx.platform.typedef.avl_index_t = uint +rbx.platform.typedef.() = pointer +rbx.platform.typedef.nfds_t = ulong +rbx.platform.typedef.model_t = uint +rbx.platform.typedef.ts_t = long_long +rbx.platform.typedef.in_port_t = ushort +rbx.platform.typedef.in_addr_t = uint +rbx.platform.typedef.ipaddr_t = uint diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-cygwin/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-cygwin/types.conf new file mode 100755 index 000000000..5dadc7f03 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-cygwin/types.conf @@ -0,0 +1,3 @@ +rbx.platform.typedef.size_t = uint64 +rbx.platform.typedef.ptrdiff_t = int64 +rbx.platform.typedef.ssize_t = int64 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-darwin/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-darwin/types.conf new file mode 100644 index 000000000..51637eed0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-darwin/types.conf @@ -0,0 +1,126 @@ +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long_long +rbx.platform.typedef.__uint64_t = ulong_long +rbx.platform.typedef.__darwin_intptr_t = long +rbx.platform.typedef.__darwin_natural_t = uint +rbx.platform.typedef.__darwin_ct_rune_t = int +rbx.platform.typedef.__darwin_ptrdiff_t = long +rbx.platform.typedef.__darwin_size_t = ulong +rbx.platform.typedef.__darwin_wchar_t = int +rbx.platform.typedef.__darwin_rune_t = int +rbx.platform.typedef.__darwin_wint_t = int +rbx.platform.typedef.__darwin_clock_t = ulong +rbx.platform.typedef.__darwin_socklen_t = uint +rbx.platform.typedef.__darwin_ssize_t = long +rbx.platform.typedef.__darwin_time_t = long +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.register_t = long_long +rbx.platform.typedef.intptr_t = long +rbx.platform.typedef.uintptr_t = ulong +rbx.platform.typedef.user_addr_t = ulong_long +rbx.platform.typedef.user_size_t = ulong_long +rbx.platform.typedef.user_ssize_t = long_long +rbx.platform.typedef.user_long_t = long_long +rbx.platform.typedef.user_ulong_t = ulong_long +rbx.platform.typedef.user_time_t = long_long +rbx.platform.typedef.user_off_t = long_long +rbx.platform.typedef.syscall_arg_t = ulong_long +rbx.platform.typedef.__darwin_blkcnt_t = long_long +rbx.platform.typedef.__darwin_blksize_t = int +rbx.platform.typedef.__darwin_dev_t = int +rbx.platform.typedef.__darwin_fsblkcnt_t = uint +rbx.platform.typedef.__darwin_fsfilcnt_t = uint +rbx.platform.typedef.__darwin_gid_t = uint +rbx.platform.typedef.__darwin_id_t = uint +rbx.platform.typedef.__darwin_ino64_t = ulong_long +rbx.platform.typedef.__darwin_ino_t = ulong_long +rbx.platform.typedef.__darwin_mach_port_name_t = uint +rbx.platform.typedef.__darwin_mach_port_t = uint +rbx.platform.typedef.__darwin_mode_t = ushort +rbx.platform.typedef.__darwin_off_t = long_long +rbx.platform.typedef.__darwin_pid_t = int +rbx.platform.typedef.__darwin_sigset_t = uint +rbx.platform.typedef.__darwin_suseconds_t = int +rbx.platform.typedef.__darwin_uid_t = uint +rbx.platform.typedef.__darwin_useconds_t = uint +rbx.platform.typedef.__darwin_uuid_t[16] = uchar +rbx.platform.typedef.__darwin_uuid_string_t[37] = char +rbx.platform.typedef.__darwin_pthread_key_t = ulong +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.u_quad_t = ulong_long +rbx.platform.typedef.quad_t = long_long +rbx.platform.typedef.qaddr_t = pointer +rbx.platform.typedef.caddr_t = string +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.dev_t = int +rbx.platform.typedef.fixpt_t = uint +rbx.platform.typedef.blkcnt_t = long_long +rbx.platform.typedef.blksize_t = int +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.in_addr_t = uint +rbx.platform.typedef.in_port_t = ushort +rbx.platform.typedef.ino_t = ulong_long +rbx.platform.typedef.ino64_t = ulong_long +rbx.platform.typedef.key_t = int +rbx.platform.typedef.mode_t = ushort +rbx.platform.typedef.nlink_t = ushort +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.segsz_t = int +rbx.platform.typedef.swblk_t = int +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.clock_t = ulong +rbx.platform.typedef.size_t = ulong +rbx.platform.typedef.ssize_t = long +rbx.platform.typedef.time_t = long +rbx.platform.typedef.useconds_t = uint +rbx.platform.typedef.suseconds_t = int +rbx.platform.typedef.rsize_t = ulong +rbx.platform.typedef.errno_t = int +rbx.platform.typedef.fd_mask = int +rbx.platform.typedef.pthread_key_t = ulong +rbx.platform.typedef.fsblkcnt_t = uint +rbx.platform.typedef.fsfilcnt_t = uint +rbx.platform.typedef.sa_family_t = uchar +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.uint8_t = uchar +rbx.platform.typedef.uint16_t = ushort +rbx.platform.typedef.uint32_t = uint +rbx.platform.typedef.uint64_t = ulong_long +rbx.platform.typedef.int_least8_t = char +rbx.platform.typedef.int_least16_t = short +rbx.platform.typedef.int_least32_t = int +rbx.platform.typedef.int_least64_t = long_long +rbx.platform.typedef.uint_least8_t = uchar +rbx.platform.typedef.uint_least16_t = ushort +rbx.platform.typedef.uint_least32_t = uint +rbx.platform.typedef.uint_least64_t = ulong_long +rbx.platform.typedef.int_fast8_t = char +rbx.platform.typedef.int_fast16_t = short +rbx.platform.typedef.int_fast32_t = int +rbx.platform.typedef.int_fast64_t = long_long +rbx.platform.typedef.uint_fast8_t = uchar +rbx.platform.typedef.uint_fast16_t = ushort +rbx.platform.typedef.uint_fast32_t = uint +rbx.platform.typedef.uint_fast64_t = ulong_long +rbx.platform.typedef.intmax_t = long +rbx.platform.typedef.uintmax_t = ulong +rbx.platform.typedef.rlim_t = ulong_long diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-freebsd/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-freebsd/types.conf new file mode 100644 index 000000000..c4df68adb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-freebsd/types.conf @@ -0,0 +1,128 @@ +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long_long +rbx.platform.typedef.__uint64_t = ulong_long +rbx.platform.typedef.__int_least8_t = char +rbx.platform.typedef.__uint_least8_t = uchar +rbx.platform.typedef.__int_least16_t = short +rbx.platform.typedef.__uint_least16_t = ushort +rbx.platform.typedef.__int_least32_t = int +rbx.platform.typedef.__uint_least32_t = uint +rbx.platform.typedef.__int_least64_t = long_long +rbx.platform.typedef.__uint_least64_t = ulong_long +rbx.platform.typedef.__int_fast8_t = int +rbx.platform.typedef.__uint_fast8_t = uint +rbx.platform.typedef.__int_fast16_t = int +rbx.platform.typedef.__uint_fast16_t = uint +rbx.platform.typedef.__int_fast32_t = int +rbx.platform.typedef.__uint_fast32_t = uint +rbx.platform.typedef.__int_fast64_t = long_long +rbx.platform.typedef.__uint_fast64_t = ulong_long +rbx.platform.typedef.__intptr_t = long +rbx.platform.typedef.__uintptr_t = ulong +rbx.platform.typedef.__intmax_t = long_long +rbx.platform.typedef.__uintmax_t = ulong_long +rbx.platform.typedef.__register_t = int +rbx.platform.typedef.__vaddr_t = ulong +rbx.platform.typedef.__paddr_t = ulong +rbx.platform.typedef.__vsize_t = ulong +rbx.platform.typedef.__psize_t = ulong +rbx.platform.typedef.__clock_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__off_t = long_long +rbx.platform.typedef.__ptrdiff_t = long +rbx.platform.typedef.__size_t = ulong +rbx.platform.typedef.__ssize_t = long +rbx.platform.typedef.__time_t = int +rbx.platform.typedef.__timer_t = int +rbx.platform.typedef.__wchar_t = int +rbx.platform.typedef.__wint_t = int +rbx.platform.typedef.__rune_t = int +rbx.platform.typedef.__wctrans_t = pointer +rbx.platform.typedef.__wctype_t = pointer +rbx.platform.typedef.__cpuid_t = ulong +rbx.platform.typedef.__dev_t = int +rbx.platform.typedef.__fixpt_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__in_addr_t = uint +rbx.platform.typedef.__in_port_t = ushort +rbx.platform.typedef.__ino_t = uint +rbx.platform.typedef.__key_t = long +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = uint +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__rlim_t = ulong_long +rbx.platform.typedef.__sa_family_t = uchar +rbx.platform.typedef.__segsz_t = int +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.__swblk_t = int +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = int +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.unchar = uchar +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.cpuid_t = ulong +rbx.platform.typedef.register_t = int +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.uint8_t = uchar +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.uint16_t = ushort +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.uint32_t = uint +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.uint64_t = ulong_long +rbx.platform.typedef.intptr_t = long +rbx.platform.typedef.uintptr_t = ulong +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.quad_t = long_long +rbx.platform.typedef.u_quad_t = ulong_long +rbx.platform.typedef.qaddr_t = pointer +rbx.platform.typedef.vaddr_t = ulong +rbx.platform.typedef.paddr_t = ulong +rbx.platform.typedef.vsize_t = ulong +rbx.platform.typedef.psize_t = ulong +rbx.platform.typedef.caddr_t = string +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.daddr32_t = int +rbx.platform.typedef.daddr64_t = long_long +rbx.platform.typedef.dev_t = int +rbx.platform.typedef.fixpt_t = uint +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ino_t = uint +rbx.platform.typedef.key_t = long +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = uint +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.rlim_t = ulong_long +rbx.platform.typedef.segsz_t = int +rbx.platform.typedef.swblk_t = int +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.useconds_t = uint +rbx.platform.typedef.suseconds_t = int +rbx.platform.typedef.in_addr_t = uint +rbx.platform.typedef.in_port_t = ushort +rbx.platform.typedef.sa_family_t = uchar +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.clock_t = int +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.size_t = ulong +rbx.platform.typedef.ssize_t = long +rbx.platform.typedef.time_t = int +rbx.platform.typedef.timer_t = int +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.__fd_mask = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-linux/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-linux/types.conf new file mode 100644 index 000000000..f319c0bbe --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-linux/types.conf @@ -0,0 +1,102 @@ +rbx.platform.typedef.__u_char = uchar +rbx.platform.typedef.__u_short = ushort +rbx.platform.typedef.__u_int = uint +rbx.platform.typedef.__u_long = ulong +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long +rbx.platform.typedef.__uint64_t = ulong +rbx.platform.typedef.__quad_t = long +rbx.platform.typedef.__u_quad_t = ulong +rbx.platform.typedef.__dev_t = ulong +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__ino_t = ulong +rbx.platform.typedef.__ino64_t = ulong +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = ulong +rbx.platform.typedef.__off_t = long +rbx.platform.typedef.__off64_t = long +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__clock_t = long +rbx.platform.typedef.__rlim_t = ulong +rbx.platform.typedef.__rlim64_t = ulong +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__time_t = long +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = long +rbx.platform.typedef.__daddr_t = int +rbx.platform.typedef.__swblk_t = long +rbx.platform.typedef.__key_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__timer_t = pointer +rbx.platform.typedef.blksize_t = long +rbx.platform.typedef.__blkcnt_t = long +rbx.platform.typedef.__blkcnt64_t = long +rbx.platform.typedef.__fsblkcnt_t = ulong +rbx.platform.typedef.__fsblkcnt64_t = ulong +rbx.platform.typedef.__fsfilcnt_t = ulong +rbx.platform.typedef.__fsfilcnt64_t = ulong +rbx.platform.typedef.__ssize_t = long +rbx.platform.typedef.__loff_t = long +rbx.platform.typedef.*__qaddr_t = long +rbx.platform.typedef.*__caddr_t = char +rbx.platform.typedef.__intptr_t = long +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.quad_t = long +rbx.platform.typedef.u_quad_t = ulong +rbx.platform.typedef.loff_t = long +rbx.platform.typedef.ino_t = ulong +rbx.platform.typedef.dev_t = ulong +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.in_addr_t = uint +rbx.platform.typedef.in_port_t = ushort +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = ulong +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.off_t = long +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ssize_t = long +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.key_t = int +rbx.platform.typedef.time_t = long +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.timer_t = pointer +rbx.platform.typedef.size_t = ulong +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.register_t = long +rbx.platform.typedef.__sig_atomic_t = int +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.__fd_mask = long +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.blkcnt_t = long +rbx.platform.typedef.fsblkcnt_t = ulong +rbx.platform.typedef.fsfilcnt_t = ulong +rbx.platform.typedef.pthread_t = ulong +rbx.platform.typedef.pthread_key_t = uint +rbx.platform.typedef.pthread_once_t = int +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.sa_family_t = ushort +rbx.platform.typedef.rlim_t = ulong +rbx.platform.typedef.__rlimit_resource_t = int +rbx.platform.typedef.__rusage_who_t = int +rbx.platform.typedef.__priority_which_t = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-netbsd/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-netbsd/types.conf new file mode 100644 index 000000000..c4df68adb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-netbsd/types.conf @@ -0,0 +1,128 @@ +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long_long +rbx.platform.typedef.__uint64_t = ulong_long +rbx.platform.typedef.__int_least8_t = char +rbx.platform.typedef.__uint_least8_t = uchar +rbx.platform.typedef.__int_least16_t = short +rbx.platform.typedef.__uint_least16_t = ushort +rbx.platform.typedef.__int_least32_t = int +rbx.platform.typedef.__uint_least32_t = uint +rbx.platform.typedef.__int_least64_t = long_long +rbx.platform.typedef.__uint_least64_t = ulong_long +rbx.platform.typedef.__int_fast8_t = int +rbx.platform.typedef.__uint_fast8_t = uint +rbx.platform.typedef.__int_fast16_t = int +rbx.platform.typedef.__uint_fast16_t = uint +rbx.platform.typedef.__int_fast32_t = int +rbx.platform.typedef.__uint_fast32_t = uint +rbx.platform.typedef.__int_fast64_t = long_long +rbx.platform.typedef.__uint_fast64_t = ulong_long +rbx.platform.typedef.__intptr_t = long +rbx.platform.typedef.__uintptr_t = ulong +rbx.platform.typedef.__intmax_t = long_long +rbx.platform.typedef.__uintmax_t = ulong_long +rbx.platform.typedef.__register_t = int +rbx.platform.typedef.__vaddr_t = ulong +rbx.platform.typedef.__paddr_t = ulong +rbx.platform.typedef.__vsize_t = ulong +rbx.platform.typedef.__psize_t = ulong +rbx.platform.typedef.__clock_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__off_t = long_long +rbx.platform.typedef.__ptrdiff_t = long +rbx.platform.typedef.__size_t = ulong +rbx.platform.typedef.__ssize_t = long +rbx.platform.typedef.__time_t = int +rbx.platform.typedef.__timer_t = int +rbx.platform.typedef.__wchar_t = int +rbx.platform.typedef.__wint_t = int +rbx.platform.typedef.__rune_t = int +rbx.platform.typedef.__wctrans_t = pointer +rbx.platform.typedef.__wctype_t = pointer +rbx.platform.typedef.__cpuid_t = ulong +rbx.platform.typedef.__dev_t = int +rbx.platform.typedef.__fixpt_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__in_addr_t = uint +rbx.platform.typedef.__in_port_t = ushort +rbx.platform.typedef.__ino_t = uint +rbx.platform.typedef.__key_t = long +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = uint +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__rlim_t = ulong_long +rbx.platform.typedef.__sa_family_t = uchar +rbx.platform.typedef.__segsz_t = int +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.__swblk_t = int +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = int +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.unchar = uchar +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.cpuid_t = ulong +rbx.platform.typedef.register_t = int +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.uint8_t = uchar +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.uint16_t = ushort +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.uint32_t = uint +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.uint64_t = ulong_long +rbx.platform.typedef.intptr_t = long +rbx.platform.typedef.uintptr_t = ulong +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.quad_t = long_long +rbx.platform.typedef.u_quad_t = ulong_long +rbx.platform.typedef.qaddr_t = pointer +rbx.platform.typedef.vaddr_t = ulong +rbx.platform.typedef.paddr_t = ulong +rbx.platform.typedef.vsize_t = ulong +rbx.platform.typedef.psize_t = ulong +rbx.platform.typedef.caddr_t = string +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.daddr32_t = int +rbx.platform.typedef.daddr64_t = long_long +rbx.platform.typedef.dev_t = int +rbx.platform.typedef.fixpt_t = uint +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ino_t = uint +rbx.platform.typedef.key_t = long +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = uint +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.rlim_t = ulong_long +rbx.platform.typedef.segsz_t = int +rbx.platform.typedef.swblk_t = int +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.useconds_t = uint +rbx.platform.typedef.suseconds_t = int +rbx.platform.typedef.in_addr_t = uint +rbx.platform.typedef.in_port_t = ushort +rbx.platform.typedef.sa_family_t = uchar +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.clock_t = int +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.size_t = ulong +rbx.platform.typedef.ssize_t = long +rbx.platform.typedef.time_t = int +rbx.platform.typedef.timer_t = int +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.__fd_mask = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-openbsd/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-openbsd/types.conf new file mode 100644 index 000000000..c4df68adb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-openbsd/types.conf @@ -0,0 +1,128 @@ +rbx.platform.typedef.__int8_t = char +rbx.platform.typedef.__uint8_t = uchar +rbx.platform.typedef.__int16_t = short +rbx.platform.typedef.__uint16_t = ushort +rbx.platform.typedef.__int32_t = int +rbx.platform.typedef.__uint32_t = uint +rbx.platform.typedef.__int64_t = long_long +rbx.platform.typedef.__uint64_t = ulong_long +rbx.platform.typedef.__int_least8_t = char +rbx.platform.typedef.__uint_least8_t = uchar +rbx.platform.typedef.__int_least16_t = short +rbx.platform.typedef.__uint_least16_t = ushort +rbx.platform.typedef.__int_least32_t = int +rbx.platform.typedef.__uint_least32_t = uint +rbx.platform.typedef.__int_least64_t = long_long +rbx.platform.typedef.__uint_least64_t = ulong_long +rbx.platform.typedef.__int_fast8_t = int +rbx.platform.typedef.__uint_fast8_t = uint +rbx.platform.typedef.__int_fast16_t = int +rbx.platform.typedef.__uint_fast16_t = uint +rbx.platform.typedef.__int_fast32_t = int +rbx.platform.typedef.__uint_fast32_t = uint +rbx.platform.typedef.__int_fast64_t = long_long +rbx.platform.typedef.__uint_fast64_t = ulong_long +rbx.platform.typedef.__intptr_t = long +rbx.platform.typedef.__uintptr_t = ulong +rbx.platform.typedef.__intmax_t = long_long +rbx.platform.typedef.__uintmax_t = ulong_long +rbx.platform.typedef.__register_t = int +rbx.platform.typedef.__vaddr_t = ulong +rbx.platform.typedef.__paddr_t = ulong +rbx.platform.typedef.__vsize_t = ulong +rbx.platform.typedef.__psize_t = ulong +rbx.platform.typedef.__clock_t = int +rbx.platform.typedef.__clockid_t = int +rbx.platform.typedef.__off_t = long_long +rbx.platform.typedef.__ptrdiff_t = long +rbx.platform.typedef.__size_t = ulong +rbx.platform.typedef.__ssize_t = long +rbx.platform.typedef.__time_t = int +rbx.platform.typedef.__timer_t = int +rbx.platform.typedef.__wchar_t = int +rbx.platform.typedef.__wint_t = int +rbx.platform.typedef.__rune_t = int +rbx.platform.typedef.__wctrans_t = pointer +rbx.platform.typedef.__wctype_t = pointer +rbx.platform.typedef.__cpuid_t = ulong +rbx.platform.typedef.__dev_t = int +rbx.platform.typedef.__fixpt_t = uint +rbx.platform.typedef.__gid_t = uint +rbx.platform.typedef.__id_t = uint +rbx.platform.typedef.__in_addr_t = uint +rbx.platform.typedef.__in_port_t = ushort +rbx.platform.typedef.__ino_t = uint +rbx.platform.typedef.__key_t = long +rbx.platform.typedef.__mode_t = uint +rbx.platform.typedef.__nlink_t = uint +rbx.platform.typedef.__pid_t = int +rbx.platform.typedef.__rlim_t = ulong_long +rbx.platform.typedef.__sa_family_t = uchar +rbx.platform.typedef.__segsz_t = int +rbx.platform.typedef.__socklen_t = uint +rbx.platform.typedef.__swblk_t = int +rbx.platform.typedef.__uid_t = uint +rbx.platform.typedef.__useconds_t = uint +rbx.platform.typedef.__suseconds_t = int +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.unchar = uchar +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.cpuid_t = ulong +rbx.platform.typedef.register_t = int +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.uint8_t = uchar +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.uint16_t = ushort +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.uint32_t = uint +rbx.platform.typedef.int64_t = long_long +rbx.platform.typedef.uint64_t = ulong_long +rbx.platform.typedef.intptr_t = long +rbx.platform.typedef.uintptr_t = ulong +rbx.platform.typedef.u_int8_t = uchar +rbx.platform.typedef.u_int16_t = ushort +rbx.platform.typedef.u_int32_t = uint +rbx.platform.typedef.u_int64_t = ulong_long +rbx.platform.typedef.quad_t = long_long +rbx.platform.typedef.u_quad_t = ulong_long +rbx.platform.typedef.qaddr_t = pointer +rbx.platform.typedef.vaddr_t = ulong +rbx.platform.typedef.paddr_t = ulong +rbx.platform.typedef.vsize_t = ulong +rbx.platform.typedef.psize_t = ulong +rbx.platform.typedef.caddr_t = string +rbx.platform.typedef.daddr_t = int +rbx.platform.typedef.daddr32_t = int +rbx.platform.typedef.daddr64_t = long_long +rbx.platform.typedef.dev_t = int +rbx.platform.typedef.fixpt_t = uint +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.id_t = uint +rbx.platform.typedef.ino_t = uint +rbx.platform.typedef.key_t = long +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.nlink_t = uint +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.rlim_t = ulong_long +rbx.platform.typedef.segsz_t = int +rbx.platform.typedef.swblk_t = int +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.useconds_t = uint +rbx.platform.typedef.suseconds_t = int +rbx.platform.typedef.in_addr_t = uint +rbx.platform.typedef.in_port_t = ushort +rbx.platform.typedef.sa_family_t = uchar +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.clock_t = int +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.size_t = ulong +rbx.platform.typedef.ssize_t = long +rbx.platform.typedef.time_t = int +rbx.platform.typedef.timer_t = int +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.__fd_mask = int diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-solaris/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-solaris/types.conf new file mode 100644 index 000000000..f461b7ec9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-solaris/types.conf @@ -0,0 +1,122 @@ +rbx.platform.typedef.lock_t = uchar +rbx.platform.typedef.int8_t = char +rbx.platform.typedef.int16_t = short +rbx.platform.typedef.int32_t = int +rbx.platform.typedef.int64_t = long +rbx.platform.typedef.uint8_t = uchar +rbx.platform.typedef.uint16_t = ushort +rbx.platform.typedef.uint32_t = uint +rbx.platform.typedef.uint64_t = ulong +rbx.platform.typedef.intmax_t = long +rbx.platform.typedef.uintmax_t = ulong +rbx.platform.typedef.intptr_t = long +rbx.platform.typedef.uintptr_t = ulong +rbx.platform.typedef.int_fast8_t = char +rbx.platform.typedef.int_fast16_t = int +rbx.platform.typedef.int_fast32_t = int +rbx.platform.typedef.int_fast64_t = long +rbx.platform.typedef.uint_fast8_t = uchar +rbx.platform.typedef.uint_fast16_t = uint +rbx.platform.typedef.uint_fast32_t = uint +rbx.platform.typedef.uint_fast64_t = ulong +rbx.platform.typedef.int_least8_t = char +rbx.platform.typedef.int_least16_t = short +rbx.platform.typedef.int_least32_t = int +rbx.platform.typedef.int_least64_t = long +rbx.platform.typedef.uint_least8_t = uchar +rbx.platform.typedef.uint_least16_t = ushort +rbx.platform.typedef.uint_least32_t = uint +rbx.platform.typedef.uint_least64_t = ulong +rbx.platform.typedef.longlong_t = long_long +rbx.platform.typedef.u_longlong_t = ulong_long +rbx.platform.typedef.t_scalar_t = int +rbx.platform.typedef.t_uscalar_t = uint +rbx.platform.typedef.uchar_t = uchar +rbx.platform.typedef.ushort_t = ushort +rbx.platform.typedef.uint_t = uint +rbx.platform.typedef.ulong_t = ulong +rbx.platform.typedef.*caddr_t = char +rbx.platform.typedef.daddr_t = long +rbx.platform.typedef.cnt_t = short +rbx.platform.typedef.ptrdiff_t = long +rbx.platform.typedef.pfn_t = ulong +rbx.platform.typedef.pgcnt_t = ulong +rbx.platform.typedef.spgcnt_t = long +rbx.platform.typedef.use_t = uchar +rbx.platform.typedef.sysid_t = short +rbx.platform.typedef.index_t = short +rbx.platform.typedef.off_t = long +rbx.platform.typedef.off64_t = long +rbx.platform.typedef.ino_t = ulong +rbx.platform.typedef.blkcnt_t = long +rbx.platform.typedef.fsblkcnt_t = ulong +rbx.platform.typedef.fsfilcnt_t = ulong +rbx.platform.typedef.ino64_t = ulong +rbx.platform.typedef.blkcnt64_t = long +rbx.platform.typedef.fsblkcnt64_t = ulong +rbx.platform.typedef.fsfilcnt64_t = ulong +rbx.platform.typedef.blksize_t = int +rbx.platform.typedef.pad64_t = long +rbx.platform.typedef.upad64_t = ulong +rbx.platform.typedef.offset_t = long_long +rbx.platform.typedef.u_offset_t = ulong_long +rbx.platform.typedef.len_t = ulong_long +rbx.platform.typedef.diskaddr_t = ulong_long +rbx.platform.typedef.k_fltset_t = uint +rbx.platform.typedef.id_t = int +rbx.platform.typedef.lgrp_id_t = int +rbx.platform.typedef.useconds_t = uint +rbx.platform.typedef.suseconds_t = long +rbx.platform.typedef.major_t = uint +rbx.platform.typedef.minor_t = uint +rbx.platform.typedef.pri_t = short +rbx.platform.typedef.cpu_flag_t = ushort +rbx.platform.typedef.o_mode_t = ushort +rbx.platform.typedef.o_dev_t = short +rbx.platform.typedef.o_uid_t = ushort +rbx.platform.typedef.o_gid_t = ushort +rbx.platform.typedef.o_nlink_t = short +rbx.platform.typedef.o_pid_t = short +rbx.platform.typedef.o_ino_t = ushort +rbx.platform.typedef.key_t = int +rbx.platform.typedef.mode_t = uint +rbx.platform.typedef.uid_t = uint +rbx.platform.typedef.gid_t = uint +rbx.platform.typedef.datalink_id_t = uint +rbx.platform.typedef.taskid_t = int +rbx.platform.typedef.projid_t = int +rbx.platform.typedef.poolid_t = int +rbx.platform.typedef.zoneid_t = int +rbx.platform.typedef.ctid_t = int +rbx.platform.typedef.pthread_t = uint +rbx.platform.typedef.pthread_key_t = uint +rbx.platform.typedef.dev_t = ulong +rbx.platform.typedef.nlink_t = uint +rbx.platform.typedef.pid_t = int +rbx.platform.typedef.size_t = ulong +rbx.platform.typedef.ssize_t = long +rbx.platform.typedef.time_t = long +rbx.platform.typedef.clock_t = long +rbx.platform.typedef.clockid_t = int +rbx.platform.typedef.timer_t = int +rbx.platform.typedef.unchar = uchar +rbx.platform.typedef.ushort = ushort +rbx.platform.typedef.uint = uint +rbx.platform.typedef.ulong = ulong +rbx.platform.typedef.u_char = uchar +rbx.platform.typedef.u_short = ushort +rbx.platform.typedef.u_int = uint +rbx.platform.typedef.u_long = ulong +rbx.platform.typedef.hrtime_t = long_long +rbx.platform.typedef.fd_mask = long +rbx.platform.typedef.fds_mask = long +rbx.platform.typedef.sa_family_t = ushort +rbx.platform.typedef.socklen_t = uint +rbx.platform.typedef.nfds_t = ulong +rbx.platform.typedef.disp_lock_t = uchar +rbx.platform.typedef.model_t = uint +rbx.platform.typedef.in_port_t = ushort +rbx.platform.typedef.in_addr_t = uint +rbx.platform.typedef.ipaddr_t = uint +rbx.platform.typedef.rlim_t = ulong +rbx.platform.typedef.rlim64_t = ulong_long diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-windows/types.conf b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-windows/types.conf new file mode 100644 index 000000000..0909c19a9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/platform/x86_64-windows/types.conf @@ -0,0 +1,27 @@ +rbx.platform.typedef.size_t = ulong_long +rbx.platform.typedef.ssize_t = long_long +rbx.platform.typedef.intptr_t = long_long +rbx.platform.typedef.uintptr_t = ulong_long +rbx.platform.typedef.ptrdiff_t = long_long +rbx.platform.typedef.wchar_t = ushort +rbx.platform.typedef.wint_t = ushort +rbx.platform.typedef.wctype_t = ushort +rbx.platform.typedef.errno_t = int +rbx.platform.typedef.__time32_t = long +rbx.platform.typedef.__time64_t = long_long +rbx.platform.typedef.time_t = long_long +rbx.platform.typedef._ino_t = ushort +rbx.platform.typedef.ino_t = ushort +rbx.platform.typedef._dev_t = uint +rbx.platform.typedef.dev_t = uint +rbx.platform.typedef._pid_t = long_long +rbx.platform.typedef.pid_t = long_long +rbx.platform.typedef._mode_t = ushort +rbx.platform.typedef.mode_t = ushort +rbx.platform.typedef._off_t = long +rbx.platform.typedef.off32_t = long +rbx.platform.typedef._off64_t = long_long +rbx.platform.typedef.off64_t = long_long +rbx.platform.typedef.off_t = long_long +rbx.platform.typedef.useconds_t = uint +rbx.platform.typedef._sigset_t = ulong_long diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/pointer.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/pointer.rb new file mode 100644 index 000000000..fec767197 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/pointer.rb @@ -0,0 +1,134 @@ +# +# Copyright (C) 2008, 2009 Wayne Meissner +# Copyright (c) 2007, 2008 Evan Phoenix +# +# This file is part of ruby-ffi. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Ruby FFI project nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +require 'ffi/platform' +module FFI + class Pointer + + # Pointer size + SIZE = Platform::ADDRESS_SIZE / 8 + + # Return the size of a pointer on the current platform, in bytes + # @return [Numeric] + def self.size + SIZE + end + + # @param [nil,Numeric] len length of string to return + # @return [String] + # Read pointer's contents as a string, or the first +len+ bytes of the + # equivalent string if +len+ is not +nil+. + def read_string(len=nil) + if len + get_bytes(0, len) + else + get_string(0) + end + end + + # @param [Numeric] len length of string to return + # @return [String] + # Read the first +len+ bytes of pointer's contents as a string. + # + # Same as: + # ptr.read_string(len) # with len not nil + def read_string_length(len) + get_bytes(0, len) + end + + # @return [String] + # Read pointer's contents as a string. + # + # Same as: + # ptr.read_string # with no len + def read_string_to_null + get_string(0) + end + + # @param [String] str string to write + # @param [Numeric] len length of string to return + # @return [self] + # Write +len+ first bytes of +str+ in pointer's contents. + # + # Same as: + # ptr.write_string(str, len) # with len not nil + def write_string_length(str, len) + put_bytes(0, str, 0, len) + end + + # @param [String] str string to write + # @param [Numeric] len length of string to return + # @return [self] + # Write +str+ in pointer's contents, or first +len+ bytes if + # +len+ is not +nil+. + def write_string(str, len=nil) + len = str.bytesize unless len + # Write the string data without NUL termination + put_bytes(0, str, 0, len) + end + + # @param [Type] type type of data to read from pointer's contents + # @param [Symbol] reader method to send to +self+ to read +type+ + # @param [Numeric] length + # @return [Array] + # Read an array of +type+ of length +length+. + # @example + # ptr.read_array_of_type(TYPE_UINT8, :get_uint8, 4) # -> [1, 2, 3, 4] + def read_array_of_type(type, reader, length) + ary = [] + size = FFI.type_size(type) + tmp = self + length.times { |j| + ary << tmp.send(reader) + tmp += size unless j == length-1 # avoid OOB + } + ary + end + + # @param [Type] type type of data to write to pointer's contents + # @param [Symbol] writer method to send to +self+ to write +type+ + # @param [Array] ary + # @return [self] + # Write +ary+ in pointer's contents as +type+. + # @example + # ptr.write_array_of_type(TYPE_UINT8, :put_uint8, [1, 2, 3 ,4]) + def write_array_of_type(type, writer, ary) + size = FFI.type_size(type) + tmp = self + ary.each_with_index {|i, j| + tmp.send(writer, i) + tmp += size unless j == ary.length-1 # avoid OOB + } + self + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/struct.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/struct.rb new file mode 100644 index 000000000..89231ba8c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/struct.rb @@ -0,0 +1,373 @@ +# +# Copyright (C) 2008-2010 Wayne Meissner +# Copyright (C) 2008, 2009 Andrea Fazzi +# Copyright (C) 2008, 2009 Luc Heinrich +# +# This file is part of ruby-ffi. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Ruby FFI project nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +require 'ffi/platform' +require 'ffi/struct_layout_builder' + +module FFI + + class StructLayout + + # @return [Array + # Get an array of tuples (field name, offset of the field). + def offsets + members.map { |m| [ m, self[m].offset ] } + end + + # @return [Numeric] + # Get the offset of a field. + def offset_of(field_name) + self[field_name].offset + end + + # An enum {Field} in a {StructLayout}. + class Enum < Field + + # @param [AbstractMemory] ptr pointer on a {Struct} + # @return [Object] + # Get an object of type {#type} from memory pointed by +ptr+. + def get(ptr) + type.find(ptr.get_int(offset)) + end + + # @param [AbstractMemory] ptr pointer on a {Struct} + # @param value + # @return [nil] + # Set +value+ into memory pointed by +ptr+. + def put(ptr, value) + ptr.put_int(offset, type.find(value)) + end + + end + + class InnerStruct < Field + def get(ptr) + type.struct_class.new(ptr.slice(self.offset, self.size)) + end + + def put(ptr, value) + raise TypeError, "wrong value type (expected #{type.struct_class})" unless value.is_a?(type.struct_class) + ptr.slice(self.offset, self.size).__copy_from__(value.pointer, self.size) + end + end + + class Mapped < Field + def initialize(name, offset, type, orig_field) + super(name, offset, type) + @orig_field = orig_field + end + + def get(ptr) + type.from_native(@orig_field.get(ptr), nil) + end + + def put(ptr, value) + @orig_field.put(ptr, type.to_native(value, nil)) + end + end + end + + + class Struct + + # Get struct size + # @return [Numeric] + def size + self.class.size + end + + # @return [Fixnum] Struct alignment + def alignment + self.class.alignment + end + alias_method :align, :alignment + + # (see FFI::StructLayout#offset_of) + def offset_of(name) + self.class.offset_of(name) + end + + # (see FFI::StructLayout#members) + def members + self.class.members + end + + # @return [Array] + # Get array of values from Struct fields. + def values + members.map { |m| self[m] } + end + + # (see FFI::StructLayout#offsets) + def offsets + self.class.offsets + end + + # Clear the struct content. + # @return [self] + def clear + pointer.clear + self + end + + # Get {Pointer} to struct content. + # @return [AbstractMemory] + def to_ptr + pointer + end + + # Get struct size + # @return [Numeric] + def self.size + defined?(@layout) ? @layout.size : defined?(@size) ? @size : 0 + end + + # set struct size + # @param [Numeric] size + # @return [size] + def self.size=(size) + raise ArgumentError, "Size already set" if defined?(@size) || defined?(@layout) + @size = size + end + + # @return (see Struct#alignment) + def self.alignment + @layout.alignment + end + + # (see FFI::Type#members) + def self.members + @layout.members + end + + # (see FFI::StructLayout#offsets) + def self.offsets + @layout.offsets + end + + # (see FFI::StructLayout#offset_of) + def self.offset_of(name) + @layout.offset_of(name) + end + + def self.in + ptr(:in) + end + + def self.out + ptr(:out) + end + + def self.ptr(flags = :inout) + @ref_data_type ||= Type::Mapped.new(StructByReference.new(self)) + end + + def self.val + @val_data_type ||= StructByValue.new(self) + end + + def self.by_value + self.val + end + + def self.by_ref(flags = :inout) + self.ptr(flags) + end + + class ManagedStructConverter < StructByReference + + # @param [Struct] struct_class + def initialize(struct_class) + super(struct_class) + + raise NoMethodError, "release() not implemented for class #{struct_class}" unless struct_class.respond_to? :release + @method = struct_class.method(:release) + end + + # @param [Pointer] ptr + # @param [nil] ctx + # @return [Struct] + def from_native(ptr, ctx) + struct_class.new(AutoPointer.new(ptr, @method)) + end + end + + def self.auto_ptr + @managed_type ||= Type::Mapped.new(ManagedStructConverter.new(self)) + end + + + class << self + public + + # @return [StructLayout] + # @overload layout + # @return [StructLayout] + # Get struct layout. + # @overload layout(*spec) + # @param [Array,Array(Hash)] spec + # @return [StructLayout] + # Create struct layout from +spec+. + # @example Creating a layout from an array +spec+ + # class MyStruct < Struct + # layout :field1, :int, + # :field2, :pointer, + # :field3, :string + # end + # @example Creating a layout from an array +spec+ with offset + # class MyStructWithOffset < Struct + # layout :field1, :int, + # :field2, :pointer, 6, # set offset to 6 for this field + # :field3, :string + # end + # @example Creating a layout from a hash +spec+ (Ruby 1.9 only) + # class MyStructFromHash < Struct + # layout :field1 => :int, + # :field2 => :pointer, + # :field3 => :string + # end + # @example Creating a layout with pointers to functions + # class MyFunctionTable < Struct + # layout :function1, callback([:int, :int], :int), + # :function2, callback([:pointer], :void), + # :field3, :string + # end + # @note Creating a layout from a hash +spec+ is supported only for Ruby 1.9. + def layout(*spec) + #raise RuntimeError, "struct layout already defined for #{self.inspect}" if defined?(@layout) + return @layout if spec.size == 0 + + builder = StructLayoutBuilder.new + builder.union = self < Union + builder.packed = @packed if defined?(@packed) + builder.alignment = @min_alignment if defined?(@min_alignment) + + if spec[0].kind_of?(Hash) + hash_layout(builder, spec) + else + array_layout(builder, spec) + end + builder.size = @size if defined?(@size) && @size > builder.size + cspec = builder.build + @layout = cspec unless self == Struct + @size = cspec.size + return cspec + end + + + protected + + def callback(params, ret) + mod = enclosing_module + FFI::CallbackInfo.new(find_type(ret, mod), params.map { |e| find_type(e, mod) }) + end + + def packed(packed = 1) + @packed = packed + end + alias :pack :packed + + def aligned(alignment = 1) + @min_alignment = alignment + end + alias :align :aligned + + def enclosing_module + begin + mod = self.name.split("::")[0..-2].inject(Object) { |obj, c| obj.const_get(c) } + (mod < FFI::Library || mod < FFI::Struct || mod.respond_to?(:find_type)) ? mod : nil + rescue Exception + nil + end + end + + + def find_field_type(type, mod = enclosing_module) + if type.kind_of?(Class) && type < Struct + FFI::Type::Struct.new(type) + + elsif type.kind_of?(Class) && type < FFI::StructLayout::Field + type + + elsif type.kind_of?(::Array) + FFI::Type::Array.new(find_field_type(type[0]), type[1]) + + else + find_type(type, mod) + end + end + + def find_type(type, mod = enclosing_module) + if mod + mod.find_type(type) + end || FFI.find_type(type) + end + + private + + # @param [StructLayoutBuilder] builder + # @param [Hash] spec + # @return [builder] + # @raise if Ruby 1.8 + # Add hash +spec+ to +builder+. + def hash_layout(builder, spec) + raise "Ruby version not supported" if RUBY_VERSION =~ /1\.8\.*/ + spec[0].each do |name, type| + builder.add name, find_field_type(type), nil + end + end + + # @param [StructLayoutBuilder] builder + # @param [Array] spec + # @return [builder] + # Add array +spec+ to +builder+. + def array_layout(builder, spec) + i = 0 + while i < spec.size + name, type = spec[i, 2] + i += 2 + + # If the next param is a Integer, it specifies the offset + if spec[i].kind_of?(Integer) + offset = spec[i] + i += 1 + else + offset = nil + end + + builder.add name, find_field_type(type), offset + end + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/struct_layout_builder.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/struct_layout_builder.rb new file mode 100644 index 000000000..918c79033 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/struct_layout_builder.rb @@ -0,0 +1,227 @@ +# +# Copyright (C) 2008-2010 Wayne Meissner +# +# This file is part of ruby-ffi. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Ruby FFI project nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +module FFI + + # Build a {StructLayout struct layout}. + class StructLayoutBuilder + attr_reader :size + attr_reader :alignment + + def initialize + @size = 0 + @alignment = 1 + @min_alignment = 1 + @packed = false + @union = false + @fields = Array.new + end + + # Set size attribute with +size+ only if +size+ is greater than attribute value. + # @param [Numeric] size + def size=(size) + @size = size if size > @size + end + + # Set alignment attribute with +align+ only if it is greater than attribute value. + # @param [Numeric] align + def alignment=(align) + @alignment = align if align > @alignment + @min_alignment = align + end + + # Set union attribute. + # Set to +true+ to build a {Union} instead of a {Struct}. + # @param [Boolean] is_union + # @return [is_union] + def union=(is_union) + @union = is_union + end + + # Building a {Union} or a {Struct} ? + # + # @return [Boolean] + # + def union? + @union + end + + # Set packed attribute + # @overload packed=(packed) Set alignment and packed attributes to + # +packed+. + # + # @param [Fixnum] packed + # + # @return [packed] + # @overload packed=(packed) Set packed attribute. + # @param packed + # + # @return [0,1] + # + def packed=(packed) + if packed.is_a?(Fixnum) + @alignment = packed + @packed = packed + else + @packed = packed ? 1 : 0 + end + end + + + # List of number types + NUMBER_TYPES = [ + Type::INT8, + Type::UINT8, + Type::INT16, + Type::UINT16, + Type::INT32, + Type::UINT32, + Type::LONG, + Type::ULONG, + Type::INT64, + Type::UINT64, + Type::FLOAT32, + Type::FLOAT64, + Type::LONGDOUBLE, + Type::BOOL, + ] + + # @param [String, Symbol] name name of the field + # @param [Array, DataConverter, Struct, StructLayout::Field, Symbol, Type] type type of the field + # @param [Numeric, nil] offset + # @return [self] + # Add a field to the builder. + # @note Setting +offset+ to +nil+ or +-1+ is equivalent to +0+. + def add(name, type, offset = nil) + + if offset.nil? || offset == -1 + offset = @union ? 0 : align(@size, @packed ? [ @packed, type.alignment ].min : [ @min_alignment, type.alignment ].max) + end + + # + # If a FFI::Type type was passed in as the field arg, try and convert to a StructLayout::Field instance + # + field = type.is_a?(StructLayout::Field) ? type : field_for_type(name, offset, type) + @fields << field + @alignment = [ @alignment, field.alignment ].max unless @packed + @size = [ @size, field.size + (@union ? 0 : field.offset) ].max + + return self + end + + # @param (see #add) + # @return (see #add) + # Same as {#add}. + # @see #add + def add_field(name, type, offset = nil) + add(name, type, offset) + end + + # @param (see #add) + # @return (see #add) + # Add a struct as a field to the builder. + def add_struct(name, type, offset = nil) + add(name, Type::Struct.new(type), offset) + end + + # @param name (see #add) + # @param type (see #add) + # @param [Numeric] count array length + # @param offset (see #add) + # @return (see #add) + # Add an array as a field to the builder. + def add_array(name, type, count, offset = nil) + add(name, Type::Array.new(type, count), offset) + end + + # @return [StructLayout] + # Build and return the struct layout. + def build + # Add tail padding if the struct is not packed + size = @packed ? @size : align(@size, @alignment) + + layout = StructLayout.new(@fields, size, @alignment) + layout.__union! if @union + layout + end + + private + + # @param [Numeric] offset + # @param [Numeric] align + # @return [Numeric] + def align(offset, align) + align + ((offset - 1) & ~(align - 1)); + end + + # @param (see #add) + # @return [StructLayout::Field] + def field_for_type(name, offset, type) + field_class = case + when type.is_a?(Type::Function) + StructLayout::Function + + when type.is_a?(Type::Struct) + StructLayout::InnerStruct + + when type.is_a?(Type::Array) + StructLayout::Array + + when type.is_a?(FFI::Enum) + StructLayout::Enum + + when NUMBER_TYPES.include?(type) + StructLayout::Number + + when type == Type::POINTER + StructLayout::Pointer + + when type == Type::STRING + StructLayout::String + + when type.is_a?(Class) && type < StructLayout::Field + type + + when type.is_a?(DataConverter) + return StructLayout::Mapped.new(name, offset, Type::Mapped.new(type), field_for_type(name, offset, type.native_type)) + + when type.is_a?(Type::Mapped) + return StructLayout::Mapped.new(name, offset, type, field_for_type(name, offset, type.native_type)) + + else + raise TypeError, "invalid struct field type #{type.inspect}" + end + + field_class.new(name, offset, type) + end + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/tools/const_generator.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/tools/const_generator.rb new file mode 100644 index 000000000..dfc622e69 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/tools/const_generator.rb @@ -0,0 +1,229 @@ +require 'tempfile' +require 'open3' + +module FFI + + # ConstGenerator turns C constants into ruby values. + # + # @example a simple example for stdio + # cg = FFI::ConstGenerator.new('stdio') do |gen| + # gen.const(:SEEK_SET) + # gen.const('SEEK_CUR') + # gen.const('seek_end') # this constant does not exist + # end # #calculate called automatically at the end of the block + # + # cg['SEEK_SET'] # => 0 + # cg['SEEK_CUR'] # => 1 + # cg['seek_end'] # => nil + # cg.to_ruby # => "SEEK_SET = 0\nSEEK_CUR = 1\n# seek_end not available" + class ConstGenerator + @options = {} + attr_reader :constants + + # Creates a new constant generator that uses +prefix+ as a name, and an + # options hash. + # + # The only option is +:required+, which if set to +true+ raises an error if a + # constant you have requested was not found. + # + # @param [#to_s] prefix + # @param [Hash] options + # @return + # @option options [Boolean] :required + # @overload initialize(prefix, options) + # @overload initialize(prefix, options) { |gen| ... } + # @yieldparam [ConstGenerator] gen new generator is passed to the block + # When passed a block, {#calculate} is automatically called at the end of + # the block, otherwise you must call it yourself. + def initialize(prefix = nil, options = {}) + @includes = ['stdio.h', 'stddef.h'] + @constants = {} + @prefix = prefix + + @required = options[:required] + @options = options + + if block_given? then + yield self + calculate self.class.options.merge(options) + end + end + # Set class options + # These options are merged with {#initialize} options when it is called with a block. + # @param [Hash] options + # @return [Hash] class options + def self.options=(options) + @options = options + end + # Get class options. + # @return [Hash] class options + def self.options + @options + end + # @param [String] name + # @return constant value (converted if a +converter+ was defined). + # Access a constant by name. + def [](name) + @constants[name].converted_value + end + + # Request the value for C constant +name+. + # + # @param [#to_s] name C constant name + # @param [String] format a printf format string to print the value out + # @param [String] cast a C cast for the value + # @param ruby_name alternate ruby name for {#to_ruby} + # + # @overload const(name, format=nil, cast='', ruby_name=nil, converter=nil) + # +converter+ is a Method or a Proc. + # @param [#call] converter convert the value from a string to the appropriate + # type for {#to_ruby}. + # @overload const(name, format=nil, cast='', ruby_name=nil) { |value| ... } + # Use a converter block. This block convert the value from a string to the + # appropriate type for {#to_ruby}. + # @yieldparam value constant value + def const(name, format = nil, cast = '', ruby_name = nil, converter = nil, + &converter_proc) + format ||= '%d' + cast ||= '' + + if converter_proc and converter then + raise ArgumentError, "Supply only converter or converter block" + end + + converter = converter_proc if converter.nil? + + const = Constant.new name, format, cast, ruby_name, converter + @constants[name.to_s] = const + return const + end + + # Calculate constants values. + # @param [Hash] options + # @option options [String] :cppflags flags for C compiler + # @return [nil] + # @raise if a constant is missing and +:required+ was set to +true+ (see {#initialize}) + def calculate(options = {}) + binary = File.join Dir.tmpdir, "rb_const_gen_bin_#{Process.pid}" + + Tempfile.open("#{@prefix}.const_generator") do |f| + @includes.each do |inc| + f.puts "#include <#{inc}>" + end + f.puts "\nint main(int argc, char **argv)\n{" + + @constants.each_value do |const| + f.puts <<-EOF + #ifdef #{const.name} + printf("#{const.name} #{const.format}\\n", #{const.cast}#{const.name}); + #endif + EOF + end + + f.puts "\n\treturn 0;\n}" + f.flush + + output = `gcc #{options[:cppflags]} -D_DARWIN_USE_64_BIT_INODE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -x c -Wall -Werror #{f.path} -o #{binary} 2>&1` + + unless $?.success? then + output = output.split("\n").map { |l| "\t#{l}" }.join "\n" + raise "Compilation error generating constants #{@prefix}:\n#{output}" + end + end + + output = `#{binary}` + File.unlink(binary + (FFI::Platform.windows? ? ".exe" : "")) + output.each_line do |line| + line =~ /^(\S+)\s(.*)$/ + const = @constants[$1] + const.value = $2 + end + + missing_constants = @constants.select do |name, constant| + constant.value.nil? + end.map { |name,| name } + + if @required and not missing_constants.empty? then + raise "Missing required constants for #{@prefix}: #{missing_constants.join ', '}" + end + end + + # Dump constants to +io+. + # @param [#puts] io + # @return [nil] + def dump_constants(io) + @constants.each do |name, constant| + name = [@prefix, name].join '.' if @prefix + io.puts "#{name} = #{constant.converted_value}" + end + end + + # Outputs values for discovered constants. If the constant's value was + # not discovered it is not omitted. + # @return [String] + def to_ruby + @constants.sort_by { |name,| name }.map do |name, constant| + if constant.value.nil? then + "# #{name} not available" + else + constant.to_ruby + end + end.join "\n" + end + + # Add additional C include file(s) to calculate constants from. + # @note +stdio.h+ and +stddef.h+ automatically included + # @param [List, Array] i include file(s) + # @return [Array] array of include files + def include(*i) + @includes |= i.flatten + end + + end + + # This class hold constants for {ConstGenerator} + class ConstGenerator::Constant + + attr_reader :name, :format, :cast + attr_accessor :value + + # @param [#to_s] name + # @param [String] format a printf format string to print the value out + # @param [String] cast a C cast for the value + # @param ruby_name alternate ruby name for {#to_ruby} + # @param [#call] converter convert the value from a string to the appropriate + # type for {#to_ruby}. + def initialize(name, format, cast, ruby_name = nil, converter=nil) + @name = name + @format = format + @cast = cast + @ruby_name = ruby_name + @converter = converter + @value = nil + end + + # Return constant value (converted if a +converter+ was defined). + # @return constant value. + def converted_value + if @converter + @converter.call(@value) + else + @value + end + end + + # get constant ruby name + # @return [String] + def ruby_name + @ruby_name || @name + end + + # Get an evaluable string from constant. + # @return [String] + def to_ruby + "#{ruby_name} = #{converted_value}" + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/tools/generator.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/tools/generator.rb new file mode 100644 index 000000000..29b59e114 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/tools/generator.rb @@ -0,0 +1,60 @@ +module FFI + + # @private + class Generator + + def initialize(ffi_name, rb_name, options = {}) + @ffi_name = ffi_name + @rb_name = rb_name + @options = options + @name = File.basename rb_name, '.rb' + + file = File.read @ffi_name + + new_file = file.gsub(/^( *)@@@(.*?)@@@/m) do + @constants = [] + @structs = [] + + indent = $1 + original_lines = $2.count "\n" + + instance_eval $2, @ffi_name, $`.count("\n") + + new_lines = [] + @constants.each { |c| new_lines << c.to_ruby } + @structs.each { |s| new_lines << s.generate_layout } + + new_lines = new_lines.join("\n").split "\n" # expand multiline blocks + new_lines = new_lines.map { |line| indent + line } + + padding = original_lines - new_lines.length + new_lines += [nil] * padding if padding >= 0 + + new_lines.join "\n" + end + + open @rb_name, 'w' do |f| + f.puts "# This file is generated by rake. Do not edit." + f.puts + f.puts new_file + end + end + + def constants(options = {}, &block) + @constants << FFI::ConstGenerator.new(@name, @options.merge(options), &block) + end + + def struct(options = {}, &block) + @structs << FFI::StructGenerator.new(@name, @options.merge(options), &block) + end + + ## + # Utility converter for constants + + def to_s + proc { |obj| obj.to_s.inspect } + end + + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/tools/generator_task.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/tools/generator_task.rb new file mode 100644 index 000000000..9e3951932 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/tools/generator_task.rb @@ -0,0 +1,36 @@ +begin + require 'ffi/struct_generator' + require 'ffi/const_generator' + require 'ffi/generator' +rescue LoadError + # from Rakefile + require 'lib/ffi/struct_generator' + require 'lib/ffi/const_generator' + require 'lib/ffi/generator' +end + +require 'rake' +require 'rake/tasklib' +require 'tempfile' + +## +# Rake task that calculates C structs for FFI::Struct. + +# @private +class FFI::Generator::Task < Rake::TaskLib + + def initialize(rb_names) + task :clean do rm_f rb_names end + + rb_names.each do |rb_name| + ffi_name = "#{rb_name}.ffi" + + file rb_name => ffi_name do |t| + puts "Generating #{rb_name}..." if Rake.application.options.trace + + FFI::Generator.new ffi_name, rb_name + end + end + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/tools/struct_generator.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/tools/struct_generator.rb new file mode 100644 index 000000000..e892e6535 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/tools/struct_generator.rb @@ -0,0 +1,194 @@ +require 'tempfile' + +module FFI + + ## + # Generates an FFI Struct layout. + # + # Given the @@@ portion in: + # + # module Zlib::ZStream < FFI::Struct + # @@@ + # name "struct z_stream_s" + # include "zlib.h" + # + # field :next_in, :pointer + # field :avail_in, :uint + # field :total_in, :ulong + # + # # ... + # @@@ + # end + # + # StructGenerator will create the layout: + # + # layout :next_in, :pointer, 0, + # :avail_in, :uint, 4, + # :total_in, :ulong, 8, + # # ... + # + # StructGenerator does its best to pad the layout it produces to preserve + # line numbers. Place the struct definition as close to the top of the file + # for best results. + + class StructGenerator + @options = {} + attr_accessor :size + attr_reader :fields + + def initialize(name, options = {}) + @name = name + @struct_name = nil + @includes = [] + @fields = [] + @found = false + @size = nil + + if block_given? then + yield self + calculate self.class.options.merge(options) + end + end + def self.options=(options) + @options = options + end + def self.options + @options + end + def calculate(options = {}) + binary = File.join Dir.tmpdir, "rb_struct_gen_bin_#{Process.pid}" + + raise "struct name not set" if @struct_name.nil? + + Tempfile.open("#{@name}.struct_generator") do |f| + f.puts "#include " + + @includes.each do |inc| + f.puts "#include <#{inc}>" + end + + f.puts "#include \n\n" + f.puts "int main(int argc, char **argv)\n{" + f.puts " #{@struct_name} s;" + f.puts %[ printf("sizeof(#{@struct_name}) %u\\n", (unsigned int) sizeof(#{@struct_name}));] + + @fields.each do |field| + f.puts <<-EOF + printf("#{field.name} %u %u\\n", (unsigned int) offsetof(#{@struct_name}, #{field.name}), + (unsigned int) sizeof(s.#{field.name})); + EOF + end + + f.puts "\n return 0;\n}" + f.flush + + output = `gcc #{options[:cppflags]} #{options[:cflags]} -D_DARWIN_USE_64_BIT_INODE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -x c -Wall -Werror #{f.path} -o #{binary} 2>&1` + + unless $?.success? then + @found = false + output = output.split("\n").map { |l| "\t#{l}" }.join "\n" + raise "Compilation error generating struct #{@name} (#{@struct_name}):\n#{output}" + end + end + + output = `#{binary}`.split "\n" + File.unlink(binary + (FFI::Platform.windows? ? ".exe" : "")) + sizeof = output.shift + unless @size + m = /\s*sizeof\([^)]+\) (\d+)/.match sizeof + @size = m[1] + end + + line_no = 0 + output.each do |line| + md = line.match(/.+ (\d+) (\d+)/) + @fields[line_no].offset = md[1].to_i + @fields[line_no].size = md[2].to_i + + line_no += 1 + end + + @found = true + end + + def field(name, type=nil) + field = Field.new(name, type) + @fields << field + return field + end + + def found? + @found + end + + def dump_config(io) + io.puts "rbx.platform.#{@name}.sizeof = #{@size}" + + @fields.each { |field| io.puts field.to_config(@name) } + end + + def generate_layout + buf = "" + + @fields.each_with_index do |field, i| + if buf.empty? + buf << "layout :#{field.name}, :#{field.type}, #{field.offset}" + else + buf << " :#{field.name}, :#{field.type}, #{field.offset}" + end + + if i < @fields.length - 1 + buf << ",\n" + end + end + + buf + end + + def get_field(name) + @fields.find { |f| name == f.name } + end + + def include(i) + @includes << i + end + + def name(n) + @struct_name = n + end + + end + + ## + # A field in a Struct. + + class StructGenerator::Field + + attr_reader :name + attr_reader :type + attr_reader :offset + attr_accessor :size + + def initialize(name, type) + @name = name + @type = type + @offset = nil + @size = nil + end + + def offset=(o) + @offset = o + end + + def to_config(name) + buf = [] + buf << "rbx.platform.#{name}.#{@name}.offset = #{@offset}" + buf << "rbx.platform.#{name}.#{@name}.size = #{@size}" + buf << "rbx.platform.#{name}.#{@name}.type = #{@type}" if @type + buf + end + + end + +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/tools/types_generator.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/tools/types_generator.rb new file mode 100644 index 000000000..125a1a08d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/tools/types_generator.rb @@ -0,0 +1,135 @@ +require 'tempfile' + +module FFI + + # @private + class TypesGenerator + + ## + # Maps different C types to the C type representations we use + + TYPE_MAP = { + "char" => :char, + "signed char" => :char, + "__signed char" => :char, + "unsigned char" => :uchar, + + "short" => :short, + "signed short" => :short, + "signed short int" => :short, + "unsigned short" => :ushort, + "unsigned short int" => :ushort, + + "int" => :int, + "signed int" => :int, + "unsigned int" => :uint, + + "long" => :long, + "long int" => :long, + "signed long" => :long, + "signed long int" => :long, + "unsigned long" => :ulong, + "unsigned long int" => :ulong, + "long unsigned int" => :ulong, + + "long long" => :long_long, + "long long int" => :long_long, + "signed long long" => :long_long, + "signed long long int" => :long_long, + "unsigned long long" => :ulong_long, + "unsigned long long int" => :ulong_long, + + "char *" => :string, + "void *" => :pointer, + } + + def self.generate(options = {}) + typedefs = nil + Tempfile.open 'ffi_types_generator' do |io| + io.puts <<-C +#include +#if !(defined(WIN32)) +#include +#include +#endif + C + + io.close + cc = ENV['CC'] || 'gcc' + cmd = "#{cc} -E -x c #{options[:cppflags]} -D_DARWIN_USE_64_BIT_INODE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -c" + if options[:input] + typedefs = File.read(options[:input]) + elsif options[:remote] + typedefs = `ssh #{options[:remote]} #{cmd} - < #{io.path}` + else + typedefs = `#{cmd} #{io.path}` + end + end + + code = "" + + typedefs.each_line do |type| + # We only care about single line typedef + next unless type =~ /typedef/ + # Ignore unions or structs + next if type =~ /union|struct/ + + # strip off the starting typedef and ending ; + type.gsub!(/^(.*typedef\s*)/, "") + type.gsub!(/\s*;\s*$/, "") + + parts = type.split(/\s+/) + def_type = parts.join(" ") + + # GCC does mapping with __attribute__ stuf, also see + # http://hal.cs.berkeley.edu/cil/cil016.html section 16.2.7. Problem + # with this is that the __attribute__ stuff can either occur before or + # after the new type that is defined... + if type =~ /__attribute__/ + if parts.last =~ /__QI__|__HI__|__SI__|__DI__|__word__/ + + # In this case, the new type is BEFORE __attribute__ we need to + # find the final_type as the type before the part that starts with + # __attribute__ + final_type = "" + parts.each do |p| + break if p =~ /__attribute__/ + final_type = p + end + else + final_type = parts.pop + end + + def_type = case type + when /__QI__/ then "char" + when /__HI__/ then "short" + when /__SI__/ then "int" + when /__DI__/ then "long long" + when /__word__/ then "long" + else "int" + end + + def_type = "unsigned #{def_type}" if type =~ /unsigned/ + else + final_type = parts.pop + def_type = parts.join(" ") + end + + if type = TYPE_MAP[def_type] + code << "rbx.platform.typedef.#{final_type} = #{type}\n" + TYPE_MAP[final_type] = TYPE_MAP[def_type] + else + # Fallback to an ordinary pointer if we don't know the type + if def_type =~ /\*/ + code << "rbx.platform.typedef.#{final_type} = pointer\n" + TYPE_MAP[final_type] = :pointer + end + end + end + + code + end + + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/types.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/types.rb new file mode 100644 index 000000000..4e48a2c97 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/types.rb @@ -0,0 +1,190 @@ +# +# Copyright (C) 2008-2010 Wayne Meissner +# Copyright (c) 2007, 2008 Evan Phoenix +# +# This file is part of ruby-ffi. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Ruby FFI project nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +# see {file:README} +module FFI + + # @param [Type, DataConverter, Symbol] old type definition used by {FFI.find_type} + # @param [Symbol] add new type definition's name to add + # @return [Type] + # Add a definition type to type definitions. + def self.typedef(old, add) + TypeDefs[add] = self.find_type(old) + end + + # (see FFI.typedef) + def self.add_typedef(old, add) + typedef old, add + end + + + # @param [Type, DataConverter, Symbol] name + # @param [Hash] type_map if nil, {FFI::TypeDefs} is used + # @return [Type] + # Find a type in +type_map+ ({FFI::TypeDefs}, by default) from + # a type objet, a type name (symbol). If +name+ is a {DataConverter}, + # a new {Type::Mapped} is created. + def self.find_type(name, type_map = nil) + if name.is_a?(Type) + name + + elsif type_map && type_map.has_key?(name) + type_map[name] + + elsif TypeDefs.has_key?(name) + TypeDefs[name] + + elsif name.is_a?(DataConverter) + (type_map || TypeDefs)[name] = Type::Mapped.new(name) + + else + raise TypeError, "unable to resolve type '#{name}'" + end + end + + # List of type definitions + TypeDefs.merge!({ + # The C void type; only useful for function return types + :void => Type::VOID, + + # C boolean type + :bool => Type::BOOL, + + # C nul-terminated string + :string => Type::STRING, + + # C signed char + :char => Type::CHAR, + # C unsigned char + :uchar => Type::UCHAR, + + # C signed short + :short => Type::SHORT, + # C unsigned short + :ushort => Type::USHORT, + + # C signed int + :int => Type::INT, + # C unsigned int + :uint => Type::UINT, + + # C signed long + :long => Type::LONG, + + # C unsigned long + :ulong => Type::ULONG, + + # C signed long long integer + :long_long => Type::LONG_LONG, + + # C unsigned long long integer + :ulong_long => Type::ULONG_LONG, + + # C single precision float + :float => Type::FLOAT, + + # C double precision float + :double => Type::DOUBLE, + + # C long double + :long_double => Type::LONGDOUBLE, + + # Native memory address + :pointer => Type::POINTER, + + # 8 bit signed integer + :int8 => Type::INT8, + # 8 bit unsigned integer + :uint8 => Type::UINT8, + + # 16 bit signed integer + :int16 => Type::INT16, + # 16 bit unsigned integer + :uint16 => Type::UINT16, + + # 32 bit signed integer + :int32 => Type::INT32, + # 32 bit unsigned integer + :uint32 => Type::UINT32, + + # 64 bit signed integer + :int64 => Type::INT64, + # 64 bit unsigned integer + :uint64 => Type::UINT64, + + :buffer_in => Type::BUFFER_IN, + :buffer_out => Type::BUFFER_OUT, + :buffer_inout => Type::BUFFER_INOUT, + + # Used in function prototypes to indicate the arguments are variadic + :varargs => Type::VARARGS, + }) + + + class StrPtrConverter + extend DataConverter + native_type Type::POINTER + + # @param [Pointer] val + # @param ctx + # @return [Array(String, Pointer)] + # Returns a [ String, Pointer ] tuple so the C memory for the string can be freed + def self.from_native(val, ctx) + [ val.null? ? nil : val.get_string(0), val ] + end + + end + + typedef(StrPtrConverter, :strptr) + + # @param type +type+ is an instance of class accepted by {FFI.find_type} + # @return [Numeric] + # Get +type+ size, in bytes. + def self.type_size(type) + find_type(type).size + end + + # Load all the platform dependent types + begin + File.open(File.join(Platform::CONF_DIR, 'types.conf'), "r") do |f| + prefix = "rbx.platform.typedef." + f.each_line { |line| + if line.index(prefix) == 0 + new_type, orig_type = line.chomp.slice(prefix.length..-1).split(/\s*=\s*/) + typedef(orig_type.to_sym, new_type.to_sym) + end + } + end + typedef :pointer, :caddr_t + rescue Errno::ENOENT + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/union.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/union.rb new file mode 100644 index 000000000..38414ab95 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/union.rb @@ -0,0 +1,43 @@ +# +# Copyright (C) 2009 Andrea Fazzi +# +# This file is part of ruby-ffi. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Ruby FFI project nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +require 'ffi/struct' + +module FFI + + class Union < FFI::Struct + def self.builder + b = StructLayoutBuilder.new + b.union = true + b + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/variadic.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/variadic.rb new file mode 100644 index 000000000..24140556c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/variadic.rb @@ -0,0 +1,78 @@ +# +# Copyright (C) 2008, 2009 Wayne Meissner +# Copyright (C) 2009 Luc Heinrich +# +# This file is part of ruby-ffi. +# +# All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions are met: +# +# * Redistributions of source code must retain the above copyright notice, this +# list of conditions and the following disclaimer. +# * Redistributions in binary form must reproduce the above copyright notice +# this list of conditions and the following disclaimer in the documentation +# and/or other materials provided with the distribution. +# * Neither the name of the Ruby FFI project nor the names of its contributors +# may be used to endorse or promote products derived from this software +# without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +# DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE +# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# + +module FFI + class VariadicInvoker + def init(arg_types, type_map) + @fixed = Array.new + @type_map = type_map + arg_types.each_with_index do |type, i| + @fixed << type unless type == Type::VARARGS + end + end + + + def call(*args, &block) + param_types = Array.new(@fixed) + param_values = Array.new + @fixed.each_with_index do |t, i| + param_values << args[i] + end + i = @fixed.length + while i < args.length + param_types << FFI.find_type(args[i], @type_map) + param_values << args[i + 1] + i += 2 + end + invoke(param_types, param_values, &block) + end + + # + # Attach the invoker to module +mod+ as +mname+ + # + def attach(mod, mname) + invoker = self + params = "*args" + call = "call" + mod.module_eval <<-code + @@#{mname} = invoker + def self.#{mname}(#{params}) + @@#{mname}.#{call}(#{params}) + end + def #{mname}(#{params}) + @@#{mname}.#{call}(#{params}) + end + code + invoker + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/version.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/version.rb new file mode 100644 index 000000000..3a66ef8d5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi/version.rb @@ -0,0 +1,4 @@ +module FFI + VERSION = '1.9.10' +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi_c.bundle b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi_c.bundle new file mode 100755 index 000000000..1fedb0a88 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/lib/ffi_c.bundle differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/Benchmark.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/Benchmark.c new file mode 100644 index 000000000..55a73806a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/Benchmark.c @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ +#include +#include + +void returnVoid() { + +} + +void returnVoidI(int arg) { + +} +int returnInt() { + return 0; +} + +int returnIntI(int arg) { + return arg; +} + +typedef int8_t s8; +typedef uint8_t u8; +typedef int16_t s16; +typedef uint16_t u16; +typedef int32_t s32; +typedef uint32_t u32; +typedef int64_t s64; +typedef uint64_t u64; +typedef float f32; +typedef double f64; +typedef void v; +typedef char* S; +typedef void* P; + +#define B6(R, T1, T2, T3, T4, T5, T6) R bench_##T1##T2##T3##T4##T5##T6##_##R(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) {} +#define B5(R, T1, T2, T3, T4, T5) R bench_##T1##T2##T3##T4##T5##_##R(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) {} +#define B4(R, T1, T2, T3, T4) R bench_##T1##T2##T3##T4##_##R(T1 a1, T2 a2, T3 a3, T4 a4) {} +#define B3(R, T1, T2, T3) R bench_##T1##T2##T3##_##R(T1 a1, T2 a2, T3 a3) {} +#define B2(R, T1, T2) R bench_##T1##T2##_##R(T1 a1, T2 a2) {} +#define B1(R, T1) R bench_##T1##_##R(T1 a1) {} +#define BrV(T) B1(v, T); B2(v, T, T); B3(v, T, T, T); B4(v, T, T, T, T); B5(v, T, T, T, T, T); B6(v, T, T, T, T, T, T); +BrV(u32); +BrV(s32); +BrV(s64); +BrV(u64); +BrV(f32); +BrV(f64); +BrV(S); +BrV(P); diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/BoolTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/BoolTest.c new file mode 100644 index 000000000..04cb6c689 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/BoolTest.c @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2007 Wayne Meissner. + * Copyright (c) 2009 Aman Gupta. + * + * All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include + +bool +bool_return_true() +{ + return true; +} + +bool +bool_return_false() +{ + return false; +} + +bool +bool_return_val(bool value) +{ + return value; +} + +bool +bool_reverse_val(bool value) +{ + return value ? false : true; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/BufferTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/BufferTest.c new file mode 100644 index 000000000..3e95ebcf2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/BufferTest.c @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + + +#define MEMSET(buf, value, size) do { \ + int i; for (i = 0; i < size; ++i) buf[i] = value; \ +} while(0) +#define MEMCPY(dst, src, size) do { \ + int i; for (i = 0; i < size; ++i) dst[i] = src[i]; \ +} while(0) + +#define FILL(JTYPE, CTYPE) \ +void fill##JTYPE##Buffer(CTYPE* buf, CTYPE value, int size) { MEMSET(buf, value, size); } + +#define COPY(JTYPE, CTYPE) \ +void copy##JTYPE##Buffer(CTYPE* dst, CTYPE* src, int size) { MEMCPY(dst, src, size); } + +#define FUNC(JTYPE, CTYPE) \ + FILL(JTYPE, CTYPE); \ + COPY(JTYPE, CTYPE) + +FUNC(Byte, char); +FUNC(Short, short); +FUNC(Int, int); +FUNC(Long, long long); +FUNC(Float, float); +FUNC(Double, double); + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/ClosureTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/ClosureTest.c new file mode 100644 index 000000000..dfeabde66 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/ClosureTest.c @@ -0,0 +1,205 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include +#include +#ifndef _WIN32 +# include +#else +# include +# include +#endif + +#define R(T, rtype) rtype testClosureVr##T(rtype (*closure)(void)) { \ + return closure != NULL ? (*closure)() : (rtype) 0; \ +} + +#define P(T, ptype) void testClosure##T##rV(void (*closure)(ptype), ptype a1) { \ + if (closure != NULL) (*closure)(a1); \ +} + +void testClosureVrV(void (*closure)(void)) +{ + (*closure)(); +} + +R(Z, bool); +R(B, char); +R(S, short); +R(I, int); +R(L, long); +R(J, long long); +R(LL, long long); +R(F, float); +R(D, double); +R(P, const void*); + + +P(Z, bool); +P(B, char); +P(S, short); +P(I, int); +P(L, long); +P(J, long long); +P(LL, long long); +P(F, float); +P(D, double); +P(P, const void*); +P(UL, unsigned long); + +#if defined(_WIN32) && !defined(_WIN64) +bool __stdcall testClosureStdcall(long *a1, void __stdcall(*closure)(void *, long), long a2) { \ + void* sp_pre; + void* sp_post; + + asm volatile (" movl %%esp,%0" : "=g" (sp_pre)); + (*closure)(a1, a2); + asm volatile (" movl %%esp,%0" : "=g" (sp_post)); + + /* %esp before pushing parameters on the stack and after the call returns + * should be equal, if both sides respects the stdcall convention */ + return sp_pre == sp_post; +} +#endif + +void testOptionalClosureBrV(void (*closure)(char), char a1) +{ + if (closure) { + (*closure)(a1); + } +} + + +struct ThreadVrV { + void (*closure)(void); + int count; +}; + +static void * +threadVrV(void *arg) +{ + struct ThreadVrV* t = (struct ThreadVrV *) arg; + + int i; + for (i = 0; i < t->count; i++) { + (*t->closure)(); + } + + return NULL; +} + +void testThreadedClosureVrV(void (*closure)(void), int n) +{ + struct ThreadVrV arg = {closure, n}; +#ifndef _WIN32 + pthread_t t; + pthread_create(&t, NULL, threadVrV, &arg); + pthread_join(t, NULL); +#else + HANDLE hThread = (HANDLE) _beginthread((void (*)(void *))threadVrV, 0, &arg); + WaitForSingleObject(hThread, INFINITE); +#endif +} + +struct s8f32s32 { + char s8; + float f32; + int s32; +}; + +// Takes a struct argument +void testClosureTrV(void (*closure)(struct s8f32s32 s), struct s8f32s32* s) +{ + (*closure)(*s); +} + +// Returns a struct value +struct s8f32s32 testClosureVrT(struct s8f32s32 (*closure)()) +{ + return (*closure)(); +} + +typedef int (*returnTypeClosure_t)(int) ; +typedef returnTypeClosure_t (*lookupClosure_t)(); + +int testReturnsClosure(lookupClosure_t lookup, int val) +{ + returnTypeClosure_t func = lookup ? (*lookup)() : NULL; + return func ? (*func)(val) : 0; +} + +static int multiplyByTwo(int value) +{ + return value * 2; +} + +returnTypeClosure_t testReturnsFunctionPointer() +{ + return multiplyByTwo; +} + +typedef int (*argumentClosure_t)(int); +typedef int (*withArgumentClosure_t)(argumentClosure_t, int); + +int testArgumentClosure(withArgumentClosure_t closure_with, argumentClosure_t closure_arg, int val) +{ + return (*closure_with)(closure_arg, val); +} + + +// +// These macros produce functions of the form: +// testClosureBIrV(void (*closure)(char, int), char a1, int a2) {} +// +#define C2_(J1, J2, N1, N2) \ +void testClosure##J1##J2##rV(void (*closure)(N1, N2), N1 a1, N2 a2) \ +{ \ + if (closure != NULL) (*closure)(a1, a2); \ +} + +#define C2(J, N) \ + C2_(B, J, char, N) \ + C2_(S, J, short, N) \ + C2_(I, J, int, N) \ + C2_(LL, J, long long, N) \ + C2_(F, J, float, N) \ + C2_(D, J, double, N) \ + + +C2(B, char); +C2(S, short); +C2(I, int); +C2(LL, long long); +C2(F, float); +C2(D, double); + +#define C3_(J1, J2, J3, N1, N2, N3) \ +void testClosure##J1##J2##J3##rV(void (*closure)(N1, N2, N3), N1 a1, N2 a2, N3 a3) \ +{ \ + (*closure)(a1, a2, a3); \ +} + + +#define C3(J, N) \ + C3_(B, J, B, char, N, char) \ + C3_(S, J, S, short, N, short) \ + C3_(I, J, I, int, N, int) \ + C3_(LL, J, LL, long long, N, long long) \ + C3_(F, J, F, float, N, float) \ + C3_(D, J, D, double, N, double) \ + +C3(B, char); +C3(S, short); +C3(I, int); +C3(LL, long long); +C3(F, float); +C3(D, double); +C3_(B, S, I, char, short, int); +C3_(B, S, LL, char, short, long long); +C3_(LL, S, B, long long, short, char); +C3_(LL, B, S, long long, char, short); + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/EnumTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/EnumTest.c new file mode 100644 index 000000000..4bf8d236b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/EnumTest.c @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ +#include + +int test_untagged_enum(int val) { + return val; +} + +int test_untagged_typedef_enum(int val) { + return val; +} + +uint8_t test_untagged_nonint_enum(uint8_t val) { + return val; +} + +uint16_t test_tagged_nonint_enum1(uint16_t val) { + return val; +} + +uint32_t test_tagged_nonint_enum2(uint32_t val) { + return val; +} + +uint64_t test_tagged_nonint_enum3(uint64_t val) { + return val; +} + +typedef enum {c1, c2, c3, c4} enum_type1; +enum_type1 test_tagged_typedef_enum1(enum_type1 val) { + return val; +} + +typedef enum {c5 = 42, c6, c7, c8} enum_type2; +enum_type2 test_tagged_typedef_enum2(enum_type2 val) { + return val; +} + +typedef enum {c9 = 42, c10, c11 = 4242, c12} enum_type3; +enum_type3 test_tagged_typedef_enum3(enum_type3 val) { + return val; +} + +typedef enum {c13 = 42, c14 = 4242, c15 = 424242, c16 = 42424242} enum_type4; +enum_type4 test_tagged_typedef_enum4(enum_type4 val) { + return val; +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/FunctionTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/FunctionTest.c new file mode 100644 index 000000000..eafad8976 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/FunctionTest.c @@ -0,0 +1,70 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#ifdef _WIN32 +#include +#define sleep(x) Sleep(x) +#endif + +#ifndef _WIN32 +#include +#include +#endif + +int testAdd(int a, int b) +{ + return a + b; +}; + +int testFunctionAdd(int a, int b, int (*f)(int, int)) +{ + return f(a, b); +}; + +void testBlocking(int seconds) { + sleep(seconds); +}; + +struct async_data { + void (*fn)(int); + int value; +}; + +static void* asyncThreadCall(void *data) +{ + struct async_data* d = (struct async_data *) data; + if (d != NULL && d->fn != NULL) { + (*d->fn)(d->value); + } + + return NULL; +} + +void testAsyncCallback(void (*fn)(int), int value) +{ +#ifndef _WIN32 + pthread_t t; + struct async_data d; + d.fn = fn; + d.value = value; + pthread_create(&t, NULL, asyncThreadCall, &d); + pthread_join(t, NULL); +#else + (*fn)(value); +#endif +} + +#if defined(_WIN32) && !defined(_WIN64) +struct StructUCDP { + unsigned char a1; + double a2; + void *a3; +}; + +void __stdcall testStdcallManyParams(long *a1, char a2, short int a3, int a4, __int64 a5, + struct StructUCDP a6, struct StructUCDP *a7, float a8, double a9) { +} +#endif diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/GNUmakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/GNUmakefile new file mode 100644 index 000000000..a7ba9e67e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/GNUmakefile @@ -0,0 +1,149 @@ +# -*- makefile -*- + +ifeq ($(OS),) + BUILD_OS := $(shell uname -s | tr '[:upper:]' '[:lower:]') + OS := $(BUILD_OS) +endif + +ifeq ($(CPU),) + CPU := $(shell uname -m | sed -e 's/i[345678]86/i386/') +endif + +PLATFORM = $(CPU)-$(OS) + +ifeq ($(OS), sunos) + OS = solaris +endif + +SRC_DIR = libtest +BUILD_DIR ?= build +TEST_BUILD_DIR = $(BUILD_DIR)/libtest +# Set defaults to unix (linux/solaris/bsd) +PREFIX = lib +LIBEXT ?= so +LIBNAME = $(PREFIX)test.$(LIBEXT) + +export MACOSX_DEPLOYMENT_TARGET=10.4 + +CCACHE := $(strip $(realpath $(shell which ccache 2> /dev/null))) + +TEST_SRCS = $(wildcard $(SRC_DIR)/*.c) +TEST_OBJS := $(patsubst $(SRC_DIR)/%.c, $(TEST_BUILD_DIR)/%.o, $(TEST_SRCS)) + +# +# Compiler/linker flags from: +# http://weblogs.java.net/blog/kellyohair/archive/2006/01/compilation_of_1.html +JFLAGS = -fno-omit-frame-pointer -fno-strict-aliasing +OFLAGS = -O2 $(JFLAGS) +WFLAGS = -W -Wall -Wno-unused -Wno-parentheses +PICFLAGS = -fPIC +SOFLAGS = -shared +LDFLAGS += $(SOFLAGS) + +IFLAGS = -I"$(BUILD_DIR)" +CFLAGS = $(OFLAGS) $(WFLAGS) $(IFLAGS) $(PICFLAGS) -D_REENTRANT + +ifneq ($(strip $(findstring $(OS), win32, mingw, cygwin)),) + # For cygwin => win32-native builds, strip out cygwin deps + ifneq ($(findstring cygwin, $(BUILD_OS)),) + CC += -mno-cygwin -mwin32 + LDFLAGS += -mno-cygwin -Wl,--add-stdcall-alias + endif + PICFLAGS= + LIBEXT=dll + CC = gcc +endif + +ifeq ($(OS), darwin) + ifneq ($(findstring $(CPU),ppc),) + ARCHFLAGS += -arch ppc + endif + ifneq ($(findstring $(CPU),i386 x86_64),) + ARCHFLAGS += -arch i386 -arch x86_64 + endif + CFLAGS += $(ARCHFLAGS) -DTARGET_RT_MAC_CFM=0 + CFLAGS += -fno-common + LDFLAGS = $(ARCHFLAGS) -dynamiclib + # link against the universal libraries on ppc machines + LDFLAGS += -L$(MACSDK)/usr/lib + LIBEXT = dylib + FFI_CFLAGS += -isysroot $(MACSDK) + PICFLAGS = + SOFLAGS = +endif + +ifeq ($(OS), linux) + SOFLAGS += -Wl,-soname,$(LIBNAME) +endif + +ifeq ($(OS), solaris) + CC = /usr/sfw/bin/gcc -std=c99 + LD = /usr/ccs/bin/ld + SOFLAGS = -shared -static-libgcc +endif + +ifeq ($(OS), aix) + LIBEXT = a + SOFLAGS = -shared -static-libgcc + PICFLAGS += -pthread +endif + +ifneq ($(findstring bsd, $(OS)),) + SOFLAGS = -shared -static-libgcc + CFLAGS += -pthread + LDFLAGS += -pthread +endif + +ifeq ($(CPU), i386) + MODEL = 32 +endif + +ifeq ($(CPU), sparcv9) + MODEL = 64 +endif + +ifeq ($(CPU), amd64) + MODEL = 64 +endif + +ifeq ($(CPU), x86_64) + MODEL = 64 +endif + +ifeq ($(CPU), ppc64) + MODEL = 64 +endif + +ifeq ($(CPU), powerpc64) + MODEL = 64 +endif + +MODELFLAG = +ifneq ($(MODEL),) + MODELFLAG = -m$(MODEL) +endif + +# On platforms (linux, solaris) that support both 32bit and 64bit, force building for one or the other +ifneq ($(or $(findstring linux, $(OS)), $(findstring solaris, $(OS))),) + # Change the CC/LD instead of CFLAGS/LDFLAGS, incase other things in the flags + # makes the libffi build choke + CC += $(MODELFLAG) + LD += $(MODELFLAG) +endif + +LIBTEST = $(BUILD_DIR)/$(LIBNAME) + +all: $(LIBTEST) + +$(TEST_BUILD_DIR)/%.o : $(SRC_DIR)/%.c + @mkdir -p $(@D) + $(CCACHE) $(CC) $(CFLAGS) -c $< -o $@ + +$(LIBTEST): $(TEST_OBJS) + $(CC) -o $@ $(LDFLAGS) $(TEST_OBJS) -lm + +clean:: + # nothing to do - ant will delete the build dir + +debug:: + @echo "SRCS=$(TEST_SRCS)" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/GlobalVariable.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/GlobalVariable.c new file mode 100644 index 000000000..39c12a2e9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/GlobalVariable.c @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include +#include + +typedef int8_t s8; +typedef uint8_t u8; +typedef int16_t s16; +typedef uint16_t u16; +typedef int32_t s32; +typedef uint32_t u32; +typedef int64_t s64; +typedef uint64_t u64; +typedef signed long sL; +typedef unsigned long uL; +typedef float f32; +typedef double f64; +#if !defined(__OpenBSD__) +typedef unsigned long ulong; +#endif +typedef void* pointer; +typedef void* P; + +#define GVAR(T) \ + extern T gvar_##T; \ + T gvar_##T = (T) -1; \ + T gvar_##T##_get() { return gvar_##T; }; \ + void gvar_##T##_set(T v) { gvar_##T = v; } + +GVAR(s8); +GVAR(u8); +GVAR(s16); +GVAR(u16); +GVAR(s32); +GVAR(u32); +GVAR(s64); +GVAR(u64); +GVAR(long); +GVAR(ulong); +GVAR(pointer); + +struct gstruct { + long data; +}; + +struct gstruct gvar_gstruct = { -1 }; + +struct gstruct* +gvar_gstruct_get(void) +{ + return &gvar_gstruct; +} + +void +gvar_gstruct_set(const struct gstruct* val) +{ + gvar_gstruct = *val; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/LastErrorTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/LastErrorTest.c new file mode 100644 index 000000000..02ce4a8bc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/LastErrorTest.c @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#if defined(_WIN32) || defined(__WIN32__) +# include +#else +# include +#endif + +int setLastError(int error) { +#if defined(_WIN32) || defined(__WIN32__) + SetLastError(error); +#else + errno = error; +#endif + return -1; +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/NumberTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/NumberTest.c new file mode 100644 index 000000000..3fa25a800 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/NumberTest.c @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include +#include +#include +#include + +#if defined(__sparc) && defined(__sun__) + #define fix_mem_access __asm("ta 6") +#else + #define fix_mem_access +#endif + +typedef int8_t s8; +typedef uint8_t u8; +typedef int16_t s16; +typedef uint16_t u16; +typedef int32_t s32; +typedef uint32_t u32; +typedef int64_t s64; +typedef uint64_t u64; +typedef signed long sL; +typedef unsigned long uL; +typedef float f32; +typedef double f64; +typedef long double f128; +#if !defined(__OpenBSD__) +typedef unsigned long ulong; +#endif + +#define ADD(T) T add_##T(T arg1, T arg2) { return arg1 + arg2; } +#define SUB(T) T sub_##T(T arg1, T arg2) { return arg1 - arg2; } +#define MUL(T) T mul_##T(T arg1, T arg2) { return arg1 * arg2; } +#define DIV(T) T div_##T(T arg1, T arg2) { return arg1 / arg2; } +#define RET(T) T ret_##T(T arg1) { return arg1; } +#define SET(T) static T T##_;void set_##T(T arg1) { T##_ = arg1; } +#define GET(T) T get_##T() { return T##_; } +typedef char* ptr; +#define TEST(T) ADD(T) SUB(T) MUL(T) DIV(T) RET(T) SET(T) GET(T) +TEST(s8); +TEST(u8); +TEST(s16); +TEST(u16); +TEST(s32); +TEST(u32); +TEST(s64); +TEST(u64); +TEST(float); +TEST(double); +TEST(long); +TEST(ulong); +TEST(f128); + +#define ADD2(R, T1, T2) R add_##T1##T2##_##R(T1 arg1, T2 arg2) { return arg1 + arg2; } +#define SUB2(R, T1, T2) R sub_##T1##T2##_##R(T1 arg1, T2 arg2) { return arg1 - arg2; } +#define MUL2(R, T1, T2) R mul_##T1##T2##_##R(T1 arg1, T2 arg2) { return arg1 * arg2; } +#define DIV2(R, T1, T2) R div_##T1##T2##_##R(T1 arg1, T2 arg2) { return arg1 / arg2; } + +#define T2__(R, T1, T2) ADD2(R, T1, T2) SUB2(R, T1, T2) MUL2(R, T1, T2) DIV2(R, T1, T2) +#define T2_(R, T1) \ + T2__(R, T1, s8) T2__(R, T1, u8) \ + T2__(R, T1, s16) T2__(R, T1, u16) \ + T2__(R, T1, s32) T2__(R, T1, u32) \ + T2__(R, T1, sL) T2__(R, T1, uL) \ + T2__(R, T1, s64) T2__(R, T1, u64) \ + +#define TEST2(R) \ + T2_(R, s8) T2_(R, u8) T2_(R, s16) T2_(R, u16) T2_(R, s32) T2_(R, u32) \ + T2_(R, sL) T2_(R, uL) T2_(R, s64) T2_(R, u64) + +#ifdef notyet +TEST2(s32) +TEST2(u32) +TEST2(s64) +TEST2(u64) +#endif + +#define ADD3(R, T1, T2, T3) R add_##T1##T2##T3##_##R(T1 arg1, T2 arg2, T3 arg3) { return arg1 + arg2 + arg3; } +#define pack_f32(buf, v) do { float f = v; memcpy((buf), &f, sizeof(f)); } while(0) +#define pack_f64(buf, v) do { double f = v; memcpy((buf), &f, sizeof(f)); } while(0) +#define pack_int(buf, v) do { *(buf) = v; } while(0) +#define pack_s8 pack_int +#define pack_u8 pack_int +#define pack_s16 pack_int +#define pack_u16 pack_int +#define pack_s32 pack_int +#define pack_u32 pack_int +#define pack_s64 pack_int +#define pack_u64 pack_int +#define pack_sL pack_int +#define pack_uL pack_int + +#define PACK3(R, T1, T2, T3) void pack_##T1##T2##T3##_##R(T1 arg1, T2 arg2, T3 arg3, R* r) { \ + fix_mem_access; \ + pack_##T1(&r[0], arg1); \ + pack_##T2(&r[1], arg2); \ + pack_##T3(&r[2], arg3); \ +} + +#define T3___(R, T1, T2, T3) PACK3(R, T1, T2, T3) /* SUB2(R, T1, T2) MUL2(R, T1, T2) DIV2(R, T1, T2) */ +#define T3__(R, T1, T2) \ + T3___(R, T1, T2, s8) T3___(R, T1, T2, u8) \ + T3___(R, T1, T2, s16) T3___(R, T1, T2, u16) \ + T3___(R, T1, T2, s32) T3___(R, T1, T2, u32) \ + T3___(R, T1, T2, sL) T3___(R, T1, T2, uL) \ + T3___(R, T1, T2, s64) T3___(R, T1, T2, u64) \ + T3___(R, T1, T2, f32) T3___(R, T1, T2, f64) \ + +#define T3_(R, T1) \ + T3__(R, T1, s8) T3__(R, T1, u8) \ + T3__(R, T1, s16) T3__(R, T1, u16) \ + T3__(R, T1, s32) T3__(R, T1, u32) \ + T3__(R, T1, sL) T3__(R, T1, uL) \ + T3__(R, T1, s64) T3__(R, T1, u64) \ + T3__(R, T1, f32) T3__(R, T1, f64) \ + +#define TEST3(R) \ + T3_(R, s8) T3_(R, u8) T3_(R, s16) T3_(R, u16) T3_(R, s32) T3_(R, u32) \ + T3_(R, sL) T3_(R, uL) T3_(R, s64) T3_(R, u64) T3_(R, f32) T3_(R, f64) + +TEST3(s64) + +void +foo6(intptr_t i1, intptr_t i2, intptr_t i3, intptr_t i4, intptr_t i5, intptr_t i6) { } + +void +foo5(intptr_t i1, intptr_t i2, intptr_t i3, intptr_t i4, intptr_t i5) { } + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/PointerTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/PointerTest.c new file mode 100644 index 000000000..7237ab20e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/PointerTest.c @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include +#include +#include +#include +#include +#include +typedef void* ptr; +typedef void* pointer; +#ifdef _WIN32 +typedef char* caddr_t; +#endif + +#define RET(T) T ptr_ret_##T(void* arg1, int offset) { \ + T tmp; memcpy(&tmp, (caddr_t) arg1 + offset, sizeof(tmp)); return tmp; \ +} +#define SET(T) void ptr_set_##T(void* arg1, int offset, T value) { \ + memcpy((caddr_t) arg1 + offset, &value, sizeof(value)); \ +} +#define TEST(T) SET(T) RET(T) + +TEST(int8_t); +TEST(int16_t); +TEST(int32_t); +TEST(int64_t); +TEST(float); +TEST(double); +TEST(pointer); + +void* +ptr_return_array_element(void **ptrArray, int arrayIndex) +{ + return ptrArray[arrayIndex]; +} + +void +ptr_set_array_element(void **ptrArray, int arrayIndex, void *value) +{ + ptrArray[arrayIndex] = value; +} + +void* +ptr_malloc(int size) +{ + return calloc(1, size); +} +void +ptr_free(void* ptr) +{ + free(ptr); +} + +void* +ptr_from_address(uintptr_t addr) +{ + return (void *) addr; +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/ReferenceTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/ReferenceTest.c new file mode 100644 index 000000000..d1dd88bc9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/ReferenceTest.c @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include + +#define REF(T) void ref_##T(T arg, T* result) { *result = arg; } +#define ADD(T) void ref_add_##T(T arg1, T arg2, T* result) { *result = arg1 + arg2; } +#define SUB(T) void ref_sub_##T(T arg1, T arg2, T* result) { *result = arg1 - arg2; } +#define MUL(T) void ref_mul_##T(T arg1, T arg2, T* result) { *result = arg1 * arg2; } +#define DIV(T) void ref_div_##T(T arg1, T arg2, T* result) { *result = arg1 / arg2; } +#define TEST(T) ADD(T) SUB(T) MUL(T) DIV(T) REF(T) + +TEST(int8_t); +TEST(int16_t); +TEST(int32_t); +TEST(int64_t); +TEST(float); +TEST(double); + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/StringTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/StringTest.c new file mode 100644 index 000000000..292242bb9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/StringTest.c @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include + +int +string_equals(const char* s1, const char* s2) +{ + return strcmp(s1, s2) == 0; +} + +void +string_set(char* s1, const char* s2) +{ + strcpy(s1, s2); +} +void +string_concat(char* dst, const char* src) +{ + strcat(dst, src); +} +void +string_dummy(char* dummy) +{ +} +const char* +string_null(void) +{ + return NULL; +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/StructTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/StructTest.c new file mode 100644 index 000000000..25683d396 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/StructTest.c @@ -0,0 +1,243 @@ +/* + * Copyright (c) 2007 Wayne Meissner. + * Copyright (c) 2009 Andrea Fazzi . + * + * All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include +#include +#include +#include +#include +#include + +typedef char s8; +typedef short s16; +typedef int s32; +typedef long long s64; +typedef float f32; +typedef double f64; + +typedef struct bugged_struct { + unsigned char visible; + unsigned int x; + unsigned int y; + short rx; + short ry; + unsigned char order; + unsigned char size; +} bugged_struct_t; + +unsigned int +bugged_struct_size() { + return sizeof(bugged_struct_t); +} + +struct test1 { + char b; + short s; + int i; + long long j; + long l; + float f; + double d; + char string[32]; +}; + +struct struct_with_array { + char c; + int a[5]; +}; + +struct nested { + int i; +}; + +struct container { + char first; + struct nested s; +}; + +int +struct_align_nested_struct(struct container* a) { return a->s.i; } + +void* +struct_field_array(struct struct_with_array* s) { return &s->a; } + +struct container* +struct_make_container_struct(int i) +{ + static struct container cs; + memset(&cs, 0, sizeof(cs)); + cs.first = 1; + cs.s.i = i; + return &cs; +} + +#define T(x, type) \ + type struct_field_##type(struct test1* t) { return t->x; } \ + struct type##_align { char first; type value; }; \ + type struct_align_##type(struct type##_align* a) { return a->value; } + +T(b, s8); +T(s, s16); +T(i, s32); +T(j, s64); +T(f, f32); +T(d, f64); +T(l, long); + +void +struct_set_string(struct test1* t, char* s) +{ + strcpy(t->string, s); +} + +struct test1* +struct_make_struct(char b, short s, int i, long long ll, float f, double d) +{ + static struct test1 t; + memset(&t, 0, sizeof(t)); + t.b = b; + t.s = s; + t.i = i; + t.j = ll; + t.f = f; + t.d = d; + return &t; +} + +typedef int (*add_cb)(int a1, int a2); +typedef int (*sub_cb)(int a1, int a2); +struct test2 { + add_cb add_callback; + sub_cb sub_callback; +}; + +int +struct_call_add_cb(struct test2* t, int a1, int a2) +{ + return t->add_callback(a1, a2); +} + +int +struct_call_sub_cb(struct test2* t, int a1, int a2) +{ + return t->sub_callback(a1, a2); +} + + +struct struct_with_array* +struct_make_struct_with_array(int a_0, int a_1, int a_2, int a_3, int a_4) +{ + static struct struct_with_array s; + + memset(&s, 0, sizeof(s)); + + s.a[0] = a_0; + s.a[1] = a_1; + s.a[2] = a_2; + s.a[3] = a_3; + s.a[4] = a_4; + + return &s; + +} + +struct s8s32 { + char s8; + int s32; +}; + +struct s8s32 +struct_return_s8s32() +{ + struct s8s32 s; + s.s8 = 0x7f; + s.s32 = 0x12345678; + + return s; +} + +struct s8s32 +struct_s8s32_set(char s8, int s32) +{ + struct s8s32 s; + + s.s8 = s8; + s.s32 = s32; + + return s; +} + +int +struct_s8s32_get_s8(struct s8s32 s) +{ + return s.s8; +} + +int +struct_s8s32_get_s32(struct s8s32 s) +{ + return s.s32; +} + +struct s8s32 +struct_s8s32_ret_s8s32(struct s8s32 s) +{ + return s; +} + +// Pass a struct and an int arg, ensure the int arg is passed correctly +int +struct_s8s32_s32_ret_s32(struct s8s32 s, int s32) +{ + return s32; +} + +// Pass a struct and a long long arg, ensure the long long arg is passed correctly +long long +struct_s8s32_s64_ret_s64(struct s8s32 s, long long s64) +{ + return s64; +} + +// Pass a struct and a long long arg, ensure the long long arg is passed correctly +int +struct_s32_ptr_s32_s8s32_ret_s32(int s32a, void *ptr, int s32b, struct s8s32 s) +{ + if (ptr != NULL) *(struct s8s32 *) ptr = s; + return s.s32; +} + +// Pass a char *, copy into buffer length struct +struct struct_string { + char *bytes; + int len; +}; + +struct struct_string +struct_varargs_ret_struct_string(int len, ...) +{ + struct struct_string ss; + va_list vl; + char* cp = NULL; + + va_start(vl, len); + + ss.len = len; + ss.bytes = va_arg(vl, char *); + if (ss.bytes != NULL) { + cp = malloc(strlen(ss.bytes) + 1); + strcpy(cp, ss.bytes); + ss.bytes = cp; + } + + va_end(vl); + + return ss; +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/UnionTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/UnionTest.c new file mode 100644 index 000000000..0929a31f6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/UnionTest.c @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include +#include +#include +#include +#include + +typedef char s8; +typedef short s16; +typedef int s32; +typedef long long s64; +typedef float f32; +typedef double f64; + +typedef union union_test { + char b; + short s; + int i; + long long j; + long l; + float f; + double d; + s8 a[10]; +} union_test_t; + +#define T(x, type) \ + type union_align_##type(union_test_t* u) { return u->x; } \ + union_test_t* union_make_union_with_##type(type value) { static union_test_t u; u.x = value; return &u; } + +T(b, s8); +T(s, s16); +T(i, s32); +T(j, s64); +T(f, f32); +T(d, f64); +T(l, long); + +unsigned int union_size() { return sizeof(union_test_t); } diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/VariadicTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/VariadicTest.c new file mode 100644 index 000000000..fea6c3b80 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/libtest/VariadicTest.c @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include +#include +#include +#include +#include + +typedef int8_t s8; +typedef uint8_t u8; +typedef int16_t s16; +typedef uint16_t u16; +typedef int32_t s32; +typedef uint32_t u32; +typedef int64_t s64; +typedef uint64_t u64; +typedef signed long sL; +typedef unsigned long uL; +typedef float F; +typedef double D; + +void pack_varargs(s64* buf, const char* fmt, ...) +{ + va_list ap; + int c; + double d; + va_start(ap, fmt); + while ((c = *fmt++)) { + switch (c) { + case 'c': + case 's': + case 'i': + *buf++ = va_arg(ap, s32); + break; + case 'l': + *buf++ = va_arg(ap, long); + break; + case 'j': + *buf++ = va_arg(ap, s64); + break; + case 'f': + case 'd': + d = va_arg(ap, double); + memcpy(buf++, &d, sizeof(d)); + break; + case 'C': + case 'S': + case 'I': + *buf++ = va_arg(ap, u32); + break; + case 'L': + *buf++ = va_arg(ap, unsigned long); + break; + } + } + va_end(ap); +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/LICENSE.SPECS b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/LICENSE.SPECS new file mode 100644 index 000000000..561dd8c6b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/LICENSE.SPECS @@ -0,0 +1,22 @@ +Copyright (c) 2008-2014 Ruby-FFI contributors + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/async_callback_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/async_callback_spec.rb new file mode 100644 index 000000000..87950cc6b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/async_callback_spec.rb @@ -0,0 +1,35 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe "async callback" do + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + AsyncIntCallback = callback [ :int ], :void + + @blocking = true + attach_function :testAsyncCallback, [ AsyncIntCallback, :int ], :void + end + + it ":int (0x7fffffff) argument" do + v = 0xdeadbeef + called = false + cb = Proc.new {|i| v = i; called = true } + LibTest.testAsyncCallback(cb, 0x7fffffff) + expect(called).to be true + expect(v).to eq(0x7fffffff) + end + + it "called a second time" do + v = 0xdeadbeef + called = false + cb = Proc.new {|i| v = i; called = true } + LibTest.testAsyncCallback(cb, 0x7fffffff) + expect(called).to be true + expect(v).to eq(0x7fffffff) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/bool_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/bool_spec.rb new file mode 100644 index 000000000..6cd1d6f34 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/bool_spec.rb @@ -0,0 +1,32 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe "Function with primitive boolean arguments and return values" do + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + attach_function :bool_return_true, [ ], :bool + attach_function :bool_return_false, [ ], :bool + attach_function :bool_return_val, [ :bool ], :bool + attach_function :bool_reverse_val, [ :bool ], :bool + end + + it "bools" do + expect(LibTest.bool_return_true).to be true + expect(LibTest.bool_return_false).to be false + + expect(LibTest.bool_return_val(true)).to be true + expect(LibTest.bool_return_val(false)).to be false + + expect(LibTest.bool_reverse_val(true)).to be false + expect(LibTest.bool_reverse_val(false)).to be true + end + + it "raise error on invalid types" do + expect { LibTest.bool_return_val(nil) }.to raise_error(::TypeError) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/buffer_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/buffer_spec.rb new file mode 100644 index 000000000..5f22a6214 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/buffer_spec.rb @@ -0,0 +1,279 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe "Buffer#total" do + [1,2,3].each do |i| + { :char => 1, :uchar => 1, :short => 2, :ushort => 2, :int => 4, + :uint => 4, :long => FFI::Type::LONG.size, :ulong => FFI::Type::ULONG.size, + :long_long => 8, :ulong_long => 8, :float => 4, :double => 8 + }.each_pair do |t, s| + + it "Buffer.alloc_in(#{t}, #{i}).total == #{i * s}" do + expect(FFI::Buffer.alloc_in(t, i).total).to eq(i * s) + end + + it "Buffer.alloc_out(#{t}, #{i}).total == #{i * s}" do + expect(FFI::Buffer.alloc_out(t, i).total).to eq(i * s) + end + + it "Buffer.alloc_inout(#{t}, #{i}).total == #{i * s}" do + expect(FFI::Buffer.alloc_inout(t, i).total).to eq(i * s) + end + end + end +end + +describe "Buffer#put_char" do + bufsize = 4 + (0..127).each do |i| + (0..bufsize-1).each do |offset| + it "put_char(#{offset}, #{i}).get_char(#{offset}) == #{i}" do + expect(FFI::Buffer.alloc_in(bufsize).put_char(offset, i).get_char(offset)).to eq(i) + end + end + end +end + +describe "Buffer#put_uchar" do + bufsize = 4 + (0..255).each do |i| + (0..bufsize-1).each do |offset| + it "Buffer.put_uchar(#{offset}, #{i}).get_uchar(#{offset}) == #{i}" do + expect(FFI::Buffer.alloc_in(bufsize).put_uchar(offset, i).get_uchar(offset)).to eq(i) + end + end + end +end + +describe "Buffer#put_short" do + bufsize = 4 + [0, 1, 128, 32767].each do |i| + (0..bufsize-2).each do |offset| + it "put_short(#{offset}, #{i}).get_short(#{offset}) == #{i}" do + expect(FFI::Buffer.alloc_in(bufsize).put_short(offset, i).get_short(offset)).to eq(i) + end + end + end +end + +describe "Buffer#put_ushort" do + bufsize = 4 + [ 0, 1, 128, 32767, 65535, 0xfee1, 0xdead, 0xbeef, 0xcafe ].each do |i| + (0..bufsize-2).each do |offset| + it "put_ushort(#{offset}, #{i}).get_ushort(#{offset}) == #{i}" do + expect(FFI::Buffer.alloc_in(bufsize).put_ushort(offset, i).get_ushort(offset)).to eq(i) + end + end + end +end + +describe "Buffer#put_int" do + bufsize = 8 + [0, 1, 128, 32767, 0x7ffffff ].each do |i| + (0..bufsize-4).each do |offset| + it "put_int(#{offset}, #{i}).get_int(#{offset}) == #{i}" do + expect(FFI::Buffer.alloc_in(bufsize).put_int(offset, i).get_int(offset)).to eq(i) + end + end + end +end + +describe "Buffer#put_uint" do + bufsize = 8 + [ 0, 1, 128, 32767, 65535, 0xfee1dead, 0xcafebabe, 0xffffffff ].each do |i| + (0..bufsize-4).each do |offset| + it "put_uint(#{offset}, #{i}).get_uint(#{offset}) == #{i}" do + expect(FFI::Buffer.alloc_in(bufsize).put_uint(offset, i).get_uint(offset)).to eq(i) + end + end + end +end + +describe "Buffer#put_long" do + bufsize = 16 + [0, 1, 128, 32767, 0x7ffffff ].each do |i| + (0..bufsize-FFI::Type::LONG.size).each do |offset| + it "put_long(#{offset}, #{i}).get_long(#{offset}) == #{i}" do + expect(FFI::Buffer.alloc_in(bufsize).put_long(offset, i).get_long(offset)).to eq(i) + end + end + end +end + +describe "Buffer#put_ulong" do + bufsize = 16 + [ 0, 1, 128, 32767, 65535, 0xfee1dead, 0xcafebabe, 0xffffffff ].each do |i| + (0..bufsize-FFI::Type::LONG.size).each do |offset| + it "put_ulong(#{offset}, #{i}).get_ulong(#{offset}) == #{i}" do + expect(FFI::Buffer.alloc_in(bufsize).put_ulong(offset, i).get_ulong(offset)).to eq(i) + end + end + end +end + +describe "Buffer#put_long_long" do + bufsize = 16 + [0, 1, 128, 32767, 0x7ffffffffffffff ].each do |i| + (0..bufsize-8).each do |offset| + it "put_long_long(#{offset}, #{i}).get_long_long(#{offset}) == #{i}" do + expect(FFI::Buffer.alloc_in(bufsize).put_long_long(offset, i).get_long_long(offset)).to eq(i) + end + end + end +end + +describe "Buffer#put_ulong_long" do + bufsize = 16 + [ 0, 1, 128, 32767, 65535, 0xdeadcafebabe, 0x7fffffffffffffff ].each do |i| + (0..bufsize-8).each do |offset| + it "put_ulong_long(#{offset}, #{i}).get_ulong_long(#{offset}) == #{i}" do + expect(FFI::Buffer.alloc_in(bufsize).put_ulong_long(offset, i).get_ulong_long(offset)).to eq(i) + end + end + end +end + +describe "Reading/Writing binary strings" do + it "Buffer#put_bytes" do + str = "hello\0world" + buf = FFI::Buffer.new 1024 + buf.put_bytes(0, str); + s2 = buf.get_bytes(0, 11); + expect(s2).to eq(str) + end + + it "Buffer#put_bytes with index and length" do + str = "hello\0world" + buf = FFI::Buffer.new 1024 + buf.put_bytes(0, str, 5, 6); + s2 = buf.get_bytes(0, 6); + expect(s2).to eq(str[5..-1]) + end + + it "Buffer#put_bytes with only index" do + str = "hello\0world" + buf = FFI::Buffer.new 1024 + buf.put_bytes(0, str, 5); + s2 = buf.get_bytes(0, 6); + expect(s2).to eq(str[5..-1]) + end + + it "Buffer#put_bytes with index > str.length" do + str = "hello\0world" + buf = FFI::Buffer.new 1024 + expect { buf.put_bytes(0, str, 12); }.to raise_error + end + + it "Buffer#put_bytes with length > str.length" do + str = "hello\0world" + buf = FFI::Buffer.new 1024 + expect { buf.put_bytes(0, str, 0, 12); }.to raise_error + end + + it "Buffer#put_bytes with negative index" do + str = "hello\0world" + buf = FFI::Buffer.new 1024 + expect { buf.put_bytes(0, str, -1, 12); }.to raise_error + end + + it "Buffer#write_bytes" do + str = "hello\0world" + buf = FFI::Buffer.new 1024 + buf.write_bytes(str) + s2 = buf.get_bytes(0, 11) + expect(s2).to eq(str) + end + + it "Buffer#write_bytes with index and length" do + str = "hello\0world" + buf = FFI::Buffer.new 1024 + buf.write_bytes(str, 5, 6) + s2 = buf.get_bytes(0, 6) + expect(s2).to eq(str[5..-1]) + end + + it "Buffer#write_bytes with only index" do + str = "hello\0world" + buf = FFI::Buffer.new 1024 + buf.write_bytes(str, 5) + s2 = buf.get_bytes(0, 6) + expect(s2).to eq(str[5..-1]) + end + + it "Buffer#write_bytes with index > str.length" do + str = "hello\0world" + buf = FFI::Buffer.new 1024 + expect { buf.write_bytes(str, 12) }.to raise_error + end + + it "Buffer#put_bytes with length > str.length" do + str = "hello\0world" + buf = FFI::Buffer.new 1024 + expect { buf.put_bytes(0, str, 0, 12) }.to raise_error + end + + it "Buffer#write_bytes with negative index" do + str = "hello\0world" + buf = FFI::Buffer.new 1024 + expect { buf.write_bytes(str, -1, 12) }.to raise_error + end +end + +describe "Reading/Writing ascii strings" do + it "Buffer#put_string with string containing zero byte" do + str = "hello\0world" + buf = FFI::Buffer.new 1024 + buf.put_string(0, str); + s2 = buf.get_bytes(0, 11); + expect(s2).to eq(str) + end + + it "Buffer#get_string with string containing zero byte" do + str = "hello\0world" + buf = FFI::Buffer.new 1024 + buf.put_bytes(0, str); + s2 = buf.get_string(0, 11); + expect(s2).to eq("hello") + end + + it "Buffer#put_string without length should NUL terminate" do + str = "hello" + buf = FFI::Buffer.new 1024 + buf.put_string(0, str); + s2 = buf.get_bytes(0, 6); + expect(s2).to eq("hello\0") + end +end + +describe "Buffer#put_pointer" do + it "put_pointer(0, p).get_pointer(0) == p" do + p = FFI::MemoryPointer.new :ulong_long + p.put_uint(0, 0xdeadbeef) + buf = FFI::Buffer.alloc_inout 8 + p2 = buf.put_pointer(0, p).get_pointer(0) + expect(p2).not_to be_nil + expect(p2).to eq(p) + expect(p2.get_uint(0)).to eq(0xdeadbeef) + end +end + +describe "Buffer#size" do + it "should return size" do + buf = FFI::Buffer.new 14 + expect(buf.size).to eq(14) + end +end + +describe "Buffer#initialize" do + it "with block should execute block" do + block_executed = false + FFI::Buffer.new(:pointer) do |ptr| + block_executed = true + end + expect(block_executed).to be true + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/callback_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/callback_spec.rb new file mode 100644 index 000000000..bc9b55a8c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/callback_spec.rb @@ -0,0 +1,773 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe "Callback" do +# module LibC +# extend FFI::Library +# callback :qsort_cmp, [ :pointer, :pointer ], :int +# attach_function :qsort, [ :pointer, :int, :int, :qsort_cmp ], :int +# end +# it "arguments get passed correctly" do +# p = MemoryPointer.new(:int, 2) +# p.put_array_of_int32(0, [ 1 , 2 ]) +# args = [] +# cmp = proc do |p1, p2| args.push(p1.get_int(0)); args.push(p2.get_int(0)); 0; end +# # this is a bit dodgey, as it relies on qsort passing the args in order +# LibC.qsort(p, 2, 4, cmp) +# args.should == [ 1, 2 ] +# end +# +# it "Block can be substituted for Callback as last argument" do +# p = MemoryPointer.new(:int, 2) +# p.put_array_of_int32(0, [ 1 , 2 ]) +# args = [] +# # this is a bit dodgey, as it relies on qsort passing the args in order +# LibC.qsort(p, 2, 4) do |p1, p2| +# args.push(p1.get_int(0)) +# args.push(p2.get_int(0)) +# 0 +# end +# args.should == [ 1, 2 ] +# end + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + class S8F32S32 < FFI::Struct + layout :s8, :char, :f32, :float, :s32, :int + end + + callback :cbVrS8, [ ], :char + callback :cbVrU8, [ ], :uchar + callback :cbVrS16, [ ], :short + callback :cbVrU16, [ ], :ushort + callback :cbVrS32, [ ], :int + callback :cbVrU32, [ ], :uint + callback :cbVrL, [ ], :long + callback :cbVrUL, [ ], :ulong + callback :cbVrS64, [ ], :long_long + callback :cbVrU64, [ ], :ulong_long + callback :cbVrP, [], :pointer + callback :cbVrZ, [], :bool + callback :cbCrV, [ :char ], :void + callback :cbSrV, [ :short ], :void + callback :cbIrV, [ :int ], :void + callback :cbLrV, [ :long ], :void + callback :cbULrV, [ :ulong ], :void + callback :cbLrV, [ :long_long ], :void + callback :cbVrT, [ ], S8F32S32.by_value + callback :cbTrV, [ S8F32S32.by_value ], :void + callback :cbYrV, [ S8F32S32.ptr ], :void + callback :cbVrY, [ ], S8F32S32.ptr + + attach_function :testCallbackVrS8, :testClosureVrB, [ :cbVrS8 ], :char + attach_function :testCallbackVrU8, :testClosureVrB, [ :cbVrU8 ], :uchar + attach_function :testCallbackVrS16, :testClosureVrS, [ :cbVrS16 ], :short + attach_function :testCallbackVrU16, :testClosureVrS, [ :cbVrU16 ], :ushort + attach_function :testCallbackVrS32, :testClosureVrI, [ :cbVrS32 ], :int + attach_function :testCallbackVrU32, :testClosureVrI, [ :cbVrU32 ], :uint + attach_function :testCallbackVrL, :testClosureVrL, [ :cbVrL ], :long + attach_function :testCallbackVrZ, :testClosureVrZ, [ :cbVrZ ], :bool + attach_function :testCallbackVrUL, :testClosureVrL, [ :cbVrUL ], :ulong + attach_function :testCallbackVrS64, :testClosureVrLL, [ :cbVrS64 ], :long_long + attach_function :testCallbackVrU64, :testClosureVrLL, [ :cbVrU64 ], :ulong_long + attach_function :testCallbackVrP, :testClosureVrP, [ :cbVrP ], :pointer + attach_function :testCallbackVrY, :testClosureVrP, [ :cbVrY ], S8F32S32.ptr + attach_function :testCallbackVrT, :testClosureVrT, [ :cbVrT ], S8F32S32.by_value + attach_function :testCallbackTrV, :testClosureTrV, [ :cbTrV, S8F32S32.ptr ], :void + attach_variable :cbVrS8, :gvar_pointer, :cbVrS8 + attach_variable :pVrS8, :gvar_pointer, :pointer + attach_function :testGVarCallbackVrS8, :testClosureVrB, [ :pointer ], :char + attach_function :testOptionalCallbackCrV, :testOptionalClosureBrV, [ :cbCrV, :char ], :void + + end + + it "returning :char (0)" do + expect(LibTest.testCallbackVrS8 { 0 }).to eq(0) + end + + it "returning :char (127)" do + expect(LibTest.testCallbackVrS8 { 127 }).to eq(127) + end + + it "returning :char (-128)" do + expect(LibTest.testCallbackVrS8 { -128 }).to eq(-128) + end + # test wrap around + it "returning :char (128)" do + expect(LibTest.testCallbackVrS8 { 128 }).to eq(-128) + end + + it "returning :char (255)" do + expect(LibTest.testCallbackVrS8 { 0xff }).to eq(-1) + end + + it "returning :uchar (0)" do + expect(LibTest.testCallbackVrU8 { 0 }).to eq(0) + end + + it "returning :uchar (0xff)" do + expect(LibTest.testCallbackVrU8 { 0xff }).to eq(0xff) + end + + it "returning :uchar (-1)" do + expect(LibTest.testCallbackVrU8 { -1 }).to eq(0xff) + end + + it "returning :uchar (128)" do + expect(LibTest.testCallbackVrU8 { 128 }).to eq(128) + end + + it "returning :uchar (-128)" do + expect(LibTest.testCallbackVrU8 { -128 }).to eq(128) + end + + it "returning :short (0)" do + expect(LibTest.testCallbackVrS16 { 0 }).to eq(0) + end + + it "returning :short (0x7fff)" do + expect(LibTest.testCallbackVrS16 { 0x7fff }).to eq(0x7fff) + end + # test wrap around + it "returning :short (0x8000)" do + expect(LibTest.testCallbackVrS16 { 0x8000 }).to eq(-0x8000) + end + + it "returning :short (0xffff)" do + expect(LibTest.testCallbackVrS16 { 0xffff }).to eq(-1) + end + + it "returning :ushort (0)" do + expect(LibTest.testCallbackVrU16 { 0 }).to eq(0) + end + + it "returning :ushort (0x7fff)" do + expect(LibTest.testCallbackVrU16 { 0x7fff }).to eq(0x7fff) + end + + it "returning :ushort (0x8000)" do + expect(LibTest.testCallbackVrU16 { 0x8000 }).to eq(0x8000) + end + + it "returning :ushort (0xffff)" do + expect(LibTest.testCallbackVrU16 { 0xffff }).to eq(0xffff) + end + + it "returning :ushort (-1)" do + expect(LibTest.testCallbackVrU16 { -1 }).to eq(0xffff) + end + + it "returning :int (0)" do + expect(LibTest.testCallbackVrS32 { 0 }).to eq(0) + end + + it "returning :int (0x7fffffff)" do + expect(LibTest.testCallbackVrS32 { 0x7fffffff }).to eq(0x7fffffff) + end + # test wrap around + it "returning :int (-0x80000000)" do + expect(LibTest.testCallbackVrS32 { -0x80000000 }).to eq(-0x80000000) + end + + it "returning :int (-1)" do + expect(LibTest.testCallbackVrS32 { -1 }).to eq(-1) + end + + it "returning :uint (0)" do + expect(LibTest.testCallbackVrU32 { 0 }).to eq(0) + end + + it "returning :uint (0x7fffffff)" do + expect(LibTest.testCallbackVrU32 { 0x7fffffff }).to eq(0x7fffffff) + end + # test wrap around + it "returning :uint (0x80000000)" do + expect(LibTest.testCallbackVrU32 { 0x80000000 }).to eq(0x80000000) + end + + it "returning :uint (0xffffffff)" do + expect(LibTest.testCallbackVrU32 { 0xffffffff }).to eq(0xffffffff) + end + + it "returning :uint (-1)" do + expect(LibTest.testCallbackVrU32 { -1 }).to eq(0xffffffff) + end + + it "returning :long (0)" do + expect(LibTest.testCallbackVrL { 0 }).to eq(0) + end + + it "returning :long (0x7fffffff)" do + expect(LibTest.testCallbackVrL { 0x7fffffff }).to eq(0x7fffffff) + end + # test wrap around + it "returning :long (-0x80000000)" do + expect(LibTest.testCallbackVrL { -0x80000000 }).to eq(-0x80000000) + end + + it "returning :long (-1)" do + expect(LibTest.testCallbackVrL { -1 }).to eq(-1) + end + + it "returning :ulong (0)" do + expect(LibTest.testCallbackVrUL { 0 }).to eq(0) + end + + it "returning :ulong (0x7fffffff)" do + expect(LibTest.testCallbackVrUL { 0x7fffffff }).to eq(0x7fffffff) + end + # test wrap around + it "returning :ulong (0x80000000)" do + expect(LibTest.testCallbackVrUL { 0x80000000 }).to eq(0x80000000) + end + + it "returning :ulong (0xffffffff)" do + expect(LibTest.testCallbackVrUL { 0xffffffff }).to eq(0xffffffff) + end + + it "Callback returning :ulong (-1)" do + if FFI::Platform::LONG_SIZE == 32 + expect(LibTest.testCallbackVrUL { -1 }).to eq(0xffffffff) + else + expect(LibTest.testCallbackVrUL { -1 }).to eq(0xffffffffffffffff) + end + end + + it "returning :long_long (0)" do + expect(LibTest.testCallbackVrS64 { 0 }).to eq(0) + end + + it "returning :long_long (0x7fffffffffffffff)" do + expect(LibTest.testCallbackVrS64 { 0x7fffffffffffffff }).to eq(0x7fffffffffffffff) + end + # test wrap around + it "returning :long_long (-0x8000000000000000)" do + expect(LibTest.testCallbackVrS64 { -0x8000000000000000 }).to eq(-0x8000000000000000) + end + + it "returning :long_long (-1)" do + expect(LibTest.testCallbackVrS64 { -1 }).to eq(-1) + end + + it "returning bool" do + expect(LibTest.testCallbackVrZ { true }).to be true + end + + it "returning :pointer (nil)" do + expect(LibTest.testCallbackVrP { nil }).to be_null + end + + it "returning :pointer (MemoryPointer)" do + p = FFI::MemoryPointer.new :long + expect(LibTest.testCallbackVrP { p }).to eq(p) + end + + it "returning struct by value" do + s = LibTest::S8F32S32.new + s[:s8] = 0x12 + s[:s32] = 0x1eefbeef + s[:f32] = 1.234567 + ret = LibTest.testCallbackVrT { s } + expect(ret[:s8]).to eq(s[:s8]) + expect(ret[:f32]).to eq(s[:f32]) + expect(ret[:s32]).to eq(s[:s32]) + + end + + it "struct by value parameter" do + s = LibTest::S8F32S32.new + s[:s8] = 0x12 + s[:s32] = 0x1eefbeef + s[:f32] = 1.234567 + s2 = LibTest::S8F32S32.new + + LibTest.testCallbackTrV(s) do |struct| + s2[:s8] = struct[:s8] + s2[:f32] = struct[:f32] + s2[:s32] = struct[:s32] + end + + expect(s2[:s8]).to eql 0x12 + expect(s2[:s32]).to eql 0x1eefbeef + expect(s2[:f32]).to be_within(0.0000001).of 1.234567 + end + + + it "global variable" do + proc = Proc.new { 0x1e } + LibTest.cbVrS8 = proc + expect(LibTest.testGVarCallbackVrS8(LibTest.pVrS8)).to eq(0x1e) + end + + describe "When the callback is considered optional by the underlying library" do + it "should handle receiving 'nil' in place of the closure" do + expect(LibTest.testOptionalCallbackCrV(nil, 13)).to be_nil + end + end + + describe 'when inlined' do + it 'could be anonymous' do + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + attach_function :testAnonymousCallbackVrS8, :testClosureVrB, [ callback([ ], :char) ], :char + end + expect(LibTest.testAnonymousCallbackVrS8 { 0 }).to eq(0) + end + end + + describe "as return value" do + + it "should not blow up when a callback is defined that returns a callback" do + expect(module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + callback :cb_return_type_1, [ :short ], :short + callback :cb_lookup_1, [ :short ], :cb_return_type_1 + attach_function :testReturnsCallback_1, :testReturnsClosure, [ :cb_lookup_1, :short ], :cb_return_type_1 + end).to be_an_instance_of FFI::Function + end + + it "should return a callback" do + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + callback :cb_return_type, [ :int ], :int + callback :cb_lookup, [ ], :cb_return_type + attach_function :testReturnsCallback, :testReturnsClosure, [ :cb_lookup, :int ], :int + end + + lookup_proc_called = false + return_proc_called = false + + return_proc = Proc.new do |a| + return_proc_called = true + a * 2 + end + lookup_proc = Proc.new do + lookup_proc_called = true + return_proc + end + + val = LibTest.testReturnsCallback(lookup_proc, 0x1234) + expect(val).to eq(0x1234 * 2) + expect(lookup_proc_called).to be true + expect(return_proc_called).to be true + end + + it "should return a method callback" do + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + callback :cb_return_type, [ :int ], :int + callback :cb_lookup, [ ], :cb_return_type + attach_function :testReturnsCallback_2, :testReturnsClosure, [ :cb_lookup, :int ], :int + end + module MethodCallback + def self.lookup + method(:perform) + end + def self.perform num + num * 2 + end + end + + expect(LibTest.testReturnsCallback_2(MethodCallback.method(:lookup), 0x1234)).to eq(0x2468) + end + + it 'should not blow up when a callback takes a callback as argument' do + expect(module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + callback :cb_argument, [ :int ], :int + callback :cb_with_cb_argument, [ :cb_argument, :int ], :int + attach_function :testCallbackAsArgument_2, :testArgumentClosure, [ :cb_with_cb_argument, :int ], :int + end).to be_an_instance_of FFI::Function + end + it 'should be able to use the callback argument' do + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + callback :cb_argument, [ :int ], :int + callback :cb_with_cb_argument, [ :cb_argument, :int ], :int + attach_function :testCallbackAsArgument, :testArgumentClosure, [ :cb_with_cb_argument, :cb_argument, :int ], :int + end + callback_arg_called = false + callback_with_callback_arg_called = false + callback_arg = Proc.new do |val| + callback_arg_called = true + val * 2 + end + callback_with_callback_arg = Proc.new do |cb, val| + callback_with_callback_arg_called = true + cb.call(val) + end + val = LibTest.testCallbackAsArgument(callback_with_callback_arg, callback_arg, 0xff1) + expect(val).to eq(0xff1 * 2) + expect(callback_arg_called).to be true + expect(callback_with_callback_arg_called).to be true + end + it 'function returns callable object' do + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + callback :funcptr, [ :int ], :int + attach_function :testReturnsFunctionPointer, [ ], :funcptr + end + f = LibTest.testReturnsFunctionPointer + expect(f.call(3)).to eq(6) + end + end + +end + + +describe "Callback with " do + # + # Test callbacks that take an argument, returning void + # + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + + class S8F32S32 < FFI::Struct + layout :s8, :char, :f32, :float, :s32, :int + end + + callback :cbS8rV, [ :char ], :void + callback :cbU8rV, [ :uchar ], :void + callback :cbS16rV, [ :short ], :void + callback :cbU16rV, [ :ushort ], :void + + callback :cbZrV, [ :bool ], :void + callback :cbS32rV, [ :int ], :void + callback :cbU32rV, [ :uint ], :void + + callback :cbLrV, [ :long ], :void + callback :cbULrV, [ :ulong ], :void + callback :cbArV, [ :string ], :void + callback :cbPrV, [ :pointer], :void + callback :cbYrV, [ S8F32S32.ptr ], :void + + callback :cbS64rV, [ :long_long ], :void + attach_function :testCallbackCrV, :testClosureBrV, [ :cbS8rV, :char ], :void + attach_function :testCallbackU8rV, :testClosureBrV, [ :cbU8rV, :uchar ], :void + attach_function :testCallbackSrV, :testClosureSrV, [ :cbS16rV, :short ], :void + attach_function :testCallbackU16rV, :testClosureSrV, [ :cbU16rV, :ushort ], :void + attach_function :testCallbackZrV, :testClosureZrV, [ :cbZrV, :bool ], :void + attach_function :testCallbackIrV, :testClosureIrV, [ :cbS32rV, :int ], :void + attach_function :testCallbackU32rV, :testClosureIrV, [ :cbU32rV, :uint ], :void + + attach_function :testCallbackLrV, :testClosureLrV, [ :cbLrV, :long ], :void + attach_function :testCallbackULrV, :testClosureULrV, [ :cbULrV, :ulong ], :void + + attach_function :testCallbackLLrV, :testClosureLLrV, [ :cbS64rV, :long_long ], :void + attach_function :testCallbackArV, :testClosurePrV, [ :cbArV, :string ], :void + attach_function :testCallbackPrV, :testClosurePrV, [ :cbPrV, :pointer], :void + attach_function :testCallbackYrV, :testClosurePrV, [ :cbYrV, S8F32S32.in ], :void + end + + it "function with Callback plus another arg should raise error if no arg given" do + expect { LibTest.testCallbackCrV { |*a| }}.to raise_error + end + + it ":char (0) argument" do + v = 0xdeadbeef + LibTest.testCallbackCrV(0) { |i| v = i } + expect(v).to eq(0) + end + + it ":char (127) argument" do + v = 0xdeadbeef + LibTest.testCallbackCrV(127) { |i| v = i } + expect(v).to eq(127) + end + + it ":char (-128) argument" do + v = 0xdeadbeef + LibTest.testCallbackCrV(-128) { |i| v = i } + expect(v).to eq(-128) + end + + it ":char (-1) argument" do + v = 0xdeadbeef + LibTest.testCallbackCrV(-1) { |i| v = i } + expect(v).to eq(-1) + end + + it ":uchar (0) argument" do + v = 0xdeadbeef + LibTest.testCallbackU8rV(0) { |i| v = i } + expect(v).to eq(0) + end + + it ":uchar (127) argument" do + v = 0xdeadbeef + LibTest.testCallbackU8rV(127) { |i| v = i } + expect(v).to eq(127) + end + + it ":uchar (128) argument" do + v = 0xdeadbeef + LibTest.testCallbackU8rV(128) { |i| v = i } + expect(v).to eq(128) + end + + it ":uchar (255) argument" do + v = 0xdeadbeef + LibTest.testCallbackU8rV(255) { |i| v = i } + expect(v).to eq(255) + end + + it ":short (0) argument" do + v = 0xdeadbeef + LibTest.testCallbackSrV(0) { |i| v = i } + expect(v).to eq(0) + end + + it ":short (0x7fff) argument" do + v = 0xdeadbeef + LibTest.testCallbackSrV(0x7fff) { |i| v = i } + expect(v).to eq(0x7fff) + end + + it ":short (-0x8000) argument" do + v = 0xdeadbeef + LibTest.testCallbackSrV(-0x8000) { |i| v = i } + expect(v).to eq(-0x8000) + end + + it ":short (-1) argument" do + v = 0xdeadbeef + LibTest.testCallbackSrV(-1) { |i| v = i } + expect(v).to eq(-1) + end + + it ":ushort (0) argument" do + v = 0xdeadbeef + LibTest.testCallbackU16rV(0) { |i| v = i } + expect(v).to eq(0) + end + + it ":ushort (0x7fff) argument" do + v = 0xdeadbeef + LibTest.testCallbackU16rV(0x7fff) { |i| v = i } + expect(v).to eq(0x7fff) + end + + it ":ushort (0x8000) argument" do + v = 0xdeadbeef + LibTest.testCallbackU16rV(0x8000) { |i| v = i } + expect(v).to eq(0x8000) + end + + it ":ushort (0xffff) argument" do + v = 0xdeadbeef + LibTest.testCallbackU16rV(0xffff) { |i| v = i } + expect(v).to eq(0xffff) + end + + it ":bool (true) argument" do + v = false + LibTest.testCallbackZrV(true) { |i| v = i } + expect(v).to be true + end + + it ":int (0) argument" do + v = 0xdeadbeef + LibTest.testCallbackIrV(0) { |i| v = i } + expect(v).to eq(0) + end + + it ":int (0x7fffffff) argument" do + v = 0xdeadbeef + LibTest.testCallbackIrV(0x7fffffff) { |i| v = i } + expect(v).to eq(0x7fffffff) + end + + it ":int (-0x80000000) argument" do + v = 0xdeadbeef + LibTest.testCallbackIrV(-0x80000000) { |i| v = i } + expect(v).to eq(-0x80000000) + end + + it ":int (-1) argument" do + v = 0xdeadbeef + LibTest.testCallbackIrV(-1) { |i| v = i } + expect(v).to eq(-1) + end + + it ":uint (0) argument" do + v = 0xdeadbeef + LibTest.testCallbackU32rV(0) { |i| v = i } + expect(v).to eq(0) + end + + it ":uint (0x7fffffff) argument" do + v = 0xdeadbeef + LibTest.testCallbackU32rV(0x7fffffff) { |i| v = i } + expect(v).to eq(0x7fffffff) + end + + it ":uint (0x80000000) argument" do + v = 0xdeadbeef + LibTest.testCallbackU32rV(0x80000000) { |i| v = i } + expect(v).to eq(0x80000000) + end + + it ":uint (0xffffffff) argument" do + v = 0xdeadbeef + LibTest.testCallbackU32rV(0xffffffff) { |i| v = i } + expect(v).to eq(0xffffffff) + end + + it ":long (0) argument" do + v = 0xdeadbeef + LibTest.testCallbackLrV(0) { |i| v = i } + expect(v).to eq(0) + end + + it ":long (0x7fffffff) argument" do + v = 0xdeadbeef + LibTest.testCallbackLrV(0x7fffffff) { |i| v = i } + expect(v).to eq(0x7fffffff) + end + + it ":long (-0x80000000) argument" do + v = 0xdeadbeef + LibTest.testCallbackLrV(-0x80000000) { |i| v = i } + expect(v).to eq(-0x80000000) + end + + it ":long (-1) argument" do + v = 0xdeadbeef + LibTest.testCallbackLrV(-1) { |i| v = i } + expect(v).to eq(-1) + end + + it ":ulong (0) argument" do + v = 0xdeadbeef + LibTest.testCallbackULrV(0) { |i| v = i } + expect(v).to eq(0) + end + + it ":ulong (0x7fffffff) argument" do + v = 0xdeadbeef + LibTest.testCallbackULrV(0x7fffffff) { |i| v = i } + expect(v).to eq(0x7fffffff) + end + + it ":ulong (0x80000000) argument" do + v = 0xdeadbeef + LibTest.testCallbackULrV(0x80000000) { |i| v = i } + expect(v).to eq(0x80000000) + end + + it ":ulong (0xffffffff) argument" do + v = 0xdeadbeef + LibTest.testCallbackULrV(0xffffffff) { |i| v = i } + expect(v).to eq(0xffffffff) + end + + it ":long_long (0) argument" do + v = 0xdeadbeef + LibTest.testCallbackLLrV(0) { |i| v = i } + expect(v).to eq(0) + end + + it ":long_long (0x7fffffffffffffff) argument" do + v = 0xdeadbeef + LibTest.testCallbackLLrV(0x7fffffffffffffff) { |i| v = i } + expect(v).to eq(0x7fffffffffffffff) + end + + it ":long_long (-0x8000000000000000) argument" do + v = 0xdeadbeef + LibTest.testCallbackLLrV(-0x8000000000000000) { |i| v = i } + expect(v).to eq(-0x8000000000000000) + end + + it ":long_long (-1) argument" do + v = 0xdeadbeef + LibTest.testCallbackLLrV(-1) { |i| v = i } + expect(v).to eq(-1) + end + + it ":string argument" do + v = nil + LibTest.testCallbackArV("Hello, World") { |i| v = i } + expect(v).to eq("Hello, World") + end + + it ":string (nil) argument" do + v = "Hello, World" + LibTest.testCallbackArV(nil) { |i| v = i } + expect(v).to be_nil + end + + it ":pointer argument" do + v = nil + magic = FFI::Pointer.new(0xdeadbeef) + LibTest.testCallbackPrV(magic) { |i| v = i } + expect(v).to eq(magic) + end + + it ":pointer (nil) argument" do + v = "Hello, World" + LibTest.testCallbackPrV(nil) { |i| v = i } + expect(v).to eq(FFI::Pointer::NULL) + end + + it "struct by reference argument" do + v = nil + magic = LibTest::S8F32S32.new + LibTest.testCallbackYrV(magic) { |i| v = i } + expect(v.class).to eq(magic.class) + expect(v.pointer).to eq(magic.pointer) + end + + it "struct by reference argument with nil value" do + v = LibTest::S8F32S32.new + LibTest.testCallbackYrV(nil) { |i| v = i } + expect(v.is_a?(FFI::Struct)).to be true + expect(v.pointer).to eq(FFI::Pointer::NULL) + end + + it "varargs parameters are rejected" do + expect { + Module.new do + extend FFI::Library + ffi_lib TestLibrary::PATH + callback :cbVrL, [ :varargs ], :long + end + }.to raise_error(ArgumentError) + end + + # + # Test stdcall convention with function and callback. + # This is Windows 32-bit only. + # + if FFI::Platform::OS =~ /windows|cygwin/ && FFI::Platform::ARCH == 'i386' + module LibTestStdcall + extend FFI::Library + ffi_lib TestLibrary::PATH + ffi_convention :stdcall + + callback :cbStdcall, [ :pointer, :long ], :void + attach_function :testCallbackStdcall, 'testClosureStdcall', [ :pointer, :cbStdcall, :long ], :bool + end + + it "stdcall convention" do + v = 0xdeadbeef + po = FFI::MemoryPointer.new :long + pr = proc{|a,i| v = a,i; i } + res = LibTestStdcall.testCallbackStdcall(po, pr, 0x7fffffff) + expect(v).to eq([po, 0x7fffffff]) + expect(res).to be true + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/custom_param_type.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/custom_param_type.rb new file mode 100644 index 000000000..7d9216bba --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/custom_param_type.rb @@ -0,0 +1,37 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe "functions with custom parameter types" do + before :each do + + Custom_enum = Class.new do + extend FFI::DataConverter + ToNativeMap= { :a => 1, :b => 2 } + FromNativeMap = { 1 => :a, 2 => :b } + + def self.native_type + @native_type_called = true + FFI::Type::INT32 + end + + def self.to_native(val, ctx) + @to_native_called = true + ToNativeMap[val] + end + + def self.from_native(val, ctx) + @from_native_called = true + FromNativeMap[val] + end + def self.native_type_called?; @native_type_called; end + def self.from_native_called?; @from_native_called; end + def self.to_native_called?; @to_native_called; end + end + + # FIXME add tests + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/custom_type_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/custom_type_spec.rb new file mode 100644 index 000000000..d9ce2c1dd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/custom_type_spec.rb @@ -0,0 +1,74 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe "functions with custom types" do + class Custom_enum + extend FFI::DataConverter + ToNativeMap= { :a => 1, :b => 2, :c => 3 } + FromNativeMap = { 1 => :a, 2 => :b, 3 => :c } + + def self.native_type + @native_type_called = true + FFI::Type::INT32 + end + + def self.to_native(val, ctx) + @to_native_called = true + ToNativeMap[val] + end + + def self.from_native(val, ctx) + @from_native_called = true + FromNativeMap[val] + end + def self.native_type_called?; @native_type_called; end + def self.from_native_called?; @from_native_called; end + def self.to_native_called?; @to_native_called; end + end + + it "can attach with custom return type" do + expect do + Module.new do + extend FFI::Library + ffi_lib TestLibrary::PATH + attach_function :ret_s32, [ :int ], Custom_enum + end + end.not_to raise_error + end + + it "should return object of correct type" do + + m = Module.new do + + extend FFI::Library + ffi_lib TestLibrary::PATH + attach_function :ret_s32, [ :int ], Custom_enum + end + + expect(m.ret_s32(1).is_a?(Symbol)).to be true + end + + it "from_native should be called for result" do + m = Module.new do + extend FFI::Library + ffi_lib TestLibrary::PATH + attach_function :ret_s32, [ :int ], Custom_enum + end + m.ret_s32(1) + expect(Custom_enum.from_native_called?).to be true + end + + it "to_native should be called for parameter" do + m = Module.new do + extend FFI::Library + ffi_lib TestLibrary::PATH + attach_function :ret_s32, [ Custom_enum ], :int + end + m.ret_s32(:a) + expect(Custom_enum.to_native_called?).to be true + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/dup_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/dup_spec.rb new file mode 100644 index 000000000..ae6e52383 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/dup_spec.rb @@ -0,0 +1,52 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe "Pointer#dup" do + it "clone should be independent" do + p1 = FFI::MemoryPointer.new(:char, 1024) + p1.put_string(0, "test123"); + p2 = p1.dup + p1.put_string(0, "deadbeef") + + expect(p2.get_string(0)).to eq("test123") + end + + it "sliced pointer can be cloned" do + p1 = FFI::MemoryPointer.new(:char, 1024) + p1.put_string(0, "test123"); + p2 = p1[1].dup + + # first char will be excised + expect(p2.get_string(0)).to eq("est123") + expect(p1.get_string(0)).to eq("test123") + end + + it "sliced pointer when cloned is independent" do + p1 = FFI::MemoryPointer.new(:char, 1024) + p1.put_string(0, "test123"); + p2 = p1[1].dup + + p1.put_string(0, "deadbeef") + # first char will be excised + expect(p2.get_string(0)).to eq("est123") + end +end + + +describe "Struct#dup" do + it "clone should be independent" do + s = Class.new(FFI::Struct) do + layout :i, :int + end + s1 = s.new + s1[:i] = 0x12345 + s2 = s1.dup + s1[:i] = 0x98765 + expect(s2[:i]).to eq(0x12345) + expect(s1[:i]).to eq(0x98765) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/enum_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/enum_spec.rb new file mode 100644 index 000000000..55ff13a6b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/enum_spec.rb @@ -0,0 +1,423 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +module TestEnum0 + extend FFI::Library +end + +module TestEnum1 + extend FFI::Library + ffi_lib TestLibrary::PATH + + enum [:c1, :c2, :c3, :c4] + enum [:c5, 42, :c6, :c7, :c8] + enum [:c9, 42, :c10, :c11, 4242, :c12] + enum [:c13, 42, :c14, 4242, :c15, 424242, :c16, 42424242] + + attach_function :test_untagged_enum, [:int], :int +end + +module TestEnum3 + extend FFI::Library + ffi_lib TestLibrary::PATH + + enum :enum_type1, [:c1, :c2, :c3, :c4] + enum :enum_type2, [:c5, 42, :c6, :c7, :c8] + enum :enum_type3, [:c9, 42, :c10, :c11, 4242, :c12] + enum :enum_type4, [:c13, 42, :c14, 4242, :c15, 424242, :c16, 42424242] + + attach_function :test_tagged_typedef_enum1, [:enum_type1], :enum_type1 + attach_function :test_tagged_typedef_enum2, [:enum_type2], :enum_type2 + attach_function :test_tagged_typedef_enum3, [:enum_type3], :enum_type3 + attach_function :test_tagged_typedef_enum4, [:enum_type4], :enum_type4 +end + +module TestEnum4 + extend FFI::Library + ffi_lib TestLibrary::PATH + + enum [:c1, :c2, :c3, :c4] + enum :enum_type1, [:c5, 0x42, :c6, :c7, :c8] + enum :enum_type2, [:c9, 0x42, :c10, :c11, 0x4242, :c12] + enum :enum_type3, [:c13, 0x42, :c14, 0x4242, :c15, 0x42424242, :c16, 0x4242424242424242] + enum FFI::Type::UINT16, :enum_type4, [:c17, 0x42, :c18, :c19, :c20] + enum FFI::Type::UINT32, :enum_type5, [:c21, 0x42, :c22, :c23, 0x4242, :c24] + enum FFI::Type::UINT64, :enum_type6, [:c25, 0x42, :c26, 0x4242, :c27, 0x42424242, :c28, 0x4242424242424242] + enum FFI::Type::UINT64, [:c29, 0x4242424242424242, :c30, :c31, :c32] + + attach_function :test_untagged_nonint_enum, [:uint8], :uint8 + attach_function :test_tagged_nonint_enum1, [:uint16], :uint16 + attach_function :test_tagged_nonint_enum2, [:uint32], :uint32 + attach_function :test_tagged_nonint_enum3, [:uint64], :uint64 + attach_function :test_tagged_nonint_enum4, :test_tagged_nonint_enum1, [:enum_type4], :enum_type4 + attach_function :test_tagged_nonint_enum5, :test_tagged_nonint_enum2, [:enum_type5], :enum_type5 + attach_function :test_tagged_nonint_enum6, :test_tagged_nonint_enum3, [:enum_type6], :enum_type6 +end + +describe "A library with no enum defined" do + it "returns nil when asked for an enum" do + expect(TestEnum0.enum_type(:foo)).to be_nil + end +end + +describe "An untagged enum" do + it "constants can be used as function parameters and return value" do + expect(TestEnum1.test_untagged_enum(:c1)).to eq(0) + expect(TestEnum1.test_untagged_enum(:c2)).to eq(1) + expect(TestEnum1.test_untagged_enum(:c3)).to eq(2) + expect(TestEnum1.test_untagged_enum(:c4)).to eq(3) + expect(TestEnum1.test_untagged_enum(:c5)).to eq(42) + expect(TestEnum1.test_untagged_enum(:c6)).to eq(43) + expect(TestEnum1.test_untagged_enum(:c7)).to eq(44) + expect(TestEnum1.test_untagged_enum(:c8)).to eq(45) + expect(TestEnum1.test_untagged_enum(:c9)).to eq(42) + expect(TestEnum1.test_untagged_enum(:c10)).to eq(43) + expect(TestEnum1.test_untagged_enum(:c11)).to eq(4242) + expect(TestEnum1.test_untagged_enum(:c12)).to eq(4243) + expect(TestEnum1.test_untagged_enum(:c13)).to eq(42) + expect(TestEnum1.test_untagged_enum(:c14)).to eq(4242) + expect(TestEnum1.test_untagged_enum(:c15)).to eq(424242) + expect(TestEnum1.test_untagged_enum(:c16)).to eq(42424242) + expect(TestEnum4.test_untagged_nonint_enum(:c1)).to eq(0) + expect(TestEnum4.test_untagged_nonint_enum(:c2)).to eq(1) + expect(TestEnum4.test_untagged_nonint_enum(:c3)).to eq(2) + expect(TestEnum4.test_untagged_nonint_enum(:c4)).to eq(3) + expect(TestEnum4.test_tagged_nonint_enum3(:c29)).to eq(0x4242424242424242) + expect(TestEnum4.test_tagged_nonint_enum3(:c30)).to eq(0x4242424242424243) + expect(TestEnum4.test_tagged_nonint_enum3(:c31)).to eq(0x4242424242424244) + expect(TestEnum4.test_tagged_nonint_enum3(:c32)).to eq(0x4242424242424245) + end +end + +describe "A tagged typedef enum" do + it "is accessible through its tag" do + expect(TestEnum3.enum_type(:enum_type1)).not_to be_nil + expect(TestEnum3.enum_type(:enum_type2)).not_to be_nil + expect(TestEnum3.enum_type(:enum_type3)).not_to be_nil + expect(TestEnum3.enum_type(:enum_type4)).not_to be_nil + expect(TestEnum4.enum_type(:enum_type1)).not_to be_nil + expect(TestEnum4.enum_type(:enum_type2)).not_to be_nil + expect(TestEnum4.enum_type(:enum_type3)).not_to be_nil + expect(TestEnum4.enum_type(:enum_type4)).not_to be_nil + expect(TestEnum4.enum_type(:enum_type5)).not_to be_nil + expect(TestEnum4.enum_type(:enum_type6)).not_to be_nil + end + + it "contains enum constants" do + expect(TestEnum3.enum_type(:enum_type1).symbols.length).to eq(4) + expect(TestEnum3.enum_type(:enum_type2).symbols.length).to eq(4) + expect(TestEnum3.enum_type(:enum_type3).symbols.length).to eq(4) + expect(TestEnum3.enum_type(:enum_type4).symbols.length).to eq(4) + expect(TestEnum4.enum_type(:enum_type1).symbols.length).to eq(4) + expect(TestEnum4.enum_type(:enum_type2).symbols.length).to eq(4) + expect(TestEnum4.enum_type(:enum_type3).symbols.length).to eq(4) + expect(TestEnum4.enum_type(:enum_type4).symbols.length).to eq(4) + expect(TestEnum4.enum_type(:enum_type5).symbols.length).to eq(4) + expect(TestEnum4.enum_type(:enum_type6).symbols.length).to eq(4) + end + + it "constants can be used as function parameters and return value" do + expect(TestEnum3.test_tagged_typedef_enum1(:c1)).to be :c1 + expect(TestEnum3.test_tagged_typedef_enum1(:c2)).to be :c2 + expect(TestEnum3.test_tagged_typedef_enum1(:c3)).to be :c3 + expect(TestEnum3.test_tagged_typedef_enum1(:c4)).to be :c4 + expect(TestEnum3.test_tagged_typedef_enum2(:c5)).to be :c5 + expect(TestEnum3.test_tagged_typedef_enum2(:c6)).to be :c6 + expect(TestEnum3.test_tagged_typedef_enum2(:c7)).to be :c7 + expect(TestEnum3.test_tagged_typedef_enum2(:c8)).to be :c8 + expect(TestEnum3.test_tagged_typedef_enum3(:c9)).to be :c9 + expect(TestEnum3.test_tagged_typedef_enum3(:c10)).to be :c10 + expect(TestEnum3.test_tagged_typedef_enum3(:c11)).to be :c11 + expect(TestEnum3.test_tagged_typedef_enum3(:c12)).to be :c12 + expect(TestEnum3.test_tagged_typedef_enum4(:c13)).to be :c13 + expect(TestEnum3.test_tagged_typedef_enum4(:c14)).to be :c14 + expect(TestEnum3.test_tagged_typedef_enum4(:c15)).to be :c15 + expect(TestEnum3.test_tagged_typedef_enum4(:c16)).to be :c16 + expect(TestEnum4.test_tagged_nonint_enum1(:c5)).to eq(0x42) + expect(TestEnum4.test_tagged_nonint_enum1(:c6)).to eq(0x43) + expect(TestEnum4.test_tagged_nonint_enum1(:c7)).to eq(0x44) + expect(TestEnum4.test_tagged_nonint_enum1(:c8)).to eq(0x45) + expect(TestEnum4.test_tagged_nonint_enum2(:c9)).to eq(0x42) + expect(TestEnum4.test_tagged_nonint_enum2(:c10)).to eq(0x43) + expect(TestEnum4.test_tagged_nonint_enum2(:c11)).to eq(0x4242) + expect(TestEnum4.test_tagged_nonint_enum2(:c12)).to eq(0x4243) + expect(TestEnum4.test_tagged_nonint_enum3(:c13)).to eq(0x42) + expect(TestEnum4.test_tagged_nonint_enum3(:c14)).to eq(0x4242) + expect(TestEnum4.test_tagged_nonint_enum3(:c15)).to eq(0x42424242) + expect(TestEnum4.test_tagged_nonint_enum3(:c16)).to eq(0x4242424242424242) + expect(TestEnum4.test_tagged_nonint_enum4(:c17)).to eq(:c17) + expect(TestEnum4.test_tagged_nonint_enum4(:c18)).to eq(:c18) + expect(TestEnum4.test_tagged_nonint_enum4(:c19)).to eq(:c19) + expect(TestEnum4.test_tagged_nonint_enum4(:c20)).to eq(:c20) + expect(TestEnum4.test_tagged_nonint_enum5(:c21)).to eq(:c21) + expect(TestEnum4.test_tagged_nonint_enum5(:c22)).to eq(:c22) + expect(TestEnum4.test_tagged_nonint_enum5(:c23)).to eq(:c23) + expect(TestEnum4.test_tagged_nonint_enum5(:c24)).to eq(:c24) + expect(TestEnum4.test_tagged_nonint_enum6(:c25)).to eq(:c25) + expect(TestEnum4.test_tagged_nonint_enum6(:c26)).to eq(:c26) + expect(TestEnum4.test_tagged_nonint_enum6(:c27)).to eq(:c27) + expect(TestEnum4.test_tagged_nonint_enum6(:c28)).to eq(:c28) + end + + it "integers can be used instead of constants" do + expect(TestEnum3.test_tagged_typedef_enum1(0)).to be :c1 + expect(TestEnum3.test_tagged_typedef_enum1(1)).to be :c2 + expect(TestEnum3.test_tagged_typedef_enum1(2)).to be :c3 + expect(TestEnum3.test_tagged_typedef_enum1(3)).to be :c4 + expect(TestEnum3.test_tagged_typedef_enum2(42)).to be :c5 + expect(TestEnum3.test_tagged_typedef_enum2(43)).to be :c6 + expect(TestEnum3.test_tagged_typedef_enum2(44)).to be :c7 + expect(TestEnum3.test_tagged_typedef_enum2(45)).to be :c8 + expect(TestEnum3.test_tagged_typedef_enum3(42)).to be :c9 + expect(TestEnum3.test_tagged_typedef_enum3(43)).to be :c10 + expect(TestEnum3.test_tagged_typedef_enum3(4242)).to be :c11 + expect(TestEnum3.test_tagged_typedef_enum3(4243)).to be :c12 + expect(TestEnum3.test_tagged_typedef_enum4(42)).to be :c13 + expect(TestEnum3.test_tagged_typedef_enum4(4242)).to be :c14 + expect(TestEnum3.test_tagged_typedef_enum4(424242)).to be :c15 + expect(TestEnum3.test_tagged_typedef_enum4(42424242)).to be :c16 + expect(TestEnum4.test_tagged_nonint_enum4(0x42)).to eq(:c17) + expect(TestEnum4.test_tagged_nonint_enum4(0x43)).to eq(:c18) + expect(TestEnum4.test_tagged_nonint_enum4(0x44)).to eq(:c19) + expect(TestEnum4.test_tagged_nonint_enum4(0x45)).to eq(:c20) + expect(TestEnum4.test_tagged_nonint_enum5(0x42)).to eq(:c21) + expect(TestEnum4.test_tagged_nonint_enum5(0x43)).to eq(:c22) + expect(TestEnum4.test_tagged_nonint_enum5(0x4242)).to eq(:c23) + expect(TestEnum4.test_tagged_nonint_enum5(0x4243)).to eq(:c24) + expect(TestEnum4.test_tagged_nonint_enum6(0x42)).to eq(:c25) + expect(TestEnum4.test_tagged_nonint_enum6(0x4242)).to eq(:c26) + expect(TestEnum4.test_tagged_nonint_enum6(0x42424242)).to eq(:c27) + expect(TestEnum4.test_tagged_nonint_enum6(0x4242424242424242)).to eq(:c28) + end +end + +describe "All enums" do + it "have autonumbered constants when defined with names only" do + expect(TestEnum1.enum_value(:c1)).to eq(0) + expect(TestEnum1.enum_value(:c2)).to eq(1) + expect(TestEnum1.enum_value(:c3)).to eq(2) + expect(TestEnum1.enum_value(:c4)).to eq(3) + + expect(TestEnum3.enum_value(:c1)).to eq(0) + expect(TestEnum3.enum_value(:c2)).to eq(1) + expect(TestEnum3.enum_value(:c3)).to eq(2) + expect(TestEnum3.enum_value(:c4)).to eq(3) + + expect(TestEnum4.enum_value(:c1)).to eq(0) + expect(TestEnum4.enum_value(:c2)).to eq(1) + expect(TestEnum4.enum_value(:c3)).to eq(2) + expect(TestEnum4.enum_value(:c4)).to eq(3) + end + + it "can have an explicit first constant and autonumbered subsequent constants" do + expect(TestEnum1.enum_value(:c5)).to eq(42) + expect(TestEnum1.enum_value(:c6)).to eq(43) + expect(TestEnum1.enum_value(:c7)).to eq(44) + expect(TestEnum1.enum_value(:c8)).to eq(45) + + expect(TestEnum3.enum_value(:c5)).to eq(42) + expect(TestEnum3.enum_value(:c6)).to eq(43) + expect(TestEnum3.enum_value(:c7)).to eq(44) + expect(TestEnum3.enum_value(:c8)).to eq(45) + + expect(TestEnum4.enum_value(:c5)).to eq(0x42) + expect(TestEnum4.enum_value(:c6)).to eq(0x43) + expect(TestEnum4.enum_value(:c7)).to eq(0x44) + expect(TestEnum4.enum_value(:c8)).to eq(0x45) + + expect(TestEnum4.enum_value(:c29)).to eq(0x4242424242424242) + expect(TestEnum4.enum_value(:c30)).to eq(0x4242424242424243) + expect(TestEnum4.enum_value(:c31)).to eq(0x4242424242424244) + expect(TestEnum4.enum_value(:c32)).to eq(0x4242424242424245) + end + + it "can have a mix of explicit and autonumbered constants" do + expect(TestEnum1.enum_value(:c9)).to eq(42) + expect(TestEnum1.enum_value(:c10)).to eq(43) + expect(TestEnum1.enum_value(:c11)).to eq(4242) + expect(TestEnum1.enum_value(:c12)).to eq(4243) + + expect(TestEnum3.enum_value(:c9)).to eq(42) + expect(TestEnum3.enum_value(:c10)).to eq(43) + expect(TestEnum3.enum_value(:c11)).to eq(4242) + expect(TestEnum3.enum_value(:c12)).to eq(4243) + + expect(TestEnum4.enum_value(:c9)).to eq(0x42) + expect(TestEnum4.enum_value(:c10)).to eq(0x43) + expect(TestEnum4.enum_value(:c11)).to eq(0x4242) + expect(TestEnum4.enum_value(:c12)).to eq(0x4243) + + expect(TestEnum4.enum_value(:c21)).to eq(0x42) + expect(TestEnum4.enum_value(:c22)).to eq(0x43) + expect(TestEnum4.enum_value(:c23)).to eq(0x4242) + expect(TestEnum4.enum_value(:c24)).to eq(0x4243) + end + + it "can have all its constants explicitely valued" do + expect(TestEnum1.enum_value(:c13)).to eq(42) + expect(TestEnum1.enum_value(:c14)).to eq(4242) + expect(TestEnum1.enum_value(:c15)).to eq(424242) + expect(TestEnum1.enum_value(:c16)).to eq(42424242) + + expect(TestEnum3.enum_value(:c13)).to eq(42) + expect(TestEnum3.enum_value(:c14)).to eq(4242) + expect(TestEnum3.enum_value(:c15)).to eq(424242) + expect(TestEnum3.enum_value(:c16)).to eq(42424242) + + expect(TestEnum4.enum_value(:c13)).to eq(0x42) + expect(TestEnum4.enum_value(:c14)).to eq(0x4242) + expect(TestEnum4.enum_value(:c15)).to eq(0x42424242) + expect(TestEnum4.enum_value(:c16)).to eq(0x4242424242424242) + + expect(TestEnum4.enum_value(:c25)).to eq(0x42) + expect(TestEnum4.enum_value(:c26)).to eq(0x4242) + expect(TestEnum4.enum_value(:c27)).to eq(0x42424242) + expect(TestEnum4.enum_value(:c28)).to eq(0x4242424242424242) + end + + it "return the constant corresponding to a specific value" do + enum = TestEnum3.enum_type(:enum_type1) + expect(enum[0]).to be :c1 + expect(enum[1]).to be :c2 + expect(enum[2]).to be :c3 + expect(enum[3]).to be :c4 + + enum = TestEnum3.enum_type(:enum_type2) + expect(enum[42]).to be :c5 + expect(enum[43]).to be :c6 + expect(enum[44]).to be :c7 + expect(enum[45]).to be :c8 + + enum = TestEnum3.enum_type(:enum_type3) + expect(enum[42]).to be :c9 + expect(enum[43]).to be :c10 + expect(enum[4242]).to be :c11 + expect(enum[4243]).to be :c12 + + enum = TestEnum3.enum_type(:enum_type4) + expect(enum[42]).to be :c13 + expect(enum[4242]).to be :c14 + expect(enum[424242]).to be :c15 + expect(enum[42424242]).to be :c16 + + enum = TestEnum4.enum_type(:enum_type1) + expect(enum[0x42]).to eq(:c5) + expect(enum[0x43]).to eq(:c6) + expect(enum[0x44]).to eq(:c7) + expect(enum[0x45]).to eq(:c8) + + enum = TestEnum4.enum_type(:enum_type2) + expect(enum[0x42]).to eq(:c9) + expect(enum[0x43]).to eq(:c10) + expect(enum[0x4242]).to eq(:c11) + expect(enum[0x4243]).to eq(:c12) + + enum = TestEnum4.enum_type(:enum_type3) + expect(enum[0x42]).to eq(:c13) + expect(enum[0x4242]).to eq(:c14) + expect(enum[0x42424242]).to eq(:c15) + expect(enum[0x4242424242424242]).to eq(:c16) + + enum = TestEnum4.enum_type(:enum_type4) + expect(enum[0x42]).to eq(:c17) + expect(enum[0x43]).to eq(:c18) + expect(enum[0x44]).to eq(:c19) + expect(enum[0x45]).to eq(:c20) + + enum = TestEnum4.enum_type(:enum_type5) + expect(enum[0x42]).to eq(:c21) + expect(enum[0x43]).to eq(:c22) + expect(enum[0x4242]).to eq(:c23) + expect(enum[0x4243]).to eq(:c24) + + enum = TestEnum4.enum_type(:enum_type6) + expect(enum[0x42]).to eq(:c25) + expect(enum[0x4242]).to eq(:c26) + expect(enum[0x42424242]).to eq(:c27) + expect(enum[0x4242424242424242]).to eq(:c28) + end + + it "return nil for values that don't have a symbol" do + enum = TestEnum3.enum_type(:enum_type1) + expect(enum[-1]).to be_nil + expect(enum[4]).to be_nil + + enum = TestEnum3.enum_type(:enum_type2) + expect(enum[0]).to be_nil + expect(enum[41]).to be_nil + expect(enum[46]).to be_nil + + enum = TestEnum3.enum_type(:enum_type3) + expect(enum[0]).to be_nil + expect(enum[41]).to be_nil + expect(enum[44]).to be_nil + expect(enum[4241]).to be_nil + expect(enum[4244]).to be_nil + + enum = TestEnum3.enum_type(:enum_type4) + expect(enum[0]).to be_nil + expect(enum[41]).to be_nil + expect(enum[43]).to be_nil + expect(enum[4241]).to be_nil + expect(enum[4243]).to be_nil + expect(enum[424241]).to be_nil + expect(enum[424243]).to be_nil + expect(enum[42424241]).to be_nil + expect(enum[42424243]).to be_nil + + enum = TestEnum4.enum_type(:enum_type1) + expect(enum[0x0]).to be_nil + expect(enum[0x41]).to be_nil + expect(enum[0x46]).to be_nil + + enum = TestEnum4.enum_type(:enum_type2) + expect(enum[0x0]).to be_nil + expect(enum[0x41]).to be_nil + expect(enum[0x44]).to be_nil + expect(enum[0x4241]).to be_nil + expect(enum[0x4244]).to be_nil + + enum = TestEnum4.enum_type(:enum_type3) + expect(enum[0x0]).to be_nil + expect(enum[0x41]).to be_nil + expect(enum[0x43]).to be_nil + expect(enum[0x4241]).to be_nil + expect(enum[0x4243]).to be_nil + expect(enum[0x42424241]).to be_nil + expect(enum[0x42424243]).to be_nil + expect(enum[0x4242424242424241]).to be_nil + expect(enum[0x4242424242424243]).to be_nil + + enum = TestEnum4.enum_type(:enum_type4) + expect(enum[0x0]).to be_nil + expect(enum[0x41]).to be_nil + expect(enum[0x46]).to be_nil + + enum = TestEnum4.enum_type(:enum_type5) + expect(enum[0x0]).to be_nil + expect(enum[0x41]).to be_nil + expect(enum[0x44]).to be_nil + expect(enum[0x4241]).to be_nil + expect(enum[0x4244]).to be_nil + + enum = TestEnum4.enum_type(:enum_type6) + expect(enum[0x0]).to be_nil + expect(enum[0x41]).to be_nil + expect(enum[0x43]).to be_nil + expect(enum[0x4241]).to be_nil + expect(enum[0x4243]).to be_nil + expect(enum[0x42424241]).to be_nil + expect(enum[0x42424243]).to be_nil + expect(enum[0x4242424242424241]).to be_nil + expect(enum[0x4242424242424243]).to be_nil + end + + it "duplicate enum keys rejected" do + expect { enum [ :a, 0xfee1dead, :b, 0xdeadbeef, :a, 0 ] }.to raise_error + expect { enum FFI::Type::UINT64, [ :a, 0xfee1dead, :b, 0xdeadbeef, :a, 0 ] }.to raise_error + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/errno_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/errno_spec.rb new file mode 100644 index 000000000..61cbda2e0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/errno_spec.rb @@ -0,0 +1,20 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe "FFI.errno" do + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + attach_function :setLastError, [ :int ], :void + end + + it "FFI.errno contains errno from last function" do + LibTest.setLastError(0) + LibTest.setLastError(0x12345678) + expect(FFI.errno).to eq(0x12345678) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/ffi_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/ffi_spec.rb new file mode 100644 index 000000000..bb93f3765 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/ffi_spec.rb @@ -0,0 +1,28 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe "FFI" do + + describe ".map_library_name" do + + let(:prefix) { FFI::Platform::LIBPREFIX } + let(:suffix) { FFI::Platform::LIBSUFFIX } + + it "should add platform library extension if not present" do + expect(FFI.map_library_name("#{prefix}dummy")).to eq("#{prefix}dummy.#{suffix}") + end + + it "should add platform library extension even if lib suffix is present in name" do + expect(FFI.map_library_name("#{prefix}dummy_with_#{suffix}")).to eq("#{prefix}dummy_with_#{suffix}.#{suffix}") + end + + it "should return Platform::LIBC when called with 'c'" do + expect(FFI.map_library_name('c')).to eq(FFI::Library::LIBC) + end + + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/Benchmark.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/Benchmark.c new file mode 100644 index 000000000..55a73806a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/Benchmark.c @@ -0,0 +1,52 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ +#include +#include + +void returnVoid() { + +} + +void returnVoidI(int arg) { + +} +int returnInt() { + return 0; +} + +int returnIntI(int arg) { + return arg; +} + +typedef int8_t s8; +typedef uint8_t u8; +typedef int16_t s16; +typedef uint16_t u16; +typedef int32_t s32; +typedef uint32_t u32; +typedef int64_t s64; +typedef uint64_t u64; +typedef float f32; +typedef double f64; +typedef void v; +typedef char* S; +typedef void* P; + +#define B6(R, T1, T2, T3, T4, T5, T6) R bench_##T1##T2##T3##T4##T5##T6##_##R(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5, T6 a6) {} +#define B5(R, T1, T2, T3, T4, T5) R bench_##T1##T2##T3##T4##T5##_##R(T1 a1, T2 a2, T3 a3, T4 a4, T5 a5) {} +#define B4(R, T1, T2, T3, T4) R bench_##T1##T2##T3##T4##_##R(T1 a1, T2 a2, T3 a3, T4 a4) {} +#define B3(R, T1, T2, T3) R bench_##T1##T2##T3##_##R(T1 a1, T2 a2, T3 a3) {} +#define B2(R, T1, T2) R bench_##T1##T2##_##R(T1 a1, T2 a2) {} +#define B1(R, T1) R bench_##T1##_##R(T1 a1) {} +#define BrV(T) B1(v, T); B2(v, T, T); B3(v, T, T, T); B4(v, T, T, T, T); B5(v, T, T, T, T, T); B6(v, T, T, T, T, T, T); +BrV(u32); +BrV(s32); +BrV(s64); +BrV(u64); +BrV(f32); +BrV(f64); +BrV(S); +BrV(P); diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/BoolTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/BoolTest.c new file mode 100644 index 000000000..04cb6c689 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/BoolTest.c @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2007 Wayne Meissner. + * Copyright (c) 2009 Aman Gupta. + * + * All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include + +bool +bool_return_true() +{ + return true; +} + +bool +bool_return_false() +{ + return false; +} + +bool +bool_return_val(bool value) +{ + return value; +} + +bool +bool_reverse_val(bool value) +{ + return value ? false : true; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/BufferTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/BufferTest.c new file mode 100644 index 000000000..3e95ebcf2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/BufferTest.c @@ -0,0 +1,31 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + + +#define MEMSET(buf, value, size) do { \ + int i; for (i = 0; i < size; ++i) buf[i] = value; \ +} while(0) +#define MEMCPY(dst, src, size) do { \ + int i; for (i = 0; i < size; ++i) dst[i] = src[i]; \ +} while(0) + +#define FILL(JTYPE, CTYPE) \ +void fill##JTYPE##Buffer(CTYPE* buf, CTYPE value, int size) { MEMSET(buf, value, size); } + +#define COPY(JTYPE, CTYPE) \ +void copy##JTYPE##Buffer(CTYPE* dst, CTYPE* src, int size) { MEMCPY(dst, src, size); } + +#define FUNC(JTYPE, CTYPE) \ + FILL(JTYPE, CTYPE); \ + COPY(JTYPE, CTYPE) + +FUNC(Byte, char); +FUNC(Short, short); +FUNC(Int, int); +FUNC(Long, long long); +FUNC(Float, float); +FUNC(Double, double); + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/ClosureTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/ClosureTest.c new file mode 100644 index 000000000..64ea2b431 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/ClosureTest.c @@ -0,0 +1,190 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include +#include +#ifndef _WIN32 +# include +#else +# include +# include +#endif + +#define R(T, rtype) rtype testClosureVr##T(rtype (*closure)(void)) { \ + return closure != NULL ? (*closure)() : (rtype) 0; \ +} + +#define P(T, ptype) void testClosure##T##rV(void (*closure)(ptype), ptype a1) { \ + if (closure != NULL) (*closure)(a1); \ +} + +void testClosureVrV(void (*closure)(void)) +{ + (*closure)(); +} + +R(Z, bool); +R(B, char); +R(S, short); +R(I, int); +R(L, long); +R(J, long long); +R(LL, long long); +R(F, float); +R(D, double); +R(P, const void*); + + +P(Z, bool); +P(B, char); +P(S, short); +P(I, int); +P(L, long); +P(J, long long); +P(LL, long long); +P(F, float); +P(D, double); +P(P, const void*); +P(UL, unsigned long); + +void testOptionalClosureBrV(void (*closure)(char), char a1) +{ + if (closure) { + (*closure)(a1); + } +} + + +struct ThreadVrV { + void (*closure)(void); + int count; +}; + +static void * +threadVrV(void *arg) +{ + struct ThreadVrV* t = (struct ThreadVrV *) arg; + + int i; + for (i = 0; i < t->count; i++) { + (*t->closure)(); + } + + return NULL; +} + +void testThreadedClosureVrV(void (*closure)(void), int n) +{ + struct ThreadVrV arg = {closure, n}; +#ifndef _WIN32 + pthread_t t; + pthread_create(&t, NULL, threadVrV, &arg); + pthread_join(t, NULL); +#else + HANDLE hThread = (HANDLE) _beginthread((void (*)(void *))threadVrV, 0, &arg); + WaitForSingleObject(hThread, INFINITE); +#endif +} + +struct s8f32s32 { + char s8; + float f32; + int s32; +}; + +// Takes a struct argument +void testClosureTrV(void (*closure)(struct s8f32s32 s), struct s8f32s32* s) +{ + (*closure)(*s); +} + +// Returns a struct value +struct s8f32s32 testClosureVrT(struct s8f32s32 (*closure)()) +{ + return (*closure)(); +} + +typedef int (*returnTypeClosure_t)(int) ; +typedef returnTypeClosure_t (*lookupClosure_t)(); + +int testReturnsClosure(lookupClosure_t lookup, int val) +{ + returnTypeClosure_t func = lookup ? (*lookup)() : NULL; + return func ? (*func)(val) : 0; +} + +static int multiplyByTwo(int value) +{ + return value * 2; +} + +returnTypeClosure_t testReturnsFunctionPointer() +{ + return multiplyByTwo; +} + +typedef int (*argumentClosure_t)(int); +typedef int (*withArgumentClosure_t)(argumentClosure_t, int); + +int testArgumentClosure(withArgumentClosure_t closure_with, argumentClosure_t closure_arg, int val) +{ + return (*closure_with)(closure_arg, val); +} + + +// +// These macros produce functions of the form: +// testClosureBIrV(void (*closure)(char, int), char a1, int a2) {} +// +#define C2_(J1, J2, N1, N2) \ +void testClosure##J1##J2##rV(void (*closure)(N1, N2), N1 a1, N2 a2) \ +{ \ + if (closure != NULL) (*closure)(a1, a2); \ +} + +#define C2(J, N) \ + C2_(B, J, char, N) \ + C2_(S, J, short, N) \ + C2_(I, J, int, N) \ + C2_(LL, J, long long, N) \ + C2_(F, J, float, N) \ + C2_(D, J, double, N) \ + + +C2(B, char); +C2(S, short); +C2(I, int); +C2(LL, long long); +C2(F, float); +C2(D, double); + +#define C3_(J1, J2, J3, N1, N2, N3) \ +void testClosure##J1##J2##J3##rV(void (*closure)(N1, N2, N3), N1 a1, N2 a2, N3 a3) \ +{ \ + (*closure)(a1, a2, a3); \ +} + + +#define C3(J, N) \ + C3_(B, J, B, char, N, char) \ + C3_(S, J, S, short, N, short) \ + C3_(I, J, I, int, N, int) \ + C3_(LL, J, LL, long long, N, long long) \ + C3_(F, J, F, float, N, float) \ + C3_(D, J, D, double, N, double) \ + +C3(B, char); +C3(S, short); +C3(I, int); +C3(LL, long long); +C3(F, float); +C3(D, double); +C3_(B, S, I, char, short, int); +C3_(B, S, LL, char, short, long long); +C3_(LL, S, B, long long, short, char); +C3_(LL, B, S, long long, char, short); + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/EnumTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/EnumTest.c new file mode 100644 index 000000000..4bf8d236b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/EnumTest.c @@ -0,0 +1,51 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ +#include + +int test_untagged_enum(int val) { + return val; +} + +int test_untagged_typedef_enum(int val) { + return val; +} + +uint8_t test_untagged_nonint_enum(uint8_t val) { + return val; +} + +uint16_t test_tagged_nonint_enum1(uint16_t val) { + return val; +} + +uint32_t test_tagged_nonint_enum2(uint32_t val) { + return val; +} + +uint64_t test_tagged_nonint_enum3(uint64_t val) { + return val; +} + +typedef enum {c1, c2, c3, c4} enum_type1; +enum_type1 test_tagged_typedef_enum1(enum_type1 val) { + return val; +} + +typedef enum {c5 = 42, c6, c7, c8} enum_type2; +enum_type2 test_tagged_typedef_enum2(enum_type2 val) { + return val; +} + +typedef enum {c9 = 42, c10, c11 = 4242, c12} enum_type3; +enum_type3 test_tagged_typedef_enum3(enum_type3 val) { + return val; +} + +typedef enum {c13 = 42, c14 = 4242, c15 = 424242, c16 = 42424242} enum_type4; +enum_type4 test_tagged_typedef_enum4(enum_type4 val) { + return val; +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/FunctionTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/FunctionTest.c new file mode 100644 index 000000000..b4d45bbb4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/FunctionTest.c @@ -0,0 +1,58 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#ifdef _WIN32 +#include +#define sleep(x) Sleep(x) +#endif + +#ifndef _WIN32 +#include +#include +#endif + +int testAdd(int a, int b) +{ + return a + b; +}; + +int testFunctionAdd(int a, int b, int (*f)(int, int)) +{ + return f(a, b); +}; + +void testBlocking(int seconds) { + sleep(seconds); +}; + +struct async_data { + void (*fn)(int); + int value; +}; + +static void* asyncThreadCall(void *data) +{ + struct async_data* d = (struct async_data *) data; + if (d != NULL && d->fn != NULL) { + (*d->fn)(d->value); + } + + return NULL; +} + +void testAsyncCallback(void (*fn)(int), int value) +{ +#ifndef _WIN32 + pthread_t t; + struct async_data d; + d.fn = fn; + d.value = value; + pthread_create(&t, NULL, asyncThreadCall, &d); + pthread_join(t, NULL); +#else + (*fn)(value); +#endif +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/GNUmakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/GNUmakefile new file mode 100644 index 000000000..d73041916 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/GNUmakefile @@ -0,0 +1,149 @@ +# -*- makefile -*- + +ifeq ($(OS),) + BUILD_OS := $(shell uname -s | tr '[:upper:]' '[:lower:]') + OS := $(BUILD_OS) +endif + +ifeq ($(CPU),) + CPU := $(shell uname -m | sed -e 's/i[345678]86/i386/') +endif + +PLATFORM = $(CPU)-$(OS) + +ifeq ($(OS), sunos) + OS = solaris +endif + +SRC_DIR = . +BUILD_DIR ?= . +TEST_BUILD_DIR = . +# Set defaults to unix (linux/solaris/bsd) +PREFIX = lib +LIBEXT ?= so +LIBNAME = $(PREFIX)test.$(LIBEXT) + +export MACOSX_DEPLOYMENT_TARGET=10.4 + +CCACHE := $(strip $(realpath $(shell which ccache 2> /dev/null))) + +TEST_SRCS = $(wildcard $(SRC_DIR)/*.c) +TEST_OBJS := $(patsubst $(SRC_DIR)/%.c, $(TEST_BUILD_DIR)/%.o, $(TEST_SRCS)) + +# +# Compiler/linker flags from: +# http://weblogs.java.net/blog/kellyohair/archive/2006/01/compilation_of_1.html +JFLAGS = -fno-omit-frame-pointer -fno-strict-aliasing +OFLAGS = -O2 $(JFLAGS) +WFLAGS = -W -Wall -Wno-unused -Wno-parentheses +PICFLAGS = -fPIC +SOFLAGS = -shared +LDFLAGS += $(SOFLAGS) + +IFLAGS = -I"$(BUILD_DIR)" +CFLAGS = $(OFLAGS) $(WFLAGS) $(IFLAGS) $(PICFLAGS) -D_REENTRANT + +ifneq ($(strip $(findstring $(OS), win32, mingw, cygwin)),) + # For cygwin => win32-native builds, strip out cygwin deps + ifneq ($(findstring cygwin, $(BUILD_OS)),) + CC += -mno-cygwin -mwin32 + LDFLAGS += -mno-cygwin -Wl,--add-stdcall-alias + endif + PICFLAGS= + LIBEXT=dll + CC = gcc +endif + +ifeq ($(OS), darwin) + ifneq ($(findstring $(CPU),ppc),) + ARCHFLAGS += -arch ppc + endif + ifneq ($(findstring $(CPU),i386 x86_64),) + ARCHFLAGS += -arch i386 -arch x86_64 + endif + CFLAGS += $(ARCHFLAGS) -DTARGET_RT_MAC_CFM=0 + CFLAGS += -fno-common + LDFLAGS = $(ARCHFLAGS) -dynamiclib + # link against the universal libraries on ppc machines + LDFLAGS += -L$(MACSDK)/usr/lib + LIBEXT = dylib + FFI_CFLAGS += -isysroot $(MACSDK) + PICFLAGS = + SOFLAGS = +endif + +ifeq ($(OS), linux) + SOFLAGS += -Wl,-soname,$(LIBNAME) +endif + +ifeq ($(OS), solaris) + CC = /usr/sfw/bin/gcc -std=c99 + LD = /usr/ccs/bin/ld + SOFLAGS = -shared -static-libgcc +endif + +ifeq ($(OS), aix) + LIBEXT = a + SOFLAGS = -shared -static-libgcc + PICFLAGS += -pthread +endif + +ifneq ($(findstring bsd, $(OS)),) + SOFLAGS = -shared -static-libgcc + CFLAGS += -pthread + LDFLAGS += -pthread +endif + +ifeq ($(CPU), i386) + MODEL = 32 +endif + +ifeq ($(CPU), sparcv9) + MODEL = 64 +endif + +ifeq ($(CPU), amd64) + MODEL = 64 +endif + +ifeq ($(CPU), x86_64) + MODEL = 64 +endif + +ifeq ($(CPU), ppc64) + MODEL = 64 +endif + +ifeq ($(CPU), powerpc64) + MODEL = 64 +endif + +MODELFLAG = +ifneq ($(MODEL),) + MODELFLAG = -m$(MODEL) +endif + +# On platforms (linux, solaris) that support both 32bit and 64bit, force building for one or the other +ifneq ($(or $(findstring linux, $(OS)), $(findstring solaris, $(OS))),) + # Change the CC/LD instead of CFLAGS/LDFLAGS, incase other things in the flags + # makes the libffi build choke + CC += $(MODELFLAG) + LD += $(MODELFLAG) +endif + +LIBTEST = $(LIBNAME) + +all: $(LIBTEST) + +$(TEST_BUILD_DIR)/%.o : $(SRC_DIR)/%.c + @mkdir -p $(@D) + $(CCACHE) $(CC) $(CFLAGS) -c $< -o $@ + +$(LIBTEST): $(TEST_OBJS) + $(CC) -o $@ $(LDFLAGS) $(TEST_OBJS) -lm + +clean:: + # nothing to do - ant will delete the build dir + +debug:: + @echo "SRCS=$(TEST_SRCS)" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/GlobalVariable.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/GlobalVariable.c new file mode 100644 index 000000000..39c12a2e9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/GlobalVariable.c @@ -0,0 +1,62 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include +#include + +typedef int8_t s8; +typedef uint8_t u8; +typedef int16_t s16; +typedef uint16_t u16; +typedef int32_t s32; +typedef uint32_t u32; +typedef int64_t s64; +typedef uint64_t u64; +typedef signed long sL; +typedef unsigned long uL; +typedef float f32; +typedef double f64; +#if !defined(__OpenBSD__) +typedef unsigned long ulong; +#endif +typedef void* pointer; +typedef void* P; + +#define GVAR(T) \ + extern T gvar_##T; \ + T gvar_##T = (T) -1; \ + T gvar_##T##_get() { return gvar_##T; }; \ + void gvar_##T##_set(T v) { gvar_##T = v; } + +GVAR(s8); +GVAR(u8); +GVAR(s16); +GVAR(u16); +GVAR(s32); +GVAR(u32); +GVAR(s64); +GVAR(u64); +GVAR(long); +GVAR(ulong); +GVAR(pointer); + +struct gstruct { + long data; +}; + +struct gstruct gvar_gstruct = { -1 }; + +struct gstruct* +gvar_gstruct_get(void) +{ + return &gvar_gstruct; +} + +void +gvar_gstruct_set(const struct gstruct* val) +{ + gvar_gstruct = *val; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/LastErrorTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/LastErrorTest.c new file mode 100644 index 000000000..02ce4a8bc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/LastErrorTest.c @@ -0,0 +1,21 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#if defined(_WIN32) || defined(__WIN32__) +# include +#else +# include +#endif + +int setLastError(int error) { +#if defined(_WIN32) || defined(__WIN32__) + SetLastError(error); +#else + errno = error; +#endif + return -1; +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/NumberTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/NumberTest.c new file mode 100644 index 000000000..3fa25a800 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/NumberTest.c @@ -0,0 +1,132 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include +#include +#include +#include + +#if defined(__sparc) && defined(__sun__) + #define fix_mem_access __asm("ta 6") +#else + #define fix_mem_access +#endif + +typedef int8_t s8; +typedef uint8_t u8; +typedef int16_t s16; +typedef uint16_t u16; +typedef int32_t s32; +typedef uint32_t u32; +typedef int64_t s64; +typedef uint64_t u64; +typedef signed long sL; +typedef unsigned long uL; +typedef float f32; +typedef double f64; +typedef long double f128; +#if !defined(__OpenBSD__) +typedef unsigned long ulong; +#endif + +#define ADD(T) T add_##T(T arg1, T arg2) { return arg1 + arg2; } +#define SUB(T) T sub_##T(T arg1, T arg2) { return arg1 - arg2; } +#define MUL(T) T mul_##T(T arg1, T arg2) { return arg1 * arg2; } +#define DIV(T) T div_##T(T arg1, T arg2) { return arg1 / arg2; } +#define RET(T) T ret_##T(T arg1) { return arg1; } +#define SET(T) static T T##_;void set_##T(T arg1) { T##_ = arg1; } +#define GET(T) T get_##T() { return T##_; } +typedef char* ptr; +#define TEST(T) ADD(T) SUB(T) MUL(T) DIV(T) RET(T) SET(T) GET(T) +TEST(s8); +TEST(u8); +TEST(s16); +TEST(u16); +TEST(s32); +TEST(u32); +TEST(s64); +TEST(u64); +TEST(float); +TEST(double); +TEST(long); +TEST(ulong); +TEST(f128); + +#define ADD2(R, T1, T2) R add_##T1##T2##_##R(T1 arg1, T2 arg2) { return arg1 + arg2; } +#define SUB2(R, T1, T2) R sub_##T1##T2##_##R(T1 arg1, T2 arg2) { return arg1 - arg2; } +#define MUL2(R, T1, T2) R mul_##T1##T2##_##R(T1 arg1, T2 arg2) { return arg1 * arg2; } +#define DIV2(R, T1, T2) R div_##T1##T2##_##R(T1 arg1, T2 arg2) { return arg1 / arg2; } + +#define T2__(R, T1, T2) ADD2(R, T1, T2) SUB2(R, T1, T2) MUL2(R, T1, T2) DIV2(R, T1, T2) +#define T2_(R, T1) \ + T2__(R, T1, s8) T2__(R, T1, u8) \ + T2__(R, T1, s16) T2__(R, T1, u16) \ + T2__(R, T1, s32) T2__(R, T1, u32) \ + T2__(R, T1, sL) T2__(R, T1, uL) \ + T2__(R, T1, s64) T2__(R, T1, u64) \ + +#define TEST2(R) \ + T2_(R, s8) T2_(R, u8) T2_(R, s16) T2_(R, u16) T2_(R, s32) T2_(R, u32) \ + T2_(R, sL) T2_(R, uL) T2_(R, s64) T2_(R, u64) + +#ifdef notyet +TEST2(s32) +TEST2(u32) +TEST2(s64) +TEST2(u64) +#endif + +#define ADD3(R, T1, T2, T3) R add_##T1##T2##T3##_##R(T1 arg1, T2 arg2, T3 arg3) { return arg1 + arg2 + arg3; } +#define pack_f32(buf, v) do { float f = v; memcpy((buf), &f, sizeof(f)); } while(0) +#define pack_f64(buf, v) do { double f = v; memcpy((buf), &f, sizeof(f)); } while(0) +#define pack_int(buf, v) do { *(buf) = v; } while(0) +#define pack_s8 pack_int +#define pack_u8 pack_int +#define pack_s16 pack_int +#define pack_u16 pack_int +#define pack_s32 pack_int +#define pack_u32 pack_int +#define pack_s64 pack_int +#define pack_u64 pack_int +#define pack_sL pack_int +#define pack_uL pack_int + +#define PACK3(R, T1, T2, T3) void pack_##T1##T2##T3##_##R(T1 arg1, T2 arg2, T3 arg3, R* r) { \ + fix_mem_access; \ + pack_##T1(&r[0], arg1); \ + pack_##T2(&r[1], arg2); \ + pack_##T3(&r[2], arg3); \ +} + +#define T3___(R, T1, T2, T3) PACK3(R, T1, T2, T3) /* SUB2(R, T1, T2) MUL2(R, T1, T2) DIV2(R, T1, T2) */ +#define T3__(R, T1, T2) \ + T3___(R, T1, T2, s8) T3___(R, T1, T2, u8) \ + T3___(R, T1, T2, s16) T3___(R, T1, T2, u16) \ + T3___(R, T1, T2, s32) T3___(R, T1, T2, u32) \ + T3___(R, T1, T2, sL) T3___(R, T1, T2, uL) \ + T3___(R, T1, T2, s64) T3___(R, T1, T2, u64) \ + T3___(R, T1, T2, f32) T3___(R, T1, T2, f64) \ + +#define T3_(R, T1) \ + T3__(R, T1, s8) T3__(R, T1, u8) \ + T3__(R, T1, s16) T3__(R, T1, u16) \ + T3__(R, T1, s32) T3__(R, T1, u32) \ + T3__(R, T1, sL) T3__(R, T1, uL) \ + T3__(R, T1, s64) T3__(R, T1, u64) \ + T3__(R, T1, f32) T3__(R, T1, f64) \ + +#define TEST3(R) \ + T3_(R, s8) T3_(R, u8) T3_(R, s16) T3_(R, u16) T3_(R, s32) T3_(R, u32) \ + T3_(R, sL) T3_(R, uL) T3_(R, s64) T3_(R, u64) T3_(R, f32) T3_(R, f64) + +TEST3(s64) + +void +foo6(intptr_t i1, intptr_t i2, intptr_t i3, intptr_t i4, intptr_t i5, intptr_t i6) { } + +void +foo5(intptr_t i1, intptr_t i2, intptr_t i3, intptr_t i4, intptr_t i5) { } + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/PointerTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/PointerTest.c new file mode 100644 index 000000000..7237ab20e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/PointerTest.c @@ -0,0 +1,63 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include +#include +#include +#include +#include +#include +typedef void* ptr; +typedef void* pointer; +#ifdef _WIN32 +typedef char* caddr_t; +#endif + +#define RET(T) T ptr_ret_##T(void* arg1, int offset) { \ + T tmp; memcpy(&tmp, (caddr_t) arg1 + offset, sizeof(tmp)); return tmp; \ +} +#define SET(T) void ptr_set_##T(void* arg1, int offset, T value) { \ + memcpy((caddr_t) arg1 + offset, &value, sizeof(value)); \ +} +#define TEST(T) SET(T) RET(T) + +TEST(int8_t); +TEST(int16_t); +TEST(int32_t); +TEST(int64_t); +TEST(float); +TEST(double); +TEST(pointer); + +void* +ptr_return_array_element(void **ptrArray, int arrayIndex) +{ + return ptrArray[arrayIndex]; +} + +void +ptr_set_array_element(void **ptrArray, int arrayIndex, void *value) +{ + ptrArray[arrayIndex] = value; +} + +void* +ptr_malloc(int size) +{ + return calloc(1, size); +} +void +ptr_free(void* ptr) +{ + free(ptr); +} + +void* +ptr_from_address(uintptr_t addr) +{ + return (void *) addr; +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/ReferenceTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/ReferenceTest.c new file mode 100644 index 000000000..d1dd88bc9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/ReferenceTest.c @@ -0,0 +1,23 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include + +#define REF(T) void ref_##T(T arg, T* result) { *result = arg; } +#define ADD(T) void ref_add_##T(T arg1, T arg2, T* result) { *result = arg1 + arg2; } +#define SUB(T) void ref_sub_##T(T arg1, T arg2, T* result) { *result = arg1 - arg2; } +#define MUL(T) void ref_mul_##T(T arg1, T arg2, T* result) { *result = arg1 * arg2; } +#define DIV(T) void ref_div_##T(T arg1, T arg2, T* result) { *result = arg1 / arg2; } +#define TEST(T) ADD(T) SUB(T) MUL(T) DIV(T) REF(T) + +TEST(int8_t); +TEST(int16_t); +TEST(int32_t); +TEST(int64_t); +TEST(float); +TEST(double); + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/StringTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/StringTest.c new file mode 100644 index 000000000..292242bb9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/StringTest.c @@ -0,0 +1,34 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include + +int +string_equals(const char* s1, const char* s2) +{ + return strcmp(s1, s2) == 0; +} + +void +string_set(char* s1, const char* s2) +{ + strcpy(s1, s2); +} +void +string_concat(char* dst, const char* src) +{ + strcat(dst, src); +} +void +string_dummy(char* dummy) +{ +} +const char* +string_null(void) +{ + return NULL; +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/StructTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/StructTest.c new file mode 100644 index 000000000..25683d396 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/StructTest.c @@ -0,0 +1,243 @@ +/* + * Copyright (c) 2007 Wayne Meissner. + * Copyright (c) 2009 Andrea Fazzi . + * + * All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include +#include +#include +#include +#include +#include + +typedef char s8; +typedef short s16; +typedef int s32; +typedef long long s64; +typedef float f32; +typedef double f64; + +typedef struct bugged_struct { + unsigned char visible; + unsigned int x; + unsigned int y; + short rx; + short ry; + unsigned char order; + unsigned char size; +} bugged_struct_t; + +unsigned int +bugged_struct_size() { + return sizeof(bugged_struct_t); +} + +struct test1 { + char b; + short s; + int i; + long long j; + long l; + float f; + double d; + char string[32]; +}; + +struct struct_with_array { + char c; + int a[5]; +}; + +struct nested { + int i; +}; + +struct container { + char first; + struct nested s; +}; + +int +struct_align_nested_struct(struct container* a) { return a->s.i; } + +void* +struct_field_array(struct struct_with_array* s) { return &s->a; } + +struct container* +struct_make_container_struct(int i) +{ + static struct container cs; + memset(&cs, 0, sizeof(cs)); + cs.first = 1; + cs.s.i = i; + return &cs; +} + +#define T(x, type) \ + type struct_field_##type(struct test1* t) { return t->x; } \ + struct type##_align { char first; type value; }; \ + type struct_align_##type(struct type##_align* a) { return a->value; } + +T(b, s8); +T(s, s16); +T(i, s32); +T(j, s64); +T(f, f32); +T(d, f64); +T(l, long); + +void +struct_set_string(struct test1* t, char* s) +{ + strcpy(t->string, s); +} + +struct test1* +struct_make_struct(char b, short s, int i, long long ll, float f, double d) +{ + static struct test1 t; + memset(&t, 0, sizeof(t)); + t.b = b; + t.s = s; + t.i = i; + t.j = ll; + t.f = f; + t.d = d; + return &t; +} + +typedef int (*add_cb)(int a1, int a2); +typedef int (*sub_cb)(int a1, int a2); +struct test2 { + add_cb add_callback; + sub_cb sub_callback; +}; + +int +struct_call_add_cb(struct test2* t, int a1, int a2) +{ + return t->add_callback(a1, a2); +} + +int +struct_call_sub_cb(struct test2* t, int a1, int a2) +{ + return t->sub_callback(a1, a2); +} + + +struct struct_with_array* +struct_make_struct_with_array(int a_0, int a_1, int a_2, int a_3, int a_4) +{ + static struct struct_with_array s; + + memset(&s, 0, sizeof(s)); + + s.a[0] = a_0; + s.a[1] = a_1; + s.a[2] = a_2; + s.a[3] = a_3; + s.a[4] = a_4; + + return &s; + +} + +struct s8s32 { + char s8; + int s32; +}; + +struct s8s32 +struct_return_s8s32() +{ + struct s8s32 s; + s.s8 = 0x7f; + s.s32 = 0x12345678; + + return s; +} + +struct s8s32 +struct_s8s32_set(char s8, int s32) +{ + struct s8s32 s; + + s.s8 = s8; + s.s32 = s32; + + return s; +} + +int +struct_s8s32_get_s8(struct s8s32 s) +{ + return s.s8; +} + +int +struct_s8s32_get_s32(struct s8s32 s) +{ + return s.s32; +} + +struct s8s32 +struct_s8s32_ret_s8s32(struct s8s32 s) +{ + return s; +} + +// Pass a struct and an int arg, ensure the int arg is passed correctly +int +struct_s8s32_s32_ret_s32(struct s8s32 s, int s32) +{ + return s32; +} + +// Pass a struct and a long long arg, ensure the long long arg is passed correctly +long long +struct_s8s32_s64_ret_s64(struct s8s32 s, long long s64) +{ + return s64; +} + +// Pass a struct and a long long arg, ensure the long long arg is passed correctly +int +struct_s32_ptr_s32_s8s32_ret_s32(int s32a, void *ptr, int s32b, struct s8s32 s) +{ + if (ptr != NULL) *(struct s8s32 *) ptr = s; + return s.s32; +} + +// Pass a char *, copy into buffer length struct +struct struct_string { + char *bytes; + int len; +}; + +struct struct_string +struct_varargs_ret_struct_string(int len, ...) +{ + struct struct_string ss; + va_list vl; + char* cp = NULL; + + va_start(vl, len); + + ss.len = len; + ss.bytes = va_arg(vl, char *); + if (ss.bytes != NULL) { + cp = malloc(strlen(ss.bytes) + 1); + strcpy(cp, ss.bytes); + ss.bytes = cp; + } + + va_end(vl); + + return ss; +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/UnionTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/UnionTest.c new file mode 100644 index 000000000..0929a31f6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/UnionTest.c @@ -0,0 +1,43 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include +#include +#include +#include +#include + +typedef char s8; +typedef short s16; +typedef int s32; +typedef long long s64; +typedef float f32; +typedef double f64; + +typedef union union_test { + char b; + short s; + int i; + long long j; + long l; + float f; + double d; + s8 a[10]; +} union_test_t; + +#define T(x, type) \ + type union_align_##type(union_test_t* u) { return u->x; } \ + union_test_t* union_make_union_with_##type(type value) { static union_test_t u; u.x = value; return &u; } + +T(b, s8); +T(s, s16); +T(i, s32); +T(j, s64); +T(f, f32); +T(d, f64); +T(l, long); + +unsigned int union_size() { return sizeof(union_test_t); } diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/VariadicTest.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/VariadicTest.c new file mode 100644 index 000000000..2f3d801ba --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/VariadicTest.c @@ -0,0 +1,99 @@ +/* + * Copyright (c) 2007 Wayne Meissner. All rights reserved. + * + * For licensing, see LICENSE.SPECS + */ + +#include +#include +#include +#include +#include + +typedef int8_t s8; +typedef uint8_t u8; +typedef int16_t s16; +typedef uint16_t u16; +typedef int32_t s32; +typedef uint32_t u32; +typedef int64_t s64; +typedef uint64_t u64; +typedef signed long sL; +typedef unsigned long uL; +typedef float F; +typedef double D; + +void pack_varargs(s64* buf, const char* fmt, ...) +{ + va_list ap; + int c; + double d; + va_start(ap, fmt); + while ((c = *fmt++)) { + switch (c) { + case 'c': + case 's': + case 'i': + *buf++ = va_arg(ap, s32); + break; + case 'l': + *buf++ = va_arg(ap, long); + break; + case 'j': + *buf++ = va_arg(ap, s64); + break; + case 'f': + case 'd': + d = va_arg(ap, double); + memcpy(buf++, &d, sizeof(d)); + break; + case 'C': + case 'S': + case 'I': + *buf++ = va_arg(ap, u32); + break; + case 'L': + *buf++ = va_arg(ap, unsigned long); + break; + } + } + va_end(ap); +} + +int pack_varargs2(s64* buf, int retval, const char* fmt, ...) +{ + va_list ap; + int c; + double d; + va_start(ap, fmt); + while ((c = *fmt++)) { + switch (c) { + case 'c': + case 's': + case 'i': + *buf++ = va_arg(ap, s32); + break; + case 'l': + *buf++ = va_arg(ap, long); + break; + case 'j': + *buf++ = va_arg(ap, s64); + break; + case 'f': + case 'd': + d = va_arg(ap, double); + memcpy(buf++, &d, sizeof(d)); + break; + case 'C': + case 'S': + case 'I': + *buf++ = va_arg(ap, u32); + break; + case 'L': + *buf++ = va_arg(ap, unsigned long); + break; + } + } + va_end(ap); + return retval + 1; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/classes.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/classes.rb new file mode 100644 index 000000000..581768c2a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/fixtures/classes.rb @@ -0,0 +1,438 @@ +module FFISpecs + # + # Callback fixtures + # + module LibTest + callback :cbVrS8, [ ], :char + callback :cbVrU8, [ ], :uchar + callback :cbVrS16, [ ], :short + callback :cbVrU16, [ ], :ushort + callback :cbVrS32, [ ], :int + callback :cbVrU32, [ ], :uint + callback :cbVrL, [ ], :long + callback :cbVrUL, [ ], :ulong + callback :cbVrS64, [ ], :long_long + callback :cbVrU64, [ ], :ulong_long + callback :cbVrP, [], :pointer + callback :cbCrV, [ :char ], :void + callback :cbSrV, [ :short ], :void + callback :cbIrV, [ :int ], :void + callback :cbLrV, [ :long ], :void + callback :cbULrV, [ :ulong ], :void + callback :cbLrV, [ :long_long ], :void + + attach_function :testCallbackVrS8, :testClosureVrB, [ :cbVrS8 ], :char + attach_function :testCallbackVrU8, :testClosureVrB, [ :cbVrU8 ], :uchar + attach_function :testCallbackVrS16, :testClosureVrS, [ :cbVrS16 ], :short + attach_function :testCallbackVrU16, :testClosureVrS, [ :cbVrU16 ], :ushort + attach_function :testCallbackVrS32, :testClosureVrI, [ :cbVrS32 ], :int + attach_function :testCallbackVrU32, :testClosureVrI, [ :cbVrU32 ], :uint + attach_function :testCallbackVrL, :testClosureVrL, [ :cbVrL ], :long + attach_function :testCallbackVrUL, :testClosureVrL, [ :cbVrUL ], :ulong + attach_function :testCallbackVrS64, :testClosureVrLL, [ :cbVrS64 ], :long_long + attach_function :testCallbackVrU64, :testClosureVrLL, [ :cbVrU64 ], :ulong_long + attach_function :testCallbackVrP, :testClosureVrP, [ :cbVrP ], :pointer + attach_function :testCallbackCrV, :testClosureBrV, [ :cbCrV, :char ], :void + attach_variable :cbVrS8, :gvar_pointer, :cbVrS8 + attach_variable :pVrS8, :gvar_pointer, :pointer + attach_function :testGVarCallbackVrS8, :testClosureVrB, [ :pointer ], :char + attach_function :testOptionalCallbackCrV, :testOptionalClosureBrV, [ :cbCrV, :char ], :void + + attach_function :testCallbackVrS8, :testClosureVrB, [ callback([ ], :char) ], :char + + callback :cb_return_type, [ :int ], :int + callback :cb_lookup, [ ], :cb_return_type + attach_function :testReturnsCallback, :testReturnsClosure, [ :cb_lookup, :int ], :int + + callback :funcptr, [ :int ], :int + attach_function :testReturnsFunctionPointer, [ ], :funcptr + + callback :cbS8rV, [ :char ], :void + callback :cbU8rV, [ :uchar ], :void + callback :cbS16rV, [ :short ], :void + callback :cbU16rV, [ :ushort ], :void + + callback :cbS32rV, [ :int ], :void + callback :cbU32rV, [ :uint ], :void + + callback :cbLrV, [ :long ], :void + callback :cbULrV, [ :ulong ], :void + + callback :cbS64rV, [ :long_long ], :void + attach_function :testCallbackCrV, :testClosureBrV, [ :cbS8rV, :char ], :void + attach_function :testCallbackU8rV, :testClosureBrV, [ :cbU8rV, :uchar ], :void + attach_function :testCallbackSrV, :testClosureSrV, [ :cbS16rV, :short ], :void + attach_function :testCallbackU16rV, :testClosureSrV, [ :cbU16rV, :ushort ], :void + attach_function :testCallbackIrV, :testClosureIrV, [ :cbS32rV, :int ], :void + attach_function :testCallbackU32rV, :testClosureIrV, [ :cbU32rV, :uint ], :void + + attach_function :testCallbackLrV, :testClosureLrV, [ :cbLrV, :long ], :void + attach_function :testCallbackULrV, :testClosureULrV, [ :cbULrV, :ulong ], :void + + attach_function :testCallbackLLrV, :testClosureLLrV, [ :cbS64rV, :long_long ], :void + end + + # + # Enum fixtures + # + module TestEnum0 + extend FFI::Library + end + + module TestEnum1 + extend FFI::Library + ffi_lib LIBRARY + + enum [:c1, :c2, :c3, :c4] + enum [:c5, 42, :c6, :c7, :c8] + enum [:c9, 42, :c10, :c11, 4242, :c12] + enum [:c13, 42, :c14, 4242, :c15, 424242, :c16, 42424242] + + attach_function :test_untagged_enum, [:int], :int + end + + module TestEnum3 + extend FFI::Library + ffi_lib LIBRARY + + enum :enum_type1, [:c1, :c2, :c3, :c4] + enum :enum_type2, [:c5, 42, :c6, :c7, :c8] + enum :enum_type3, [:c9, 42, :c10, :c11, 4242, :c12] + enum :enum_type4, [:c13, 42, :c14, 4242, :c15, 424242, :c16, 42424242] + + attach_function :test_tagged_typedef_enum1, [:enum_type1], :enum_type1 + attach_function :test_tagged_typedef_enum2, [:enum_type2], :enum_type2 + attach_function :test_tagged_typedef_enum3, [:enum_type3], :enum_type3 + attach_function :test_tagged_typedef_enum4, [:enum_type4], :enum_type4 + end + + # + # Errno fixtures + # + module LibTest + attach_function :setLastError, [ :int ], :void + end + + # + # ManagedStruct fixtures + # + module LibTest + attach_function :ptr_from_address, [ FFI::Platform::ADDRESS_SIZE == 32 ? :uint : :ulong_long ], :pointer + end + + class NoRelease < ManagedStruct + layout :i, :int + end + + class WhatClassAmI < ManagedStruct + layout :i, :int + def self.release; end + end + + class PleaseReleaseMe < ManagedStruct + layout :i, :int + @@count = 0 + def self.release + @@count += 1 + end + def self.wait_gc(count) + loop = 5 + while loop > 0 && @@count < count + loop -= 1 + if RUBY_PLATFORM =~ /java/ + require 'java' + java.lang.System.gc + else + GC.start + end + sleep 0.05 if @@count < count + end + end + end + + # + # Number fixtures + # + module LibTest + attach_function :ret_s8, [ :char ], :char + attach_function :ret_u8, [ :uchar ], :uchar + attach_function :ret_s16, [ :short ], :short + attach_function :ret_u16, [ :ushort ], :ushort + attach_function :ret_s32, [ :int ], :int + attach_function :ret_u32, [ :uint ], :uint + attach_function :ret_s64, [ :long_long ], :long_long + attach_function :ret_u64, [ :ulong_long ], :ulong_long + attach_function :ret_long, [ :long ], :long + attach_function :ret_ulong, [ :ulong ], :ulong + attach_function :set_s8, [ :char ], :void + attach_function :get_s8, [ ], :char + attach_function :set_float, [ :float ], :void + attach_function :get_float, [ ], :float + attach_function :set_double, [ :double ], :void + attach_function :get_double, [ ], :double + end + + PACK_VALUES = { + 's8' => [ 0x12 ], + 'u8' => [ 0x34 ], + 's16' => [ 0x5678 ], + 'u16' => [ 0x9abc ], + 's32' => [ 0x7654321f ], + 'u32' => [ 0xfee1babe ], + 'sL' => [ 0x1f2e3d4c ], + 'uL' => [ 0xf7e8d9ca ], + 's64' => [ 0x1eafdeadbeefa1b2 ], + #'f32' => [ 1.234567 ], # TODO: Why is this disabled? + 'f64' => [ 9.87654321 ] + } + + TYPE_MAP = { + 's8' => :char, 'u8' => :uchar, 's16' => :short, 'u16' => :ushort, + 's32' => :int, 'u32' => :uint, 's64' => :long_long, 'u64' => :ulong_long, + 'sL' => :long, 'uL' => :ulong, 'f32' => :float, 'f64' => :double + } + TYPES = TYPE_MAP.keys + + module LibTest + [ 's32', 'u32', 's64', 'u64' ].each do |rt| + TYPES.each do |t1| + TYPES.each do |t2| + TYPES.each do |t3| + begin + attach_function "pack_#{t1}#{t2}#{t3}_#{rt}", + [ TYPE_MAP[t1], TYPE_MAP[t2], TYPE_MAP[t3], :buffer_out ], :void + rescue FFI::NotFoundError + end + end + end + end + end + end + + # + # Pointer fixtures + # + module LibTest + attach_function :ptr_ret_int32_t, [ :pointer, :int ], :int + attach_function :ptr_from_address, [ FFI::Platform::ADDRESS_SIZE == 32 ? :uint : :ulong_long ], :pointer + attach_function :ptr_set_pointer, [ :pointer, :int, :pointer ], :void + end + + class ToPtrTest + def initialize(ptr) + @ptr = ptr + end + def to_ptr + @ptr + end + end + + require 'delegate' + class PointerDelegate < DelegateClass(FFI::Pointer) + def initialize(ptr) + super + @ptr = ptr + end + def to_ptr + @ptr + end + end + + class AutoPointerTestHelper + @@count = 0 + def self.release + @@count += 1 if @@count > 0 + end + def self.reset + @@count = 0 + end + def self.gc_everything(count) + loop = 5 + while @@count < count && loop > 0 + loop -= 1 + if RUBY_PLATFORM =~ /java/ + require "java" + java.lang.System.gc + else + GC.start + end + sleep 0.05 unless @@count == count + end + @@count = 0 + end + def self.finalizer + self.method(:release).to_proc + end + end + + # + # String fixtures + # + module LibTest + attach_function :ptr_ret_pointer, [ :pointer, :int], :string + attach_function :string_equals, [ :string, :string ], :int + attach_function :string_dummy, [ :string ], :void + end + + # + # Struct initialize fixtures + # + class StructWithInitialize < FFI::Struct + layout :string, :string + attr_accessor :magic + def initialize + super + self.magic = 42 + end + end + + # + # Struct fixtures + # + StructTypes = { + 's8' => :char, + 's16' => :short, + 's32' => :int, + 's64' => :long_long, + 'long' => :long, + 'f32' => :float, + 'f64' => :double + } + + module LibTest + attach_function :ptr_ret_pointer, [ :pointer, :int], :string + attach_function :ptr_ret_int32_t, [ :pointer, :int ], :int + attach_function :ptr_from_address, [ :ulong ], :pointer + attach_function :string_equals, [ :string, :string ], :int + [ 's8', 's16', 's32', 's64', 'f32', 'f64', 'long' ].each do |t| + attach_function "struct_align_#{t}", [ :pointer ], StructTypes[t] + end + end + + class PointerMember < FFI::Struct + layout :pointer, :pointer + end + + class StringMember < FFI::Struct + layout :string, :string + end + + module CallbackMember + extend FFI::Library + ffi_lib LIBRARY + callback :add, [ :int, :int ], :int + callback :sub, [ :int, :int ], :int + + class TestStruct < FFI::Struct + layout :add, :add, + :sub, :sub + end + + attach_function :struct_call_add_cb, [TestStruct, :int, :int], :int + attach_function :struct_call_sub_cb, [TestStruct, :int, :int], :int + end + + module LibTest + class NestedStruct < FFI::Struct + layout :i, :int + end + + class ContainerStruct < FFI::Struct + layout :first, :char, :ns, NestedStruct + end + + attach_function :struct_align_nested_struct, [ :pointer ], :int + attach_function :struct_make_container_struct, [ :int ], :pointer + + class StructWithArray < FFI::Struct + layout :first, :char, :a, [:int, 5] + end + + attach_function :struct_make_struct_with_array, [:int, :int, :int, :int, :int], :pointer + attach_function :struct_field_array, [:pointer], :pointer + + class BuggedStruct < FFI::Struct + layout :visible, :uchar, + :x, :uint, + :y, :uint, + :rx, :short, + :ry, :short, + :order, :uchar, + :size, :uchar + end + + attach_function :bugged_struct_size, [], :uint + end + + module StructCustomTypedef + extend FFI::Library + ffi_lib LIBRARY + typedef :uint, :fubar3_t + + class S < FFI::Struct + layout :a, :fubar3_t + end + end + + # + # Union fixtures + # + module LibTest + Types = { + 's8' => [:char, :c, 1], + 's16' => [:short, :s, 0xff0], + 's32' => [:int, :i, 0xff00], + 's64' => [:long_long, :j, 0xffff00], + 'long' => [:long, :l, 0xffff], + 'f32' => [:float, :f, 1.0001], + 'f64' => [:double, :d, 1.000000001] + } + + class TestUnion < FFI::Union + layout( :a, [:char, 10], + :i, :int, + :f, :float, + :d, :double, + :s, :short, + :l, :long, + :j, :long_long, + :c, :char ) + end + + Types.keys.each do |k| + attach_function "union_align_#{k}", [ :pointer ], Types[k][0] + attach_function "union_make_union_with_#{k}", [ Types[k][0] ], :pointer + end + + attach_function :union_size, [], :uint + end + + # + # Variadic fixtures + # + module LibTest + attach_function :pack_varargs, [ :buffer_out, :string, :varargs ], :void + end + + module Varargs + PACK_VALUES = { + 'c' => [ 0x12 ], + 'C' => [ 0x34 ], + 's' => [ 0x5678 ], + 'S' => [ 0x9abc ], + 'i' => [ 0x7654321f ], + 'I' => [ 0xfee1babe ], + 'l' => [ 0x1f2e3d4c ], + 'L' => [ 0xf7e8d9ca ], + 'j' => [ 0x1eafdeadbeefa1b2 ], + 'f' => [ 1.23456789 ], + 'd' => [ 9.87654321 ] + } + + TYPE_MAP = { + 'c' => :char, 'C' => :uchar, 's' => :short, 'S' => :ushort, + 'i' => :int, 'I' => :uint, 'j' => :long_long, 'J' => :ulong_long, + 'l' => :long, 'L' => :ulong, 'f' => :float, 'd' => :double + } + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/function_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/function_spec.rb new file mode 100644 index 000000000..ab08f3578 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/function_spec.rb @@ -0,0 +1,92 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe FFI::Function do + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + attach_function :testFunctionAdd, [:int, :int, :pointer], :int + end + before do + @libtest = FFI::DynamicLibrary.open(TestLibrary::PATH, + FFI::DynamicLibrary::RTLD_LAZY | FFI::DynamicLibrary::RTLD_GLOBAL) + end + + it 'is initialized with a signature and a block' do + fn = FFI::Function.new(:int, []) { 5 } + expect(fn.call).to eql 5 + end + + it 'raises an error when passing a wrong signature' do + expect { FFI::Function.new([], :int).new { } }.to raise_error TypeError + end + + it 'returns a native pointer' do + expect(FFI::Function.new(:int, []) { }).to be_a_kind_of FFI::Pointer + end + + it 'can be used as callback from C passing to it a block' do + function_add = FFI::Function.new(:int, [:int, :int]) { |a, b| a + b } + expect(LibTest.testFunctionAdd(10, 10, function_add)).to eq(20) + end + + it 'can be used as callback from C passing to it a Proc object' do + function_add = FFI::Function.new(:int, [:int, :int], Proc.new { |a, b| a + b }) + expect(LibTest.testFunctionAdd(10, 10, function_add)).to eq(20) + end + + it 'can be used to wrap an existing function pointer' do + expect(FFI::Function.new(:int, [:int, :int], @libtest.find_function('testAdd')).call(10, 10)).to eq(20) + end + + it 'can be attached to a module' do + module Foo; end + fp = FFI::Function.new(:int, [:int, :int], @libtest.find_function('testAdd')) + fp.attach(Foo, 'add') + expect(Foo.add(10, 10)).to eq(20) + end + + it 'can be used to extend an object' do + fp = FFI::Function.new(:int, [:int, :int], @libtest.find_function('testAdd')) + foo = Object.new + class << foo + def singleton_class + class << self; self; end + end + end + fp.attach(foo.singleton_class, 'add') + expect(foo.add(10, 10)).to eq(20) + end + + it 'can wrap a blocking function' do + fp = FFI::Function.new(:void, [ :int ], @libtest.find_function('testBlocking'), :blocking => true) + threads = 10.times.map do |x| + Thread.new do + time = Time.now + fp.call(2) + expect(Time.now - time).to be >= 2 + end + end + threads.each { |t| t.join } + end + + it 'autorelease flag is set to true by default' do + fp = FFI::Function.new(:int, [:int, :int], @libtest.find_function('testAdd')) + expect(fp.autorelease?).to be true + end + + it 'can explicity free itself' do + fp = FFI::Function.new(:int, []) { } + fp.free + expect { fp.free }.to raise_error RuntimeError + end + + it 'can\'t explicity free itself if not previously allocated' do + fp = FFI::Function.new(:int, [:int, :int], @libtest.find_function('testAdd')) + expect { fp.free }.to raise_error RuntimeError + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/io_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/io_spec.rb new file mode 100644 index 000000000..22c238ad8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/io_spec.rb @@ -0,0 +1,16 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +if false # disabled for #390 + describe "FFI::IO.for_fd" do + it "produces an IO wrapping the specified file descriptor" do + expect do + FFI::IO.for_fd(2, "r") + end.to_not raise_error + end + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/library_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/library_spec.rb new file mode 100644 index 000000000..4359b9325 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/library_spec.rb @@ -0,0 +1,276 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe "Library" do + describe ".enum_value" do + m = Module.new do + extend FFI::Library + enum :something, [:one, :two] + end + + it "should return a value for a valid key" do + expect(m.enum_value(:one)).to eq(0) + expect(m.enum_value(:two)).to eq(1) + end + + it "should return nil for an invalid key" do + expect(m.enum_value(:three)).to be nil + end + end + + describe "#ffi_convention" do + it "defaults to :default" do + m = Module.new do + extend FFI::Library + end + expect(m.ffi_convention).to eq(:default) + end + + it "should be settable" do + m = Module.new do + extend FFI::Library + end + + expect(m.ffi_convention).to eq(:default) + m.ffi_convention :stdcall + expect(m.ffi_convention).to eq(:stdcall) + end + end + + if FFI::Platform::OS =~ /windows|cygwin/ && FFI::Platform::ARCH == 'i386' + module LibTestStdcall + extend FFI::Library + ffi_lib TestLibrary::PATH + ffi_convention :stdcall + + class StructUCDP < FFI::Struct + layout :a1, :uchar, + :a2, :double, + :a3, :pointer + end + + attach_function :testStdcallManyParams, [ :pointer, :int8, :int16, :int32, :int64, + StructUCDP.by_value, StructUCDP.by_ref, :float, :double ], :void + end + + it "adds stdcall decoration: testStdcallManyParams@64" do + s = LibTestStdcall::StructUCDP.new + po = FFI::MemoryPointer.new :long + LibTestStdcall.testStdcallManyParams po, 1, 2, 3, 4, s, s, 1.0, 2.0 + end + end + + describe "ffi_lib" do + it "empty name list should raise error" do + expect { + Module.new do |m| + m.extend FFI::Library + ffi_lib + end + }.to raise_error(LoadError) + end + + end + + unless RbConfig::CONFIG['target_os'] =~ /mswin|mingw/ + it "attach_function with no library specified" do + expect { + Module.new do |m| + m.extend FFI::Library + attach_function :getpid, [ ], :uint + end + }.to raise_error + end + + it "attach_function :getpid from this process" do + expect { + expect(Module.new do |m| + m.extend FFI::Library + ffi_lib FFI::Library::CURRENT_PROCESS + attach_function :getpid, [ ], :uint + end.getpid).to eq(Process.pid) + }.not_to raise_error + end + + it "attach_function :getpid from [ 'c', 'libc.so.6'] " do + expect { + expect(Module.new do |m| + m.extend FFI::Library + ffi_lib [ 'c', 'libc.so.6' ] + attach_function :getpid, [ ], :uint + end.getpid).to eq(Process.pid) + }.not_to raise_error + end + + it "attach_function :getpid from [ 'libc.so.6', 'c' ] " do + expect { + expect(Module.new do |m| + m.extend FFI::Library + ffi_lib [ 'libc.so.6', 'c' ] + attach_function :getpid, [ ], :uint + end.getpid).to eq(Process.pid) + }.not_to raise_error + end + + it "attach_function :getpid from [ 'libfubar.so.0xdeadbeef', nil, 'c' ] " do + expect { + expect(Module.new do |m| + m.extend FFI::Library + ffi_lib [ 'libfubar.so.0xdeadbeef', nil, 'c' ] + attach_function :getpid, [ ], :uint + end.getpid).to eq(Process.pid) + }.not_to raise_error + end + + it "attach_function :getpid from [ 'libfubar.so.0xdeadbeef' ] " do + expect { + expect(Module.new do |m| + m.extend FFI::Library + ffi_lib 'libfubar.so.0xdeadbeef' + attach_function :getpid, [ ], :uint + end.getpid).to eq(Process.pid) + }.to raise_error(LoadError) + end + + it "attach_function :bool_return_true from [ File.expand_path(#{TestLibrary::PATH.inspect}) ]" do + mod = Module.new do |m| + m.extend FFI::Library + ffi_lib File.expand_path(TestLibrary::PATH) + attach_function :bool_return_true, [ ], :bool + end + expect(mod.bool_return_true).to be true + end + end + + def gvar_lib(name, type) + Module.new do |m| + m.extend FFI::Library + ffi_lib TestLibrary::PATH + attach_variable :gvar, "gvar_#{name}", type + attach_function :get, "gvar_#{name}_get", [], type + attach_function :set, "gvar_#{name}_set", [ type ], :void + end + end + + def gvar_test(name, type, val) + lib = gvar_lib(name, type) + lib.set(val) + expect(lib.gvar).to eq(val) + lib.set(0) + lib.gvar = val + expect(lib.get).to eq(val) + end + + [ 0, 127, -128, -1 ].each do |i| + it ":char variable" do + gvar_test("s8", :char, i) + end + end + + [ 0, 0x7f, 0x80, 0xff ].each do |i| + it ":uchar variable" do + gvar_test("u8", :uchar, i) + end + end + + [ 0, 0x7fff, -0x8000, -1 ].each do |i| + it ":short variable" do + gvar_test("s16", :short, i) + end + end + + [ 0, 0x7fff, 0x8000, 0xffff ].each do |i| + it ":ushort variable" do + gvar_test("u16", :ushort, i) + end + end + + [ 0, 0x7fffffff, -0x80000000, -1 ].each do |i| + it ":int variable" do + gvar_test("s32", :int, i) + end + end + + [ 0, 0x7fffffff, 0x80000000, 0xffffffff ].each do |i| + it ":uint variable" do + gvar_test("u32", :uint, i) + end + end + + [ 0, 0x7fffffffffffffff, -0x8000000000000000, -1 ].each do |i| + it ":long_long variable" do + gvar_test("s64", :long_long, i) + end + end + + [ 0, 0x7fffffffffffffff, 0x8000000000000000, 0xffffffffffffffff ].each do |i| + it ":ulong_long variable" do + gvar_test("u64", :ulong_long, i) + end + end + + if FFI::Platform::LONG_SIZE == 32 + [ 0, 0x7fffffff, -0x80000000, -1 ].each do |i| + it ":long variable" do + gvar_test("long", :long, i) + end + end + + [ 0, 0x7fffffff, 0x80000000, 0xffffffff ].each do |i| + it ":ulong variable" do + gvar_test("ulong", :ulong, i) + end + end + else + [ 0, 0x7fffffffffffffff, -0x8000000000000000, -1 ].each do |i| + it ":long variable" do + gvar_test("long", :long, i) + end + end + + [ 0, 0x7fffffffffffffff, 0x8000000000000000, 0xffffffffffffffff ].each do |i| + it ":ulong variable" do + gvar_test("ulong", :ulong, i) + end + end + end + + it "Pointer variable" do + lib = gvar_lib("pointer", :pointer) + val = FFI::MemoryPointer.new :long + lib.set(val) + expect(lib.gvar).to eq(val) + lib.set(nil) + lib.gvar = val + expect(lib.get).to eq(val) + end + + [ 0, 0x7fffffff, -0x80000000, -1 ].each do |i| + it "structure" do + class GlobalStruct < FFI::Struct + layout :data, :long + end + + lib = Module.new do |m| + m.extend FFI::Library + ffi_lib TestLibrary::PATH + attach_variable :gvar, "gvar_gstruct", GlobalStruct + attach_function :get, "gvar_gstruct_get", [], GlobalStruct + attach_function :set, "gvar_gstruct_set", [ GlobalStruct ], :void + end + + val = GlobalStruct.new + val[:data] = i + lib.set(val) + expect(lib.gvar[:data]).to eq(i) + val[:data] = 0 + lib.gvar[:data] = i + val = GlobalStruct.new(lib.get) + expect(val[:data]).to eq(i) + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/long_double.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/long_double.rb new file mode 100644 index 000000000..b16613b24 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/long_double.rb @@ -0,0 +1,30 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) +require 'bigdecimal' + +describe ":long_double arguments and return values" do + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + attach_function :add_f128, [ :long_double, :long_double ], :long_double + attach_function :ret_f128, [ :long_double ], :long_double + end + + it "returns first parameter" do + expect(LibTest.ret_f128(0.1)).to be_within(0.01).of(0.1) + end + + it "returns first parameter with high precision" do + ld = BigDecimal.new("1.234567890123456789") + tolerance = BigDecimal.new("0.0000000000000000001") + expect(LibTest.ret_f128(ld)).to be_within(tolerance).of(ld) + end + + it "add two long double numbers" do + expect(LibTest.add_f128(0.1, 0.2)).to be_within(0.01).of(0.3) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/managed_struct_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/managed_struct_spec.rb new file mode 100644 index 000000000..f11c67a98 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/managed_struct_spec.rb @@ -0,0 +1,68 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe "Managed Struct" do + include FFI + module ManagedStructTestLib + extend FFI::Library + ffi_lib TestLibrary::PATH + attach_function :ptr_from_address, [ FFI::Platform::ADDRESS_SIZE == 32 ? :uint : :ulong_long ], :pointer + end + + it "should raise an error if release() is not defined" do + class NoRelease < FFI::ManagedStruct ; layout :i, :int; end + expect { NoRelease.new(ManagedStructTestLib.ptr_from_address(0x12345678)) }.to raise_error(NoMethodError) + end + + it "should be the right class" do + class WhatClassAmI < FFI::ManagedStruct + layout :i, :int + def self.release + end + end + + expect(WhatClassAmI.new(ManagedStructTestLib.ptr_from_address(0x12345678)).class).to eq(WhatClassAmI) + end + + it "should build with self reference" do + class ClassWithSelfRef < FFI::ManagedStruct + layout :data, self.ptr + def self.release + end + end + + expect(ClassWithSelfRef.new(ManagedStructTestLib.ptr_from_address(0x12345678)).class).to eq(ClassWithSelfRef) + end + + # see #427 + it "should release memory properly", :broken => true do + class PleaseReleaseMe < FFI::ManagedStruct + layout :i, :int + @@count = 0 + def self.release + @@count += 1 + end + def self.wait_gc(count) + loop = 5 + while loop > 0 && @@count < count + loop -= 1 + TestLibrary.force_gc + sleep 0.05 if @@count < count + end + end + end + + loop_count = 30 + wiggle_room = 5 + + expect(PleaseReleaseMe).to receive(:release).at_least(loop_count-wiggle_room).times + loop_count.times do + PleaseReleaseMe.new(ManagedStructTestLib.ptr_from_address(0x12345678)) + end + PleaseReleaseMe.wait_gc loop_count + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/memorypointer_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/memorypointer_spec.rb new file mode 100644 index 000000000..d819f3569 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/memorypointer_spec.rb @@ -0,0 +1,78 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +MemoryPointer = FFI::MemoryPointer + +describe "MemoryPointer#total" do + it "MemoryPointer.new(:char, 1).total == 1" do + expect(MemoryPointer.new(:char, 1).total).to eq 1 + end + + it "MemoryPointer.new(:short, 1).total == 2" do + expect(MemoryPointer.new(:short, 1).total).to eq 2 + end + + it "MemoryPointer.new(:int, 1).total == 4" do + expect(MemoryPointer.new(:int, 1).total).to eq 4 + end + + it "MemoryPointer.new(:long_long, 1).total == 8" do + expect(MemoryPointer.new(:long_long, 1).total).to eq 8 + end + + it "MemoryPointer.new(1024).total == 1024" do + expect(MemoryPointer.new(1024).total).to eq 1024 + end +end +describe "MemoryPointer#read_array_of_long" do + it "foo" do + ptr = MemoryPointer.new(:long, 1024) + ptr[0].write_long 1234 + ptr[1].write_long 5678 + l = ptr.read_array_of_long(2) + expect(l[0]).to eq 1234 + expect(l[1]).to eq 5678 + end +end +describe "MemoryPointer argument" do + module Ptr + extend FFI::Library + ffi_lib FFI::Platform::LIBC + attach_function :memset, [ :pointer, :int, :ulong ], :pointer + attach_function :memcpy, [ :pointer, :pointer, :ulong ], :pointer + end + + it "Pointer passed correctly" do + p = MemoryPointer.new :int, 1 + ret = Ptr.memset(p, 0, p.total) + expect(ret).to eq p + end + + it "Data passed to native function" do + p = MemoryPointer.new :int, 1 + p2 = MemoryPointer.new :int, 1 + p2.put_int(0, 0x5eadbeef) + Ptr.memcpy(p, p2, p.total) + expect(p.get_int(0)).to eq p2.get_int(0) + expect(p2.get_int(0)).not_to eql 0 + end +end +describe "MemoryPointer return value" do + module Stdio + extend FFI::Library + ffi_lib FFI::Platform::LIBC + attach_function :fopen, [ :string, :string ], :pointer + attach_function :fclose, [ :pointer ], :int + attach_function :fwrite, [ :pointer, :ulong, :ulong, :string ], :ulong + end + + it "fopen returns non-nil" do + fp = Stdio.fopen("/dev/null", "w") + expect(fp).to_not be_nil + expect(Stdio.fclose(fp)).to eq 0 unless fp.nil? or fp.null? + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/number_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/number_spec.rb new file mode 100644 index 000000000..acb956226 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/number_spec.rb @@ -0,0 +1,247 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe "Function with primitive integer arguments" do + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + attach_function :ret_s8, [ :char ], :char + attach_function :ret_u8, [ :uchar ], :uchar + attach_function :ret_s16, [ :short ], :short + attach_function :ret_u16, [ :ushort ], :ushort + attach_function :ret_s32, [ :int ], :int + attach_function :ret_u32, [ :uint ], :uint + attach_function :ret_s64, [ :long_long ], :long_long + attach_function :ret_u64, [ :ulong_long ], :ulong_long + attach_function :ret_long, [ :long ], :long + attach_function :ret_ulong, [ :ulong ], :ulong + attach_function :set_s8, [ :char ], :void + attach_function :get_s8, [ ], :char + attach_function :set_float, [ :float ], :void + attach_function :get_float, [ ], :float + attach_function :set_double, [ :double ], :void + attach_function :get_double, [ ], :double + end + + it "int8.size" do + expect(FFI::TYPE_INT8.size).to eq(1) + end + + it "uint8.size" do + expect(FFI::TYPE_UINT8.size).to eq(1) + end + + it "int16.size" do + expect(FFI::TYPE_INT16.size).to eq(2) + end + + it "uint16.size" do + expect(FFI::TYPE_UINT16.size).to eq(2) + end + + it "int32.size" do + expect(FFI::TYPE_INT32.size).to eq(4) + end + + it "uint32.size" do + expect(FFI::TYPE_UINT32.size).to eq(4) + end + + it "int64.size" do + expect(FFI::TYPE_INT64.size).to eq(8) + end + + it "uint64.size" do + expect(FFI::TYPE_UINT64.size).to eq(8) + end + + it "float.size" do + expect(FFI::TYPE_FLOAT32.size).to eq(4) + end + + it "double.size" do + expect(FFI::TYPE_FLOAT64.size).to eq(8) + end + [ 0, 127, -128, -1 ].each do |i| + it ":char call(:char (#{i}))" do + expect(LibTest.ret_s8(i)).to eq(i) + end + end + [ 0, 0x7f, 0x80, 0xff ].each do |i| + it ":uchar call(:uchar (#{i}))" do + expect(LibTest.ret_u8(i)).to eq(i) + end + end + [ 0, 0x7fff, -0x8000, -1 ].each do |i| + it ":short call(:short (#{i}))" do + expect(LibTest.ret_s16(i)).to eq(i) + end + end + [ 0, 0x7fff, 0x8000, 0xffff ].each do |i| + it ":ushort call(:ushort (#{i}))" do + expect(LibTest.ret_u16(i)).to eq(i) + end + end + [ 0, 0x7fffffff, -0x80000000, -1 ].each do |i| + it ":int call(:int (#{i}))" do + expect(LibTest.ret_s32(i)).to eq(i) + end + end + [ 0, 0x7fffffff, 0x80000000, 0xffffffff ].each do |i| + it ":uint call(:uint (#{i}))" do + expect(LibTest.ret_u32(i)).to eq(i) + end + end + [ 0, 0x7fffffffffffffff, -0x8000000000000000, -1 ].each do |i| + it ":long_long call(:long_long (#{i}))" do + expect(LibTest.ret_s64(i)).to eq(i) + end + end + [ 0, 0x7fffffffffffffff, 0x8000000000000000, 0xffffffffffffffff ].each do |i| + it ":ulong_long call(:ulong_long (#{i}))" do + expect(LibTest.ret_u64(i)).to eq(i) + end + end + if FFI::Platform::LONG_SIZE == 32 + [ 0, 0x7fffffff, -0x80000000, -1 ].each do |i| + it ":long call(:long (#{i}))" do + expect(LibTest.ret_long(i)).to eq(i) + end + end + [ 0, 0x7fffffff, 0x80000000, 0xffffffff ].each do |i| + it ":ulong call(:ulong (#{i}))" do + expect(LibTest.ret_ulong(i)).to eq(i) + end + end + else + [ 0, 0x7fffffffffffffff, -0x8000000000000000, -1 ].each do |i| + it ":long call(:long (#{i}))" do + expect(LibTest.ret_long(i)).to eq(i) + end + end + [ 0, 0x7fffffffffffffff, 0x8000000000000000, 0xffffffffffffffff ].each do |i| + it ":ulong call(:ulong (#{i}))" do + expect(LibTest.ret_ulong(i)).to eq(i) + end + end + [ 0.0, 0.1, 1.1, 1.23 ].each do |f| + it ":float call(:double (#{f}))" do + LibTest.set_float(f) + expect((LibTest.get_float - f).abs).to be < 0.001 + end + end + [ 0.0, 0.1, 1.1, 1.23 ].each do |f| + it ":double call(:double (#{f}))" do + LibTest.set_double(f) + expect((LibTest.get_double - f).abs).to be < 0.001 + end + end + end +end +describe "Integer parameter range checking" do + [ 128, -129 ].each do |i| + it ":char call(:char (#{i}))" do + expect { expect(LibTest.ret_int8_t(i)).to eq(i) }.to raise_error + end + end + [ -1, 256 ].each do |i| + it ":uchar call(:uchar (#{i}))" do + expect { expect(LibTest.ret_u_int8_t(i)).to eq(i) }.to raise_error + end + end + [ 0x8000, -0x8001 ].each do |i| + it ":short call(:short (#{i}))" do + expect { expect(LibTest.ret_int16_t(i)).to eq(i) }.to raise_error + end + end + [ -1, 0x10000 ].each do |i| + it ":ushort call(:ushort (#{i}))" do + expect { expect(LibTest.ret_u_int16_t(i)).to eq(i) }.to raise_error + end + end + [ 0x80000000, -0x80000001 ].each do |i| + it ":int call(:int (#{i}))" do + expect { expect(LibTest.ret_int32_t(i)).to eq(i) }.to raise_error + end + end + [ -1, 0x100000000 ].each do |i| + it ":ushort call(:ushort (#{i}))" do + expect { expect(LibTest.ret_u_int32_t(i)).to eq(i) }.to raise_error + end + end +end +describe "Three different size Integer arguments" do + TYPE_MAP = { + 's8' => :char, 'u8' => :uchar, 's16' => :short, 'u16' => :ushort, + 's32' => :int, 'u32' => :uint, 's64' => :long_long, 'u64' => :ulong_long, + 'sL' => :long, 'uL' => :ulong, 'f32' => :float, 'f64' => :double + } + TYPES = TYPE_MAP.keys + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + + + [ 's32', 'u32', 's64', 'u64' ].each do |rt| + TYPES.each do |t1| + TYPES.each do |t2| + TYPES.each do |t3| + begin + attach_function "pack_#{t1}#{t2}#{t3}_#{rt}", + [ TYPE_MAP[t1], TYPE_MAP[t2], TYPE_MAP[t3], :buffer_out ], :void + rescue FFI::NotFoundError + end + end + end + end + end + end + + PACK_VALUES = { + 's8' => [ 0x12 ], + 'u8' => [ 0x34 ], + 's16' => [ 0x5678 ], + 'u16' => [ 0x9abc ], + 's32' => [ 0x7654321f ], + 'u32' => [ 0xfee1babe ], + 'sL' => [ 0x1f2e3d4c ], + 'uL' => [ 0xf7e8d9ca ], + 's64' => [ 0x1eafdeadbeefa1b2 ], +# 'f32' => [ 1.234567 ], + 'f64' => [ 9.87654321 ] + } + + def verify(p, off, t, v) + if t == 'f32' + expect(p.get_float32(off)).to eq(v) + elsif t == 'f64' + expect(p.get_float64(off)).to eq(v) + else + expect(p.get_int64(off)).to eq(v) + end + end + + PACK_VALUES.keys.each do |t1| + PACK_VALUES.keys.each do |t2| + PACK_VALUES.keys.each do |t3| + PACK_VALUES[t1].each do |v1| + PACK_VALUES[t2].each do |v2| + PACK_VALUES[t3].each do |v3| + it "call(#{TYPE_MAP[t1]} (#{v1}), #{TYPE_MAP[t2]} (#{v2}), #{TYPE_MAP[t3]} (#{v3}))" do + p = FFI::Buffer.new :long_long, 3 + LibTest.send("pack_#{t1}#{t2}#{t3}_s64", v1, v2, v3, p) + verify(p, 0, t1, v1) + verify(p, 8, t2, v2) + verify(p, 16, t3, v3) + end + end + end + end + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/platform_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/platform_spec.rb new file mode 100644 index 000000000..7c567191d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/platform_spec.rb @@ -0,0 +1,114 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe "FFI::Platform::LIBSUFFIX" do + case OS + when "linux" + it "returns 'so'" do + expect(FFI::Platform::LIBSUFFIX).to eq('so') + end + when "windows" + it "returns 'dll'" do + expect(FFI::Platform::LIBSUFFIX).to eq('dll') + end + when "darwin" + it "returns 'dylib'" do + expect(FFI::Platform::LIBSUFFIX).to eq('dylib') + end + end +end + +describe "FFI::Platform::IS_WINDOWS" do + case OS + when "linux" + it "returns false" do + expect(FFI::Platform::IS_WINDOWS).to be false + end + when "windows" + it "returns true" do + expect(FFI::Platform::IS_WINDOWS).to be true + end + when "darwin" + it "returns false" do + expect(FFI::Platform::IS_WINDOWS).to be false + end + end +end + +describe "FFI::Platform::ARCH" do + it "returns the architecture type" do + expect(FFI::Platform::ARCH).to eq(CPU) + end +end + +describe "FFI::Platform::OS" do + case OS + when "linux" + it "returns 'linux' as a string" do + expect(FFI::Platform::OS).to eq('linux') + end + when "windows" + it "returns 'windows' as a string" do + expect(FFI::Platform::OS).to eq('windows') + end + when "darwin" + it "returns 'darwin' as a string" do + expect(FFI::Platform::OS).to eq('darwin') + end + end +end + +describe "FFI::Platform.windows?" do + case OS + when "linux" + it "returns false" do + expect(FFI::Platform.windows?).to be false + end + when "windows" + it "returns true" do + expect(FFI::Platform.windows?).to be true + end + when "darwin" + it "returns false" do + expect(FFI::Platform.windows?).to be false + end + end +end + +describe "FFI::Platform.mac?" do + case OS + when "linux" + it "returns false" do + expect(FFI::Platform.mac?).to be false + end + when "windows" + it "returns false" do + expect(FFI::Platform.mac?).to be false + end + when "darwin" + it "returns true" do + expect(FFI::Platform.mac?).to be true + end + end +end + +describe "FFI::Platform.unix?" do + case OS + when "linux" + it "returns true" do + expect(FFI::Platform.unix?).to be true + end + when "windows" + it "returns false" do + expect(FFI::Platform.unix?).to be false + end + when "darwin" + it "returns true" do + expect(FFI::Platform.unix?).to be true + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/pointer_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/pointer_spec.rb new file mode 100644 index 000000000..19c1953dc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/pointer_spec.rb @@ -0,0 +1,278 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) +require 'delegate' + +module PointerTestLib + extend FFI::Library + ffi_lib TestLibrary::PATH + begin + attach_function :ptr_ret_int32_t, [ :pointer, :int ], :int + rescue FFI::NotFoundError + # NetBSD uses #define instead of typedef for these + attach_function :ptr_ret_int32_t, :ptr_ret___int32_t, [ :pointer, :int ], :int + end + attach_function :ptr_from_address, [ FFI::Platform::ADDRESS_SIZE == 32 ? :uint : :ulong_long ], :pointer + attach_function :ptr_set_pointer, [ :pointer, :int, :pointer ], :void + attach_function :ptr_ret_pointer, [ :pointer, :int ], :pointer +end +describe "Pointer" do + include FFI + class ToPtrTest + def initialize(ptr) + @ptr = ptr + end + def to_ptr + @ptr + end + end + + it "Any object implementing #to_ptr can be passed as a :pointer parameter" do + memory = FFI::MemoryPointer.new :long_long + magic = 0x12345678 + memory.put_int32(0, magic) + tp = ToPtrTest.new(memory) + expect(PointerTestLib.ptr_ret_int32_t(tp, 0)).to eq(magic) + end + class PointerDelegate < DelegateClass(FFI::Pointer) + def initialize(ptr) + @ptr = ptr + end + def to_ptr + @ptr + end + end + + it "A DelegateClass(Pointer) can be passed as a :pointer parameter" do + memory = FFI::MemoryPointer.new :long_long + magic = 0x12345678 + memory.put_int32(0, magic) + ptr = PointerDelegate.new(memory) + expect(PointerTestLib.ptr_ret_int32_t(ptr, 0)).to eq(magic) + end + + it "Fixnum cannot be used as a Pointer argument" do + expect { PointerTestLib.ptr_ret_int32(0, 0) }.to raise_error + end + + it "Bignum cannot be used as a Pointer argument" do + expect { PointerTestLib.ptr_ret_int32(0xfee1deadbeefcafebabe, 0) }.to raise_error + end + + describe "pointer type methods" do + + it "#read_pointer" do + memory = FFI::MemoryPointer.new :pointer + PointerTestLib.ptr_set_pointer(memory, 0, PointerTestLib.ptr_from_address(0xdeadbeef)) + expect(memory.read_pointer.address).to eq(0xdeadbeef) + end + + it "#write_pointer" do + memory = FFI::MemoryPointer.new :pointer + memory.write_pointer(PointerTestLib.ptr_from_address(0xdeadbeef)) + expect(PointerTestLib.ptr_ret_pointer(memory, 0).address).to eq(0xdeadbeef) + end + + it "#read_array_of_pointer" do + values = [0x12345678, 0xfeedf00d, 0xdeadbeef] + memory = FFI::MemoryPointer.new :pointer, values.size + values.each_with_index do |address, j| + PointerTestLib.ptr_set_pointer(memory, j * FFI.type_size(:pointer), PointerTestLib.ptr_from_address(address)) + end + array = memory.read_array_of_pointer(values.size) + values.each_with_index do |address, j| + expect(array[j].address).to eq(address) + end + end + + end + + describe 'NULL' do + it 'should be obtained using Pointer::NULL constant' do + null_ptr = FFI::Pointer::NULL + expect(null_ptr).to be_null + end + it 'should be obtained passing address 0 to constructor' do + expect(FFI::Pointer.new(0)).to be_null + end + it 'should raise an error when attempting read/write operations on it' do + null_ptr = FFI::Pointer::NULL + expect { null_ptr.read_int }.to raise_error(FFI::NullPointerError) + expect { null_ptr.write_int(0xff1) }.to raise_error(FFI::NullPointerError) + end + it 'returns true when compared with nil' do + expect((FFI::Pointer::NULL == nil)).to be true + end + end + + it "Pointer.size returns sizeof pointer on platform" do + expect(FFI::Pointer.size).to eq((FFI::Platform::ADDRESS_SIZE / 8)) + end + + describe "#slice" do + before(:each) do + @mptr = FFI::MemoryPointer.new(:char, 12) + @mptr.put_uint(0, 0x12345678) + @mptr.put_uint(4, 0xdeadbeef) + end + + it "contents of sliced pointer matches original pointer at offset" do + expect(@mptr.slice(4, 4).get_uint(0)).to eq(0xdeadbeef) + end + + it "modifying sliced pointer is reflected in original pointer" do + @mptr.slice(4, 4).put_uint(0, 0xfee1dead) + expect(@mptr.get_uint(4)).to eq(0xfee1dead) + end + + it "access beyond bounds should raise IndexError" do + expect { @mptr.slice(4, 4).get_int(4) }.to raise_error(IndexError) + end + end + + describe "#type_size" do + it "should be same as FFI.type_size(type)" do + expect(FFI::MemoryPointer.new(:int, 1).type_size).to eq(FFI.type_size(:int)) + end + end +end + +describe "AutoPointer" do + loop_count = 30 + wiggle_room = 5 # GC rarely cleans up all objects. we can get most of them, and that's enough to determine if the basic functionality is working. + magic = 0x12345678 + + class AutoPointerTestHelper + @@count = 0 + def self.release + @@count += 1 if @@count > 0 + end + def self.reset + @@count = 0 + end + def self.gc_everything(count) + loop = 5 + while @@count < count && loop > 0 + loop -= 1 + TestLibrary.force_gc + sleep 0.05 unless @@count == count + end + @@count = 0 + end + def self.finalizer + self.method(:release).to_proc + end + end + class AutoPointerSubclass < FFI::AutoPointer + def self.release(ptr); end + end + + # see #427 + it "cleanup via default release method", :broken => true do + expect(AutoPointerSubclass).to receive(:release).at_least(loop_count-wiggle_room).times + AutoPointerTestHelper.reset + loop_count.times do + # note that if we called + # AutoPointerTestHelper.method(:release).to_proc inline, we'd + # have a reference to the pointer and it would never get GC'd. + AutoPointerSubclass.new(PointerTestLib.ptr_from_address(magic)) + end + AutoPointerTestHelper.gc_everything loop_count + end + + # see #427 + it "cleanup when passed a proc", :broken => true do + # NOTE: passing a proc is touchy, because it's so easy to create a memory leak. + # + # specifically, if we made an inline call to + # + # AutoPointerTestHelper.method(:release).to_proc + # + # we'd have a reference to the pointer and it would + # never get GC'd. + expect(AutoPointerTestHelper).to receive(:release).at_least(loop_count-wiggle_room).times + AutoPointerTestHelper.reset + loop_count.times do + FFI::AutoPointer.new(PointerTestLib.ptr_from_address(magic), + AutoPointerTestHelper.finalizer) + end + AutoPointerTestHelper.gc_everything loop_count + end + + # see #427 + it "cleanup when passed a method", :broken => true do + expect(AutoPointerTestHelper).to receive(:release).at_least(loop_count-wiggle_room).times + AutoPointerTestHelper.reset + loop_count.times do + FFI::AutoPointer.new(PointerTestLib.ptr_from_address(magic), + AutoPointerTestHelper.method(:release)) + end + AutoPointerTestHelper.gc_everything loop_count + end + + it "can be used as the return type of a function" do + expect do + Module.new do + extend FFI::Library + ffi_lib TestLibrary::PATH + class CustomAutoPointer < FFI::AutoPointer + def self.release(ptr); end + end + attach_function :ptr_from_address, [ FFI::Platform::ADDRESS_SIZE == 32 ? :uint : :ulong_long ], CustomAutoPointer + end + end.not_to raise_error + end + + describe "#new" do + it "MemoryPointer argument raises TypeError" do + expect { FFI::AutoPointer.new(FFI::MemoryPointer.new(:int))}.to raise_error(::TypeError) + end + it "AutoPointer argument raises TypeError" do + expect { AutoPointerSubclass.new(AutoPointerSubclass.new(PointerTestLib.ptr_from_address(0))) }.to raise_error(::TypeError) + end + it "Buffer argument raises TypeError" do + expect { FFI::AutoPointer.new(FFI::Buffer.new(:int))}.to raise_error(::TypeError) + end + + end + + describe "#autorelease?" do + ptr_class = Class.new(FFI::AutoPointer) do + def self.release(ptr); end + end + + it "should be true by default" do + expect(ptr_class.new(FFI::Pointer.new(0xdeadbeef)).autorelease?).to be true + end + + it "should return false when autorelease=(false)" do + ptr = ptr_class.new(FFI::Pointer.new(0xdeadbeef)) + ptr.autorelease = false + expect(ptr.autorelease?).to be false + end + end + + describe "#type_size" do + ptr_class = Class.new(FFI::AutoPointer) do + def self.release(ptr); end + end + + it "type_size of AutoPointer should match wrapped Pointer" do + aptr = ptr_class.new(FFI::Pointer.new(:int, 0xdeadbeef)) + expect(aptr.type_size).to eq(FFI.type_size(:int)) + end + + it "[] offset should match wrapped Pointer" do + mptr = FFI::MemoryPointer.new(:int, 1024) + aptr = ptr_class.new(FFI::Pointer.new(:int, mptr)) + aptr[0].write_uint(0xfee1dead) + aptr[1].write_uint(0xcafebabe) + expect(mptr[0].read_uint).to eq(0xfee1dead) + expect(mptr[1].read_uint).to eq(0xcafebabe) + end + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/rbx/attach_function_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/rbx/attach_function_spec.rb new file mode 100644 index 000000000..e90f535f5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/rbx/attach_function_spec.rb @@ -0,0 +1,33 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +class Timeval < FFI::Struct + layout :tv_sec, :ulong, 0, :tv_usec, :ulong, 4 +end + +module LibC + extend FFI::Library + ffi_lib FFI::Library::LIBC + + attach_function :gettimeofday, [:pointer, :pointer], :int +end + +describe FFI::Library, "#attach_function" do + it "correctly returns a value for gettimeofday" do + t = Timeval.new + time = LibC.gettimeofday(t.pointer, nil) + expect(time).to be_kind_of(Integer) + end + + it "correctly populates a struct for gettimeofday" do + t = Timeval.new + LibC.gettimeofday(t.pointer, nil) + expect(t[:tv_sec]).to be_kind_of(Numeric) + expect(t[:tv_usec]).to be_kind_of(Numeric) + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/rbx/memory_pointer_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/rbx/memory_pointer_spec.rb new file mode 100644 index 000000000..0fe359774 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/rbx/memory_pointer_spec.rb @@ -0,0 +1,130 @@ +# coding: utf-8 +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +module CTest + extend FFI::Library + ffi_lib FFI::Library::LIBC + + attach_function :strcat, [:pointer, :pointer], :pointer +end + +describe "MemoryPointer" do + it "makes a pointer from a string" do + m = FFI::MemoryPointer.from_string("FFI is Awesome") + expect(m.total).to eq(15) + expect(m.type_size).to eq(1) + end + + it "does not make a pointer from non-strings" do + expect { FFI::MemoryPointer.from_string(nil) }.to raise_error(TypeError) + end + + it "makes a pointer from a string with multibyte characters" do + m = FFI::MemoryPointer.from_string("ぱんだ") + expect(m.total).to eq(10) + expect(m.type_size).to eq(1) + end + + it "reads back a string" do + m = FFI::MemoryPointer.from_string("FFI is Awesome") + expect(m.read_string).to eq("FFI is Awesome") + end + + it "makes a pointer for a certain number of bytes" do + m = FFI::MemoryPointer.new(8) + m.write_array_of_int([1,2]) + expect(m.read_array_of_int(2)).to eq([1,2]) + end + + it "allows access to an element of the pointer (as an array)" do + m = FFI::MemoryPointer.new(:int, 2) + m.write_array_of_int([1,2]) + expect(m[0].read_int).to eq(1) + expect(m[1].read_int).to eq(2) + end + + it "allows writing as an int" do + m = FFI::MemoryPointer.new(:int) + m.write_int(1) + expect(m.read_int).to eq(1) + end + + it "allows writing as a long" do + m = FFI::MemoryPointer.new(:long) + m.write_long(10) + expect(m.read_long).to eq(10) + end + + it "raises an error if you try putting a long into a pointer of size 1" do + m = FFI::MemoryPointer.new(1) + expect { m.write_long(10) }.to raise_error + end + + it "raises an error if you try putting an int into a pointer of size 1" do + m = FFI::MemoryPointer.new(1) + expect { m.write_int(10) }.to raise_error + end +# it "does not raise IndexError for opaque pointers" do +# m = FFI::MemoryPointer.new(8) +# p2 = FFI::MemoryPointer.new(1024) +# m.write_long(p2.address) +# p = m.read_pointer +# lambda { p.write_int(10) }.should_not raise_error +# end + + it "makes a pointer for a certain type" do + m = FFI::MemoryPointer.new(:int) + m.write_int(10) + expect(m.read_int).to eq(10) + end + + it "makes a memory pointer for a number of a certain type" do + m = FFI::MemoryPointer.new(:int, 2) + m.write_array_of_int([1,2]) + expect(m.read_array_of_int(2)).to eq([1,2]) + end + + it "makes a pointer for an object responding to #size" do + m = FFI::MemoryPointer.new(Struct.new(:size).new(8)) + m.write_array_of_int([1,2]) + expect(m.read_array_of_int(2)).to eq([1,2]) + end + + it "makes a pointer for a number of an object responding to #size" do + m = FFI::MemoryPointer.new(Struct.new(:size).new(4), 2) + m.write_array_of_int([1,2]) + expect(m.read_array_of_int(2)).to eq([1,2]) + end + + it "MemoryPointer#address returns correct value" do + m = FFI::MemoryPointer.new(:long_long) + magic = 0x12345678 + m.write_long(magic) + expect(m.read_pointer.address).to eq(magic) + end + + it "MemoryPointer#null? returns true for zero value" do + m = FFI::MemoryPointer.new(:long_long) + m.write_long(0) + expect(m.read_pointer.null?).to be true + end + + it "MemoryPointer#null? returns false for non-zero value" do + m = FFI::MemoryPointer.new(:long_long) + m.write_long(0x12345678) + expect(m.read_pointer.null?).to be false + end + + it "initialize with block should execute block" do + block_executed = false + FFI::MemoryPointer.new(:pointer) do |ptr| + block_executed = true + end + expect(block_executed).to be true + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/rbx/spec_helper.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/rbx/spec_helper.rb new file mode 100644 index 000000000..6e009d874 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/rbx/spec_helper.rb @@ -0,0 +1,6 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "../spec_helper")) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/rbx/struct_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/rbx/struct_spec.rb new file mode 100644 index 000000000..a7ed85b44 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/rbx/struct_spec.rb @@ -0,0 +1,18 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +class Timeval < FFI::Struct + layout :tv_sec, :ulong, 0, :tv_usec, :ulong, 4 +end + +describe FFI::Struct do + it "allows setting fields" do + t = Timeval.new + t[:tv_sec] = 12 + expect(t[:tv_sec]).to eq(12) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/spec_helper.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/spec_helper.rb new file mode 100644 index 000000000..0c173e428 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/spec_helper.rb @@ -0,0 +1,93 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require 'rbconfig' +require 'fileutils' +require 'ffi' + +RSpec.configure do |c| + c.filter_run_excluding :broken => true +end + +CPU = case RbConfig::CONFIG['host_cpu'].downcase + when /i[3456]86/ + # Darwin always reports i686, even when running in 64bit mode + if RbConfig::CONFIG['host_os'] =~ /darwin/ && 0xfee1deadbeef.is_a?(Fixnum) + "x86_64" + else + "i386" + end + + when /amd64|x86_64/ + "x86_64" + + when /ppc64|powerpc64/ + "powerpc64" + + when /ppc|powerpc/ + "powerpc" + + when /^arm/ + "arm" + + else + RbConfig::CONFIG['host_cpu'] + end + +OS = case RbConfig::CONFIG['host_os'].downcase + when /linux/ + "linux" + when /darwin/ + "darwin" + when /freebsd/ + "freebsd" + when /openbsd/ + "openbsd" + when /sunos|solaris/ + "solaris" + when /mswin|mingw/ + "win32" + else + RbConfig::CONFIG['host_os'].downcase + end + +def compile_library(path, lib) + + dir = File.expand_path(path, File.dirname(__FILE__)) + lib = "#{dir}/#{lib}" + if !File.exist?(lib) + output = nil + FileUtils.cd(dir) do + output = system(*%{#{system('which gmake >/dev/null') && 'gmake' || 'make'} CPU=#{CPU} OS=#{OS} }.tap{|x| puts x.inspect}) + end + + if $?.exitstatus != 0 + puts "ERROR:\n#{output}" + raise "Unable to compile \"#{lib}\"" + end + end + + lib +end + +require "ffi" + +module TestLibrary + PATH = compile_library("fixtures", "libtest.#{FFI::Platform::LIBSUFFIX}") + + def self.force_gc + if RUBY_PLATFORM =~ /java/ + java.lang.System.gc + elsif defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx' + GC.run(true) + else + GC.start + end + end +end +module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/string_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/string_spec.rb new file mode 100644 index 000000000..fac11f00b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/string_spec.rb @@ -0,0 +1,118 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) +describe "String tests" do + include FFI + module StrLibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + attach_function :ptr_ret_pointer, [ :pointer, :int], :string + attach_function :string_equals, [ :string, :string ], :int + attach_function :string_dummy, [ :string ], :void + attach_function :string_null, [ ], :string + end + + it "MemoryPointer#get_string returns a tainted string" do + mp = FFI::MemoryPointer.new 1024 + mp.put_string(0, "test\0") + str = mp.get_string(0) + expect(str.tainted?).to be true + end + + it "String returned by a method is tainted" do + mp = FFI::MemoryPointer.new :pointer + sp = FFI::MemoryPointer.new 1024 + sp.put_string(0, "test") + mp.put_pointer(0, sp) + str = StrLibTest.ptr_ret_pointer(mp, 0) + expect(str).to eq("test") + expect(str).to be_tainted + end + + it "Poison null byte raises error" do + s = "123\0abc" + expect { StrLibTest.string_equals(s, s) }.to raise_error + end + + it "Tainted String parameter should throw a SecurityError" do + $SAFE = 1 + str = "test" + str.taint + begin + expect(LibTest.string_equals(str, str)).to be false + rescue SecurityError + end + end if false + it "casts nil as NULL pointer" do + expect(StrLibTest.string_dummy(nil)).to be_nil + end + + it "return nil for NULL char*" do + expect(StrLibTest.string_null).to be_nil + end + + it "reads an array of strings until encountering a NULL pointer" do + strings = ["foo", "bar", "baz", "testing", "ffi"] + ptrary = FFI::MemoryPointer.new(:pointer, 6) + ary = strings.inject([]) do |a, str| + f = FFI::MemoryPointer.new(1024) + f.put_string(0, str) + a << f + end + ary.insert(3, nil) + ptrary.write_array_of_pointer(ary) + expect(ptrary.get_array_of_string(0)).to eq(["foo", "bar", "baz"]) + end + + it "reads an array of strings of the size specified, substituting nil when a pointer is NULL" do + strings = ["foo", "bar", "baz", "testing", "ffi"] + ptrary = FFI::MemoryPointer.new(:pointer, 6) + ary = strings.inject([]) do |a, str| + f = FFI::MemoryPointer.new(1024) + f.put_string(0, str) + a << f + end + ary.insert(2, nil) + ptrary.write_array_of_pointer(ary) + expect(ptrary.get_array_of_string(0, 4)).to eq(["foo", "bar", nil, "baz"]) + end + + it "reads an array of strings, taking a memory offset parameter" do + strings = ["foo", "bar", "baz", "testing", "ffi"] + ptrary = FFI::MemoryPointer.new(:pointer, 5) + ary = strings.inject([]) do |a, str| + f = FFI::MemoryPointer.new(1024) + f.put_string(0, str) + a << f + end + ptrary.write_array_of_pointer(ary) + expect(ptrary.get_array_of_string(2 * FFI.type_size(:pointer), 3)).to eq(["baz", "testing", "ffi"]) + end + + it "raises an IndexError when trying to read an array of strings out of bounds" do + strings = ["foo", "bar", "baz", "testing", "ffi"] + ptrary = FFI::MemoryPointer.new(:pointer, 5) + ary = strings.inject([]) do |a, str| + f = FFI::MemoryPointer.new(1024) + f.put_string(0, str) + a << f + end + ptrary.write_array_of_pointer(ary) + expect { ptrary.get_array_of_string(0, 6) }.to raise_error + end + + it "raises an IndexError when trying to read an array of strings using a negative offset" do + strings = ["foo", "bar", "baz", "testing", "ffi"] + ptrary = FFI::MemoryPointer.new(:pointer, 5) + ary = strings.inject([]) do |a, str| + f = FFI::MemoryPointer.new(1024) + f.put_string(0, str) + a << f + end + ptrary.write_array_of_pointer(ary) + expect { ptrary.get_array_of_string(-1) }.to raise_error + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/strptr_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/strptr_spec.rb new file mode 100644 index 000000000..a6400f4d8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/strptr_spec.rb @@ -0,0 +1,50 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe "functions returning :strptr" do + + it "can attach function with :strptr return type" do + expect do + Module.new do + extend FFI::Library + ffi_lib FFI::Library::LIBC + if !FFI::Platform.windows? + attach_function :strdup, [ :string ], :strptr + else + attach_function :_strdup, [ :string ], :strptr + end + end + end.not_to raise_error + end + + module StrPtr + extend FFI::Library + ffi_lib FFI::Library::LIBC + attach_function :free, [ :pointer ], :void + if !FFI::Platform.windows? + attach_function :strdup, [ :string ], :strptr + else + attach_function :strdup, :_strdup, [ :string ], :strptr + end + end + + it "should return [ String, Pointer ]" do + result = StrPtr.strdup("test") + expect(result[0].is_a?(String)).to be true + expect(result[1].is_a?(FFI::Pointer)).to be true + end + + it "should return the correct value" do + result = StrPtr.strdup("test") + expect(result[0]).to eq("test") + end + + it "should return non-NULL pointer" do + result = StrPtr.strdup("test") + expect(result[1]).not_to be_null + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/struct_by_ref_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/struct_by_ref_spec.rb new file mode 100644 index 000000000..0858423a4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/struct_by_ref_spec.rb @@ -0,0 +1,43 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe FFI::Struct, ' by_ref' do + before :all do + @struct_class = struct_class = Class.new(FFI::Struct) do + layout :a, :pointer + end + + @api = Module.new do + extend FFI::Library + ffi_lib TestLibrary::PATH + fn = FFI::Type::POINTER.size == FFI::Type::LONG.size ? :ret_ulong : :ret_u64 + attach_function :struct_test, fn, [ struct_class.by_ref ], :pointer + end + end + + it "should accept instances of exact struct class" do + s = @struct_class.new + expect(@api.struct_test(s)).to eq(s.pointer) + end + + it "should accept nil" do + expect(@api.struct_test(nil)).to be_null + end + + it "should reject other types" do + expect { expect(@api.struct_test('test')).to be_nil }.to raise_error(TypeError) + end + + it "should reject instances of other struct classes" do + other_class = Class.new(FFI::Struct) do + layout :a, :pointer + end + + expect { @api.struct_test(other_class.new) }.to raise_error(TypeError) + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/struct_callback_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/struct_callback_spec.rb new file mode 100644 index 000000000..7cab301bb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/struct_callback_spec.rb @@ -0,0 +1,69 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe FFI::Struct, ' with inline callback functions' do + it 'should be able to define inline callback field' do + expect(module CallbackMember1 + extend FFI::Library + ffi_lib TestLibrary::PATH + DUMMY_CB = callback :dummy_cb, [ :int ], :int + class TestStruct < FFI::Struct + layout \ + :add, callback([ :int, :int ], :int), + :sub, callback([ :int, :int ], :int), + :cb_with_cb_parameter, callback([ DUMMY_CB, :int ], :int) + end + attach_function :struct_call_add_cb, [TestStruct, :int, :int], :int + attach_function :struct_call_sub_cb, [TestStruct, :int, :int], :int + end).to be_an_instance_of FFI::Function + end + + it 'should take methods as callbacks' do + module CallbackMember2 + extend FFI::Library + ffi_lib TestLibrary::PATH + class TestStruct < FFI::Struct + layout \ + :add, callback([ :int, :int ], :int), + :sub, callback([ :int, :int ], :int) + end + attach_function :struct_call_add_cb, [TestStruct, :int, :int], :int + attach_function :struct_call_sub_cb, [TestStruct, :int, :int], :int + end + module StructCallbacks + def self.add a, b + a+b + end + end + + ts = CallbackMember2::TestStruct.new + ts[:add] = StructCallbacks.method(:add) + + expect(CallbackMember2.struct_call_add_cb(ts, 1, 2)).to eq(3) + end + + it 'should return callable object from []' do + module CallbackMember3 + extend FFI::Library + ffi_lib TestLibrary::PATH + class TestStruct < FFI::Struct + layout \ + :add, callback([ :int, :int ], :int), + :sub, callback([ :int, :int ], :int) + end + attach_function :struct_call_add_cb, [TestStruct, :int, :int], :int + attach_function :struct_call_sub_cb, [TestStruct, :int, :int], :int + end + + s = CallbackMember3::TestStruct.new + add = Proc.new { |a,b| a+b} + s[:add] = add + fn = s[:add] + expect(fn.respond_to?(:call)).to be true + expect(fn.call(1, 2)).to eq(3) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/struct_initialize_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/struct_initialize_spec.rb new file mode 100644 index 000000000..beb2477ec --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/struct_initialize_spec.rb @@ -0,0 +1,35 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe FFI::Struct, ' with an initialize function' do + it "should call the initialize function" do + class StructWithInitialize < FFI::Struct + layout :string, :string + attr_accessor :magic + def initialize + super + self.magic = 42 + end + end + expect(StructWithInitialize.new.magic).to eq(42) + end +end + +describe FFI::ManagedStruct, ' with an initialize function' do + it "should call the initialize function" do + class ManagedStructWithInitialize < FFI::ManagedStruct + layout :string, :string + attr_accessor :magic + def initialize + super FFI::MemoryPointer.new(:pointer).put_int(0, 0x1234).get_pointer(0) + self.magic = 42 + end + def self.release;end + end + expect(ManagedStructWithInitialize.new.magic).to eq(42) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/struct_packed_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/struct_packed_spec.rb new file mode 100644 index 000000000..8132be728 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/struct_packed_spec.rb @@ -0,0 +1,50 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe FFI::Struct do + it "packed :char followed by :int should have size of 5" do + expect(Class.new(FFI::Struct) do + packed + layout :c, :char, :i, :int + end.size).to eq(5) + end + + it "packed :char followed by :int should have alignment of 1" do + expect(Class.new(FFI::Struct) do + packed + layout :c, :char, :i, :int + end.alignment).to eq(1) + end + + it "packed(2) :char followed by :int should have size of 6" do + expect(Class.new(FFI::Struct) do + packed 2 + layout :c, :char, :i, :int + end.size).to eq(6) + end + + it "packed(2) :char followed by :int should have alignment of 2" do + expect(Class.new(FFI::Struct) do + packed 2 + layout :c, :char, :i, :int + end.alignment).to eq(2) + end + + it "packed :short followed by int should have size of 6" do + expect(Class.new(FFI::Struct) do + packed + layout :s, :short, :i, :int + end.size).to eq(6) + end + + it "packed :short followed by int should have alignment of 1" do + expect(Class.new(FFI::Struct) do + packed + layout :s, :short, :i, :int + end.alignment).to eq(1) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/struct_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/struct_spec.rb new file mode 100644 index 000000000..172875874 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/struct_spec.rb @@ -0,0 +1,886 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe "Struct aligns fields correctly" do + it "char, followed by an int" do + pending("not supported in 1.8") if RUBY_VERSION =~ /1.8.*/ + class CIStruct < FFI::Struct + layout :c => :char, :i => :int + end + expect(CIStruct.size).to eq(8) + end + + it "short, followed by an int" do + pending("not supported in 1.8") if RUBY_VERSION =~ /1.8.*/ + class SIStruct < FFI::Struct + layout :s => :short, :i => :int + end + expect(SIStruct.size).to eq(8) + end + + it "int, followed by an int" do + pending("not supported in 1.8") if RUBY_VERSION =~ /1.8.*/ + class IIStruct < FFI::Struct + layout :i1 => :int, :i => :int + end + expect(IIStruct.size).to eq(8) + end + + it "long long, followed by an int" do + pending("not supported in 1.8") if RUBY_VERSION =~ /1.8.*/ + class LLIStruct < FFI::Struct + layout :l => :long_long, :i => :int + end + expect(LLIStruct.size).to eq(FFI::TYPE_UINT64.alignment == 4 ? 12 : 16) + end +end + +describe "Struct tests" do + StructTypes = { + 's8' => :char, + 's16' => :short, + 's32' => :int, + 's64' => :long_long, + 'long' => :long, + 'f32' => :float, + 'f64' => :double + } + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + attach_function :ptr_ret_pointer, [ :pointer, :int], :string + begin + attach_function :ptr_ret_int32_t, [ :pointer, :int ], :int + rescue FFI::NotFoundError + # NetBSD uses #define instead of typedef for these + attach_function :ptr_ret_int32_t, :ptr_ret___int32_t, [ :pointer, :int ], :int + end + attach_function :ptr_from_address, [ :ulong ], :pointer + attach_function :string_equals, [ :string, :string ], :int + [ 's8', 's16', 's32', 's64', 'f32', 'f64', 'long' ].each do |t| + attach_function "struct_align_#{t}", [ :pointer ], StructTypes[t] + end + end + class PointerMember < FFI::Struct + layout :pointer, :pointer + end + class StringMember < FFI::Struct + layout :string, :string + end + + it "Struct#[:pointer]" do + magic = 0x12345678 + mp = FFI::MemoryPointer.new :long + mp.put_long(0, magic) + smp = FFI::MemoryPointer.new :pointer + smp.put_pointer(0, mp) + s = PointerMember.new smp + expect(s[:pointer]).to eq(mp) + end + + it "Struct#[:pointer].nil? for NULL value" do + magic = 0x12345678 + mp = FFI::MemoryPointer.new :long + mp.put_long(0, magic) + smp = FFI::MemoryPointer.new :pointer + smp.put_pointer(0, nil) + s = PointerMember.new smp + expect(s[:pointer].null?).to be true + end + + it "Struct#[:pointer]=" do + magic = 0x12345678 + mp = FFI::MemoryPointer.new :long + mp.put_long(0, magic) + smp = FFI::MemoryPointer.new :pointer + s = PointerMember.new smp + s[:pointer] = mp + expect(smp.get_pointer(0)).to eq(mp) + end + + it "Struct#[:pointer]=struct" do + smp = FFI::MemoryPointer.new :pointer + s = PointerMember.new smp + expect { s[:pointer] = s }.not_to raise_error Exception + expect { s[:pointer].nil? }.not_to raise_error Exception + end + + it "Struct#[:pointer]=nil" do + smp = FFI::MemoryPointer.new :pointer + s = PointerMember.new smp + s[:pointer] = nil + expect(smp.get_pointer(0)).to be_null + end + + it "Struct#[:string]" do + magic = "test" + mp = FFI::MemoryPointer.new 1024 + mp.put_string(0, magic) + smp = FFI::MemoryPointer.new :pointer + smp.put_pointer(0, mp) + s = StringMember.new smp + expect(s[:string]).to eq(magic) + end + + it "Struct#[:string].nil? for NULL value" do + smp = FFI::MemoryPointer.new :pointer + smp.put_pointer(0, nil) + s = StringMember.new smp + expect(s[:string]).to be_nil + end + + it "Struct#layout works with :name, :type pairs" do + class PairLayout < FFI::Struct + layout :a, :int, :b, :long_long + end + ll_off = (FFI::TYPE_UINT64.alignment == 4 ? 4 : 8) + expect(PairLayout.size).to eq((ll_off + 8)) + mp = FFI::MemoryPointer.new(PairLayout.size) + s = PairLayout.new mp + s[:a] = 0x12345678 + expect(mp.get_int(0)).to eq(0x12345678) + s[:b] = 0xfee1deadbeef + expect(mp.get_int64(ll_off)).to eq(0xfee1deadbeef) + end + + it "Struct#layout works with :name, :type, offset tuples" do + class PairLayout < FFI::Struct + layout :a, :int, 0, :b, :long_long, 4 + end + expect(PairLayout.size).to eq((FFI::TYPE_UINT64.alignment == 4 ? 12 : 16)) + mp = FFI::MemoryPointer.new(PairLayout.size) + s = PairLayout.new mp + s[:a] = 0x12345678 + expect(mp.get_int(0)).to eq(0x12345678) + s[:b] = 0xfee1deadbeef + expect(mp.get_int64(4)).to eq(0xfee1deadbeef) + end + + it "Struct#layout works with mixed :name,:type and :name,:type,offset" do + class MixedLayout < FFI::Struct + layout :a, :int, :b, :long_long, 4 + end + expect(MixedLayout.size).to eq((FFI::TYPE_UINT64.alignment == 4 ? 12 : 16)) + mp = FFI::MemoryPointer.new(MixedLayout.size) + s = MixedLayout.new mp + s[:a] = 0x12345678 + expect(mp.get_int(0)).to eq(0x12345678) + s[:b] = 0xfee1deadbeef + expect(mp.get_int64(4)).to eq(0xfee1deadbeef) + end + + rb_maj, rb_min = RUBY_VERSION.split('.') + if rb_maj.to_i >= 1 && rb_min.to_i >= 9 || RUBY_PLATFORM =~ /java/ + it "Struct#layout withs with a hash of :name => type" do + class HashLayout < FFI::Struct + layout :a => :int, :b => :long_long + end + ll_off = (FFI::TYPE_UINT64.alignment == 4 ? 4 : 8) + expect(HashLayout.size).to eq(ll_off + 8) + mp = FFI::MemoryPointer.new(HashLayout.size) + s = HashLayout.new mp + s[:a] = 0x12345678 + expect(mp.get_int(0)).to eq(0x12345678) + s[:b] = 0xfee1deadbeef + expect(mp.get_int64(ll_off)).to eq(0xfee1deadbeef) + end + end + + it "subclass overrides initialize without calling super" do + class InitializeWithoutSuper < FFI::Struct + layout :a, :int, :b, :long_long, :d, [:double, 2] + + def initialize(a, b) + self[:a] = a + self[:b] = b + self[:d][0] = 1.2 + self[:d][1] = 3.4 + end + + end + s = InitializeWithoutSuper.new(0x1eefbeef, 0xdeadcafebabe) + expect(s[:a]).to eq(0x1eefbeef) + expect(s[:b]).to eq(0xdeadcafebabe) + end + + it "Can use Struct subclass as parameter type" do + expect(module StructParam + extend FFI::Library + ffi_lib TestLibrary::PATH + class TestStruct < FFI::Struct + layout :c, :char + end + attach_function :struct_field_s8, [ TestStruct.in ], :char + end).to be_an_instance_of FFI::Function + end + + it "Can use Struct subclass as IN parameter type" do + expect(module StructParam2 + extend FFI::Library + ffi_lib TestLibrary::PATH + class TestStruct < FFI::Struct + layout :c, :char + end + attach_function :struct_field_s8, [ TestStruct.in ], :char + end).to be_an_instance_of FFI::Function + end + + it "Can use Struct subclass as OUT parameter type" do + expect(module StructParam3 + extend FFI::Library + ffi_lib TestLibrary::PATH + class TestStruct < FFI::Struct + layout :c, :char + end + attach_function :struct_field_s8, [ TestStruct.out ], :char + end).to be_an_instance_of FFI::Function + end + + it "can be passed directly as a :pointer parameter" do + class TestStruct < FFI::Struct + layout :i, :int + end + s = TestStruct.new + s[:i] = 0x12 + expect(LibTest.ptr_ret_int32_t(s, 0)).to eq(0x12) + end + + it ":char member aligned correctly" do + class AlignChar < FFI::Struct + layout :c, :char, :v, :char + end + s = AlignChar.new + s[:v] = 0x12 + expect(LibTest.struct_align_s8(s.pointer)).to eq(0x12) + end + + it ":short member aligned correctly" do + class AlignShort < FFI::Struct + layout :c, :char, :v, :short + end + s = AlignShort.alloc_in + s[:v] = 0x1234 + expect(LibTest.struct_align_s16(s.pointer)).to eq(0x1234) + end + + it ":int member aligned correctly" do + class AlignInt < FFI::Struct + layout :c, :char, :v, :int + end + s = AlignInt.alloc_in + s[:v] = 0x12345678 + expect(LibTest.struct_align_s32(s.pointer)).to eq(0x12345678) + end + + it ":long_long member aligned correctly" do + class AlignLongLong < FFI::Struct + layout :c, :char, :v, :long_long + end + s = AlignLongLong.alloc_in + s[:v] = 0x123456789abcdef0 + expect(LibTest.struct_align_s64(s.pointer)).to eq(0x123456789abcdef0) + end + + it ":long member aligned correctly" do + class AlignLong < FFI::Struct + layout :c, :char, :v, :long + end + s = AlignLong.alloc_in + s[:v] = 0x12345678 + expect(LibTest.struct_align_long(s.pointer)).to eq(0x12345678) + end + + it ":float member aligned correctly" do + class AlignFloat < FFI::Struct + layout :c, :char, :v, :float + end + s = AlignFloat.alloc_in + s[:v] = 1.23456 + expect((LibTest.struct_align_f32(s.pointer) - 1.23456).abs).to be < 0.00001 + end + + it ":double member aligned correctly" do + class AlignDouble < FFI::Struct + layout :c, :char, :v, :double + end + s = AlignDouble.alloc_in + s[:v] = 1.23456789 + expect((LibTest.struct_align_f64(s.pointer) - 1.23456789).abs).to be < 0.00000001 + end + + it ":ulong, :pointer struct" do + class ULPStruct < FFI::Struct + layout :ul, :ulong, :p, :pointer + end + s = ULPStruct.alloc_in + s[:ul] = 0xdeadbeef + s[:p] = LibTest.ptr_from_address(0x12345678) + expect(s.pointer.get_ulong(0)).to eq(0xdeadbeef) + end + def test_num_field(type, v) + klass = Class.new(FFI::Struct) + klass.layout :v, type, :dummy, :long + + s = klass.new + s[:v] = v + expect(s.pointer.send("get_#{type.to_s}", 0)).to eq(v) + s.pointer.send("put_#{type.to_s}", 0, 0) + expect(s[:v]).to eq(0) + end + def self.int_field_test(type, values) + values.each do |v| + it "#{type} field r/w (#{v.to_s(16)})" do + test_num_field(type, v) + end + end + end + int_field_test(:char, [ 0, 127, -128, -1 ]) + int_field_test(:uchar, [ 0, 0x7f, 0x80, 0xff ]) + int_field_test(:short, [ 0, 0x7fff, -0x8000, -1 ]) + int_field_test(:ushort, [ 0, 0x7fff, 0x8000, 0xffff ]) + int_field_test(:int, [ 0, 0x7fffffff, -0x80000000, -1 ]) + int_field_test(:uint, [ 0, 0x7fffffff, 0x80000000, 0xffffffff ]) + int_field_test(:long_long, [ 0, 0x7fffffffffffffff, -0x8000000000000000, -1 ]) + int_field_test(:ulong_long, [ 0, 0x7fffffffffffffff, 0x8000000000000000, 0xffffffffffffffff ]) + if FFI::Platform::LONG_SIZE == 32 + int_field_test(:long, [ 0, 0x7fffffff, -0x80000000, -1 ]) + int_field_test(:ulong, [ 0, 0x7fffffff, 0x80000000, 0xffffffff ]) + else + int_field_test(:long, [ 0, 0x7fffffffffffffff, -0x8000000000000000, -1 ]) + int_field_test(:ulong, [ 0, 0x7fffffffffffffff, 0x8000000000000000, 0xffffffffffffffff ]) + end + + it ":float field r/w" do + klass = Class.new(FFI::Struct) + klass.layout :v, :float, :dummy, :long + + s = klass.new + value = 1.23456 + s[:v] = value + expect((s.pointer.get_float(0) - value).abs).to be < 0.0001 + end + + it ":double field r/w" do + klass = Class.new(FFI::Struct) + klass.layout :v, :double, :dummy, :long + + s = klass.new + value = 1.23456 + s[:v] = value + expect((s.pointer.get_double(0) - value).abs).to be < 0.0001 + end + module EnumFields + extend FFI::Library + TestEnum = enum :test_enum, [:c1, 10, :c2, 20, :c3, 30, :c4, 40] + class TestStruct < FFI::Struct + layout :a, :int, :c, :test_enum, + :d, [ TestEnum, TestEnum.symbols.length ] + end + end + + it ":enum field r/w" do + s = EnumFields::TestStruct.new + s[:c] = :c3 + + expect(s.pointer.get_uint(FFI::Type::INT32.size)).to eq(30) + expect(s[:c]).to eq(:c3) + end + + it "array of :enum field" do + s = EnumFields::TestStruct.new + EnumFields::TestEnum.symbols.each_with_index do |val, i| + s[:d][i] = val + end + + EnumFields::TestEnum.symbols.each_with_index do |val, i| + expect(s.pointer.get_uint(FFI::Type::INT32.size * (2 + i))).to eq(EnumFields::TestEnum[val]) + end + + s[:d].each_with_index do |val, i| + expect(val).to eq(EnumFields::TestEnum.symbols[i]) + end + end + + module CallbackMember + extend FFI::Library + ffi_lib TestLibrary::PATH + callback :add, [ :int, :int ], :int + callback :sub, [ :int, :int ], :int + class TestStruct < FFI::Struct + layout :add, :add, + :sub, :sub + end + attach_function :struct_call_add_cb, [TestStruct.in, :int, :int], :int + attach_function :struct_call_sub_cb, [TestStruct.in, :int, :int], :int + end + + it "Can have CallbackInfo struct field" do + s = CallbackMember::TestStruct.new + add_proc = lambda { |a, b| a+b } + sub_proc = lambda { |a, b| a-b } + s[:add] = add_proc + s[:sub] = sub_proc + expect(CallbackMember.struct_call_add_cb(s, 40, 2)).to eq(42) + expect(CallbackMember.struct_call_sub_cb(s, 44, 2)).to eq(42) + end + + it "Can return its members as a list" do + class TestStruct < FFI::Struct + layout :a, :int, :b, :int, :c, :int + end + expect(TestStruct.members).to include(:a, :b, :c) + end + + it "Can return its instance members and values as lists" do + class TestStruct < FFI::Struct + layout :a, :int, :b, :int, :c, :int + end + s = TestStruct.new + expect(s.members).to include(:a, :b, :c) + s[:a] = 1 + s[:b] = 2 + s[:c] = 3 + expect(s.values).to include(1, 2, 3) + end + + it 'should return an ordered field/offset pairs array' do + class TestStruct < FFI::Struct + layout :a, :int, :b, :int, :c, :int + end + s = TestStruct.new + expect(s.offsets).to eq([[:a, 0], [:b, 4], [:c, 8]]) + expect(TestStruct.offsets).to eq([[:a, 0], [:b, 4], [:c, 8]]) + end + + it "Struct#offset_of returns offset of field within struct" do + class TestStruct < FFI::Struct + layout :a, :int, :b, :int, :c, :int + end + expect(TestStruct.offset_of(:a)).to eq(0) + expect(TestStruct.offset_of(:b)).to eq(4) + expect(TestStruct.offset_of(:c)).to eq(8) + end +end + +describe FFI::Struct, ".layout" do + module FFISpecs + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + begin + attach_function :ptr_ret_int32_t, [ :pointer, :int ], :int + rescue FFI::NotFoundError + # NetBSD uses #define instead of typedef for these + attach_function :ptr_ret_int32_t, :ptr_ret___int32_t, [ :pointer, :int ], :int + end + end + end + + describe "when derived class is not assigned to any constant" do + it "resolves a built-in type" do + klass = Class.new FFI::Struct + klass.layout :number, :int + + instance = klass.new + instance[:number] = 0xA1 + expect(FFISpecs::LibTest.ptr_ret_int32_t(instance, 0)).to eq(0xA1) + end + end + + describe "when derived class is assigned to a constant" do + it "resolves a built-in type" do + class FFISpecs::TestStruct < FFI::Struct + layout :number, :int + end + + instance = FFISpecs::TestStruct.new + instance[:number] = 0xA1 + expect(FFISpecs::LibTest.ptr_ret_int32_t(instance, 0)).to eq(0xA1) + end + + it "resolves a type from the enclosing module" do + module FFISpecs::LibTest + typedef :uint, :custom_int + + class TestStruct < FFI::Struct + layout :number, :custom_int + end + end + + instance = FFISpecs::LibTest::TestStruct.new + instance[:number] = 0xA1 + expect(FFISpecs::LibTest.ptr_ret_int32_t(instance, 0)).to eq(0xA1) + end + end +end + +describe FFI::Struct, ' with a nested struct field' do + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + class NestedStruct < FFI::Struct + layout :i, :int + end + class ContainerStruct < FFI::Struct + layout :first, :char, :ns, NestedStruct + end + attach_function :struct_align_nested_struct, [ :pointer ], :int + attach_function :struct_make_container_struct, [ :int ], :pointer + end + before do + @cs = LibTest::ContainerStruct.new + end + + it 'should align correctly nested struct field' do + @cs[:ns][:i] = 123 + expect(LibTest.struct_align_nested_struct(@cs.to_ptr)).to eq(123) + end + + it 'should correctly calculate Container size (in bytes)' do + expect(LibTest::ContainerStruct.size).to eq(8) + end + + it 'should return a Struct object when the field is accessed' do + expect(@cs[:ns].is_a?(FFI::Struct)).to be true + end + + it 'should read a value from memory' do + @cs = LibTest::ContainerStruct.new(LibTest.struct_make_container_struct(123)) + expect(@cs[:ns][:i]).to eq(123) + end + + it 'should write a value to memory' do + @cs = LibTest::ContainerStruct.new(LibTest.struct_make_container_struct(123)) + @cs[:ns][:i] = 456 + expect(LibTest.struct_align_nested_struct(@cs.to_ptr)).to eq(456) + end + + it 'should be able to assign struct instance to nested field' do + cs = LibTest::ContainerStruct.new(LibTest.struct_make_container_struct(123)) + ns = LibTest::NestedStruct.new + ns[:i] = 567 + cs[:ns] = ns + expect(cs[:ns][:i]).to eq(567) + expect(LibTest.struct_align_nested_struct(cs.to_ptr)).to eq(567) + end +end + +describe FFI::Struct, ' with a nested array of structs' do + module InlineArrayOfStructs + extend FFI::Library + ffi_lib TestLibrary::PATH + class NestedStruct < FFI::Struct + layout :i, :int + end + class ContainerStruct < FFI::Struct + layout :first, :char, :ns, [ NestedStruct, 1 ] + end + attach_function :struct_align_nested_struct, [ :pointer ], :int + attach_function :struct_make_container_struct, [ :int ], :pointer + end + + before do + @cs = InlineArrayOfStructs::ContainerStruct.new + end + + it 'should align correctly nested struct field' do + @cs[:ns][0][:i] = 123 + expect(InlineArrayOfStructs.struct_align_nested_struct(@cs.to_ptr)).to eq(123) + end + + it 'should correctly calculate Container size (in bytes)' do + expect(InlineArrayOfStructs::ContainerStruct.size).to eq(8) + end + + it 'should return a Struct object when the field is accessed' do + expect(@cs[:ns][0].is_a?(FFI::Struct)).to be true + end + + it 'should read a value from memory' do + @cs = InlineArrayOfStructs::ContainerStruct.new(InlineArrayOfStructs.struct_make_container_struct(123)) + expect(@cs[:ns][0][:i]).to eq(123) + end + + it 'should write a value to memory' do + @cs = InlineArrayOfStructs::ContainerStruct.new(InlineArrayOfStructs.struct_make_container_struct(123)) + @cs[:ns][0][:i] = 456 + expect(InlineArrayOfStructs.struct_align_nested_struct(@cs.to_ptr)).to eq(456) + end + + it 'should support Enumerable#each' do + @cs = InlineArrayOfStructs::ContainerStruct.new(InlineArrayOfStructs.struct_make_container_struct(123)) + ints = [] + @cs[:ns].each { |s| ints << s[:i] } + expect(ints[0]).to eq(123) + end +end + +describe FFI::Struct, ' by value' do + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + + class S8S32 < FFI::Struct + layout :s8, :char, :s32, :int + end + + class StructString < FFI::Struct + layout :bytes, :string, :len, :int + end + + attach_function :struct_return_s8s32, [ ], S8S32.by_value + attach_function :struct_s8s32_set, [ :char, :int ], S8S32.by_value + attach_function :struct_s8s32_get_s8, [ S8S32.by_value ], :char + attach_function :struct_s8s32_get_s32, [ S8S32.by_value ], :int + attach_function :struct_s8s32_s32_ret_s32, [ S8S32.by_value, :int ], :int + attach_function :struct_s8s32_s64_ret_s64, [ S8S32.by_value, :long_long ], :long_long + attach_function :struct_s8s32_ret_s8s32, [ S8S32.by_value ], S8S32.by_value + attach_function :struct_s32_ptr_s32_s8s32_ret_s32, [ :int, :pointer, :int, S8S32.by_value ], :int + attach_function :struct_varargs_ret_struct_string, [ :int, :varargs ], StructString.by_value + end + + it 'return using pre-set values' do + s = LibTest.struct_return_s8s32 + expect(s[:s8]).to eq(0x7f) + expect(s[:s32]).to eq(0x12345678) + end + + it 'return using passed in values' do + s = LibTest.struct_s8s32_set(123, 456789) + expect(s[:s8]).to eq(123) + expect(s[:s32]).to eq(456789) + end + + it 'parameter' do + s = LibTest::S8S32.new + s[:s8] = 0x12 + s[:s32] = 0x34567890 + expect(LibTest.struct_s8s32_get_s8(s)).to eq(0x12) + expect(LibTest.struct_s8s32_get_s32(s)).to eq(0x34567890) + end + + it 'parameter with following s32' do + s = LibTest::S8S32.new + s[:s8] = 0x12 + s[:s32] = 0x34567890 + + expect(LibTest.struct_s8s32_s32_ret_s32(s, 0x1eefdead)).to eq(0x1eefdead) + end + + # it 'parameter with following s64' do + # s = LibTest::S8S64.new + # s[:s8] = 0x12 + # s[:s64] = 0x34567890 + # + # + # LibTest.struct_s8s64_s64_ret_s64(s, 0x1eefdead1eefdead).should == 0x1eefdead1eefdead + # end + + it 'parameter with preceding s32,ptr,s32' do + s = LibTest::S8S32.new + s[:s8] = 0x12 + s[:s32] = 0x34567890 + out = LibTest::S8S32.new + expect(LibTest.struct_s32_ptr_s32_s8s32_ret_s32(0x1000000, out, 0x1eafbeef, s)).to eq(0x34567890) + expect(out[:s8]).to eq(s[:s8]) + expect(out[:s32]).to eq(s[:s32]) + end + + it 'parameter with preceding s32,string,s32' do + s = LibTest::S8S32.new + s[:s8] = 0x12 + s[:s32] = 0x34567890 + out = 0.chr * 32 + expect(LibTest.struct_s32_ptr_s32_s8s32_ret_s32(0x1000000, out, 0x1eafbeef, s)).to eq(0x34567890) + end + + it 'parameter, returning struct by value' do + s = LibTest::S8S32.new + s[:s8] = 0x12 + s[:s32] = 0x34567890 + + ret = LibTest.struct_s8s32_ret_s8s32(s) + expect(ret[:s8]).to eq(s[:s8]) + expect(ret[:s32]).to eq(s[:s32]) + end + + it 'varargs returning a struct' do + string = "test" + s = LibTest.struct_varargs_ret_struct_string(4, :string, string) + expect(s[:len]).to eq(string.length) + expect(s[:bytes]).to eq(string) + end +end + +describe FFI::Struct, ' with an array field' do + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + class StructWithArray < FFI::Struct + layout :first, :char, :a, [:int, 5] + end + attach_function :struct_make_struct_with_array, [:int, :int, :int, :int, :int], :pointer + attach_function :struct_field_array, [:pointer], :pointer + end + before do + @s = LibTest::StructWithArray.new + end + + it 'should correctly calculate StructWithArray size (in bytes)' do + expect(LibTest::StructWithArray.size).to eq(24) + end + + it 'should read values from memory' do + @s = LibTest::StructWithArray.new(LibTest.struct_make_struct_with_array(0, 1, 2, 3, 4)) + expect(@s[:a].to_a).to eq([0, 1, 2, 3, 4]) + end +# it 'should cache array object for successive calls' do +# @s[:a].object_id.should == @s[:a].object_id +# end + + it 'should return the number of elements in the array field' do + @s = LibTest::StructWithArray.new(LibTest.struct_make_struct_with_array(0, 1, 2, 3, 4)) + expect(@s[:a].size).to eq(5) + end + + it 'should allow iteration through the array elements' do + @s = LibTest::StructWithArray.new(LibTest.struct_make_struct_with_array(0, 1, 2, 3, 4)) + @s[:a].each_with_index { |elem, i| expect(elem).to eq(i) } + end + + it 'should return the pointer to the array' do + @s = LibTest::StructWithArray.new(LibTest.struct_make_struct_with_array(0, 1, 2, 3, 4)) + expect(@s[:a].to_ptr).to eq(LibTest::struct_field_array(@s.to_ptr)) + end +end + +describe 'BuggedStruct' do + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + class BuggedStruct < FFI::Struct + layout :visible, :uchar, + :x, :uint, + :y, :uint, + :rx, :short, + :ry, :short, + :order, :uchar, + :size, :uchar + end + attach_function :bugged_struct_size, [], :uint + end + + it 'should return its correct size' do + expect(LibTest::BuggedStruct.size).to eq(LibTest.bugged_struct_size) + end + + it "offsets within struct should be correct" do + expect(LibTest::BuggedStruct.offset_of(:visible)).to eq(0) + expect(LibTest::BuggedStruct.offset_of(:x)).to eq(4) + expect(LibTest::BuggedStruct.offset_of(:y)).to eq(8) + expect(LibTest::BuggedStruct.offset_of(:rx)).to eq(12) + expect(LibTest::BuggedStruct.offset_of(:ry)).to eq(14) + expect(LibTest::BuggedStruct.offset_of(:order)).to eq(16) + expect(LibTest::BuggedStruct.offset_of(:size)).to eq(17) + end + + it 'should return correct field/offset pairs' do + expect(LibTest::BuggedStruct.offsets.sort do |a, b| + a[1] <=> b[1] + end).to eq([[:visible, 0], [:x, 4], [:y, 8], [:rx, 12], [:ry, 14], [:order, 16], [:size, 17]]) + end +end + +describe "Struct allocation" do + it "MemoryPointer.new(Struct, 2)" do + class S < FFI::Struct + layout :i, :uint + end + p = FFI::MemoryPointer.new(S, 2) + expect(p.total).to eq(8) + expect(p.type_size).to eq(4) + p.put_uint(4, 0xdeadbeef) + expect(S.new(p[1])[:i]).to eq(0xdeadbeef) + expect(p[1].address).to eq((p[0].address + 4)) + end + + it "Buffer.new(Struct, 2)" do + class S < FFI::Struct + layout :i, :uint + end + p = FFI::Buffer.new(S, 2) + expect(p.total).to eq(8) + expect(p.type_size).to eq(4) + p.put_uint(4, 0xdeadbeef) + expect(S.new(p[1])[:i]).to eq(0xdeadbeef) + end + + it "null? should be true when initialized with NULL pointer" do + class S < FFI::Struct + layout :i, :uint + end + expect(S.new(FFI::Pointer::NULL)).to be_null + end + + it "null? should be false when initialized with non-NULL pointer" do + class S < FFI::Struct + layout :i, :uint + end + expect(S.new(FFI::MemoryPointer.new(S))).not_to be_null + end + + it "supports :bool as a struct member" do + expect do + c = Class.new(FFI::Struct) do + layout :b, :bool + end + struct = c.new + struct[:b] = ! struct[:b] + end.not_to raise_error Exception + end + +end + +describe "variable-length arrays" do + it "zero length array should be accepted as last field" do + expect { + Class.new(FFI::Struct) do + layout :count, :int, :data, [ :char, 0 ] + end + }.not_to raise_error Exception + end + + it "zero length array before last element should raise error" do + expect { + Class.new(FFI::Struct) do + layout :data, [ :char, 0 ], :count, :int + end + }.to raise_error + end + + it "can access elements of array" do + struct_class = Class.new(FFI::Struct) do + layout :count, :int, :data, [ :long, 0 ] + end + s = struct_class.new(FFI::MemoryPointer.new(1024)) + s[:data][0] = 0x1eadbeef + s[:data][1] = 0x12345678 + expect(s[:data][0]).to eq(0x1eadbeef) + expect(s[:data][1]).to eq(0x12345678) + end + + it "non-variable length array is bounds checked" do + struct_class = Class.new(FFI::Struct) do + layout :count, :int, :data, [ :long, 1 ] + end + s = struct_class.new(FFI::MemoryPointer.new(1024)) + s[:data][0] = 0x1eadbeef + expect { s[:data][1] = 0x12345678 }.to raise_error + expect(s[:data][0]).to eq(0x1eadbeef) + expect { expect(s[:data][1]).to == 0x12345678 }.to raise_error + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/typedef_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/typedef_spec.rb new file mode 100644 index 000000000..d73247faa --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/typedef_spec.rb @@ -0,0 +1,91 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) +describe "Custom type definitions" do + it "attach_function with custom typedef" do + module CustomTypedef + extend FFI::Library + ffi_lib TestLibrary::PATH + typedef :uint, :fubar_t + attach_function :ret_u32, [ :fubar_t ], :fubar_t + end + expect(CustomTypedef.ret_u32(0x12345678)).to eq(0x12345678) + end + + it "variadic invoker with custom typedef" do + module VariadicCustomTypedef + extend FFI::Library + ffi_lib TestLibrary::PATH + typedef :uint, :fubar_t + attach_function :pack_varargs, [ :buffer_out, :string, :varargs ], :void + end + buf = FFI::Buffer.new :uint, 10 + VariadicCustomTypedef.pack_varargs(buf, "i", :fubar_t, 0x12345678) + expect(buf.get_int64(0)).to eq(0x12345678) + end + + it "Callback with custom typedef parameter" do + module CallbackCustomTypedef + extend FFI::Library + ffi_lib TestLibrary::PATH + typedef :uint, :fubar3_t + callback :cbIrV, [ :fubar3_t ], :void + attach_function :testCallbackU32rV, :testClosureIrV, [ :cbIrV, :fubar3_t ], :void + end + i = 0 + CallbackCustomTypedef.testCallbackU32rV(0xdeadbeef) { |v| i = v } + expect(i).to eq(0xdeadbeef) + end + module StructCustomTypedef + extend FFI::Library + ffi_lib TestLibrary::PATH + typedef :uint, :fubar3_t + class S < FFI::Struct + layout :a, :fubar3_t + end + end + + it "Struct with custom typedef field" do + s = StructCustomTypedef::S.new + s[:a] = 0x12345678 + expect(s.pointer.get_uint(0)).to eq(0x12345678) + end + + it "attach_function after a typedef should not reject normal types" do + expect do + Module.new do + extend FFI::Library + # enum() will insert a custom typedef called :foo for the enum + enum :foo, [ :a, :b ] + typedef :int, :bar + + ffi_lib TestLibrary::PATH + begin + attach_function :ptr_ret_int32_t, [ :string, :foo ], :bar + rescue FFI::NotFoundError + # NetBSD uses #define instead of typedef for these + attach_function :ptr_ret_int32_t, :ptr_ret___int32_t, [ :string, :foo ], :bar + end + end + end.not_to raise_error + end + + it "detects the correct type for size_t" do + expect do + Module.new do + extend FFI::Library + ffi_lib "c" + if FFI::Platform.windows? + # _read() is a function of msvcrt.dll + attach_function :_read, [:int, :pointer, :uint], :int + else + # read(2) is a standard UNIX function + attach_function :read, [:int, :pointer, :size_t], :ssize_t + end + end + end.not_to raise_error + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/union_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/union_spec.rb new file mode 100644 index 000000000..45bf7ec8e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/union_spec.rb @@ -0,0 +1,67 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +module LibTest + Types = { + 's8' => [:char, :c, 1], + 's16' => [:short, :s, 0xff0], + 's32' => [:int, :i, 0xff00], + 's64' => [:long_long, :j, 0xffff00], + 'long' => [:long, :l, 0xffff], + 'f32' => [:float, :f, 1.0001], + 'f64' => [:double, :d, 1.000000001] + } + class TestUnion < FFI::Union + layout( :a, [:char, 10], + :i, :int, + :f, :float, + :d, :double, + :s, :short, + :l, :long, + :j, :long_long, + :c, :char ) + end + Types.keys.each do |k| + attach_function "union_align_#{k}", [ :pointer ], Types[k][0] + attach_function "union_make_union_with_#{k}", [ Types[k][0] ], :pointer + end + attach_function :union_size, [], :uint +end + +describe 'Union' do + before do + @u = LibTest::TestUnion.new + end + + it 'should place all the fields at offset 0' do + expect(LibTest::TestUnion.members.all? { |m| LibTest::TestUnion.offset_of(m) == 0 }).to be true + end + LibTest::Types.each do |k, type| + it "should correctly align/write a #{type[0]} value" do + @u[type[1]] = type[2] + if k == 'f32' or k == 'f64' + expect((@u[type[1]] - LibTest.send("union_align_#{k}", @u.to_ptr)).abs).to be < 0.00001 + else + expect(@u[type[1]]).to eq(LibTest.send("union_align_#{k}", @u.to_ptr)) + end + end + end + LibTest::Types.each do |k, type| + it "should read a #{type[0]} value from memory" do + @u = LibTest::TestUnion.new(LibTest.send("union_make_union_with_#{k}", type[2])) + if k == 'f32' or k == 'f64' + expect((@u[type[1]] - type[2]).abs).to be < 0.00001 + else + expect(@u[type[1]]).to eq(type[2]) + end + end + end + + it 'should return a size equals to the size of the biggest field' do + expect(LibTest::TestUnion.size).to eq(LibTest.union_size) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/variadic_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/variadic_spec.rb new file mode 100644 index 000000000..413828011 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/ffi/variadic_spec.rb @@ -0,0 +1,113 @@ +# +# This file is part of ruby-ffi. +# For licensing, see LICENSE.SPECS +# + +require File.expand_path(File.join(File.dirname(__FILE__), "spec_helper")) + +describe "Function with variadic arguments" do + module LibTest + extend FFI::Library + ffi_lib TestLibrary::PATH + enum :enum_type1, [:c1, :c2] + enum :enum_type2, [:c3, 42, :c4] + attach_function :pack_varargs, [ :buffer_out, :string, :varargs ], :void + attach_function :pack_varargs2, [ :buffer_out, :enum_type1, :string, :varargs ], :enum_type1 + end + + it "takes enum arguments" do + buf = FFI::Buffer.new :long_long, 2 + LibTest.pack_varargs(buf, "ii", :int, :c3, :int, :c4) + expect(buf.get_int64(0)).to eq(42) + expect(buf.get_int64(8)).to eq(43) + end + + it "returns symbols for enums" do + buf = FFI::Buffer.new :long_long, 2 + expect(LibTest.pack_varargs2(buf, :c1, "ii", :int, :c3, :int, :c4)).to eq(:c2) + end + + [ 0, 127, -128, -1 ].each do |i| + it "call variadic with (:char (#{i})) argument" do + buf = FFI::Buffer.new :long_long + LibTest.pack_varargs(buf, "c", :char, i) + expect(buf.get_int64(0)).to eq(i) + end + end + + [ 0, 0x7f, 0x80, 0xff ].each do |i| + it "call variadic with (:uchar (#{i})) argument" do + buf = FFI::Buffer.new :long_long + LibTest.pack_varargs(buf, "C", :uchar, i) + expect(buf.get_int64(0)).to eq(i) + end + end + + [ 0, 1.234567, 9.87654321 ].each do |v| + it "call variadic with (:float (#{v})) argument" do + buf = FFI::Buffer.new :long_long + LibTest.pack_varargs(buf, "f", :float, v.to_f) + expect(buf.get_float64(0)).to eq(v) + end + end + + [ 0, 1.234567, 9.87654321 ].each do |v| + it "call variadic with (:double (#{v})) argument" do + buf = FFI::Buffer.new :long_long + LibTest.pack_varargs(buf, "f", :double, v.to_f) + expect(buf.get_float64(0)).to eq(v) + end + end + + module Varargs + PACK_VALUES = { + 'c' => [ 0x12 ], + 'C' => [ 0x34 ], + 's' => [ 0x5678 ], + 'S' => [ 0x9abc ], + 'i' => [ 0x7654321f ], + 'I' => [ 0xfee1babe ], + 'l' => [ 0x1f2e3d4c ], + 'L' => [ 0xf7e8d9ca ], + 'j' => [ 0x1eafdeadbeefa1b2 ], + 'f' => [ 1.23456789 ], + 'd' => [ 9.87654321 ] + } + + TYPE_MAP = { + 'c' => :char, 'C' => :uchar, 's' => :short, 'S' => :ushort, + 'i' => :int, 'I' => :uint, 'j' => :long_long, 'J' => :ulong_long, + 'l' => :long, 'L' => :ulong, 'f' => :float, 'd' => :double + } + end + + def verify(p, off, v) + if v.kind_of?(Float) + expect(p.get_float64(off)).to eq(v) + else + expect(p.get_int64(off)).to eq(v) + end + end + + Varargs::PACK_VALUES.keys.each do |t1| + Varargs::PACK_VALUES.keys.each do |t2| + Varargs::PACK_VALUES.keys.each do |t3| + Varargs::PACK_VALUES[t1].each do |v1| + Varargs::PACK_VALUES[t2].each do |v2| + Varargs::PACK_VALUES[t3].each do |v3| + fmt = "#{t1}#{t2}#{t3}" + params = [ Varargs::TYPE_MAP[t1], v1, Varargs::TYPE_MAP[t2], v2, Varargs::TYPE_MAP[t3], v3 ] + it "call(#{fmt}, #{params.join(',')})" do + buf = FFI::Buffer.new :long_long, 3 + LibTest.pack_varargs(buf, fmt, *params) + verify(buf, 0, v1) + verify(buf, 8, v2) + verify(buf, 16, v3) + end + end + end + end + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/spec.opts b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/spec.opts new file mode 100644 index 000000000..60a02457f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ffi-1.9.10/spec/spec.opts @@ -0,0 +1,4 @@ +--color +-w +--format +documentation diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/.gitignore b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/.gitignore new file mode 100644 index 000000000..f7bebc43f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/.gitignore @@ -0,0 +1,18 @@ +*.gem +*.rbc +.bundle +.config +.yardoc +Gemfile.lock +InstalledFiles +_yardoc +coverage +doc/ +lib/bundler/man +pkg +rdoc +spec/reports +test/tmp +test/version_tmp +tmp +html diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/.travis.yml b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/.travis.yml new file mode 100644 index 000000000..23e1a15f3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/.travis.yml @@ -0,0 +1,8 @@ +language: ruby +rvm: + - "1.9.2" + - "1.9.3" + - "2.0.0" + - jruby-19mode # JRuby in 1.9 mode + - rbx-19mode +script: rake test diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/Gemfile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/Gemfile new file mode 100644 index 000000000..ffe243345 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/Gemfile @@ -0,0 +1,7 @@ +source 'https://rubygems.org' + +# Specify your gem's dependencies in forwardablex.gemspec +gemspec + +gem 'simplecov', :require => false, :group => :test +gem 'coveralls', :require => false, :group => :test diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/HISTORY.md b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/HISTORY.md new file mode 100644 index 000000000..ffb0767ce --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/HISTORY.md @@ -0,0 +1,21 @@ +# History of ForwardableX + +## 0.1.4 + +* Added receiver keyword :identity. + +## 0.1.3 + +* Added forward_as_key and forward_as_key! that forward key to receiver. + +## 0.1.2 + +* Bug fix: proc receivers should be evaluated in context of instance. + +## 0.1.1 + +* Introduced receiver keyword :class for forwarding to class method + +## 0.1.0 + +First release. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/LICENSE.txt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/LICENSE.txt new file mode 100644 index 000000000..74bf5ff05 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2013 Keita Yamaguchi + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/README.md b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/README.md new file mode 100644 index 000000000..0613d2ad3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/README.md @@ -0,0 +1,95 @@ +# ForwardableX + +ForwardableX is a Ruby library to extend forwardable.rb. + +[![Gem Version](https://badge.fury.io/rb/forwardablex.png)](http://badge.fury.io/rb/forwardablex) [![Build Status](https://travis-ci.org/keita/forwardablex.png?branch=master)](https://travis-ci.org/keita/forwardablex) [![Coverage Status](https://coveralls.io/repos/keita/forwardablex/badge.png?branch=master)](https://coveralls.io/r/keita/forwardablex) [![Code Climate](https://codeclimate.com/github/keita/forwardablex.png)](https://codeclimate.com/github/keita/forwardablex) + +## Installation + + gem install forwardablex + +## Usage + +### Forward to Instance Variable + +```ruby +Receiver = Struct(:m) +class Forwarder + forward :@receiver, :m + def initialize + @recevier = Receiver.new("forwarded") + end +end +Forwarder.new.m #=> "forwarded" +``` + +### Forward to Proc Receiver + +```ruby +class Forwarder + forward lambda{Struct(:m).new("forwarded")}, :m +end +Forwarder.new.m #=> "forwarded" +``` + +### Forward to Instance + +```ruby +Receiver = Struct(:m) +class Forwarder + forward Receiver.new("forwarded"), :m +end +Forwarder.new.m #=> "forwarded" +``` + +### Class Method Accessor + +```ruby +class Forwarder + class << self + def m + "forwarded" + end + end + forward :class, :m +end +Forwarder.new.m #=> "forwarded" +``` + +### Table Accessor + +```ruby +class Forwarder + forward_as_key :@table, :key + + def initialize + @table = {:key => "forwarded"} + end +end +Forwarder.new.key #=> "forwarded" +``` + +### Identity + +```ruby +class Forwarder + foward :identity, :self +end +Forwarder.new {|x| x == x.self} #=> true +``` + +## Documentation + +- [API Documentation](http://rubydoc.info/gems/forwardablex) + +## Licence + +ForwardableX is free software distributed under MIT licence. + +## Contributing + +1. Fork it +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin my-new-feature`) +5. Create new Pull Request diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/Rakefile new file mode 100644 index 000000000..b45f9fc73 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/Rakefile @@ -0,0 +1,18 @@ +require "bundler/gem_tasks" + +desc 'Test specs' +task 'test' do + sh "bundle exec bacon -a" +end + +desc 'Generate API document' +task 'html' do + sh "bundle exec yard doc -o html --hide-void-return --no-api" +end + +desc 'Show undocumented function list' +task 'html:undoc' do + sh "bundle exec yard stats --list-undoc --no-api --compact" +end + +task :default => :test diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/forwardablex.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/forwardablex.gemspec new file mode 100644 index 000000000..121b528c8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/forwardablex.gemspec @@ -0,0 +1,24 @@ +# -*- ruby -*- +# -*- encoding: utf-8 -*- +lib = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'forwardablex/version' + +Gem::Specification.new do |gem| + gem.name = "forwardablex" + gem.version = ForwardableX::VERSION + gem.authors = ["Keita Yamaguchi"] + gem.email = ["keita.yamaguchi@gmail.com"] + gem.description = "This is a library to extend Forwardable functions" + gem.summary = "Forwardable extension" + gem.homepage = "https://github.com/keita/forwardablex" + + gem.files = `git ls-files`.split($/) + gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } + gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) + gem.require_paths = ["lib"] + gem.add_development_dependency "rake" + gem.add_development_dependency "bacon" + gem.add_development_dependency "yard" + gem.add_development_dependency "redcarpet" unless RUBY_PLATFORM == 'java' +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/lib/forwardablex.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/lib/forwardablex.rb new file mode 100644 index 000000000..1adc85803 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/lib/forwardablex.rb @@ -0,0 +1,226 @@ +# Copyright (C) 2013 Keita Yamaguchi + +require "forwardablex/version" + +# ForwardableX is a module for providing extra Forwardable functions. Benefits +# to use this library are the following: +# +# - you can use easy keyword "forward", instead of "def_instance_delegator" or "def_delegator" +# - you can specify message receiver as instance variable name, Proc object or plain object +# - no need to declare "extend Forwardable" +# - forwardable.rb compatible API +# +# @example Forward to Instance Variable +# Receiver = Struct(:m) +# class Forwarder +# forward :@receiver, :m +# def initialize +# @recevier = Receiver.new("forwarded") +# end +# end +# Forwarder.new.m #=> "forwarded" +# @example Forward to Proc Receiver +# class Forwarder +# forward lambda{Struct(:m).new("forwarded")}, :m +# end +# Forwarder.new.m #=> "forwarded" +# @example Forward to Instance +# Receiver = Struct(:m) +# class Forwarder +# forward Receiver.new("forwarded"), :m +# end +# Forwarder.new.m #=> "forwarded" +# @example Class Method Accessor +# Receiver = Struct(:name) +# class Forwarder +# class << self +# def m +# "forwarded" +# end +# end +# forward :class, :m +# end +# Forwarder.new.m #=> "forwarded" +module ForwardableX + # Define a method that forwards the message to the receiver. You can specify + # receiver as instance variable name, Proc object, and plain object. + # + # @param receiver [Symbol, String, Proc, or Object] + # message receiver + # @param method [Symbol] + # method name that we forward to + # @param name [Symbol] + # method name that we forward from + # @return [void] + def forward(receiver, method, name=method) + context = self.kind_of?(Module) ? self : self.singleton_class + context.instance_eval do + case receiver + when :class + forward_class_receiver(method, name) + when :identity + forward_identity_receiver(name) + when Symbol, String + forward_named_receiver(receiver, method, name) + when Proc + forward_proc_receiver(receiver, method, name) + else + forward_object_receiver(receiver, method, name) + end + end + end + alias :def_instance_delegator :forward + alias :def_singleton_delegator :forward + alias :def_delegator :forward + + # Define each method that calls the receiver's method. + # + # @param receiver [Symbol, String, Proc, or Object] + # message receiver + # @param methods [Array] + # method names that we forward to + # @return [void] + def forward!(receiver, *methods) + methods.delete("__send__") + methods.delete("__id__") + methods.each {|method| forward(receiver, method)} + end + alias :def_instance_delegators :forward! + alias :def_singleton_delegators :forward! + alias :def_delegators :forward! + + # Same as Forwardable#delegate, but you can specify receivers as instance + # variable name, Proc object, and plain object. + # + # @param hash [Hash] + # the hash table contains keys as methods and values as recevier + # @return [void] + def delegate(hash) + hash.each do |methods, receiver| + forward!(receiver, *methods) + end + end + + # Define a method that forwards the key to the receiver. You can specify + # receiver as instance variable name, Proc object, and plain object. + # + # @param receiver [Symbol, String, Proc, or Object] + # message receiver that have method #[] + # @param key [Symbol] + # key that we forward to the receiver + # @param name [Symbol] + # method name that we forward from + # @return [void] + def forward_as_key(receiver, key, name=key) + context = self.kind_of?(Module) ? self : self.singleton_class + context.instance_eval do + case receiver + when :class + forward_class_receiver(:[], name, key) + when :identity + forward_identity_receiver(name) + when Symbol, String + forward_named_receiver(receiver, :[], name, key) + when Proc + forward_proc_receiver(receiver, :[], name, key) + else + forward_object_receiver(receiver, :[], name, key) + end + end + end + + # Define each method that forwards to the receiver as key. + # + # @param receiver [Symbol, String, Proc, or Object] + # message receiver that have method #[] + # @param key [Array] + # key that we forward to the receiver + # @return [void] + def forward_as_key!(receiver, *keys) + keys.each {|key| forward_as_key(receiver, key)} + end + + private + + # Forward the name to class receiver. + # + # @param method [Symbol] + # method name of the class + # @param name [Symbol] + # forwarder method name + # @param _args [Array] + # additional arguments + # @return [void] + def forward_class_receiver(method, name, *_args) + define_method(name) do |*args, &b| + self.class.__send__(method, *_args, *args, &b) + end + end + + # Forward the name to the named receiver. + # + # @param receiver [Symbol] + # receiver's name + # @param method [Symbol] + # method name of the receiver + # @param name [Symbol] + # forwarder method name + # @param _args [Array] + # additional arguments + # @return [void] + def forward_named_receiver(receiver, method, name, *_args) + define_method(name) do |*args, &b| + instance_variable_get(receiver).__send__(method, *_args, *args, &b) + end + end + + # Forward the name to the Proc result. + # + # @param proc [Proc] + # Proc object that generate the receiver + # @param method [Symbol] + # method name of the proc result + # @param name [Symbol] + # forwarder method name + # @param _args [Array] + # additional arguments + # @return [void] + def forward_proc_receiver(proc, method, name, *_args) + define_method(name) do |*args, &b| + instance_eval(&proc).__send__(method, *_args, *args, &b) + end + end + + # Forward the name to the identity function. + # + # @param name [Symbol] + # forwarder method name + # @return [void] + def forward_identity_receiver(name) + define_method(name) do |*args, &b| + self + end + end + + # Forward the name to the object. + # + # @param receiver [Object] + # receiver object + # @param method [Symbol] + # method name of the object + # @param name [Symbol] + # forwarder method name + # @param _args [Array] + # additional arguments + # @return [void] + def forward_object_receiver(receiver, method, name, *_args) + define_method(name) do |*args, &b| + receiver.__send__(method, *args, &b) + end + end +end + +# @api private +class Object + extend ForwardableX +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/lib/forwardablex/version.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/lib/forwardablex/version.rb new file mode 100644 index 000000000..2d9ca12e2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/lib/forwardablex/version.rb @@ -0,0 +1,4 @@ +module ForwardableX + # version of ForwardableX + VERSION = "0.1.4" +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/test/spec_forwardablex.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/test/spec_forwardablex.rb new file mode 100644 index 000000000..eea4239a4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/forwardablex-0.1.4/test/spec_forwardablex.rb @@ -0,0 +1,205 @@ +require 'simplecov' +require 'coveralls' +Coveralls.wear! +SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ + SimpleCov::Formatter::HTMLFormatter, + Coveralls::SimpleCov::Formatter +] +SimpleCov.start {add_filter 'test'} + +require 'forwardable' +require 'forwardablex' + +class Receiver + def method_missing(name, *args) + name + end +end + +class Forwarder + attr_reader :name + + def initialize(name=self.class) + @rec = Receiver.new + @name = name + end +end + +class XForwarder < Forwarder + forward :@rec, :m1 + forward :@rec, :m1, :mm1 + forward! :@rec, :m2, :m3 + forward Proc.new{@rec}, :m4 + forward Proc.new{@rec}, :m4, :mm4 + forward! Proc.new{@rec}, :m5, :m6 + forward Receiver.new, :m7 + forward Receiver.new, :m7, :mm7 + forward! Receiver.new, :m8, :m9 +end + +class DefDelegatorForwarder < Forwarder + def_delegator :@rec, :m1 + def_delegator :@rec, :m1, :mm1 + def_delegators :@rec, :m2, :m3 + def_delegator Proc.new{@rec}, :m4 + def_delegator Proc.new{@rec}, :m4, :mm4 + def_delegators Proc.new{@rec}, :m5, :m6 + def_delegator Receiver.new, :m7 + def_delegator Receiver.new, :m7, :mm7 + def_delegators Receiver.new, :m8, :m9 +end + +class DefInstanceDelegatorForwarder < Forwarder + def_instance_delegator :@rec, :m1 + def_instance_delegator :@rec, :m1, :mm1 + def_instance_delegators :@rec, :m2, :m3 + def_instance_delegator Proc.new{@rec}, :m4 + def_instance_delegator Proc.new{@rec}, :m4, :mm4 + def_instance_delegators Proc.new{@rec}, :m5, :m6 + def_instance_delegator Receiver.new, :m7 + def_instance_delegator Receiver.new, :m7, :mm7 + def_instance_delegators Receiver.new, :m8, :m9 +end + +class DelegateForwarder < Forwarder + delegate :m1 => :@rec + delegate [:m2, :m3] => :@rec + delegate :m4 => Proc.new{@rec} + delegate [:m5, :m6] => Proc.new{@rec} + delegate :m7 => Receiver.new + delegate [:m8, :m9] => Receiver.new +end + +xforwarder = Forwarder.new("xforwarder").tap do |obj| + obj.extend ForwardableX + obj.forward :@rec, :m1 + obj.forward :@rec, :m1, :mm1 + obj.forward! :@rec, :m2, :m3 + obj.forward Proc.new{@rec}, :m4 + obj.forward Proc.new{@rec}, :m4, :mm4 + obj.forward! Proc.new{@rec}, :m5, :m6 + obj.forward Receiver.new, :m7 + obj.forward Receiver.new, :m7, :mm7 + obj.forward! Receiver.new, :m8, :m9 +end + +singletonforwarder = Forwarder.new("singletonforwarder").tap do |obj| + obj.extend ForwardableX + obj.def_singleton_delegator :@rec, :m1 + obj.def_singleton_delegator :@rec, :m1, :mm1 + obj.def_singleton_delegators :@rec, :m2, :m3 + obj.def_singleton_delegator Proc.new{@rec}, :m4 + obj.def_singleton_delegator Proc.new{@rec}, :m4, :mm4 + obj.def_singleton_delegators Proc.new{@rec}, :m5, :m6 + obj.def_singleton_delegator Receiver.new, :m7 + obj.def_singleton_delegator Receiver.new, :m7, :mm7 + obj.def_singleton_delegators Receiver.new, :m8, :m9 +end + +class ClassMethodForwarder + class << self + def m + "forwarded" + end + end + + forward :class, :m +end + +class ClassMethodForwarderA < ClassMethodForwarder + class << self + def m + "forwarded to A" + end + end +end + +class KeyForwarder + forward_as_key :@table, :a + forward_as_key :@table, :a, :b + forward_as_key! :@table, :c, :d, :e + forward_as_key :class, :f + forward_as_key Proc.new{@table}, :g + forward_as_key Receiver.new, :h + + class << self + def [](key) + {f: 1}[key] + end + end + + def initialize(table={}) + @table = table + end +end + +class IdentityForwarder + forward :identity, :a + forward :identity, :a, :b + forward! :identity, :c, :d, :e + forward_as_key :identity, :f + forward_as_key :identity, :f, :g + forward_as_key! :identity, :h, :i, :j +end + +describe 'ForwardableX' do + [ XForwarder.new, + DefDelegatorForwarder.new, + DefInstanceDelegatorForwarder.new, + DelegateForwarder.new, + xforwarder, + singletonforwarder + ].each do |obj| + describe obj.name do + it 'should forward' do + obj.m1.should == :m1 + obj.m2.should == :m2 + obj.m3.should == :m3 + obj.m4.should == :m4 + obj.m5.should == :m5 + obj.m6.should == :m6 + obj.m7.should == :m7 + obj.m8.should == :m8 + obj.m9.should == :m9 + end + + unless obj.kind_of? DelegateForwarder + it 'should forward by alias' do + obj.mm1.should == :m1 + end + end + end + end + + it 'should forward to class' do + ClassMethodForwarder.new.m.should == "forwarded" + ClassMethodForwarderA.new.m.should == "forwarded to A" + end + + it 'should forward to the table as key' do + KeyForwarder.new(a: 1, b: 2, c: 3, d: 4, e: 5, f: 6, g: 7, h: 8).tap do |obj| + obj.a.should == 1 + obj.b.should == 1 + obj.c.should == 3 + obj.d.should == 4 + obj.e.should == 5 + obj.f.should == 1 + obj.g.should == 7 + obj.h.should == :[] + end + end + + it 'should forward to identity' do + forwarder = IdentityForwarder.new + forwarder.a.should == forwarder + forwarder.b.should == forwarder + forwarder.c.should == forwarder + forwarder.d.should == forwarder + forwarder.e.should == forwarder + forwarder.f.should == forwarder + forwarder.g.should == forwarder + forwarder.h.should == forwarder + forwarder.i.should == forwarder + forwarder.j.should == forwarder + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/History.rdoc b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/History.rdoc new file mode 100644 index 000000000..de68ad7ab --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/History.rdoc @@ -0,0 +1,419 @@ +=== 0.4.3 / 2012-10-01 + +* Track size on Tries for performance (fredericksgary) +* Hash#values should not return a set as there is no guarantee of uniqueness (and worse it means you potentially lose duplicate values). (fredericksgary) +* Add Hash#slice, Hash#except, Hash#fetch (misfo) +* Implemented a public Hash#new for subclassing (misfo) +* Some initial benchmarks (haedius) +* Documentation corrections (harukizaemon, szajbus, rwfowler) + +=== 0.4.2 / 2011-04-07 + +* Added List#merge/merge_by to merge sorted lists into a single stream. +* Added Enumerator#to_list produces a lazy list. +* Alias List/Set#group_by as #group. + +=== 0.4.0 / 2010-12-13 + +* Added initial implementation of Vector for efficient indexed access. + +* Fix car/cdr so they work on Ruby 1.8.7 (tianyicui) +* Fix specs when running under 1.8.7 (tianyicui, kef) +* Fix bundler/rvm support (kef) + +=== 0.3.10 / 2010-10-22 + +* Update to RSpec 2. + +=== 0.3.9 / 2010-06-02 + +* Implement Hash#values. + +=== 0.3.8 / 2010-06-02 + +* Hash now accepts a block for supplying default values. + +=== 0.3.7 / 2010-05-16 + +* Initial Queue implementation complete. + +* Implement Stack#peek. + +* Add Stack#enqueue, #dequeue to reflect the fact that a Stack is also a LIFO Queue. + +* Fix incompatibilities with Ruby 1.8.7 syntax. + +=== 0.3.6 / 2010-05-03 + +* Hash#put now supports returning a value from a block instead of passing an explicit value. Almost like a substitute for the non-functional []= + +=== 0.3.4 / 2010-04-29 + +* Reduce garbage collection by keeping a singleton instance of an empty hash. + +* Added some VERY experimental Read-Copy-Update collections (no tests). + +* Slightly improve performance and greatly improve the readability of #eql?/#== methods. + +* Added some VERY experimental memoization for immutable objects. + +* Added Set#merge as an alias for Set#union. + +* Implemented Hash#merge (aliased as #+). + +=== 0.3.3 / 2010-04-09 + +* Fixed: hash code generation had VERY poor distribution. + +=== 0.3.1 / 2010-04-04 + +* Fixed: Immutable not required in hamster.rb + +=== 0.3.0 / 2010-03-28 + +* Add Hamster::Immutable as general purpose module to facililate immutability. + +* List, Stack, Set, and Hash now all implement Hamster::Immutable. + +=== 0.2.13 / 2010-03-25 + +* Implement Hash#hash. + +* Implement Set#hash. + +* Implement List#hash. + +* Implement Set#flatten. + +=== 0.2.12 / 2010-03-01 + +* Fixed bug: List#join accidentally modifying head if it was a string. + +=== 0.2.11 / 2010-02-15 + +* Implement Set#one? + +* Implement Set#minimum (aliased as #min). + +* Implement Set#maximum (aliased as #max). + +* Implement Set#reduce with an optional memo. + +* Fix List#reduce should return nil when given no block and no starting value. + +=== 0.2.10 / 2010-02-15 + +* Fix a bunch of spec failures under 1.8.7. + +* Remove some redundant object construction. + +=== 0.2.9 / 2010-02-11 + +* Fix #to_list not available in all Enumerables. + +=== 0.2.8 / 2010-02-10 + +* Implement Set#exclusion (aliased as #^) as equivalent to ((a | b) - (a & b)). + +* Implement Set#subset? + +* Implement Set#superset? + +* Implement Set#difference (aliased as #diff, #subtract, and #-). + +* Implement Set#intersection (aliased as #intersect and #&). + +* Implement Set#union (aliased as #| and #+). + +* Implement Set#union (aliased as #| and #+). + +* Remove Hash#[]= as its useless. + +=== 0.2.7 / 2010-02-08 + +* Fixed bug with Hamster.interval (and Hamster.range) not handling Strings correctly. + +=== 0.2.6 / 2010-01-29 + +* Implement Array#to_list. + +* Simplify (and improve performance of) conversions from arrays to lists. + +* Speed up Set and List sorting. + +* Implement Hash#find (aliased as #detect). + +* Implement List#elem_indices, List#find_indices (aliased as #indices as appropriate). + +* Implement List#index as per MRI and alias as #elem_index, and #find_index as appropriate. + +* Remove some redundant construction of streams. + +=== 0.2.5 / 2010-01-19 + +* Implement Set#clear. + +* Implement List#slice (also aliased as #[from, length]). + +* Implement List#at (aliased as #[index]). + +=== 0.2.4 / 2010-01-18 + +* Fix List#cadr and friends under JRuby. + +* Remove redundant locking (speed up). + +* Make reverse "lazy" (ish). + +* Fixed: StackOverflow calling List#head and List#tail on very large lazy lists. + +* Alias #reduce as #foldr. + +=== 0.2.3 / 2010-01-18 + +* Implement Set#group_by. + +* Implement List#group_by. + +* Implement Hash#inspect. + +* Tuples can now be implicitly converted to args and variables via #to_ary, meaning you can do: + + integers = Hamster.iterate(1, &:succ) + odds, evens = integers.partition(&:odd?) + +=== 0.2.2 / 2010-01-15 + +* Implement List#flatten. + +* Implement List#each_slice (aliased as #each_chunk). + +* Return a tuple rather than a list for #split_at, #partition, #break, and #span. + +* Implement List#chunk. + +* Implement Set#compact. + +* Implement List#compact. + +=== 0.2.1 / 2010-01-15 + +* Fix bug: List#empty? would cause a stack overflow on very large streams. + +=== 0.2.0 / 2010-01-14 + +* List methods that return lists are now all lazy. Not sure what, if any, negative impact this will have but the positives have so far been well worth it. + +* Ensure List#eql? (and #==) doesn't accidentally consider an empty list to be equal to an empty array! + +* Ensure List responds_to? cadr and friends. + +* Stream now releases the block for garbage collection once called. + +* Implement List#combinations. + +* Implement List#inits. + +* Implement List#tails. + +* Implement Hash#uniq. + +* Alias #uniq as #remove_duplicates. + +* Alias #all? as #forall? + +* Implement Set#product. + +* Implement Set#sum. + +=== 0.1.23 / 2010-01-11 + +* Implement List#product. + +* Implement List#sum. + +* Implement List#last. + +* Implement List#init. + +* Alias #reject as #remove. + +* Alias #each as #foreach. + +* Rename Hash#remove as Hash#delete. + +* Rename Set#remove as Set#delete. + +=== 0.1.22 / 2010-01-10 + +* Implement List#union (aliased as #|). + +* Implement List#uniq (aliased as #nub). + +* Implement List#intersperse. + +* Alias #include? as #elem? + +* Implement Stack#to_list. + +* Implement Stack#to_a. + +* Implement Set#join. + +* Implement Set#count. + +* Implement List#count. + +* Alias #include? as #contains? + +* #each now returns nil if you specify a block. + +* Implement Set#find (aliased as #detect). + +=== 0.1.21 / 2010-01-08 + +* Implement List#sort. (Very, VERY inefficient implementation!) + +* Implement List#sort_by. (Very, VERY inefficient implementation!) + +* Implement Set#to_set. + +* Implement Set#inspect. + +* Implement Set#first (aliased as #head). + +* Implement Set#sort. (Very, VERY inefficient implementation!) + +* Implement Set#sort_by. (Very, VERY inefficient implementation!) + +* Implement List#join. + +=== 0.1.20 / 2010-01-07 + +* Implement Stack#clear. + +* Implement List#clear and Stack#clear. + +* Implement List#break. + +* Implement List#span. + +=== 0.1.19 / 2010-01-03 + +* Bump minimum Ruby version to 1.8.7. I mean really, c'mon! + +=== 0.1.18 / 2010-01-03 + +* Added gem development dependency on RSpec. + +=== 0.1.17 / 2010-01-02 + +* Alias #empty? as #null? + +* Implement List#split_at. + +* Implement List.iterate. + +* Implement List#cycle. + +* Implement List.replicate. + +* Implement List.repeat. + +* Simplify List#take. + +* Simplify any?, all?, and none? + +* Re-write List#one? to be less complex. + +* Add Set#to_list. + +* Implement List#zip. + +* Implement Set#grep. + +* Implement Set#uniq (aliased as #nub). + +* Implement List#grep. + +=== 0.1.16 / 2009-12-30 + +* Ensure streams cache results. + +* Ensure lists don't blow the stack. + +* List#entries is now an alias for List#to_a. + +* Implement List#to_list. + +* Implement List#one?. + +* Set#to_a is now aliased as #entries. + +* Implement List#minimum (aliased as #min) and List#maximum (aliased as #max). + +=== 0.1.15 / 2009-12-15 + +* Implemented IO#to_list. + +* Implemented Enumerable#to_list. + +=== 0.1.14 / 2009-12-14 + +* List#reduce supports optional initial value. + +* Implemented List#to_ary for implicit conversion to arrays and call parameters. + +* Implemented Set#to_a. + +* Alias #filter as #find_all. + +* Alias #reject as #delete_if. + +* Alias #reduce as #fold. + +=== 0.1.13 / 2009-12-10 + +* Stack now fully functional + +=== 0.1.12 / 2009-12-10 + +* List methods are now lazy where feasible + +* Now works under Ruby >= 1.8.6 + +=== 0.1.8 / 2009-11-29 + +* Add convenience constructors: List[], Set[], and Hash[] + +=== 0.1.7 / 2009-11-27 + +* Implemented #eql?/== for Hash and Set. + +=== 0.1.6 / 2009-11-23 + +* First cut at finishing implementation of Hash. + +=== 0.1.5 / 2009-11-5 + +* Add some examples + +=== 0.1.4 / 2009-10-26 + +* Simplify and share Trie between Hash and Set + +=== 0.1.3 / 2009-10-26 + +* All known issues fixed. + +=== 0.1.2 / 2009-10-25 + +* Fixed all but one outstanding issue with #remove + +=== 0.1.1 / 2009-10-23 + +* Added #remove + +=== 0.1.0 / 2009-10-21 + +* Initial version diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/LICENSE b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/LICENSE new file mode 100644 index 000000000..5f53f8ede --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/LICENSE @@ -0,0 +1,20 @@ +Copyright (c) 2009-2010 Simon Harris + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/README.rdoc b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/README.rdoc new file mode 100644 index 000000000..f4ef029eb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/README.rdoc @@ -0,0 +1,236 @@ += Hamster - Efficient, Immutable, Thread-Safe Collection classes for Ruby + + GitHub: http://github.com/harukizaemon/hamster + RubyGems: https://rubygems.org/gems/hamster + email: haruki_zaemon@mac.com + IRC: ##haruki_zaemon on freenode + +== Introduction + +Hamster started out as an implementation of Hash Array Mapped Tries (HAMT) for Ruby (see http://lampwww.epfl.ch/papers/idealhashtrees.pdf) and has since expanded to include implementations of other Persistent Data Structures (see http://en.wikipedia.org/wiki/Persistent_data_structure) including Set, List, Stack, Queue, and Vector. + +Hamster collections are immutable. Whenever you modify a Hamster collection, the original is preserved and a modified copy is returned. This makes them inherently thread-safe and sharable. (For an interesting perspective on why immutability itself is inherently a good thing, you might like to take a look at Matthias Felleisen's Function Objects presentation: http://www.ccs.neu.edu/home/matthias/Presentations/ecoop2004.pdf) + +Hamster collection classes remain space efficient by making use of some very well understood and very simple techniques that enable sharing between copies. + +Hamster collections are almost always closed under a given operation. That is, whereas Ruby's collection methods always return arrays, Hamster collections will return an instance of the same class wherever possible. + +And lastly, Hamster lists are lazy -- where Ruby's language constructs permit -- making it possible to, among other things, process "infinitely large" lists. (Note: Ruby 1.9 supports a form of laziness using Enumerator. However, they're implemented using Fibers which unfortunately can't be shared across threads.) + +== Installation + +Hamster is distributed as a gem via rubygems (http://rubygems.org/gems/hamster) or as source via GitHub (http://github.com/harukizaemon/hamster). + +Installation via the gem is easy: + + > gem install hamster + +Once installed, all that remains is to make the collection classes available in your code: + + require 'hamster' + +Installation via bundler is even easier: + + gem "hamster" + + +If you prefer, you can instead require individual classes as necessary: + + require 'hamster/list' + require 'hamster/stack' + require 'hamster/queue' + require 'hamster/hash' + require 'hamster/set' + require 'hamster/vector' + +== Examples + +Most Hamster classes support an API that resembles their standard library counterpart, with the caveat that any modification returns a new instance. What follows are some simple examples to help illustrate this point. + +=== Hash + +Constructing a Hamster Hash is almost as simple as a regular one: + + simon = Hamster.hash(:name => "Simon", :gender => :male) # => {:name => "Simon", :gender => :male} + +Accessing the contents will be familiar to you: + + simon[:name] # => "Simon" + simon.get(:gender) # => :male + +Updating the contents is a little different than you are used to: + + james = simon.put(:name, "James") # => {:name => "James", :gender => :male} + simon # => {:name => "Simon", :gender => :male} + james[:name] # => "James" + simon[:name] # => "Simon" + +As you can see, updating the hash returned a copy leaving the original intact. Similarly, deleting a key returns yet another copy: + + male = simon.delete(:name) # => {:gender => :male} + simon # => {:name => "Simon", :gender => :male} + male.has_key?(:name) # => false + simon.has_key?(:name) # => true + +Hamster's hash doesn't provide an assignment (#[]=) method. The reason for this is simple yet irritating: Ruby assignment methods always return the assigned value, no matter what the method itself returns. For example: + + counters = Hamster.hash(:odds => 0, :evens => 0) + counters[:odds] += 1 # => 1 + +Because of this, the returned copy would be lost thus making the construct useless. Instead #put accepts a block instead of an explicit value so we can still do something similar + + counters.put(:odds) { |value| value + 1 } # => {:odds => 1, :evens => 0} + +or more succinctly: + + counters.put(:odds, &:next) # => {:odds => 1, :evens => 0} + +=== Set + +=== List + +Lists have a head -- the value of the item at the head of the list -- and a tail -- containing the remaining items. For example: + + list = Hamster.list(1, 2, 3) + + list.head # => 1 + list.tail # => Hamster.list(2, 3) + +To add to a list, you use #cons: + + original = Hamster.list(1, 2, 3) + copy = original.cons(0) # => Hamster.list(0, 1, 2, 3) + +Notice how modifying a list actually returns a new list. That's because Hamster lists are immutable. Thankfully, just like Hamster Set and Hash, they're also very efficient at making copies! + +Lists are, where possible, lazy. That is, they try to defer processing items until absolutely necessary. For example, given a crude function to detect prime numbers: + + def prime?(n) + 2.upto(Math.sqrt(n).round) { |i| return false if n % i == 0 } + true + end + +The following code will only call prime? as many times as necessary to generate the first 3 prime numbers between 10000 and 1000000: + + Hamster.interval(10000, 1000000).filter { |i| prime?(i) }.take(3) # => 0.0009s + +Compare that to the conventional equivalent which needs to calculate all possible values in the range before taking the first 3: + + (10000..1000000).select { |i| prime?(i) }.take(3) # => 10s + +Besides Hamster.list there are other ways to construct lists: + +Hamster.interval(from, to) (aliased as .range) creates a lazy list equivalent to a list containing all the values between from and to without actually creating a list that big. + +Hamster.stream { ... } allows you to creates infinite lists. Each time a new value is required, the supplied block is called. For example, to generate a list of integers you could do: + + count = 0 + integers = Hamster.stream { count += 1 } + +Hamster.repeat(x) creates an infinite list with x the value for every element. + +Hamster.replicate(n, x) creates a list of size n with x the value for every element. + +Hamster.iterate(x) { |x| ... } creates an infinite list where the first item is calculated by applying the block on the initial argument, the second item by applying the function on the previous result and so on. For example, a simpler way to generate a list of integers would be: + + integers = Hamster.iterate(1) { |i| i + 1 } + +or even more succinctly: + + integers = Hamster.iterate(1, &:next) + +You also get Enumerable#to_list so you can slowly transition from built-in collection classes to Hamster. + +And finally, you get IO#to_list allowing you to lazily processes huge files. For example, imagine the following code to process a 100MB file: + + File.open("my_100_mb_file.txt") do |io| + lines = [] + io.each_line do |line| + break if lines.size == 10 + lines << line.chomp.downcase.reverse + end + end + +How many times/how long did you read the code before it became apparent what the code actually did? Now compare that to the following: + + File.open("my_100_mb_file.txt") do |io| + io.map(&:chomp).map(&:downcase).map(&:reverse).take(10) + end + +Unfortunately, though the second example reads nicely, it takes around 13 seconds to run (compared with 0.033 seconds for the first) even though we're only interested in the first 10 lines! However, using a little #to_list magic, we can get the running time back down to 0.033 seconds! + + File.open("my_100_mb_file.txt") do |io| + io.to_list.map(&:chomp).map(&:downcase).map(&:reverse).take(10) + end + +How is this even possible? It's possible because IO#to_list creates a lazy list whereby each line is only ever read and processed as needed, in effect converting it to the first example without all the syntactic, imperative, noise. + +=== Stack + +=== Queue + +=== Vector + +== Disclaimer + +Hamster started out as a spike to prove a point and has since morphed into something I actually use. My primary concern has been to round out the functionality with good test coverage and clean, readable code. + +Performance is pretty good -- especially with lazy lists -- but there are some things which may blow the stack due to a lack of Tail-Call-Optimisation in Ruby. + +Documentation is sparse but I've tried as best I can to write specs that read as documentation. I've also tried to alias methods as their Enumerable equivalents where possible to ease code migration. + +== Reporting bugs + +Please report all bugs on the GitHub issue tracker located at: http://github.com/harukizaemon/hamster/issues + +== But I still don't understand why I should care? + +As mentioned earlier, persistent data structures perform a copy whenever they are modified meaning there is never any chance that two threads could be modifying the same instance at any one time. And, because they are very efficient copies, you don't need to worry about using up gobs of memory in the process. + +Even if threading isn't a concern, because they're immutable, you can pass them around between objects, methods, and functions in the same thread and never worry about data corruption; no more defensive calls to #dup! + +=== OK, that sounds mildly interesting. What's the downside--there's always a downside? + +There's a potential performance hit when compared with MRI's built-in, native, hand-crafted C-code implementation of Hash. For example: + + hash = Hamster.hash + (1..10000).each { |i| hash = hash.put(i, i) } # => 0.05s + (1..10000).each { |i| hash.get(i) } # => 0.008s + +versus + + hash = {} + (1..10000).each { |i| hash[i] = i } # => 0.004s + (1..10000).each { |i| hash[i] } # => 0.001s + +=== That seems pretty bad? + +Well, yes and no. The previous comparison wasn't really fair. Sure, if all you want to do is replace your existing uses of Hash in single-threaded environments then don't even bother. However, if you need something that can be used efficiently in concurrent environments where multiple threads are accessing--reading AND writing--the contents things get much better. + +=== Do you have a better example? + +A more realistic comparison might look like: + + hash = Hamster.hash + (1..10000).each { |i| hash = hash.put(i, i) } # => 0.05s + (1..10000).each { |i| hash.get(i) } # => 0.008s + +versus + + hash = {} + (1..10000).each { |i| + hash = hash.dup + hash[i] = i + } # => 19.8s + + (1..10000).each { |i| hash[i] } # => 0.001s + +What's even better -- or worse depending on your perspective -- is that after all that, the native Hash version still isn't thread-safe and still requires some synchronisation around it slowing it down even further. + +The Hamster version on the other hand was unchanged from the original whilst remaining inherently thread-safe, and 3 orders of magnitude faster. + +=== Sure, but as you say, you still need synchronisation so why bother with the copying? + +Well, I could show you one but I'd have to re-write/wrap most Hash methods to make them generic, or at the very least write some application-specific code that synchronised using a Mutex and ... well ... it's hard, I always make mistakes, I always end up with weird edge cases and race conditions so, I'll leave that as an exercise for you :) + +And don't forget that even if threading isn't a concern for you, the safety provided by immutability alone is worth it, not to mention the lazy implementations. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/Rakefile new file mode 100644 index 000000000..2387e6f00 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/Rakefile @@ -0,0 +1,5 @@ +Dir[File.expand_path("tasks/**/*.rb")].each do |task_file| + require task_file +end + +task :default => [ :spec ] diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster.rb new file mode 100644 index 000000000..6a7a2bef4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster.rb @@ -0,0 +1,9 @@ +require 'hamster/core_ext' +require 'hamster/immutable' +require 'hamster/list' +require 'hamster/stack' +require 'hamster/queue' +require 'hamster/hash' +require 'hamster/set' +require 'hamster/vector' +require 'hamster/version' diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/core_ext.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/core_ext.rb new file mode 100644 index 000000000..bcf6e1f91 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/core_ext.rb @@ -0,0 +1,3 @@ +require 'hamster/core_ext/enumerable' +require 'hamster/core_ext/enumerator' +require 'hamster/core_ext/io' diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/core_ext/enumerable.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/core_ext/enumerable.rb new file mode 100644 index 000000000..a5c7eae18 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/core_ext/enumerable.rb @@ -0,0 +1,30 @@ +require 'hamster/list' + +module Hamster + + module CoreExt + + module Enumerable + + def self.included(base) + base.class_eval do + def to_list + list = EmptyList + reverse_each { |item| list = list.cons(item) } + list + end + end + + end + + end + + end + +end + +module Enumerable + + include Hamster::CoreExt::Enumerable + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/core_ext/enumerator.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/core_ext/enumerator.rb new file mode 100644 index 000000000..903841fc5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/core_ext/enumerator.rb @@ -0,0 +1,30 @@ +require 'hamster/list' + +module Hamster + + module CoreExt + + module Enumerator + + def to_list + Stream.new do + begin + Sequence.new(self.next, to_list) + rescue StopIteration + EmptyList + end + end + + end + + end + + end + +end + +class Enumerator + + include Hamster::CoreExt::Enumerator + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/core_ext/io.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/core_ext/io.rb new file mode 100644 index 000000000..a5009a3e7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/core_ext/io.rb @@ -0,0 +1,30 @@ +require 'hamster/list' + +module Hamster + + module CoreExt + + module IO + + def to_list(sep = $/) + Stream.new do + line = gets(sep) + if line + Sequence.new(line, to_list) + else + EmptyList + end + end + end + + end + + end + +end + +class IO + + include Hamster::CoreExt::IO + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/enumerable.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/enumerable.rb new file mode 100644 index 000000000..6fdf9a64e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/enumerable.rb @@ -0,0 +1,141 @@ +require 'forwardable' + +require 'hamster/undefined' +require 'hamster/tuple' + +module Hamster + + module Enumerable + + extend Forwardable + + def each + raise NoMethodError, "undefined method `each' for #{self.class.name}" + end + def_delegator :self, :each, :foreach + + def filter + raise NoMethodError, "undefined method `filter' for #{self.class.name}" + end + def_delegator :self, :filter, :select + def_delegator :self, :filter, :find_all + + def each_with_index(&block) + return self unless block_given? + reduce(0) do |index, item| + yield(item, index) + index + 1 + end + nil + end + + def reduce(memo = Undefined) + each do |item| + memo = memo.equal?(Undefined) ? item : yield(memo, item) + end if block_given? + Undefined.erase(memo) + end + def_delegator :self, :reduce, :inject + def_delegator :self, :reduce, :fold + def_delegator :self, :reduce, :foldr + + def partition(&block) + return self unless block_given? + Tuple.new(filter(&block), remove(&block)) + end + + def find + return nil unless block_given? + each { |item| return item if yield(item) } + end + def_delegator :self, :find, :detect + + def include?(object) + any? { |item| item == object } + end + def_delegator :self, :include?, :member? + def_delegator :self, :include?, :contains? + def_delegator :self, :include?, :elem? + + def any? + return any? { |item| item } unless block_given? + each { |item| return true if yield(item) } + false + end + def_delegator :self, :any?, :exist? + def_delegator :self, :any?, :exists? + + def all? + return all? { |item| item } unless block_given? + each { |item| return false unless yield(item) } + true + end + def_delegator :self, :all?, :forall? + + def none? + return none? { |item| item } unless block_given? + each { |item| return false if yield(item) } + true + end + + def one? + return one? { |item| !! item } unless block_given? + reduce(false) do |previously_matched, item| + if yield(item) + return false if previously_matched + true + else + previously_matched + end + end + end + + def minimum(&block) + return minimum { |minimum, item| item <=> minimum } unless block_given? + reduce { |minimum, item| yield(minimum, item) < 0 ? item : minimum } + end + def_delegator :self, :minimum, :min + + def maximum(&block) + return maximum { |maximum, item| item <=> maximum } unless block_given? + reduce { |maximum, item| yield(maximum, item) > 0 ? item : maximum } + end + def_delegator :self, :maximum, :max + + def grep(pattern, &block) + filter { |item| pattern === item }.map(&block) + end + + def count(&block) + return size unless block_given? + reduce(0) { |count, item| yield(item) ? count + 1 : count } + end + + def product + reduce(1, &:*) + end + + def sum + reduce(0, &:+) + end + + def remove + return self unless block_given? + filter { |item| !yield(item) } + end + def_delegator :self, :remove, :reject + def_delegator :self, :remove, :delete_if + + def compact + remove(&:nil?) + end + + def to_a + reduce([]) { |a, item| a << item } + end + def_delegator :self, :to_a, :entries + def_delegator :self, :to_a, :to_ary + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/experimental/mutable_hash.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/experimental/mutable_hash.rb new file mode 100644 index 000000000..7e865fab0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/experimental/mutable_hash.rb @@ -0,0 +1,34 @@ +require 'hamster/hash' +require 'hamster/experimental/read_copy_update' + +module Hamster + + def self.mutable_hash(pairs = {}, &block) + MutableHash.new(hash(pairs, &block)) + end + + class MutableHash + + include ReadCopyUpdate + + def put(key, value = Undefined, &block) + old_value = nil + transform { |hash| + old_value = hash.get(key) + hash.put(key, value, &block) + } + old_value + end + + def delete(key) + old_value = nil + transform { |hash| + old_value = hash.get(key) + hash.delete(key) + } + old_value + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/experimental/mutable_queue.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/experimental/mutable_queue.rb new file mode 100644 index 000000000..a4f6b331f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/experimental/mutable_queue.rb @@ -0,0 +1,34 @@ +require 'forwardable' +require 'hamster/queue' +require 'hamster/experimental/read_copy_update' + +module Hamster + + def self.mutable_queue(*items) + MutableQueue.new(queue(*items)) + end + + class MutableQueue + + extend Forwardable + + include ReadCopyUpdate + + def enqueue(item) + transform { |queue| queue.enqueue(item) } + end + def_delegate :self, :enqueue, :<< + def_delegate :self, :enqueue, :add + + def dequeue + head = nil + transform { |queue| + head = queue.head + queue.dequeue + } + head + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/experimental/mutable_set.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/experimental/mutable_set.rb new file mode 100644 index 000000000..2002c27c7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/experimental/mutable_set.rb @@ -0,0 +1,46 @@ +require 'forwardable' +require 'hamster/set' +require 'hamster/experimental/read_copy_update' + +module Hamster + + def self.mutable_set(*items) + MutableSet.new(set(*items)) + end + + class MutableSet + + extend Forwardable + + include ReadCopyUpdate + + def add(item) + transform { |set| set.add(item) } + end + def_delegator :self, :add, :<< + + def add?(item) + added = false + transform { |set| + added = !set.include?(item) + set.add(item) + } + added + end + + def delete(item) + transform { |set| set.delete(item) } + end + + def delete?(item) + deleted = false + transform { |set| + deleted = set.include?(item) + set.delete(item) + } + deleted + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/experimental/mutable_stack.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/experimental/mutable_stack.rb new file mode 100644 index 000000000..e86ab5639 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/experimental/mutable_stack.rb @@ -0,0 +1,35 @@ +require 'forwardable' +require 'hamster/stack' +require 'hamster/experimental/read_copy_update' + +module Hamster + + def self.mutable_stack(*items) + MutableStack.new(stack(*items)) + end + + class MutableStack + + extend Forwardable + + include ReadCopyUpdate + + def push(item) + transform { |stack| stack.push(item) } + end + def_delegator :self, :push, :<< + def_delegator :self, :push, :enqueue + + def pop + top = nil + transform { |stack| + top = stack.peek + stack.pop + } + top + end + def_delegator :self, :pop, :dequeue + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/experimental/read_copy_update.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/experimental/read_copy_update.rb new file mode 100644 index 000000000..ce41c6072 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/experimental/read_copy_update.rb @@ -0,0 +1,35 @@ +require 'forwardable' +require 'thread' + +module Hamster + + module ReadCopyUpdate + + extend Forwardable + + def initialize(content) + @content = content + @lock = Mutex.new + end + + def eql?(other) + instance_of?(other.class) && @content.eql?(other.instance_variable_get(:@content)) + end + def_delegator :self, :eql?, :== + + protected + + def transform + @lock.synchronize { @content = yield(@content) } + self + end + + private + + def method_missing(name, *args, &block) + @content.send(name, *args, &block) rescue super + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/hash.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/hash.rb new file mode 100644 index 000000000..dcc1daad4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/hash.rb @@ -0,0 +1,193 @@ +require 'forwardable' + +require 'hamster/immutable' +require 'hamster/undefined' +require 'hamster/trie' + +module Hamster + + def self.hash(pairs = {}, &block) + Hash.new(pairs, &block) + end + + class Hash + + extend Forwardable + + include Immutable + + class << self + def new(pairs = {}, &block) + @empty ||= super() + pairs.reduce(block_given? ? super(&block) : @empty) { |hash, pair| hash.put(pair.first, pair.last) } + end + + attr_reader :empty + end + + def initialize(&block) + @trie = EmptyTrie + @default = block + end + + def size + @trie.size + end + def_delegator :self, :size, :length + + def empty? + @trie.empty? + end + def_delegator :self, :empty?, :null? + + def has_key?(key) + @trie.has_key?(key) + end + def_delegator :self, :has_key?, :key? + def_delegator :self, :has_key?, :include? + def_delegator :self, :has_key?, :member? + + def get(key) + entry = @trie.get(key) + if entry + entry.value + elsif @default + @default.call(key) + end + end + def_delegator :self, :get, :[] + + def fetch(key, default = Undefined) + entry = @trie.get(key) + if entry + entry.value + elsif default != Undefined + default + elsif block_given? + yield + else + raise KeyError.new("key not found: #{key.inspect}") + end + end + + def put(key, value = Undefined) + return put(key, yield(get(key))) if value.equal?(Undefined) + transform { @trie = @trie.put(key, value) } + end + + def delete(key) + trie = @trie.delete(key) + transform_unless(trie.equal?(@trie)) { @trie = trie } + end + + def each + return self unless block_given? + @trie.each { |entry| yield(entry.key, entry.value) } + end + def_delegator :self, :each, :foreach + + def map + return self unless block_given? + return self if empty? + transform { @trie = @trie.reduce(EmptyTrie) { |trie, entry| trie.put(*yield(entry.key, entry.value)) } } + end + def_delegator :self, :map, :collect + + def reduce(memo) + return memo unless block_given? + @trie.reduce(memo) { |memo, entry| yield(memo, entry.key, entry.value) } + end + def_delegator :self, :reduce, :inject + def_delegator :self, :reduce, :fold + def_delegator :self, :reduce, :foldr + + def filter + return self unless block_given? + trie = @trie.filter { |entry| yield(entry.key, entry.value) } + return self.class.empty if trie.empty? + transform_unless(trie.equal?(@trie)) { @trie = trie } + end + def_delegator :self, :filter, :select + def_delegator :self, :filter, :find_all + + def remove + return self unless block_given? + filter { |key, value| !yield(key, value) } + end + def_delegator :self, :remove, :reject + def_delegator :self, :remove, :delete_if + + def any? + return !empty? unless block_given? + each { |key, value| return true if yield(key, value) } + false + end + def_delegator :self, :any?, :exist? + def_delegator :self, :any?, :exists? + + def all? + each { |key, value| return false unless yield(key, value) } if block_given? + true + end + def_delegator :self, :all?, :forall? + + def none? + return empty? unless block_given? + each { |key, value| return false if yield(key, value) } + true + end + + def find + return nil unless block_given? + each { |key, value| return Tuple.new(key, value) if yield(key, value) } + nil + end + def_delegator :self, :find, :detect + + def merge(other) + transform { @trie = other.reduce(@trie, &:put) } + end + def_delegator :self, :merge, :+ + + def except(*keys) + keys.reduce(self) { |hash, key| hash.delete(key) } + end + + def slice(*keys) + except(*self.keys - keys) + end + + def keys + reduce(Hamster.set) { |keys, key, value| keys.add(key) } + end + + def values + reduce(Hamster.list) { |values, key, value| values.cons(value) } + end + + def clear + self.class.empty + end + + def eql?(other) + instance_of?(other.class) && @trie.eql?(other.instance_variable_get(:@trie)) + end + def_delegator :self, :eql?, :== + + def hash + reduce(0) { |hash, key, value| (hash << 32) - hash + key.hash + value.hash } + end + + def_delegator :self, :dup, :uniq + def_delegator :self, :dup, :nub + def_delegator :self, :dup, :remove_duplicates + + def inspect + "{#{reduce([]) { |memo, key, value| memo << "#{key.inspect} => #{value.inspect}"}.join(", ")}}" + end + + end + + EmptyHash = Hash.new + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/immutable.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/immutable.rb new file mode 100644 index 000000000..6a93ae31a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/immutable.rb @@ -0,0 +1,81 @@ +module Hamster + + module Immutable + + def self.included(klass) + klass.extend(ClassMethods) + klass.instance_eval do + include InstanceMethods + end + end + + module ClassMethods + + def new(*args) + super.immutable! + end + + def memoize(*names) + include MemoizeMethods unless include?(MemoizeMethods) + names.each do |name| + original_method = "__hamster_immutable_#{name}__" + alias_method original_method, name + class_eval <<-METHOD, __FILE__, __LINE__ + def #{name} + if @__hamster_immutable_memory__.instance_variable_defined?(:@#{name}) + @__hamster_immutable_memory__.instance_variable_get(:@#{name}) + else + @__hamster_immutable_memory__.instance_variable_set(:@#{name}, #{original_method}) + end + end + METHOD + end + end + + end + + module MemoizeMethods + + def immutable! + @__hamster_immutable_memory__ = Object.new + freeze + end + + end + + module InstanceMethods + + def immutable! + freeze + end + + def immutable? + frozen? + end + + alias_method :__hamster_immutable_dup__, :dup + private :__hamster_immutable_dup__ + + def dup + self + end + + def clone + self + end + + protected + + def transform_unless(condition, &block) + condition ? self : transform(&block) + end + + def transform(&block) + __hamster_immutable_dup__.tap { |copy| copy.instance_eval(&block) }.immutable! + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/list.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/list.rb new file mode 100644 index 000000000..56ea98c90 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/list.rb @@ -0,0 +1,501 @@ +require 'forwardable' +require 'thread' + +require 'hamster/core_ext/enumerable' +require 'hamster/undefined' +require 'hamster/enumerable' +require 'hamster/tuple' +require 'hamster/sorter' +require 'hamster/hash' +require 'hamster/set' + +module Hamster + + class << self + + extend Forwardable + + def list(*items) + items.to_list + end + + def stream(&block) + return EmptyList unless block_given? + Stream.new { Sequence.new(yield, stream(&block)) } + end + + def interval(from, to) + return EmptyList if from > to + interval_exclusive(from, to.next) + end + def_delegator :self, :interval, :range + + def repeat(item) + Stream.new { Sequence.new(item, repeat(item)) } + end + + def replicate(number, item) + repeat(item).take(number) + end + + def iterate(item, &block) + Stream.new { Sequence.new(item, iterate(yield(item), &block)) } + end + + private + + def interval_exclusive(from, to) + return EmptyList if from == to + Stream.new { Sequence.new(from, interval_exclusive(from.next, to)) } + end + + end + + module List + + extend Forwardable + + include Enumerable + + CADR = /^c([ad]+)r$/ + + def_delegator :self, :head, :first + + def_delegator :self, :empty?, :null? + + def size + reduce(0) { |memo, item| memo.next } + end + def_delegator :self, :size, :length + + def cons(item) + Sequence.new(item, self) + end + def_delegator :self, :cons, :>> + + def each + return self unless block_given? + list = self + while !list.empty? + yield(list.head) + list = list.tail + end + end + + def map(&block) + return self unless block_given? + Stream.new do + next self if empty? + Sequence.new(yield(head), tail.map(&block)) + end + end + def_delegator :self, :map, :collect + + def filter(&block) + return self unless block_given? + Stream.new do + next self if empty? + next Sequence.new(head, tail.filter(&block)) if yield(head) + tail.filter(&block) + end + end + + def take_while(&block) + return self unless block_given? + Stream.new do + next self if empty? + next Sequence.new(head, tail.take_while(&block)) if yield(head) + EmptyList + end + end + + def drop_while(&block) + return self unless block_given? + Stream.new do + list = self + while !list.empty? && yield(list.head) + list = list.tail + end + list + end + end + + def take(number) + Stream.new do + next self if empty? + next Sequence.new(head, tail.take(number - 1)) if number > 0 + EmptyList + end + end + + def drop(number) + Stream.new do + list = self + while !list.empty? && number > 0 + number -= 1 + list = list.tail + end + list + end + end + + def append(other) + Stream.new do + next other if empty? + Sequence.new(head, tail.append(other)) + end + end + def_delegator :self, :append, :concat + def_delegator :self, :append, :cat + def_delegator :self, :append, :+ + + def reverse + Stream.new { reduce(EmptyList) { |list, item| list.cons(item) } } + end + + def zip(other) + Stream.new do + next self if empty? && other.empty? + Sequence.new(Sequence.new(head, Sequence.new(other.head)), tail.zip(other.tail)) + end + end + + def cycle + Stream.new do + next self if empty? + Sequence.new(head, tail.append(self.cycle)) + end + end + + def split_at(number) + Tuple.new(take(number), drop(number)) + end + + def span(&block) + return Tuple.new(self, EmptyList) unless block_given? + Tuple.new(take_while(&block), drop_while(&block)) + end + + def break(&block) + return span unless block_given? + span { |item| !yield(item) } + end + + def clear + EmptyList + end + + def sort(&comparator) + Stream.new { Sorter.new(self).sort(&comparator) } + end + + def sort_by(&transformer) + return sort unless block_given? + Stream.new { Sorter.new(self).sort_by(&transformer) } + end + + def join(sep = "") + return "" if empty? + sep = sep.to_s + tail.reduce(head.to_s.dup) { |result, item| result << sep << item.to_s } + end + + def intersperse(sep) + Stream.new do + next self if tail.empty? + Sequence.new(head, Sequence.new(sep, tail.intersperse(sep))) + end + end + + def uniq(items = EmptySet) + Stream.new do + next self if empty? + next tail.uniq(items) if items.include?(head) + Sequence.new(head, tail.uniq(items.add(head))) + end + end + def_delegator :self, :uniq, :nub + def_delegator :self, :uniq, :remove_duplicates + + def union(other) + self.append(other).uniq + end + def_delegator :self, :union, :| + + def init + return EmptyList if tail.empty? + Stream.new { Sequence.new(head, tail.init) } + end + + def last + list = self + while !list.tail.empty? + list = list.tail + end + list.head + end + + def tails + Stream.new do + next Sequence.new(self) if empty? + Sequence.new(self, tail.tails) + end + end + + def inits + Stream.new do + next Sequence.new(self) if empty? + Sequence.new(EmptyList, tail.inits.map { |list| list.cons(head) }) + end + end + + def combinations(number) + return Sequence.new(EmptyList) if number == 0 + Stream.new do + next self if empty? + tail.combinations(number - 1).map { |list| list.cons(head) }.append(tail.combinations(number)) + end + end + def_delegator :self, :combinations, :combination + + def chunk(number) + Stream.new do + next self if empty? + first, remainder = split_at(number) + Sequence.new(first, remainder.chunk(number)) + end + end + + def each_chunk(number, &block) + chunk(number).each(&block) + end + def_delegator :self, :each_chunk, :each_slice + + def flatten + Stream.new do + next self if empty? + next head.append(tail.flatten) if head.is_a?(List) + Sequence.new(head, tail.flatten) + end + end + + def group_by(&block) + return group_by { |item| item } unless block_given? + reduce(EmptyHash) do |hash, item| + key = yield(item) + hash.put(key, (hash.get(key) || EmptyList).cons(item)) + end + end + def_delegator :self, :group_by, :group + + def at(index) + drop(index).head + end + + def slice(from, length = Undefined) + return at(from) if length.equal?(Undefined) + drop(from).take(length) + end + def_delegator :self, :slice, :[] + + def find_index + return nil unless block_given? + i = 0 + list = self + loop do + return nil if list.empty? + return i if yield(list.head) + i += 1 + list = list.tail + end + end + + def elem_index(object) + find_index { |item| item == object } + end + + def index(object = Undefined, &block) + return elem_index(object) unless object.equal?(Undefined) + find_index(&block) + end + + def find_indices(i = 0, &block) + return EmptyList unless block_given? + Stream.new do + next EmptyList if empty? + next Sequence.new(i, tail.find_indices(i + 1, &block)) if yield(head) + tail.find_indices(i + 1, &block) + end + end + + def elem_indices(object) + find_indices { |item| item == object } + end + + def indices(object = Undefined, &block) + return elem_indices(object) unless object.equal?(Undefined) + find_indices(&block) + end + + def merge(&comparator) + return merge_by unless block_given? + Stream.new do + sorted = remove(&:empty?).sort do |a, b| + yield(a.head, b.head) + end + next EmptyList if sorted.empty? + Sequence.new(sorted.head.head, sorted.tail.cons(sorted.head.tail).merge(&comparator)) + end + end + + def merge_by(&transformer) + return merge_by { |item| item } unless block_given? + Stream.new do + sorted = remove(&:empty?).sort_by do |list| + yield(list.head) + end + next EmptyList if sorted.empty? + Sequence.new(sorted.head.head, sorted.tail.cons(sorted.head.tail).merge_by(&transformer)) + end + end + + def eql?(other) + list = self + loop do + return true if other.equal?(list) + return false unless other.is_a?(List) + return other.empty? if list.empty? + return false if other.empty? + return false unless other.head.eql?(list.head) + list = list.tail + other = other.tail + end + end + def_delegator :self, :eql?, :== + + def hash + reduce(0) { |hash, item| (hash << 5) - hash + item.hash } + end + + def dup + self + end + def_delegator :self, :dup, :clone + + def to_list + self + end + + def to_set + reduce(EmptySet) { |set, item| set.add(item) } + end + + def inspect + to_a.inspect + end + + def respond_to?(name, include_private = false) + super || CADR === name.to_s + end + + private + + def method_missing(name, *args, &block) + return accessor($1) if CADR === name.to_s + super + end + + # Perform compositions of car and cdr operations. Their names consist of a 'c', followed by at + # least one 'a' or 'd', and finally an 'r'. The series of 'a's and 'd's in each function's name is chosen to + # identify the series of car and cdr operations that is performed by the function. The order in which the 'a's and + # 'd's appear is the inverse of the order in which the corresponding operations are performed. + def accessor(sequence) + sequence.reverse.each_char.reduce(self) do |memo, char| + case char + when "a" then memo.head + when "d" then memo.tail + end + end + end + + end + + class Sequence + + include List + + attr_reader :head, :tail + + def initialize(head, tail = EmptyList) + @head = head + @tail = tail + end + + def empty? + false + end + + end + + class Stream + + extend Forwardable + + include List + + def initialize(&block) + @block = block + @lock = Mutex.new + end + + def_delegator :target, :head + def_delegator :target, :tail + def_delegator :target, :empty? + + protected + + def vivify + @lock.synchronize do + unless @block.nil? + @target = @block.call + @block = nil + end + end + @target + end + + private + + def target + list = vivify + while list.is_a?(Stream) + list = list.vivify + end + list + end + + end + + module EmptyList + + class << self + + include List + + def head + nil + end + + def tail + self + end + + def empty? + true + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/queue.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/queue.rb new file mode 100644 index 000000000..aa6bd1576 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/queue.rb @@ -0,0 +1,93 @@ +require 'forwardable' + +require 'hamster/immutable' +require 'hamster/list' + +module Hamster + + def self.queue(*items) + items.reduce(EmptyQueue) { |queue, item| queue.enqueue(item) } + end + + class Queue + + extend Forwardable + + include Immutable + + def initialize + @front = @rear = EmptyList + end + + def empty? + @front.empty? && @rear.empty? + end + def_delegator :self, :empty?, :null? + + def size + @front.size + @rear.size + end + def_delegator :self, :size, :length + + def head + return @front.head unless @front.empty? + @rear.last + end + def_delegator :self, :head, :first + def_delegator :self, :head, :peek + def_delegator :self, :head, :front + + def enqueue(item) + transform { @rear = @rear.cons(item) } + end + def_delegator :self, :enqueue, :<< + def_delegator :self, :enqueue, :add + + def dequeue + front = @front + rear = @rear + if front.empty? + return EmptyQueue if rear.empty? + front = rear.reverse + rear = EmptyList + end + + transform { + @front = front.tail + @rear = rear + } + end + def_delegator :self, :dequeue, :tail + + def clear + EmptyQueue + end + + def eql?(other) + instance_of?(other.class) && + to_list.eql?(other.to_list) + end + def_delegator :self, :eql?, :== + + def to_a + to_list.to_a + end + def_delegator :self, :to_a, :entries + + def to_ary + to_list.to_ary + end + + def to_list + @front.append(@rear.reverse) + end + + def inspect + to_list.inspect + end + + end + + EmptyQueue = Queue.new + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/set.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/set.rb new file mode 100644 index 000000000..f82bf864f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/set.rb @@ -0,0 +1,174 @@ +require 'forwardable' + +require 'hamster/immutable' +require 'hamster/undefined' +require 'hamster/enumerable' +require 'hamster/sorter' +require 'hamster/trie' +require 'hamster/list' + +module Hamster + + def self.set(*items) + items.reduce(EmptySet) { |set, item| set.add(item) } + end + + class Set + + extend Forwardable + + include Immutable + + include Enumerable + + def initialize(trie = EmptyTrie) + @trie = trie + end + + def empty? + @trie.empty? + end + def_delegator :self, :empty?, :null? + + def size + @trie.size + end + def_delegator :self, :size, :length + + def add(item) + transform_unless(include?(item)) { @trie = @trie.put(item, nil) } + end + def_delegator :self, :add, :<< + + def delete(item) + trie = @trie.delete(item) + transform_unless(trie.equal?(@trie)) { @trie = trie } + end + + def each + return self unless block_given? + @trie.each { |entry| yield(entry.key) } + end + + def map + return self unless block_given? + return self if empty? + transform { @trie = @trie.reduce(EmptyTrie) { |trie, entry| trie.put(yield(entry.key), nil) } } + end + def_delegator :self, :map, :collect + + def filter + return self unless block_given? + trie = @trie.filter { |entry| yield(entry.key) } + return EmptySet if trie.empty? + transform_unless(trie.equal?(@trie)) { @trie = trie } + end + + def include?(object) + any? { |item| item.eql?(object) } + end + + def head + find { true } + end + def_delegator :self, :head, :first + + def sort(&comparator) + Stream.new { Sorter.new(self).sort(&comparator) } + end + + def sort_by(&transformer) + return sort unless block_given? + Stream.new { Sorter.new(self).sort_by(&transformer) } + end + + def join(sep = nil) + to_a.join(sep) + end + + def union(other) + trie = other.reduce(@trie) do |trie, item| + next trie if trie.has_key?(item) + trie.put(item, nil) + end + transform_unless(trie.equal?(@trie)) { @trie = trie } + end + def_delegator :self, :union, :| + def_delegator :self, :union, :+ + def_delegator :self, :union, :merge + + def intersection(other) + trie = @trie.filter { |entry| other.include?(entry.key) } + transform_unless(trie.equal?(@trie)) { @trie = trie } + end + def_delegator :self, :intersection, :intersect + def_delegator :self, :intersection, :& + + def difference(other) + trie = @trie.filter { |entry| !other.include?(entry.key) } + transform_unless(trie.equal?(@trie)) { @trie = trie } + end + def_delegator :self, :difference, :diff + def_delegator :self, :difference, :subtract + def_delegator :self, :difference, :- + + def exclusion(other) + ((self | other) - (self & other)) + end + def_delegator :self, :exclusion, :^ + + def subset?(other) + all? { |item| other.include?(item) } + end + + def superset?(other) + other.subset?(self) + end + + def flatten + reduce(EmptySet) do |set, item| + next set.union(item.flatten) if item.is_a?(Set) + set.add(item) + end + end + + def group_by(&block) + return group_by { |item| item } unless block_given? + reduce(EmptyHash) do |hash, item| + key = yield(item) + hash.put(key, (hash.get(key) || EmptySet).add(item)) + end + end + def_delegator :self, :group_by, :group + + def clear + EmptySet + end + + def eql?(other) + instance_of?(other.class) && @trie.eql?(other.instance_variable_get(:@trie)) + end + def_delegator :self, :eql?, :== + + def hash + reduce(0) { |hash, item| (hash << 5) - hash + item.hash } + end + + def_delegator :self, :dup, :uniq + def_delegator :self, :dup, :nub + def_delegator :self, :dup, :to_set + def_delegator :self, :dup, :remove_duplicates + + def to_list + reduce(EmptyList) { |list, item| list.cons(item) } + end + + def inspect + "{#{to_a.inspect[1..-2]}}" + end + + end + + EmptySet = Set.new + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/sorter.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/sorter.rb new file mode 100644 index 000000000..3f6525443 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/sorter.rb @@ -0,0 +1,32 @@ +require 'forwardable' + +require 'hamster/immutable' +require 'hamster/core_ext/enumerator' + +module Hamster + + class Sorter + + include ::Enumerable + + extend Forwardable + + include Immutable + + def initialize(collection) + @collection = collection + end + + def_delegator :@collection, :each + + def sort(&comparator) + super.to_enum.to_list + end + + def sort_by(&transformer) + super.to_enum.to_list + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/stack.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/stack.rb new file mode 100644 index 000000000..21380ca42 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/stack.rb @@ -0,0 +1,82 @@ +require 'forwardable' + +require 'hamster/immutable' +require 'hamster/list' + +module Hamster + + def self.stack(*items) + items.reduce(EmptyStack) { |stack, item| stack.push(item) } + end + + class Stack + + extend Forwardable + + include Immutable + + def initialize + @list = EmptyList + end + + def empty? + @list.empty? + end + + def size + @list.size + end + def_delegator :self, :size, :length + + def peek + @list.head + end + def_delegator :self, :peek, :top + + def push(item) + transform { @list = @list.cons(item) } + end + def_delegator :self, :push, :<< + def_delegator :self, :push, :enqueue + + def pop + list = @list.tail + if list.empty? + EmptyStack + else + transform { @list = list } + end + end + def_delegator :self, :pop, :dequeue + + def clear + EmptyStack + end + + def eql?(other) + instance_of?(other.class) && @list.eql?(other.instance_variable_get(:@list)) + end + def_delegator :self, :eql?, :== + + def to_a + @list.to_a + end + def_delegator :self, :to_a, :entries + + def to_ary + @list.to_ary + end + + def to_list + @list + end + + def inspect + @list.inspect + end + + end + + EmptyStack = Stack.new + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/trie.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/trie.rb new file mode 100644 index 000000000..4b673db70 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/trie.rb @@ -0,0 +1,185 @@ +require 'forwardable' + +module Hamster + + class Trie + + extend Forwardable + + def initialize(significant_bits, size = 0, entries = [], children = []) + @significant_bits = significant_bits + @entries = entries + @children = children + @size = size + end + + # Returns the number of key-value pairs in the trie. + def size + @size + end + + # Returns true if the trie contains no key-value pairs. + def empty? + size == 0 + end + + # Returns true if the given key is present in the trie. + def has_key?(key) + !! get(key) + end + + # Calls block once for each entry in the trie, passing the key-value pair as parameters. + def each + @entries.each { |entry| yield(entry) if entry } + @children.each do |child| + child.each { |entry| yield(entry) } if child + end + nil + end + + def reduce(memo) + each { |entry| memo = yield(memo, entry) } + memo + end + + def filter + reduce(self) { |trie, entry| yield(entry) ? trie : trie.delete(entry.key) } + end + + # Returns a copy of self with the given value associated with the key. + def put(key, value) + index = index_for(key) + entry = @entries[index] + + if !entry + entries = @entries.dup + entries[index] = Entry.new(key, value) + self.class.new(@significant_bits, @size + 1, entries, @children) + elsif entry.key.eql?(key) + entries = @entries.dup + entries[index] = Entry.new(key, value) + self.class.new(@significant_bits, @size, entries, @children) + else + children = @children.dup + child = children[index] + child_size = child ? child.size : 0 + children[index] = if child + child.put(key, value) + else + self.class.new(@significant_bits + 5).put!(key, value) + end + new_child_size = children[index].size + new_self_size = @size + (new_child_size - child_size) + self.class.new(@significant_bits, new_self_size, @entries, children) + end + end + + # Retrieves the entry corresponding to the given key. If not found, returns nil. + def get(key) + index = index_for(key) + entry = @entries[index] + if entry && entry.key.eql?(key) + entry + else + child = @children[index] + if child + child.get(key) + end + end + end + + # Returns a copy of self with the given key (and associated value) deleted. If not found, returns self. + def delete(key) + find_and_delete(key) || self.class.new(@significant_bits) + end + + def include?(key, value) + entry = get(key) + entry && value.eql?(entry.value) + end + + # Returns true if . eql? is synonymous with == + def eql?(other) + return true if equal?(other) + return false unless instance_of?(other.class) && size == other.size + each do |entry| + return false unless other.include?(entry.key, entry.value) + end + true + end + def_delegator :self, :eql?, :== + + protected + + # Returns self after overwriting the element associated with the specified key. + def put!(key, value) + index = index_for(key) + @size += 1 unless @entries[index] + @entries[index] = Entry.new(key, value) + self + end + + # Returns a replacement instance after removing the specified key. + # If not found, returns self. + # If empty, returns nil. + def find_and_delete(key) + index = index_for(key) + entry = @entries[index] + if entry && entry.key.eql?(key) + return delete_at(index) + else + child = @children[index] + if child + copy = child.find_and_delete(key) + if !copy.equal?(child) + children = @children.dup + children[index] = copy + copy_size = copy ? copy.size : 0 + new_size = @size - (child.size - copy_size) + return self.class.new(@significant_bits, new_size, @entries, children) + end + end + end + self + end + + # Returns a replacement instance after removing the specified entry. If empty, returns nil + def delete_at(index = @entries.index { |e| e }) + yield(@entries[index]) if block_given? + if size > 1 + entries = @entries.dup + child = @children[index] + if child + children = @children.dup + children[index] = child.delete_at do |entry| + entries[index] = entry + end + else + entries[index] = nil + end + self.class.new(@significant_bits, @size - 1, entries, children || @children) + end + end + + private + + def index_for(key) + (key.hash.abs >> @significant_bits) & 31 + end + + class Entry + + attr_reader :key, :value + + def initialize(key, value) + @key = key + @value = value + end + + end + + end + + EmptyTrie = Trie.new(0) + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/tuple.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/tuple.rb new file mode 100644 index 000000000..c5d6b55dd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/tuple.rb @@ -0,0 +1,45 @@ +require 'forwardable' + +require 'hamster/immutable' + +module Hamster + + class Tuple + + extend Forwardable + + include Immutable + + def initialize(*items) + @items = items.freeze + end + + def first + @items.first + end + + def last + @items.last + end + + def eql?(other) + return true if other.equal?(self) + instance_of?(other.class) && @items.eql?(other.instance_variable_get(:@items)) + end + def_delegator :self, :eql?, :== + + def to_ary + @items + end + + def to_a + @items.dup + end + + def inspect + "(#{@items.inspect[1..-2]})" + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/undefined.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/undefined.rb new file mode 100644 index 000000000..b1336985f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/undefined.rb @@ -0,0 +1,11 @@ +module Hamster + + module Undefined + + def self.erase(value) + value unless value.equal?(self) + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/vector.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/vector.rb new file mode 100644 index 000000000..5d441f182 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/vector.rb @@ -0,0 +1,163 @@ +require 'forwardable' + +require 'hamster/undefined' +require 'hamster/immutable' +require 'hamster/enumerable' + +module Hamster + + def self.vector(*items) + items.reduce(EmptyVector) { |vector, item| vector.add(item) } + end + + class Vector + + extend Forwardable + + include Immutable + + include Enumerable + + BLOCK_SIZE = 32 + INDEX_MASK = BLOCK_SIZE - 1 + BITS_PER_LEVEL = 5 + + def initialize + @levels = 0 + @root = [] + @size = 0 + end + + def empty? + @size == 0 + end + def_delegator :self, :empty?, :null? + + def size + @size + end + def_delegator :self, :size, :length + + def first + get(0) + end + def_delegator :self, :first, :head + + def last + get(-1) + end + + def add(item) + transform do + update_leaf_node(@size, item) + @size += 1 + end + end + def_delegator :self, :add, :<< + def_delegator :self, :add, :cons + + # def delete(index) + # end + + def set(index, item = Undefined) + return set(index, yield(get(index))) if item.equal?(Undefined) + raise IndexError if empty? or index == @size + raise IndexError if index.abs > @size + return set(@size + index, item) if index < 0 + transform do + update_leaf_node(index, item) + end + end + + def get(index) + return nil if empty? or index == @size + return nil if index.abs > @size + return get(@size + index) if index < 0 + leaf_node_for(@root, root_index_bits, index)[index & INDEX_MASK] + end + def_delegator :self, :get, :[] + def_delegator :self, :get, :at + + def each(&block) + return self unless block_given? + traverse_depth_first(&block) + nil + end + + def map(&block) + return self unless block_given? + reduce(EmptyVector) { |vector, item| vector.add(yield(item)) } + end + def_delegator :self, :map, :collect + + def filter + return self unless block_given? + reduce(EmptyVector) { |vector, item| yield(item) ? vector.add(item) : vector } + end + + def clear + EmptyVector + end + + def inspect + to_a.inspect + end + + def eql?(other) + return true if other.equal?(self) + return false unless instance_of?(other.class) && @size == other.size + @root.eql?(other.instance_variable_get(:@root)) + end + def_delegator :self, :eql?, :== + + private + + def traverse_depth_first(node = @root, level = @levels, &block) + return node.each(&block) if level == 0 + node.each { |child| traverse_depth_first(child, level - 1, &block) } + end + + def leaf_node_for(node, child_index_bits, index) + return node if child_index_bits == 0 + child_index = (index >> child_index_bits) & INDEX_MASK + leaf_node_for(node[child_index], child_index_bits - BITS_PER_LEVEL, index) + end + + def update_leaf_node(index, item) + copy_leaf_node_for(new_root, root_index_bits, index)[index & INDEX_MASK] = item + end + + def copy_leaf_node_for(node, child_index_bits, index) + return node if child_index_bits == 0 + child_index = (index >> child_index_bits) & INDEX_MASK + if child_node = node[child_index] + child_node = child_node.dup + else + child_node = [] + end + node[child_index] = child_node + copy_leaf_node_for(child_node, child_index_bits - BITS_PER_LEVEL, index) + end + + def new_root + if full? + @levels += 1 + @root = [@root] + else + @root = @root.dup + end + end + + def full? + (@size >> root_index_bits) > 0 + end + + def root_index_bits + @levels * BITS_PER_LEVEL + end + + end + + EmptyVector = Vector.new + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/version.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/version.rb new file mode 100644 index 000000000..f2fe3c7d6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/lib/hamster/version.rb @@ -0,0 +1,5 @@ +module Hamster + + VERSION = "0.4.3".freeze + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/array_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/array_spec.rb new file mode 100644 index 000000000..99534fc8c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/array_spec.rb @@ -0,0 +1,20 @@ +require 'spec_helper' + +require 'hamster/core_ext/enumerable' + +describe Array do + + describe "#to_list" do + + before do + array = ["A", "B", "C"] + @list = array.to_list + end + + it "returns an equivalent list" do + @list.should == Hamster.list("A", "B", "C") + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/app.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/app.js new file mode 100644 index 000000000..1a6902ba5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/app.js @@ -0,0 +1,66 @@ +$(document).ready(function() { + $('.file_list').dataTable({ + "aaSorting": [[ 1, "asc" ]], + "bPaginate": false, + "bJQueryUI": true, + "aoColumns": [ + null, + { "sType": "percent" }, + null, + null, + null, + null + ] + }); + + $('.source_table tbody tr:odd').addClass('odd'); + $('.source_table tbody tr:even').addClass('even'); + + $("a.src_link").fancybox({ + 'hideOnContentClick': true + }); + + // Hide src files and file list container + $('.source_files').hide(); + $('.file_list_container').hide(); + + // Add tabs based upon existing file_list_containers + $('.file_list_container h2').each(function(){ + $('.group_tabs').append('
  • ' + $(this).html() + '
  • '); + }); + + $('.group_tabs a').each( function() { + $(this).addClass($(this).attr('href').replace('#', '')); + }); + + $('.group_tabs a').live('focus', function() { + $(this).blur(); + }); + + var favicon_path = $('link[rel="shortcut icon"]').attr('href') + $('.group_tabs a').live('click', function(){ + if (!$(this).parent().hasClass('active')) { + $('.group_tabs a').parent().removeClass('active'); + $(this).parent().addClass('active'); + $('.file_list_container').hide(); + $(".file_list_container" + $(this).attr('href')).show(); + window.location.href = window.location.href.split('#')[0] + $(this).attr('href').replace('#', '#_'); + + // Force favicon reload - otherwise the location change containing anchor would drop the favicon... + // Works only on firefox, but still... - Anyone know a better solution to force favicon? + $('link[rel="shortcut icon"]').remove(); + $('head').append(''); + }; + return false; + }); + + if (jQuery.url.attr('anchor')) { + $('.group_tabs a.'+jQuery.url.attr('anchor').replace('_', '')).click(); + } else { + $('.group_tabs a:first').click(); + }; + + $("abbr.timeago").timeago(); + $('#loading').fadeOut(); + $('#wrapper').show(); +}); diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/blank.gif b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/blank.gif new file mode 100644 index 000000000..35d42e808 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/blank.gif differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_close.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_close.png new file mode 100644 index 000000000..07035307a Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_close.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_loading.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_loading.png new file mode 100644 index 000000000..250301796 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_loading.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_nav_left.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_nav_left.png new file mode 100644 index 000000000..ebaa6a4fd Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_nav_left.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_nav_right.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_nav_right.png new file mode 100644 index 000000000..873294e96 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_nav_right.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_e.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_e.png new file mode 100644 index 000000000..2eda08936 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_e.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_n.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_n.png new file mode 100644 index 000000000..69aa10e23 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_n.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_ne.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_ne.png new file mode 100644 index 000000000..79f6980a3 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_ne.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_nw.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_nw.png new file mode 100644 index 000000000..7182cd938 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_nw.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_s.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_s.png new file mode 100644 index 000000000..d8858bfb7 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_s.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_se.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_se.png new file mode 100644 index 000000000..541e3ffd3 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_se.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_sw.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_sw.png new file mode 100644 index 000000000..b451689fa Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_sw.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_w.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_w.png new file mode 100644 index 000000000..8a4e4a887 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_w.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_title_left.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_title_left.png new file mode 100644 index 000000000..6049223d1 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_title_left.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_title_main.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_title_main.png new file mode 100644 index 000000000..8044271f2 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_title_main.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_title_over.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_title_over.png new file mode 100644 index 000000000..d9f458f4b Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_title_over.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_title_right.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_title_right.png new file mode 100644 index 000000000..e36d9db2a Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_title_right.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancybox-x.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancybox-x.png new file mode 100644 index 000000000..c2130f869 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancybox-x.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancybox-y.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancybox-y.png new file mode 100644 index 000000000..7ef399b99 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancybox-y.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancybox.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancybox.png new file mode 100644 index 000000000..65e14f68f Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancybox.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.css b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.css new file mode 100644 index 000000000..28bbb1327 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.css @@ -0,0 +1,363 @@ +/* + * FancyBox - jQuery Plugin + * Simple and fancy lightbox alternative + * + * Examples and documentation at: http://fancybox.net + * + * Copyright (c) 2008 - 2010 Janis Skarnelis + * + * Version: 1.3.1 (05/03/2010) + * Requires: jQuery v1.3+ + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ + +#fancybox-loading { + position: fixed; + top: 50%; + left: 50%; + height: 40px; + width: 40px; + margin-top: -20px; + margin-left: -20px; + cursor: pointer; + overflow: hidden; + z-index: 1104; + display: none; +} + +* html #fancybox-loading { /* IE6 */ + position: absolute; + margin-top: 0; +} + +#fancybox-loading div { + position: absolute; + top: 0; + left: 0; + width: 40px; + height: 480px; + background-image: url('fancybox.png'); +} + +#fancybox-overlay { + position: fixed; + top: 0; + left: 0; + bottom: 0; + right: 0; + background: #000; + z-index: 1100; + display: none; +} + +* html #fancybox-overlay { /* IE6 */ + position: absolute; + width: 100%; +} + +#fancybox-tmp { + padding: 0; + margin: 0; + border: 0; + overflow: auto; + display: none; +} + +#fancybox-wrap { + position: absolute; + top: 0; + left: 0; + margin: 0; + padding: 20px; + z-index: 1101; + display: none; +} + +#fancybox-outer { + position: relative; + width: 100%; + height: 100%; + background: #FFF; +} + +#fancybox-inner { + position: absolute; + top: 0; + left: 0; + width: 1px; + height: 1px; + padding: 0; + margin: 0; + outline: none; + overflow: hidden; +} + +#fancybox-hide-sel-frame { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: transparent; +} + +#fancybox-close { + position: absolute; + top: -15px; + right: -15px; + width: 30px; + height: 30px; + background-image: url('fancybox.png'); + background-position: -40px 0px; + cursor: pointer; + z-index: 1103; + display: none; +} + +#fancybox_error { + color: #444; + font: normal 12px/20px Arial; + padding: 7px; + margin: 0; +} + +#fancybox-content { + height: auto; + width: auto; + padding: 0; + margin: 0; +} + +#fancybox-img { + width: 100%; + height: 100%; + padding: 0; + margin: 0; + border: none; + outline: none; + line-height: 0; + vertical-align: top; + -ms-interpolation-mode: bicubic; +} + +#fancybox-frame { + position: relative; + width: 100%; + height: 100%; + border: none; + display: block; +} + +#fancybox-title { + position: absolute; + bottom: 0; + left: 0; + font-family: Arial; + font-size: 12px; + z-index: 1102; +} + +.fancybox-title-inside { + padding: 10px 0; + text-align: center; + color: #333; +} + +.fancybox-title-outside { + padding-top: 5px; + color: #FFF; + text-align: center; + font-weight: bold; +} + +.fancybox-title-over { + color: #FFF; + text-align: left; +} + +#fancybox-title-over { + padding: 10px; + background-image: url('fancy_title_over.png'); + display: block; +} + +#fancybox-title-wrap { + display: inline-block; +} + +#fancybox-title-wrap span { + height: 32px; + float: left; +} + +#fancybox-title-left { + padding-left: 15px; + background-image: url('fancybox.png'); + background-position: -40px -90px; + background-repeat: no-repeat; +} + +#fancybox-title-main { + font-weight: bold; + line-height: 29px; + background-image: url('fancybox-x.png'); + background-position: 0px -40px; + color: #FFF; +} + +#fancybox-title-right { + padding-left: 15px; + background-image: url('fancybox.png'); + background-position: -55px -90px; + background-repeat: no-repeat; +} + +#fancybox-left, #fancybox-right { + position: absolute; + bottom: 0px; + height: 100%; + width: 35%; + cursor: pointer; + outline: none; + background-image: url('blank.gif'); + z-index: 1102; + display: none; +} + +#fancybox-left { + left: 0px; +} + +#fancybox-right { + right: 0px; +} + +#fancybox-left-ico, #fancybox-right-ico { + position: absolute; + top: 50%; + left: -9999px; + width: 30px; + height: 30px; + margin-top: -15px; + cursor: pointer; + z-index: 1102; + display: block; +} + +#fancybox-left-ico { + background-image: url('fancybox.png'); + background-position: -40px -30px; +} + +#fancybox-right-ico { + background-image: url('fancybox.png'); + background-position: -40px -60px; +} + +#fancybox-left:hover, #fancybox-right:hover { + visibility: visible; /* IE6 */ +} + +#fancybox-left:hover span { + left: 20px; +} + +#fancybox-right:hover span { + left: auto; + right: 20px; +} + +.fancy-bg { + position: absolute; + padding: 0; + margin: 0; + border: 0; + width: 20px; + height: 20px; + z-index: 1001; +} + +#fancy-bg-n { + top: -20px; + left: 0; + width: 100%; + background-image: url('fancybox-x.png'); +} + +#fancy-bg-ne { + top: -20px; + right: -20px; + background-image: url('fancybox.png'); + background-position: -40px -162px; +} + +#fancy-bg-e { + top: 0; + right: -20px; + height: 100%; + background-image: url('fancybox-y.png'); + background-position: -20px 0px; +} + +#fancy-bg-se { + bottom: -20px; + right: -20px; + background-image: url('fancybox.png'); + background-position: -40px -182px; +} + +#fancy-bg-s { + bottom: -20px; + left: 0; + width: 100%; + background-image: url('fancybox-x.png'); + background-position: 0px -20px; +} + +#fancy-bg-sw { + bottom: -20px; + left: -20px; + background-image: url('fancybox.png'); + background-position: -40px -142px; +} + +#fancy-bg-w { + top: 0; + left: -20px; + height: 100%; + background-image: url('fancybox-y.png'); +} + +#fancy-bg-nw { + top: -20px; + left: -20px; + background-image: url('fancybox.png'); + background-position: -40px -122px; +} + +/* IE */ + +#fancybox-loading.fancybox-ie div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_loading.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_close.png', sizingMethod='scale'); } + +.fancybox-ie #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_over.png', sizingMethod='scale'); zoom: 1; } +.fancybox-ie #fancybox-title-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_left.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-title-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_main.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-title-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_right.png', sizingMethod='scale'); } + +.fancybox-ie #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_left.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_right.png', sizingMethod='scale'); } + +.fancybox-ie .fancy-bg { background: transparent !important; } + +.fancybox-ie #fancy-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_n.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_ne.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_e.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_se.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_s.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_sw.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_w.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_nw.png', sizingMethod='scale'); } diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.pack.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.pack.js new file mode 100644 index 000000000..8421d53a6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.pack.js @@ -0,0 +1,44 @@ +/* + * FancyBox - jQuery Plugin + * Simple and fancy lightbox alternative + * + * Examples and documentation at: http://fancybox.net + * + * Copyright (c) 2008 - 2010 Janis Skarnelis + * + * Version: 1.3.1 (05/03/2010) + * Requires: jQuery v1.3+ + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ + +(function(b){var m,u,x,g,D,i,z,A,B,p=0,e={},q=[],n=0,c={},j=[],E=null,s=new Image,G=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,S=/[^\.]\.(swf)\s*$/i,H,I=1,k,l,h=false,y=b.extend(b("
    ")[0],{prop:0}),v=0,O=!b.support.opacity&&!window.XMLHttpRequest,J=function(){u.hide();s.onerror=s.onload=null;E&&E.abort();m.empty()},P=function(){b.fancybox('

    The requested content cannot be loaded.
    Please try again later.

    ',{scrolling:"no",padding:20,transitionIn:"none",transitionOut:"none"})}, +K=function(){return[b(window).width(),b(window).height(),b(document).scrollLeft(),b(document).scrollTop()]},T=function(){var a=K(),d={},f=c.margin,o=c.autoScale,t=(20+f)*2,w=(20+f)*2,r=c.padding*2;if(c.width.toString().indexOf("%")>-1){d.width=a[0]*parseFloat(c.width)/100-40;o=false}else d.width=c.width+r;if(c.height.toString().indexOf("%")>-1){d.height=a[1]*parseFloat(c.height)/100-40;o=false}else d.height=c.height+r;if(o&&(d.width>a[0]-t||d.height>a[1]-w))if(e.type=="image"||e.type=="swf"){t+=r; +w+=r;o=Math.min(Math.min(a[0]-t,c.width)/c.width,Math.min(a[1]-w,c.height)/c.height);d.width=Math.round(o*(d.width-r))+r;d.height=Math.round(o*(d.height-r))+r}else{d.width=Math.min(d.width,a[0]-t);d.height=Math.min(d.height,a[1]-w)}d.top=a[3]+(a[1]-(d.height+40))*0.5;d.left=a[2]+(a[0]-(d.width+40))*0.5;if(c.autoScale===false){d.top=Math.max(a[3]+f,d.top);d.left=Math.max(a[2]+f,d.left)}return d},U=function(a){if(a&&a.length)switch(c.titlePosition){case "inside":return a;case "over":return''+ +a+"";default:return''+a+''}return false},V=function(){var a=c.title,d=l.width-c.padding*2,f="fancybox-title-"+c.titlePosition;b("#fancybox-title").remove();v=0;if(c.titleShow!==false){a=b.isFunction(c.titleFormat)?c.titleFormat(a,j,n,c):U(a);if(!(!a||a==="")){b('
    ').css({width:d,paddingLeft:c.padding, +paddingRight:c.padding}).html(a).appendTo("body");switch(c.titlePosition){case "inside":v=b("#fancybox-title").outerHeight(true)-c.padding;l.height+=v;break;case "over":b("#fancybox-title").css("bottom",c.padding);break;default:b("#fancybox-title").css("bottom",b("#fancybox-title").outerHeight(true)*-1);break}b("#fancybox-title").appendTo(D).hide()}}},W=function(){b(document).unbind("keydown.fb").bind("keydown.fb",function(a){if(a.keyCode==27&&c.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if(a.keyCode== +37){a.preventDefault();b.fancybox.prev()}else if(a.keyCode==39){a.preventDefault();b.fancybox.next()}});if(b.fn.mousewheel){g.unbind("mousewheel.fb");j.length>1&&g.bind("mousewheel.fb",function(a,d){a.preventDefault();h||d===0||(d>0?b.fancybox.prev():b.fancybox.next())})}if(c.showNavArrows){if(c.cyclic&&j.length>1||n!==0)A.show();if(c.cyclic&&j.length>1||n!=j.length-1)B.show()}},X=function(){var a,d;if(j.length-1>n){a=j[n+1].href;if(typeof a!=="undefined"&&a.match(G)){d=new Image;d.src=a}}if(n>0){a= +j[n-1].href;if(typeof a!=="undefined"&&a.match(G)){d=new Image;d.src=a}}},L=function(){i.css("overflow",c.scrolling=="auto"?c.type=="image"||c.type=="iframe"||c.type=="swf"?"hidden":"auto":c.scrolling=="yes"?"auto":"visible");if(!b.support.opacity){i.get(0).style.removeAttribute("filter");g.get(0).style.removeAttribute("filter")}b("#fancybox-title").show();c.hideOnContentClick&&i.one("click",b.fancybox.close);c.hideOnOverlayClick&&x.one("click",b.fancybox.close);c.showCloseButton&&z.show();W();b(window).bind("resize.fb", +b.fancybox.center);c.centerOnScroll?b(window).bind("scroll.fb",b.fancybox.center):b(window).unbind("scroll.fb");b.isFunction(c.onComplete)&&c.onComplete(j,n,c);h=false;X()},M=function(a){var d=Math.round(k.width+(l.width-k.width)*a),f=Math.round(k.height+(l.height-k.height)*a),o=Math.round(k.top+(l.top-k.top)*a),t=Math.round(k.left+(l.left-k.left)*a);g.css({width:d+"px",height:f+"px",top:o+"px",left:t+"px"});d=Math.max(d-c.padding*2,0);f=Math.max(f-(c.padding*2+v*a),0);i.css({width:d+"px",height:f+ +"px"});if(typeof l.opacity!=="undefined")g.css("opacity",a<0.5?0.5:a)},Y=function(a){var d=a.offset();d.top+=parseFloat(a.css("paddingTop"))||0;d.left+=parseFloat(a.css("paddingLeft"))||0;d.top+=parseFloat(a.css("border-top-width"))||0;d.left+=parseFloat(a.css("border-left-width"))||0;d.width=a.width();d.height=a.height();return d},Q=function(){var a=e.orig?b(e.orig):false,d={};if(a&&a.length){a=Y(a);d={width:a.width+c.padding*2,height:a.height+c.padding*2,top:a.top-c.padding-20,left:a.left-c.padding- +20}}else{a=K();d={width:1,height:1,top:a[3]+a[1]*0.5,left:a[2]+a[0]*0.5}}return d},N=function(){u.hide();if(g.is(":visible")&&b.isFunction(c.onCleanup))if(c.onCleanup(j,n,c)===false){b.event.trigger("fancybox-cancel");h=false;return}j=q;n=p;c=e;i.get(0).scrollTop=0;i.get(0).scrollLeft=0;if(c.overlayShow){O&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"}); +x.css({"background-color":c.overlayColor,opacity:c.overlayOpacity}).unbind().show()}l=T();V();if(g.is(":visible")){b(z.add(A).add(B)).hide();var a=g.position(),d;k={top:a.top,left:a.left,width:g.width(),height:g.height()};d=k.width==l.width&&k.height==l.height;i.fadeOut(c.changeFade,function(){var f=function(){i.html(m.contents()).fadeIn(c.changeFade,L)};b.event.trigger("fancybox-change");i.empty().css("overflow","hidden");if(d){i.css({top:c.padding,left:c.padding,width:Math.max(l.width-c.padding* +2,1),height:Math.max(l.height-c.padding*2-v,1)});f()}else{i.css({top:c.padding,left:c.padding,width:Math.max(k.width-c.padding*2,1),height:Math.max(k.height-c.padding*2,1)});y.prop=0;b(y).animate({prop:1},{duration:c.changeSpeed,easing:c.easingChange,step:M,complete:f})}})}else{g.css("opacity",1);if(c.transitionIn=="elastic"){k=Q();i.css({top:c.padding,left:c.padding,width:Math.max(k.width-c.padding*2,1),height:Math.max(k.height-c.padding*2,1)}).html(m.contents());g.css(k).show();if(c.opacity)l.opacity= +0;y.prop=0;b(y).animate({prop:1},{duration:c.speedIn,easing:c.easingIn,step:M,complete:L})}else{i.css({top:c.padding,left:c.padding,width:Math.max(l.width-c.padding*2,1),height:Math.max(l.height-c.padding*2-v,1)}).html(m.contents());g.css(l).fadeIn(c.transitionIn=="none"?0:c.speedIn,L)}}},F=function(){m.width(e.width);m.height(e.height);if(e.width=="auto")e.width=m.width();if(e.height=="auto")e.height=m.height();N()},Z=function(){h=true;e.width=s.width;e.height=s.height;b("").attr({id:"fancybox-img", +src:s.src,alt:e.title}).appendTo(m);N()},C=function(){J();var a=q[p],d,f,o,t,w;e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));o=a.title||b(a).title||e.title||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(o===""&&e.orig)o=e.orig.attr("alt");d=a.nodeName&&/^(?:javascript|#)/i.test(a.href)?e.href||null:e.href||a.href||null;if(e.type){f=e.type;if(!d)d=e.content}else if(e.content)f="html";else if(d)if(d.match(G))f= +"image";else if(d.match(S))f="swf";else if(b(a).hasClass("iframe"))f="iframe";else if(d.match(/#/)){a=d.substr(d.indexOf("#"));f=b(a).length>0?"inline":"ajax"}else f="ajax";else f="inline";e.type=f;e.href=d;e.title=o;if(e.autoDimensions&&e.type!=="iframe"&&e.type!=="swf"){e.width="auto";e.height="auto"}if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=false;e.enableEscapeButton=false;e.showCloseButton=false}if(b.isFunction(e.onStart))if(e.onStart(q,p,e)===false){h=false; +return}m.css("padding",20+e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(i.children())});switch(f){case "html":m.html(e.content);F();break;case "inline":b('
    ').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(i.children())}).bind("fancybox-cancel",function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity(); +s=new Image;s.onerror=function(){P()};s.onload=function(){s.onerror=null;s.onload=null;Z()};s.src=d;break;case "swf":t='';w="";b.each(e.swf,function(r,R){t+='';w+=" "+r+'="'+R+'"'});t+='";m.html(t); +F();break;case "ajax":a=d.split("#",2);f=e.ajax.data||{};if(a.length>1){d=a[0];if(typeof f=="string")f+="&selector="+a[1];else f.selector=a[1]}h=false;b.fancybox.showActivity();E=b.ajax(b.extend(e.ajax,{url:d,data:f,error:P,success:function(r){if(E.status==200){m.html(r);F()}}}));break;case "iframe":b('').appendTo(m);N();break}},$=function(){if(u.is(":visible")){b("div", +u).css("top",I*-40+"px");I=(I+1)%12}else clearInterval(H)},aa=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('
    '),u=b('
    '),x=b('
    '),g=b('
    '));if(!b.support.opacity){g.addClass("fancybox-ie");u.addClass("fancybox-ie")}D=b('
    ').append('
    ').appendTo(g); +D.append(i=b('
    '),z=b(''),A=b(''),B=b(''));z.click(b.fancybox.close);u.click(b.fancybox.cancel);A.click(function(a){a.preventDefault();b.fancybox.prev()});B.click(function(a){a.preventDefault();b.fancybox.next()});if(O){x.get(0).style.setExpression("height", +"document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'");u.get(0).style.setExpression("top","(-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'");D.prepend('')}}}; +b.fn.fancybox=function(a){b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(d){d.preventDefault();if(!h){h=true;b(this).blur();q=[];p=0;d=b(this).attr("rel")||"";if(!d||d==""||d==="nofollow")q.push(this);else{q=b("a[rel="+d+"], area[rel="+d+"]");p=q.index(this)}C();return false}});return this};b.fancybox=function(a,d){if(!h){h=true;d=typeof d!=="undefined"?d:{};q=[];p=d.index||0;if(b.isArray(a)){for(var f=0,o=a.length;fq.length||p<0)p=0;C()}};b.fancybox.showActivity=function(){clearInterval(H);u.show();H=setInterval($,66)};b.fancybox.hideActivity=function(){u.hide()};b.fancybox.next=function(){return b.fancybox.pos(n+1)};b.fancybox.prev=function(){return b.fancybox.pos(n- +1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a,10);if(a>-1&&j.length>a){p=a;C()}if(c.cyclic&&j.length>1&&a<0){p=j.length-1;C()}if(c.cyclic&&j.length>1&&a>=j.length){p=0;C()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");J();e&&b.isFunction(e.onCancel)&&e.onCancel(q,p,e);h=false}};b.fancybox.close=function(){function a(){x.fadeOut("fast");g.hide();b.event.trigger("fancybox-cleanup");i.empty();b.isFunction(c.onClosed)&&c.onClosed(j,n,c);j=e=[];n=p=0;c=e={};h=false} +if(!(h||g.is(":hidden"))){h=true;if(c&&b.isFunction(c.onCleanup))if(c.onCleanup(j,n,c)===false){h=false;return}J();b(z.add(A).add(B)).hide();b("#fancybox-title").remove();g.add(i).add(x).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");i.css("overflow","hidden");if(c.transitionOut=="elastic"){k=Q();var d=g.position();l={top:d.top,left:d.left,width:g.width(),height:g.height()};if(c.opacity)l.opacity=1;y.prop=1;b(y).animate({prop:0},{duration:c.speedOut,easing:c.easingOut, +step:M,complete:a})}else g.fadeOut(c.transitionOut=="none"?0:c.speedOut,a)}};b.fancybox.resize=function(){var a,d;if(!(h||g.is(":hidden"))){h=true;a=i.wrapInner("
    ").children();d=a.height();g.css({height:d+c.padding*2+v});i.css({height:d});a.replaceWith(a.children());b.fancybox.center()}};b.fancybox.center=function(){h=true;var a=K(),d=c.margin,f={};f.top=a[3]+(a[1]-(g.height()-v+40))*0.5;f.left=a[2]+(a[0]-(g.width()+40))*0.5;f.top=Math.max(a[3]+d,f.top);f.left=Math.max(a[2]+ +d,f.left);g.css(f);h=false};b.fn.fancybox.defaults={padding:10,margin:20,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.3,overlayColor:"#666",titleShow:true,titlePosition:"outside",titleFormat:null,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast", +easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,onStart:null,onCancel:null,onComplete:null,onCleanup:null,onClosed:null};b(document).ready(function(){aa()})})(jQuery); \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/favicon.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/favicon.png new file mode 100644 index 000000000..6bd0e1338 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/favicon.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/jquery-1.4.2.min.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/jquery-1.4.2.min.js new file mode 100644 index 000000000..b170a78f8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/jquery-1.4.2.min.js @@ -0,0 +1,155 @@ +/*! + * jQuery JavaScript Library v1.4.2 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Sat Feb 13 22:33:48 2010 -0500 + */ +(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, +Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& +(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, +a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== +"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, +function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
    a"; +var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, +parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= +false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= +s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, +applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; +else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, +a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== +w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, +cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= +c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); +a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, +function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); +k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), +C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= +e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& +f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; +if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", +e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, +"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, +d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, +e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); +t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| +g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, +CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, +g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, +text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, +setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= +h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== +"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, +h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& +q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; +if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

    ";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); +(function(){var g=s.createElement("div");g.innerHTML="
    ";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: +function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= +{},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== +"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", +d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? +a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== +1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
    ","
    "];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, +""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); +return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", +""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= +c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? +c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= +function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= +Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, +"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= +a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= +a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== +"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
    ").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, +serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), +function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, +global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& +e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? +"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== +false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= +false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", +c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| +d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); +g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== +1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== +"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; +if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== +"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| +c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; +this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= +this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, +e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
    "; +a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); +c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, +d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- +f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": +"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in +e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/jquery.dataTables.min.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/jquery.dataTables.min.js new file mode 100644 index 000000000..b5ee8585d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/jquery.dataTables.min.js @@ -0,0 +1,152 @@ +/* + * File: jquery.dataTables.min.js + * Version: 1.7.0 + * Author: Allan Jardine (www.sprymedia.co.uk) + * Info: www.datatables.net + * + * Copyright 2008-2010 Allan Jardine, all rights reserved. + * + * This source file is free software, under either the GPL v2 license or a + * BSD style license, as supplied with this software. + * + * This source file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. + */ +(function(j,Y,p){j.fn.dataTableSettings=[];var E=j.fn.dataTableSettings;j.fn.dataTableExt={};var m=j.fn.dataTableExt;m.sVersion="1.7.0";m.sErrMode="alert";m.iApiIndex=0;m.oApi={};m.afnFiltering=[];m.aoFeatures=[];m.ofnSearch={};m.afnSortData=[];m.oStdClasses={sPagePrevEnabled:"paginate_enabled_previous",sPagePrevDisabled:"paginate_disabled_previous",sPageNextEnabled:"paginate_enabled_next",sPageNextDisabled:"paginate_disabled_next",sPageJUINext:"",sPageJUIPrev:"",sPageButton:"paginate_button",sPageButtonActive:"paginate_active", +sPageButtonStaticDisabled:"paginate_button",sPageFirst:"first",sPagePrevious:"previous",sPageNext:"next",sPageLast:"last",sStripOdd:"odd",sStripEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled", +sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:""};m.oJUIClasses={sPagePrevEnabled:"fg-button ui-state-default ui-corner-left",sPagePrevDisabled:"fg-button ui-state-default ui-corner-left ui-state-disabled", +sPageNextEnabled:"fg-button ui-state-default ui-corner-right",sPageNextDisabled:"fg-button ui-state-default ui-corner-right ui-state-disabled",sPageJUINext:"ui-icon ui-icon-circle-arrow-e",sPageJUIPrev:"ui-icon ui-icon-circle-arrow-w",sPageButton:"fg-button ui-state-default",sPageButtonActive:"fg-button ui-state-default ui-state-disabled",sPageButtonStaticDisabled:"fg-button ui-state-default ui-state-disabled",sPageFirst:"first ui-corner-tl ui-corner-bl",sPagePrevious:"previous",sPageNext:"next", +sPageLast:"last ui-corner-tr ui-corner-br",sStripOdd:"odd",sStripEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate fg-buttonset fg-buttonset-multi paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"ui-state-default",sSortDesc:"ui-state-default",sSortable:"ui-state-default",sSortableAsc:"ui-state-default",sSortableDesc:"ui-state-default",sSortableNone:"ui-state-default", +sSortColumn:"sorting_",sSortJUIAsc:"css_right ui-icon ui-icon-triangle-1-n",sSortJUIDesc:"css_right ui-icon ui-icon-triangle-1-s",sSortJUI:"css_right ui-icon ui-icon-carat-2-n-s",sSortJUIAscAllowed:"css_right ui-icon ui-icon-carat-1-n",sSortJUIDescAllowed:"css_right ui-icon ui-icon-carat-1-s",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead ui-state-default",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot ui-state-default", +sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:"ui-state-default"};m.oPagination={two_button:{fnInit:function(g,l,q){var r,u,y;if(g.bJUI){r=p.createElement("a");u=p.createElement("a");y=p.createElement("span");y.className=g.oClasses.sPageJUINext;u.appendChild(y);y=p.createElement("span");y.className=g.oClasses.sPageJUIPrev;r.appendChild(y)}else{r=p.createElement("div");u=p.createElement("div")}r.className=g.oClasses.sPagePrevDisabled;u.className=g.oClasses.sPageNextDisabled;r.title=g.oLanguage.oPaginate.sPrevious; +u.title=g.oLanguage.oPaginate.sNext;l.appendChild(r);l.appendChild(u);j(r).click(function(){g.oApi._fnPageChange(g,"previous")&&q(g)});j(u).click(function(){g.oApi._fnPageChange(g,"next")&&q(g)});j(r).bind("selectstart",function(){return false});j(u).bind("selectstart",function(){return false});if(g.sTableId!==""&&typeof g.aanFeatures.p=="undefined"){l.setAttribute("id",g.sTableId+"_paginate");r.setAttribute("id",g.sTableId+"_previous");u.setAttribute("id",g.sTableId+"_next")}},fnUpdate:function(g){if(g.aanFeatures.p)for(var l= +g.aanFeatures.p,q=0,r=l.length;q=u-r){r=u-q+1;w=u}else{r=y-Math.ceil(q/2)+1;w=r+q-1}for(q=r;q<=w;q++)C+=y!=q?''+q+"":''+q+"";w=g.aanFeatures.p;var z,D=function(){g._iDisplayStart= +(this.innerHTML*1-1)*g._iDisplayLength;l(g);return false},L=function(){return false};q=0;for(r=w.length;ql?1:0},"string-desc":function(g,l){g=g.toLowerCase();l=l.toLowerCase();return gl?-1:0},"html-asc":function(g,l){g=g.replace(/<.*?>/g,"").toLowerCase(); +l=l.replace(/<.*?>/g,"").toLowerCase();return gl?1:0},"html-desc":function(g,l){g=g.replace(/<.*?>/g,"").toLowerCase();l=l.replace(/<.*?>/g,"").toLowerCase();return gl?-1:0},"date-asc":function(g,l){g=Date.parse(g);l=Date.parse(l);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(l)||l==="")l=Date.parse("01/01/1970 00:00:00");return g-l},"date-desc":function(g,l){g=Date.parse(g);l=Date.parse(l);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(l)||l=== +"")l=Date.parse("01/01/1970 00:00:00");return l-g},"numeric-asc":function(g,l){return(g=="-"||g===""?0:g*1)-(l=="-"||l===""?0:l*1)},"numeric-desc":function(g,l){return(l=="-"||l===""?0:l*1)-(g=="-"||g===""?0:g*1)}};m.aTypes=[function(g){if(g.length===0)return"numeric";var l,q=false;l=g.charAt(0);if("0123456789-".indexOf(l)==-1)return null;for(var r=1;r")!=-1)return"html";return null}];m.fnVersionCheck=function(g){var l=function(w,x){for(;w.length=parseInt(u,10)};m._oExternConfig={iNextUnique:0};j.fn.dataTable=function(g){function l(){this.fnRecordsTotal=function(){return this.oFeatures.bServerSide? +this._iRecordsTotal:this.aiDisplayMaster.length};this.fnRecordsDisplay=function(){return this.oFeatures.bServerSide?this._iRecordsDisplay:this.aiDisplay.length};this.fnDisplayEnd=function(){return this.oFeatures.bServerSide?this.oFeatures.bPaginate===false?this._iDisplayStart+this.aiDisplay.length:Math.min(this._iDisplayStart+this._iDisplayLength,this._iDisplayStart+this.aiDisplay.length):this._iDisplayEnd};this.sInstance=this.oInstance=null;this.oFeatures={bPaginate:true,bLengthChange:true,bFilter:true, +bSort:true,bInfo:true,bAutoWidth:true,bProcessing:false,bSortClasses:true,bStateSave:false,bServerSide:false};this.oScroll={sX:"",sXInner:"",sY:"",bCollapse:false,iBarWidth:0};this.aanFeatures=[];this.oLanguage={sProcessing:"Processing...",sLengthMenu:"Show _MENU_ entries",sZeroRecords:"No matching records found",sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)", +sInfoPostFix:"",sSearch:"Search:",sUrl:"",oPaginate:{sFirst:"First",sPrevious:"Previous",sNext:"Next",sLast:"Last"}};this.aoData=[];this.aiDisplay=[];this.aiDisplayMaster=[];this.aoColumns=[];this.iNextId=0;this.asDataSearch=[];this.oPreviousSearch={sSearch:"",bRegex:false,bSmart:true};this.aoPreSearchCols=[];this.aaSorting=[[0,"asc",0]];this.aaSortingFixed=null;this.asStripClasses=[];this.asDestoryStrips=[];this.fnFooterCallback=this.fnHeaderCallback=this.fnRowCallback=null;this.aoDrawCallback=[]; +this.fnInitComplete=null;this.sTableId="";this.nTableWrapper=this.nTBody=this.nTFoot=this.nTHead=this.nTable=null;this.iDefaultSortIndex=0;this.bInitialised=false;this.aoOpenRows=[];this.sDom="lfrtip";this.sPaginationType="two_button";this.iCookieDuration=7200;this.sCookiePrefix="SpryMedia_DataTables_";this.sAjaxSource=null;this.bAjaxDataGet=true;this.fnServerData=function(a,b,c){j.ajax({url:a,data:b,success:c,dataType:"json",cache:false,error:function(){alert("DataTables warning: JSON data from server failed to load or be parsed. This is most likely to be caused by a JSON formatting error.")}})}; +this.fnFormatNumber=function(a){if(a<1E3)return a;else{var b=a+"";a=b.split("");var c="";b=b.length;for(var d=0;d=a.fnRecordsDisplay()?0:a.iInitDisplayStart;a.iInitDisplayStart=-1;F(a)}if(!(a.oFeatures.bServerSide&&!oa(a))){if(a.aiDisplay.length!==0){var i=a._iDisplayStart,h=a._iDisplayEnd;if(a.oFeatures.bServerSide){i=0;h=a.aoData.length}for(i=i;itr",a.nTHead)[0],V(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);typeof a.fnFooterCallback=="function"&&a.fnFooterCallback.call(a.oInstance,j(">tr",a.nTFoot)[0],V(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);f= +p.createDocumentFragment();b=p.createDocumentFragment();if(a.nTBody){e=a.nTBody.parentNode;b.appendChild(a.nTBody);c=a.nTBody.childNodes;for(b=c.length-1;b>=0;b--)c[b].parentNode.removeChild(c[b]);b=0;for(c=d.length;bj(a.nTable.parentNode).width()&&U(a)}b=0;for(c=a.aoDrawCallback.length;b< +c;b++)a.aoDrawCallback[b].fn.call(a.oInstance,a);a.bSorted=false;a.bFiltered=false}}function L(a){if(a.oFeatures.bSort)O(a,a.oPreviousSearch);else if(a.oFeatures.bFilter)P(a,a.oPreviousSearch);else{F(a);D(a)}}function oa(a){if(a.bAjaxDataGet){K(a,true);var b=a.aoColumns.length,c=[],d;a.iDraw++;c.push({name:"sEcho",value:a.iDraw});c.push({name:"iColumns",value:b});c.push({name:"sColumns",value:aa(a)});c.push({name:"iDisplayStart",value:a._iDisplayStart});c.push({name:"iDisplayLength",value:a.oFeatures.bPaginate!== +false?a._iDisplayLength:-1});if(a.oFeatures.bFilter!==false){c.push({name:"sSearch",value:a.oPreviousSearch.sSearch});c.push({name:"bRegex",value:a.oPreviousSearch.bRegex});for(d=0;d")c=c.parentNode;else if(i=="l"&&a.oFeatures.bPaginate&&a.oFeatures.bLengthChange){f=ra(a);e=1}else if(i=="f"&&a.oFeatures.bFilter){f=sa(a);e=1}else if(i=="r"&&a.oFeatures.bProcessing){f=ta(a);e=1}else if(i=="t"){f=ua(a);e=1}else if(i=="i"&&a.oFeatures.bInfo){f=va(a);e=1}else if(i=="p"&&a.oFeatures.bPaginate){f=wa(a);e=1}else if(m.aoFeatures.length!==0){h=m.aoFeatures;k=0;for(o=h.length;kcaption",a.nTable);i=0;for(k=d.length;i0&&a.nTable.removeChild(i[0]);if(a.nTFoot!==null){k=a.nTable.getElementsByTagName("tfoot");k.length>0&&a.nTable.removeChild(k[0])}i= +a.nTHead.cloneNode(true);a.nTable.insertBefore(i,a.nTable.childNodes[0]);if(a.nTFoot!==null){k=a.nTFoot.cloneNode(true);a.nTable.insertBefore(k,a.nTable.childNodes[1])}var I=ca(i);f=0;for(e=I.length;ff-a.oScroll.iBarWidth)a.nTable.style.width=v(f)}else a.nTable.style.width=v(f);f=j(a.nTable).outerWidth();e=a.nTHead.getElementsByTagName("tr");i=i.getElementsByTagName("tr");M(function(A,G){o=A.style;o.paddingTop="0";o.paddingBottom="0";o.borderTopWidth="0";o.borderBottomWidth= +"0";o.height=0;s=j(A).width();G.style.width=v(s);H.push(s)},i,e);if(a.nTFoot!==null){h=k.getElementsByTagName("tr");k=a.nTFoot.getElementsByTagName("tr");M(function(A,G){o=A.style;o.paddingTop="0";o.paddingBottom="0";o.borderTopWidth="0";o.borderBottomWidth="0";s=j(A).width();G.style.width=v(s);H.push(s)},h,k)}M(function(A){A.innerHTML="";A.style.width=v(H.shift())},i);a.nTFoot!==null&&M(function(A){A.innerHTML="";A.style.width=v(H.shift())},h);if(j(a.nTable).outerWidth()d.offsetWidth?a.oScroll.iBarWidth:0;if(a.nTable.offsetHeight'; +var c=j("input",b);c.val(a.oPreviousSearch.sSearch.replace('"',"""));c.keyup(function(){for(var d=a.aanFeatures.f,f=0,e=d.length;f=0;d--){f=ga(a.aoData[a.aiDisplay[d]]._aData[c],a.aoColumns[c].sType);if(!b.test(f)){a.aiDisplay.splice(d, +1);e++}}}}function ya(a,b,c,d,f){var e=fa(b,d,f);if(typeof c=="undefined"||c===null)c=0;if(m.afnFiltering.length!==0)c=1;if(b.length<=0){a.aiDisplay.splice(0,a.aiDisplay.length);a.aiDisplay=a.aiDisplayMaster.slice()}else if(a.aiDisplay.length==a.aiDisplayMaster.length||a.oPreviousSearch.sSearch.length>b.length||c==1||b.indexOf(a.oPreviousSearch.sSearch)!==0){a.aiDisplay.splice(0,a.aiDisplay.length);Q(a,1);for(c=0;c/g,"");else if(typeof a=="string")return a.replace(/\n/g, +" ");return a}function O(a,b){var c=[],d=m.oSort,f=a.aoData,e,i,h,k;if(!a.oFeatures.bServerSide&&(a.aaSorting.length!==0||a.aaSortingFixed!==null)){c=a.aaSortingFixed!==null?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();for(h=0;h0){e=a.aoColumns[c[c.length-1][0]].iDataSort;i=a.aoColumns[e].sType;k+="iTest = oSort['"+i+"-"+c[c.length-1][1]+"']( aoData[a]._aData["+e+"], aoData[b]._aData["+e+"] );if (iTest===0) return oSort['numeric-"+c[c.length-1][1]+"'](a, b); return iTest;}";eval(k);a.aiDisplayMaster.sort(this.ClosureDataTables.fn)}this.ClosureDataTables=undefined}}if(typeof b=="undefined"||b)W(a);a.bSorted=true;if(a.oFeatures.bFilter)P(a, +a.oPreviousSearch,1);else{a.aiDisplay=a.aiDisplayMaster.slice();a._iDisplayStart=0;F(a);D(a)}}function $(a,b,c,d){j(b).click(function(f){if(a.aoColumns[c].bSortable!==false){var e=function(){var i,h;if(f.shiftKey){for(var k=false,o=0;o=i)for(b=0;b=0?a._iDisplayStart-a._iDisplayLength:0;if(a._iDisplayStart<0)a._iDisplayStart=0}else if(b=="next")if(a._iDisplayLength>=0){if(a._iDisplayStart+a._iDisplayLength=0){b=parseInt((a.fnRecordsDisplay()-1)/a._iDisplayLength,10)+1;a._iDisplayStart=(b-1)*a._iDisplayLength}else a._iDisplayStart=0;else J(a,0,"Unknown paging action: "+b);return c!=a._iDisplayStart}function va(a){var b=p.createElement("div");b.className=a.oClasses.sInfo;if(typeof a.aanFeatures.i=="undefined"){a.aoDrawCallback.push({fn:Ca,sName:"information"});a.sTableId!==""&&b.setAttribute("id",a.sTableId+"_info")}return b} +function Ca(a){if(!(!a.oFeatures.bInfo||a.aanFeatures.i.length===0)){var b=j(a.aanFeatures.i[0]),c=a.fnFormatNumber(a.fnRecordsTotal()),d=a.fnFormatNumber(a._iDisplayStart+1),f=a.fnFormatNumber(a.fnDisplayEnd()),e=a.fnFormatNumber(a.fnRecordsDisplay());if(a.fnRecordsDisplay()===0&&a.fnRecordsDisplay()==a.fnRecordsTotal())b.html(a.oLanguage.sInfoEmpty+a.oLanguage.sInfoPostFix);else if(a.fnRecordsDisplay()===0)b.html(a.oLanguage.sInfoEmpty+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",c)+a.oLanguage.sInfoPostFix); +else a.fnRecordsDisplay()==a.fnRecordsTotal()?b.html(a.oLanguage.sInfo.replace("_START_",d).replace("_END_",f).replace("_TOTAL_",e)+a.oLanguage.sInfoPostFix):b.html(a.oLanguage.sInfo.replace("_START_",d).replace("_END_",f).replace("_TOTAL_",e)+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()))+a.oLanguage.sInfoPostFix);a=a.aanFeatures.i;if(a.length>1){b=b.html();c=1;for(d=a.length;c",c,d;if(a.aLengthMenu.length==2&&typeof a.aLengthMenu[0]=="object"&&typeof a.aLengthMenu[1]=="object"){c=0;for(d=a.aLengthMenu[0].length;c'+a.aLengthMenu[1][c]+""}else{c=0;for(d=a.aLengthMenu.length;c'+a.aLengthMenu[c]+""}b+="";var f=p.createElement("div");a.sTableId!==""&&typeof a.aanFeatures.l=="undefined"&&f.setAttribute("id",a.sTableId+ +"_length");f.className=a.oClasses.sLength;f.innerHTML=a.oLanguage.sLengthMenu.replace("_MENU_",b);j('select option[value="'+a._iDisplayLength+'"]',f).attr("selected",true);j("select",f).change(function(){var e=j(this).val(),i=a.aanFeatures.l;c=0;for(d=i.length;ca.aiDisplay.length||a._iDisplayLength==-1?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength}function Da(a,b){if(!a||a===null||a==="")return 0;if(typeof b=="undefined")b=p.getElementsByTagName("body")[0];var c=p.createElement("div");c.style.width=a;b.appendChild(c);a=c.offsetWidth;b.removeChild(c);return a}function ea(a){var b=0,c,d=0,f=a.aoColumns.length,e,i=j("th",a.nTHead);for(e= +0;etd",b);e.each(function(h){this.style.width="";h=da(a,h);if(h!==null&&a.aoColumns[h].sWidthOrig!=="")this.style.width=a.aoColumns[h].sWidthOrig});for(e=0;etd",b);if(f.length===0)f=j("thead tr:eq(0)>th",b);for(e=c=0;e0)a.aoColumns[e].sWidth=v(d);c++}a.nTable.style.width=v(j(b).outerWidth());b.parentNode.removeChild(b)}}function ia(a,b){if(a.oScroll.sX===""&&a.oScroll.sY!== +""){j(b).width();b.style.width=v(j(b).outerWidth()-a.oScroll.iBarWidth)}else if(a.oScroll.sX!=="")b.style.width=v(j(b).outerWidth())}function Ea(a,b,c){if(typeof c=="undefined"||c){c=Fa(a,b);b=N(a,b);if(c<0)return null;return a.aoData[c].nTr.getElementsByTagName("td")[b]}var d=-1,f,e;c=-1;var i=p.createElement("div");i.style.visibility="hidden";i.style.position="absolute";p.body.appendChild(i);f=0;for(e=a.aoData.length;fd){d=i.offsetWidth; +c=f}}p.body.removeChild(i);if(c>=0){b=N(a,b);if(a=a.aoData[c].nTr.getElementsByTagName("td")[b])return a}return null}function Fa(a,b){for(var c=0,d=-1,f=0;fc){c=e.length;d=f}}return d}function v(a){if(a===null)return"0px";if(typeof a=="number")return a+"px";if(a.indexOf("em")!=-1||a.indexOf("%")!=-1||a.indexOf("ex")!=-1||a.indexOf("px")!=-1)return a;return a+"px"}function La(a,b){if(a.length!=b.length)return 1;for(var c=0;cb&&a[d]--;c!=-1&&a.splice(c,1)}function qa(a,b){b=b.split(",");for(var c=[],d=0,f=a.aoColumns.length;d< +f;d++)for(var e=0;e4096){e=p.cookie.split(";");for(var h=0,k=e.length;h=d.aiDisplay.length){d._iDisplayStart-=d._iDisplayLength;if(d._iDisplayStart<0)d._iDisplayStart=0}if(typeof c=="undefined"||c){F(d);D(d)}return f};this.fnClearTable=function(a){var b=B(this[m.iApiIndex]);ba(b);if(typeof a=="undefined"||a)D(b)};this.fnOpen=function(a,b,c){var d=B(this[m.iApiIndex]);this.fnClose(a);var f=p.createElement("tr"),e=p.createElement("td");f.appendChild(e);e.className=c;e.colSpan=T(d);e.innerHTML=b;b=j("tr",d.nTBody);j.inArray(a,b)!=-1&&j(f).insertAfter(a); +d.aoOpenRows.push({nTr:f,nParent:a});return f};this.fnClose=function(a){for(var b=B(this[m.iApiIndex]),c=0;ctr",c.nTHead)[0];var h=j(">tr",c.nTFoot)[0],k=[],o=[];for(d=0;d< +f;d++){k.push(c.aoColumns[d].nTh);o.push(c.aoColumns[d].nTf)}if(b){for(d=b=0;d=T(c)){e.appendChild(k[a]);h&&h.appendChild(o[a]);d=0;for(f=c.aoData.length;dtd:eq("+i+")",c.aoData[d].nTr)[0])}}c.aoColumns[a].bVisible=true}else{e.removeChild(k[a]);h&&h.removeChild(o[a]);i=X(c);d=0;for(f=c.aoData.length;dtr:even",c).addClass(a.asDestoryStrips[0]);j(">tr:odd",c).addClass(a.asDestoryStrips[1]);b=0;for(d=E.length;bt<"F"ip>'}if(e.oScroll.sX!== +""||e.oScroll.sY!=="")e.oScroll.iBarWidth=Ja();if(typeof g.iDisplayStart!="undefined"&&typeof e.iInitDisplayStart=="undefined"){e.iInitDisplayStart=g.iDisplayStart;e._iDisplayStart=g.iDisplayStart}if(typeof g.bStateSave!="undefined"){e.oFeatures.bStateSave=g.bStateSave;Ia(e,g);e.aoDrawCallback.push({fn:Ga,sName:"state_save"})}if(typeof g.aaData!="undefined")h=true;if(typeof g!="undefined"&&typeof g.aoData!="undefined")g.aoColumns=g.aoData;if(typeof g.oLanguage!="undefined")if(typeof g.oLanguage.sUrl!= +"undefined"&&g.oLanguage.sUrl!==""){e.oLanguage.sUrl=g.oLanguage.sUrl;j.getJSON(e.oLanguage.sUrl,null,function(o){u(e,o,true)});i=true}else u(e,g.oLanguage,false)}else g={};if(typeof g.asStripClasses=="undefined"){e.asStripClasses.push(e.oClasses.sStripOdd);e.asStripClasses.push(e.oClasses.sStripEven)}c=false;d=j("tbody>tr",this);a=0;for(b=e.asStripClasses.length;a=0;a--){k=g.aoColumnDefs[a].aTargets;c=0;for(d=k.length;c=0){for(;e.aoColumns.length<=k[c];)y(e);C(e,k[c],g.aoColumnDefs[a])}else if(typeof k[c]=="number"&&k[c]<0)C(e,e.aoColumns.length+k[c],g.aoColumnDefs[a]);else if(typeof k[c]=="string"){b= +0;for(f=e.aoColumns.length;b0)e.nTFoot=this.getElementsByTagName("tfoot")[0];if(h)for(a=0;a y) ? 1 : 0)); +}; + +jQuery.fn.dataTableExt.oSort['percent-desc'] = function(a,b) { + var x = (a == "-") ? 0 : a.replace( /%/, "" ); + var y = (b == "-") ? 0 : b.replace( /%/, "" ); + x = parseFloat( x ); + y = parseFloat( y ); + return ((x < y) ? 1 : ((x > y) ? -1 : 0)); +}; \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/jquery.timeago.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/jquery.timeago.js new file mode 100644 index 000000000..0ada770a9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/jquery.timeago.js @@ -0,0 +1,141 @@ +/* + * timeago: a jQuery plugin, version: 0.9 (2010-06-21) + * @requires jQuery v1.2.3 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008-2010, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.datetime(timestamp)); + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "ago", + suffixFromNow: "from now", + seconds: "less than a minute", + minute: "about a minute", + minutes: "%d minutes", + hour: "about an hour", + hours: "about %d hours", + day: "a day", + days: "%d days", + month: "about a month", + months: "%d months", + year: "about a year", + years: "%d years", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + distanceMillis = Math.abs(distanceMillis); + } + + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 48 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.floor(days)) || + days < 60 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.floor(days / 30)) || + years < 2 && substitute($l.year, 1) || + substitute($l.years, Math.floor(years)); + + return $.trim([prefix, words, suffix].join(" ")); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d\d\d/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + var isTime = $(elem).get(0).tagName.toLowerCase() == "time"; // $(elem).is("time"); + var iso8601 = isTime ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0) element.attr("title", text); + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +})(jQuery); diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/jquery.url.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/jquery.url.js new file mode 100644 index 000000000..d1715ebcd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/jquery.url.js @@ -0,0 +1,174 @@ +// JQuery URL Parser +// Written by Mark Perkins, mark@allmarkedup.com +// License: http://unlicense.org/ (i.e. do what you want with it!) + +jQuery.url = function() +{ + var segments = {}; + + var parsed = {}; + + /** + * Options object. Only the URI and strictMode values can be changed via the setters below. + */ + var options = { + + url : window.location, // default URI is the page in which the script is running + + strictMode: false, // 'loose' parsing by default + + key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], // keys available to query + + q: { + name: "queryKey", + parser: /(?:^|&)([^&=]*)=?([^&]*)/g + }, + + parser: { + strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, //less intuitive, more accurate to the specs + loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // more intuitive, fails on relative paths and deviates from specs + } + + }; + + /** + * Deals with the parsing of the URI according to the regex above. + * Written by Steven Levithan - see credits at top. + */ + var parseUri = function() + { + str = decodeURI( options.url ); + + var m = options.parser[ options.strictMode ? "strict" : "loose" ].exec( str ); + var uri = {}; + var i = 14; + + while ( i-- ) { + uri[ options.key[i] ] = m[i] || ""; + } + + uri[ options.q.name ] = {}; + uri[ options.key[12] ].replace( options.q.parser, function ( $0, $1, $2 ) { + if ($1) { + uri[options.q.name][$1] = $2; + } + }); + + return uri; + }; + + /** + * Returns the value of the passed in key from the parsed URI. + * + * @param string key The key whose value is required + */ + var key = function( key ) + { + if ( ! parsed.length ) + { + setUp(); // if the URI has not been parsed yet then do this first... + } + if ( key == "base" ) + { + if ( parsed.port !== null && parsed.port !== "" ) + { + return parsed.protocol+"://"+parsed.host+":"+parsed.port+"/"; + } + else + { + return parsed.protocol+"://"+parsed.host+"/"; + } + } + + return ( parsed[key] === "" ) ? null : parsed[key]; + }; + + /** + * Returns the value of the required query string parameter. + * + * @param string item The parameter whose value is required + */ + var param = function( item ) + { + if ( ! parsed.length ) + { + setUp(); // if the URI has not been parsed yet then do this first... + } + return ( parsed.queryKey[item] === null ) ? null : parsed.queryKey[item]; + }; + + /** + * 'Constructor' (not really!) function. + * Called whenever the URI changes to kick off re-parsing of the URI and splitting it up into segments. + */ + var setUp = function() + { + parsed = parseUri(); + + getSegments(); + }; + + /** + * Splits up the body of the URI into segments (i.e. sections delimited by '/') + */ + var getSegments = function() + { + var p = parsed.path; + segments = []; // clear out segments array + segments = parsed.path.length == 1 ? {} : ( p.charAt( p.length - 1 ) == "/" ? p.substring( 1, p.length - 1 ) : path = p.substring( 1 ) ).split("/"); + }; + + return { + + /** + * Sets the parsing mode - either strict or loose. Set to loose by default. + * + * @param string mode The mode to set the parser to. Anything apart from a value of 'strict' will set it to loose! + */ + setMode : function( mode ) + { + strictMode = mode == "strict" ? true : false; + return this; + }, + + /** + * Sets URI to parse if you don't want to to parse the current page's URI. + * Calling the function with no value for newUri resets it to the current page's URI. + * + * @param string newUri The URI to parse. + */ + setUrl : function( newUri ) + { + options.url = newUri === undefined ? window.location : newUri; + setUp(); + return this; + }, + + /** + * Returns the value of the specified URI segment. Segments are numbered from 1 to the number of segments. + * For example the URI http://test.com/about/company/ segment(1) would return 'about'. + * + * If no integer is passed into the function it returns the number of segments in the URI. + * + * @param int pos The position of the segment to return. Can be empty. + */ + segment : function( pos ) + { + if ( ! parsed.length ) + { + setUp(); // if the URI has not been parsed yet then do this first... + } + if ( pos === undefined ) + { + return segments.length; + } + return ( segments[pos] === "" || segments[pos] === undefined ) ? null : segments[pos]; + }, + + attr : key, // provides public access to private 'key' function - see above + + param : param // provides public access to private 'param' function - see above + + }; + +}(); \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/loading.gif b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/loading.gif new file mode 100644 index 000000000..3596a61f3 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/loading.gif differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/magnify.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/magnify.png new file mode 100644 index 000000000..6073b9530 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/magnify.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png new file mode 100644 index 000000000..5b5dab2ab Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_75_ffffff_40x100.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_75_ffffff_40x100.png new file mode 100644 index 000000000..ac8b229af Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_75_ffffff_40x100.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png new file mode 100644 index 000000000..ad3d6346e Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_65_ffffff_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_65_ffffff_1x400.png new file mode 100644 index 000000000..42ccba269 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_65_ffffff_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_dadada_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_dadada_1x400.png new file mode 100644 index 000000000..5a46b47cb Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_dadada_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png new file mode 100644 index 000000000..86c2baa65 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png new file mode 100644 index 000000000..4443fdc1a Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png new file mode 100644 index 000000000..7c9fa6c6e Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_222222_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_222222_256x240.png new file mode 100644 index 000000000..b273ff111 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_222222_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_2e83ff_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_2e83ff_256x240.png new file mode 100644 index 000000000..09d1cdc85 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_2e83ff_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_454545_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_454545_256x240.png new file mode 100644 index 000000000..59bd45b90 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_454545_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_888888_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_888888_256x240.png new file mode 100644 index 000000000..6d02426c1 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_888888_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_cd0a0a_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_cd0a0a_256x240.png new file mode 100644 index 000000000..2ab019b73 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_cd0a0a_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/jquery-ui-1.8.4.custom.css b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/jquery-ui-1.8.4.custom.css new file mode 100644 index 000000000..b8b2bbe50 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/jquery-ui-1.8.4.custom.css @@ -0,0 +1,295 @@ +/* + * jQuery UI CSS Framework @VERSION + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + */ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute; left: -99999999px; } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } + + +/* + * jQuery UI CSS Framework @VERSION + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + * + * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px + */ + + +/* Component containers +----------------------------------*/ +.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; } +.ui-widget .ui-widget { font-size: 1em; } +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; } +.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; } +.ui-widget-content a { color: #222222; } +.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } +.ui-widget-header a { color: #222222; } + +/* Interaction states +----------------------------------*/ +.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; } +.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; } +.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; } +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; } +.ui-widget :active { outline: none; } + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; } +.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; } +.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } +.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); } +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } +.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } +.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); } +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); } + +/* positioning */ +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-off { background-position: -96px -144px; } +.ui-icon-radio-on { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-start { background-position: -80px -160px; } +/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; } +.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } +.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } +.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } +.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } +.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } + +/* Overlays */ +.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); } +.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; } \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/stylesheet.css b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/stylesheet.css new file mode 100644 index 000000000..9b50a9b05 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/assets/0.4.4/stylesheet.css @@ -0,0 +1,341 @@ +/* ----------------------------------------------------------------------- + + + Blueprint CSS Framework 0.9 + http://blueprintcss.org + + * Copyright (c) 2007-Present. See LICENSE for more info. + * See README for instructions on how to use Blueprint. + * For credits and origins, see AUTHORS. + * This is a compressed file. See the sources in the 'src' directory. + +----------------------------------------------------------------------- */ + +/* reset.css */ +html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;} +article, aside, dialog, figure, footer, header, hgroup, nav, section {display:block;} +body {line-height:1.5;} +table {border-collapse:separate;border-spacing:0;} +caption, th, td {text-align:left;font-weight:normal;} +table, td, th {vertical-align:middle;} +blockquote:before, blockquote:after, q:before, q:after {content:"";} +blockquote, q {quotes:"" "";} +a img {border:none;} + +/* typography.css */ +html {font-size:100.01%;} +body {font-size:82%;color:#222;background:#fff;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;} +h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;} +h1 {font-size:3em;line-height:1;margin-bottom:0.5em;} +h2 {font-size:2em;margin-bottom:0.75em;} +h3 {font-size:1.5em;line-height:1;margin-bottom:1em;} +h4 {font-size:1.2em;line-height:1.25;margin-bottom:1.25em;} +h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;} +h6 {font-size:1em;font-weight:bold;} +h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;} +p {margin:0 0 1.5em;} +p img.left {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;} +p img.right {float:right;margin:1.5em 0 1.5em 1.5em;} +a:focus, a:hover {color:#000;} +a {color:#009;text-decoration:underline;} +blockquote {margin:1.5em;color:#666;font-style:italic;} +strong {font-weight:bold;} +em, dfn {font-style:italic;} +dfn {font-weight:bold;} +sup, sub {line-height:0;} +abbr, acronym {border-bottom:1px dotted #666;} +address {margin:0 0 1.5em;font-style:italic;} +del {color:#666;} +pre {margin:1.5em 0;white-space:pre;} +pre, code, tt {font:1em 'andale mono', 'lucida console', monospace;line-height:1.5;} +li ul, li ol {margin:0;} +ul, ol {margin:0 1.5em 1.5em 0;padding-left:3.333em;} +ul {list-style-type:disc;} +ol {list-style-type:decimal;} +dl {margin:0 0 1.5em 0;} +dl dt {font-weight:bold;} +dd {margin-left:1.5em;} +table {margin-bottom:1.4em;width:100%;} +th {font-weight:bold;} +thead th {background:#c3d9ff;} +th, td, caption {padding:4px 10px 4px 5px;} +tr.even td {background:#efefef;} +tfoot {font-style:italic;} +caption {background:#eee;} +.small {font-size:.8em;margin-bottom:1.875em;line-height:1.875em;} +.large {font-size:1.2em;line-height:2.5em;margin-bottom:1.25em;} +.hide {display:none;} +.quiet {color:#666;} +.loud {color:#000;} +.highlight {background:#ff0;} +.added {background:#060;color:#fff;} +.removed {background:#900;color:#fff;} +.first {margin-left:0;padding-left:0;} +.last {margin-right:0;padding-right:0;} +.top {margin-top:0;padding-top:0;} +.bottom {margin-bottom:0;padding-bottom:0;} + +/* forms.css */ +label {font-weight:bold;} +fieldset {padding:1.4em;margin:0 0 1.5em 0;border:1px solid #ccc;} +legend {font-weight:bold;font-size:1.2em;} +input[type=text], input[type=password], input.text, input.title, textarea, select {background-color:#fff;border:1px solid #bbb;} +input[type=text]:focus, input[type=password]:focus, input.text:focus, input.title:focus, textarea:focus, select:focus {border-color:#666;} +input[type=text], input[type=password], input.text, input.title, textarea, select {margin:0.5em 0;} +input.text, input.title {width:300px;padding:5px;} +input.title {font-size:1.5em;} +textarea {width:390px;height:250px;padding:5px;} +input[type=checkbox], input[type=radio], input.checkbox, input.radio {position:relative;top:.25em;} +form.inline {line-height:3;} +form.inline p {margin-bottom:0;} +.error, .notice, .success {padding:.8em;margin-bottom:1em;border:2px solid #ddd;} +.error {background:#FBE3E4;color:#8a1f11;border-color:#FBC2C4;} +.notice {background:#FFF6BF;color:#514721;border-color:#FFD324;} +.success {background:#E6EFC2;color:#264409;border-color:#C6D880;} +.error a {color:#8a1f11;} +.notice a {color:#514721;} +.success a {color:#264409;} +.box {padding:1.5em;margin-bottom:1.5em;background:#E5ECF9;} +hr {background:#ddd;color:#ddd;clear:both;float:none;width:100%;height:.1em;margin:0 0 1.45em;border:none;} +hr.space {background:#fff;color:#fff;visibility:hidden;} +.clearfix:after, .container:after {content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden;} +.clearfix, .container {display:block;} +.clear {clear:both;} + +#loading { + position: fixed; + left: 40%; + top: 50%; +} + +a { + color: #600; + text-decoration: none; +} + +a:hover { + color: #900; + text-decoration: underline; +} + +body { + font-family: "Lucida Grande", Helvetica, "Helvetica Neue", Arial, sans-serif; + padding: 12px; + background-color: #333; +} + +h1, h2, h3, h4 { + color: #1C2324; + margin: 0; + padding: 0; + margin-bottom: 12px; +} + +table { + width: 100%; +} + +#content { + clear: left; + background-color: white; + border: 2px solid #ddd; + border-top: 8px solid #ddd; + padding: 18px; + -webkit-border-bottom-left-radius: 5px; + -webkit-border-bottom-right-radius: 5px; + -webkit-border-top-right-radius: 5px; + -moz-border-radius-bottomleft: 5px; + -moz-border-radius-bottomright: 5px; + -moz-border-radius-topright: 5px; + border-bottom-left-radius: 5px; + border-bottom-right-radius: 5px; + border-top-right-radius: 5px; +} + +.dataTables_filter, .dataTables_info { + padding: 2px 6px; +} + +abbr.timeago { + text-decoration: none; + border: none; + font-weight: bold; +} + +.timestamp { + float: right; + color: #ddd; +} + +.group_tabs { + list-style: none; + float: left; + margin: 0; + padding: 0; +} +.group_tabs li { + display: inline; + float: left; +} + +.group_tabs li a { + font-family: Helvetica, Arial, sans-serif; + display: block; + float: left; + text-decoration: none; + padding: 4px 8px; + background-color: #aaa; + background: -webkit-gradient(linear, 0 0, 0 bottom, from(#DDD), to(#aaa)); + background: -moz-linear-gradient(#DDD, #aaa); + background: linear-gradient(#DDD, #aaa); + text-shadow: #e5e5e5 1px 1px 0px; + border-bottom: none; + color: #333; + font-weight: bold; + margin-right: 8px; + border-top: 1px solid #efefef; + -webkit-border-top-left-radius: 2px; + -webkit-border-top-right-radius: 2px; + -moz-border-radius-topleft: 2px; + -moz-border-radius-topright: 2px; + border-top-left-radius: 2px; + border-top-right-radius: 2px; +} + +.group_tabs li a:hover { + background-color: #ccc; + background: -webkit-gradient(linear, 0 0, 0 bottom, from(#eee), to(#aaa)); + background: -moz-linear-gradient(#eee, #aaa); + background: linear-gradient(#eee, #aaa); +} + +.group_tabs li a:active { + padding-top: 5px; + padding-bottom: 3px; +} + +.group_tabs li.active a { + color: black; + text-shadow: #fff 1px 1px 0px; + background-color: #ddd; + background: -webkit-gradient(linear, 0 0, 0 bottom, from(#fff), to(#ddd)); + background: -moz-linear-gradient(#fff, #ddd); + background: linear-gradient(#fff, #ddd); +} + +.file_list { + margin-bottom: 18px; +} + +a.src_link { + background: url('./magnify.png') no-repeat left 50%; + padding-left: 18px; +} + +tr, td { + margin: 0; + padding: 0; +} + +th { + white-space: nowrap; +} + +th.ui-state-default { + cursor: pointer; +} + +th span.ui-icon { + float: left; +} + +td { + padding: 4px 8px; +} + +.source_table td { + padding: 2px 8px; +} + + +.source_table { + overflow: auto; +} + +.source_table table { + width: 95%; +} + +.source_table thead td { + background-color: white; +} + +.source_table thead th { + background-color: white; +} + +.source_table td.hits { + text-align: right; +} + +.source_table h3, .source_table h4 { + padding: 0; + margin: 0; + margin-bottom: 4px; +} + +td pre { + margin: 0; + padding: 0; + color: #222; + font-family: "Monaco", "Inconsolata", "Consolas", monospace; +} + +.line_number { + width: 20px; + font-weight: bold; +} + +#footer { + color: #ddd; + font-size: 12px; + font-weight: bold; + margin-top: 12px; + text-align: right; +} +#footer a { + color: #eee; + text-decoration: underline; +} +#footer a:hover { + color: #fff; + text-decoration: none; +} + +.green { + color: #090; +} +.red { + color: #900; +} +.yellow { + color: #da0; +} +.hit.odd td { + background-color: #bbdbb6; +} +.hit.even td { + background-color: #cde1c9; +} +.miss.odd td { + background-color: #f19683; +} +.miss.even td { + background-color: #efb5a8; +} +.never.odd td { + background-color: #efefef; +} +.never.even td { + background-color: #f4f4f4; +} \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/covered_percent b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/covered_percent new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/covered_percent @@ -0,0 +1 @@ +0 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/index.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/index.html new file mode 100644 index 000000000..ca26a6e63 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/index.html @@ -0,0 +1,71 @@ + + + + Code coverage for Core ext + + + + + + + + + + + + + + + +
    + loading +
    + + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/resultset.yml b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/resultset.yml new file mode 100644 index 000000000..6b254afc0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/coverage/resultset.yml @@ -0,0 +1,10 @@ +--- +! '/tmp/textmate-command-30083.rb ': + :original_result: {} + :created_at: 2011-04-06 13:13:49.196879000 +10:00 +! '/tmp/textmate-command-30111.rb ': + :original_result: {} + :created_at: 2011-04-06 13:13:56.134815000 +10:00 +! '/tmp/textmate-command-30282.rb ': + :original_result: {} + :created_at: 2011-04-06 13:17:21.846793000 +10:00 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/enumerable_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/enumerable_spec.rb new file mode 100644 index 000000000..960f79d3d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/enumerable_spec.rb @@ -0,0 +1,34 @@ +require 'spec_helper' + +require 'hamster/core_ext/enumerable' + +describe Enumerable do + + class TestEnumerable + + include Enumerable + + def initialize(*values) + @values = values + end + + def each(&block) + @values.each(&block) + end + + end + + describe "#to_list" do + + before do + enumerable = TestEnumerable.new("A", "B", "C") + @list = enumerable.to_list + end + + it "returns an equivalent list" do + @list.should == Hamster.list("A", "B", "C") + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/enumerator_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/enumerator_spec.rb new file mode 100644 index 000000000..c3ac64452 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/enumerator_spec.rb @@ -0,0 +1,25 @@ +require 'spec_helper' + +require 'hamster/core_ext/enumerator' + +describe Enumerator do + + describe "#to_list" do + + before do + @enumerator = ["A", "B", "C"].to_enum + @list = @enumerator.to_list + end + + it "returns an equivalent list" do + @list.should == Hamster.list("A", "B", "C") + end + + it "is lazy" do + @list.head.should == "A" + @enumerator.next.should == "B" + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/io_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/io_spec.rb new file mode 100644 index 000000000..306413ba3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/io_spec.rb @@ -0,0 +1,29 @@ +require 'spec_helper' + +require 'hamster/core_ext/io' + +describe IO do + + describe "#to_list" do + + describe "with a File" do + + it "returns an equivalent list" do + File.open(File.dirname(__FILE__) + "/io_spec.txt") do |io| + io.to_list.should == Hamster.list("A\n", "B\n", "C\n") + end + end + + end + + describe "with a StringIO" do + + it "returns an equivalent list" do + StringIO.new("A\nB\nC\n").to_list.should == Hamster.list("A\n", "B\n", "C\n") + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/io_spec.txt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/io_spec.txt new file mode 100644 index 000000000..b1e67221a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/core_ext/io_spec.txt @@ -0,0 +1,3 @@ +A +B +C diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/experimental/mutable_set/add?_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/experimental/mutable_set/add?_spec.rb new file mode 100644 index 000000000..692504ea0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/experimental/mutable_set/add?_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' + +require 'hamster/experimental/mutable_set' + +describe Hamster::MutableSet do + + describe "#add?" do + + before do + @set = Hamster.mutable_set("A", "B", "C") + end + + describe "with a unique value" do + + before do + @result = @set.add?("D") + end + + it "returns true" do + @result.should == true + end + + it "modifies the set to include the new value" do + @set.should == Hamster.mutable_set("A", "B", "C", "D") + end + + end + + describe "with a duplicate value" do + + before do + @result = @set.add?("C") + end + + it "preserves the original values" do + @set.should == Hamster.mutable_set("A", "B", "C") + end + + it "returns false" do + @result.should == false + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/experimental/mutable_set/add_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/experimental/mutable_set/add_spec.rb new file mode 100644 index 000000000..a2f96dc8e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/experimental/mutable_set/add_spec.rb @@ -0,0 +1,51 @@ +require 'spec_helper' + +require 'hamster/experimental/mutable_set' + +describe Hamster::MutableSet do + + [:add, :<<].each do |method| + + describe "##{method}" do + + before do + @set = Hamster.mutable_set("A", "B", "C") + end + + describe "with a unique value" do + + before do + @result = @set.send(method, "D") + end + + it "returns self" do + @result.should equal(@set) + end + + it "modifies the set to include the new value" do + @set.should == Hamster.mutable_set("A", "B", "C", "D") + end + + end + + describe "with a duplicate value" do + + before do + @result = @set.send(method, "C") + end + + it "preserves the original values" do + @set.should == Hamster.mutable_set("A", "B", "C") + end + + it "returns self" do + @result.should equal(@set) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/experimental/mutable_set/delete?_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/experimental/mutable_set/delete?_spec.rb new file mode 100644 index 000000000..2e140e10e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/experimental/mutable_set/delete?_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' + +require 'hamster/experimental/mutable_set' + +describe Hamster::Set do + + describe "#delete?" do + + before do + @set = Hamster.mutable_set("A", "B", "C") + end + + describe "with an existing value" do + + before do + @result = @set.delete?("B") + end + + it "returns true" do + @result.should == true + end + + it "modifies the set to remove the value" do + @set.should == Hamster.mutable_set("A", "C") + end + + end + + describe "with a non-existing value" do + + before do + @result = @set.delete?("D") + end + + it "preserves the original values" do + @set.should == Hamster.mutable_set("A", "B", "C") + end + + it "returns false" do + @result.should == false + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/experimental/mutable_set/delete_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/experimental/mutable_set/delete_spec.rb new file mode 100644 index 000000000..ef4a74e18 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/experimental/mutable_set/delete_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' + +require 'hamster/experimental/mutable_set' + +describe Hamster::Set do + + describe "#delete" do + + before do + @set = Hamster.mutable_set("A", "B", "C") + end + + describe "with an existing value" do + + before do + @result = @set.delete("B") + end + + it "returns self" do + @result.should equal(@set) + end + + it "modifies the set to remove the value" do + @set.should == Hamster.mutable_set("A", "C") + end + + end + + describe "with a non-existing value" do + + before do + @result = @set.delete("D") + end + + it "preserves the original values" do + @set.should == Hamster.mutable_set("A", "B", "C") + end + + it "returns self" do + @result.should equal(@set) + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/experimental/mutable_stack/pop_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/experimental/mutable_stack/pop_spec.rb new file mode 100644 index 000000000..e959070ee --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/experimental/mutable_stack/pop_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' + +require 'hamster/experimental/mutable_stack' + +describe Hamster::MutableStack do + + [:pop, :dequeue].each do |method| + + describe "##{method}" do + + [ + [[], nil, []], + [["A"], "A", []], + [["A", "B"], "B", ["A"]], + [["A", "B", "C"], "C", ["A", "B"]], + ].each do |initial_state, return_value, resulting_state| + + describe "on #{initial_state.inspect}" do + + before do + @stack = Hamster.mutable_stack(*initial_state) + @result = @stack.send(method) + end + + it "returns #{return_value.inspect}" do + @result.should == return_value + end + + it "modifies the stack to #{resulting_state.inspect}" do + @stack.should == Hamster.mutable_stack(*resulting_state) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/experimental/mutable_stack/push_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/experimental/mutable_stack/push_spec.rb new file mode 100644 index 000000000..f5a94aa3e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/experimental/mutable_stack/push_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' + +require 'hamster/experimental/mutable_stack' + +describe Hamster::MutableStack do + + [:push, :<<, :enqueue].each do |method| + + describe "##{method}" do + + [ + [[], "A", ["A"]], + [["A"], "B", ["A", "B"]], + [["A"], "A", ["A", "A"]], + [["A", "B", "C"], "D", ["A", "B", "C", "D"]], + ].each do |initial_state, new_value, resulting_state| + + describe "on #{initial_state.inspect} with #{new_value.inspect}" do + + before do + @stack = Hamster.mutable_stack(*initial_state) + @result = @stack.send(method, new_value) + end + + it "returns self" do + @result.should equal(@stack) + end + + it "modifies the stack to #{resulting_state.inspect}" do + @stack.should == Hamster.mutable_stack(*resulting_state) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/all_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/all_spec.rb new file mode 100644 index 000000000..942522b77 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/all_spec.rb @@ -0,0 +1,59 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + [:all?, :forall?].each do |method| + + describe "##{method}" do + + describe "when empty" do + + before do + @hash = Hamster.hash + end + + it "with a block returns true" do + @hash.send(method) {}.should == true + end + + it "with no block returns true" do + @hash.send(method).should == true + end + + end + + describe "when not empty" do + + before do + @hash = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + describe "with a block" do + + it "returns true if the block always returns true" do + @hash.send(method) { |key, value| true }.should == true + end + + it "returns false if the block ever returns false" do + @hash.send(method) { |key, value| key == "D" || value == "dee" }.should == false + end + + end + + describe "with no block" do + + it "returns true" do + @hash.send(method).should == true + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/any_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/any_spec.rb new file mode 100644 index 000000000..bbd8bb061 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/any_spec.rb @@ -0,0 +1,68 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + [:any?, :exist?, :exists?].each do |method| + + describe "##{method}" do + + describe "when empty" do + + before do + @hash = Hamster.hash + end + + it "with a block returns false" do + @hash.send(method) {}.should == false + end + + it "with no block returns false" do + @hash.send(method).should == false + end + + end + + describe "when not empty" do + + before do + @hash = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see", nil => "NIL") + end + + describe "with a block" do + + [ + ["A", "aye"], + ["B", "bee"], + ["C", "see"], + [nil, "NIL"], + ].each do |pair| + + it "returns true if the block ever returns true (#{pair.inspect})" do + @hash.send(method) { |key, value| key == pair.first && value == pair.last }.should == true + end + + it "returns false if the block always returns false" do + @hash.send(method) { |key, value| key == "D" && value == "dee" }.should == false + end + + end + + end + + describe "with no block" do + + it "returns true" do + @hash.send(method).should == true + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/clear_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/clear_spec.rb new file mode 100644 index 000000000..40e6a93e8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/clear_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + describe "#clear" do + + [ + [], + ["A" => "aye"], + ["A" => "aye", "B" => "bee", "C" => "see"], + ].each do |values| + + describe "on #{values}" do + + before do + @original = Hamster.hash(*values) + @result = @original.clear + end + + it "preserves the original" do + @original.should == Hamster.hash(*values) + end + + it "returns an empty hash" do + @result.should equal(Hamster.hash) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/construction_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/construction_spec.rb new file mode 100644 index 000000000..30828de20 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/construction_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + describe ".hash" do + + describe "with nothing" do + + before do + @hash = Hamster.hash + end + + it "returns an empty hash" do + @hash.should be_empty + end + + end + + describe "with an implicit hash" do + + before do + @hash = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + it "is equivalent to repeatedly using #put" do + @hash.should == Hamster.hash.put("A", "aye").put("B", "bee").put("C", "see") + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/copying_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/copying_spec.rb new file mode 100644 index 000000000..d895b2845 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/copying_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + before do + @hash = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + [:dup, :clone].each do |method| + + describe "##{method}" do + + it "returns self" do + @hash.send(method).should equal(@hash) + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/delete_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/delete_spec.rb new file mode 100644 index 000000000..6e2f68335 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/delete_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + describe "#delete" do + + before do + @original = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + describe "with an existing key" do + + before do + @result = @original.delete("B") + end + + it "preserves the original" do + @original.should == Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + it "returns a copy with the remaining key/value pairs" do + @result.should == Hamster.hash("A" => "aye", "C" => "see") + end + + end + + describe "with a non-existing key" do + + before do + @result = @original.delete("D") + end + + it "preserves the original values" do + @original.should == Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/each_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/each_spec.rb new file mode 100644 index 000000000..17f8eb077 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/each_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + [:each, :foreach].each do |method| + + describe "##{method}" do + + before do + @hash = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + describe "with a block (internal iteration)" do + + it "returns nil" do + @hash.send(method) {}.should be_nil + end + + it "yields all key/value pairs" do + actual_pairs = {} + @hash.send(method) { |key, value| actual_pairs[key] = value } + actual_pairs.should == {"A" => "aye", "B" => "bee", "C" => "see"} + end + + end + + describe "with no block" do + + it "returns self" do + @hash.send(method).should equal(@hash) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/empty_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/empty_spec.rb new file mode 100644 index 000000000..cd37692c1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/empty_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + [:empty?, :null?].each do |method| + + describe "##{method}" do + + [ + [[], true], + [["A" => "aye"], false], + [["A" => "aye", "B" => "bee", "C" => "see"], false], + ].each do |pairs, result| + + it "returns #{result} for #{pairs.inspect}" do + Hamster.hash(*pairs).send(method).should == result + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/eql_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/eql_spec.rb new file mode 100644 index 000000000..0e62865b4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/eql_spec.rb @@ -0,0 +1,62 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + [:eql?, :==].each do |method| + + describe "##{method}" do + + describe "returns false when comparing with" do + + before do + @hash = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + it "a standard hash" do + @hash.send(method, "A" => "aye", "B" => "bee", "C" => "see").should == false + end + + it "an aribtrary object" do + @hash.send(method, Object.new).should == false + end + + end + + [ + [{}, {}, true], + [{"A" => "aye"}, {}, false], + [{}, {"A" => "aye"}, false], + [{"A" => "aye"}, {"A" => "aye"}, true], + [{"A" => "aye"}, {"B" => "bee"}, false], + [{"A" => "aye", "B" => "bee"}, {"A" => "aye"}, false], + [{"A" => "aye"}, {"A" => "aye", "B" => "bee"}, false], + [{"A" => "aye", "B" => "bee", "C" => "see"}, {"A" => "aye", "B" => "bee", "C" => "see"}, true], + [{"C" => "see", "A" => "aye", "B" => "bee"}, {"A" => "aye", "B" => "bee", "C" => "see"}, true], + ].each do |a, b, expected| + + describe "returns #{expected.inspect}" do + + before do + @a = Hamster.hash(a) + @b = Hamster.hash(b) + end + + it "for #{a.inspect} and #{b.inspect}" do + @a.send(method, @b).should == expected + end + + it "for #{b.inspect} and #{a.inspect}" do + @b.send(method, @a).should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/except_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/except_spec.rb new file mode 100644 index 000000000..dfa3d5f8e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/except_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + describe "#except" do + + before do + @hash = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see", nil => "NIL") + end + + describe "with only keys that the Hash has" do + + it "returns a Hash without those values" do + @hash.except("B", nil).should == Hamster.hash("A" => "aye", "C" => "see") + end + + end + + describe "with keys that the Hash doesn't have" do + + it "returns a Hash without the values that it had keys for" do + @hash.except("B", "A", 3).should == Hamster.hash("C" => "see", nil => "NIL") + end + + end + + end + +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/fetch_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/fetch_spec.rb new file mode 100644 index 000000000..b3c3c7b8b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/fetch_spec.rb @@ -0,0 +1,95 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + describe "#fetch" do + + describe "with no default provided" do + + describe "when the key exists" do + + before do + @hash = Hamster.hash("A" => "aye") + end + + it "returns the value associated with the key" do + @hash.fetch("A").should == "aye" + end + + end + + describe "when the key does not exist" do + + before do + @hash = Hamster.hash("A" => "aye") + end + + it "raises a KeyError" do + lambda { @hash.fetch("B") }.should raise_error(KeyError) + end + + end + + end + + describe "with a default value" do + + describe "when the key exists" do + + before do + @hash = Hamster.hash("A" => "aye") + end + + it "returns the value associated with the key" do + @hash.fetch("A", "default").should == "aye" + end + + end + + describe "when the key does not exist" do + + before do + @hash = Hamster.hash("A" => "aye") + end + + it "returns the default value" do + @hash.fetch("B", "default").should == "default" + end + + end + + end + + describe "with a default block" do + + describe "when the key exists" do + + before do + @hash = Hamster.hash("A" => "aye") + end + + it "returns the value associated with the key" do + @hash.fetch("A") { "default".upcase }.should == "aye" + end + + end + + describe "when the key does not exist" do + + before do + @hash = Hamster.hash("A" => "aye") + end + + it "returns the default value" do + @hash.fetch("B") { "default".upcase }.should == "DEFAULT" + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/filter_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/filter_spec.rb new file mode 100644 index 000000000..16212fb99 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/filter_spec.rb @@ -0,0 +1,63 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + [:filter, :select, :find_all].each do |method| + + describe "##{method}" do + + before do + @original = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + describe "when everything matches" do + + before do + @result = @original.send(method) { |key, value| true } + end + + it "returns self" do + @result.should equal(@original) + end + + end + + describe "when only some things match" do + + describe "with a block" do + + before do + @result = @original.send(method) { |key, value| key == "A" && value == "aye" } + end + + it "preserves the original" do + @original.should == Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + it "returns a set with the matching values" do + @result.should == Hamster.hash("A" => "aye") + end + + end + + describe "with no block" do + + before do + @result = @original.send(method) + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/find_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/find_spec.rb new file mode 100644 index 000000000..ce76c48b8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/find_spec.rb @@ -0,0 +1,58 @@ +require 'spec_helper' + +require 'hamster/tuple' +require 'hamster/hash' + +describe Hamster::Hash do + + [:find, :detect].each do |method| + + describe "##{method}" do + + [ + [[], "A", nil], + [[], nil, nil], + [["A" => "aye"], "A", Hamster::Tuple.new("A", "aye")], + [["A" => "aye"], "B", nil], + [["A" => "aye"], nil, nil], + [["A" => "aye", "B" => "bee", nil => "NIL"], "A", Hamster::Tuple.new("A", "aye")], + [["A" => "aye", "B" => "bee", nil => "NIL"], "B", Hamster::Tuple.new("B", "bee")], + [["A" => "aye", "B" => "bee", nil => "NIL"], nil, Hamster::Tuple.new(nil, "NIL")], + [["A" => "aye", "B" => "bee", nil => "NIL"], "C", nil], + ].each do |values, key, expected| + + describe "on #{values.inspect}" do + + before do + @hash = Hamster.hash(*values) + end + + describe "with a block" do + + before do + @result = @hash.send(method) { |k, v| k == key } + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + describe "without a block" do + + it "returns nil" do + @hash.send(method).should be_nil + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/get_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/get_spec.rb new file mode 100644 index 000000000..becb5404f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/get_spec.rb @@ -0,0 +1,68 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + [:get, :[]].each do |method| + + describe "##{method}" do + + describe "with a default block" do + + describe "when the key exists" do + + before do + @hash = Hamster.hash("A" => "aye") { |key| fail } + end + + it "returns the value associated with the key" do + @hash.get("A").should == "aye" + end + + end + + describe "when the key does not exist" do + + before do + @hash = Hamster.hash("A" => "aye") { |key| key.should == "B"; "bee" } + end + + it "returns the value associated with the key" do + @hash.get("B").should == "bee" + end + + end + + end + + describe "with no default block" do + + before do + @hash = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see", nil => "NIL") + end + + [ + ["A", "aye"], + ["B", "bee"], + ["C", "see"], + [nil, "NIL"] + ].each do |key, value| + + it "returns the value (#{value.inspect}) for an existing key (#{key.inspect})" do + @hash.send(method, key).should == value + end + + end + + it "returns nil for a non-existing key" do + @hash.send(method, "D").should be_nil + end + + end + + end + + end + + end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/has_key_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/has_key_spec.rb new file mode 100644 index 000000000..d693174f5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/has_key_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + [:has_key?, :key?, :include?, :member?].each do |method| + + describe "##{method}" do + + before do + @hash = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see", nil => "NIL", 2.0 => "two") + end + + ["A", "B", "C", nil, 2.0].each do |key| + + it "returns true for an existing key (#{key.inspect})" do + @hash.send(method, key).should == true + end + + end + + it "returns false for a non-existing key" do + @hash.send(method, "D").should == false + end + + it "uses #eql? for equality" do + @hash.send(method, 2).should == false + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/hash_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/hash_spec.rb new file mode 100644 index 000000000..f5782d11c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/hash_spec.rb @@ -0,0 +1,54 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + describe "#hash" do + + it "values are sufficiently distributed" do + (1..4000). + each_slice(4). + map { |ka, va, kb, vb| Hamster.hash(ka => va, kb => vb).hash }. + uniq. + size.should == 1000 + end + + it "differs given the same keys and different values" do + Hamster.hash("ka" => "va").hash.should_not == Hamster.hash("ka" => "vb").hash + end + + it "differs given the same values and different keys" do + Hamster.hash("ka" => "va").hash.should_not == Hamster.hash("kb" => "va").hash + end + + describe "on an empty hash" do + + before do + @result = Hamster.hash.hash + end + + it "returns 0" do + @result.should == 0 + end + + end + + describe "from a subclass" do + before do + @subclass = Class.new(Hamster::Hash) + @instance = @subclass.new("some" => "values") + end + + it "should return an instance of the subclass" do + @instance.class.should be @subclass + end + + it "should return a frozen instance" do + @instance.frozen?.should be true + end + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/immutable_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/immutable_spec.rb new file mode 100644 index 000000000..71d3b8f34 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/immutable_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +require 'hamster/immutable' +require 'hamster/hash' + +describe Hamster::Hash do + + it "includes Immutable" do + Hamster::Hash.should include(Hamster::Immutable) + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/inspect_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/inspect_spec.rb new file mode 100644 index 000000000..2ee0f5605 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/inspect_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + describe "#inspect" do + + [ + [[], "{}"], + [["A" => "aye"], "{\"A\" => \"aye\"}"], + [[DeterministicHash.new("A", 1) => "aye", DeterministicHash.new("B", 2) => "bee", DeterministicHash.new("C", 3) => "see"], "{\"A\" => \"aye\", \"B\" => \"bee\", \"C\" => \"see\"}"] + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.hash(*values) + @result = original.inspect + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/keys_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/keys_spec.rb new file mode 100644 index 000000000..603d299e3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/keys_spec.rb @@ -0,0 +1,21 @@ +require 'spec_helper' + +require 'hamster/hash' +require 'hamster/set' + +describe Hamster::Hash do + + describe "#keys" do + + before do + hash = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + @result = hash.keys + end + + it "returns the keys as a set" do + @result.should == Hamster.set("A", "B", "C") + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/map_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/map_spec.rb new file mode 100644 index 000000000..9f51b16f9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/map_spec.rb @@ -0,0 +1,64 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + [:map, :collect].each do |method| + + describe "##{method}" do + + describe "when empty" do + + before do + @original = Hamster.hash + @mapped = @original.send(method) {} + end + + it "returns self" do + @mapped.should equal(@original) + end + + end + + describe "when not empty" do + + before do + @original = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + describe "with a block" do + + before do + @mapped = @original.send(method) { |key, value| [key.downcase, value.upcase] } + end + + it "preserves the original values" do + @original.should == Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + it "returns a new hash with the mapped values" do + @mapped.should == Hamster.hash("a" => "AYE", "b" => "BEE", "c" => "SEE") + end + + end + + describe "with no block" do + + before do + @result = @original.send(method) + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/merge_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/merge_spec.rb new file mode 100644 index 000000000..ef1865438 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/merge_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + [:merge, :+].each do |method| + + describe "##{method}" do + + [ + [[], [], []], + [["A" => "aye"], [], ["A" => "aye"]], + [["A" => "aye"], ["A" => "bee"], ["A" => "bee"]], + [["A" => "aye"], ["B" => "bee"], ["A" => "aye", "B" => "bee"]], + ].each do |a, b, expected| + + describe "for #{a.inspect} and #{b.inspect}" do + + before do + @result = Hamster.hash(*a).send(method, Hamster.hash(*b)) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.hash(*expected) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/none_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/none_spec.rb new file mode 100644 index 000000000..89e146a1a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/none_spec.rb @@ -0,0 +1,64 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + describe "#none?" do + + describe "when empty" do + + before do + @hash = Hamster.hash + end + + it "with a block returns true" do + @hash.none? {}.should == true + end + + it "with no block returns true" do + @hash.none?.should == true + end + + end + + describe "when not empty" do + + before do + @hash = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see", nil => "NIL") + end + + describe "with a block" do + + [ + ["A", "aye"], + ["B", "bee"], + ["C", "see"], + [nil, "NIL"], + ].each do |pair| + + it "returns false if the block ever returns true (#{pair.inspect})" do + @hash.none? { |key, value| key == pair.first && value == pair.last }.should == false + end + + it "returns true if the block always returns false" do + @hash.none? { |key, value| key == "D" && value == "dee" }.should == true + end + + end + + end + + describe "with no block" do + + it "returns false" do + @hash.none?.should == false + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/put_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/put_spec.rb new file mode 100644 index 000000000..97ae615a2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/put_spec.rb @@ -0,0 +1,65 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + describe "#put" do + + before do + @original = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + describe "with a block" do + + it "passes the value to the block" do + @original.put("A") { |value| value.should == "aye" } + end + + it "replaces the value with the result of the block" do + result = @original.put("A") { |value| "FLIBBLE" } + result.get("A").should == "FLIBBLE" + end + + it "supports to_proc methods" do + result = @original.put("A", &:upcase) + result.get("A").should == "AYE" + end + + end + + describe "with a unique key" do + + before do + @result = @original.put("D", "dee") + end + + it "preserves the original" do + @original.should == Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + it "returns a copy with the superset of key/value pairs" do + @result.should == Hamster.hash("A" => "aye", "B" => "bee", "C" => "see", "D" => "dee") + end + + end + + describe "with a duplicate key" do + + before do + @result = @original.put("C", "sea") + end + + it "preserves the original" do + @original.should == Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + it "returns a copy with the superset of key/value pairs" do + @result.should == Hamster.hash("A" => "aye", "B" => "bee", "C" => "sea") + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/reduce_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/reduce_spec.rb new file mode 100644 index 000000000..995fe7b12 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/reduce_spec.rb @@ -0,0 +1,60 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + [:reduce, :inject, :fold, :foldr].each do |method| + + describe "##{method}" do + + describe "when empty" do + + before do + @original = Hamster.hash + @result = @original.send(method, "ABC") {} + end + + it "returns the memo" do + @result.should == "ABC" + end + + end + + describe "when not empty" do + + before do + @original = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + describe "with a block" do + + before do + @result = @original.send(method, 0) { |memo, key, value| memo + 1 } + end + + it "returns the final memo" do + @result.should == 3 + end + + end + + describe "with no block" do + + before do + @result = @original.send(method, "ABC") + end + + it "returns the memo" do + @result.should == "ABC" + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/remove_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/remove_spec.rb new file mode 100644 index 000000000..dce8d774b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/remove_spec.rb @@ -0,0 +1,63 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + [:remove, :reject, :delete_if].each do |method| + + describe "##{method}" do + + before do + @original = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + describe "when nothing matches" do + + before do + @result = @original.send(method) { |key, value| false } + end + + it "returns self" do + @result.should equal(@original) + end + + end + + describe "when only some things match" do + + describe "with a block" do + + before do + @result = @original.send(method) { |key, value| key == "A" && value == "aye" } + end + + it "preserves the original" do + @original.should == Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + it "returns a set with the matching values" do + @result.should == Hamster.hash("B" => "bee", "C" => "see") + end + + end + + describe "with no block" do + + before do + @result = @original.send(method) + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/size_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/size_spec.rb new file mode 100644 index 000000000..3e6804ec9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/size_spec.rb @@ -0,0 +1,61 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + [:size, :length].each do |method| + + describe "##{method}" do + + [ + [[], 0], + [["A" => "aye"], 1], + [["A" => "bee", "B" => "bee", "C" => "see"], 3], + ].each do |values, result| + + it "returns #{result} for #{values.inspect}" do + Hamster.hash(*values).send(method).should == result + end + + end + + lots = (1..10842).to_a + srand 89533474 + random_things = (lots + lots).sort_by{|x|rand} + + it "should have the correct size after adding lots of things with colliding keys and such" do + h = Hamster.hash + random_things.each do |thing| + h = h.put(thing, thing * 2) + end + h.size.should == 10842 + end + + random_actions = (lots.map{|x|[:add, x]} + lots.map{|x|[:add, x]} + lots.map{|x|[:remove, x]}). + sort_by{|x|rand} + ending_size = random_actions.reduce({}) do |h, (act, ob)| + if act == :add + h[ob] = 1 + else + h.delete(ob) + end + h + end.size + it "should have the correct size after lots of addings and removings" do + h = Hamster.hash + random_actions.each do |(act, ob)| + if act == :add + h = h.put(ob, ob * 3) + else + h = h.delete(ob) + end + end + h.size.should == ending_size + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/slice_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/slice_spec.rb new file mode 100644 index 000000000..585496384 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/slice_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + describe "#slice" do + + before do + @hash = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see", nil => "NIL") + end + + describe "with only keys that the Hash has" do + + it "returns a Hash with only those values" do + @hash.slice("B", nil).should == Hamster.hash("B" => "bee", nil => "NIL") + end + + end + + describe "with keys that the Hash doesn't have" do + + it "returns a Hash with only the values that have matching keys" do + @hash.slice("B", "A", 3).should == Hamster.hash("A" => "aye", "B" => "bee") + end + + end + + end + +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/uniq_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/uniq_spec.rb new file mode 100644 index 000000000..810e9da94 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/uniq_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +require 'hamster/hash' + +describe Hamster::Hash do + + before do + @hash = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + end + + [:uniq, :nub, :remove_duplicates].each do |method| + + describe "##{method}" do + + it "returns self" do + @hash.send(method).should equal(@hash) + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/values_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/values_spec.rb new file mode 100644 index 000000000..d171b7afe --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/hash/values_spec.rb @@ -0,0 +1,34 @@ +require 'spec_helper' + +require 'hamster/hash' +require 'hamster/set' + +describe Hamster::Hash do + + describe "#values" do + + before do + hash = Hamster.hash("A" => "aye", "B" => "bee", "C" => "see") + @result = hash.values + end + + it "returns the keys as a list" do + @result.should be_a Hamster::List + @result.to_a.sort.should == %w(aye bee see) + end + + end + + describe "#values with duplicates" do + before do + hash = Hamster.hash(:A => 15, :B => 19, :C => 15) + @result = hash.values + end + + it "returns the keys as a list" do + @result.should be_a Hamster::List + @result.to_a.sort.should == [15,15,19] + end + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/immutable/copying_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/immutable/copying_spec.rb new file mode 100644 index 000000000..517e1966c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/immutable/copying_spec.rb @@ -0,0 +1,28 @@ +require 'spec_helper' + +require 'hamster/immutable' + +describe Hamster::Immutable do + + class Fixture + include Hamster::Immutable + end + + [:dup, :clone].each do |method| + + describe "##{method}" do + + before do + @original = Fixture.new + @result = @original.send(method) + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/immutable/immutable_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/immutable/immutable_spec.rb new file mode 100644 index 000000000..f06f815ff --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/immutable/immutable_spec.rb @@ -0,0 +1,58 @@ +require 'spec_helper' + +require 'hamster/immutable' + +describe Hamster::Immutable do + + describe "#immutable?" do + + describe "object constructed after its class becomes Immutable" do + + class Fixture + include Hamster::Immutable + end + + before do + @fixture = Fixture.new + end + + it "returns true" do + @fixture.should be_immutable + end + + end + + describe "object constructed before its class becomes Immutable" do + + before do + @fixture = Class.new.new + @fixture.class.instance_eval do + include Hamster::Immutable + end + end + + describe "that are not frozen" do + + it "returns false" do + @fixture.should_not be_immutable + end + + end + + describe "that are frozen" do + + before do + @fixture.freeze + end + + it "returns true" do + @fixture.should be_immutable + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/immutable/memoize_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/immutable/memoize_spec.rb new file mode 100644 index 000000000..50ca8d4aa --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/immutable/memoize_spec.rb @@ -0,0 +1,64 @@ +require 'spec_helper' + +require 'hamster/immutable' + +describe Hamster::Immutable do + + describe "#memoize" do + + class Fixture + include Hamster::Immutable + + def initialize(&block) + @block = block + end + + def call + @block.call + end + memoize :call + + def copy + transform {} + end + + end + + before do + @count = 0 + @fixture = Fixture.new { @count += 1 } + @fixture.call + end + + it "should still freezes be immutable" do + @fixture.should be_immutable + end + + describe "when called multiple times" do + + before do + @fixture.call + end + + it "a memoized method will only be evaluated once" do + @count.should == 1 + end + + end + + describe "when making a copy" do + + before do + @copy = @fixture.copy + @copy.call + end + + it "should clear all memory" do + @count.should == 2 + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/immutable/new_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/immutable/new_spec.rb new file mode 100644 index 000000000..3d4ac1583 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/immutable/new_spec.rb @@ -0,0 +1,28 @@ +require 'spec_helper' + +require 'hamster/immutable' + +describe Hamster::Immutable do + + describe "#new" do + + class NewPerson < Struct.new(:first, :last) + include Hamster::Immutable + end + + before do + @instance = NewPerson.new("Simon", "Harris") + end + + it "passes the constructor arguments" do + @instance.first.should == "Simon" + @instance.last.should == "Harris" + end + + it "freezes the instance" do + @instance.should be_frozen + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/immutable/transform_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/immutable/transform_spec.rb new file mode 100644 index 000000000..0de6d124c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/immutable/transform_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +require 'hamster/immutable' + +describe Hamster::Immutable do + + describe "#transform" do + + class TransformPerson < Struct.new(:first, :last) + include Hamster::Immutable + public :transform + end + + before do + @original = TransformPerson.new("Simon", "Harris") + @result = @original.transform { self.first = "Sampy" } + end + + it "preserves the original" do + @original.first.should == "Simon" + @original.last.should == "Harris" + end + + it "returns a new instance with the updated values" do + @result.first.should == "Sampy" + @result.last.should == "Harris" + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/immutable/transform_unless_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/immutable/transform_unless_spec.rb new file mode 100644 index 000000000..0cc166c12 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/immutable/transform_unless_spec.rb @@ -0,0 +1,55 @@ +require 'spec_helper' + +require 'hamster/immutable' + +describe Hamster::Immutable do + + describe "#transform_unless" do + + class TransformUnlessPerson < Struct.new(:first, :last) + include Hamster::Immutable + public :transform_unless + end + + before do + @original = TransformUnlessPerson.new("Simon", "Harris") + end + + describe "when the condition is false" do + + before do + @result = @original.transform_unless(false) { self.first = "Sampy" } + end + + it "preserves the original" do + @original.first.should == "Simon" + @original.last.should == "Harris" + end + + it "returns a new instance with the updated values" do + @result.first.should == "Sampy" + @result.last.should == "Harris" + end + + end + + describe "when the condition is true" do + + before do + @result = @original.transform_unless(true) { fail("Should never be called") } + end + + it "preserves the original" do + @original.first.should == "Simon" + @original.last.should == "Harris" + end + + it "returns the original" do + @result.should equal(@original) + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/all_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/all_spec.rb new file mode 100644 index 000000000..28960bf66 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/all_spec.rb @@ -0,0 +1,111 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:all?, :forall?].each do |method| + + describe "##{method}" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.send(method) }.should_not raise_error + end + + end + + describe "when empty" do + + before do + @list = Hamster.list + end + + it "with a block returns true" do + @list.send(method) {}.should == true + end + + it "with no block returns true" do + @list.send(method).should == true + end + + end + + describe "when not empty" do + + describe "with a block" do + + before do + @list = Hamster.list("A", "B", "C") + end + + describe "if the block always returns true" do + + before do + @result = @list.send(method) { |item| true } + end + + it "returns true" do + @result.should == true + end + + end + + describe "if the block ever returns false" do + + before do + @result = @list.send(method) { |item| item == "D" } + end + + it "returns false" do + @result.should == false + end + + end + + end + + describe "with no block" do + + describe "if all values are truthy" do + + before do + @result = Hamster.list(true, "A").send(method) + end + + it "returns true" do + @result.should == true + end + + end + + [nil, false].each do |value| + + describe "if any value is #{value.inspect}" do + + before do + @result = Hamster.list(value, true, "A").send(method) + end + + it "returns false" do + @result.should == false + end + + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/any_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/any_spec.rb new file mode 100644 index 000000000..86c52d6bc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/any_spec.rb @@ -0,0 +1,79 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:any?, :exist?, :exists?].each do |method| + + describe "##{method}" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.send(method) { false } }.should_not raise_error + end + + end + + describe "when empty" do + + before do + @list = Hamster.list + end + + it "with a block returns false" do + @list.send(method) {}.should == false + end + + it "with no block returns false" do + @list.send(method).should == false + end + + end + + describe "when not empty" do + + describe "with a block" do + + before do + @list = Hamster.list("A", "B", "C", nil) + end + + ["A", "B", "C", nil].each do |value| + + it "returns true if the block ever returns true (#{value.inspect})" do + @list.send(method) { |item| item == value }.should == true + end + + end + + it "returns false if the block always returns false" do + @list.send(method) { |item| item == "D" }.should == false + end + + end + + describe "with no block" do + + it "returns true if any value is truthy" do + Hamster.list(nil, false, "A", true).send(method).should == true + end + + it "returns false if all values are falsey" do + Hamster.list(nil, false).send(method).should == false + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/append_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/append_spec.rb new file mode 100644 index 000000000..e45b45fe1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/append_spec.rb @@ -0,0 +1,50 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:append, :concat, :cat, :+].each do |method| + + describe "##{method}" do + + it "is lazy" do + lambda { Hamster.stream { fail }.append(Hamster.stream { fail }) }.should_not raise_error + end + + [ + [[], [], []], + [["A"], [], ["A"]], + [[], ["A"], ["A"]], + [["A", "B"], ["C", "D"], ["A", "B", "C", "D"]], + ].each do |left_values, right_values, expected| + + describe "on #{left_values.inspect} and #{right_values.inspect}" do + + before do + @left = Hamster.list(*left_values) + @right = Hamster.list(*right_values) + @result = @left.append(@right) + end + + it "preserves the left" do + @left.should == Hamster.list(*left_values) + end + + it "preserves the right" do + @right.should == Hamster.list(*right_values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + + end + +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/at_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/at_spec.rb new file mode 100644 index 000000000..35d9d53ef --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/at_spec.rb @@ -0,0 +1,49 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:at, :[]].each do |method| + + describe "##{method}" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.send(method, STACK_OVERFLOW_DEPTH) }.should_not raise_error + end + + end + + [ + [[], 10, nil], + [["A"], 10, nil], + [["A", "B", "C"], 0, "A"], + [["A", "B", "C"], 2, "C"], + ].each do |values, number, expected| + + describe "#{values.inspect} with #{number}" do + + before do + @original = Hamster.list(*values) + @result = @original.send(method, number) + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/break_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/break_spec.rb new file mode 100644 index 000000000..bce64fcfe --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/break_spec.rb @@ -0,0 +1,85 @@ +require 'spec_helper' + +require 'hamster/tuple' +require 'hamster/list' + +describe Hamster::List do + + describe "#break" do + + it "is lazy" do + lambda { Hamster.stream { fail }.break { |item| false } }.should_not raise_error + end + + [ + [[], [], []], + [[1], [1], []], + [[1, 2], [1, 2], []], + [[1, 2, 3], [1, 2], [3]], + [[1, 2, 3, 4], [1, 2], [3, 4]], + [[2, 3, 4], [2], [3, 4]], + [[3, 4], [], [3, 4]], + [[4], [], [4]], + ].each do |values, expected_prefix, expected_remainder| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + end + + describe "with a block" do + + before do + @result = @original.break { |item| item > 2 } + @prefix = @result.first + @remainder = @result.last + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns a tuple with two items" do + @result.is_a?(Hamster::Tuple).should == true + end + + it "correctly identifies the prefix" do + @prefix.should == Hamster.list(*expected_prefix) + end + + it "correctly identifies the remainder" do + @remainder.should == Hamster.list(*expected_remainder) + end + + end + + describe "without a block" do + + before do + @result = @original.break + @prefix = @result.first + @remainder = @result.last + end + + it "returns a tuple with two items" do + @result.is_a?(Hamster::Tuple).should == true + end + + it "returns self as the prefix" do + @prefix.should equal(@original) + end + + it "leaves the remainder empty" do + @remainder.should be_empty + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/cadr_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/cadr_spec.rb new file mode 100644 index 000000000..f98a25890 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/cadr_spec.rb @@ -0,0 +1,50 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [ + [[], :car, nil], + [["A"], :car, "A"], + [["A", "B", "C"], :car, "A"], + [["A", "B", "C"], :cadr, "B"], + [["A", "B", "C"], :caddr, "C"], + [["A", "B", "C"], :cadddr, nil], + [["A", "B", "C"], :caddddr, nil], + [[], :cdr, Hamster.list], + [["A"], :cdr, Hamster.list], + [["A", "B", "C"], :cdr, Hamster.list("B", "C")], + [["A", "B", "C"], :cddr, Hamster.list("C")], + [["A", "B", "C"], :cdddr, Hamster.list], + [["A", "B", "C"], :cddddr, Hamster.list], + ].each do |values, method, expected| + + describe "##{method}" do + + it "is responded to" do + Hamster.list.respond_to?(method).should == true + end + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.send(method) + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/chunk_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/chunk_spec.rb new file mode 100644 index 000000000..fb6063a5f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/chunk_spec.rb @@ -0,0 +1,40 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#chunk" do + + it "is lazy" do + lambda { Hamster.stream { fail }.chunk(2) }.should_not raise_error + end + + [ + [[], []], + [["A"], [Hamster.list("A")]], + [["A", "B", "C"], [Hamster.list("A", "B"), Hamster.list("C")]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.chunk(2) + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/clear_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/clear_spec.rb new file mode 100644 index 000000000..2e484e269 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/clear_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#clear" do + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values}" do + + before do + @original = Hamster.list(*values) + @result = @original.clear + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns an empty list" do + @result.should equal(Hamster.list) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/combinations_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/combinations_spec.rb new file mode 100644 index 000000000..1366f93ca --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/combinations_spec.rb @@ -0,0 +1,51 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:combinations, :combination].each do |method| + + describe "##{method}" do + + it "is lazy" do + lambda { Hamster.stream { fail }.combinations(2) }.should_not raise_error + end + + [ + [["A", "B", "C", "D"], 1, [["A"], ["B"], ["C"], ["D"]]], + [["A", "B", "C", "D"], 2, [["A", "B"], ["A", "C"], ["A", "D"], ["B", "C"], ["B", "D"], ["C", "D"]]], + [["A", "B", "C", "D"], 3, [["A", "B", "C"], ["A", "B", "D"], ["A", "C", "D"], ["B", "C", "D"]]], + [["A", "B", "C", "D"], 4, [["A", "B", "C", "D"]]], + [["A", "B", "C", "D"], 0, [[]]], + [["A", "B", "C", "D"], 5, []], + [[], 0, [[]]], + [[], 1, []], + ].each do |values, number, expected| + + expected = expected.map { |x| Hamster.list(*x) } + + describe "on #{values.inspect} in groups of #{number}" do + + before do + @original = Hamster.list(*values) + @result = @original.send(method, number) + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/compact_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/compact_spec.rb new file mode 100644 index 000000000..d04873b27 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/compact_spec.rb @@ -0,0 +1,46 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#compact" do + + it "is lazy" do + lambda { Hamster.stream { fail }.compact }.should_not raise_error + end + + [ + [[], []], + [["A"], ["A"]], + [["A", "B", "C"], ["A", "B", "C"]], + [[nil], []], + [[nil, "B"], ["B"]], + [["A", nil], ["A"]], + [[nil, nil], []], + [["A", nil, "C"], ["A", "C"]], + [[nil, "B", nil], ["B"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.compact + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/cons_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/cons_spec.rb new file mode 100644 index 000000000..b472863f9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/cons_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:cons, :>>].each do |method| + + describe "##{method}" do + + [ + [[], "A", ["A"]], + [["A"], "B", ["B", "A"]], + [["A"], "A", ["A", "A"]], + [["A", "B", "C"], "D", ["D", "A", "B", "C"]], + ].each do |values, new_value, expected| + + describe "on #{values.inspect} with #{new_value.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.send(method, new_value) + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/construction_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/construction_spec.rb new file mode 100644 index 000000000..a4a67a823 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/construction_spec.rb @@ -0,0 +1,140 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster do + + describe ".list" do + + describe "with no arguments" do + + before do + @list = Hamster.list + end + + it "always returns the same instance" do + @list.should equal(Hamster.list) + end + + it "returns an empty list" do + @list.should be_empty + end + + end + + describe "with a number of items" do + + before do + @list = Hamster.list("A", "B", "C") + end + + it "always returns a different instance" do + @list.should_not equal(Hamster.list("A", "B", "C")) + end + + it "is the same as repeatedly using #cons" do + @list.should == Hamster.list.cons("C").cons("B").cons("A") + end + + end + + end + + describe ".stream" do + + describe "with no block" do + + before do + @list = Hamster.stream + end + + it "returns an empty list" do + @list.should == Hamster.list + end + + end + + describe "with a block" do + + before do + count = 0 + @list = Hamster.stream { count += 1 } + end + + it "repeatedly calls the block" do + @list.take(5).should == Hamster.list(1, 2, 3, 4, 5) + end + + end + + end + + [:interval, :range].each do |method| + + describe ".#{method}" do + + describe "for numbers" do + + before do + @list = Hamster.send(method, 98, 102) + end + + it "is equivalent to a list with explicit values" do + @list.should == Hamster.list(98, 99, 100, 101, 102) + end + + end + + describe "for strings" do + + before do + @list = Hamster.send(method, "A", "AA") + end + + it "is equivalent to a list with explicit values" do + @list.should == Hamster.list("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "AA") + end + + end + + end + + end + + describe ".repeat" do + + before do + @list = Hamster.repeat("A") + end + + it "returns an infinite list with specified value for each element" do + @list.take(5).should == Hamster.list("A", "A", "A", "A", "A") + end + + end + + describe ".replicate" do + + before do + @list = Hamster.replicate(5, "A") + end + + it "returns a list with the specified value repeated the specified number of times" do + @list.should == Hamster.list("A", "A", "A", "A", "A") + end + + end + + describe ".iterate" do + + before do + @list = Hamster.iterate(1) { |item| item * 2 } + end + + it "returns an infinite list where the first item is calculated by applying the block on the initial argument, the second item by applying the function on the previous result and so on" do + @list.take(10).should == Hamster.list(1, 2, 4, 8, 16, 32, 64, 128, 256, 512) + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/copying_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/copying_spec.rb new file mode 100644 index 000000000..e907774ca --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/copying_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:dup, :clone].each do |method| + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.send(method) + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/count_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/count_spec.rb new file mode 100644 index 000000000..0f7ff90a9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/count_spec.rb @@ -0,0 +1,66 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#count" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.count }.should_not raise_error + end + + end + + [ + [[], 0], + [[1], 1], + [[1, 2], 1], + [[1, 2, 3], 2], + [[1, 2, 3, 4], 2], + [[1, 2, 3, 4, 5], 3], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + end + + describe "with a block" do + + before do + @result = @original.count(&:odd?) + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + describe "without a block" do + + before do + @result = @original.count + end + + it "returns length" do + @result.should == @original.length + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/app.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/app.js new file mode 100644 index 000000000..1a6902ba5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/app.js @@ -0,0 +1,66 @@ +$(document).ready(function() { + $('.file_list').dataTable({ + "aaSorting": [[ 1, "asc" ]], + "bPaginate": false, + "bJQueryUI": true, + "aoColumns": [ + null, + { "sType": "percent" }, + null, + null, + null, + null + ] + }); + + $('.source_table tbody tr:odd').addClass('odd'); + $('.source_table tbody tr:even').addClass('even'); + + $("a.src_link").fancybox({ + 'hideOnContentClick': true + }); + + // Hide src files and file list container + $('.source_files').hide(); + $('.file_list_container').hide(); + + // Add tabs based upon existing file_list_containers + $('.file_list_container h2').each(function(){ + $('.group_tabs').append('
  • ' + $(this).html() + '
  • '); + }); + + $('.group_tabs a').each( function() { + $(this).addClass($(this).attr('href').replace('#', '')); + }); + + $('.group_tabs a').live('focus', function() { + $(this).blur(); + }); + + var favicon_path = $('link[rel="shortcut icon"]').attr('href') + $('.group_tabs a').live('click', function(){ + if (!$(this).parent().hasClass('active')) { + $('.group_tabs a').parent().removeClass('active'); + $(this).parent().addClass('active'); + $('.file_list_container').hide(); + $(".file_list_container" + $(this).attr('href')).show(); + window.location.href = window.location.href.split('#')[0] + $(this).attr('href').replace('#', '#_'); + + // Force favicon reload - otherwise the location change containing anchor would drop the favicon... + // Works only on firefox, but still... - Anyone know a better solution to force favicon? + $('link[rel="shortcut icon"]').remove(); + $('head').append(''); + }; + return false; + }); + + if (jQuery.url.attr('anchor')) { + $('.group_tabs a.'+jQuery.url.attr('anchor').replace('_', '')).click(); + } else { + $('.group_tabs a:first').click(); + }; + + $("abbr.timeago").timeago(); + $('#loading').fadeOut(); + $('#wrapper').show(); +}); diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/blank.gif b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/blank.gif new file mode 100644 index 000000000..35d42e808 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/blank.gif differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_close.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_close.png new file mode 100644 index 000000000..07035307a Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_close.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_loading.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_loading.png new file mode 100644 index 000000000..250301796 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_loading.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_nav_left.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_nav_left.png new file mode 100644 index 000000000..ebaa6a4fd Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_nav_left.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_nav_right.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_nav_right.png new file mode 100644 index 000000000..873294e96 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_nav_right.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_e.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_e.png new file mode 100644 index 000000000..2eda08936 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_e.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_n.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_n.png new file mode 100644 index 000000000..69aa10e23 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_n.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_ne.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_ne.png new file mode 100644 index 000000000..79f6980a3 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_ne.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_nw.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_nw.png new file mode 100644 index 000000000..7182cd938 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_nw.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_s.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_s.png new file mode 100644 index 000000000..d8858bfb7 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_s.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_se.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_se.png new file mode 100644 index 000000000..541e3ffd3 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_se.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_sw.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_sw.png new file mode 100644 index 000000000..b451689fa Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_sw.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_w.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_w.png new file mode 100644 index 000000000..8a4e4a887 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_w.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_title_left.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_title_left.png new file mode 100644 index 000000000..6049223d1 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_title_left.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_title_main.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_title_main.png new file mode 100644 index 000000000..8044271f2 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_title_main.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_title_over.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_title_over.png new file mode 100644 index 000000000..d9f458f4b Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_title_over.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_title_right.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_title_right.png new file mode 100644 index 000000000..e36d9db2a Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_title_right.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancybox-x.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancybox-x.png new file mode 100644 index 000000000..c2130f869 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancybox-x.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancybox-y.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancybox-y.png new file mode 100644 index 000000000..7ef399b99 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancybox-y.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancybox.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancybox.png new file mode 100644 index 000000000..65e14f68f Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/fancybox.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.css b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.css new file mode 100644 index 000000000..28bbb1327 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.css @@ -0,0 +1,363 @@ +/* + * FancyBox - jQuery Plugin + * Simple and fancy lightbox alternative + * + * Examples and documentation at: http://fancybox.net + * + * Copyright (c) 2008 - 2010 Janis Skarnelis + * + * Version: 1.3.1 (05/03/2010) + * Requires: jQuery v1.3+ + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ + +#fancybox-loading { + position: fixed; + top: 50%; + left: 50%; + height: 40px; + width: 40px; + margin-top: -20px; + margin-left: -20px; + cursor: pointer; + overflow: hidden; + z-index: 1104; + display: none; +} + +* html #fancybox-loading { /* IE6 */ + position: absolute; + margin-top: 0; +} + +#fancybox-loading div { + position: absolute; + top: 0; + left: 0; + width: 40px; + height: 480px; + background-image: url('fancybox.png'); +} + +#fancybox-overlay { + position: fixed; + top: 0; + left: 0; + bottom: 0; + right: 0; + background: #000; + z-index: 1100; + display: none; +} + +* html #fancybox-overlay { /* IE6 */ + position: absolute; + width: 100%; +} + +#fancybox-tmp { + padding: 0; + margin: 0; + border: 0; + overflow: auto; + display: none; +} + +#fancybox-wrap { + position: absolute; + top: 0; + left: 0; + margin: 0; + padding: 20px; + z-index: 1101; + display: none; +} + +#fancybox-outer { + position: relative; + width: 100%; + height: 100%; + background: #FFF; +} + +#fancybox-inner { + position: absolute; + top: 0; + left: 0; + width: 1px; + height: 1px; + padding: 0; + margin: 0; + outline: none; + overflow: hidden; +} + +#fancybox-hide-sel-frame { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: transparent; +} + +#fancybox-close { + position: absolute; + top: -15px; + right: -15px; + width: 30px; + height: 30px; + background-image: url('fancybox.png'); + background-position: -40px 0px; + cursor: pointer; + z-index: 1103; + display: none; +} + +#fancybox_error { + color: #444; + font: normal 12px/20px Arial; + padding: 7px; + margin: 0; +} + +#fancybox-content { + height: auto; + width: auto; + padding: 0; + margin: 0; +} + +#fancybox-img { + width: 100%; + height: 100%; + padding: 0; + margin: 0; + border: none; + outline: none; + line-height: 0; + vertical-align: top; + -ms-interpolation-mode: bicubic; +} + +#fancybox-frame { + position: relative; + width: 100%; + height: 100%; + border: none; + display: block; +} + +#fancybox-title { + position: absolute; + bottom: 0; + left: 0; + font-family: Arial; + font-size: 12px; + z-index: 1102; +} + +.fancybox-title-inside { + padding: 10px 0; + text-align: center; + color: #333; +} + +.fancybox-title-outside { + padding-top: 5px; + color: #FFF; + text-align: center; + font-weight: bold; +} + +.fancybox-title-over { + color: #FFF; + text-align: left; +} + +#fancybox-title-over { + padding: 10px; + background-image: url('fancy_title_over.png'); + display: block; +} + +#fancybox-title-wrap { + display: inline-block; +} + +#fancybox-title-wrap span { + height: 32px; + float: left; +} + +#fancybox-title-left { + padding-left: 15px; + background-image: url('fancybox.png'); + background-position: -40px -90px; + background-repeat: no-repeat; +} + +#fancybox-title-main { + font-weight: bold; + line-height: 29px; + background-image: url('fancybox-x.png'); + background-position: 0px -40px; + color: #FFF; +} + +#fancybox-title-right { + padding-left: 15px; + background-image: url('fancybox.png'); + background-position: -55px -90px; + background-repeat: no-repeat; +} + +#fancybox-left, #fancybox-right { + position: absolute; + bottom: 0px; + height: 100%; + width: 35%; + cursor: pointer; + outline: none; + background-image: url('blank.gif'); + z-index: 1102; + display: none; +} + +#fancybox-left { + left: 0px; +} + +#fancybox-right { + right: 0px; +} + +#fancybox-left-ico, #fancybox-right-ico { + position: absolute; + top: 50%; + left: -9999px; + width: 30px; + height: 30px; + margin-top: -15px; + cursor: pointer; + z-index: 1102; + display: block; +} + +#fancybox-left-ico { + background-image: url('fancybox.png'); + background-position: -40px -30px; +} + +#fancybox-right-ico { + background-image: url('fancybox.png'); + background-position: -40px -60px; +} + +#fancybox-left:hover, #fancybox-right:hover { + visibility: visible; /* IE6 */ +} + +#fancybox-left:hover span { + left: 20px; +} + +#fancybox-right:hover span { + left: auto; + right: 20px; +} + +.fancy-bg { + position: absolute; + padding: 0; + margin: 0; + border: 0; + width: 20px; + height: 20px; + z-index: 1001; +} + +#fancy-bg-n { + top: -20px; + left: 0; + width: 100%; + background-image: url('fancybox-x.png'); +} + +#fancy-bg-ne { + top: -20px; + right: -20px; + background-image: url('fancybox.png'); + background-position: -40px -162px; +} + +#fancy-bg-e { + top: 0; + right: -20px; + height: 100%; + background-image: url('fancybox-y.png'); + background-position: -20px 0px; +} + +#fancy-bg-se { + bottom: -20px; + right: -20px; + background-image: url('fancybox.png'); + background-position: -40px -182px; +} + +#fancy-bg-s { + bottom: -20px; + left: 0; + width: 100%; + background-image: url('fancybox-x.png'); + background-position: 0px -20px; +} + +#fancy-bg-sw { + bottom: -20px; + left: -20px; + background-image: url('fancybox.png'); + background-position: -40px -142px; +} + +#fancy-bg-w { + top: 0; + left: -20px; + height: 100%; + background-image: url('fancybox-y.png'); +} + +#fancy-bg-nw { + top: -20px; + left: -20px; + background-image: url('fancybox.png'); + background-position: -40px -122px; +} + +/* IE */ + +#fancybox-loading.fancybox-ie div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_loading.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_close.png', sizingMethod='scale'); } + +.fancybox-ie #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_over.png', sizingMethod='scale'); zoom: 1; } +.fancybox-ie #fancybox-title-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_left.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-title-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_main.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-title-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_right.png', sizingMethod='scale'); } + +.fancybox-ie #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_left.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_right.png', sizingMethod='scale'); } + +.fancybox-ie .fancy-bg { background: transparent !important; } + +.fancybox-ie #fancy-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_n.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_ne.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_e.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_se.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_s.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_sw.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_w.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_nw.png', sizingMethod='scale'); } diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.pack.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.pack.js new file mode 100644 index 000000000..8421d53a6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.pack.js @@ -0,0 +1,44 @@ +/* + * FancyBox - jQuery Plugin + * Simple and fancy lightbox alternative + * + * Examples and documentation at: http://fancybox.net + * + * Copyright (c) 2008 - 2010 Janis Skarnelis + * + * Version: 1.3.1 (05/03/2010) + * Requires: jQuery v1.3+ + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ + +(function(b){var m,u,x,g,D,i,z,A,B,p=0,e={},q=[],n=0,c={},j=[],E=null,s=new Image,G=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,S=/[^\.]\.(swf)\s*$/i,H,I=1,k,l,h=false,y=b.extend(b("
    ")[0],{prop:0}),v=0,O=!b.support.opacity&&!window.XMLHttpRequest,J=function(){u.hide();s.onerror=s.onload=null;E&&E.abort();m.empty()},P=function(){b.fancybox('

    The requested content cannot be loaded.
    Please try again later.

    ',{scrolling:"no",padding:20,transitionIn:"none",transitionOut:"none"})}, +K=function(){return[b(window).width(),b(window).height(),b(document).scrollLeft(),b(document).scrollTop()]},T=function(){var a=K(),d={},f=c.margin,o=c.autoScale,t=(20+f)*2,w=(20+f)*2,r=c.padding*2;if(c.width.toString().indexOf("%")>-1){d.width=a[0]*parseFloat(c.width)/100-40;o=false}else d.width=c.width+r;if(c.height.toString().indexOf("%")>-1){d.height=a[1]*parseFloat(c.height)/100-40;o=false}else d.height=c.height+r;if(o&&(d.width>a[0]-t||d.height>a[1]-w))if(e.type=="image"||e.type=="swf"){t+=r; +w+=r;o=Math.min(Math.min(a[0]-t,c.width)/c.width,Math.min(a[1]-w,c.height)/c.height);d.width=Math.round(o*(d.width-r))+r;d.height=Math.round(o*(d.height-r))+r}else{d.width=Math.min(d.width,a[0]-t);d.height=Math.min(d.height,a[1]-w)}d.top=a[3]+(a[1]-(d.height+40))*0.5;d.left=a[2]+(a[0]-(d.width+40))*0.5;if(c.autoScale===false){d.top=Math.max(a[3]+f,d.top);d.left=Math.max(a[2]+f,d.left)}return d},U=function(a){if(a&&a.length)switch(c.titlePosition){case "inside":return a;case "over":return''+ +a+"";default:return''+a+''}return false},V=function(){var a=c.title,d=l.width-c.padding*2,f="fancybox-title-"+c.titlePosition;b("#fancybox-title").remove();v=0;if(c.titleShow!==false){a=b.isFunction(c.titleFormat)?c.titleFormat(a,j,n,c):U(a);if(!(!a||a==="")){b('
    ').css({width:d,paddingLeft:c.padding, +paddingRight:c.padding}).html(a).appendTo("body");switch(c.titlePosition){case "inside":v=b("#fancybox-title").outerHeight(true)-c.padding;l.height+=v;break;case "over":b("#fancybox-title").css("bottom",c.padding);break;default:b("#fancybox-title").css("bottom",b("#fancybox-title").outerHeight(true)*-1);break}b("#fancybox-title").appendTo(D).hide()}}},W=function(){b(document).unbind("keydown.fb").bind("keydown.fb",function(a){if(a.keyCode==27&&c.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if(a.keyCode== +37){a.preventDefault();b.fancybox.prev()}else if(a.keyCode==39){a.preventDefault();b.fancybox.next()}});if(b.fn.mousewheel){g.unbind("mousewheel.fb");j.length>1&&g.bind("mousewheel.fb",function(a,d){a.preventDefault();h||d===0||(d>0?b.fancybox.prev():b.fancybox.next())})}if(c.showNavArrows){if(c.cyclic&&j.length>1||n!==0)A.show();if(c.cyclic&&j.length>1||n!=j.length-1)B.show()}},X=function(){var a,d;if(j.length-1>n){a=j[n+1].href;if(typeof a!=="undefined"&&a.match(G)){d=new Image;d.src=a}}if(n>0){a= +j[n-1].href;if(typeof a!=="undefined"&&a.match(G)){d=new Image;d.src=a}}},L=function(){i.css("overflow",c.scrolling=="auto"?c.type=="image"||c.type=="iframe"||c.type=="swf"?"hidden":"auto":c.scrolling=="yes"?"auto":"visible");if(!b.support.opacity){i.get(0).style.removeAttribute("filter");g.get(0).style.removeAttribute("filter")}b("#fancybox-title").show();c.hideOnContentClick&&i.one("click",b.fancybox.close);c.hideOnOverlayClick&&x.one("click",b.fancybox.close);c.showCloseButton&&z.show();W();b(window).bind("resize.fb", +b.fancybox.center);c.centerOnScroll?b(window).bind("scroll.fb",b.fancybox.center):b(window).unbind("scroll.fb");b.isFunction(c.onComplete)&&c.onComplete(j,n,c);h=false;X()},M=function(a){var d=Math.round(k.width+(l.width-k.width)*a),f=Math.round(k.height+(l.height-k.height)*a),o=Math.round(k.top+(l.top-k.top)*a),t=Math.round(k.left+(l.left-k.left)*a);g.css({width:d+"px",height:f+"px",top:o+"px",left:t+"px"});d=Math.max(d-c.padding*2,0);f=Math.max(f-(c.padding*2+v*a),0);i.css({width:d+"px",height:f+ +"px"});if(typeof l.opacity!=="undefined")g.css("opacity",a<0.5?0.5:a)},Y=function(a){var d=a.offset();d.top+=parseFloat(a.css("paddingTop"))||0;d.left+=parseFloat(a.css("paddingLeft"))||0;d.top+=parseFloat(a.css("border-top-width"))||0;d.left+=parseFloat(a.css("border-left-width"))||0;d.width=a.width();d.height=a.height();return d},Q=function(){var a=e.orig?b(e.orig):false,d={};if(a&&a.length){a=Y(a);d={width:a.width+c.padding*2,height:a.height+c.padding*2,top:a.top-c.padding-20,left:a.left-c.padding- +20}}else{a=K();d={width:1,height:1,top:a[3]+a[1]*0.5,left:a[2]+a[0]*0.5}}return d},N=function(){u.hide();if(g.is(":visible")&&b.isFunction(c.onCleanup))if(c.onCleanup(j,n,c)===false){b.event.trigger("fancybox-cancel");h=false;return}j=q;n=p;c=e;i.get(0).scrollTop=0;i.get(0).scrollLeft=0;if(c.overlayShow){O&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"}); +x.css({"background-color":c.overlayColor,opacity:c.overlayOpacity}).unbind().show()}l=T();V();if(g.is(":visible")){b(z.add(A).add(B)).hide();var a=g.position(),d;k={top:a.top,left:a.left,width:g.width(),height:g.height()};d=k.width==l.width&&k.height==l.height;i.fadeOut(c.changeFade,function(){var f=function(){i.html(m.contents()).fadeIn(c.changeFade,L)};b.event.trigger("fancybox-change");i.empty().css("overflow","hidden");if(d){i.css({top:c.padding,left:c.padding,width:Math.max(l.width-c.padding* +2,1),height:Math.max(l.height-c.padding*2-v,1)});f()}else{i.css({top:c.padding,left:c.padding,width:Math.max(k.width-c.padding*2,1),height:Math.max(k.height-c.padding*2,1)});y.prop=0;b(y).animate({prop:1},{duration:c.changeSpeed,easing:c.easingChange,step:M,complete:f})}})}else{g.css("opacity",1);if(c.transitionIn=="elastic"){k=Q();i.css({top:c.padding,left:c.padding,width:Math.max(k.width-c.padding*2,1),height:Math.max(k.height-c.padding*2,1)}).html(m.contents());g.css(k).show();if(c.opacity)l.opacity= +0;y.prop=0;b(y).animate({prop:1},{duration:c.speedIn,easing:c.easingIn,step:M,complete:L})}else{i.css({top:c.padding,left:c.padding,width:Math.max(l.width-c.padding*2,1),height:Math.max(l.height-c.padding*2-v,1)}).html(m.contents());g.css(l).fadeIn(c.transitionIn=="none"?0:c.speedIn,L)}}},F=function(){m.width(e.width);m.height(e.height);if(e.width=="auto")e.width=m.width();if(e.height=="auto")e.height=m.height();N()},Z=function(){h=true;e.width=s.width;e.height=s.height;b("").attr({id:"fancybox-img", +src:s.src,alt:e.title}).appendTo(m);N()},C=function(){J();var a=q[p],d,f,o,t,w;e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));o=a.title||b(a).title||e.title||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(o===""&&e.orig)o=e.orig.attr("alt");d=a.nodeName&&/^(?:javascript|#)/i.test(a.href)?e.href||null:e.href||a.href||null;if(e.type){f=e.type;if(!d)d=e.content}else if(e.content)f="html";else if(d)if(d.match(G))f= +"image";else if(d.match(S))f="swf";else if(b(a).hasClass("iframe"))f="iframe";else if(d.match(/#/)){a=d.substr(d.indexOf("#"));f=b(a).length>0?"inline":"ajax"}else f="ajax";else f="inline";e.type=f;e.href=d;e.title=o;if(e.autoDimensions&&e.type!=="iframe"&&e.type!=="swf"){e.width="auto";e.height="auto"}if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=false;e.enableEscapeButton=false;e.showCloseButton=false}if(b.isFunction(e.onStart))if(e.onStart(q,p,e)===false){h=false; +return}m.css("padding",20+e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(i.children())});switch(f){case "html":m.html(e.content);F();break;case "inline":b('
    ').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(i.children())}).bind("fancybox-cancel",function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity(); +s=new Image;s.onerror=function(){P()};s.onload=function(){s.onerror=null;s.onload=null;Z()};s.src=d;break;case "swf":t='';w="";b.each(e.swf,function(r,R){t+='';w+=" "+r+'="'+R+'"'});t+='";m.html(t); +F();break;case "ajax":a=d.split("#",2);f=e.ajax.data||{};if(a.length>1){d=a[0];if(typeof f=="string")f+="&selector="+a[1];else f.selector=a[1]}h=false;b.fancybox.showActivity();E=b.ajax(b.extend(e.ajax,{url:d,data:f,error:P,success:function(r){if(E.status==200){m.html(r);F()}}}));break;case "iframe":b('').appendTo(m);N();break}},$=function(){if(u.is(":visible")){b("div", +u).css("top",I*-40+"px");I=(I+1)%12}else clearInterval(H)},aa=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('
    '),u=b('
    '),x=b('
    '),g=b('
    '));if(!b.support.opacity){g.addClass("fancybox-ie");u.addClass("fancybox-ie")}D=b('
    ').append('
    ').appendTo(g); +D.append(i=b('
    '),z=b(''),A=b(''),B=b(''));z.click(b.fancybox.close);u.click(b.fancybox.cancel);A.click(function(a){a.preventDefault();b.fancybox.prev()});B.click(function(a){a.preventDefault();b.fancybox.next()});if(O){x.get(0).style.setExpression("height", +"document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'");u.get(0).style.setExpression("top","(-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'");D.prepend('')}}}; +b.fn.fancybox=function(a){b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(d){d.preventDefault();if(!h){h=true;b(this).blur();q=[];p=0;d=b(this).attr("rel")||"";if(!d||d==""||d==="nofollow")q.push(this);else{q=b("a[rel="+d+"], area[rel="+d+"]");p=q.index(this)}C();return false}});return this};b.fancybox=function(a,d){if(!h){h=true;d=typeof d!=="undefined"?d:{};q=[];p=d.index||0;if(b.isArray(a)){for(var f=0,o=a.length;fq.length||p<0)p=0;C()}};b.fancybox.showActivity=function(){clearInterval(H);u.show();H=setInterval($,66)};b.fancybox.hideActivity=function(){u.hide()};b.fancybox.next=function(){return b.fancybox.pos(n+1)};b.fancybox.prev=function(){return b.fancybox.pos(n- +1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a,10);if(a>-1&&j.length>a){p=a;C()}if(c.cyclic&&j.length>1&&a<0){p=j.length-1;C()}if(c.cyclic&&j.length>1&&a>=j.length){p=0;C()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");J();e&&b.isFunction(e.onCancel)&&e.onCancel(q,p,e);h=false}};b.fancybox.close=function(){function a(){x.fadeOut("fast");g.hide();b.event.trigger("fancybox-cleanup");i.empty();b.isFunction(c.onClosed)&&c.onClosed(j,n,c);j=e=[];n=p=0;c=e={};h=false} +if(!(h||g.is(":hidden"))){h=true;if(c&&b.isFunction(c.onCleanup))if(c.onCleanup(j,n,c)===false){h=false;return}J();b(z.add(A).add(B)).hide();b("#fancybox-title").remove();g.add(i).add(x).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");i.css("overflow","hidden");if(c.transitionOut=="elastic"){k=Q();var d=g.position();l={top:d.top,left:d.left,width:g.width(),height:g.height()};if(c.opacity)l.opacity=1;y.prop=1;b(y).animate({prop:0},{duration:c.speedOut,easing:c.easingOut, +step:M,complete:a})}else g.fadeOut(c.transitionOut=="none"?0:c.speedOut,a)}};b.fancybox.resize=function(){var a,d;if(!(h||g.is(":hidden"))){h=true;a=i.wrapInner("
    ").children();d=a.height();g.css({height:d+c.padding*2+v});i.css({height:d});a.replaceWith(a.children());b.fancybox.center()}};b.fancybox.center=function(){h=true;var a=K(),d=c.margin,f={};f.top=a[3]+(a[1]-(g.height()-v+40))*0.5;f.left=a[2]+(a[0]-(g.width()+40))*0.5;f.top=Math.max(a[3]+d,f.top);f.left=Math.max(a[2]+ +d,f.left);g.css(f);h=false};b.fn.fancybox.defaults={padding:10,margin:20,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.3,overlayColor:"#666",titleShow:true,titlePosition:"outside",titleFormat:null,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast", +easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,onStart:null,onCancel:null,onComplete:null,onCleanup:null,onClosed:null};b(document).ready(function(){aa()})})(jQuery); \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/favicon.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/favicon.png new file mode 100644 index 000000000..6bd0e1338 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/favicon.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/jquery-1.4.2.min.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/jquery-1.4.2.min.js new file mode 100644 index 000000000..b170a78f8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/jquery-1.4.2.min.js @@ -0,0 +1,155 @@ +/*! + * jQuery JavaScript Library v1.4.2 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Sat Feb 13 22:33:48 2010 -0500 + */ +(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, +Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& +(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, +a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== +"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, +function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
    a"; +var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, +parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= +false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= +s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, +applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; +else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, +a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== +w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, +cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= +c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); +a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, +function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); +k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), +C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= +e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& +f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; +if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", +e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, +"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, +d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, +e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); +t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| +g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, +CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, +g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, +text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, +setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= +h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== +"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, +h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& +q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; +if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

    ";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); +(function(){var g=s.createElement("div");g.innerHTML="
    ";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: +function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= +{},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== +"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", +d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? +a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== +1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
    ","
    "];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, +""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); +return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", +""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= +c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? +c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= +function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= +Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, +"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= +a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= +a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== +"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
    ").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, +serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), +function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, +global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& +e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? +"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== +false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= +false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", +c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| +d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); +g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== +1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== +"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; +if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== +"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| +c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; +this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= +this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, +e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
    "; +a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); +c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, +d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- +f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": +"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in +e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/jquery.dataTables.min.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/jquery.dataTables.min.js new file mode 100644 index 000000000..b5ee8585d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/jquery.dataTables.min.js @@ -0,0 +1,152 @@ +/* + * File: jquery.dataTables.min.js + * Version: 1.7.0 + * Author: Allan Jardine (www.sprymedia.co.uk) + * Info: www.datatables.net + * + * Copyright 2008-2010 Allan Jardine, all rights reserved. + * + * This source file is free software, under either the GPL v2 license or a + * BSD style license, as supplied with this software. + * + * This source file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. + */ +(function(j,Y,p){j.fn.dataTableSettings=[];var E=j.fn.dataTableSettings;j.fn.dataTableExt={};var m=j.fn.dataTableExt;m.sVersion="1.7.0";m.sErrMode="alert";m.iApiIndex=0;m.oApi={};m.afnFiltering=[];m.aoFeatures=[];m.ofnSearch={};m.afnSortData=[];m.oStdClasses={sPagePrevEnabled:"paginate_enabled_previous",sPagePrevDisabled:"paginate_disabled_previous",sPageNextEnabled:"paginate_enabled_next",sPageNextDisabled:"paginate_disabled_next",sPageJUINext:"",sPageJUIPrev:"",sPageButton:"paginate_button",sPageButtonActive:"paginate_active", +sPageButtonStaticDisabled:"paginate_button",sPageFirst:"first",sPagePrevious:"previous",sPageNext:"next",sPageLast:"last",sStripOdd:"odd",sStripEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled", +sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:""};m.oJUIClasses={sPagePrevEnabled:"fg-button ui-state-default ui-corner-left",sPagePrevDisabled:"fg-button ui-state-default ui-corner-left ui-state-disabled", +sPageNextEnabled:"fg-button ui-state-default ui-corner-right",sPageNextDisabled:"fg-button ui-state-default ui-corner-right ui-state-disabled",sPageJUINext:"ui-icon ui-icon-circle-arrow-e",sPageJUIPrev:"ui-icon ui-icon-circle-arrow-w",sPageButton:"fg-button ui-state-default",sPageButtonActive:"fg-button ui-state-default ui-state-disabled",sPageButtonStaticDisabled:"fg-button ui-state-default ui-state-disabled",sPageFirst:"first ui-corner-tl ui-corner-bl",sPagePrevious:"previous",sPageNext:"next", +sPageLast:"last ui-corner-tr ui-corner-br",sStripOdd:"odd",sStripEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate fg-buttonset fg-buttonset-multi paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"ui-state-default",sSortDesc:"ui-state-default",sSortable:"ui-state-default",sSortableAsc:"ui-state-default",sSortableDesc:"ui-state-default",sSortableNone:"ui-state-default", +sSortColumn:"sorting_",sSortJUIAsc:"css_right ui-icon ui-icon-triangle-1-n",sSortJUIDesc:"css_right ui-icon ui-icon-triangle-1-s",sSortJUI:"css_right ui-icon ui-icon-carat-2-n-s",sSortJUIAscAllowed:"css_right ui-icon ui-icon-carat-1-n",sSortJUIDescAllowed:"css_right ui-icon ui-icon-carat-1-s",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead ui-state-default",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot ui-state-default", +sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:"ui-state-default"};m.oPagination={two_button:{fnInit:function(g,l,q){var r,u,y;if(g.bJUI){r=p.createElement("a");u=p.createElement("a");y=p.createElement("span");y.className=g.oClasses.sPageJUINext;u.appendChild(y);y=p.createElement("span");y.className=g.oClasses.sPageJUIPrev;r.appendChild(y)}else{r=p.createElement("div");u=p.createElement("div")}r.className=g.oClasses.sPagePrevDisabled;u.className=g.oClasses.sPageNextDisabled;r.title=g.oLanguage.oPaginate.sPrevious; +u.title=g.oLanguage.oPaginate.sNext;l.appendChild(r);l.appendChild(u);j(r).click(function(){g.oApi._fnPageChange(g,"previous")&&q(g)});j(u).click(function(){g.oApi._fnPageChange(g,"next")&&q(g)});j(r).bind("selectstart",function(){return false});j(u).bind("selectstart",function(){return false});if(g.sTableId!==""&&typeof g.aanFeatures.p=="undefined"){l.setAttribute("id",g.sTableId+"_paginate");r.setAttribute("id",g.sTableId+"_previous");u.setAttribute("id",g.sTableId+"_next")}},fnUpdate:function(g){if(g.aanFeatures.p)for(var l= +g.aanFeatures.p,q=0,r=l.length;q=u-r){r=u-q+1;w=u}else{r=y-Math.ceil(q/2)+1;w=r+q-1}for(q=r;q<=w;q++)C+=y!=q?''+q+"":''+q+"";w=g.aanFeatures.p;var z,D=function(){g._iDisplayStart= +(this.innerHTML*1-1)*g._iDisplayLength;l(g);return false},L=function(){return false};q=0;for(r=w.length;ql?1:0},"string-desc":function(g,l){g=g.toLowerCase();l=l.toLowerCase();return gl?-1:0},"html-asc":function(g,l){g=g.replace(/<.*?>/g,"").toLowerCase(); +l=l.replace(/<.*?>/g,"").toLowerCase();return gl?1:0},"html-desc":function(g,l){g=g.replace(/<.*?>/g,"").toLowerCase();l=l.replace(/<.*?>/g,"").toLowerCase();return gl?-1:0},"date-asc":function(g,l){g=Date.parse(g);l=Date.parse(l);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(l)||l==="")l=Date.parse("01/01/1970 00:00:00");return g-l},"date-desc":function(g,l){g=Date.parse(g);l=Date.parse(l);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(l)||l=== +"")l=Date.parse("01/01/1970 00:00:00");return l-g},"numeric-asc":function(g,l){return(g=="-"||g===""?0:g*1)-(l=="-"||l===""?0:l*1)},"numeric-desc":function(g,l){return(l=="-"||l===""?0:l*1)-(g=="-"||g===""?0:g*1)}};m.aTypes=[function(g){if(g.length===0)return"numeric";var l,q=false;l=g.charAt(0);if("0123456789-".indexOf(l)==-1)return null;for(var r=1;r")!=-1)return"html";return null}];m.fnVersionCheck=function(g){var l=function(w,x){for(;w.length=parseInt(u,10)};m._oExternConfig={iNextUnique:0};j.fn.dataTable=function(g){function l(){this.fnRecordsTotal=function(){return this.oFeatures.bServerSide? +this._iRecordsTotal:this.aiDisplayMaster.length};this.fnRecordsDisplay=function(){return this.oFeatures.bServerSide?this._iRecordsDisplay:this.aiDisplay.length};this.fnDisplayEnd=function(){return this.oFeatures.bServerSide?this.oFeatures.bPaginate===false?this._iDisplayStart+this.aiDisplay.length:Math.min(this._iDisplayStart+this._iDisplayLength,this._iDisplayStart+this.aiDisplay.length):this._iDisplayEnd};this.sInstance=this.oInstance=null;this.oFeatures={bPaginate:true,bLengthChange:true,bFilter:true, +bSort:true,bInfo:true,bAutoWidth:true,bProcessing:false,bSortClasses:true,bStateSave:false,bServerSide:false};this.oScroll={sX:"",sXInner:"",sY:"",bCollapse:false,iBarWidth:0};this.aanFeatures=[];this.oLanguage={sProcessing:"Processing...",sLengthMenu:"Show _MENU_ entries",sZeroRecords:"No matching records found",sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)", +sInfoPostFix:"",sSearch:"Search:",sUrl:"",oPaginate:{sFirst:"First",sPrevious:"Previous",sNext:"Next",sLast:"Last"}};this.aoData=[];this.aiDisplay=[];this.aiDisplayMaster=[];this.aoColumns=[];this.iNextId=0;this.asDataSearch=[];this.oPreviousSearch={sSearch:"",bRegex:false,bSmart:true};this.aoPreSearchCols=[];this.aaSorting=[[0,"asc",0]];this.aaSortingFixed=null;this.asStripClasses=[];this.asDestoryStrips=[];this.fnFooterCallback=this.fnHeaderCallback=this.fnRowCallback=null;this.aoDrawCallback=[]; +this.fnInitComplete=null;this.sTableId="";this.nTableWrapper=this.nTBody=this.nTFoot=this.nTHead=this.nTable=null;this.iDefaultSortIndex=0;this.bInitialised=false;this.aoOpenRows=[];this.sDom="lfrtip";this.sPaginationType="two_button";this.iCookieDuration=7200;this.sCookiePrefix="SpryMedia_DataTables_";this.sAjaxSource=null;this.bAjaxDataGet=true;this.fnServerData=function(a,b,c){j.ajax({url:a,data:b,success:c,dataType:"json",cache:false,error:function(){alert("DataTables warning: JSON data from server failed to load or be parsed. This is most likely to be caused by a JSON formatting error.")}})}; +this.fnFormatNumber=function(a){if(a<1E3)return a;else{var b=a+"";a=b.split("");var c="";b=b.length;for(var d=0;d=a.fnRecordsDisplay()?0:a.iInitDisplayStart;a.iInitDisplayStart=-1;F(a)}if(!(a.oFeatures.bServerSide&&!oa(a))){if(a.aiDisplay.length!==0){var i=a._iDisplayStart,h=a._iDisplayEnd;if(a.oFeatures.bServerSide){i=0;h=a.aoData.length}for(i=i;itr",a.nTHead)[0],V(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);typeof a.fnFooterCallback=="function"&&a.fnFooterCallback.call(a.oInstance,j(">tr",a.nTFoot)[0],V(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);f= +p.createDocumentFragment();b=p.createDocumentFragment();if(a.nTBody){e=a.nTBody.parentNode;b.appendChild(a.nTBody);c=a.nTBody.childNodes;for(b=c.length-1;b>=0;b--)c[b].parentNode.removeChild(c[b]);b=0;for(c=d.length;bj(a.nTable.parentNode).width()&&U(a)}b=0;for(c=a.aoDrawCallback.length;b< +c;b++)a.aoDrawCallback[b].fn.call(a.oInstance,a);a.bSorted=false;a.bFiltered=false}}function L(a){if(a.oFeatures.bSort)O(a,a.oPreviousSearch);else if(a.oFeatures.bFilter)P(a,a.oPreviousSearch);else{F(a);D(a)}}function oa(a){if(a.bAjaxDataGet){K(a,true);var b=a.aoColumns.length,c=[],d;a.iDraw++;c.push({name:"sEcho",value:a.iDraw});c.push({name:"iColumns",value:b});c.push({name:"sColumns",value:aa(a)});c.push({name:"iDisplayStart",value:a._iDisplayStart});c.push({name:"iDisplayLength",value:a.oFeatures.bPaginate!== +false?a._iDisplayLength:-1});if(a.oFeatures.bFilter!==false){c.push({name:"sSearch",value:a.oPreviousSearch.sSearch});c.push({name:"bRegex",value:a.oPreviousSearch.bRegex});for(d=0;d")c=c.parentNode;else if(i=="l"&&a.oFeatures.bPaginate&&a.oFeatures.bLengthChange){f=ra(a);e=1}else if(i=="f"&&a.oFeatures.bFilter){f=sa(a);e=1}else if(i=="r"&&a.oFeatures.bProcessing){f=ta(a);e=1}else if(i=="t"){f=ua(a);e=1}else if(i=="i"&&a.oFeatures.bInfo){f=va(a);e=1}else if(i=="p"&&a.oFeatures.bPaginate){f=wa(a);e=1}else if(m.aoFeatures.length!==0){h=m.aoFeatures;k=0;for(o=h.length;kcaption",a.nTable);i=0;for(k=d.length;i0&&a.nTable.removeChild(i[0]);if(a.nTFoot!==null){k=a.nTable.getElementsByTagName("tfoot");k.length>0&&a.nTable.removeChild(k[0])}i= +a.nTHead.cloneNode(true);a.nTable.insertBefore(i,a.nTable.childNodes[0]);if(a.nTFoot!==null){k=a.nTFoot.cloneNode(true);a.nTable.insertBefore(k,a.nTable.childNodes[1])}var I=ca(i);f=0;for(e=I.length;ff-a.oScroll.iBarWidth)a.nTable.style.width=v(f)}else a.nTable.style.width=v(f);f=j(a.nTable).outerWidth();e=a.nTHead.getElementsByTagName("tr");i=i.getElementsByTagName("tr");M(function(A,G){o=A.style;o.paddingTop="0";o.paddingBottom="0";o.borderTopWidth="0";o.borderBottomWidth= +"0";o.height=0;s=j(A).width();G.style.width=v(s);H.push(s)},i,e);if(a.nTFoot!==null){h=k.getElementsByTagName("tr");k=a.nTFoot.getElementsByTagName("tr");M(function(A,G){o=A.style;o.paddingTop="0";o.paddingBottom="0";o.borderTopWidth="0";o.borderBottomWidth="0";s=j(A).width();G.style.width=v(s);H.push(s)},h,k)}M(function(A){A.innerHTML="";A.style.width=v(H.shift())},i);a.nTFoot!==null&&M(function(A){A.innerHTML="";A.style.width=v(H.shift())},h);if(j(a.nTable).outerWidth()d.offsetWidth?a.oScroll.iBarWidth:0;if(a.nTable.offsetHeight'; +var c=j("input",b);c.val(a.oPreviousSearch.sSearch.replace('"',"""));c.keyup(function(){for(var d=a.aanFeatures.f,f=0,e=d.length;f=0;d--){f=ga(a.aoData[a.aiDisplay[d]]._aData[c],a.aoColumns[c].sType);if(!b.test(f)){a.aiDisplay.splice(d, +1);e++}}}}function ya(a,b,c,d,f){var e=fa(b,d,f);if(typeof c=="undefined"||c===null)c=0;if(m.afnFiltering.length!==0)c=1;if(b.length<=0){a.aiDisplay.splice(0,a.aiDisplay.length);a.aiDisplay=a.aiDisplayMaster.slice()}else if(a.aiDisplay.length==a.aiDisplayMaster.length||a.oPreviousSearch.sSearch.length>b.length||c==1||b.indexOf(a.oPreviousSearch.sSearch)!==0){a.aiDisplay.splice(0,a.aiDisplay.length);Q(a,1);for(c=0;c/g,"");else if(typeof a=="string")return a.replace(/\n/g, +" ");return a}function O(a,b){var c=[],d=m.oSort,f=a.aoData,e,i,h,k;if(!a.oFeatures.bServerSide&&(a.aaSorting.length!==0||a.aaSortingFixed!==null)){c=a.aaSortingFixed!==null?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();for(h=0;h0){e=a.aoColumns[c[c.length-1][0]].iDataSort;i=a.aoColumns[e].sType;k+="iTest = oSort['"+i+"-"+c[c.length-1][1]+"']( aoData[a]._aData["+e+"], aoData[b]._aData["+e+"] );if (iTest===0) return oSort['numeric-"+c[c.length-1][1]+"'](a, b); return iTest;}";eval(k);a.aiDisplayMaster.sort(this.ClosureDataTables.fn)}this.ClosureDataTables=undefined}}if(typeof b=="undefined"||b)W(a);a.bSorted=true;if(a.oFeatures.bFilter)P(a, +a.oPreviousSearch,1);else{a.aiDisplay=a.aiDisplayMaster.slice();a._iDisplayStart=0;F(a);D(a)}}function $(a,b,c,d){j(b).click(function(f){if(a.aoColumns[c].bSortable!==false){var e=function(){var i,h;if(f.shiftKey){for(var k=false,o=0;o=i)for(b=0;b=0?a._iDisplayStart-a._iDisplayLength:0;if(a._iDisplayStart<0)a._iDisplayStart=0}else if(b=="next")if(a._iDisplayLength>=0){if(a._iDisplayStart+a._iDisplayLength=0){b=parseInt((a.fnRecordsDisplay()-1)/a._iDisplayLength,10)+1;a._iDisplayStart=(b-1)*a._iDisplayLength}else a._iDisplayStart=0;else J(a,0,"Unknown paging action: "+b);return c!=a._iDisplayStart}function va(a){var b=p.createElement("div");b.className=a.oClasses.sInfo;if(typeof a.aanFeatures.i=="undefined"){a.aoDrawCallback.push({fn:Ca,sName:"information"});a.sTableId!==""&&b.setAttribute("id",a.sTableId+"_info")}return b} +function Ca(a){if(!(!a.oFeatures.bInfo||a.aanFeatures.i.length===0)){var b=j(a.aanFeatures.i[0]),c=a.fnFormatNumber(a.fnRecordsTotal()),d=a.fnFormatNumber(a._iDisplayStart+1),f=a.fnFormatNumber(a.fnDisplayEnd()),e=a.fnFormatNumber(a.fnRecordsDisplay());if(a.fnRecordsDisplay()===0&&a.fnRecordsDisplay()==a.fnRecordsTotal())b.html(a.oLanguage.sInfoEmpty+a.oLanguage.sInfoPostFix);else if(a.fnRecordsDisplay()===0)b.html(a.oLanguage.sInfoEmpty+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",c)+a.oLanguage.sInfoPostFix); +else a.fnRecordsDisplay()==a.fnRecordsTotal()?b.html(a.oLanguage.sInfo.replace("_START_",d).replace("_END_",f).replace("_TOTAL_",e)+a.oLanguage.sInfoPostFix):b.html(a.oLanguage.sInfo.replace("_START_",d).replace("_END_",f).replace("_TOTAL_",e)+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()))+a.oLanguage.sInfoPostFix);a=a.aanFeatures.i;if(a.length>1){b=b.html();c=1;for(d=a.length;c",c,d;if(a.aLengthMenu.length==2&&typeof a.aLengthMenu[0]=="object"&&typeof a.aLengthMenu[1]=="object"){c=0;for(d=a.aLengthMenu[0].length;c'+a.aLengthMenu[1][c]+""}else{c=0;for(d=a.aLengthMenu.length;c'+a.aLengthMenu[c]+""}b+="";var f=p.createElement("div");a.sTableId!==""&&typeof a.aanFeatures.l=="undefined"&&f.setAttribute("id",a.sTableId+ +"_length");f.className=a.oClasses.sLength;f.innerHTML=a.oLanguage.sLengthMenu.replace("_MENU_",b);j('select option[value="'+a._iDisplayLength+'"]',f).attr("selected",true);j("select",f).change(function(){var e=j(this).val(),i=a.aanFeatures.l;c=0;for(d=i.length;ca.aiDisplay.length||a._iDisplayLength==-1?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength}function Da(a,b){if(!a||a===null||a==="")return 0;if(typeof b=="undefined")b=p.getElementsByTagName("body")[0];var c=p.createElement("div");c.style.width=a;b.appendChild(c);a=c.offsetWidth;b.removeChild(c);return a}function ea(a){var b=0,c,d=0,f=a.aoColumns.length,e,i=j("th",a.nTHead);for(e= +0;etd",b);e.each(function(h){this.style.width="";h=da(a,h);if(h!==null&&a.aoColumns[h].sWidthOrig!=="")this.style.width=a.aoColumns[h].sWidthOrig});for(e=0;etd",b);if(f.length===0)f=j("thead tr:eq(0)>th",b);for(e=c=0;e0)a.aoColumns[e].sWidth=v(d);c++}a.nTable.style.width=v(j(b).outerWidth());b.parentNode.removeChild(b)}}function ia(a,b){if(a.oScroll.sX===""&&a.oScroll.sY!== +""){j(b).width();b.style.width=v(j(b).outerWidth()-a.oScroll.iBarWidth)}else if(a.oScroll.sX!=="")b.style.width=v(j(b).outerWidth())}function Ea(a,b,c){if(typeof c=="undefined"||c){c=Fa(a,b);b=N(a,b);if(c<0)return null;return a.aoData[c].nTr.getElementsByTagName("td")[b]}var d=-1,f,e;c=-1;var i=p.createElement("div");i.style.visibility="hidden";i.style.position="absolute";p.body.appendChild(i);f=0;for(e=a.aoData.length;fd){d=i.offsetWidth; +c=f}}p.body.removeChild(i);if(c>=0){b=N(a,b);if(a=a.aoData[c].nTr.getElementsByTagName("td")[b])return a}return null}function Fa(a,b){for(var c=0,d=-1,f=0;fc){c=e.length;d=f}}return d}function v(a){if(a===null)return"0px";if(typeof a=="number")return a+"px";if(a.indexOf("em")!=-1||a.indexOf("%")!=-1||a.indexOf("ex")!=-1||a.indexOf("px")!=-1)return a;return a+"px"}function La(a,b){if(a.length!=b.length)return 1;for(var c=0;cb&&a[d]--;c!=-1&&a.splice(c,1)}function qa(a,b){b=b.split(",");for(var c=[],d=0,f=a.aoColumns.length;d< +f;d++)for(var e=0;e4096){e=p.cookie.split(";");for(var h=0,k=e.length;h=d.aiDisplay.length){d._iDisplayStart-=d._iDisplayLength;if(d._iDisplayStart<0)d._iDisplayStart=0}if(typeof c=="undefined"||c){F(d);D(d)}return f};this.fnClearTable=function(a){var b=B(this[m.iApiIndex]);ba(b);if(typeof a=="undefined"||a)D(b)};this.fnOpen=function(a,b,c){var d=B(this[m.iApiIndex]);this.fnClose(a);var f=p.createElement("tr"),e=p.createElement("td");f.appendChild(e);e.className=c;e.colSpan=T(d);e.innerHTML=b;b=j("tr",d.nTBody);j.inArray(a,b)!=-1&&j(f).insertAfter(a); +d.aoOpenRows.push({nTr:f,nParent:a});return f};this.fnClose=function(a){for(var b=B(this[m.iApiIndex]),c=0;ctr",c.nTHead)[0];var h=j(">tr",c.nTFoot)[0],k=[],o=[];for(d=0;d< +f;d++){k.push(c.aoColumns[d].nTh);o.push(c.aoColumns[d].nTf)}if(b){for(d=b=0;d=T(c)){e.appendChild(k[a]);h&&h.appendChild(o[a]);d=0;for(f=c.aoData.length;dtd:eq("+i+")",c.aoData[d].nTr)[0])}}c.aoColumns[a].bVisible=true}else{e.removeChild(k[a]);h&&h.removeChild(o[a]);i=X(c);d=0;for(f=c.aoData.length;dtr:even",c).addClass(a.asDestoryStrips[0]);j(">tr:odd",c).addClass(a.asDestoryStrips[1]);b=0;for(d=E.length;bt<"F"ip>'}if(e.oScroll.sX!== +""||e.oScroll.sY!=="")e.oScroll.iBarWidth=Ja();if(typeof g.iDisplayStart!="undefined"&&typeof e.iInitDisplayStart=="undefined"){e.iInitDisplayStart=g.iDisplayStart;e._iDisplayStart=g.iDisplayStart}if(typeof g.bStateSave!="undefined"){e.oFeatures.bStateSave=g.bStateSave;Ia(e,g);e.aoDrawCallback.push({fn:Ga,sName:"state_save"})}if(typeof g.aaData!="undefined")h=true;if(typeof g!="undefined"&&typeof g.aoData!="undefined")g.aoColumns=g.aoData;if(typeof g.oLanguage!="undefined")if(typeof g.oLanguage.sUrl!= +"undefined"&&g.oLanguage.sUrl!==""){e.oLanguage.sUrl=g.oLanguage.sUrl;j.getJSON(e.oLanguage.sUrl,null,function(o){u(e,o,true)});i=true}else u(e,g.oLanguage,false)}else g={};if(typeof g.asStripClasses=="undefined"){e.asStripClasses.push(e.oClasses.sStripOdd);e.asStripClasses.push(e.oClasses.sStripEven)}c=false;d=j("tbody>tr",this);a=0;for(b=e.asStripClasses.length;a=0;a--){k=g.aoColumnDefs[a].aTargets;c=0;for(d=k.length;c=0){for(;e.aoColumns.length<=k[c];)y(e);C(e,k[c],g.aoColumnDefs[a])}else if(typeof k[c]=="number"&&k[c]<0)C(e,e.aoColumns.length+k[c],g.aoColumnDefs[a]);else if(typeof k[c]=="string"){b= +0;for(f=e.aoColumns.length;b0)e.nTFoot=this.getElementsByTagName("tfoot")[0];if(h)for(a=0;a y) ? 1 : 0)); +}; + +jQuery.fn.dataTableExt.oSort['percent-desc'] = function(a,b) { + var x = (a == "-") ? 0 : a.replace( /%/, "" ); + var y = (b == "-") ? 0 : b.replace( /%/, "" ); + x = parseFloat( x ); + y = parseFloat( y ); + return ((x < y) ? 1 : ((x > y) ? -1 : 0)); +}; \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/jquery.timeago.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/jquery.timeago.js new file mode 100644 index 000000000..0ada770a9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/jquery.timeago.js @@ -0,0 +1,141 @@ +/* + * timeago: a jQuery plugin, version: 0.9 (2010-06-21) + * @requires jQuery v1.2.3 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008-2010, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.datetime(timestamp)); + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "ago", + suffixFromNow: "from now", + seconds: "less than a minute", + minute: "about a minute", + minutes: "%d minutes", + hour: "about an hour", + hours: "about %d hours", + day: "a day", + days: "%d days", + month: "about a month", + months: "%d months", + year: "about a year", + years: "%d years", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + distanceMillis = Math.abs(distanceMillis); + } + + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 48 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.floor(days)) || + days < 60 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.floor(days / 30)) || + years < 2 && substitute($l.year, 1) || + substitute($l.years, Math.floor(years)); + + return $.trim([prefix, words, suffix].join(" ")); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d\d\d/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + var isTime = $(elem).get(0).tagName.toLowerCase() == "time"; // $(elem).is("time"); + var iso8601 = isTime ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0) element.attr("title", text); + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +})(jQuery); diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/jquery.url.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/jquery.url.js new file mode 100644 index 000000000..d1715ebcd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/jquery.url.js @@ -0,0 +1,174 @@ +// JQuery URL Parser +// Written by Mark Perkins, mark@allmarkedup.com +// License: http://unlicense.org/ (i.e. do what you want with it!) + +jQuery.url = function() +{ + var segments = {}; + + var parsed = {}; + + /** + * Options object. Only the URI and strictMode values can be changed via the setters below. + */ + var options = { + + url : window.location, // default URI is the page in which the script is running + + strictMode: false, // 'loose' parsing by default + + key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], // keys available to query + + q: { + name: "queryKey", + parser: /(?:^|&)([^&=]*)=?([^&]*)/g + }, + + parser: { + strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, //less intuitive, more accurate to the specs + loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // more intuitive, fails on relative paths and deviates from specs + } + + }; + + /** + * Deals with the parsing of the URI according to the regex above. + * Written by Steven Levithan - see credits at top. + */ + var parseUri = function() + { + str = decodeURI( options.url ); + + var m = options.parser[ options.strictMode ? "strict" : "loose" ].exec( str ); + var uri = {}; + var i = 14; + + while ( i-- ) { + uri[ options.key[i] ] = m[i] || ""; + } + + uri[ options.q.name ] = {}; + uri[ options.key[12] ].replace( options.q.parser, function ( $0, $1, $2 ) { + if ($1) { + uri[options.q.name][$1] = $2; + } + }); + + return uri; + }; + + /** + * Returns the value of the passed in key from the parsed URI. + * + * @param string key The key whose value is required + */ + var key = function( key ) + { + if ( ! parsed.length ) + { + setUp(); // if the URI has not been parsed yet then do this first... + } + if ( key == "base" ) + { + if ( parsed.port !== null && parsed.port !== "" ) + { + return parsed.protocol+"://"+parsed.host+":"+parsed.port+"/"; + } + else + { + return parsed.protocol+"://"+parsed.host+"/"; + } + } + + return ( parsed[key] === "" ) ? null : parsed[key]; + }; + + /** + * Returns the value of the required query string parameter. + * + * @param string item The parameter whose value is required + */ + var param = function( item ) + { + if ( ! parsed.length ) + { + setUp(); // if the URI has not been parsed yet then do this first... + } + return ( parsed.queryKey[item] === null ) ? null : parsed.queryKey[item]; + }; + + /** + * 'Constructor' (not really!) function. + * Called whenever the URI changes to kick off re-parsing of the URI and splitting it up into segments. + */ + var setUp = function() + { + parsed = parseUri(); + + getSegments(); + }; + + /** + * Splits up the body of the URI into segments (i.e. sections delimited by '/') + */ + var getSegments = function() + { + var p = parsed.path; + segments = []; // clear out segments array + segments = parsed.path.length == 1 ? {} : ( p.charAt( p.length - 1 ) == "/" ? p.substring( 1, p.length - 1 ) : path = p.substring( 1 ) ).split("/"); + }; + + return { + + /** + * Sets the parsing mode - either strict or loose. Set to loose by default. + * + * @param string mode The mode to set the parser to. Anything apart from a value of 'strict' will set it to loose! + */ + setMode : function( mode ) + { + strictMode = mode == "strict" ? true : false; + return this; + }, + + /** + * Sets URI to parse if you don't want to to parse the current page's URI. + * Calling the function with no value for newUri resets it to the current page's URI. + * + * @param string newUri The URI to parse. + */ + setUrl : function( newUri ) + { + options.url = newUri === undefined ? window.location : newUri; + setUp(); + return this; + }, + + /** + * Returns the value of the specified URI segment. Segments are numbered from 1 to the number of segments. + * For example the URI http://test.com/about/company/ segment(1) would return 'about'. + * + * If no integer is passed into the function it returns the number of segments in the URI. + * + * @param int pos The position of the segment to return. Can be empty. + */ + segment : function( pos ) + { + if ( ! parsed.length ) + { + setUp(); // if the URI has not been parsed yet then do this first... + } + if ( pos === undefined ) + { + return segments.length; + } + return ( segments[pos] === "" || segments[pos] === undefined ) ? null : segments[pos]; + }, + + attr : key, // provides public access to private 'key' function - see above + + param : param // provides public access to private 'param' function - see above + + }; + +}(); \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/loading.gif b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/loading.gif new file mode 100644 index 000000000..3596a61f3 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/loading.gif differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/magnify.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/magnify.png new file mode 100644 index 000000000..6073b9530 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/magnify.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png new file mode 100644 index 000000000..5b5dab2ab Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_75_ffffff_40x100.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_75_ffffff_40x100.png new file mode 100644 index 000000000..ac8b229af Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_75_ffffff_40x100.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png new file mode 100644 index 000000000..ad3d6346e Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_65_ffffff_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_65_ffffff_1x400.png new file mode 100644 index 000000000..42ccba269 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_65_ffffff_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_dadada_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_dadada_1x400.png new file mode 100644 index 000000000..5a46b47cb Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_dadada_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png new file mode 100644 index 000000000..86c2baa65 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png new file mode 100644 index 000000000..4443fdc1a Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png new file mode 100644 index 000000000..7c9fa6c6e Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_222222_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_222222_256x240.png new file mode 100644 index 000000000..b273ff111 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_222222_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_2e83ff_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_2e83ff_256x240.png new file mode 100644 index 000000000..09d1cdc85 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_2e83ff_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_454545_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_454545_256x240.png new file mode 100644 index 000000000..59bd45b90 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_454545_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_888888_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_888888_256x240.png new file mode 100644 index 000000000..6d02426c1 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_888888_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_cd0a0a_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_cd0a0a_256x240.png new file mode 100644 index 000000000..2ab019b73 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_cd0a0a_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/jquery-ui-1.8.4.custom.css b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/jquery-ui-1.8.4.custom.css new file mode 100644 index 000000000..b8b2bbe50 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/smoothness/jquery-ui-1.8.4.custom.css @@ -0,0 +1,295 @@ +/* + * jQuery UI CSS Framework @VERSION + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + */ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute; left: -99999999px; } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } + + +/* + * jQuery UI CSS Framework @VERSION + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + * + * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px + */ + + +/* Component containers +----------------------------------*/ +.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; } +.ui-widget .ui-widget { font-size: 1em; } +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; } +.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; } +.ui-widget-content a { color: #222222; } +.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } +.ui-widget-header a { color: #222222; } + +/* Interaction states +----------------------------------*/ +.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; } +.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; } +.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; } +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; } +.ui-widget :active { outline: none; } + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; } +.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; } +.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } +.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); } +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } +.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } +.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); } +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); } + +/* positioning */ +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-off { background-position: -96px -144px; } +.ui-icon-radio-on { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-start { background-position: -80px -160px; } +/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; } +.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } +.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } +.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } +.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } +.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } + +/* Overlays */ +.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); } +.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; } \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/stylesheet.css b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/stylesheet.css new file mode 100644 index 000000000..9b50a9b05 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/assets/0.4.4/stylesheet.css @@ -0,0 +1,341 @@ +/* ----------------------------------------------------------------------- + + + Blueprint CSS Framework 0.9 + http://blueprintcss.org + + * Copyright (c) 2007-Present. See LICENSE for more info. + * See README for instructions on how to use Blueprint. + * For credits and origins, see AUTHORS. + * This is a compressed file. See the sources in the 'src' directory. + +----------------------------------------------------------------------- */ + +/* reset.css */ +html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;} +article, aside, dialog, figure, footer, header, hgroup, nav, section {display:block;} +body {line-height:1.5;} +table {border-collapse:separate;border-spacing:0;} +caption, th, td {text-align:left;font-weight:normal;} +table, td, th {vertical-align:middle;} +blockquote:before, blockquote:after, q:before, q:after {content:"";} +blockquote, q {quotes:"" "";} +a img {border:none;} + +/* typography.css */ +html {font-size:100.01%;} +body {font-size:82%;color:#222;background:#fff;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;} +h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;} +h1 {font-size:3em;line-height:1;margin-bottom:0.5em;} +h2 {font-size:2em;margin-bottom:0.75em;} +h3 {font-size:1.5em;line-height:1;margin-bottom:1em;} +h4 {font-size:1.2em;line-height:1.25;margin-bottom:1.25em;} +h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;} +h6 {font-size:1em;font-weight:bold;} +h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;} +p {margin:0 0 1.5em;} +p img.left {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;} +p img.right {float:right;margin:1.5em 0 1.5em 1.5em;} +a:focus, a:hover {color:#000;} +a {color:#009;text-decoration:underline;} +blockquote {margin:1.5em;color:#666;font-style:italic;} +strong {font-weight:bold;} +em, dfn {font-style:italic;} +dfn {font-weight:bold;} +sup, sub {line-height:0;} +abbr, acronym {border-bottom:1px dotted #666;} +address {margin:0 0 1.5em;font-style:italic;} +del {color:#666;} +pre {margin:1.5em 0;white-space:pre;} +pre, code, tt {font:1em 'andale mono', 'lucida console', monospace;line-height:1.5;} +li ul, li ol {margin:0;} +ul, ol {margin:0 1.5em 1.5em 0;padding-left:3.333em;} +ul {list-style-type:disc;} +ol {list-style-type:decimal;} +dl {margin:0 0 1.5em 0;} +dl dt {font-weight:bold;} +dd {margin-left:1.5em;} +table {margin-bottom:1.4em;width:100%;} +th {font-weight:bold;} +thead th {background:#c3d9ff;} +th, td, caption {padding:4px 10px 4px 5px;} +tr.even td {background:#efefef;} +tfoot {font-style:italic;} +caption {background:#eee;} +.small {font-size:.8em;margin-bottom:1.875em;line-height:1.875em;} +.large {font-size:1.2em;line-height:2.5em;margin-bottom:1.25em;} +.hide {display:none;} +.quiet {color:#666;} +.loud {color:#000;} +.highlight {background:#ff0;} +.added {background:#060;color:#fff;} +.removed {background:#900;color:#fff;} +.first {margin-left:0;padding-left:0;} +.last {margin-right:0;padding-right:0;} +.top {margin-top:0;padding-top:0;} +.bottom {margin-bottom:0;padding-bottom:0;} + +/* forms.css */ +label {font-weight:bold;} +fieldset {padding:1.4em;margin:0 0 1.5em 0;border:1px solid #ccc;} +legend {font-weight:bold;font-size:1.2em;} +input[type=text], input[type=password], input.text, input.title, textarea, select {background-color:#fff;border:1px solid #bbb;} +input[type=text]:focus, input[type=password]:focus, input.text:focus, input.title:focus, textarea:focus, select:focus {border-color:#666;} +input[type=text], input[type=password], input.text, input.title, textarea, select {margin:0.5em 0;} +input.text, input.title {width:300px;padding:5px;} +input.title {font-size:1.5em;} +textarea {width:390px;height:250px;padding:5px;} +input[type=checkbox], input[type=radio], input.checkbox, input.radio {position:relative;top:.25em;} +form.inline {line-height:3;} +form.inline p {margin-bottom:0;} +.error, .notice, .success {padding:.8em;margin-bottom:1em;border:2px solid #ddd;} +.error {background:#FBE3E4;color:#8a1f11;border-color:#FBC2C4;} +.notice {background:#FFF6BF;color:#514721;border-color:#FFD324;} +.success {background:#E6EFC2;color:#264409;border-color:#C6D880;} +.error a {color:#8a1f11;} +.notice a {color:#514721;} +.success a {color:#264409;} +.box {padding:1.5em;margin-bottom:1.5em;background:#E5ECF9;} +hr {background:#ddd;color:#ddd;clear:both;float:none;width:100%;height:.1em;margin:0 0 1.45em;border:none;} +hr.space {background:#fff;color:#fff;visibility:hidden;} +.clearfix:after, .container:after {content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden;} +.clearfix, .container {display:block;} +.clear {clear:both;} + +#loading { + position: fixed; + left: 40%; + top: 50%; +} + +a { + color: #600; + text-decoration: none; +} + +a:hover { + color: #900; + text-decoration: underline; +} + +body { + font-family: "Lucida Grande", Helvetica, "Helvetica Neue", Arial, sans-serif; + padding: 12px; + background-color: #333; +} + +h1, h2, h3, h4 { + color: #1C2324; + margin: 0; + padding: 0; + margin-bottom: 12px; +} + +table { + width: 100%; +} + +#content { + clear: left; + background-color: white; + border: 2px solid #ddd; + border-top: 8px solid #ddd; + padding: 18px; + -webkit-border-bottom-left-radius: 5px; + -webkit-border-bottom-right-radius: 5px; + -webkit-border-top-right-radius: 5px; + -moz-border-radius-bottomleft: 5px; + -moz-border-radius-bottomright: 5px; + -moz-border-radius-topright: 5px; + border-bottom-left-radius: 5px; + border-bottom-right-radius: 5px; + border-top-right-radius: 5px; +} + +.dataTables_filter, .dataTables_info { + padding: 2px 6px; +} + +abbr.timeago { + text-decoration: none; + border: none; + font-weight: bold; +} + +.timestamp { + float: right; + color: #ddd; +} + +.group_tabs { + list-style: none; + float: left; + margin: 0; + padding: 0; +} +.group_tabs li { + display: inline; + float: left; +} + +.group_tabs li a { + font-family: Helvetica, Arial, sans-serif; + display: block; + float: left; + text-decoration: none; + padding: 4px 8px; + background-color: #aaa; + background: -webkit-gradient(linear, 0 0, 0 bottom, from(#DDD), to(#aaa)); + background: -moz-linear-gradient(#DDD, #aaa); + background: linear-gradient(#DDD, #aaa); + text-shadow: #e5e5e5 1px 1px 0px; + border-bottom: none; + color: #333; + font-weight: bold; + margin-right: 8px; + border-top: 1px solid #efefef; + -webkit-border-top-left-radius: 2px; + -webkit-border-top-right-radius: 2px; + -moz-border-radius-topleft: 2px; + -moz-border-radius-topright: 2px; + border-top-left-radius: 2px; + border-top-right-radius: 2px; +} + +.group_tabs li a:hover { + background-color: #ccc; + background: -webkit-gradient(linear, 0 0, 0 bottom, from(#eee), to(#aaa)); + background: -moz-linear-gradient(#eee, #aaa); + background: linear-gradient(#eee, #aaa); +} + +.group_tabs li a:active { + padding-top: 5px; + padding-bottom: 3px; +} + +.group_tabs li.active a { + color: black; + text-shadow: #fff 1px 1px 0px; + background-color: #ddd; + background: -webkit-gradient(linear, 0 0, 0 bottom, from(#fff), to(#ddd)); + background: -moz-linear-gradient(#fff, #ddd); + background: linear-gradient(#fff, #ddd); +} + +.file_list { + margin-bottom: 18px; +} + +a.src_link { + background: url('./magnify.png') no-repeat left 50%; + padding-left: 18px; +} + +tr, td { + margin: 0; + padding: 0; +} + +th { + white-space: nowrap; +} + +th.ui-state-default { + cursor: pointer; +} + +th span.ui-icon { + float: left; +} + +td { + padding: 4px 8px; +} + +.source_table td { + padding: 2px 8px; +} + + +.source_table { + overflow: auto; +} + +.source_table table { + width: 95%; +} + +.source_table thead td { + background-color: white; +} + +.source_table thead th { + background-color: white; +} + +.source_table td.hits { + text-align: right; +} + +.source_table h3, .source_table h4 { + padding: 0; + margin: 0; + margin-bottom: 4px; +} + +td pre { + margin: 0; + padding: 0; + color: #222; + font-family: "Monaco", "Inconsolata", "Consolas", monospace; +} + +.line_number { + width: 20px; + font-weight: bold; +} + +#footer { + color: #ddd; + font-size: 12px; + font-weight: bold; + margin-top: 12px; + text-align: right; +} +#footer a { + color: #eee; + text-decoration: underline; +} +#footer a:hover { + color: #fff; + text-decoration: none; +} + +.green { + color: #090; +} +.red { + color: #900; +} +.yellow { + color: #da0; +} +.hit.odd td { + background-color: #bbdbb6; +} +.hit.even td { + background-color: #cde1c9; +} +.miss.odd td { + background-color: #f19683; +} +.miss.even td { + background-color: #efb5a8; +} +.never.odd td { + background-color: #efefef; +} +.never.even td { + background-color: #f4f4f4; +} \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/covered_percent b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/covered_percent new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/covered_percent @@ -0,0 +1 @@ +0 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/index.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/index.html new file mode 100644 index 000000000..894ab6b65 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/index.html @@ -0,0 +1,71 @@ + + + + Code coverage for List + + + + + + + + + + + + + + + +
    + loading +
    + + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/resultset.yml b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/resultset.yml new file mode 100644 index 000000000..f0ec42aa8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/coverage/resultset.yml @@ -0,0 +1,225 @@ +--- +"/tmp/textmate-command-50488.rb ": + :original_result: {} + + :created_at: 2011-04-07 07:19:26.366000 +10:00 +"/tmp/textmate-command-50541.rb ": + :original_result: {} + + :created_at: 2011-04-07 07:34:33.733000 +10:00 +"/tmp/textmate-command-50803.rb ": + :original_result: {} + + :created_at: 2011-04-07 07:33:43.780000 +10:00 +"/tmp/textmate-command-52586.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:21:49.550000 +10:00 +"/tmp/textmate-command-52618.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:09:25.856000 +10:00 +"/tmp/textmate-command-52647.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:10:40.595000 +10:00 +"/tmp/textmate-command-53439.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:24:47.457000 +10:00 +"/tmp/textmate-command-53471.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:23:28.155000 +10:00 +"/tmp/textmate-command-53542.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:25:41.648000 +10:00 +"/tmp/textmate-command-53717.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:42:39.470000 +10:00 +"/tmp/textmate-command-53749.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:37:45.005000 +10:00 +"/tmp/textmate-command-53792.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:36:12.708000 +10:00 +"/tmp/textmate-command-53808.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:40:27.899000 +10:00 +"/tmp/textmate-command-53879.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:40:19.329000 +10:00 +"/tmp/textmate-command-53922.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:40:25.642000 +10:00 +"/tmp/textmate-command-53945.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:45:07.593000 +10:00 +"/tmp/textmate-command-53973.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:31:04.745000 +10:00 +"/tmp/textmate-command-54115.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:41:11.360000 +10:00 +"/tmp/textmate-command-54165.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:34:39.531000 +10:00 +"/tmp/textmate-command-54196.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:43:40.667000 +10:00 +"/tmp/textmate-command-54230.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:37:05.387000 +10:00 +"/tmp/textmate-command-54246.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:41:19.794000 +10:00 +"/tmp/textmate-command-54347.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:52:28.383000 +10:00 +"/tmp/textmate-command-54376.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:52:41.048000 +10:00 +"/tmp/textmate-command-54411.rb ": + :original_result: {} + + :created_at: 2011-04-07 09:44:15.547000 +10:00 +"/tmp/textmate-command-54504.rb ": + :original_result: {} + + :created_at: 2011-04-07 10:10:21.027000 +10:00 +"/tmp/textmate-command-54532.rb ": + :original_result: {} + + :created_at: 2011-04-07 10:13:21.371000 +10:00 +"/tmp/textmate-command-54610.rb ": + :original_result: {} + + :created_at: 2011-04-07 10:01:25.539000 +10:00 +"/tmp/textmate-command-54705.rb ": + :original_result: {} + + :created_at: 2011-04-07 10:01:34.077000 +10:00 +"/tmp/textmate-command-54728.rb ": + :original_result: {} + + :created_at: 2011-04-07 10:02:40.598000 +10:00 +"/tmp/textmate-command-54759.rb ": + :original_result: {} + + :created_at: 2011-04-07 10:04:49.009000 +10:00 +"/tmp/textmate-command-54808.rb ": + :original_result: {} + + :created_at: 2011-04-07 10:27:20.890000 +10:00 +"/tmp/textmate-command-58245.rb ": + :original_result: {} + + :created_at: 2011-04-07 13:00:24.367000 +10:00 +"/tmp/textmate-command-58287.rb ": + :original_result: {} + + :created_at: 2011-04-07 12:57:04.458000 +10:00 +"/tmp/textmate-command-58321.rb ": + :original_result: {} + + :created_at: 2011-04-07 12:58:56.161000 +10:00 +"/tmp/textmate-command-58391.rb ": + :original_result: {} + + :created_at: 2011-04-07 12:52:08.339000 +10:00 +"/tmp/textmate-command-58525.rb ": + :original_result: {} + + :created_at: 2011-04-07 12:55:25.003000 +10:00 +"/tmp/textmate-command-58558.rb ": + :original_result: {} + + :created_at: 2011-04-07 13:04:28.992000 +10:00 +"/tmp/textmate-command-58602.rb ": + :original_result: {} + + :created_at: 2011-04-07 13:08:34.168000 +10:00 +"/tmp/textmate-command-58648.rb ": + :original_result: {} + + :created_at: 2011-04-07 13:04:20.528000 +10:00 +"/tmp/textmate-command-58693.rb ": + :original_result: {} + + :created_at: 2011-04-07 12:58:20.478000 +10:00 +"/tmp/textmate-command-58736.rb ": + :original_result: {} + + :created_at: 2011-04-07 13:02:26.377000 +10:00 +"/tmp/textmate-command-58765.rb ": + :original_result: {} + + :created_at: 2011-04-07 12:55:17.849000 +10:00 +"/tmp/textmate-command-58941.rb ": + :original_result: {} + + :created_at: 2011-04-07 13:07:49.694000 +10:00 +"/tmp/textmate-command-59015.rb ": + :original_result: {} + + :created_at: 2011-04-07 13:06:31.501000 +10:00 +"/tmp/textmate-command-59035.rb ": + :original_result: {} + + :created_at: 2011-04-07 13:03:31.368000 +10:00 +"/tmp/textmate-command-59071.rb ": + :original_result: {} + + :created_at: 2011-04-07 13:08:58.560000 +10:00 +"/tmp/textmate-command-59137.rb ": + :original_result: {} + + :created_at: 2011-04-07 13:09:11.584000 +10:00 +"/tmp/textmate-command-59162.rb ": + :original_result: {} + + :created_at: 2011-04-07 13:08:48.527000 +10:00 +"/tmp/textmate-command-59218.rb ": + :original_result: {} + + :created_at: 2011-04-07 13:16:29.488000 +10:00 +"/tmp/textmate-command-22299.rb ": + :original_result: {} + + :created_at: 2011-04-08 23:44:29.387143 +10:00 +"/tmp/textmate-command-22367.rb ": + :original_result: {} + + :created_at: 2011-04-08 23:45:02.840619 +10:00 +"/tmp/textmate-command-22438.rb ": + :original_result: {} + + :created_at: 2011-04-08 23:45:30.650235 +10:00 +"/tmp/textmate-command-22544.rb ": + :original_result: {} + + :created_at: 2011-04-08 23:47:11.009880 +10:00 +"/tmp/textmate-command-54823.rb ": + :original_result: {} + + :created_at: 2011-04-11 06:34:55.765170 +10:00 +"/tmp/textmate-command-54890.rb ": + :original_result: {} + + :created_at: 2011-04-11 06:35:16.806386 +10:00 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/cycle_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/cycle_spec.rb new file mode 100644 index 000000000..1edecd242 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/cycle_spec.rb @@ -0,0 +1,45 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster do + + describe "#cycle" do + + it "is lazy" do + lambda { Hamster.stream { fail }.cycle }.should_not raise_error + end + + describe "with an empty list" do + + before do + original = Hamster.list + @result = original.cycle + end + + it "returns an empty list" do + @result.should be_empty + end + + end + + describe "with a non-empty list" do + + before do + @original = Hamster.list("A", "B", "C") + @result = @original.cycle + end + + it "preserves the original" do + @original.should == Hamster.list("A", "B", "C") + end + + it "infinitely cycles through all values" do + @result.take(7).should == Hamster.list("A", "B", "C", "A", "B", "C", "A") + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/drop_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/drop_spec.rb new file mode 100644 index 000000000..2932c8579 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/drop_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#drop" do + + it "is lazy" do + lambda { Hamster.stream { fail }.drop(1) }.should_not raise_error + end + + [ + [[], 10, []], + [["A"], 10, []], + [["A"], -1, ["A"]], + [["A", "B", "C"], 0, ["A", "B", "C"]], + [["A", "B", "C"], 2, ["C"]], + ].each do |values, number, expected| + + describe "#{number} from #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.drop(number) + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/drop_while_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/drop_while_spec.rb new file mode 100644 index 000000000..374852ea2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/drop_while_spec.rb @@ -0,0 +1,59 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#drop_while" do + + it "is lazy" do + lambda { Hamster.stream { fail }.drop_while { false } }.should_not raise_error + end + + [ + [[], []], + [["A"], []], + [["A", "B", "C"], ["C"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + end + + describe "with a block" do + + before do + @result = @original.drop_while { |item| item < "C" } + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + describe "without a block" do + + before do + @result = @original.drop_while + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/each_slice_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/each_slice_spec.rb new file mode 100644 index 000000000..e0dd8ce28 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/each_slice_spec.rb @@ -0,0 +1,80 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:each_chunk, :each_slice].each do |method| + + describe "##{method}" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.send(method, 1) { |item| } }.should_not raise_error + end + + end + + [ + [[], []], + [["A"], [Hamster.list("A")]], + [["A", "B", "C"], [Hamster.list("A", "B"), Hamster.list("C")]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + end + + describe "with a block" do + + before do + @items = [] + @result = @original.send(method, 2) { |item| @items << item } + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "iterates over the items in order" do + @items.should == expected + end + + it "returns nil" do + @result.should be_nil + end + + end + + describe "without a block" do + + before do + @result = @original.send(method, 2) + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns the expected items" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/each_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/each_spec.rb new file mode 100644 index 000000000..eb6a381c0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/each_spec.rb @@ -0,0 +1,72 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:each, :foreach].each do |method| + + describe "##{method}" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.send(method) { |item| } }.should_not raise_error + end + + end + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + end + + describe "with a block" do + + before do + @items = [] + @result = @original.send(method) { |item| @items << item } + end + + it "iterates over the items in order" do + @items.should == values + end + + it "returns nil" do + @result.should be_nil + end + + end + + describe "without a block" do + + before do + @result = @original.send(method) + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/each_with_index_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/each_with_index_spec.rb new file mode 100644 index 000000000..667ed5a3e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/each_with_index_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#each_with_index" do + + describe "with no block" do + + before do + @list = Hamster.list("A", "B", "C") + @result = @list.each_with_index + end + + it "returns self" do + @result.should equal(@list) + end + + end + + describe "with a block" do + + before do + @list = Hamster.interval(1, 1025) + @pairs = [] + @result = @list.each_with_index { |item, index| @pairs << [item, index] } + end + + it "returns nil" do + @result.should be_nil + end + + it "iterates over the items in order" do + @pairs.should == (1..@list.size).zip(0..@list.size.pred) + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/elem_index_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/elem_index_spec.rb new file mode 100644 index 000000000..a3a603945 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/elem_index_spec.rb @@ -0,0 +1,58 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:elem_index, :index].each do |method| + + describe "##{method}" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.send(method, nil) }.should_not raise_error + end + + end + + [ + [[], "A", nil], + [[], nil, nil], + [["A"], "A", 0], + [["A"], "B", nil], + [["A"], nil, nil], + [["A", "B", nil], "A", 0], + [["A", "B", nil], "B", 1], + [["A", "B", nil], nil, 2], + [["A", "B", nil], "C", nil], + [[2], 2, 0], + [[2], 2.0, 0], + [[2.0], 2.0, 0], + [[2.0], 2, 0], + ].each do |values, item, expected| + + describe "looking for #{item.inspect} in #{values.inspect}" do + + before do + list = Hamster.list(*values) + @result = list.send(method, item) + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/elem_indices_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/elem_indices_spec.rb new file mode 100644 index 000000000..94bbd6225 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/elem_indices_spec.rb @@ -0,0 +1,45 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:elem_indices, :indices].each do |method| + + describe "##{method}" do + + it "is lazy" do + lambda { Hamster.stream { fail }.send(method, nil) }.should_not raise_error + end + + [ + [[], "A", []], + [["A"], "B", []], + [["A", "B", "A"], "B", [1]], + [["A", "B", "A"], "A", [0, 2]], + [[2], 2, [0]], + [[2], 2.0, [0]], + [[2.0], 2.0, [0]], + [[2.0], 2, [0]], + ].each do |values, item, expected| + + describe "looking for #{item.inspect} in #{values.inspect}" do + + before do + list = Hamster.list(*values) + @result = list.send(method, item) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/empty_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/empty_spec.rb new file mode 100644 index 000000000..0e3592f44 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/empty_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:empty?, :null?].each do |method| + + describe "##{method}" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.filter(&:nil?).empty? }.should_not raise_error + end + + end + + [ + [[], true], + [["A"], false], + [["A", "B", "C"], false], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @result = Hamster.list(*values).send(method) + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/eql_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/eql_spec.rb new file mode 100644 index 000000000..de1c5007b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/eql_spec.rb @@ -0,0 +1,78 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:eql?, :==].each do |method| + + describe "##{method}" do + + describe "on a really big list" do + + before do + @a = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + @b = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @a.send(method, @b) }.should_not raise_error + end + + end + + describe "returns false when comparing with" do + + before do + @list = Hamster.list("A", "B", "C") + end + + it "an array with the same contents" do + @list.send(method, ["A", "B", "C"]).should == false + end + + it "an aribtrary object" do + @list.send(method, Object.new).should == false + end + + end + + it "returns false when comparing an empty list with an empty array" do + Hamster.list.send(method, []).should == false + end + + [ + [[], [], true], + [[], [nil], false], + [["A"], [], false], + [["A"], ["A"], true], + [["A"], ["B"], false], + [["A", "B"], ["A"], false], + [["A", "B", "C"], ["A", "B", "C"], true], + [["C", "A", "B"], ["A", "B", "C"], false], + ].each do |a, b, expected| + + describe "returns #{expected.inspect}" do + + before do + @a = Hamster.list(*a) + @b = Hamster.list(*b) + end + + it "for lists #{a.inspect} and #{b.inspect}" do + @a.send(method, @b).should == expected + end + + it "for lists #{b.inspect} and #{a.inspect}" do + @b.send(method, @a).should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/filter_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/filter_spec.rb new file mode 100644 index 000000000..86a018bb0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/filter_spec.rb @@ -0,0 +1,61 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:filter, :select, :find_all].each do |method| + + describe "##{method}" do + + it "is lazy" do + lambda { Hamster.stream { fail }.filter { |item| false } }.should_not raise_error + end + + [ + [[], []], + [["A"], ["A"]], + [["A", "B", "C"], ["A", "B", "C"]], + [["A", "b", "C"], ["A", "C"]], + [["a", "b", "c"], []], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + end + + describe "with a block" do + + before do + @result = @original.send(method) { |item| item == item.upcase } + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + describe "without a block" do + + it "returns self" do + @original.send(method).should equal(@original) + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/find_index_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/find_index_spec.rb new file mode 100644 index 000000000..dc3e9da6e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/find_index_spec.rb @@ -0,0 +1,58 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:find_index, :index].each do |method| + + describe "##{method}" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.send(method) { |item| false } }.should_not raise_error + end + + end + + [ + [[], "A", nil], + [[], nil, nil], + [["A"], "A", 0], + [["A"], "B", nil], + [["A"], nil, nil], + [["A", "B", nil], "A", 0], + [["A", "B", nil], "B", 1], + [["A", "B", nil], nil, 2], + [["A", "B", nil], "C", nil], + [[2], 2, 0], + [[2], 2.0, 0], + [[2.0], 2.0, 0], + [[2.0], 2, 0], + ].each do |values, item, expected| + + describe "looking for #{item.inspect} in #{values.inspect}" do + + before do + list = Hamster.list(*values) + @result = list.send(method) { |x| x == item } + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/find_indices_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/find_indices_spec.rb new file mode 100644 index 000000000..bd8a559f9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/find_indices_spec.rb @@ -0,0 +1,45 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:find_indices, :indices].each do |method| + + describe "##{method}" do + + it "is lazy" do + lambda { Hamster.stream { fail }.send(method) { |item| true } }.should_not raise_error + end + + [ + [[], "A", []], + [["A"], "B", []], + [["A", "B", "A"], "B", [1]], + [["A", "B", "A"], "A", [0, 2]], + [[2], 2, [0]], + [[2], 2.0, [0]], + [[2.0], 2.0, [0]], + [[2.0], 2, [0]], + ].each do |values, item, expected| + + describe "looking for #{item.inspect} in #{values.inspect}" do + + before do + list = Hamster.list(*values) + @result = list.send(method) { |x| x == item } + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/find_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/find_spec.rb new file mode 100644 index 000000000..16542c9ff --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/find_spec.rb @@ -0,0 +1,65 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:find, :detect].each do |method| + + describe "##{method}" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.send(method) { false } }.should_not raise_error + end + + end + + [ + [[], "A", nil], + [[], nil, nil], + [["A"], "A", "A"], + [["A"], "B", nil], + [["A"], nil, nil], + [["A", "B", nil], "A", "A"], + [["A", "B", nil], "B", "B"], + [["A", "B", nil], nil, nil], + [["A", "B", nil], "C", nil], + ].each do |values, item, expected| + + describe "on #{values.inspect}" do + + before do + @list = Hamster.list(*values) + end + + describe "with a block" do + + it "returns #{expected.inspect}" do + @list.send(method) { |x| x == item }.should == expected + end + + end + + describe "without a block" do + + it "returns nil" do + @list.send(method).should be_nil + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/flatten_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/flatten_spec.rb new file mode 100644 index 000000000..0ef61151c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/flatten_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster do + + describe "#flatten" do + + it "is lazy" do + lambda { Hamster.stream { fail }.flatten }.should_not raise_error + end + + [ + [[], []], + [["A"], ["A"]], + [["A", "B", "C"], ["A", "B", "C"]], + [["A", Hamster.list("B"), "C"], ["A", "B", "C"]], + [[Hamster.list("A"), Hamster.list("B"), Hamster.list("C")], ["A", "B", "C"]], + ].each do |values, expected| + + describe "on #{values}" do + + before do + @original = Hamster.list(*values) + @result = @original.flatten + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns an empty list" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/grep_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/grep_spec.rb new file mode 100644 index 000000000..130a4062c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/grep_spec.rb @@ -0,0 +1,70 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#grep" do + + it "is lazy" do + lambda { Hamster.stream { fail }.grep(Object) { |item| item } }.should_not raise_error + end + + describe "without a block" do + + [ + [[], []], + [["A"], ["A"]], + [[1], []], + [["A", 2, "C"], ["A", "C"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @list = Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @list.grep(String).should == Hamster.list(*expected) + end + + end + + end + + end + + describe "with a block" do + + [ + [[], []], + [["A"], ["a"]], + [[1], []], + [["A", 2, "C"], ["a", "c"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.grep(String, &:downcase) + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/group_by_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/group_by_spec.rb new file mode 100644 index 000000000..71daee6b7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/group_by_spec.rb @@ -0,0 +1,77 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:group_by, :group].each do |method| + + describe "##{method}" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.send(method) }.should_not raise_error + end + + end + + describe "with a block" do + + [ + [[], []], + [[1], [true => Hamster.list(1)]], + [[1, 2, 3, 4], [true => Hamster.list(3, 1), false => Hamster.list(4, 2)]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.list(*values) + @result = original.send(method, &:odd?) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.hash(*expected) + end + + end + + end + + end + + describe "without a block" do + + [ + [[], []], + [[1], [1 => Hamster.list(1)]], + [[1, 2, 3, 4], [1 => Hamster.list(1), 2 => Hamster.list(2), 3 => Hamster.list(3), 4 => Hamster.list(4)]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.list(*values) + @result = original.send(method) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.hash(*expected) + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/hash_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/hash_spec.rb new file mode 100644 index 000000000..a40b0e7be --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/hash_spec.rb @@ -0,0 +1,43 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#hash" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.hash }.should_not raise_error + end + + end + + describe "on an empty list" do + + before do + @result = Hamster.list.hash + end + + it "returns 0" do + @result.should == 0 + end + + end + + it "values are sufficiently distributed" do + (1..4000). + each_slice(4). + map { |a, b, c, d| Hamster.list(a, b, c, d).hash }. + uniq. + size.should == 1000 + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/head_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/head_spec.rb new file mode 100644 index 000000000..06b8c96d9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/head_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:head, :first].each do |method| + + describe "##{method}" do + + [ + [[], nil], + [["A"], "A"], + [["A", "B", "C"], "A"], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @list = Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @list.send(method).should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/include_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/include_spec.rb new file mode 100644 index 000000000..b003b1f82 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/include_spec.rb @@ -0,0 +1,57 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:include?, :member?, :contains?, :elem?].each do |method| + + describe "##{method}" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.send(method, nil) }.should_not raise_error + end + + end + + [ + [[], "A", false], + [[], nil, false], + [["A"], "A", true], + [["A"], "B", false], + [["A"], nil, false], + [["A", "B", nil], "A", true], + [["A", "B", nil], "B", true], + [["A", "B", nil], nil, true], + [["A", "B", nil], "C", false], + [[2], 2, true], + [[2], 2.0, true], + [[2.0], 2.0, true], + [[2.0], 2, true], + ].each do |values, item, expected| + + describe "on #{values.inspect}" do + + before do + @list = Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @list.send(method, item).should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/init_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/init_spec.rb new file mode 100644 index 000000000..2898e8fd1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/init_spec.rb @@ -0,0 +1,40 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#init" do + + it "is lazy" do + lambda { Hamster.stream { false }.init }.should_not raise_error + end + + [ + [[], []], + [["A"], []], + [["A", "B", "C"], ["A", "B"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.init + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns the list without the last element: #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/inits_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/inits_spec.rb new file mode 100644 index 000000000..53bc76cc7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/inits_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#inits" do + + it "is lazy" do + lambda { Hamster.stream { fail }.inits }.should_not raise_error + end + + [ + [[], [[]]], + [["A"], [[], ["A"]]], + [["A", "B", "C"], [[], ["A"], ["A", "B"], ["A", "B", "C"]]], + ].each do |values, expected| + + expected = expected.map { |x| Hamster.list(*x) } + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.inits + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/inspect_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/inspect_spec.rb new file mode 100644 index 000000000..c1722cb40 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/inspect_spec.rb @@ -0,0 +1,43 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#inspect" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.inspect }.should_not raise_error + end + + end + + [ + [[], "[]"], + [["A"], "[\"A\"]"], + [["A", "B", "C"], "[\"A\", \"B\", \"C\"]"] + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @list = Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @list.inspect.should == expected + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/intersperse_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/intersperse_spec.rb new file mode 100644 index 000000000..6bc2d3381 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/intersperse_spec.rb @@ -0,0 +1,40 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#intersperse" do + + it "is lazy" do + lambda { Hamster.stream { fail }.intersperse("") }.should_not raise_error + end + + [ + [[], []], + [["A"], ["A"]], + [["A", "B", "C"], ["A", "|", "B", "|", "C"]] + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.intersperse("|") + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/join_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/join_spec.rb new file mode 100644 index 000000000..e12dda52a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/join_spec.rb @@ -0,0 +1,81 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#join" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.join }.should_not raise_error + end + + end + + describe "with a separator" do + + [ + [[], ""], + [["A"], "A"], + [["A", "B", "C"], "A|B|C"] + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.join("|") + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + + describe "without a separator" do + + [ + [[], ""], + [["A"], "A"], + [["A", "B", "C"], "ABC"] + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.join + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/last_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/last_spec.rb new file mode 100644 index 000000000..bda13eadc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/last_spec.rb @@ -0,0 +1,44 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#last" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.last }.should_not raise_error + end + + end + + [ + [[], nil], + [["A"], "A"], + [["A", "B", "C"], "C"], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.list(*values) + @result = original.last + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/map_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/map_spec.rb new file mode 100644 index 000000000..2a8ef0f84 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/map_spec.rb @@ -0,0 +1,69 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:map, :collect].each do |method| + + describe "##{method}" do + + it "is lazy" do + lambda { Hamster.stream { fail }.map { |item| item } }.should_not raise_error + end + + [ + [[], []], + [["A"], ["a"]], + [["A", "B", "C"], ["a", "b", "c"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + end + + describe "with a block" do + + before do + @result = @original.send(method, &:downcase) + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + it "is lazy" do + count = 0 + @original.send(method) { |item| count += 1 } + count.should <= 1 + end + + end + + describe "without a block" do + + before do + @result = @original.send(method) + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/maximum_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/maximum_spec.rb new file mode 100644 index 000000000..db84e6c23 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/maximum_spec.rb @@ -0,0 +1,77 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:maximum, :max].each do |method| + + describe "##{method}" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.send(method) }.should_not raise_error + end + + end + + describe "with a block" do + + [ + [[], nil], + [["A"], "A"], + [["Ichi", "Ni", "San"], "Ichi"], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.list(*values) + @result = original.send(method) { |maximum, item| item.length <=> maximum.length } + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + + describe "without a block" do + + [ + [[], nil], + [["A"], "A"], + [["Ichi", "Ni", "San"], "San"], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.list(*values) + @result = original.send(method) + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/merge_by_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/merge_by_spec.rb new file mode 100644 index 000000000..1bd70d0f2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/merge_by_spec.rb @@ -0,0 +1,79 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + context "without a comparator" do + + context "on an empty list" do + + subject { Hamster.list } + + it "returns an empty list" do + subject.merge_by.should be_empty + end + + end + + context "on a single list" do + + let(:list) { Hamster.list(1, 2, 3) } + + subject { Hamster.list(list) } + + it "returns the list" do + subject.merge_by.should == list + end + + end + + context "with multiple lists" do + + subject { Hamster.list(Hamster.list(3, 6, 7, 8), Hamster.list(1, 2, 4, 5, 9))} + + it "merges the lists based on natural sort order" do + subject.merge_by.should == Hamster.list(1, 2, 3, 4, 5, 6, 7, 8, 9) + end + + end + + end + + context "with a comparator" do + + context "on an empty list" do + + subject { Hamster.list } + + it "returns an empty list" do + subject.merge_by { |item| fail("should never be called") }.should be_empty + end + + end + + context "on a single list" do + + let(:list) { Hamster.list(1, 2, 3) } + + subject { Hamster.list(list) } + + it "returns the list" do + subject.merge_by { |item| -item }.should == Hamster.list(1, 2, 3) + end + + end + + context "with multiple lists" do + + subject { Hamster.list(Hamster.list(8, 7, 6, 3), Hamster.list(9, 5, 4, 2, 1))} + + it "merges the lists based on the specified transformer" do + subject.merge_by { |item| -item }.should == Hamster.list(9, 8, 7, 6, 5, 4, 3, 2, 1) + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/merge_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/merge_spec.rb new file mode 100644 index 000000000..148afe658 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/merge_spec.rb @@ -0,0 +1,79 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + context "without a comparator" do + + context "on an empty list" do + + subject { Hamster.list } + + it "returns an empty list" do + subject.merge.should be_empty + end + + end + + context "on a single list" do + + let(:list) { Hamster.list(1, 2, 3) } + + subject { Hamster.list(list) } + + it "returns the list" do + subject.merge.should == list + end + + end + + context "with multiple lists" do + + subject { Hamster.list(Hamster.list(3, 6, 7, 8), Hamster.list(1, 2, 4, 5, 9))} + + it "merges the lists based on natural sort order" do + subject.merge.should == Hamster.list(1, 2, 3, 4, 5, 6, 7, 8, 9) + end + + end + + end + + context "with a comparator" do + + context "on an empty list" do + + subject { Hamster.list } + + it "returns an empty list" do + subject.merge { |a, b| fail("should never be called") }.should be_empty + end + + end + + context "on a single list" do + + let(:list) { Hamster.list(1, 2, 3) } + + subject { Hamster.list(list) } + + it "returns the list" do + subject.merge { |a, b| fail("should never be called") }.should == list + end + + end + + context "with multiple lists" do + + subject { Hamster.list(Hamster.list(8, 7, 6, 3), Hamster.list(9, 5, 4, 2, 1))} + + it "merges the lists based on the specified comparator" do + subject.merge { |a, b| b <=> a }.should == Hamster.list(9, 8, 7, 6, 5, 4, 3, 2, 1) + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/minimum_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/minimum_spec.rb new file mode 100644 index 000000000..b16676be6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/minimum_spec.rb @@ -0,0 +1,77 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:minimum, :min].each do |method| + + describe "##{method}" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.send(method) }.should_not raise_error + end + + end + + describe "with a block" do + + [ + [[], nil], + [["A"], "A"], + [["Ichi", "Ni", "San"], "Ni"], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.list(*values) + @result = original.send(method) { |minimum, item| item.length <=> minimum.length } + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + + describe "without a block" do + + [ + [[], nil], + [["A"], "A"], + [["Ichi", "Ni", "San"], "Ichi"], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.list(*values) + @result = original.send(method) + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/none_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/none_spec.rb new file mode 100644 index 000000000..7c6001e6b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/none_spec.rb @@ -0,0 +1,75 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#none?" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.none? { false } }.should_not raise_error + end + + end + + describe "when empty" do + + before do + @list = Hamster.list + end + + it "with a block returns true" do + @list.none? {}.should == true + end + + it "with no block returns true" do + @list.none?.should == true + end + + end + + describe "when not empty" do + + describe "with a block" do + + before do + @list = Hamster.list("A", "B", "C", nil) + end + + ["A", "B", "C", nil].each do |value| + + it "returns false if the block ever returns true (#{value.inspect})" do + @list.none? { |item| item == value }.should == false + end + + end + + it "returns true if the block always returns false" do + @list.none? { |item| item == "D" }.should == true + end + + end + + describe "with no block" do + + it "returns false if any value is truthy" do + Hamster.list(nil, false, true, "A").none?.should == false + end + + it "returns true if all values are falsey" do + Hamster.list(nil, false).none?.should == true + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/one_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/one_spec.rb new file mode 100644 index 000000000..3045df923 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/one_spec.rb @@ -0,0 +1,75 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#one?" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.one? { false } }.should_not raise_error + end + + end + + describe "when empty" do + + before do + @list = Hamster.list + end + + it "with a block returns false" do + @list.one? {}.should == false + end + + it "with no block returns false" do + @list.one?.should == false + end + + end + + describe "when not empty" do + + describe "with a block" do + + before do + @list = Hamster.list("A", "B", "C") + end + + it "returns false if the block returns true more than once" do + @list.one? { |item| true }.should == false + end + + it "returns false if the block never returns true" do + @list.one? { |item| false }.should == false + end + + it "returns true if the block only returns true once" do + @list.one? { |item| item == "A" }.should == true + end + + end + + describe "with no block" do + + it "returns false if more than one value is truthy" do + Hamster.list(nil, true, "A").one?.should == false + end + + it "returns true if only one value is truthy" do + Hamster.list(nil, true, false).one?.should == true + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/partition_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/partition_spec.rb new file mode 100644 index 000000000..9f33f5b35 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/partition_spec.rb @@ -0,0 +1,75 @@ +require 'spec_helper' + +require 'hamster/tuple' +require 'hamster/list' + +describe Hamster::List do + + describe "#partition" do + + it "is lazy" do + lambda { Hamster.stream { fail }.partition }.should_not raise_error + end + + [ + [[], [], []], + [[1], [1], []], + [[1, 2], [1], [2]], + [[1, 2, 3], [1, 3], [2]], + [[1, 2, 3, 4], [1, 3], [2, 4]], + [[2, 3, 4], [3], [2, 4]], + [[3, 4], [3], [4]], + [[4], [], [4]], + ].each do |values, expected_matches, expected_remainder| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + end + + describe "with a block" do + + before do + @result = @original.partition(&:odd?) + @matches = @result.first + @remainder = @result.last + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns a tuple with two items" do + @result.is_a?(Hamster::Tuple).should == true + end + + it "correctly identifies the matches" do + @matches.should == Hamster.list(*expected_matches) + end + + it "correctly identifies the remainder" do + @remainder.should == Hamster.list(*expected_remainder) + end + + end + + describe "without a block" do + + before do + @result = @original.partition + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/product_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/product_spec.rb new file mode 100644 index 000000000..0664f447c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/product_spec.rb @@ -0,0 +1,44 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#product" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.product }.should_not raise_error + end + + end + + [ + [[], 1], + [[2], 2], + [[1, 3, 5, 7, 11], 1155], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.list(*values) + @result = original.product + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/reduce_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/reduce_spec.rb new file mode 100644 index 000000000..ad93eece0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/reduce_spec.rb @@ -0,0 +1,99 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:reduce, :inject, :fold, :foldr].each do |method| + + describe "##{method}" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.reduce(&:+) }.should_not raise_error + end + + end + + [ + [[], 10, 10], + [[1], 10, 9], + [[1, 2, 3], 10, 4], + ].each do |values, initial, expected| + + describe "on #{values.inspect}" do + + before do + @list = Hamster.list(*values) + end + + describe "with an initial value of #{initial}" do + + describe "and a block" do + + it "returns #{expected.inspect}" do + @list.send(method, initial) { |memo, item| memo - item }.should == expected + end + + end + + describe "and no block" do + + it "returns the memo" do + @list.send(method, initial).should == initial + end + + end + + end + + end + + end + + [ + [[], nil], + [[1], 1], + [[1, 2, 3], -4], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @list = Hamster.list(*values) + end + + describe "with no initial value" do + + describe "and a block" do + + it "returns #{expected.inspect}" do + @list.send(method) { |memo, item| memo - item }.should == expected + end + + end + + describe "and no block" do + + it "returns nil" do + @list.send(method).should be_nil + end + + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/remove_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/remove_spec.rb new file mode 100644 index 000000000..d5c08626a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/remove_spec.rb @@ -0,0 +1,67 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:remove, :reject, :delete_if].each do |method| + + describe "##{method}" do + + it "is lazy" do + lambda { Hamster.stream { fail }.send(method) { |item| false } }.should_not raise_error + end + + [ + [[], []], + [["A"], ["A"]], + [["A", "B", "C"], ["A", "B", "C"]], + [["A", "b", "C"], ["A", "C"]], + [["a", "b", "c"], []], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + end + + describe "with a block" do + + before do + @result = @original.send(method) { |item| item == item.downcase } + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + it "is lazy" do + count = 0 + @original.send(method) { |item| count += 1; false } + count.should <= 1 + end + + end + + describe "without a block" do + + before do + @result = @original.send(method) + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/reverse_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/reverse_spec.rb new file mode 100644 index 000000000..be6d9d097 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/reverse_spec.rb @@ -0,0 +1,52 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#reverse" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.reverse }.should_not raise_error + end + + end + + it "is lazy" do + lambda { Hamster.stream { fail }.reverse }.should_not raise_error + end + + [ + [[], []], + [["A"], ["A"]], + [["A", "B", "C"], ["C", "B", "A"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.reverse { |item| item.downcase } + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/size_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/size_spec.rb new file mode 100644 index 000000000..65547bfab --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/size_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:size, :length].each do |method| + + describe "##{method}" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.size }.should_not raise_error + end + + end + + [ + [[], 0], + [["A"], 1], + [["A", "B", "C"], 3], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @list = Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @list.send(method).should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/slice_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/slice_spec.rb new file mode 100644 index 000000000..6d120d190 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/slice_spec.rb @@ -0,0 +1,50 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:slice, :[]].each do |method| + + describe "#slice" do + + it "is lazy" do + lambda { Hamster.stream { fail }.send(method, 1, 5) }.should_not raise_error + end + + [ + [[], 0, 10, []], + [[], 1, 1, []], + [["A"], 0, 0, []], + [["A"], 1, 1, []], + [["A"], 1, 10, []], + [["A"], 0, 1, ["A"]], + [["A"], 0, 10, ["A"]], + [["A", "B", "C"], 0, 3, ["A", "B", "C"]], + [["A", "B", "C"], 2, 1, ["C"]], + ].each do |values, from, length, expected| + + describe "#{values.inspect} from #{from} for a length of #{length}" do + + before do + @original = Hamster.list(*values) + @result = @original.send(method, from, length) + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/sorting_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/sorting_spec.rb new file mode 100644 index 000000000..05a53365b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/sorting_spec.rb @@ -0,0 +1,70 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [ + [:sort, lambda { |left, right| left.length <=> right.length }], + [:sort_by, lambda { |item| item.length }], + ].each do |method, comparator| + + describe "##{method}" do + + it "is lazy" do + lambda { Hamster.stream { fail }.send(method, &comparator) }.should_not raise_error + end + + [ + [[], []], + [["A"], ["A"]], + [["Ichi", "Ni", "San"], ["Ni", "San", "Ichi"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + end + + describe "with a block" do + + before do + @result = @original.send(method, &comparator) + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + describe "without a block" do + + before do + @result = @original.send(method) + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.sort.inspect}" do + @result.should == Hamster.list(*expected.sort) + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/span_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/span_spec.rb new file mode 100644 index 000000000..f2faf3a7c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/span_spec.rb @@ -0,0 +1,86 @@ +require 'spec_helper' + +require 'hamster/list' + +describe "Hamster.list#span" do + + it "is lazy" do + lambda { Hamster.stream { |item| fail }.span { true } }.should_not raise_error + end + + describe <<-DESC do +given a predicate (in the form of a block), splits the list into two lists + (returned as a tuple) such that elements in the first list (the prefix) are + taken from the head of the list while the predicate is satisfied, and elements + in the second list (the remainder) are the remaining elements from the list + once the predicate is not satisfied. For example: +DESC + + [ + [[], [], []], + [[1], [1], []], + [[1, 2], [1, 2], []], + [[1, 2, 3], [1, 2], [3]], + [[1, 2, 3, 4], [1, 2], [3, 4]], + [[2, 3, 4], [2], [3, 4]], + [[3, 4], [], [3, 4]], + [[4], [], [4]], + ].each do |values, expected_prefix, expected_remainder| + + describe "given the list #{values.inspect}" do + + before do + @original = Hamster.list(*values) + end + + describe "and a predicate that returns true for values <= 2" do + + before do + @result = @original.span { |item| item <= 2 } + @prefix = @result.first + @remainder = @result.last + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns the prefix as #{expected_prefix.inspect}" do + @prefix.should == Hamster.list(*expected_prefix) + end + + it "returns the remainder as #{expected_remainder.inspect}" do + @remainder.should == Hamster.list(*expected_remainder) + end + + end + + describe "without a predicate" do + + before do + @result = @original.span + @prefix = @result.first + @remainder = @result.last + end + + it "returns a tuple" do + @result.is_a?(Hamster::Tuple).should == true + end + + it "returns self as the prefix" do + @prefix.should equal(@original) + end + + it "returns an empty list as the remainder" do + @remainder.should be_empty + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/split_at_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/split_at_spec.rb new file mode 100644 index 000000000..7dd77903c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/split_at_spec.rb @@ -0,0 +1,53 @@ +require 'spec_helper' + +require 'hamster/tuple' +require 'hamster/list' + +describe Hamster::List do + + describe "#split_at" do + + it "is lazy" do + lambda { Hamster.stream { fail }.split_at(1) }.should_not raise_error + end + + [ + [[], [], []], + [[1], [1], []], + [[1, 2], [1, 2], []], + [[1, 2, 3], [1, 2], [3]], + [[1, 2, 3, 4], [1, 2], [3, 4]], + ].each do |values, expected_prefix, expected_remainder| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.split_at(2) + @prefix = @result.first + @remainder = @result.last + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns a tuple with two items" do + @result.is_a?(Hamster::Tuple).should == true + end + + it "correctly identifies the matches" do + @prefix.should == Hamster.list(*expected_prefix) + end + + it "correctly identifies the remainder" do + @remainder.should == Hamster.list(*expected_remainder) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/sum_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/sum_spec.rb new file mode 100644 index 000000000..f5d9031db --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/sum_spec.rb @@ -0,0 +1,44 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#sum" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.sum }.should_not raise_error + end + + end + + [ + [[], 0], + [[2], 2], + [[1, 3, 5, 7, 11], 27], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.list(*values) + @result = original.sum + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/tail_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/tail_spec.rb new file mode 100644 index 000000000..7b152e32c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/tail_spec.rb @@ -0,0 +1,48 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#tail" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.filter(&:nil?).tail }.should_not raise_error + end + + end + + [ + [[], []], + [["A"], []], + [["A", "B", "C"], ["B", "C"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.tail + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/tails_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/tails_spec.rb new file mode 100644 index 000000000..6d1a811b7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/tails_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#tails" do + + it "is lazy" do + lambda { Hamster.stream { fail }.tails }.should_not raise_error + end + + [ + [[], [[]]], + [["A"], [["A"], []]], + [["A", "B", "C"], [["A", "B", "C"], ["B", "C"], ["C"], []]], + ].each do |values, expected| + + expected = expected.map { |x| Hamster.list(*x) } + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.tails + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/take_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/take_spec.rb new file mode 100644 index 000000000..410f1dca7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/take_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#take" do + + it "is lazy" do + lambda { Hamster.stream { fail }.take(1) }.should_not raise_error + end + + [ + [[], 10, []], + [["A"], 10, ["A"]], + [["A"], -1, []], + [["A", "B", "C"], 0, []], + [["A", "B", "C"], 2, ["A", "B"]], + ].each do |values, number, expected| + + describe "#{number} from #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.take(number) + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/take_while_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/take_while_spec.rb new file mode 100644 index 000000000..3237c2ccb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/take_while_spec.rb @@ -0,0 +1,62 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#take_while" do + + it "is lazy" do + lambda { Hamster.stream { fail }.take_while { false } }.should_not raise_error + end + + [ + [[], []], + [["A"], ["A"]], + [["A", "B", "C"], ["A", "B"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.take_while { |item| item < "C" } + end + + describe "with a block" do + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "is lazy" do + count = 0 + @original.take_while { |item| count += 1; true } + count.should <= 1 + end + + end + + describe "without a block" do + + before do + @result = @original.take_while + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/to_a_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/to_a_spec.rb new file mode 100644 index 000000000..30c58d980 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/to_a_spec.rb @@ -0,0 +1,54 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:to_a, :entries].each do |method| + + describe "##{method}" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.to_a }.should_not raise_error + end + + end + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values.inspect}" do + + before do + @list = Hamster.list(*values) + @result = @list.send(method) + end + + it "returns #{values.inspect}" do + @result.should == values + end + + it "returns a mutable array" do + @result.last.should_not == "The End" + @result << "The End" + @result.last.should == "The End" + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/to_ary_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/to_ary_spec.rb new file mode 100644 index 000000000..6369ba683 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/to_ary_spec.rb @@ -0,0 +1,56 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#to_ary" do + + describe "on a really big list" do + + before do + @list = Hamster.interval(0, STACK_OVERFLOW_DEPTH) + end + + it "doesn't run out of stack" do + lambda { @list.to_ary }.should_not raise_error + end + + end + + describe "enables implicit conversion to" do + + before do + @list = Hamster.list("A", "B", "C", "D") + end + + it "block parameters" do + def func(&block) + yield(@list) + end + func do |a, b, *c| + a.should == "A" + b.should == "B" + c.should == ["C", "D"] + end + end + + it "method arguments" do + def func(a, b, *c) + a.should == "A" + b.should == "B" + c.should == ["C", "D"] + end + func(*@list) + end + + it "works with splat" do + array = *@list + array.should == ["A", "B", "C", "D"] + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/to_list_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/to_list_spec.rb new file mode 100644 index 000000000..79e1eae10 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/to_list_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#to_list" do + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.to_list + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/to_set_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/to_set_spec.rb new file mode 100644 index 000000000..40ce6b6cb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/to_set_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +require 'hamster/list' +require 'hamster/set' + +describe Hamster::List do + + describe "#to_set" do + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values.inspect}" do + + before do + original = Hamster.list(*values) + @result = original.to_set + end + + it "returns self" do + @result.should == Hamster.set(*values) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/union_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/union_spec.rb new file mode 100644 index 000000000..08c9f76a5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/union_spec.rb @@ -0,0 +1,49 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:union, :|].each do |method| + + describe "##{method}" do + + it "is lazy" do + lambda { Hamster.stream { fail }.union(Hamster.stream { fail }) }.should_not raise_error + end + + [ + [[], [], []], + [["A"], [], ["A"]], + [["A", "B", "C"], [], ["A", "B", "C"]], + [["A", "A"], ["A"], ["A"]], + ].each do |a, b, expected| + + describe "returns #{expected.inspect}" do + + before do + @a = Hamster.list(*a) + @b = Hamster.list(*b) + end + + it "for #{a.inspect} and #{b.inspect}" do + @result = @a.send(method, @b) + end + + it "for #{b.inspect} and #{a.inspect}" do + @result = @b.send(method, @a) + end + + after do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/uniq_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/uniq_spec.rb new file mode 100644 index 000000000..d5626423f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/uniq_spec.rb @@ -0,0 +1,45 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + [:uniq, :nub, :remove_duplicates].each do |method| + + describe "##{method}" do + + it "is lazy" do + lambda { Hamster.stream { fail }.uniq }.should_not raise_error + end + + [ + [[], []], + [["A"], ["A"]], + [["A", "B", "C"], ["A", "B", "C"]], + [["A", "B", "A", "C", "C"], ["A", "B", "C"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.list(*values) + @result = @original.send(method) + end + + it "preserves the original" do + @original.should == Hamster.list(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/zip_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/zip_spec.rb new file mode 100644 index 000000000..5f7f5f7de --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/list/zip_spec.rb @@ -0,0 +1,39 @@ +require 'spec_helper' + +require 'hamster/list' + +describe Hamster::List do + + describe "#zip" do + + it "is lazy" do + lambda { Hamster.stream { fail }.zip(Hamster.stream { fail }) }.should_not raise_error + end + + [ + [[], [], []], + [["A"], ["aye"], [Hamster.list("A", "aye")]], + [["A"], [], [Hamster.list("A", nil)]], + [[], ["A"], [Hamster.list(nil, "A")]], + [["A", "B", "C"], ["aye", "bee", "see"], [Hamster.list("A", "aye"), Hamster.list("B", "bee"), Hamster.list("C", "see")]], + ].each do |left, right, expected| + + describe "on #{left.inspect} and #{right.inspect}" do + + before do + @left = Hamster.list(*left) + @right = Hamster.list(*right) + @result = @left.zip(@right) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/clear_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/clear_spec.rb new file mode 100644 index 000000000..1b4135099 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/clear_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +require 'hamster/queue' + +describe Hamster::Queue do + + describe "#clear" do + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values}" do + + before do + @original = Hamster.queue(*values) + @result = @original.clear + end + + it "preserves the original" do + @original.should == Hamster.queue(*values) + end + + it "returns an empty queue" do + @result.should equal(Hamster.queue) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/construction_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/construction_spec.rb new file mode 100644 index 000000000..00a3f33bb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/construction_spec.rb @@ -0,0 +1,43 @@ +require 'spec_helper' + +require 'hamster/queue' + +describe Hamster do + + describe ".queue" do + + describe "with no arguments" do + + before do + @queue = Hamster.queue + end + + it "always returns the same instance" do + @queue.should equal(Hamster.queue) + end + + it "returns an empty queue" do + @queue.should be_empty + end + + end + + describe "with a number of items" do + + before do + @queue = Hamster.queue("A", "B", "C") + end + + it "always returns a different instance" do + @queue.should_not equal(Hamster.queue("A", "B", "C")) + end + + it "is the same as repeatedly using #enqueue" do + @queue.should == Hamster.queue.enqueue("A").enqueue("B").enqueue("C") + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/dequeue_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/dequeue_spec.rb new file mode 100644 index 000000000..20a8a4a18 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/dequeue_spec.rb @@ -0,0 +1,40 @@ +require 'spec_helper' + +require 'hamster/queue' + +describe Hamster::Queue do + + [:dequeue, :tail].each do |method| + + describe "##{method}" do + + [ + [[], []], + [["A"], []], + [["A", "B", "C"], ["B", "C"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.queue(*values) + @result = @original.send(method) + end + + it "preserves the original" do + @original.should == Hamster.queue(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.queue(*expected) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/empty_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/empty_spec.rb new file mode 100644 index 000000000..4176a82f7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/empty_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' + +require 'hamster/queue' + +describe Hamster::Queue do + + [:empty?, :null?].each do |method| + + describe "##{method}" do + + [ + [[], true], + [["A"], false], + [["A", "B", "C"], false], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @result = Hamster.queue(*values).send(method) + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + + describe "after dequeueing an item from #{["A", "B", "C"].inspect}" do + + before do + @result = Hamster.queue("A", "B", "C").dequeue + end + + it "returns false" do + @result.should_not be_empty + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/enqueue_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/enqueue_spec.rb new file mode 100644 index 000000000..9df91623f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/enqueue_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' + +require 'hamster/queue' + +describe Hamster::Queue do + + [:enqueue, :<<, :add].each do |method| + + describe "##{method}" do + + [ + [[], "A", ["A"]], + [["A"], "B", ["A", "B"]], + [["A"], "A", ["A", "A"]], + [["A", "B", "C"], "D", ["A", "B", "C", "D"]], + ].each do |values, new_value, expected| + + describe "on #{values.inspect} with #{new_value.inspect}" do + + before do + @original = Hamster.queue(*values) + @result = @original.send(method, new_value) + end + + it "preserves the original" do + @original.should == Hamster.queue(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.queue(*expected) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/head_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/head_spec.rb new file mode 100644 index 000000000..7f4a9082a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/head_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +require 'hamster/queue' + +describe Hamster::Queue do + + [:head, :first, :peek, :front].each do |method| + + describe "##{method}" do + + [ + [[], nil], + [["A"], "A"], + [["A", "B", "C"], "A"], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @queue = Hamster.queue(*values) + end + + it "returns #{expected.inspect}" do + @queue.send(method).should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/inspect_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/inspect_spec.rb new file mode 100644 index 000000000..388b7609d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/inspect_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +require 'hamster/queue' + +describe Hamster::Queue do + + describe "#inspect" do + + [ + [[], "[]"], + [["A"], "[\"A\"]"], + [["A", "B", "C"], "[\"A\", \"B\", \"C\"]"] + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @queue = Hamster.queue(*values) + end + + it "returns #{expected.inspect}" do + @queue.inspect.should == expected + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/size_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/size_spec.rb new file mode 100644 index 000000000..c454957ba --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/size_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +require 'hamster/queue' + +describe Hamster::Queue do + + [:size, :length].each do |method| + + describe "##{method}" do + + [ + [[], 0], + [["A"], 1], + [["A", "B", "C"], 3], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @queue = Hamster.queue(*values) + end + + it "returns #{expected.inspect}" do + @queue.send(method).should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/to_a_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/to_a_spec.rb new file mode 100644 index 000000000..209d40426 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/to_a_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +require 'hamster/queue' + +describe Hamster::Queue do + + [:to_a, :entries].each do |method| + + describe "##{method}" do + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values.inspect}" do + + before do + @queue = Hamster.queue(*values) + @result = @queue.send(method) + end + + it "returns #{values.inspect}" do + @result.should == values + end + + it "returns a mutable array" do + @result.last.should_not == "The End" + @result << "The End" + @result.last.should == "The End" + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/to_ary_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/to_ary_spec.rb new file mode 100644 index 000000000..0416ab821 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/to_ary_spec.rb @@ -0,0 +1,44 @@ +require 'spec_helper' + +require 'hamster/queue' + +describe Hamster::Queue do + + describe "#to_ary" do + + describe "enables implicit conversion to" do + + before do + @queue = Hamster.queue("A", "B", "C", "D") + end + + it "block parameters" do + def func(&block) + yield(@queue) + end + func do |a, b, *c| + a.should == "A" + b.should == "B" + c.should == ["C", "D"] + end + end + + it "method arguments" do + def func(a, b, *c) + a.should == "A" + b.should == "B" + c.should == ["C", "D"] + end + func(*@queue) + end + + it "works with splat" do + array = *@queue + array.should == ["A", "B", "C", "D"] + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/to_list_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/to_list_spec.rb new file mode 100644 index 000000000..7e5516ba2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/queue/to_list_spec.rb @@ -0,0 +1,44 @@ +require 'spec_helper' + +require 'hamster/queue' +require 'hamster/list' + +describe Hamster::Queue do + + describe "#to_list" do + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values.inspect}" do + + before do + @list = Hamster.queue(*values).to_list + end + + it "returns a list containing #{values.inspect}" do + @list.should == Hamster.list(*values) + end + + end + + end + + describe "after dequeueing an item from #{["A", "B", "C"].inspect}" do + + before do + @list = Hamster.queue("A", "B", "C").dequeue.to_list + end + + it "returns a list containing #{["B", "C"].inspect}" do + @list.should == Hamster.list("B", "C") + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/add_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/add_spec.rb new file mode 100644 index 000000000..e39c75804 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/add_spec.rb @@ -0,0 +1,51 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:add, :<<].each do |method| + + describe "##{method}" do + + before do + @original = Hamster.set("A", "B", "C") + end + + describe "with a unique value" do + + before do + @result = @original.send(method, "D") + end + + it "preserves the original" do + @original.should == Hamster.set("A", "B", "C") + end + + it "returns a copy with the superset of values" do + @result.should == Hamster.set("A", "B", "C", "D") + end + + end + + describe "with a duplicate value" do + + before do + @result = @original.send(method, "C") + end + + it "preserves the original values" do + @original.should == Hamster.set("A", "B", "C") + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/all_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/all_spec.rb new file mode 100644 index 000000000..d194b5fe4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/all_spec.rb @@ -0,0 +1,67 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:all?, :forall?].each do |method| + + describe "##{method}" do + + describe "when empty" do + + before do + @set = Hamster.set + end + + it "with a block returns true" do + @set.send(method) {}.should == true + end + + it "with no block returns true" do + @set.send(method).should == true + end + + end + + describe "when not empty" do + + describe "with a block" do + + before do + @set = Hamster.set("A", "B", "C") + end + + it "returns true if the block always returns true" do + @set.send(method) { |item| true }.should == true + end + + it "returns false if the block ever returns false" do + @set.send(method) { |item| item == "D" }.should == false + end + + end + + describe "with no block" do + + it "returns true if all values are truthy" do + Hamster.set(true, "A").send(method).should == true + end + + [nil, false].each do |value| + + it "returns false if any value is #{value.inspect}" do + Hamster.set(value, true, "A").send(method).should == false + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/any_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/any_spec.rb new file mode 100644 index 000000000..e575b74c1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/any_spec.rb @@ -0,0 +1,67 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:any?, :exist?, :exists?].each do |method| + + describe "##{method}" do + + describe "when empty" do + + before do + @set = Hamster.set + end + + it "with a block returns false" do + @set.send(method) {}.should == false + end + + it "with no block returns false" do + @set.send(method).should == false + end + + end + + describe "when not empty" do + + describe "with a block" do + + before do + @set = Hamster.set("A", "B", "C", nil) + end + + ["A", "B", "C", nil].each do |value| + + it "returns true if the block ever returns true (#{value.inspect})" do + @set.send(method) { |item| item == value }.should == true + end + + end + + it "returns false if the block always returns false" do + @set.send(method) { |item| item == "D" }.should == false + end + + end + + describe "with no block" do + + it "returns true if any value is truthy" do + Hamster.set(nil, false, true, "A").send(method).should == true + end + + it "returns false if all values are falsey" do + Hamster.set(nil, false).send(method).should == false + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/clear_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/clear_spec.rb new file mode 100644 index 000000000..502dd4dc3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/clear_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + describe "#clear" do + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values}" do + + before do + @original = Hamster.set(*values) + @result = @original.clear + end + + it "preserves the original" do + @original.should == Hamster.set(*values) + end + + it "returns an empty set" do + @result.should equal(Hamster.set) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/compact_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/compact_spec.rb new file mode 100644 index 000000000..671333fb6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/compact_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + describe "#compact" do + + [ + [[], []], + [["A"], ["A"]], + [["A", "B", "C"], ["A", "B", "C"]], + [[nil], []], + [[nil, "B"], ["B"]], + [["A", nil], ["A"]], + [[nil, nil], []], + [["A", nil, "C"], ["A", "C"]], + [[nil, "B", nil], ["B"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.set(*values) + @result = @original.compact + end + + it "preserves the original" do + @original.should == Hamster.set(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.set(*expected) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/construction_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/construction_spec.rb new file mode 100644 index 000000000..713b993ae --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/construction_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + describe ".set" do + + describe "with no values" do + + it "returns the empty set" do + Hamster.set.should equal(Hamster::EmptySet) + end + + end + + describe "with a list of values" do + + before do + @set = Hamster.set("A", "B", "C") + end + + it "is equivalent to repeatedly using #add" do + @set.should == Hamster.set.add("A").add("B").add("C") + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/copying_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/copying_spec.rb new file mode 100644 index 000000000..2559895e6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/copying_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + before do + @set = Hamster.set("A", "B", "C") + end + + [:dup, :clone].each do |method| + + describe "##{method}" do + + it "returns self" do + @set.send(method).should equal(@set) + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/count_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/count_spec.rb new file mode 100644 index 000000000..502378d0c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/count_spec.rb @@ -0,0 +1,54 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + describe "#count" do + + [ + [[], 0], + [[1], 1], + [[1, 2], 1], + [[1, 2, 3], 2], + [[1, 2, 3, 4], 2], + [[1, 2, 3, 4, 5], 3], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.set(*values) + end + + describe "with a block" do + + before do + @result = @original.count(&:odd?) + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + describe "without a block" do + + before do + @result = @original.count + end + + it "returns length" do + @result.should == @original.length + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/app.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/app.js new file mode 100644 index 000000000..1a6902ba5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/app.js @@ -0,0 +1,66 @@ +$(document).ready(function() { + $('.file_list').dataTable({ + "aaSorting": [[ 1, "asc" ]], + "bPaginate": false, + "bJQueryUI": true, + "aoColumns": [ + null, + { "sType": "percent" }, + null, + null, + null, + null + ] + }); + + $('.source_table tbody tr:odd').addClass('odd'); + $('.source_table tbody tr:even').addClass('even'); + + $("a.src_link").fancybox({ + 'hideOnContentClick': true + }); + + // Hide src files and file list container + $('.source_files').hide(); + $('.file_list_container').hide(); + + // Add tabs based upon existing file_list_containers + $('.file_list_container h2').each(function(){ + $('.group_tabs').append('
  • ' + $(this).html() + '
  • '); + }); + + $('.group_tabs a').each( function() { + $(this).addClass($(this).attr('href').replace('#', '')); + }); + + $('.group_tabs a').live('focus', function() { + $(this).blur(); + }); + + var favicon_path = $('link[rel="shortcut icon"]').attr('href') + $('.group_tabs a').live('click', function(){ + if (!$(this).parent().hasClass('active')) { + $('.group_tabs a').parent().removeClass('active'); + $(this).parent().addClass('active'); + $('.file_list_container').hide(); + $(".file_list_container" + $(this).attr('href')).show(); + window.location.href = window.location.href.split('#')[0] + $(this).attr('href').replace('#', '#_'); + + // Force favicon reload - otherwise the location change containing anchor would drop the favicon... + // Works only on firefox, but still... - Anyone know a better solution to force favicon? + $('link[rel="shortcut icon"]').remove(); + $('head').append(''); + }; + return false; + }); + + if (jQuery.url.attr('anchor')) { + $('.group_tabs a.'+jQuery.url.attr('anchor').replace('_', '')).click(); + } else { + $('.group_tabs a:first').click(); + }; + + $("abbr.timeago").timeago(); + $('#loading').fadeOut(); + $('#wrapper').show(); +}); diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/blank.gif b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/blank.gif new file mode 100644 index 000000000..35d42e808 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/blank.gif differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_close.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_close.png new file mode 100644 index 000000000..07035307a Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_close.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_loading.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_loading.png new file mode 100644 index 000000000..250301796 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_loading.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_nav_left.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_nav_left.png new file mode 100644 index 000000000..ebaa6a4fd Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_nav_left.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_nav_right.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_nav_right.png new file mode 100644 index 000000000..873294e96 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_nav_right.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_e.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_e.png new file mode 100644 index 000000000..2eda08936 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_e.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_n.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_n.png new file mode 100644 index 000000000..69aa10e23 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_n.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_ne.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_ne.png new file mode 100644 index 000000000..79f6980a3 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_ne.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_nw.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_nw.png new file mode 100644 index 000000000..7182cd938 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_nw.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_s.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_s.png new file mode 100644 index 000000000..d8858bfb7 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_s.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_se.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_se.png new file mode 100644 index 000000000..541e3ffd3 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_se.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_sw.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_sw.png new file mode 100644 index 000000000..b451689fa Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_sw.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_w.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_w.png new file mode 100644 index 000000000..8a4e4a887 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_w.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_title_left.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_title_left.png new file mode 100644 index 000000000..6049223d1 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_title_left.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_title_main.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_title_main.png new file mode 100644 index 000000000..8044271f2 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_title_main.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_title_over.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_title_over.png new file mode 100644 index 000000000..d9f458f4b Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_title_over.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_title_right.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_title_right.png new file mode 100644 index 000000000..e36d9db2a Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_title_right.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancybox-x.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancybox-x.png new file mode 100644 index 000000000..c2130f869 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancybox-x.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancybox-y.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancybox-y.png new file mode 100644 index 000000000..7ef399b99 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancybox-y.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancybox.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancybox.png new file mode 100644 index 000000000..65e14f68f Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/fancybox.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.css b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.css new file mode 100644 index 000000000..28bbb1327 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.css @@ -0,0 +1,363 @@ +/* + * FancyBox - jQuery Plugin + * Simple and fancy lightbox alternative + * + * Examples and documentation at: http://fancybox.net + * + * Copyright (c) 2008 - 2010 Janis Skarnelis + * + * Version: 1.3.1 (05/03/2010) + * Requires: jQuery v1.3+ + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ + +#fancybox-loading { + position: fixed; + top: 50%; + left: 50%; + height: 40px; + width: 40px; + margin-top: -20px; + margin-left: -20px; + cursor: pointer; + overflow: hidden; + z-index: 1104; + display: none; +} + +* html #fancybox-loading { /* IE6 */ + position: absolute; + margin-top: 0; +} + +#fancybox-loading div { + position: absolute; + top: 0; + left: 0; + width: 40px; + height: 480px; + background-image: url('fancybox.png'); +} + +#fancybox-overlay { + position: fixed; + top: 0; + left: 0; + bottom: 0; + right: 0; + background: #000; + z-index: 1100; + display: none; +} + +* html #fancybox-overlay { /* IE6 */ + position: absolute; + width: 100%; +} + +#fancybox-tmp { + padding: 0; + margin: 0; + border: 0; + overflow: auto; + display: none; +} + +#fancybox-wrap { + position: absolute; + top: 0; + left: 0; + margin: 0; + padding: 20px; + z-index: 1101; + display: none; +} + +#fancybox-outer { + position: relative; + width: 100%; + height: 100%; + background: #FFF; +} + +#fancybox-inner { + position: absolute; + top: 0; + left: 0; + width: 1px; + height: 1px; + padding: 0; + margin: 0; + outline: none; + overflow: hidden; +} + +#fancybox-hide-sel-frame { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: transparent; +} + +#fancybox-close { + position: absolute; + top: -15px; + right: -15px; + width: 30px; + height: 30px; + background-image: url('fancybox.png'); + background-position: -40px 0px; + cursor: pointer; + z-index: 1103; + display: none; +} + +#fancybox_error { + color: #444; + font: normal 12px/20px Arial; + padding: 7px; + margin: 0; +} + +#fancybox-content { + height: auto; + width: auto; + padding: 0; + margin: 0; +} + +#fancybox-img { + width: 100%; + height: 100%; + padding: 0; + margin: 0; + border: none; + outline: none; + line-height: 0; + vertical-align: top; + -ms-interpolation-mode: bicubic; +} + +#fancybox-frame { + position: relative; + width: 100%; + height: 100%; + border: none; + display: block; +} + +#fancybox-title { + position: absolute; + bottom: 0; + left: 0; + font-family: Arial; + font-size: 12px; + z-index: 1102; +} + +.fancybox-title-inside { + padding: 10px 0; + text-align: center; + color: #333; +} + +.fancybox-title-outside { + padding-top: 5px; + color: #FFF; + text-align: center; + font-weight: bold; +} + +.fancybox-title-over { + color: #FFF; + text-align: left; +} + +#fancybox-title-over { + padding: 10px; + background-image: url('fancy_title_over.png'); + display: block; +} + +#fancybox-title-wrap { + display: inline-block; +} + +#fancybox-title-wrap span { + height: 32px; + float: left; +} + +#fancybox-title-left { + padding-left: 15px; + background-image: url('fancybox.png'); + background-position: -40px -90px; + background-repeat: no-repeat; +} + +#fancybox-title-main { + font-weight: bold; + line-height: 29px; + background-image: url('fancybox-x.png'); + background-position: 0px -40px; + color: #FFF; +} + +#fancybox-title-right { + padding-left: 15px; + background-image: url('fancybox.png'); + background-position: -55px -90px; + background-repeat: no-repeat; +} + +#fancybox-left, #fancybox-right { + position: absolute; + bottom: 0px; + height: 100%; + width: 35%; + cursor: pointer; + outline: none; + background-image: url('blank.gif'); + z-index: 1102; + display: none; +} + +#fancybox-left { + left: 0px; +} + +#fancybox-right { + right: 0px; +} + +#fancybox-left-ico, #fancybox-right-ico { + position: absolute; + top: 50%; + left: -9999px; + width: 30px; + height: 30px; + margin-top: -15px; + cursor: pointer; + z-index: 1102; + display: block; +} + +#fancybox-left-ico { + background-image: url('fancybox.png'); + background-position: -40px -30px; +} + +#fancybox-right-ico { + background-image: url('fancybox.png'); + background-position: -40px -60px; +} + +#fancybox-left:hover, #fancybox-right:hover { + visibility: visible; /* IE6 */ +} + +#fancybox-left:hover span { + left: 20px; +} + +#fancybox-right:hover span { + left: auto; + right: 20px; +} + +.fancy-bg { + position: absolute; + padding: 0; + margin: 0; + border: 0; + width: 20px; + height: 20px; + z-index: 1001; +} + +#fancy-bg-n { + top: -20px; + left: 0; + width: 100%; + background-image: url('fancybox-x.png'); +} + +#fancy-bg-ne { + top: -20px; + right: -20px; + background-image: url('fancybox.png'); + background-position: -40px -162px; +} + +#fancy-bg-e { + top: 0; + right: -20px; + height: 100%; + background-image: url('fancybox-y.png'); + background-position: -20px 0px; +} + +#fancy-bg-se { + bottom: -20px; + right: -20px; + background-image: url('fancybox.png'); + background-position: -40px -182px; +} + +#fancy-bg-s { + bottom: -20px; + left: 0; + width: 100%; + background-image: url('fancybox-x.png'); + background-position: 0px -20px; +} + +#fancy-bg-sw { + bottom: -20px; + left: -20px; + background-image: url('fancybox.png'); + background-position: -40px -142px; +} + +#fancy-bg-w { + top: 0; + left: -20px; + height: 100%; + background-image: url('fancybox-y.png'); +} + +#fancy-bg-nw { + top: -20px; + left: -20px; + background-image: url('fancybox.png'); + background-position: -40px -122px; +} + +/* IE */ + +#fancybox-loading.fancybox-ie div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_loading.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_close.png', sizingMethod='scale'); } + +.fancybox-ie #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_over.png', sizingMethod='scale'); zoom: 1; } +.fancybox-ie #fancybox-title-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_left.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-title-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_main.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-title-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_right.png', sizingMethod='scale'); } + +.fancybox-ie #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_left.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_right.png', sizingMethod='scale'); } + +.fancybox-ie .fancy-bg { background: transparent !important; } + +.fancybox-ie #fancy-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_n.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_ne.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_e.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_se.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_s.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_sw.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_w.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_nw.png', sizingMethod='scale'); } diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.pack.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.pack.js new file mode 100644 index 000000000..8421d53a6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.pack.js @@ -0,0 +1,44 @@ +/* + * FancyBox - jQuery Plugin + * Simple and fancy lightbox alternative + * + * Examples and documentation at: http://fancybox.net + * + * Copyright (c) 2008 - 2010 Janis Skarnelis + * + * Version: 1.3.1 (05/03/2010) + * Requires: jQuery v1.3+ + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ + +(function(b){var m,u,x,g,D,i,z,A,B,p=0,e={},q=[],n=0,c={},j=[],E=null,s=new Image,G=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,S=/[^\.]\.(swf)\s*$/i,H,I=1,k,l,h=false,y=b.extend(b("
    ")[0],{prop:0}),v=0,O=!b.support.opacity&&!window.XMLHttpRequest,J=function(){u.hide();s.onerror=s.onload=null;E&&E.abort();m.empty()},P=function(){b.fancybox('

    The requested content cannot be loaded.
    Please try again later.

    ',{scrolling:"no",padding:20,transitionIn:"none",transitionOut:"none"})}, +K=function(){return[b(window).width(),b(window).height(),b(document).scrollLeft(),b(document).scrollTop()]},T=function(){var a=K(),d={},f=c.margin,o=c.autoScale,t=(20+f)*2,w=(20+f)*2,r=c.padding*2;if(c.width.toString().indexOf("%")>-1){d.width=a[0]*parseFloat(c.width)/100-40;o=false}else d.width=c.width+r;if(c.height.toString().indexOf("%")>-1){d.height=a[1]*parseFloat(c.height)/100-40;o=false}else d.height=c.height+r;if(o&&(d.width>a[0]-t||d.height>a[1]-w))if(e.type=="image"||e.type=="swf"){t+=r; +w+=r;o=Math.min(Math.min(a[0]-t,c.width)/c.width,Math.min(a[1]-w,c.height)/c.height);d.width=Math.round(o*(d.width-r))+r;d.height=Math.round(o*(d.height-r))+r}else{d.width=Math.min(d.width,a[0]-t);d.height=Math.min(d.height,a[1]-w)}d.top=a[3]+(a[1]-(d.height+40))*0.5;d.left=a[2]+(a[0]-(d.width+40))*0.5;if(c.autoScale===false){d.top=Math.max(a[3]+f,d.top);d.left=Math.max(a[2]+f,d.left)}return d},U=function(a){if(a&&a.length)switch(c.titlePosition){case "inside":return a;case "over":return''+ +a+"";default:return''+a+''}return false},V=function(){var a=c.title,d=l.width-c.padding*2,f="fancybox-title-"+c.titlePosition;b("#fancybox-title").remove();v=0;if(c.titleShow!==false){a=b.isFunction(c.titleFormat)?c.titleFormat(a,j,n,c):U(a);if(!(!a||a==="")){b('
    ').css({width:d,paddingLeft:c.padding, +paddingRight:c.padding}).html(a).appendTo("body");switch(c.titlePosition){case "inside":v=b("#fancybox-title").outerHeight(true)-c.padding;l.height+=v;break;case "over":b("#fancybox-title").css("bottom",c.padding);break;default:b("#fancybox-title").css("bottom",b("#fancybox-title").outerHeight(true)*-1);break}b("#fancybox-title").appendTo(D).hide()}}},W=function(){b(document).unbind("keydown.fb").bind("keydown.fb",function(a){if(a.keyCode==27&&c.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if(a.keyCode== +37){a.preventDefault();b.fancybox.prev()}else if(a.keyCode==39){a.preventDefault();b.fancybox.next()}});if(b.fn.mousewheel){g.unbind("mousewheel.fb");j.length>1&&g.bind("mousewheel.fb",function(a,d){a.preventDefault();h||d===0||(d>0?b.fancybox.prev():b.fancybox.next())})}if(c.showNavArrows){if(c.cyclic&&j.length>1||n!==0)A.show();if(c.cyclic&&j.length>1||n!=j.length-1)B.show()}},X=function(){var a,d;if(j.length-1>n){a=j[n+1].href;if(typeof a!=="undefined"&&a.match(G)){d=new Image;d.src=a}}if(n>0){a= +j[n-1].href;if(typeof a!=="undefined"&&a.match(G)){d=new Image;d.src=a}}},L=function(){i.css("overflow",c.scrolling=="auto"?c.type=="image"||c.type=="iframe"||c.type=="swf"?"hidden":"auto":c.scrolling=="yes"?"auto":"visible");if(!b.support.opacity){i.get(0).style.removeAttribute("filter");g.get(0).style.removeAttribute("filter")}b("#fancybox-title").show();c.hideOnContentClick&&i.one("click",b.fancybox.close);c.hideOnOverlayClick&&x.one("click",b.fancybox.close);c.showCloseButton&&z.show();W();b(window).bind("resize.fb", +b.fancybox.center);c.centerOnScroll?b(window).bind("scroll.fb",b.fancybox.center):b(window).unbind("scroll.fb");b.isFunction(c.onComplete)&&c.onComplete(j,n,c);h=false;X()},M=function(a){var d=Math.round(k.width+(l.width-k.width)*a),f=Math.round(k.height+(l.height-k.height)*a),o=Math.round(k.top+(l.top-k.top)*a),t=Math.round(k.left+(l.left-k.left)*a);g.css({width:d+"px",height:f+"px",top:o+"px",left:t+"px"});d=Math.max(d-c.padding*2,0);f=Math.max(f-(c.padding*2+v*a),0);i.css({width:d+"px",height:f+ +"px"});if(typeof l.opacity!=="undefined")g.css("opacity",a<0.5?0.5:a)},Y=function(a){var d=a.offset();d.top+=parseFloat(a.css("paddingTop"))||0;d.left+=parseFloat(a.css("paddingLeft"))||0;d.top+=parseFloat(a.css("border-top-width"))||0;d.left+=parseFloat(a.css("border-left-width"))||0;d.width=a.width();d.height=a.height();return d},Q=function(){var a=e.orig?b(e.orig):false,d={};if(a&&a.length){a=Y(a);d={width:a.width+c.padding*2,height:a.height+c.padding*2,top:a.top-c.padding-20,left:a.left-c.padding- +20}}else{a=K();d={width:1,height:1,top:a[3]+a[1]*0.5,left:a[2]+a[0]*0.5}}return d},N=function(){u.hide();if(g.is(":visible")&&b.isFunction(c.onCleanup))if(c.onCleanup(j,n,c)===false){b.event.trigger("fancybox-cancel");h=false;return}j=q;n=p;c=e;i.get(0).scrollTop=0;i.get(0).scrollLeft=0;if(c.overlayShow){O&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"}); +x.css({"background-color":c.overlayColor,opacity:c.overlayOpacity}).unbind().show()}l=T();V();if(g.is(":visible")){b(z.add(A).add(B)).hide();var a=g.position(),d;k={top:a.top,left:a.left,width:g.width(),height:g.height()};d=k.width==l.width&&k.height==l.height;i.fadeOut(c.changeFade,function(){var f=function(){i.html(m.contents()).fadeIn(c.changeFade,L)};b.event.trigger("fancybox-change");i.empty().css("overflow","hidden");if(d){i.css({top:c.padding,left:c.padding,width:Math.max(l.width-c.padding* +2,1),height:Math.max(l.height-c.padding*2-v,1)});f()}else{i.css({top:c.padding,left:c.padding,width:Math.max(k.width-c.padding*2,1),height:Math.max(k.height-c.padding*2,1)});y.prop=0;b(y).animate({prop:1},{duration:c.changeSpeed,easing:c.easingChange,step:M,complete:f})}})}else{g.css("opacity",1);if(c.transitionIn=="elastic"){k=Q();i.css({top:c.padding,left:c.padding,width:Math.max(k.width-c.padding*2,1),height:Math.max(k.height-c.padding*2,1)}).html(m.contents());g.css(k).show();if(c.opacity)l.opacity= +0;y.prop=0;b(y).animate({prop:1},{duration:c.speedIn,easing:c.easingIn,step:M,complete:L})}else{i.css({top:c.padding,left:c.padding,width:Math.max(l.width-c.padding*2,1),height:Math.max(l.height-c.padding*2-v,1)}).html(m.contents());g.css(l).fadeIn(c.transitionIn=="none"?0:c.speedIn,L)}}},F=function(){m.width(e.width);m.height(e.height);if(e.width=="auto")e.width=m.width();if(e.height=="auto")e.height=m.height();N()},Z=function(){h=true;e.width=s.width;e.height=s.height;b("").attr({id:"fancybox-img", +src:s.src,alt:e.title}).appendTo(m);N()},C=function(){J();var a=q[p],d,f,o,t,w;e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));o=a.title||b(a).title||e.title||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(o===""&&e.orig)o=e.orig.attr("alt");d=a.nodeName&&/^(?:javascript|#)/i.test(a.href)?e.href||null:e.href||a.href||null;if(e.type){f=e.type;if(!d)d=e.content}else if(e.content)f="html";else if(d)if(d.match(G))f= +"image";else if(d.match(S))f="swf";else if(b(a).hasClass("iframe"))f="iframe";else if(d.match(/#/)){a=d.substr(d.indexOf("#"));f=b(a).length>0?"inline":"ajax"}else f="ajax";else f="inline";e.type=f;e.href=d;e.title=o;if(e.autoDimensions&&e.type!=="iframe"&&e.type!=="swf"){e.width="auto";e.height="auto"}if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=false;e.enableEscapeButton=false;e.showCloseButton=false}if(b.isFunction(e.onStart))if(e.onStart(q,p,e)===false){h=false; +return}m.css("padding",20+e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(i.children())});switch(f){case "html":m.html(e.content);F();break;case "inline":b('
    ').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(i.children())}).bind("fancybox-cancel",function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity(); +s=new Image;s.onerror=function(){P()};s.onload=function(){s.onerror=null;s.onload=null;Z()};s.src=d;break;case "swf":t='';w="";b.each(e.swf,function(r,R){t+='';w+=" "+r+'="'+R+'"'});t+='";m.html(t); +F();break;case "ajax":a=d.split("#",2);f=e.ajax.data||{};if(a.length>1){d=a[0];if(typeof f=="string")f+="&selector="+a[1];else f.selector=a[1]}h=false;b.fancybox.showActivity();E=b.ajax(b.extend(e.ajax,{url:d,data:f,error:P,success:function(r){if(E.status==200){m.html(r);F()}}}));break;case "iframe":b('').appendTo(m);N();break}},$=function(){if(u.is(":visible")){b("div", +u).css("top",I*-40+"px");I=(I+1)%12}else clearInterval(H)},aa=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('
    '),u=b('
    '),x=b('
    '),g=b('
    '));if(!b.support.opacity){g.addClass("fancybox-ie");u.addClass("fancybox-ie")}D=b('
    ').append('
    ').appendTo(g); +D.append(i=b('
    '),z=b(''),A=b(''),B=b(''));z.click(b.fancybox.close);u.click(b.fancybox.cancel);A.click(function(a){a.preventDefault();b.fancybox.prev()});B.click(function(a){a.preventDefault();b.fancybox.next()});if(O){x.get(0).style.setExpression("height", +"document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'");u.get(0).style.setExpression("top","(-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'");D.prepend('')}}}; +b.fn.fancybox=function(a){b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(d){d.preventDefault();if(!h){h=true;b(this).blur();q=[];p=0;d=b(this).attr("rel")||"";if(!d||d==""||d==="nofollow")q.push(this);else{q=b("a[rel="+d+"], area[rel="+d+"]");p=q.index(this)}C();return false}});return this};b.fancybox=function(a,d){if(!h){h=true;d=typeof d!=="undefined"?d:{};q=[];p=d.index||0;if(b.isArray(a)){for(var f=0,o=a.length;fq.length||p<0)p=0;C()}};b.fancybox.showActivity=function(){clearInterval(H);u.show();H=setInterval($,66)};b.fancybox.hideActivity=function(){u.hide()};b.fancybox.next=function(){return b.fancybox.pos(n+1)};b.fancybox.prev=function(){return b.fancybox.pos(n- +1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a,10);if(a>-1&&j.length>a){p=a;C()}if(c.cyclic&&j.length>1&&a<0){p=j.length-1;C()}if(c.cyclic&&j.length>1&&a>=j.length){p=0;C()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");J();e&&b.isFunction(e.onCancel)&&e.onCancel(q,p,e);h=false}};b.fancybox.close=function(){function a(){x.fadeOut("fast");g.hide();b.event.trigger("fancybox-cleanup");i.empty();b.isFunction(c.onClosed)&&c.onClosed(j,n,c);j=e=[];n=p=0;c=e={};h=false} +if(!(h||g.is(":hidden"))){h=true;if(c&&b.isFunction(c.onCleanup))if(c.onCleanup(j,n,c)===false){h=false;return}J();b(z.add(A).add(B)).hide();b("#fancybox-title").remove();g.add(i).add(x).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");i.css("overflow","hidden");if(c.transitionOut=="elastic"){k=Q();var d=g.position();l={top:d.top,left:d.left,width:g.width(),height:g.height()};if(c.opacity)l.opacity=1;y.prop=1;b(y).animate({prop:0},{duration:c.speedOut,easing:c.easingOut, +step:M,complete:a})}else g.fadeOut(c.transitionOut=="none"?0:c.speedOut,a)}};b.fancybox.resize=function(){var a,d;if(!(h||g.is(":hidden"))){h=true;a=i.wrapInner("
    ").children();d=a.height();g.css({height:d+c.padding*2+v});i.css({height:d});a.replaceWith(a.children());b.fancybox.center()}};b.fancybox.center=function(){h=true;var a=K(),d=c.margin,f={};f.top=a[3]+(a[1]-(g.height()-v+40))*0.5;f.left=a[2]+(a[0]-(g.width()+40))*0.5;f.top=Math.max(a[3]+d,f.top);f.left=Math.max(a[2]+ +d,f.left);g.css(f);h=false};b.fn.fancybox.defaults={padding:10,margin:20,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.3,overlayColor:"#666",titleShow:true,titlePosition:"outside",titleFormat:null,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast", +easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,onStart:null,onCancel:null,onComplete:null,onCleanup:null,onClosed:null};b(document).ready(function(){aa()})})(jQuery); \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/favicon.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/favicon.png new file mode 100644 index 000000000..6bd0e1338 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/favicon.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/jquery-1.4.2.min.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/jquery-1.4.2.min.js new file mode 100644 index 000000000..b170a78f8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/jquery-1.4.2.min.js @@ -0,0 +1,155 @@ +/*! + * jQuery JavaScript Library v1.4.2 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Sat Feb 13 22:33:48 2010 -0500 + */ +(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, +Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& +(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, +a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== +"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, +function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
    a"; +var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, +parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= +false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= +s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, +applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; +else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, +a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== +w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, +cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= +c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); +a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, +function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); +k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), +C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= +e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& +f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; +if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", +e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, +"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, +d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, +e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); +t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| +g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, +CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, +g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, +text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, +setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= +h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== +"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, +h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& +q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; +if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

    ";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); +(function(){var g=s.createElement("div");g.innerHTML="
    ";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: +function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= +{},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== +"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", +d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? +a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== +1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
    ","
    "];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, +""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); +return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", +""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= +c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? +c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= +function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= +Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, +"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= +a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= +a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== +"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
    ").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, +serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), +function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, +global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& +e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? +"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== +false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= +false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", +c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| +d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); +g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== +1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== +"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; +if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== +"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| +c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; +this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= +this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, +e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
    "; +a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); +c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, +d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- +f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": +"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in +e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/jquery.dataTables.min.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/jquery.dataTables.min.js new file mode 100644 index 000000000..b5ee8585d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/jquery.dataTables.min.js @@ -0,0 +1,152 @@ +/* + * File: jquery.dataTables.min.js + * Version: 1.7.0 + * Author: Allan Jardine (www.sprymedia.co.uk) + * Info: www.datatables.net + * + * Copyright 2008-2010 Allan Jardine, all rights reserved. + * + * This source file is free software, under either the GPL v2 license or a + * BSD style license, as supplied with this software. + * + * This source file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. + */ +(function(j,Y,p){j.fn.dataTableSettings=[];var E=j.fn.dataTableSettings;j.fn.dataTableExt={};var m=j.fn.dataTableExt;m.sVersion="1.7.0";m.sErrMode="alert";m.iApiIndex=0;m.oApi={};m.afnFiltering=[];m.aoFeatures=[];m.ofnSearch={};m.afnSortData=[];m.oStdClasses={sPagePrevEnabled:"paginate_enabled_previous",sPagePrevDisabled:"paginate_disabled_previous",sPageNextEnabled:"paginate_enabled_next",sPageNextDisabled:"paginate_disabled_next",sPageJUINext:"",sPageJUIPrev:"",sPageButton:"paginate_button",sPageButtonActive:"paginate_active", +sPageButtonStaticDisabled:"paginate_button",sPageFirst:"first",sPagePrevious:"previous",sPageNext:"next",sPageLast:"last",sStripOdd:"odd",sStripEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled", +sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:""};m.oJUIClasses={sPagePrevEnabled:"fg-button ui-state-default ui-corner-left",sPagePrevDisabled:"fg-button ui-state-default ui-corner-left ui-state-disabled", +sPageNextEnabled:"fg-button ui-state-default ui-corner-right",sPageNextDisabled:"fg-button ui-state-default ui-corner-right ui-state-disabled",sPageJUINext:"ui-icon ui-icon-circle-arrow-e",sPageJUIPrev:"ui-icon ui-icon-circle-arrow-w",sPageButton:"fg-button ui-state-default",sPageButtonActive:"fg-button ui-state-default ui-state-disabled",sPageButtonStaticDisabled:"fg-button ui-state-default ui-state-disabled",sPageFirst:"first ui-corner-tl ui-corner-bl",sPagePrevious:"previous",sPageNext:"next", +sPageLast:"last ui-corner-tr ui-corner-br",sStripOdd:"odd",sStripEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate fg-buttonset fg-buttonset-multi paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"ui-state-default",sSortDesc:"ui-state-default",sSortable:"ui-state-default",sSortableAsc:"ui-state-default",sSortableDesc:"ui-state-default",sSortableNone:"ui-state-default", +sSortColumn:"sorting_",sSortJUIAsc:"css_right ui-icon ui-icon-triangle-1-n",sSortJUIDesc:"css_right ui-icon ui-icon-triangle-1-s",sSortJUI:"css_right ui-icon ui-icon-carat-2-n-s",sSortJUIAscAllowed:"css_right ui-icon ui-icon-carat-1-n",sSortJUIDescAllowed:"css_right ui-icon ui-icon-carat-1-s",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead ui-state-default",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot ui-state-default", +sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:"ui-state-default"};m.oPagination={two_button:{fnInit:function(g,l,q){var r,u,y;if(g.bJUI){r=p.createElement("a");u=p.createElement("a");y=p.createElement("span");y.className=g.oClasses.sPageJUINext;u.appendChild(y);y=p.createElement("span");y.className=g.oClasses.sPageJUIPrev;r.appendChild(y)}else{r=p.createElement("div");u=p.createElement("div")}r.className=g.oClasses.sPagePrevDisabled;u.className=g.oClasses.sPageNextDisabled;r.title=g.oLanguage.oPaginate.sPrevious; +u.title=g.oLanguage.oPaginate.sNext;l.appendChild(r);l.appendChild(u);j(r).click(function(){g.oApi._fnPageChange(g,"previous")&&q(g)});j(u).click(function(){g.oApi._fnPageChange(g,"next")&&q(g)});j(r).bind("selectstart",function(){return false});j(u).bind("selectstart",function(){return false});if(g.sTableId!==""&&typeof g.aanFeatures.p=="undefined"){l.setAttribute("id",g.sTableId+"_paginate");r.setAttribute("id",g.sTableId+"_previous");u.setAttribute("id",g.sTableId+"_next")}},fnUpdate:function(g){if(g.aanFeatures.p)for(var l= +g.aanFeatures.p,q=0,r=l.length;q=u-r){r=u-q+1;w=u}else{r=y-Math.ceil(q/2)+1;w=r+q-1}for(q=r;q<=w;q++)C+=y!=q?''+q+"":''+q+"";w=g.aanFeatures.p;var z,D=function(){g._iDisplayStart= +(this.innerHTML*1-1)*g._iDisplayLength;l(g);return false},L=function(){return false};q=0;for(r=w.length;ql?1:0},"string-desc":function(g,l){g=g.toLowerCase();l=l.toLowerCase();return gl?-1:0},"html-asc":function(g,l){g=g.replace(/<.*?>/g,"").toLowerCase(); +l=l.replace(/<.*?>/g,"").toLowerCase();return gl?1:0},"html-desc":function(g,l){g=g.replace(/<.*?>/g,"").toLowerCase();l=l.replace(/<.*?>/g,"").toLowerCase();return gl?-1:0},"date-asc":function(g,l){g=Date.parse(g);l=Date.parse(l);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(l)||l==="")l=Date.parse("01/01/1970 00:00:00");return g-l},"date-desc":function(g,l){g=Date.parse(g);l=Date.parse(l);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(l)||l=== +"")l=Date.parse("01/01/1970 00:00:00");return l-g},"numeric-asc":function(g,l){return(g=="-"||g===""?0:g*1)-(l=="-"||l===""?0:l*1)},"numeric-desc":function(g,l){return(l=="-"||l===""?0:l*1)-(g=="-"||g===""?0:g*1)}};m.aTypes=[function(g){if(g.length===0)return"numeric";var l,q=false;l=g.charAt(0);if("0123456789-".indexOf(l)==-1)return null;for(var r=1;r")!=-1)return"html";return null}];m.fnVersionCheck=function(g){var l=function(w,x){for(;w.length=parseInt(u,10)};m._oExternConfig={iNextUnique:0};j.fn.dataTable=function(g){function l(){this.fnRecordsTotal=function(){return this.oFeatures.bServerSide? +this._iRecordsTotal:this.aiDisplayMaster.length};this.fnRecordsDisplay=function(){return this.oFeatures.bServerSide?this._iRecordsDisplay:this.aiDisplay.length};this.fnDisplayEnd=function(){return this.oFeatures.bServerSide?this.oFeatures.bPaginate===false?this._iDisplayStart+this.aiDisplay.length:Math.min(this._iDisplayStart+this._iDisplayLength,this._iDisplayStart+this.aiDisplay.length):this._iDisplayEnd};this.sInstance=this.oInstance=null;this.oFeatures={bPaginate:true,bLengthChange:true,bFilter:true, +bSort:true,bInfo:true,bAutoWidth:true,bProcessing:false,bSortClasses:true,bStateSave:false,bServerSide:false};this.oScroll={sX:"",sXInner:"",sY:"",bCollapse:false,iBarWidth:0};this.aanFeatures=[];this.oLanguage={sProcessing:"Processing...",sLengthMenu:"Show _MENU_ entries",sZeroRecords:"No matching records found",sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)", +sInfoPostFix:"",sSearch:"Search:",sUrl:"",oPaginate:{sFirst:"First",sPrevious:"Previous",sNext:"Next",sLast:"Last"}};this.aoData=[];this.aiDisplay=[];this.aiDisplayMaster=[];this.aoColumns=[];this.iNextId=0;this.asDataSearch=[];this.oPreviousSearch={sSearch:"",bRegex:false,bSmart:true};this.aoPreSearchCols=[];this.aaSorting=[[0,"asc",0]];this.aaSortingFixed=null;this.asStripClasses=[];this.asDestoryStrips=[];this.fnFooterCallback=this.fnHeaderCallback=this.fnRowCallback=null;this.aoDrawCallback=[]; +this.fnInitComplete=null;this.sTableId="";this.nTableWrapper=this.nTBody=this.nTFoot=this.nTHead=this.nTable=null;this.iDefaultSortIndex=0;this.bInitialised=false;this.aoOpenRows=[];this.sDom="lfrtip";this.sPaginationType="two_button";this.iCookieDuration=7200;this.sCookiePrefix="SpryMedia_DataTables_";this.sAjaxSource=null;this.bAjaxDataGet=true;this.fnServerData=function(a,b,c){j.ajax({url:a,data:b,success:c,dataType:"json",cache:false,error:function(){alert("DataTables warning: JSON data from server failed to load or be parsed. This is most likely to be caused by a JSON formatting error.")}})}; +this.fnFormatNumber=function(a){if(a<1E3)return a;else{var b=a+"";a=b.split("");var c="";b=b.length;for(var d=0;d=a.fnRecordsDisplay()?0:a.iInitDisplayStart;a.iInitDisplayStart=-1;F(a)}if(!(a.oFeatures.bServerSide&&!oa(a))){if(a.aiDisplay.length!==0){var i=a._iDisplayStart,h=a._iDisplayEnd;if(a.oFeatures.bServerSide){i=0;h=a.aoData.length}for(i=i;itr",a.nTHead)[0],V(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);typeof a.fnFooterCallback=="function"&&a.fnFooterCallback.call(a.oInstance,j(">tr",a.nTFoot)[0],V(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);f= +p.createDocumentFragment();b=p.createDocumentFragment();if(a.nTBody){e=a.nTBody.parentNode;b.appendChild(a.nTBody);c=a.nTBody.childNodes;for(b=c.length-1;b>=0;b--)c[b].parentNode.removeChild(c[b]);b=0;for(c=d.length;bj(a.nTable.parentNode).width()&&U(a)}b=0;for(c=a.aoDrawCallback.length;b< +c;b++)a.aoDrawCallback[b].fn.call(a.oInstance,a);a.bSorted=false;a.bFiltered=false}}function L(a){if(a.oFeatures.bSort)O(a,a.oPreviousSearch);else if(a.oFeatures.bFilter)P(a,a.oPreviousSearch);else{F(a);D(a)}}function oa(a){if(a.bAjaxDataGet){K(a,true);var b=a.aoColumns.length,c=[],d;a.iDraw++;c.push({name:"sEcho",value:a.iDraw});c.push({name:"iColumns",value:b});c.push({name:"sColumns",value:aa(a)});c.push({name:"iDisplayStart",value:a._iDisplayStart});c.push({name:"iDisplayLength",value:a.oFeatures.bPaginate!== +false?a._iDisplayLength:-1});if(a.oFeatures.bFilter!==false){c.push({name:"sSearch",value:a.oPreviousSearch.sSearch});c.push({name:"bRegex",value:a.oPreviousSearch.bRegex});for(d=0;d")c=c.parentNode;else if(i=="l"&&a.oFeatures.bPaginate&&a.oFeatures.bLengthChange){f=ra(a);e=1}else if(i=="f"&&a.oFeatures.bFilter){f=sa(a);e=1}else if(i=="r"&&a.oFeatures.bProcessing){f=ta(a);e=1}else if(i=="t"){f=ua(a);e=1}else if(i=="i"&&a.oFeatures.bInfo){f=va(a);e=1}else if(i=="p"&&a.oFeatures.bPaginate){f=wa(a);e=1}else if(m.aoFeatures.length!==0){h=m.aoFeatures;k=0;for(o=h.length;kcaption",a.nTable);i=0;for(k=d.length;i0&&a.nTable.removeChild(i[0]);if(a.nTFoot!==null){k=a.nTable.getElementsByTagName("tfoot");k.length>0&&a.nTable.removeChild(k[0])}i= +a.nTHead.cloneNode(true);a.nTable.insertBefore(i,a.nTable.childNodes[0]);if(a.nTFoot!==null){k=a.nTFoot.cloneNode(true);a.nTable.insertBefore(k,a.nTable.childNodes[1])}var I=ca(i);f=0;for(e=I.length;ff-a.oScroll.iBarWidth)a.nTable.style.width=v(f)}else a.nTable.style.width=v(f);f=j(a.nTable).outerWidth();e=a.nTHead.getElementsByTagName("tr");i=i.getElementsByTagName("tr");M(function(A,G){o=A.style;o.paddingTop="0";o.paddingBottom="0";o.borderTopWidth="0";o.borderBottomWidth= +"0";o.height=0;s=j(A).width();G.style.width=v(s);H.push(s)},i,e);if(a.nTFoot!==null){h=k.getElementsByTagName("tr");k=a.nTFoot.getElementsByTagName("tr");M(function(A,G){o=A.style;o.paddingTop="0";o.paddingBottom="0";o.borderTopWidth="0";o.borderBottomWidth="0";s=j(A).width();G.style.width=v(s);H.push(s)},h,k)}M(function(A){A.innerHTML="";A.style.width=v(H.shift())},i);a.nTFoot!==null&&M(function(A){A.innerHTML="";A.style.width=v(H.shift())},h);if(j(a.nTable).outerWidth()d.offsetWidth?a.oScroll.iBarWidth:0;if(a.nTable.offsetHeight'; +var c=j("input",b);c.val(a.oPreviousSearch.sSearch.replace('"',"""));c.keyup(function(){for(var d=a.aanFeatures.f,f=0,e=d.length;f=0;d--){f=ga(a.aoData[a.aiDisplay[d]]._aData[c],a.aoColumns[c].sType);if(!b.test(f)){a.aiDisplay.splice(d, +1);e++}}}}function ya(a,b,c,d,f){var e=fa(b,d,f);if(typeof c=="undefined"||c===null)c=0;if(m.afnFiltering.length!==0)c=1;if(b.length<=0){a.aiDisplay.splice(0,a.aiDisplay.length);a.aiDisplay=a.aiDisplayMaster.slice()}else if(a.aiDisplay.length==a.aiDisplayMaster.length||a.oPreviousSearch.sSearch.length>b.length||c==1||b.indexOf(a.oPreviousSearch.sSearch)!==0){a.aiDisplay.splice(0,a.aiDisplay.length);Q(a,1);for(c=0;c/g,"");else if(typeof a=="string")return a.replace(/\n/g, +" ");return a}function O(a,b){var c=[],d=m.oSort,f=a.aoData,e,i,h,k;if(!a.oFeatures.bServerSide&&(a.aaSorting.length!==0||a.aaSortingFixed!==null)){c=a.aaSortingFixed!==null?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();for(h=0;h0){e=a.aoColumns[c[c.length-1][0]].iDataSort;i=a.aoColumns[e].sType;k+="iTest = oSort['"+i+"-"+c[c.length-1][1]+"']( aoData[a]._aData["+e+"], aoData[b]._aData["+e+"] );if (iTest===0) return oSort['numeric-"+c[c.length-1][1]+"'](a, b); return iTest;}";eval(k);a.aiDisplayMaster.sort(this.ClosureDataTables.fn)}this.ClosureDataTables=undefined}}if(typeof b=="undefined"||b)W(a);a.bSorted=true;if(a.oFeatures.bFilter)P(a, +a.oPreviousSearch,1);else{a.aiDisplay=a.aiDisplayMaster.slice();a._iDisplayStart=0;F(a);D(a)}}function $(a,b,c,d){j(b).click(function(f){if(a.aoColumns[c].bSortable!==false){var e=function(){var i,h;if(f.shiftKey){for(var k=false,o=0;o=i)for(b=0;b=0?a._iDisplayStart-a._iDisplayLength:0;if(a._iDisplayStart<0)a._iDisplayStart=0}else if(b=="next")if(a._iDisplayLength>=0){if(a._iDisplayStart+a._iDisplayLength=0){b=parseInt((a.fnRecordsDisplay()-1)/a._iDisplayLength,10)+1;a._iDisplayStart=(b-1)*a._iDisplayLength}else a._iDisplayStart=0;else J(a,0,"Unknown paging action: "+b);return c!=a._iDisplayStart}function va(a){var b=p.createElement("div");b.className=a.oClasses.sInfo;if(typeof a.aanFeatures.i=="undefined"){a.aoDrawCallback.push({fn:Ca,sName:"information"});a.sTableId!==""&&b.setAttribute("id",a.sTableId+"_info")}return b} +function Ca(a){if(!(!a.oFeatures.bInfo||a.aanFeatures.i.length===0)){var b=j(a.aanFeatures.i[0]),c=a.fnFormatNumber(a.fnRecordsTotal()),d=a.fnFormatNumber(a._iDisplayStart+1),f=a.fnFormatNumber(a.fnDisplayEnd()),e=a.fnFormatNumber(a.fnRecordsDisplay());if(a.fnRecordsDisplay()===0&&a.fnRecordsDisplay()==a.fnRecordsTotal())b.html(a.oLanguage.sInfoEmpty+a.oLanguage.sInfoPostFix);else if(a.fnRecordsDisplay()===0)b.html(a.oLanguage.sInfoEmpty+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",c)+a.oLanguage.sInfoPostFix); +else a.fnRecordsDisplay()==a.fnRecordsTotal()?b.html(a.oLanguage.sInfo.replace("_START_",d).replace("_END_",f).replace("_TOTAL_",e)+a.oLanguage.sInfoPostFix):b.html(a.oLanguage.sInfo.replace("_START_",d).replace("_END_",f).replace("_TOTAL_",e)+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()))+a.oLanguage.sInfoPostFix);a=a.aanFeatures.i;if(a.length>1){b=b.html();c=1;for(d=a.length;c",c,d;if(a.aLengthMenu.length==2&&typeof a.aLengthMenu[0]=="object"&&typeof a.aLengthMenu[1]=="object"){c=0;for(d=a.aLengthMenu[0].length;c'+a.aLengthMenu[1][c]+""}else{c=0;for(d=a.aLengthMenu.length;c'+a.aLengthMenu[c]+""}b+="";var f=p.createElement("div");a.sTableId!==""&&typeof a.aanFeatures.l=="undefined"&&f.setAttribute("id",a.sTableId+ +"_length");f.className=a.oClasses.sLength;f.innerHTML=a.oLanguage.sLengthMenu.replace("_MENU_",b);j('select option[value="'+a._iDisplayLength+'"]',f).attr("selected",true);j("select",f).change(function(){var e=j(this).val(),i=a.aanFeatures.l;c=0;for(d=i.length;ca.aiDisplay.length||a._iDisplayLength==-1?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength}function Da(a,b){if(!a||a===null||a==="")return 0;if(typeof b=="undefined")b=p.getElementsByTagName("body")[0];var c=p.createElement("div");c.style.width=a;b.appendChild(c);a=c.offsetWidth;b.removeChild(c);return a}function ea(a){var b=0,c,d=0,f=a.aoColumns.length,e,i=j("th",a.nTHead);for(e= +0;etd",b);e.each(function(h){this.style.width="";h=da(a,h);if(h!==null&&a.aoColumns[h].sWidthOrig!=="")this.style.width=a.aoColumns[h].sWidthOrig});for(e=0;etd",b);if(f.length===0)f=j("thead tr:eq(0)>th",b);for(e=c=0;e0)a.aoColumns[e].sWidth=v(d);c++}a.nTable.style.width=v(j(b).outerWidth());b.parentNode.removeChild(b)}}function ia(a,b){if(a.oScroll.sX===""&&a.oScroll.sY!== +""){j(b).width();b.style.width=v(j(b).outerWidth()-a.oScroll.iBarWidth)}else if(a.oScroll.sX!=="")b.style.width=v(j(b).outerWidth())}function Ea(a,b,c){if(typeof c=="undefined"||c){c=Fa(a,b);b=N(a,b);if(c<0)return null;return a.aoData[c].nTr.getElementsByTagName("td")[b]}var d=-1,f,e;c=-1;var i=p.createElement("div");i.style.visibility="hidden";i.style.position="absolute";p.body.appendChild(i);f=0;for(e=a.aoData.length;fd){d=i.offsetWidth; +c=f}}p.body.removeChild(i);if(c>=0){b=N(a,b);if(a=a.aoData[c].nTr.getElementsByTagName("td")[b])return a}return null}function Fa(a,b){for(var c=0,d=-1,f=0;fc){c=e.length;d=f}}return d}function v(a){if(a===null)return"0px";if(typeof a=="number")return a+"px";if(a.indexOf("em")!=-1||a.indexOf("%")!=-1||a.indexOf("ex")!=-1||a.indexOf("px")!=-1)return a;return a+"px"}function La(a,b){if(a.length!=b.length)return 1;for(var c=0;cb&&a[d]--;c!=-1&&a.splice(c,1)}function qa(a,b){b=b.split(",");for(var c=[],d=0,f=a.aoColumns.length;d< +f;d++)for(var e=0;e4096){e=p.cookie.split(";");for(var h=0,k=e.length;h=d.aiDisplay.length){d._iDisplayStart-=d._iDisplayLength;if(d._iDisplayStart<0)d._iDisplayStart=0}if(typeof c=="undefined"||c){F(d);D(d)}return f};this.fnClearTable=function(a){var b=B(this[m.iApiIndex]);ba(b);if(typeof a=="undefined"||a)D(b)};this.fnOpen=function(a,b,c){var d=B(this[m.iApiIndex]);this.fnClose(a);var f=p.createElement("tr"),e=p.createElement("td");f.appendChild(e);e.className=c;e.colSpan=T(d);e.innerHTML=b;b=j("tr",d.nTBody);j.inArray(a,b)!=-1&&j(f).insertAfter(a); +d.aoOpenRows.push({nTr:f,nParent:a});return f};this.fnClose=function(a){for(var b=B(this[m.iApiIndex]),c=0;ctr",c.nTHead)[0];var h=j(">tr",c.nTFoot)[0],k=[],o=[];for(d=0;d< +f;d++){k.push(c.aoColumns[d].nTh);o.push(c.aoColumns[d].nTf)}if(b){for(d=b=0;d=T(c)){e.appendChild(k[a]);h&&h.appendChild(o[a]);d=0;for(f=c.aoData.length;dtd:eq("+i+")",c.aoData[d].nTr)[0])}}c.aoColumns[a].bVisible=true}else{e.removeChild(k[a]);h&&h.removeChild(o[a]);i=X(c);d=0;for(f=c.aoData.length;dtr:even",c).addClass(a.asDestoryStrips[0]);j(">tr:odd",c).addClass(a.asDestoryStrips[1]);b=0;for(d=E.length;bt<"F"ip>'}if(e.oScroll.sX!== +""||e.oScroll.sY!=="")e.oScroll.iBarWidth=Ja();if(typeof g.iDisplayStart!="undefined"&&typeof e.iInitDisplayStart=="undefined"){e.iInitDisplayStart=g.iDisplayStart;e._iDisplayStart=g.iDisplayStart}if(typeof g.bStateSave!="undefined"){e.oFeatures.bStateSave=g.bStateSave;Ia(e,g);e.aoDrawCallback.push({fn:Ga,sName:"state_save"})}if(typeof g.aaData!="undefined")h=true;if(typeof g!="undefined"&&typeof g.aoData!="undefined")g.aoColumns=g.aoData;if(typeof g.oLanguage!="undefined")if(typeof g.oLanguage.sUrl!= +"undefined"&&g.oLanguage.sUrl!==""){e.oLanguage.sUrl=g.oLanguage.sUrl;j.getJSON(e.oLanguage.sUrl,null,function(o){u(e,o,true)});i=true}else u(e,g.oLanguage,false)}else g={};if(typeof g.asStripClasses=="undefined"){e.asStripClasses.push(e.oClasses.sStripOdd);e.asStripClasses.push(e.oClasses.sStripEven)}c=false;d=j("tbody>tr",this);a=0;for(b=e.asStripClasses.length;a=0;a--){k=g.aoColumnDefs[a].aTargets;c=0;for(d=k.length;c=0){for(;e.aoColumns.length<=k[c];)y(e);C(e,k[c],g.aoColumnDefs[a])}else if(typeof k[c]=="number"&&k[c]<0)C(e,e.aoColumns.length+k[c],g.aoColumnDefs[a]);else if(typeof k[c]=="string"){b= +0;for(f=e.aoColumns.length;b0)e.nTFoot=this.getElementsByTagName("tfoot")[0];if(h)for(a=0;a y) ? 1 : 0)); +}; + +jQuery.fn.dataTableExt.oSort['percent-desc'] = function(a,b) { + var x = (a == "-") ? 0 : a.replace( /%/, "" ); + var y = (b == "-") ? 0 : b.replace( /%/, "" ); + x = parseFloat( x ); + y = parseFloat( y ); + return ((x < y) ? 1 : ((x > y) ? -1 : 0)); +}; \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/jquery.timeago.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/jquery.timeago.js new file mode 100644 index 000000000..0ada770a9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/jquery.timeago.js @@ -0,0 +1,141 @@ +/* + * timeago: a jQuery plugin, version: 0.9 (2010-06-21) + * @requires jQuery v1.2.3 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008-2010, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.datetime(timestamp)); + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "ago", + suffixFromNow: "from now", + seconds: "less than a minute", + minute: "about a minute", + minutes: "%d minutes", + hour: "about an hour", + hours: "about %d hours", + day: "a day", + days: "%d days", + month: "about a month", + months: "%d months", + year: "about a year", + years: "%d years", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + distanceMillis = Math.abs(distanceMillis); + } + + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 48 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.floor(days)) || + days < 60 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.floor(days / 30)) || + years < 2 && substitute($l.year, 1) || + substitute($l.years, Math.floor(years)); + + return $.trim([prefix, words, suffix].join(" ")); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d\d\d/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + var isTime = $(elem).get(0).tagName.toLowerCase() == "time"; // $(elem).is("time"); + var iso8601 = isTime ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0) element.attr("title", text); + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +})(jQuery); diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/jquery.url.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/jquery.url.js new file mode 100644 index 000000000..d1715ebcd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/jquery.url.js @@ -0,0 +1,174 @@ +// JQuery URL Parser +// Written by Mark Perkins, mark@allmarkedup.com +// License: http://unlicense.org/ (i.e. do what you want with it!) + +jQuery.url = function() +{ + var segments = {}; + + var parsed = {}; + + /** + * Options object. Only the URI and strictMode values can be changed via the setters below. + */ + var options = { + + url : window.location, // default URI is the page in which the script is running + + strictMode: false, // 'loose' parsing by default + + key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], // keys available to query + + q: { + name: "queryKey", + parser: /(?:^|&)([^&=]*)=?([^&]*)/g + }, + + parser: { + strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, //less intuitive, more accurate to the specs + loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // more intuitive, fails on relative paths and deviates from specs + } + + }; + + /** + * Deals with the parsing of the URI according to the regex above. + * Written by Steven Levithan - see credits at top. + */ + var parseUri = function() + { + str = decodeURI( options.url ); + + var m = options.parser[ options.strictMode ? "strict" : "loose" ].exec( str ); + var uri = {}; + var i = 14; + + while ( i-- ) { + uri[ options.key[i] ] = m[i] || ""; + } + + uri[ options.q.name ] = {}; + uri[ options.key[12] ].replace( options.q.parser, function ( $0, $1, $2 ) { + if ($1) { + uri[options.q.name][$1] = $2; + } + }); + + return uri; + }; + + /** + * Returns the value of the passed in key from the parsed URI. + * + * @param string key The key whose value is required + */ + var key = function( key ) + { + if ( ! parsed.length ) + { + setUp(); // if the URI has not been parsed yet then do this first... + } + if ( key == "base" ) + { + if ( parsed.port !== null && parsed.port !== "" ) + { + return parsed.protocol+"://"+parsed.host+":"+parsed.port+"/"; + } + else + { + return parsed.protocol+"://"+parsed.host+"/"; + } + } + + return ( parsed[key] === "" ) ? null : parsed[key]; + }; + + /** + * Returns the value of the required query string parameter. + * + * @param string item The parameter whose value is required + */ + var param = function( item ) + { + if ( ! parsed.length ) + { + setUp(); // if the URI has not been parsed yet then do this first... + } + return ( parsed.queryKey[item] === null ) ? null : parsed.queryKey[item]; + }; + + /** + * 'Constructor' (not really!) function. + * Called whenever the URI changes to kick off re-parsing of the URI and splitting it up into segments. + */ + var setUp = function() + { + parsed = parseUri(); + + getSegments(); + }; + + /** + * Splits up the body of the URI into segments (i.e. sections delimited by '/') + */ + var getSegments = function() + { + var p = parsed.path; + segments = []; // clear out segments array + segments = parsed.path.length == 1 ? {} : ( p.charAt( p.length - 1 ) == "/" ? p.substring( 1, p.length - 1 ) : path = p.substring( 1 ) ).split("/"); + }; + + return { + + /** + * Sets the parsing mode - either strict or loose. Set to loose by default. + * + * @param string mode The mode to set the parser to. Anything apart from a value of 'strict' will set it to loose! + */ + setMode : function( mode ) + { + strictMode = mode == "strict" ? true : false; + return this; + }, + + /** + * Sets URI to parse if you don't want to to parse the current page's URI. + * Calling the function with no value for newUri resets it to the current page's URI. + * + * @param string newUri The URI to parse. + */ + setUrl : function( newUri ) + { + options.url = newUri === undefined ? window.location : newUri; + setUp(); + return this; + }, + + /** + * Returns the value of the specified URI segment. Segments are numbered from 1 to the number of segments. + * For example the URI http://test.com/about/company/ segment(1) would return 'about'. + * + * If no integer is passed into the function it returns the number of segments in the URI. + * + * @param int pos The position of the segment to return. Can be empty. + */ + segment : function( pos ) + { + if ( ! parsed.length ) + { + setUp(); // if the URI has not been parsed yet then do this first... + } + if ( pos === undefined ) + { + return segments.length; + } + return ( segments[pos] === "" || segments[pos] === undefined ) ? null : segments[pos]; + }, + + attr : key, // provides public access to private 'key' function - see above + + param : param // provides public access to private 'param' function - see above + + }; + +}(); \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/loading.gif b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/loading.gif new file mode 100644 index 000000000..3596a61f3 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/loading.gif differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/magnify.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/magnify.png new file mode 100644 index 000000000..6073b9530 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/magnify.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png new file mode 100644 index 000000000..5b5dab2ab Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_75_ffffff_40x100.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_75_ffffff_40x100.png new file mode 100644 index 000000000..ac8b229af Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_75_ffffff_40x100.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png new file mode 100644 index 000000000..ad3d6346e Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_65_ffffff_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_65_ffffff_1x400.png new file mode 100644 index 000000000..42ccba269 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_65_ffffff_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_dadada_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_dadada_1x400.png new file mode 100644 index 000000000..5a46b47cb Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_dadada_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png new file mode 100644 index 000000000..86c2baa65 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png new file mode 100644 index 000000000..4443fdc1a Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png new file mode 100644 index 000000000..7c9fa6c6e Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_222222_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_222222_256x240.png new file mode 100644 index 000000000..b273ff111 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_222222_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_2e83ff_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_2e83ff_256x240.png new file mode 100644 index 000000000..09d1cdc85 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_2e83ff_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_454545_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_454545_256x240.png new file mode 100644 index 000000000..59bd45b90 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_454545_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_888888_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_888888_256x240.png new file mode 100644 index 000000000..6d02426c1 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_888888_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_cd0a0a_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_cd0a0a_256x240.png new file mode 100644 index 000000000..2ab019b73 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_cd0a0a_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/jquery-ui-1.8.4.custom.css b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/jquery-ui-1.8.4.custom.css new file mode 100644 index 000000000..b8b2bbe50 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/smoothness/jquery-ui-1.8.4.custom.css @@ -0,0 +1,295 @@ +/* + * jQuery UI CSS Framework @VERSION + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + */ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute; left: -99999999px; } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } + + +/* + * jQuery UI CSS Framework @VERSION + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + * + * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px + */ + + +/* Component containers +----------------------------------*/ +.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; } +.ui-widget .ui-widget { font-size: 1em; } +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; } +.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; } +.ui-widget-content a { color: #222222; } +.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } +.ui-widget-header a { color: #222222; } + +/* Interaction states +----------------------------------*/ +.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; } +.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; } +.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; } +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; } +.ui-widget :active { outline: none; } + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; } +.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; } +.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } +.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); } +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } +.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } +.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); } +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); } + +/* positioning */ +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-off { background-position: -96px -144px; } +.ui-icon-radio-on { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-start { background-position: -80px -160px; } +/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; } +.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } +.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } +.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } +.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } +.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } + +/* Overlays */ +.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); } +.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; } \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/stylesheet.css b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/stylesheet.css new file mode 100644 index 000000000..9b50a9b05 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/assets/0.4.4/stylesheet.css @@ -0,0 +1,341 @@ +/* ----------------------------------------------------------------------- + + + Blueprint CSS Framework 0.9 + http://blueprintcss.org + + * Copyright (c) 2007-Present. See LICENSE for more info. + * See README for instructions on how to use Blueprint. + * For credits and origins, see AUTHORS. + * This is a compressed file. See the sources in the 'src' directory. + +----------------------------------------------------------------------- */ + +/* reset.css */ +html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;} +article, aside, dialog, figure, footer, header, hgroup, nav, section {display:block;} +body {line-height:1.5;} +table {border-collapse:separate;border-spacing:0;} +caption, th, td {text-align:left;font-weight:normal;} +table, td, th {vertical-align:middle;} +blockquote:before, blockquote:after, q:before, q:after {content:"";} +blockquote, q {quotes:"" "";} +a img {border:none;} + +/* typography.css */ +html {font-size:100.01%;} +body {font-size:82%;color:#222;background:#fff;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;} +h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;} +h1 {font-size:3em;line-height:1;margin-bottom:0.5em;} +h2 {font-size:2em;margin-bottom:0.75em;} +h3 {font-size:1.5em;line-height:1;margin-bottom:1em;} +h4 {font-size:1.2em;line-height:1.25;margin-bottom:1.25em;} +h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;} +h6 {font-size:1em;font-weight:bold;} +h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;} +p {margin:0 0 1.5em;} +p img.left {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;} +p img.right {float:right;margin:1.5em 0 1.5em 1.5em;} +a:focus, a:hover {color:#000;} +a {color:#009;text-decoration:underline;} +blockquote {margin:1.5em;color:#666;font-style:italic;} +strong {font-weight:bold;} +em, dfn {font-style:italic;} +dfn {font-weight:bold;} +sup, sub {line-height:0;} +abbr, acronym {border-bottom:1px dotted #666;} +address {margin:0 0 1.5em;font-style:italic;} +del {color:#666;} +pre {margin:1.5em 0;white-space:pre;} +pre, code, tt {font:1em 'andale mono', 'lucida console', monospace;line-height:1.5;} +li ul, li ol {margin:0;} +ul, ol {margin:0 1.5em 1.5em 0;padding-left:3.333em;} +ul {list-style-type:disc;} +ol {list-style-type:decimal;} +dl {margin:0 0 1.5em 0;} +dl dt {font-weight:bold;} +dd {margin-left:1.5em;} +table {margin-bottom:1.4em;width:100%;} +th {font-weight:bold;} +thead th {background:#c3d9ff;} +th, td, caption {padding:4px 10px 4px 5px;} +tr.even td {background:#efefef;} +tfoot {font-style:italic;} +caption {background:#eee;} +.small {font-size:.8em;margin-bottom:1.875em;line-height:1.875em;} +.large {font-size:1.2em;line-height:2.5em;margin-bottom:1.25em;} +.hide {display:none;} +.quiet {color:#666;} +.loud {color:#000;} +.highlight {background:#ff0;} +.added {background:#060;color:#fff;} +.removed {background:#900;color:#fff;} +.first {margin-left:0;padding-left:0;} +.last {margin-right:0;padding-right:0;} +.top {margin-top:0;padding-top:0;} +.bottom {margin-bottom:0;padding-bottom:0;} + +/* forms.css */ +label {font-weight:bold;} +fieldset {padding:1.4em;margin:0 0 1.5em 0;border:1px solid #ccc;} +legend {font-weight:bold;font-size:1.2em;} +input[type=text], input[type=password], input.text, input.title, textarea, select {background-color:#fff;border:1px solid #bbb;} +input[type=text]:focus, input[type=password]:focus, input.text:focus, input.title:focus, textarea:focus, select:focus {border-color:#666;} +input[type=text], input[type=password], input.text, input.title, textarea, select {margin:0.5em 0;} +input.text, input.title {width:300px;padding:5px;} +input.title {font-size:1.5em;} +textarea {width:390px;height:250px;padding:5px;} +input[type=checkbox], input[type=radio], input.checkbox, input.radio {position:relative;top:.25em;} +form.inline {line-height:3;} +form.inline p {margin-bottom:0;} +.error, .notice, .success {padding:.8em;margin-bottom:1em;border:2px solid #ddd;} +.error {background:#FBE3E4;color:#8a1f11;border-color:#FBC2C4;} +.notice {background:#FFF6BF;color:#514721;border-color:#FFD324;} +.success {background:#E6EFC2;color:#264409;border-color:#C6D880;} +.error a {color:#8a1f11;} +.notice a {color:#514721;} +.success a {color:#264409;} +.box {padding:1.5em;margin-bottom:1.5em;background:#E5ECF9;} +hr {background:#ddd;color:#ddd;clear:both;float:none;width:100%;height:.1em;margin:0 0 1.45em;border:none;} +hr.space {background:#fff;color:#fff;visibility:hidden;} +.clearfix:after, .container:after {content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden;} +.clearfix, .container {display:block;} +.clear {clear:both;} + +#loading { + position: fixed; + left: 40%; + top: 50%; +} + +a { + color: #600; + text-decoration: none; +} + +a:hover { + color: #900; + text-decoration: underline; +} + +body { + font-family: "Lucida Grande", Helvetica, "Helvetica Neue", Arial, sans-serif; + padding: 12px; + background-color: #333; +} + +h1, h2, h3, h4 { + color: #1C2324; + margin: 0; + padding: 0; + margin-bottom: 12px; +} + +table { + width: 100%; +} + +#content { + clear: left; + background-color: white; + border: 2px solid #ddd; + border-top: 8px solid #ddd; + padding: 18px; + -webkit-border-bottom-left-radius: 5px; + -webkit-border-bottom-right-radius: 5px; + -webkit-border-top-right-radius: 5px; + -moz-border-radius-bottomleft: 5px; + -moz-border-radius-bottomright: 5px; + -moz-border-radius-topright: 5px; + border-bottom-left-radius: 5px; + border-bottom-right-radius: 5px; + border-top-right-radius: 5px; +} + +.dataTables_filter, .dataTables_info { + padding: 2px 6px; +} + +abbr.timeago { + text-decoration: none; + border: none; + font-weight: bold; +} + +.timestamp { + float: right; + color: #ddd; +} + +.group_tabs { + list-style: none; + float: left; + margin: 0; + padding: 0; +} +.group_tabs li { + display: inline; + float: left; +} + +.group_tabs li a { + font-family: Helvetica, Arial, sans-serif; + display: block; + float: left; + text-decoration: none; + padding: 4px 8px; + background-color: #aaa; + background: -webkit-gradient(linear, 0 0, 0 bottom, from(#DDD), to(#aaa)); + background: -moz-linear-gradient(#DDD, #aaa); + background: linear-gradient(#DDD, #aaa); + text-shadow: #e5e5e5 1px 1px 0px; + border-bottom: none; + color: #333; + font-weight: bold; + margin-right: 8px; + border-top: 1px solid #efefef; + -webkit-border-top-left-radius: 2px; + -webkit-border-top-right-radius: 2px; + -moz-border-radius-topleft: 2px; + -moz-border-radius-topright: 2px; + border-top-left-radius: 2px; + border-top-right-radius: 2px; +} + +.group_tabs li a:hover { + background-color: #ccc; + background: -webkit-gradient(linear, 0 0, 0 bottom, from(#eee), to(#aaa)); + background: -moz-linear-gradient(#eee, #aaa); + background: linear-gradient(#eee, #aaa); +} + +.group_tabs li a:active { + padding-top: 5px; + padding-bottom: 3px; +} + +.group_tabs li.active a { + color: black; + text-shadow: #fff 1px 1px 0px; + background-color: #ddd; + background: -webkit-gradient(linear, 0 0, 0 bottom, from(#fff), to(#ddd)); + background: -moz-linear-gradient(#fff, #ddd); + background: linear-gradient(#fff, #ddd); +} + +.file_list { + margin-bottom: 18px; +} + +a.src_link { + background: url('./magnify.png') no-repeat left 50%; + padding-left: 18px; +} + +tr, td { + margin: 0; + padding: 0; +} + +th { + white-space: nowrap; +} + +th.ui-state-default { + cursor: pointer; +} + +th span.ui-icon { + float: left; +} + +td { + padding: 4px 8px; +} + +.source_table td { + padding: 2px 8px; +} + + +.source_table { + overflow: auto; +} + +.source_table table { + width: 95%; +} + +.source_table thead td { + background-color: white; +} + +.source_table thead th { + background-color: white; +} + +.source_table td.hits { + text-align: right; +} + +.source_table h3, .source_table h4 { + padding: 0; + margin: 0; + margin-bottom: 4px; +} + +td pre { + margin: 0; + padding: 0; + color: #222; + font-family: "Monaco", "Inconsolata", "Consolas", monospace; +} + +.line_number { + width: 20px; + font-weight: bold; +} + +#footer { + color: #ddd; + font-size: 12px; + font-weight: bold; + margin-top: 12px; + text-align: right; +} +#footer a { + color: #eee; + text-decoration: underline; +} +#footer a:hover { + color: #fff; + text-decoration: none; +} + +.green { + color: #090; +} +.red { + color: #900; +} +.yellow { + color: #da0; +} +.hit.odd td { + background-color: #bbdbb6; +} +.hit.even td { + background-color: #cde1c9; +} +.miss.odd td { + background-color: #f19683; +} +.miss.even td { + background-color: #efb5a8; +} +.never.odd td { + background-color: #efefef; +} +.never.even td { + background-color: #f4f4f4; +} \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/covered_percent b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/covered_percent new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/covered_percent @@ -0,0 +1 @@ +0 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/index.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/index.html new file mode 100644 index 000000000..aea00ce5f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/index.html @@ -0,0 +1,71 @@ + + + + Code coverage for Set + + + + + + + + + + + + + + + +
    + loading +
    + + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/resultset.yml b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/resultset.yml new file mode 100644 index 000000000..6c11df802 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/coverage/resultset.yml @@ -0,0 +1,13 @@ +--- +! '/tmp/textmate-command-51306.rb ': + :original_result: {} + :created_at: 2011-04-07 07:50:15.752611000 +10:00 +! '/tmp/textmate-command-51345.rb ': + :original_result: {} + :created_at: 2011-04-07 07:50:31.877212000 +10:00 +! '/tmp/textmate-command-51376.rb ': + :original_result: {} + :created_at: 2011-04-07 07:50:49.433731000 +10:00 +! '/tmp/textmate-command-52388.rb ': + :original_result: {} + :created_at: 2011-04-07 09:02:26.780485000 +10:00 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/delete_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/delete_spec.rb new file mode 100644 index 000000000..711ac6032 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/delete_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + describe "#delete" do + + before do + @original = Hamster.set("A", "B", "C") + end + + describe "with an existing value" do + + before do + @result = @original.delete("B") + end + + it "preserves the original" do + @original.should == Hamster.set("A", "B", "C") + end + + it "returns a copy with the remaining of values" do + @result.should == Hamster.set("A", "C") + end + + end + + describe "with a non-existing value" do + + before do + @result = @original.delete("D") + end + + it "preserves the original values" do + @original.should == Hamster.set("A", "B", "C") + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/difference_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/difference_spec.rb new file mode 100644 index 000000000..90d878742 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/difference_spec.rb @@ -0,0 +1,37 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:difference, :diff, :subtract, :-].each do |method| + + describe "##{method}" do + + [ + [[], [], []], + [["A"], [], ["A"]], + [["A"], ["A"], []], + [["A", "B", "C"], ["B"], ["A", "C"]], + [["A", "B", "C"], ["A", "C"], ["B"]], + ].each do |a, b, expected| + + describe "for #{a.inspect} and #{b.inspect}" do + + before do + @result = Hamster.set(*a).send(method, Hamster.set(*b)) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.set(*expected) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/each_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/each_spec.rb new file mode 100644 index 000000000..f68115f25 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/each_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +require 'set' +require 'hamster/set' + +describe Hamster::Set do + + [:each, :foreach].each do |method| + + describe "##{method}" do + + before do + @set = Hamster.set("A", "B", "C") + end + + describe "with a block (internal iteration)" do + + it "returns nil" do + @set.send(method) {}.should be_nil + end + + it "yields all values" do + actual_values = Set[] + @set.send(method) { |value| actual_values << value } + actual_values.should == Set["A", "B", "C"] + end + + end + + describe "with no block" do + + it "returns self" do + @set.send(method).should equal(@set) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/empty_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/empty_spec.rb new file mode 100644 index 000000000..ad26e6cf2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/empty_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:empty?, :null?].each do |method| + + describe "##{method}" do + + [ + [[], true], + [["A"], false], + [["A", "B", "C"], false], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @set = Hamster.set(*values) + end + + it "returns #{expected.inspect}" do + @set.send(method).should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/eql_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/eql_spec.rb new file mode 100644 index 000000000..d5d4ef209 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/eql_spec.rb @@ -0,0 +1,62 @@ +require 'spec_helper' + +require 'set' +require 'hamster/set' + +describe Hamster::Set do + + [:eql?, :==].each do |method| + + describe "##{method}" do + + describe "returns false when comparing with" do + + before do + @set = Hamster.set("A", "B", "C") + end + + it "a standard set" do + @set.send(method, Set["A", "B", "C"]).should == false + end + + it "an aribtrary object" do + @set.send(method, Object.new).should == false + end + + end + + [ + [[], [], true], + [[], [nil], false], + [["A"], [], false], + [["A"], ["A"], true], + [["A"], ["B"], false], + [["A", "B"], ["A"], false], + [["A", "B", "C"], ["A", "B", "C"], true], + [["C", "A", "B"], ["A", "B", "C"], true], + ].each do |a, b, expected| + + describe "returns #{expected.inspect}" do + + before do + @a = Hamster.set(*a) + @b = Hamster.set(*b) + end + + it "for #{a.inspect} and #{b.inspect}" do + @a.send(method, @b).should == expected + end + + it "for #{b.inspect} and #{a.inspect}" do + @b.send(method, @a).should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/exclusion_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/exclusion_spec.rb new file mode 100644 index 000000000..12663b356 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/exclusion_spec.rb @@ -0,0 +1,38 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:exclusion, :^].each do |method| + + describe "##{method}" do + + [ + [[], [], []], + [["A"], [], ["A"]], + [["A"], ["A"], []], + [["A", "B", "C"], ["B"], ["A", "C"]], + [["A", "B", "C"], ["B", "C", "D"], ["A", "D"]], + [["A", "B", "C"], ["D", "E", "F"], ["A", "B", "C", "D", "E", "F"]], + ].each do |a, b, expected| + + describe "for #{a.inspect} and #{b.inspect}" do + + before do + @result = Hamster.set(*a).send(method, Hamster.set(*b)) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.set(*expected) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/filter_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/filter_spec.rb new file mode 100644 index 000000000..b146c0cb2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/filter_spec.rb @@ -0,0 +1,79 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:filter, :select, :find_all].each do |method| + + describe "##{method}" do + + before do + @original = Hamster.set("A", "B", "C") + end + + describe "when everything matches" do + + before do + @result = @original.send(method) { |item| true } + end + + it "returns self" do + @result.should equal(@original) + end + + end + + describe "when only some things match" do + + describe "with a block" do + + before do + @result = @original.send(method) { |item| item == "A" } + end + + it "preserves the original" do + @original.should == Hamster.set("A", "B", "C") + end + + it "returns a set with the matching values" do + @result.should == Hamster.set("A") + end + + end + + describe "with no block" do + + before do + @result = @original.send(method) + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + describe "when nothing matches" do + + before do + @result = @original.send(method) { |item| false } + end + + it "preserves the original" do + @original.should == Hamster.set("A", "B", "C") + end + + it "returns an empty set" do + @result.should equal(Hamster.set) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/find_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/find_spec.rb new file mode 100644 index 000000000..87e0539f3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/find_spec.rb @@ -0,0 +1,53 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:find, :detect].each do |method| + + describe "##{method}" do + + [ + [[], "A", nil], + [[], nil, nil], + [["A"], "A", "A"], + [["A"], "B", nil], + [["A"], nil, nil], + [["A", "B", nil], "A", "A"], + [["A", "B", nil], "B", "B"], + [["A", "B", nil], nil, nil], + [["A", "B", nil], "C", nil], + ].each do |values, item, expected| + + describe "on #{values.inspect}" do + + before do + @set = Hamster.set(*values) + end + + describe "with a block" do + + it "returns #{expected.inspect}" do + @set.send(method) { |x| x == item }.should == expected + end + + end + + describe "without a block" do + + it "returns nil" do + @set.send(method).should be_nil + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/flatten_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/flatten_spec.rb new file mode 100644 index 000000000..cefee9253 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/flatten_spec.rb @@ -0,0 +1,49 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster do + + describe "#flatten" do + + [ + [["A"], ["A"]], + [["A", "B", "C"], ["A", "B", "C"]], + [["A", Hamster.set("B"), "C"], ["A", "B", "C"]], + [[Hamster.set("A"), Hamster.set("B"), Hamster.set("C")], ["A", "B", "C"]], + ].each do |values, expected| + + describe "on #{values}" do + + before do + @original = Hamster.set(*values) + @result = @original.flatten + end + + it "preserves the original" do + @original.should == Hamster.set(*values) + end + + it "returns the inlined values" do + @result.should == Hamster.set(*expected) + end + + end + + end + + describe "on an empty set" do + + before do + @result = Hamster.set.flatten + end + + it "returns an empty set" do + @result.should equal(Hamster.set) + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/grep_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/grep_spec.rb new file mode 100644 index 000000000..527fb54d0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/grep_spec.rb @@ -0,0 +1,62 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + describe "#grep" do + + describe "without a block" do + + [ + [[], []], + [["A"], ["A"]], + [[1], []], + [["A", 2, "C"], ["A", "C"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @list = Hamster.set(*values) + end + + it "returns #{expected.inspect}" do + @list.grep(String).should == Hamster.set(*expected) + end + + end + + end + + end + + describe "with a block" do + + [ + [[], []], + [["A"], ["a"]], + [[1], []], + [["A", 2, "C"], ["a", "c"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @list = Hamster.set(*values) + end + + it "returns #{expected.inspect}" do + @list.grep(String, &:downcase).should == Hamster.set(*expected) + end + + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/group_by_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/group_by_spec.rb new file mode 100644 index 000000000..af37fcac9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/group_by_spec.rb @@ -0,0 +1,65 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:group_by, :group].each do |method| + + describe "##{method}" do + + describe "with a block" do + + [ + [[], []], + [[1], [true => Hamster.set(1)]], + [[1, 2, 3, 4], [true => Hamster.set(3, 1), false => Hamster.set(4, 2)]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.set(*values) + @result = original.send(method, &:odd?) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.hash(*expected) + end + + end + + end + + end + + describe "without a block" do + + [ + [[], []], + [[1], [1 => Hamster.set(1)]], + [[1, 2, 3, 4], [1 => Hamster.set(1), 2 => Hamster.set(2), 3 => Hamster.set(3), 4 => Hamster.set(4)]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.set(*values) + @result = original.group_by + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.hash(*expected) + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/hash_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/hash_spec.rb new file mode 100644 index 000000000..95da93b97 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/hash_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + describe "#hash" do + + describe "on an empty set" do + + before do + @result = Hamster.set.hash + end + + it "returns 0" do + @result.should == 0 + end + + end + + it "values are sufficiently distributed" do + (1..4000). + each_slice(4). + map { |a, b, c, d| Hamster.set(a, b, c, d).hash }. + uniq. + size.should == 1000 + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/head_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/head_spec.rb new file mode 100644 index 000000000..31ffd4afa --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/head_spec.rb @@ -0,0 +1,39 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:head, :first].each do |method| + + describe "##{method}" do + + describe "on an empty set" do + + before do + @result = Hamster.set.send(method) + end + + it "returns nil" do + @returns.should be_nil + end + + end + + describe "on a non-empty set" do + + before do + @result = Hamster.set("A", "B", "C").send(method) + end + + it "returns an arbitrary value from the set" do + ["A", "B", "C"].should include(@result) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/immutable_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/immutable_spec.rb new file mode 100644 index 000000000..54fa47938 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/immutable_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +require 'hamster/immutable' +require 'hamster/set' + +describe Hamster::Set do + + it "includes Immutable" do + Hamster::Set.should include(Hamster::Immutable) + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/include_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/include_spec.rb new file mode 100644 index 000000000..b9a34abd5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/include_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:include?, :member?, :contains?, :elem?].each do |method| + + describe "##{method}" do + + before do + @set = Hamster.set("A", "B", "C", 2.0, nil) + end + + ["A", "B", "C", 2.0, nil].each do |value| + + it "returns true for an existing value (#{value.inspect})" do + @set.send(method, value).should == true + end + + end + + it "returns false for a non-existing value" do + @set.send(method, "D").should == false + end + + it "uses #eql? for equality" do + @set.send(method, 2).should == false + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/inspect_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/inspect_spec.rb new file mode 100644 index 000000000..b1f2328f3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/inspect_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + describe "#inspect" do + + [ + [[], "{}"], + [["A"], "{\"A\"}"], + [[DeterministicHash.new("A", 1), DeterministicHash.new("B", 2), DeterministicHash.new("C", 3)], "{\"A\", \"B\", \"C\"}"] + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.set(*values) + @result = original.inspect + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/intersection_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/intersection_spec.rb new file mode 100644 index 000000000..9ae184d37 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/intersection_spec.rb @@ -0,0 +1,46 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:intersection, :intersect, :&].each do |method| + + describe "##{method}" do + + [ + [[], [], []], + [["A"], [], []], + [["A"], ["A"], ["A"]], + [["A", "B", "C"], ["B"], ["B"]], + [["A", "B", "C"], ["A", "C"], ["A", "C"]], + ].each do |a, b, expected| + + describe "returns #{expected.inspect}" do + + before do + @a = Hamster.set(*a) + @b = Hamster.set(*b) + end + + it "for #{a.inspect} and #{b.inspect}" do + @result = @a.send(method, @b) + end + + it "for #{b.inspect} and #{a.inspect}" do + @result = @b.send(method, @a) + end + + after do + @result.should == Hamster.set(*expected) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/join_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/join_spec.rb new file mode 100644 index 000000000..3cfd9c18e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/join_spec.rb @@ -0,0 +1,69 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + describe "#join" do + + describe "with a separator" do + + [ + [[], ""], + [["A"], "A"], + [[DeterministicHash.new("A", 1), DeterministicHash.new("B", 2), DeterministicHash.new("C", 3)], "A|B|C"] + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.set(*values) + @result = @original.join("|") + end + + it "preserves the original" do + @original.should == Hamster.set(*values) + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + + describe "without a separator" do + + [ + [[], ""], + [["A"], "A"], + [[DeterministicHash.new("A", 1), DeterministicHash.new("B", 2), DeterministicHash.new("C", 3)], "ABC"] + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.set(*values) + @result = @original.join + end + + it "preserves the original" do + @original.should == Hamster.set(*values) + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/map_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/map_spec.rb new file mode 100644 index 000000000..0f8afe5cd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/map_spec.rb @@ -0,0 +1,64 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:map, :collect].each do |method| + + describe "##{method}" do + + describe "when empty" do + + before do + @original = Hamster.set + @mapped = @original.send(method) {} + end + + it "returns self" do + @mapped.should equal(@original) + end + + end + + describe "when not empty" do + + before do + @original = Hamster.set("A", "B", "C") + end + + describe "with a block" do + + before do + @mapped = @original.send(method, &:downcase) + end + + it "preserves the original values" do + @original.should == Hamster.set("A", "B", "C") + end + + it "returns a new set with the mapped values" do + @mapped.should == Hamster.set("a", "b", "c") + end + + end + + describe "with no block" do + + before do + @result = @original.send(method) + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/maximum_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/maximum_spec.rb new file mode 100644 index 000000000..b9511524e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/maximum_spec.rb @@ -0,0 +1,65 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:maximum, :max].each do |method| + + describe "##{method}" do + + describe "with a block" do + + [ + [[], nil], + [["A"], "A"], + [["Ichi", "Ni", "San"], "Ichi"], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.set(*values) + @result = original.send(method) { |maximum, item| item.length <=> maximum.length } + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + + describe "without a block" do + + [ + [[], nil], + [["A"], "A"], + [["Ichi", "Ni", "San"], "San"], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.set(*values) + @result = original.send(method) + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/minimum_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/minimum_spec.rb new file mode 100644 index 000000000..72c771161 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/minimum_spec.rb @@ -0,0 +1,65 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:minimum, :min].each do |method| + + describe "##{method}" do + + describe "with a block" do + + [ + [[], nil], + [["A"], "A"], + [["Ichi", "Ni", "San"], "Ni"], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.set(*values) + @result = original.send(method) { |minimum, item| item.length <=> minimum.length } + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + + describe "without a block" do + + [ + [[], nil], + [["A"], "A"], + [["Ichi", "Ni", "San"], "Ichi"], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.set(*values) + @result = original.send(method) + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/none_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/none_spec.rb new file mode 100644 index 000000000..41afdf6ec --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/none_spec.rb @@ -0,0 +1,63 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + describe "#none?" do + + describe "when empty" do + + before do + @set = Hamster.set + end + + it "with a block returns true" do + @set.none? {}.should == true + end + + it "with no block returns true" do + @set.none?.should == true + end + + end + + describe "when not empty" do + + describe "with a block" do + + before do + @set = Hamster.set("A", "B", "C", nil) + end + + ["A", "B", "C", nil].each do |value| + + it "returns false if the block ever returns true (#{value.inspect})" do + @set.none? { |item| item == value }.should == false + end + + end + + it "returns true if the block always returns false" do + @set.none? { |item| item == "D" }.should == true + end + + end + + describe "with no block" do + + it "returns false if any value is truthy" do + Hamster.set(nil, false, true, "A").none?.should == false + end + + it "returns true if all values are falsey" do + Hamster.set(nil, false).none?.should == true + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/one_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/one_spec.rb new file mode 100644 index 000000000..722cb48c3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/one_spec.rb @@ -0,0 +1,63 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + describe "#one?" do + + describe "when empty" do + + before do + @set = Hamster.set + end + + it "with a block returns false" do + @set.one? {}.should == false + end + + it "with no block returns false" do + @set.one?.should == false + end + + end + + describe "when not empty" do + + describe "with a block" do + + before do + @set = Hamster.set("A", "B", "C") + end + + it "returns false if the block returns true more than once" do + @set.one? { |item| true }.should == false + end + + it "returns false if the block never returns true" do + @set.one? { |item| false }.should == false + end + + it "returns true if the block only returns true once" do + @set.one? { |item| item == "A" }.should == true + end + + end + + describe "with no block" do + + it "returns false if more than one value is truthy" do + Hamster.set(nil, true, "A").one?.should == false + end + + it "returns true if only one value is truthy" do + Hamster.set(nil, true, false).one?.should == true + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/partition_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/partition_spec.rb new file mode 100644 index 000000000..f50f19a09 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/partition_spec.rb @@ -0,0 +1,71 @@ +require 'spec_helper' + +require 'hamster/tuple' +require 'hamster/set' + +describe Hamster::Set do + + describe "#partition" do + + [ + [[], [], []], + [[1], [1], []], + [[1, 2], [1], [2]], + [[1, 2, 3], [1, 3], [2]], + [[1, 2, 3, 4], [1, 3], [2, 4]], + [[2, 3, 4], [3], [2, 4]], + [[3, 4], [3], [4]], + [[4], [], [4]], + ].each do |values, expected_matches, expected_remainder| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.set(*values) + end + + describe "with a block" do + + before do + @result = @original.partition(&:odd?) + @matches = @result.first + @remainder = @result.last + end + + it "preserves the original" do + @original.should == Hamster.set(*values) + end + + it "returns a tuple with two items" do + @result.is_a?(Hamster::Tuple).should == true + end + + it "correctly identifies the matches" do + @matches.should == Hamster.set(*expected_matches) + end + + it "correctly identifies the remainder" do + @remainder.should == Hamster.set(*expected_remainder) + end + + end + + describe "without a block" do + + before do + @result = @original.partition + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/product_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/product_spec.rb new file mode 100644 index 000000000..521905c1d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/product_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + describe "#product" do + + [ + [[], 1], + [[2], 2], + [[1, 3, 5, 7, 11], 1155], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.set(*values) + @result = original.product + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/reduce_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/reduce_spec.rb new file mode 100644 index 000000000..d25f7fb48 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/reduce_spec.rb @@ -0,0 +1,87 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:reduce, :inject, :fold, :foldr].each do |method| + + describe "##{method}" do + + [ + [[], 10, 10], + [[1], 10, 9], + [[1, 2, 3], 10, 4], + ].each do |values, initial, expected| + + describe "on #{values.inspect}" do + + before do + @set = Hamster.set(*values) + end + + describe "with an initial value of #{initial}" do + + describe "and a block" do + + it "returns #{expected.inspect}" do + @set.send(method, initial) { |memo, item| memo - item }.should == expected + end + + end + + describe "and no block" do + + it "returns the memo" do + @set.send(method, initial).should == initial + end + + end + + end + + end + + end + + [ + [[], nil], + [[1], 1], + [[1, 2, 3], 6], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @set = Hamster.set(*values) + end + + describe "with no initial value" do + + describe "and a block" do + + it "returns #{expected.inspect}" do + @set.send(method) { |memo, item| memo + item }.should == expected + end + + end + + describe "and no block" do + + it "returns nil" do + @set.send(method).should be_nil + end + + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/remove_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/remove_spec.rb new file mode 100644 index 000000000..ec1d3156a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/remove_spec.rb @@ -0,0 +1,63 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:remove, :reject, :delete_if].each do |method| + + describe "##{method}" do + + before do + @original = Hamster.set("A", "B", "C") + end + + describe "when nothing matches" do + + before do + @result = @original.send(method) { |item| false } + end + + it "returns self" do + @result.should equal(@original) + end + + end + + describe "when only some things match" do + + describe "with a block" do + + before do + @result = @original.send(method) { |item| item == "A" } + end + + it "preserves the original" do + @original.should == Hamster.set("A", "B", "C") + end + + it "returns a set with the matching values" do + @result.should == Hamster.set("B", "C") + end + + end + + describe "with no block" do + + before do + @result = @original.send(method) + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/size_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/size_spec.rb new file mode 100644 index 000000000..f8ca79731 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/size_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:size, :length].each do |method| + + describe "##{method}" do + + [ + [[], 0], + [["A"], 1], + [["A", "B", "C"], 3], + ].each do |values, result| + + it "returns #{result} for #{values.inspect}" do + Hamster.set(*values).send(method).should == result + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/sorting_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/sorting_spec.rb new file mode 100644 index 000000000..b312b8c03 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/sorting_spec.rb @@ -0,0 +1,58 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [ + [:sort, lambda { |left, right| left.length <=> right.length }], + [:sort_by, lambda { |item| item.length }], + ].each do |method, comparator| + + describe "##{method}" do + + [ + [[], []], + [["A"], ["A"]], + [["Ichi", "Ni", "San"], ["Ni", "San", "Ichi"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.set(*values) + end + + describe "with a block" do + + before do + @result = @original.send(method, &comparator) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + describe "without a block" do + + before do + @result = @original.send(method) + end + + it "returns #{expected.sort.inspect}" do + @result.should == Hamster.list(*expected.sort) + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/subset_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/subset_spec.rb new file mode 100644 index 000000000..23bdf9a38 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/subset_spec.rb @@ -0,0 +1,39 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + describe "#subset?" do + + [ + [[], [], true], + [["A"], [], false], + [[], ["A"], true], + [["A"], ["A"], true], + [["A", "B", "C"], ["B"], false], + [["B"], ["A", "B", "C"], true], + [["A", "B", "C"], ["A", "C"], false], + [["A", "C"], ["A", "B", "C"], true], + [["A", "B", "C"], ["A", "B", "C"], true], + [["A", "B", "C"], ["A", "B", "C", "D"], true], + [["A", "B", "C", "D"], ["A", "B", "C"], false], + ].each do |a, b, expected| + + describe "for #{a.inspect} and #{b.inspect}" do + + before do + @result = Hamster.set(*a).subset?(Hamster.set(*b)) + end + + it "returns #{expected}" do + @result.should == expected + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/sum_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/sum_spec.rb new file mode 100644 index 000000000..9be99eb38 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/sum_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + describe "#sum" do + + [ + [[], 0], + [[2], 2], + [[1, 3, 5, 7, 11], 27], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.set(*values) + @result = original.sum + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/superset_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/superset_spec.rb new file mode 100644 index 000000000..ea9bd734a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/superset_spec.rb @@ -0,0 +1,39 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + describe "#superset?" do + + [ + [[], [], true], + [["A"], [], true], + [[], ["A"], false], + [["A"], ["A"], true], + [["A", "B", "C"], ["B"], true], + [["B"], ["A", "B", "C"], false], + [["A", "B", "C"], ["A", "C"], true], + [["A", "C"], ["A", "B", "C"], false], + [["A", "B", "C"], ["A", "B", "C"], true], + [["A", "B", "C"], ["A", "B", "C", "D"], false], + [["A", "B", "C", "D"], ["A", "B", "C"], true], + ].each do |a, b, expected| + + describe "for #{a.inspect} and #{b.inspect}" do + + before do + @result = Hamster.set(*a).superset?(Hamster.set(*b)) + end + + it "returns #{expected}" do + @result.should == expected + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/to_a_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/to_a_spec.rb new file mode 100644 index 000000000..22be0fd2e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/to_a_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:to_a, :entries].each do |method| + + describe "##{method}" do + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values.inspect}" do + + before do + @set = Hamster.set(*values) + @result = @set.send(method) + end + + it "returns #{values.inspect}" do + @result.sort.should == values.sort + end + + it "returns a mutable array" do + @result.last.should_not == "The End" + @result << "The End" + @result.last.should == "The End" + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/to_list_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/to_list_spec.rb new file mode 100644 index 000000000..f916a7500 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/to_list_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' + +require 'hamster/set' +require 'hamster/list' + +describe Hamster::Set do + + describe "#to_list" do + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values.inspect}" do + + before do + set = Hamster.set(*values) + @list = set.to_list + end + + it "returns a list" do + @list.is_a?(Hamster::List).should == true + end + + describe "the returned list" do + + it "has the correct length" do + @list.size.should == values.size + end + + it "contains all values" do + values.each do |value| + @list.should include(value) + end + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/to_set_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/to_set_spec.rb new file mode 100644 index 000000000..31440efec --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/to_set_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + describe "#to_set" do + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.set(*values) + @result = @original.to_set + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/union_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/union_spec.rb new file mode 100644 index 000000000..bbcd6e5d8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/union_spec.rb @@ -0,0 +1,45 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + [:union, :|, :+, :merge].each do |method| + + describe "##{method}" do + + [ + [[], [], []], + [["A"], [], ["A"]], + [["A"], ["A"], ["A"]], + [["A", "B", "C"], [], ["A", "B", "C"]], + ].each do |a, b, expected| + + describe "returns #{expected.inspect}" do + + before do + @a = Hamster.set(*a) + @b = Hamster.set(*b) + end + + it "for #{a.inspect} and #{b.inspect}" do + @result = @a.send(method, @b) + end + + it "for #{b.inspect} and #{a.inspect}" do + @result = @b.send(method, @a) + end + + after do + @result.should == Hamster.set(*expected) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/uniq_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/uniq_spec.rb new file mode 100644 index 000000000..b41866af2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/set/uniq_spec.rb @@ -0,0 +1,23 @@ +require 'spec_helper' + +require 'hamster/set' + +describe Hamster::Set do + + before do + @set = Hamster.set("A", "B", "C") + end + + [:uniq, :nub, :remove_duplicates].each do |method| + + describe "##{method}" do + + it "returns self" do + @set.send(method).should equal(@set) + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/app.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/app.js new file mode 100644 index 000000000..1a6902ba5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/app.js @@ -0,0 +1,66 @@ +$(document).ready(function() { + $('.file_list').dataTable({ + "aaSorting": [[ 1, "asc" ]], + "bPaginate": false, + "bJQueryUI": true, + "aoColumns": [ + null, + { "sType": "percent" }, + null, + null, + null, + null + ] + }); + + $('.source_table tbody tr:odd').addClass('odd'); + $('.source_table tbody tr:even').addClass('even'); + + $("a.src_link").fancybox({ + 'hideOnContentClick': true + }); + + // Hide src files and file list container + $('.source_files').hide(); + $('.file_list_container').hide(); + + // Add tabs based upon existing file_list_containers + $('.file_list_container h2').each(function(){ + $('.group_tabs').append('
  • ' + $(this).html() + '
  • '); + }); + + $('.group_tabs a').each( function() { + $(this).addClass($(this).attr('href').replace('#', '')); + }); + + $('.group_tabs a').live('focus', function() { + $(this).blur(); + }); + + var favicon_path = $('link[rel="shortcut icon"]').attr('href') + $('.group_tabs a').live('click', function(){ + if (!$(this).parent().hasClass('active')) { + $('.group_tabs a').parent().removeClass('active'); + $(this).parent().addClass('active'); + $('.file_list_container').hide(); + $(".file_list_container" + $(this).attr('href')).show(); + window.location.href = window.location.href.split('#')[0] + $(this).attr('href').replace('#', '#_'); + + // Force favicon reload - otherwise the location change containing anchor would drop the favicon... + // Works only on firefox, but still... - Anyone know a better solution to force favicon? + $('link[rel="shortcut icon"]').remove(); + $('head').append(''); + }; + return false; + }); + + if (jQuery.url.attr('anchor')) { + $('.group_tabs a.'+jQuery.url.attr('anchor').replace('_', '')).click(); + } else { + $('.group_tabs a:first').click(); + }; + + $("abbr.timeago").timeago(); + $('#loading').fadeOut(); + $('#wrapper').show(); +}); diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/blank.gif b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/blank.gif new file mode 100644 index 000000000..35d42e808 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/blank.gif differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_close.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_close.png new file mode 100644 index 000000000..07035307a Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_close.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_loading.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_loading.png new file mode 100644 index 000000000..250301796 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_loading.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_nav_left.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_nav_left.png new file mode 100644 index 000000000..ebaa6a4fd Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_nav_left.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_nav_right.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_nav_right.png new file mode 100644 index 000000000..873294e96 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_nav_right.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_e.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_e.png new file mode 100644 index 000000000..2eda08936 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_e.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_n.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_n.png new file mode 100644 index 000000000..69aa10e23 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_n.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_ne.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_ne.png new file mode 100644 index 000000000..79f6980a3 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_ne.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_nw.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_nw.png new file mode 100644 index 000000000..7182cd938 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_nw.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_s.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_s.png new file mode 100644 index 000000000..d8858bfb7 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_s.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_se.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_se.png new file mode 100644 index 000000000..541e3ffd3 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_se.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_sw.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_sw.png new file mode 100644 index 000000000..b451689fa Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_sw.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_w.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_w.png new file mode 100644 index 000000000..8a4e4a887 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_w.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_title_left.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_title_left.png new file mode 100644 index 000000000..6049223d1 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_title_left.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_title_main.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_title_main.png new file mode 100644 index 000000000..8044271f2 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_title_main.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_title_over.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_title_over.png new file mode 100644 index 000000000..d9f458f4b Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_title_over.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_title_right.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_title_right.png new file mode 100644 index 000000000..e36d9db2a Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_title_right.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancybox-x.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancybox-x.png new file mode 100644 index 000000000..c2130f869 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancybox-x.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancybox-y.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancybox-y.png new file mode 100644 index 000000000..7ef399b99 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancybox-y.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancybox.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancybox.png new file mode 100644 index 000000000..65e14f68f Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancybox.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.css b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.css new file mode 100644 index 000000000..28bbb1327 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.css @@ -0,0 +1,363 @@ +/* + * FancyBox - jQuery Plugin + * Simple and fancy lightbox alternative + * + * Examples and documentation at: http://fancybox.net + * + * Copyright (c) 2008 - 2010 Janis Skarnelis + * + * Version: 1.3.1 (05/03/2010) + * Requires: jQuery v1.3+ + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ + +#fancybox-loading { + position: fixed; + top: 50%; + left: 50%; + height: 40px; + width: 40px; + margin-top: -20px; + margin-left: -20px; + cursor: pointer; + overflow: hidden; + z-index: 1104; + display: none; +} + +* html #fancybox-loading { /* IE6 */ + position: absolute; + margin-top: 0; +} + +#fancybox-loading div { + position: absolute; + top: 0; + left: 0; + width: 40px; + height: 480px; + background-image: url('fancybox.png'); +} + +#fancybox-overlay { + position: fixed; + top: 0; + left: 0; + bottom: 0; + right: 0; + background: #000; + z-index: 1100; + display: none; +} + +* html #fancybox-overlay { /* IE6 */ + position: absolute; + width: 100%; +} + +#fancybox-tmp { + padding: 0; + margin: 0; + border: 0; + overflow: auto; + display: none; +} + +#fancybox-wrap { + position: absolute; + top: 0; + left: 0; + margin: 0; + padding: 20px; + z-index: 1101; + display: none; +} + +#fancybox-outer { + position: relative; + width: 100%; + height: 100%; + background: #FFF; +} + +#fancybox-inner { + position: absolute; + top: 0; + left: 0; + width: 1px; + height: 1px; + padding: 0; + margin: 0; + outline: none; + overflow: hidden; +} + +#fancybox-hide-sel-frame { + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + background: transparent; +} + +#fancybox-close { + position: absolute; + top: -15px; + right: -15px; + width: 30px; + height: 30px; + background-image: url('fancybox.png'); + background-position: -40px 0px; + cursor: pointer; + z-index: 1103; + display: none; +} + +#fancybox_error { + color: #444; + font: normal 12px/20px Arial; + padding: 7px; + margin: 0; +} + +#fancybox-content { + height: auto; + width: auto; + padding: 0; + margin: 0; +} + +#fancybox-img { + width: 100%; + height: 100%; + padding: 0; + margin: 0; + border: none; + outline: none; + line-height: 0; + vertical-align: top; + -ms-interpolation-mode: bicubic; +} + +#fancybox-frame { + position: relative; + width: 100%; + height: 100%; + border: none; + display: block; +} + +#fancybox-title { + position: absolute; + bottom: 0; + left: 0; + font-family: Arial; + font-size: 12px; + z-index: 1102; +} + +.fancybox-title-inside { + padding: 10px 0; + text-align: center; + color: #333; +} + +.fancybox-title-outside { + padding-top: 5px; + color: #FFF; + text-align: center; + font-weight: bold; +} + +.fancybox-title-over { + color: #FFF; + text-align: left; +} + +#fancybox-title-over { + padding: 10px; + background-image: url('fancy_title_over.png'); + display: block; +} + +#fancybox-title-wrap { + display: inline-block; +} + +#fancybox-title-wrap span { + height: 32px; + float: left; +} + +#fancybox-title-left { + padding-left: 15px; + background-image: url('fancybox.png'); + background-position: -40px -90px; + background-repeat: no-repeat; +} + +#fancybox-title-main { + font-weight: bold; + line-height: 29px; + background-image: url('fancybox-x.png'); + background-position: 0px -40px; + color: #FFF; +} + +#fancybox-title-right { + padding-left: 15px; + background-image: url('fancybox.png'); + background-position: -55px -90px; + background-repeat: no-repeat; +} + +#fancybox-left, #fancybox-right { + position: absolute; + bottom: 0px; + height: 100%; + width: 35%; + cursor: pointer; + outline: none; + background-image: url('blank.gif'); + z-index: 1102; + display: none; +} + +#fancybox-left { + left: 0px; +} + +#fancybox-right { + right: 0px; +} + +#fancybox-left-ico, #fancybox-right-ico { + position: absolute; + top: 50%; + left: -9999px; + width: 30px; + height: 30px; + margin-top: -15px; + cursor: pointer; + z-index: 1102; + display: block; +} + +#fancybox-left-ico { + background-image: url('fancybox.png'); + background-position: -40px -30px; +} + +#fancybox-right-ico { + background-image: url('fancybox.png'); + background-position: -40px -60px; +} + +#fancybox-left:hover, #fancybox-right:hover { + visibility: visible; /* IE6 */ +} + +#fancybox-left:hover span { + left: 20px; +} + +#fancybox-right:hover span { + left: auto; + right: 20px; +} + +.fancy-bg { + position: absolute; + padding: 0; + margin: 0; + border: 0; + width: 20px; + height: 20px; + z-index: 1001; +} + +#fancy-bg-n { + top: -20px; + left: 0; + width: 100%; + background-image: url('fancybox-x.png'); +} + +#fancy-bg-ne { + top: -20px; + right: -20px; + background-image: url('fancybox.png'); + background-position: -40px -162px; +} + +#fancy-bg-e { + top: 0; + right: -20px; + height: 100%; + background-image: url('fancybox-y.png'); + background-position: -20px 0px; +} + +#fancy-bg-se { + bottom: -20px; + right: -20px; + background-image: url('fancybox.png'); + background-position: -40px -182px; +} + +#fancy-bg-s { + bottom: -20px; + left: 0; + width: 100%; + background-image: url('fancybox-x.png'); + background-position: 0px -20px; +} + +#fancy-bg-sw { + bottom: -20px; + left: -20px; + background-image: url('fancybox.png'); + background-position: -40px -142px; +} + +#fancy-bg-w { + top: 0; + left: -20px; + height: 100%; + background-image: url('fancybox-y.png'); +} + +#fancy-bg-nw { + top: -20px; + left: -20px; + background-image: url('fancybox.png'); + background-position: -40px -122px; +} + +/* IE */ + +#fancybox-loading.fancybox-ie div { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_loading.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-close { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_close.png', sizingMethod='scale'); } + +.fancybox-ie #fancybox-title-over { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_over.png', sizingMethod='scale'); zoom: 1; } +.fancybox-ie #fancybox-title-left { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_left.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-title-main { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_main.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-title-right { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_title_right.png', sizingMethod='scale'); } + +.fancybox-ie #fancybox-left-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_left.png', sizingMethod='scale'); } +.fancybox-ie #fancybox-right-ico { background: transparent; filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_nav_right.png', sizingMethod='scale'); } + +.fancybox-ie .fancy-bg { background: transparent !important; } + +.fancybox-ie #fancy-bg-n { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_n.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-ne { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_ne.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-e { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_e.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-se { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_se.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-s { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_s.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-sw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_sw.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-w { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_w.png', sizingMethod='scale'); } +.fancybox-ie #fancy-bg-nw { filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='fancybox/fancy_shadow_nw.png', sizingMethod='scale'); } diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.pack.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.pack.js new file mode 100644 index 000000000..8421d53a6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.pack.js @@ -0,0 +1,44 @@ +/* + * FancyBox - jQuery Plugin + * Simple and fancy lightbox alternative + * + * Examples and documentation at: http://fancybox.net + * + * Copyright (c) 2008 - 2010 Janis Skarnelis + * + * Version: 1.3.1 (05/03/2010) + * Requires: jQuery v1.3+ + * + * Dual licensed under the MIT and GPL licenses: + * http://www.opensource.org/licenses/mit-license.php + * http://www.gnu.org/licenses/gpl.html + */ + +(function(b){var m,u,x,g,D,i,z,A,B,p=0,e={},q=[],n=0,c={},j=[],E=null,s=new Image,G=/\.(jpg|gif|png|bmp|jpeg)(.*)?$/i,S=/[^\.]\.(swf)\s*$/i,H,I=1,k,l,h=false,y=b.extend(b("
    ")[0],{prop:0}),v=0,O=!b.support.opacity&&!window.XMLHttpRequest,J=function(){u.hide();s.onerror=s.onload=null;E&&E.abort();m.empty()},P=function(){b.fancybox('

    The requested content cannot be loaded.
    Please try again later.

    ',{scrolling:"no",padding:20,transitionIn:"none",transitionOut:"none"})}, +K=function(){return[b(window).width(),b(window).height(),b(document).scrollLeft(),b(document).scrollTop()]},T=function(){var a=K(),d={},f=c.margin,o=c.autoScale,t=(20+f)*2,w=(20+f)*2,r=c.padding*2;if(c.width.toString().indexOf("%")>-1){d.width=a[0]*parseFloat(c.width)/100-40;o=false}else d.width=c.width+r;if(c.height.toString().indexOf("%")>-1){d.height=a[1]*parseFloat(c.height)/100-40;o=false}else d.height=c.height+r;if(o&&(d.width>a[0]-t||d.height>a[1]-w))if(e.type=="image"||e.type=="swf"){t+=r; +w+=r;o=Math.min(Math.min(a[0]-t,c.width)/c.width,Math.min(a[1]-w,c.height)/c.height);d.width=Math.round(o*(d.width-r))+r;d.height=Math.round(o*(d.height-r))+r}else{d.width=Math.min(d.width,a[0]-t);d.height=Math.min(d.height,a[1]-w)}d.top=a[3]+(a[1]-(d.height+40))*0.5;d.left=a[2]+(a[0]-(d.width+40))*0.5;if(c.autoScale===false){d.top=Math.max(a[3]+f,d.top);d.left=Math.max(a[2]+f,d.left)}return d},U=function(a){if(a&&a.length)switch(c.titlePosition){case "inside":return a;case "over":return''+ +a+"";default:return''+a+''}return false},V=function(){var a=c.title,d=l.width-c.padding*2,f="fancybox-title-"+c.titlePosition;b("#fancybox-title").remove();v=0;if(c.titleShow!==false){a=b.isFunction(c.titleFormat)?c.titleFormat(a,j,n,c):U(a);if(!(!a||a==="")){b('
    ').css({width:d,paddingLeft:c.padding, +paddingRight:c.padding}).html(a).appendTo("body");switch(c.titlePosition){case "inside":v=b("#fancybox-title").outerHeight(true)-c.padding;l.height+=v;break;case "over":b("#fancybox-title").css("bottom",c.padding);break;default:b("#fancybox-title").css("bottom",b("#fancybox-title").outerHeight(true)*-1);break}b("#fancybox-title").appendTo(D).hide()}}},W=function(){b(document).unbind("keydown.fb").bind("keydown.fb",function(a){if(a.keyCode==27&&c.enableEscapeButton){a.preventDefault();b.fancybox.close()}else if(a.keyCode== +37){a.preventDefault();b.fancybox.prev()}else if(a.keyCode==39){a.preventDefault();b.fancybox.next()}});if(b.fn.mousewheel){g.unbind("mousewheel.fb");j.length>1&&g.bind("mousewheel.fb",function(a,d){a.preventDefault();h||d===0||(d>0?b.fancybox.prev():b.fancybox.next())})}if(c.showNavArrows){if(c.cyclic&&j.length>1||n!==0)A.show();if(c.cyclic&&j.length>1||n!=j.length-1)B.show()}},X=function(){var a,d;if(j.length-1>n){a=j[n+1].href;if(typeof a!=="undefined"&&a.match(G)){d=new Image;d.src=a}}if(n>0){a= +j[n-1].href;if(typeof a!=="undefined"&&a.match(G)){d=new Image;d.src=a}}},L=function(){i.css("overflow",c.scrolling=="auto"?c.type=="image"||c.type=="iframe"||c.type=="swf"?"hidden":"auto":c.scrolling=="yes"?"auto":"visible");if(!b.support.opacity){i.get(0).style.removeAttribute("filter");g.get(0).style.removeAttribute("filter")}b("#fancybox-title").show();c.hideOnContentClick&&i.one("click",b.fancybox.close);c.hideOnOverlayClick&&x.one("click",b.fancybox.close);c.showCloseButton&&z.show();W();b(window).bind("resize.fb", +b.fancybox.center);c.centerOnScroll?b(window).bind("scroll.fb",b.fancybox.center):b(window).unbind("scroll.fb");b.isFunction(c.onComplete)&&c.onComplete(j,n,c);h=false;X()},M=function(a){var d=Math.round(k.width+(l.width-k.width)*a),f=Math.round(k.height+(l.height-k.height)*a),o=Math.round(k.top+(l.top-k.top)*a),t=Math.round(k.left+(l.left-k.left)*a);g.css({width:d+"px",height:f+"px",top:o+"px",left:t+"px"});d=Math.max(d-c.padding*2,0);f=Math.max(f-(c.padding*2+v*a),0);i.css({width:d+"px",height:f+ +"px"});if(typeof l.opacity!=="undefined")g.css("opacity",a<0.5?0.5:a)},Y=function(a){var d=a.offset();d.top+=parseFloat(a.css("paddingTop"))||0;d.left+=parseFloat(a.css("paddingLeft"))||0;d.top+=parseFloat(a.css("border-top-width"))||0;d.left+=parseFloat(a.css("border-left-width"))||0;d.width=a.width();d.height=a.height();return d},Q=function(){var a=e.orig?b(e.orig):false,d={};if(a&&a.length){a=Y(a);d={width:a.width+c.padding*2,height:a.height+c.padding*2,top:a.top-c.padding-20,left:a.left-c.padding- +20}}else{a=K();d={width:1,height:1,top:a[3]+a[1]*0.5,left:a[2]+a[0]*0.5}}return d},N=function(){u.hide();if(g.is(":visible")&&b.isFunction(c.onCleanup))if(c.onCleanup(j,n,c)===false){b.event.trigger("fancybox-cancel");h=false;return}j=q;n=p;c=e;i.get(0).scrollTop=0;i.get(0).scrollLeft=0;if(c.overlayShow){O&&b("select:not(#fancybox-tmp select)").filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one("fancybox-cleanup",function(){this.style.visibility="inherit"}); +x.css({"background-color":c.overlayColor,opacity:c.overlayOpacity}).unbind().show()}l=T();V();if(g.is(":visible")){b(z.add(A).add(B)).hide();var a=g.position(),d;k={top:a.top,left:a.left,width:g.width(),height:g.height()};d=k.width==l.width&&k.height==l.height;i.fadeOut(c.changeFade,function(){var f=function(){i.html(m.contents()).fadeIn(c.changeFade,L)};b.event.trigger("fancybox-change");i.empty().css("overflow","hidden");if(d){i.css({top:c.padding,left:c.padding,width:Math.max(l.width-c.padding* +2,1),height:Math.max(l.height-c.padding*2-v,1)});f()}else{i.css({top:c.padding,left:c.padding,width:Math.max(k.width-c.padding*2,1),height:Math.max(k.height-c.padding*2,1)});y.prop=0;b(y).animate({prop:1},{duration:c.changeSpeed,easing:c.easingChange,step:M,complete:f})}})}else{g.css("opacity",1);if(c.transitionIn=="elastic"){k=Q();i.css({top:c.padding,left:c.padding,width:Math.max(k.width-c.padding*2,1),height:Math.max(k.height-c.padding*2,1)}).html(m.contents());g.css(k).show();if(c.opacity)l.opacity= +0;y.prop=0;b(y).animate({prop:1},{duration:c.speedIn,easing:c.easingIn,step:M,complete:L})}else{i.css({top:c.padding,left:c.padding,width:Math.max(l.width-c.padding*2,1),height:Math.max(l.height-c.padding*2-v,1)}).html(m.contents());g.css(l).fadeIn(c.transitionIn=="none"?0:c.speedIn,L)}}},F=function(){m.width(e.width);m.height(e.height);if(e.width=="auto")e.width=m.width();if(e.height=="auto")e.height=m.height();N()},Z=function(){h=true;e.width=s.width;e.height=s.height;b("").attr({id:"fancybox-img", +src:s.src,alt:e.title}).appendTo(m);N()},C=function(){J();var a=q[p],d,f,o,t,w;e=b.extend({},b.fn.fancybox.defaults,typeof b(a).data("fancybox")=="undefined"?e:b(a).data("fancybox"));o=a.title||b(a).title||e.title||"";if(a.nodeName&&!e.orig)e.orig=b(a).children("img:first").length?b(a).children("img:first"):b(a);if(o===""&&e.orig)o=e.orig.attr("alt");d=a.nodeName&&/^(?:javascript|#)/i.test(a.href)?e.href||null:e.href||a.href||null;if(e.type){f=e.type;if(!d)d=e.content}else if(e.content)f="html";else if(d)if(d.match(G))f= +"image";else if(d.match(S))f="swf";else if(b(a).hasClass("iframe"))f="iframe";else if(d.match(/#/)){a=d.substr(d.indexOf("#"));f=b(a).length>0?"inline":"ajax"}else f="ajax";else f="inline";e.type=f;e.href=d;e.title=o;if(e.autoDimensions&&e.type!=="iframe"&&e.type!=="swf"){e.width="auto";e.height="auto"}if(e.modal){e.overlayShow=true;e.hideOnOverlayClick=false;e.hideOnContentClick=false;e.enableEscapeButton=false;e.showCloseButton=false}if(b.isFunction(e.onStart))if(e.onStart(q,p,e)===false){h=false; +return}m.css("padding",20+e.padding+e.margin);b(".fancybox-inline-tmp").unbind("fancybox-cancel").bind("fancybox-change",function(){b(this).replaceWith(i.children())});switch(f){case "html":m.html(e.content);F();break;case "inline":b('
    ').hide().insertBefore(b(a)).bind("fancybox-cleanup",function(){b(this).replaceWith(i.children())}).bind("fancybox-cancel",function(){b(this).replaceWith(m.children())});b(a).appendTo(m);F();break;case "image":h=false;b.fancybox.showActivity(); +s=new Image;s.onerror=function(){P()};s.onload=function(){s.onerror=null;s.onload=null;Z()};s.src=d;break;case "swf":t='';w="";b.each(e.swf,function(r,R){t+='';w+=" "+r+'="'+R+'"'});t+='";m.html(t); +F();break;case "ajax":a=d.split("#",2);f=e.ajax.data||{};if(a.length>1){d=a[0];if(typeof f=="string")f+="&selector="+a[1];else f.selector=a[1]}h=false;b.fancybox.showActivity();E=b.ajax(b.extend(e.ajax,{url:d,data:f,error:P,success:function(r){if(E.status==200){m.html(r);F()}}}));break;case "iframe":b('').appendTo(m);N();break}},$=function(){if(u.is(":visible")){b("div", +u).css("top",I*-40+"px");I=(I+1)%12}else clearInterval(H)},aa=function(){if(!b("#fancybox-wrap").length){b("body").append(m=b('
    '),u=b('
    '),x=b('
    '),g=b('
    '));if(!b.support.opacity){g.addClass("fancybox-ie");u.addClass("fancybox-ie")}D=b('
    ').append('
    ').appendTo(g); +D.append(i=b('
    '),z=b(''),A=b(''),B=b(''));z.click(b.fancybox.close);u.click(b.fancybox.cancel);A.click(function(a){a.preventDefault();b.fancybox.prev()});B.click(function(a){a.preventDefault();b.fancybox.next()});if(O){x.get(0).style.setExpression("height", +"document.body.scrollHeight > document.body.offsetHeight ? document.body.scrollHeight : document.body.offsetHeight + 'px'");u.get(0).style.setExpression("top","(-20 + (document.documentElement.clientHeight ? document.documentElement.clientHeight/2 : document.body.clientHeight/2 ) + ( ignoreMe = document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop )) + 'px'");D.prepend('')}}}; +b.fn.fancybox=function(a){b(this).data("fancybox",b.extend({},a,b.metadata?b(this).metadata():{})).unbind("click.fb").bind("click.fb",function(d){d.preventDefault();if(!h){h=true;b(this).blur();q=[];p=0;d=b(this).attr("rel")||"";if(!d||d==""||d==="nofollow")q.push(this);else{q=b("a[rel="+d+"], area[rel="+d+"]");p=q.index(this)}C();return false}});return this};b.fancybox=function(a,d){if(!h){h=true;d=typeof d!=="undefined"?d:{};q=[];p=d.index||0;if(b.isArray(a)){for(var f=0,o=a.length;fq.length||p<0)p=0;C()}};b.fancybox.showActivity=function(){clearInterval(H);u.show();H=setInterval($,66)};b.fancybox.hideActivity=function(){u.hide()};b.fancybox.next=function(){return b.fancybox.pos(n+1)};b.fancybox.prev=function(){return b.fancybox.pos(n- +1)};b.fancybox.pos=function(a){if(!h){a=parseInt(a,10);if(a>-1&&j.length>a){p=a;C()}if(c.cyclic&&j.length>1&&a<0){p=j.length-1;C()}if(c.cyclic&&j.length>1&&a>=j.length){p=0;C()}}};b.fancybox.cancel=function(){if(!h){h=true;b.event.trigger("fancybox-cancel");J();e&&b.isFunction(e.onCancel)&&e.onCancel(q,p,e);h=false}};b.fancybox.close=function(){function a(){x.fadeOut("fast");g.hide();b.event.trigger("fancybox-cleanup");i.empty();b.isFunction(c.onClosed)&&c.onClosed(j,n,c);j=e=[];n=p=0;c=e={};h=false} +if(!(h||g.is(":hidden"))){h=true;if(c&&b.isFunction(c.onCleanup))if(c.onCleanup(j,n,c)===false){h=false;return}J();b(z.add(A).add(B)).hide();b("#fancybox-title").remove();g.add(i).add(x).unbind();b(window).unbind("resize.fb scroll.fb");b(document).unbind("keydown.fb");i.css("overflow","hidden");if(c.transitionOut=="elastic"){k=Q();var d=g.position();l={top:d.top,left:d.left,width:g.width(),height:g.height()};if(c.opacity)l.opacity=1;y.prop=1;b(y).animate({prop:0},{duration:c.speedOut,easing:c.easingOut, +step:M,complete:a})}else g.fadeOut(c.transitionOut=="none"?0:c.speedOut,a)}};b.fancybox.resize=function(){var a,d;if(!(h||g.is(":hidden"))){h=true;a=i.wrapInner("
    ").children();d=a.height();g.css({height:d+c.padding*2+v});i.css({height:d});a.replaceWith(a.children());b.fancybox.center()}};b.fancybox.center=function(){h=true;var a=K(),d=c.margin,f={};f.top=a[3]+(a[1]-(g.height()-v+40))*0.5;f.left=a[2]+(a[0]-(g.width()+40))*0.5;f.top=Math.max(a[3]+d,f.top);f.left=Math.max(a[2]+ +d,f.left);g.css(f);h=false};b.fn.fancybox.defaults={padding:10,margin:20,opacity:false,modal:false,cyclic:false,scrolling:"auto",width:560,height:340,autoScale:true,autoDimensions:true,centerOnScroll:false,ajax:{},swf:{wmode:"transparent"},hideOnOverlayClick:true,hideOnContentClick:false,overlayShow:true,overlayOpacity:0.3,overlayColor:"#666",titleShow:true,titlePosition:"outside",titleFormat:null,transitionIn:"fade",transitionOut:"fade",speedIn:300,speedOut:300,changeSpeed:300,changeFade:"fast", +easingIn:"swing",easingOut:"swing",showCloseButton:true,showNavArrows:true,enableEscapeButton:true,onStart:null,onCancel:null,onComplete:null,onCleanup:null,onClosed:null};b(document).ready(function(){aa()})})(jQuery); \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/favicon.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/favicon.png new file mode 100644 index 000000000..6bd0e1338 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/favicon.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/jquery-1.4.2.min.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/jquery-1.4.2.min.js new file mode 100644 index 000000000..b170a78f8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/jquery-1.4.2.min.js @@ -0,0 +1,155 @@ +/*! + * jQuery JavaScript Library v1.4.2 + * http://jquery.com/ + * + * Copyright 2010, John Resig + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * Includes Sizzle.js + * http://sizzlejs.com/ + * Copyright 2010, The Dojo Foundation + * Released under the MIT, BSD, and GPL Licenses. + * + * Date: Sat Feb 13 22:33:48 2010 -0500 + */ +(function(A,w){function ma(){if(!c.isReady){try{s.documentElement.doScroll("left")}catch(a){setTimeout(ma,1);return}c.ready()}}function Qa(a,b){b.src?c.ajax({url:b.src,async:false,dataType:"script"}):c.globalEval(b.text||b.textContent||b.innerHTML||"");b.parentNode&&b.parentNode.removeChild(b)}function X(a,b,d,f,e,j){var i=a.length;if(typeof b==="object"){for(var o in b)X(a,o,b[o],f,e,d);return a}if(d!==w){f=!j&&f&&c.isFunction(d);for(o=0;o)[^>]*$|^#([\w-]+)$/,Ua=/^.[^:#\[\.,]*$/,Va=/\S/, +Wa=/^(\s|\u00A0)+|(\s|\u00A0)+$/g,Xa=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,P=navigator.userAgent,xa=false,Q=[],L,$=Object.prototype.toString,aa=Object.prototype.hasOwnProperty,ba=Array.prototype.push,R=Array.prototype.slice,ya=Array.prototype.indexOf;c.fn=c.prototype={init:function(a,b){var d,f;if(!a)return this;if(a.nodeType){this.context=this[0]=a;this.length=1;return this}if(a==="body"&&!b){this.context=s;this[0]=s.body;this.selector="body";this.length=1;return this}if(typeof a==="string")if((d=Ta.exec(a))&& +(d[1]||!b))if(d[1]){f=b?b.ownerDocument||b:s;if(a=Xa.exec(a))if(c.isPlainObject(b)){a=[s.createElement(a[1])];c.fn.attr.call(a,b,true)}else a=[f.createElement(a[1])];else{a=sa([d[1]],[f]);a=(a.cacheable?a.fragment.cloneNode(true):a.fragment).childNodes}return c.merge(this,a)}else{if(b=s.getElementById(d[2])){if(b.id!==d[2])return T.find(a);this.length=1;this[0]=b}this.context=s;this.selector=a;return this}else if(!b&&/^\w+$/.test(a)){this.selector=a;this.context=s;a=s.getElementsByTagName(a);return c.merge(this, +a)}else return!b||b.jquery?(b||T).find(a):c(b).find(a);else if(c.isFunction(a))return T.ready(a);if(a.selector!==w){this.selector=a.selector;this.context=a.context}return c.makeArray(a,this)},selector:"",jquery:"1.4.2",length:0,size:function(){return this.length},toArray:function(){return R.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this.slice(a)[0]:this[a]},pushStack:function(a,b,d){var f=c();c.isArray(a)?ba.apply(f,a):c.merge(f,a);f.prevObject=this;f.context=this.context;if(b=== +"find")f.selector=this.selector+(this.selector?" ":"")+d;else if(b)f.selector=this.selector+"."+b+"("+d+")";return f},each:function(a,b){return c.each(this,a,b)},ready:function(a){c.bindReady();if(c.isReady)a.call(s,c);else Q&&Q.push(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(R.apply(this,arguments),"slice",R.call(arguments).join(","))},map:function(a){return this.pushStack(c.map(this, +function(b,d){return a.call(b,d,b)}))},end:function(){return this.prevObject||c(null)},push:ba,sort:[].sort,splice:[].splice};c.fn.init.prototype=c.fn;c.extend=c.fn.extend=function(){var a=arguments[0]||{},b=1,d=arguments.length,f=false,e,j,i,o;if(typeof a==="boolean"){f=a;a=arguments[1]||{};b=2}if(typeof a!=="object"&&!c.isFunction(a))a={};if(d===b){a=this;--b}for(;b
    a"; +var e=d.getElementsByTagName("*"),j=d.getElementsByTagName("a")[0];if(!(!e||!e.length||!j)){c.support={leadingWhitespace:d.firstChild.nodeType===3,tbody:!d.getElementsByTagName("tbody").length,htmlSerialize:!!d.getElementsByTagName("link").length,style:/red/.test(j.getAttribute("style")),hrefNormalized:j.getAttribute("href")==="/a",opacity:/^0.55$/.test(j.style.opacity),cssFloat:!!j.style.cssFloat,checkOn:d.getElementsByTagName("input")[0].value==="on",optSelected:s.createElement("select").appendChild(s.createElement("option")).selected, +parentNode:d.removeChild(d.appendChild(s.createElement("div"))).parentNode===null,deleteExpando:true,checkClone:false,scriptEval:false,noCloneEvent:true,boxModel:null};b.type="text/javascript";try{b.appendChild(s.createTextNode("window."+f+"=1;"))}catch(i){}a.insertBefore(b,a.firstChild);if(A[f]){c.support.scriptEval=true;delete A[f]}try{delete b.test}catch(o){c.support.deleteExpando=false}a.removeChild(b);if(d.attachEvent&&d.fireEvent){d.attachEvent("onclick",function k(){c.support.noCloneEvent= +false;d.detachEvent("onclick",k)});d.cloneNode(true).fireEvent("onclick")}d=s.createElement("div");d.innerHTML="";a=s.createDocumentFragment();a.appendChild(d.firstChild);c.support.checkClone=a.cloneNode(true).cloneNode(true).lastChild.checked;c(function(){var k=s.createElement("div");k.style.width=k.style.paddingLeft="1px";s.body.appendChild(k);c.boxModel=c.support.boxModel=k.offsetWidth===2;s.body.removeChild(k).style.display="none"});a=function(k){var n= +s.createElement("div");k="on"+k;var r=k in n;if(!r){n.setAttribute(k,"return;");r=typeof n[k]==="function"}return r};c.support.submitBubbles=a("submit");c.support.changeBubbles=a("change");a=b=d=e=j=null}})();c.props={"for":"htmlFor","class":"className",readonly:"readOnly",maxlength:"maxLength",cellspacing:"cellSpacing",rowspan:"rowSpan",colspan:"colSpan",tabindex:"tabIndex",usemap:"useMap",frameborder:"frameBorder"};var G="jQuery"+J(),Ya=0,za={};c.extend({cache:{},expando:G,noData:{embed:true,object:true, +applet:true},data:function(a,b,d){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var f=a[G],e=c.cache;if(!f&&typeof b==="string"&&d===w)return null;f||(f=++Ya);if(typeof b==="object"){a[G]=f;e[f]=c.extend(true,{},b)}else if(!e[f]){a[G]=f;e[f]={}}a=e[f];if(d!==w)a[b]=d;return typeof b==="string"?a[b]:a}},removeData:function(a,b){if(!(a.nodeName&&c.noData[a.nodeName.toLowerCase()])){a=a==A?za:a;var d=a[G],f=c.cache,e=f[d];if(b){if(e){delete e[b];c.isEmptyObject(e)&&c.removeData(a)}}else{if(c.support.deleteExpando)delete a[c.expando]; +else a.removeAttribute&&a.removeAttribute(c.expando);delete f[d]}}}});c.fn.extend({data:function(a,b){if(typeof a==="undefined"&&this.length)return c.data(this[0]);else if(typeof a==="object")return this.each(function(){c.data(this,a)});var d=a.split(".");d[1]=d[1]?"."+d[1]:"";if(b===w){var f=this.triggerHandler("getData"+d[1]+"!",[d[0]]);if(f===w&&this.length)f=c.data(this[0],a);return f===w&&d[1]?this.data(d[0]):f}else return this.trigger("setData"+d[1]+"!",[d[0],b]).each(function(){c.data(this, +a,b)})},removeData:function(a){return this.each(function(){c.removeData(this,a)})}});c.extend({queue:function(a,b,d){if(a){b=(b||"fx")+"queue";var f=c.data(a,b);if(!d)return f||[];if(!f||c.isArray(d))f=c.data(a,b,c.makeArray(d));else f.push(d);return f}},dequeue:function(a,b){b=b||"fx";var d=c.queue(a,b),f=d.shift();if(f==="inprogress")f=d.shift();if(f){b==="fx"&&d.unshift("inprogress");f.call(a,function(){c.dequeue(a,b)})}}});c.fn.extend({queue:function(a,b){if(typeof a!=="string"){b=a;a="fx"}if(b=== +w)return c.queue(this[0],a);return this.each(function(){var d=c.queue(this,a,b);a==="fx"&&d[0]!=="inprogress"&&c.dequeue(this,a)})},dequeue:function(a){return this.each(function(){c.dequeue(this,a)})},delay:function(a,b){a=c.fx?c.fx.speeds[a]||a:a;b=b||"fx";return this.queue(b,function(){var d=this;setTimeout(function(){c.dequeue(d,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])}});var Aa=/[\n\t]/g,ca=/\s+/,Za=/\r/g,$a=/href|src|style/,ab=/(button|input)/i,bb=/(button|input|object|select|textarea)/i, +cb=/^(a|area)$/i,Ba=/radio|checkbox/;c.fn.extend({attr:function(a,b){return X(this,a,b,true,c.attr)},removeAttr:function(a){return this.each(function(){c.attr(this,a,"");this.nodeType===1&&this.removeAttribute(a)})},addClass:function(a){if(c.isFunction(a))return this.each(function(n){var r=c(this);r.addClass(a.call(this,n,r.attr("class")))});if(a&&typeof a==="string")for(var b=(a||"").split(ca),d=0,f=this.length;d-1)return true;return false},val:function(a){if(a===w){var b=this[0];if(b){if(c.nodeName(b,"option"))return(b.attributes.value||{}).specified?b.value:b.text;if(c.nodeName(b,"select")){var d=b.selectedIndex,f=[],e=b.options;b=b.type==="select-one";if(d<0)return null;var j=b?d:0;for(d=b?d+1:e.length;j=0;else if(c.nodeName(this,"select")){var u=c.makeArray(r);c("option",this).each(function(){this.selected= +c.inArray(c(this).val(),u)>=0});if(!u.length)this.selectedIndex=-1}else this.value=r}})}});c.extend({attrFn:{val:true,css:true,html:true,text:true,data:true,width:true,height:true,offset:true},attr:function(a,b,d,f){if(!a||a.nodeType===3||a.nodeType===8)return w;if(f&&b in c.attrFn)return c(a)[b](d);f=a.nodeType!==1||!c.isXMLDoc(a);var e=d!==w;b=f&&c.props[b]||b;if(a.nodeType===1){var j=$a.test(b);if(b in a&&f&&!j){if(e){b==="type"&&ab.test(a.nodeName)&&a.parentNode&&c.error("type property can't be changed"); +a[b]=d}if(c.nodeName(a,"form")&&a.getAttributeNode(b))return a.getAttributeNode(b).nodeValue;if(b==="tabIndex")return(b=a.getAttributeNode("tabIndex"))&&b.specified?b.value:bb.test(a.nodeName)||cb.test(a.nodeName)&&a.href?0:w;return a[b]}if(!c.support.style&&f&&b==="style"){if(e)a.style.cssText=""+d;return a.style.cssText}e&&a.setAttribute(b,""+d);a=!c.support.hrefNormalized&&f&&j?a.getAttribute(b,2):a.getAttribute(b);return a===null?w:a}return c.style(a,b,d)}});var O=/\.(.*)$/,db=function(a){return a.replace(/[^\w\s\.\|`]/g, +function(b){return"\\"+b})};c.event={add:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){if(a.setInterval&&a!==A&&!a.frameElement)a=A;var e,j;if(d.handler){e=d;d=e.handler}if(!d.guid)d.guid=c.guid++;if(j=c.data(a)){var i=j.events=j.events||{},o=j.handle;if(!o)j.handle=o=function(){return typeof c!=="undefined"&&!c.event.triggered?c.event.handle.apply(o.elem,arguments):w};o.elem=a;b=b.split(" ");for(var k,n=0,r;k=b[n++];){j=e?c.extend({},e):{handler:d,data:f};if(k.indexOf(".")>-1){r=k.split("."); +k=r.shift();j.namespace=r.slice(0).sort().join(".")}else{r=[];j.namespace=""}j.type=k;j.guid=d.guid;var u=i[k],z=c.event.special[k]||{};if(!u){u=i[k]=[];if(!z.setup||z.setup.call(a,f,r,o)===false)if(a.addEventListener)a.addEventListener(k,o,false);else a.attachEvent&&a.attachEvent("on"+k,o)}if(z.add){z.add.call(a,j);if(!j.handler.guid)j.handler.guid=d.guid}u.push(j);c.event.global[k]=true}a=null}}},global:{},remove:function(a,b,d,f){if(!(a.nodeType===3||a.nodeType===8)){var e,j=0,i,o,k,n,r,u,z=c.data(a), +C=z&&z.events;if(z&&C){if(b&&b.type){d=b.handler;b=b.type}if(!b||typeof b==="string"&&b.charAt(0)==="."){b=b||"";for(e in C)c.event.remove(a,e+b)}else{for(b=b.split(" ");e=b[j++];){n=e;i=e.indexOf(".")<0;o=[];if(!i){o=e.split(".");e=o.shift();k=new RegExp("(^|\\.)"+c.map(o.slice(0).sort(),db).join("\\.(?:.*\\.)?")+"(\\.|$)")}if(r=C[e])if(d){n=c.event.special[e]||{};for(B=f||0;B=0){a.type= +e=e.slice(0,-1);a.exclusive=true}if(!d){a.stopPropagation();c.event.global[e]&&c.each(c.cache,function(){this.events&&this.events[e]&&c.event.trigger(a,b,this.handle.elem)})}if(!d||d.nodeType===3||d.nodeType===8)return w;a.result=w;a.target=d;b=c.makeArray(b);b.unshift(a)}a.currentTarget=d;(f=c.data(d,"handle"))&&f.apply(d,b);f=d.parentNode||d.ownerDocument;try{if(!(d&&d.nodeName&&c.noData[d.nodeName.toLowerCase()]))if(d["on"+e]&&d["on"+e].apply(d,b)===false)a.result=false}catch(j){}if(!a.isPropagationStopped()&& +f)c.event.trigger(a,b,f,true);else if(!a.isDefaultPrevented()){f=a.target;var i,o=c.nodeName(f,"a")&&e==="click",k=c.event.special[e]||{};if((!k._default||k._default.call(d,a)===false)&&!o&&!(f&&f.nodeName&&c.noData[f.nodeName.toLowerCase()])){try{if(f[e]){if(i=f["on"+e])f["on"+e]=null;c.event.triggered=true;f[e]()}}catch(n){}if(i)f["on"+e]=i;c.event.triggered=false}}},handle:function(a){var b,d,f,e;a=arguments[0]=c.event.fix(a||A.event);a.currentTarget=this;b=a.type.indexOf(".")<0&&!a.exclusive; +if(!b){d=a.type.split(".");a.type=d.shift();f=new RegExp("(^|\\.)"+d.slice(0).sort().join("\\.(?:.*\\.)?")+"(\\.|$)")}e=c.data(this,"events");d=e[a.type];if(e&&d){d=d.slice(0);e=0;for(var j=d.length;e-1?c.map(a.options,function(f){return f.selected}).join("-"):"";else if(a.nodeName.toLowerCase()==="select")d=a.selectedIndex;return d},fa=function(a,b){var d=a.target,f,e;if(!(!da.test(d.nodeName)||d.readOnly)){f=c.data(d,"_change_data");e=Fa(d);if(a.type!=="focusout"||d.type!=="radio")c.data(d,"_change_data", +e);if(!(f===w||e===f))if(f!=null||e){a.type="change";return c.event.trigger(a,b,d)}}};c.event.special.change={filters:{focusout:fa,click:function(a){var b=a.target,d=b.type;if(d==="radio"||d==="checkbox"||b.nodeName.toLowerCase()==="select")return fa.call(this,a)},keydown:function(a){var b=a.target,d=b.type;if(a.keyCode===13&&b.nodeName.toLowerCase()!=="textarea"||a.keyCode===32&&(d==="checkbox"||d==="radio")||d==="select-multiple")return fa.call(this,a)},beforeactivate:function(a){a=a.target;c.data(a, +"_change_data",Fa(a))}},setup:function(){if(this.type==="file")return false;for(var a in ea)c.event.add(this,a+".specialChange",ea[a]);return da.test(this.nodeName)},teardown:function(){c.event.remove(this,".specialChange");return da.test(this.nodeName)}};ea=c.event.special.change.filters}s.addEventListener&&c.each({focus:"focusin",blur:"focusout"},function(a,b){function d(f){f=c.event.fix(f);f.type=b;return c.event.handle.call(this,f)}c.event.special[b]={setup:function(){this.addEventListener(a, +d,true)},teardown:function(){this.removeEventListener(a,d,true)}}});c.each(["bind","one"],function(a,b){c.fn[b]=function(d,f,e){if(typeof d==="object"){for(var j in d)this[b](j,f,d[j],e);return this}if(c.isFunction(f)){e=f;f=w}var i=b==="one"?c.proxy(e,function(k){c(this).unbind(k,i);return e.apply(this,arguments)}):e;if(d==="unload"&&b!=="one")this.one(d,f,e);else{j=0;for(var o=this.length;j0){y=t;break}}t=t[g]}m[q]=y}}}var f=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^[\]]*\]|['"][^'"]*['"]|[^[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, +e=0,j=Object.prototype.toString,i=false,o=true;[0,0].sort(function(){o=false;return 0});var k=function(g,h,l,m){l=l||[];var q=h=h||s;if(h.nodeType!==1&&h.nodeType!==9)return[];if(!g||typeof g!=="string")return l;for(var p=[],v,t,y,S,H=true,M=x(h),I=g;(f.exec(""),v=f.exec(I))!==null;){I=v[3];p.push(v[1]);if(v[2]){S=v[3];break}}if(p.length>1&&r.exec(g))if(p.length===2&&n.relative[p[0]])t=ga(p[0]+p[1],h);else for(t=n.relative[p[0]]?[h]:k(p.shift(),h);p.length;){g=p.shift();if(n.relative[g])g+=p.shift(); +t=ga(g,t)}else{if(!m&&p.length>1&&h.nodeType===9&&!M&&n.match.ID.test(p[0])&&!n.match.ID.test(p[p.length-1])){v=k.find(p.shift(),h,M);h=v.expr?k.filter(v.expr,v.set)[0]:v.set[0]}if(h){v=m?{expr:p.pop(),set:z(m)}:k.find(p.pop(),p.length===1&&(p[0]==="~"||p[0]==="+")&&h.parentNode?h.parentNode:h,M);t=v.expr?k.filter(v.expr,v.set):v.set;if(p.length>0)y=z(t);else H=false;for(;p.length;){var D=p.pop();v=D;if(n.relative[D])v=p.pop();else D="";if(v==null)v=h;n.relative[D](y,v,M)}}else y=[]}y||(y=t);y||k.error(D|| +g);if(j.call(y)==="[object Array]")if(H)if(h&&h.nodeType===1)for(g=0;y[g]!=null;g++){if(y[g]&&(y[g]===true||y[g].nodeType===1&&E(h,y[g])))l.push(t[g])}else for(g=0;y[g]!=null;g++)y[g]&&y[g].nodeType===1&&l.push(t[g]);else l.push.apply(l,y);else z(y,l);if(S){k(S,q,l,m);k.uniqueSort(l)}return l};k.uniqueSort=function(g){if(B){i=o;g.sort(B);if(i)for(var h=1;h":function(g,h){var l=typeof h==="string";if(l&&!/\W/.test(h)){h=h.toLowerCase();for(var m=0,q=g.length;m=0))l||m.push(v);else if(l)h[p]=false;return false},ID:function(g){return g[1].replace(/\\/g,"")},TAG:function(g){return g[1].toLowerCase()}, +CHILD:function(g){if(g[1]==="nth"){var h=/(-?)(\d*)n((?:\+|-)?\d*)/.exec(g[2]==="even"&&"2n"||g[2]==="odd"&&"2n+1"||!/\D/.test(g[2])&&"0n+"+g[2]||g[2]);g[2]=h[1]+(h[2]||1)-0;g[3]=h[3]-0}g[0]=e++;return g},ATTR:function(g,h,l,m,q,p){h=g[1].replace(/\\/g,"");if(!p&&n.attrMap[h])g[1]=n.attrMap[h];if(g[2]==="~=")g[4]=" "+g[4]+" ";return g},PSEUDO:function(g,h,l,m,q){if(g[1]==="not")if((f.exec(g[3])||"").length>1||/^\w/.test(g[3]))g[3]=k(g[3],null,null,h);else{g=k.filter(g[3],h,l,true^q);l||m.push.apply(m, +g);return false}else if(n.match.POS.test(g[0])||n.match.CHILD.test(g[0]))return true;return g},POS:function(g){g.unshift(true);return g}},filters:{enabled:function(g){return g.disabled===false&&g.type!=="hidden"},disabled:function(g){return g.disabled===true},checked:function(g){return g.checked===true},selected:function(g){return g.selected===true},parent:function(g){return!!g.firstChild},empty:function(g){return!g.firstChild},has:function(g,h,l){return!!k(l[3],g).length},header:function(g){return/h\d/i.test(g.nodeName)}, +text:function(g){return"text"===g.type},radio:function(g){return"radio"===g.type},checkbox:function(g){return"checkbox"===g.type},file:function(g){return"file"===g.type},password:function(g){return"password"===g.type},submit:function(g){return"submit"===g.type},image:function(g){return"image"===g.type},reset:function(g){return"reset"===g.type},button:function(g){return"button"===g.type||g.nodeName.toLowerCase()==="button"},input:function(g){return/input|select|textarea|button/i.test(g.nodeName)}}, +setFilters:{first:function(g,h){return h===0},last:function(g,h,l,m){return h===m.length-1},even:function(g,h){return h%2===0},odd:function(g,h){return h%2===1},lt:function(g,h,l){return hl[3]-0},nth:function(g,h,l){return l[3]-0===h},eq:function(g,h,l){return l[3]-0===h}},filter:{PSEUDO:function(g,h,l,m){var q=h[1],p=n.filters[q];if(p)return p(g,l,h,m);else if(q==="contains")return(g.textContent||g.innerText||a([g])||"").indexOf(h[3])>=0;else if(q==="not"){h= +h[3];l=0;for(m=h.length;l=0}},ID:function(g,h){return g.nodeType===1&&g.getAttribute("id")===h},TAG:function(g,h){return h==="*"&&g.nodeType===1||g.nodeName.toLowerCase()===h},CLASS:function(g,h){return(" "+(g.className||g.getAttribute("class"))+" ").indexOf(h)>-1},ATTR:function(g,h){var l=h[1];g=n.attrHandle[l]?n.attrHandle[l](g):g[l]!=null?g[l]:g.getAttribute(l);l=g+"";var m=h[2];h=h[4];return g==null?m==="!=":m=== +"="?l===h:m==="*="?l.indexOf(h)>=0:m==="~="?(" "+l+" ").indexOf(h)>=0:!h?l&&g!==false:m==="!="?l!==h:m==="^="?l.indexOf(h)===0:m==="$="?l.substr(l.length-h.length)===h:m==="|="?l===h||l.substr(0,h.length+1)===h+"-":false},POS:function(g,h,l,m){var q=n.setFilters[h[2]];if(q)return q(g,l,h,m)}}},r=n.match.POS;for(var u in n.match){n.match[u]=new RegExp(n.match[u].source+/(?![^\[]*\])(?![^\(]*\))/.source);n.leftMatch[u]=new RegExp(/(^(?:.|\r|\n)*?)/.source+n.match[u].source.replace(/\\(\d+)/g,function(g, +h){return"\\"+(h-0+1)}))}var z=function(g,h){g=Array.prototype.slice.call(g,0);if(h){h.push.apply(h,g);return h}return g};try{Array.prototype.slice.call(s.documentElement.childNodes,0)}catch(C){z=function(g,h){h=h||[];if(j.call(g)==="[object Array]")Array.prototype.push.apply(h,g);else if(typeof g.length==="number")for(var l=0,m=g.length;l";var l=s.documentElement;l.insertBefore(g,l.firstChild);if(s.getElementById(h)){n.find.ID=function(m,q,p){if(typeof q.getElementById!=="undefined"&&!p)return(q=q.getElementById(m[1]))?q.id===m[1]||typeof q.getAttributeNode!=="undefined"&& +q.getAttributeNode("id").nodeValue===m[1]?[q]:w:[]};n.filter.ID=function(m,q){var p=typeof m.getAttributeNode!=="undefined"&&m.getAttributeNode("id");return m.nodeType===1&&p&&p.nodeValue===q}}l.removeChild(g);l=g=null})();(function(){var g=s.createElement("div");g.appendChild(s.createComment(""));if(g.getElementsByTagName("*").length>0)n.find.TAG=function(h,l){l=l.getElementsByTagName(h[1]);if(h[1]==="*"){h=[];for(var m=0;l[m];m++)l[m].nodeType===1&&h.push(l[m]);l=h}return l};g.innerHTML=""; +if(g.firstChild&&typeof g.firstChild.getAttribute!=="undefined"&&g.firstChild.getAttribute("href")!=="#")n.attrHandle.href=function(h){return h.getAttribute("href",2)};g=null})();s.querySelectorAll&&function(){var g=k,h=s.createElement("div");h.innerHTML="

    ";if(!(h.querySelectorAll&&h.querySelectorAll(".TEST").length===0)){k=function(m,q,p,v){q=q||s;if(!v&&q.nodeType===9&&!x(q))try{return z(q.querySelectorAll(m),p)}catch(t){}return g(m,q,p,v)};for(var l in g)k[l]=g[l];h=null}}(); +(function(){var g=s.createElement("div");g.innerHTML="
    ";if(!(!g.getElementsByClassName||g.getElementsByClassName("e").length===0)){g.lastChild.className="e";if(g.getElementsByClassName("e").length!==1){n.order.splice(1,0,"CLASS");n.find.CLASS=function(h,l,m){if(typeof l.getElementsByClassName!=="undefined"&&!m)return l.getElementsByClassName(h[1])};g=null}}})();var E=s.compareDocumentPosition?function(g,h){return!!(g.compareDocumentPosition(h)&16)}: +function(g,h){return g!==h&&(g.contains?g.contains(h):true)},x=function(g){return(g=(g?g.ownerDocument||g:0).documentElement)?g.nodeName!=="HTML":false},ga=function(g,h){var l=[],m="",q;for(h=h.nodeType?[h]:h;q=n.match.PSEUDO.exec(g);){m+=q[0];g=g.replace(n.match.PSEUDO,"")}g=n.relative[g]?g+"*":g;q=0;for(var p=h.length;q=0===d})};c.fn.extend({find:function(a){for(var b=this.pushStack("","find",a),d=0,f=0,e=this.length;f0)for(var j=d;j0},closest:function(a,b){if(c.isArray(a)){var d=[],f=this[0],e,j= +{},i;if(f&&a.length){e=0;for(var o=a.length;e-1:c(f).is(e)){d.push({selector:i,elem:f});delete j[i]}}f=f.parentNode}}return d}var k=c.expr.match.POS.test(a)?c(a,b||this.context):null;return this.map(function(n,r){for(;r&&r.ownerDocument&&r!==b;){if(k?k.index(r)>-1:c(r).is(a))return r;r=r.parentNode}return null})},index:function(a){if(!a||typeof a=== +"string")return c.inArray(this[0],a?c(a):this.parent().children());return c.inArray(a.jquery?a[0]:a,this)},add:function(a,b){a=typeof a==="string"?c(a,b||this.context):c.makeArray(a);b=c.merge(this.get(),a);return this.pushStack(qa(a[0])||qa(b[0])?b:c.unique(b))},andSelf:function(){return this.add(this.prevObject)}});c.each({parent:function(a){return(a=a.parentNode)&&a.nodeType!==11?a:null},parents:function(a){return c.dir(a,"parentNode")},parentsUntil:function(a,b,d){return c.dir(a,"parentNode", +d)},next:function(a){return c.nth(a,2,"nextSibling")},prev:function(a){return c.nth(a,2,"previousSibling")},nextAll:function(a){return c.dir(a,"nextSibling")},prevAll:function(a){return c.dir(a,"previousSibling")},nextUntil:function(a,b,d){return c.dir(a,"nextSibling",d)},prevUntil:function(a,b,d){return c.dir(a,"previousSibling",d)},siblings:function(a){return c.sibling(a.parentNode.firstChild,a)},children:function(a){return c.sibling(a.firstChild)},contents:function(a){return c.nodeName(a,"iframe")? +a.contentDocument||a.contentWindow.document:c.makeArray(a.childNodes)}},function(a,b){c.fn[a]=function(d,f){var e=c.map(this,b,d);eb.test(a)||(f=d);if(f&&typeof f==="string")e=c.filter(f,e);e=this.length>1?c.unique(e):e;if((this.length>1||gb.test(f))&&fb.test(a))e=e.reverse();return this.pushStack(e,a,R.call(arguments).join(","))}});c.extend({filter:function(a,b,d){if(d)a=":not("+a+")";return c.find.matches(a,b)},dir:function(a,b,d){var f=[];for(a=a[b];a&&a.nodeType!==9&&(d===w||a.nodeType!==1||!c(a).is(d));){a.nodeType=== +1&&f.push(a);a=a[b]}return f},nth:function(a,b,d){b=b||1;for(var f=0;a;a=a[d])if(a.nodeType===1&&++f===b)break;return a},sibling:function(a,b){for(var d=[];a;a=a.nextSibling)a.nodeType===1&&a!==b&&d.push(a);return d}});var Ja=/ jQuery\d+="(?:\d+|null)"/g,V=/^\s+/,Ka=/(<([\w:]+)[^>]*?)\/>/g,hb=/^(?:area|br|col|embed|hr|img|input|link|meta|param)$/i,La=/<([\w:]+)/,ib=/"},F={option:[1,""],legend:[1,"
    ","
    "],thead:[1,"","
    "],tr:[2,"","
    "],td:[3,"","
    "],col:[2,"","
    "],area:[1,"",""],_default:[0,"",""]};F.optgroup=F.option;F.tbody=F.tfoot=F.colgroup=F.caption=F.thead;F.th=F.td;if(!c.support.htmlSerialize)F._default=[1,"div
    ","
    "];c.fn.extend({text:function(a){if(c.isFunction(a))return this.each(function(b){var d= +c(this);d.text(a.call(this,b,d.text()))});if(typeof a!=="object"&&a!==w)return this.empty().append((this[0]&&this[0].ownerDocument||s).createTextNode(a));return c.text(this)},wrapAll:function(a){if(c.isFunction(a))return this.each(function(d){c(this).wrapAll(a.call(this,d))});if(this[0]){var b=c(a,this[0].ownerDocument).eq(0).clone(true);this[0].parentNode&&b.insertBefore(this[0]);b.map(function(){for(var d=this;d.firstChild&&d.firstChild.nodeType===1;)d=d.firstChild;return d}).append(this)}return this}, +wrapInner:function(a){if(c.isFunction(a))return this.each(function(b){c(this).wrapInner(a.call(this,b))});return this.each(function(){var b=c(this),d=b.contents();d.length?d.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){c(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){c.nodeName(this,"body")||c(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.appendChild(a)})}, +prepend:function(){return this.domManip(arguments,true,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b,this)});else if(arguments.length){var a=c(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,false,function(b){this.parentNode.insertBefore(b, +this.nextSibling)});else if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,c(arguments[0]).toArray());return a}},remove:function(a,b){for(var d=0,f;(f=this[d])!=null;d++)if(!a||c.filter(a,[f]).length){if(!b&&f.nodeType===1){c.cleanData(f.getElementsByTagName("*"));c.cleanData([f])}f.parentNode&&f.parentNode.removeChild(f)}return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++)for(b.nodeType===1&&c.cleanData(b.getElementsByTagName("*"));b.firstChild;)b.removeChild(b.firstChild); +return this},clone:function(a){var b=this.map(function(){if(!c.support.noCloneEvent&&!c.isXMLDoc(this)){var d=this.outerHTML,f=this.ownerDocument;if(!d){d=f.createElement("div");d.appendChild(this.cloneNode(true));d=d.innerHTML}return c.clean([d.replace(Ja,"").replace(/=([^="'>\s]+\/)>/g,'="$1">').replace(V,"")],f)[0]}else return this.cloneNode(true)});if(a===true){ra(this,b);ra(this.find("*"),b.find("*"))}return b},html:function(a){if(a===w)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(Ja, +""):null;else if(typeof a==="string"&&!ta.test(a)&&(c.support.leadingWhitespace||!V.test(a))&&!F[(La.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Ka,Ma);try{for(var b=0,d=this.length;b0||e.cacheable||this.length>1?k.cloneNode(true):k)}o.length&&c.each(o,Qa)}return this}});c.fragments={};c.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){c.fn[a]=function(d){var f=[];d=c(d);var e=this.length===1&&this[0].parentNode;if(e&&e.nodeType===11&&e.childNodes.length===1&&d.length===1){d[b](this[0]); +return this}else{e=0;for(var j=d.length;e0?this.clone(true):this).get();c.fn[b].apply(c(d[e]),i);f=f.concat(i)}return this.pushStack(f,a,d.selector)}}});c.extend({clean:function(a,b,d,f){b=b||s;if(typeof b.createElement==="undefined")b=b.ownerDocument||b[0]&&b[0].ownerDocument||s;for(var e=[],j=0,i;(i=a[j])!=null;j++){if(typeof i==="number")i+="";if(i){if(typeof i==="string"&&!jb.test(i))i=b.createTextNode(i);else if(typeof i==="string"){i=i.replace(Ka,Ma);var o=(La.exec(i)||["", +""])[1].toLowerCase(),k=F[o]||F._default,n=k[0],r=b.createElement("div");for(r.innerHTML=k[1]+i+k[2];n--;)r=r.lastChild;if(!c.support.tbody){n=ib.test(i);o=o==="table"&&!n?r.firstChild&&r.firstChild.childNodes:k[1]===""&&!n?r.childNodes:[];for(k=o.length-1;k>=0;--k)c.nodeName(o[k],"tbody")&&!o[k].childNodes.length&&o[k].parentNode.removeChild(o[k])}!c.support.leadingWhitespace&&V.test(i)&&r.insertBefore(b.createTextNode(V.exec(i)[0]),r.firstChild);i=r.childNodes}if(i.nodeType)e.push(i);else e= +c.merge(e,i)}}if(d)for(j=0;e[j];j++)if(f&&c.nodeName(e[j],"script")&&(!e[j].type||e[j].type.toLowerCase()==="text/javascript"))f.push(e[j].parentNode?e[j].parentNode.removeChild(e[j]):e[j]);else{e[j].nodeType===1&&e.splice.apply(e,[j+1,0].concat(c.makeArray(e[j].getElementsByTagName("script"))));d.appendChild(e[j])}return e},cleanData:function(a){for(var b,d,f=c.cache,e=c.event.special,j=c.support.deleteExpando,i=0,o;(o=a[i])!=null;i++)if(d=o[c.expando]){b=f[d];if(b.events)for(var k in b.events)e[k]? +c.event.remove(o,k):Ca(o,k,b.handle);if(j)delete o[c.expando];else o.removeAttribute&&o.removeAttribute(c.expando);delete f[d]}}});var kb=/z-?index|font-?weight|opacity|zoom|line-?height/i,Na=/alpha\([^)]*\)/,Oa=/opacity=([^)]*)/,ha=/float/i,ia=/-([a-z])/ig,lb=/([A-Z])/g,mb=/^-?\d+(?:px)?$/i,nb=/^-?\d/,ob={position:"absolute",visibility:"hidden",display:"block"},pb=["Left","Right"],qb=["Top","Bottom"],rb=s.defaultView&&s.defaultView.getComputedStyle,Pa=c.support.cssFloat?"cssFloat":"styleFloat",ja= +function(a,b){return b.toUpperCase()};c.fn.css=function(a,b){return X(this,a,b,true,function(d,f,e){if(e===w)return c.curCSS(d,f);if(typeof e==="number"&&!kb.test(f))e+="px";c.style(d,f,e)})};c.extend({style:function(a,b,d){if(!a||a.nodeType===3||a.nodeType===8)return w;if((b==="width"||b==="height")&&parseFloat(d)<0)d=w;var f=a.style||a,e=d!==w;if(!c.support.opacity&&b==="opacity"){if(e){f.zoom=1;b=parseInt(d,10)+""==="NaN"?"":"alpha(opacity="+d*100+")";a=f.filter||c.curCSS(a,"filter")||"";f.filter= +Na.test(a)?a.replace(Na,b):b}return f.filter&&f.filter.indexOf("opacity=")>=0?parseFloat(Oa.exec(f.filter)[1])/100+"":""}if(ha.test(b))b=Pa;b=b.replace(ia,ja);if(e)f[b]=d;return f[b]},css:function(a,b,d,f){if(b==="width"||b==="height"){var e,j=b==="width"?pb:qb;function i(){e=b==="width"?a.offsetWidth:a.offsetHeight;f!=="border"&&c.each(j,function(){f||(e-=parseFloat(c.curCSS(a,"padding"+this,true))||0);if(f==="margin")e+=parseFloat(c.curCSS(a,"margin"+this,true))||0;else e-=parseFloat(c.curCSS(a, +"border"+this+"Width",true))||0})}a.offsetWidth!==0?i():c.swap(a,ob,i);return Math.max(0,Math.round(e))}return c.curCSS(a,b,d)},curCSS:function(a,b,d){var f,e=a.style;if(!c.support.opacity&&b==="opacity"&&a.currentStyle){f=Oa.test(a.currentStyle.filter||"")?parseFloat(RegExp.$1)/100+"":"";return f===""?"1":f}if(ha.test(b))b=Pa;if(!d&&e&&e[b])f=e[b];else if(rb){if(ha.test(b))b="float";b=b.replace(lb,"-$1").toLowerCase();e=a.ownerDocument.defaultView;if(!e)return null;if(a=e.getComputedStyle(a,null))f= +a.getPropertyValue(b);if(b==="opacity"&&f==="")f="1"}else if(a.currentStyle){d=b.replace(ia,ja);f=a.currentStyle[b]||a.currentStyle[d];if(!mb.test(f)&&nb.test(f)){b=e.left;var j=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;e.left=d==="fontSize"?"1em":f||0;f=e.pixelLeft+"px";e.left=b;a.runtimeStyle.left=j}}return f},swap:function(a,b,d){var f={};for(var e in b){f[e]=a.style[e];a.style[e]=b[e]}d.call(a);for(e in b)a.style[e]=f[e]}});if(c.expr&&c.expr.filters){c.expr.filters.hidden=function(a){var b= +a.offsetWidth,d=a.offsetHeight,f=a.nodeName.toLowerCase()==="tr";return b===0&&d===0&&!f?true:b>0&&d>0&&!f?false:c.curCSS(a,"display")==="none"};c.expr.filters.visible=function(a){return!c.expr.filters.hidden(a)}}var sb=J(),tb=//gi,ub=/select|textarea/i,vb=/color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week/i,N=/=\?(&|$)/,ka=/\?/,wb=/(\?|&)_=.*?(&|$)/,xb=/^(\w+:)?\/\/([^\/?#]+)/,yb=/%20/g,zb=c.fn.load;c.fn.extend({load:function(a,b,d){if(typeof a!== +"string")return zb.call(this,a);else if(!this.length)return this;var f=a.indexOf(" ");if(f>=0){var e=a.slice(f,a.length);a=a.slice(0,f)}f="GET";if(b)if(c.isFunction(b)){d=b;b=null}else if(typeof b==="object"){b=c.param(b,c.ajaxSettings.traditional);f="POST"}var j=this;c.ajax({url:a,type:f,dataType:"html",data:b,complete:function(i,o){if(o==="success"||o==="notmodified")j.html(e?c("
    ").append(i.responseText.replace(tb,"")).find(e):i.responseText);d&&j.each(d,[i.responseText,o,i])}});return this}, +serialize:function(){return c.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?c.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||ub.test(this.nodeName)||vb.test(this.type))}).map(function(a,b){a=c(this).val();return a==null?null:c.isArray(a)?c.map(a,function(d){return{name:b.name,value:d}}):{name:b.name,value:a}}).get()}});c.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), +function(a,b){c.fn[b]=function(d){return this.bind(b,d)}});c.extend({get:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b=null}return c.ajax({type:"GET",url:a,data:b,success:d,dataType:f})},getScript:function(a,b){return c.get(a,null,b,"script")},getJSON:function(a,b,d){return c.get(a,b,d,"json")},post:function(a,b,d,f){if(c.isFunction(b)){f=f||d;d=b;b={}}return c.ajax({type:"POST",url:a,data:b,success:d,dataType:f})},ajaxSetup:function(a){c.extend(c.ajaxSettings,a)},ajaxSettings:{url:location.href, +global:true,type:"GET",contentType:"application/x-www-form-urlencoded",processData:true,async:true,xhr:A.XMLHttpRequest&&(A.location.protocol!=="file:"||!A.ActiveXObject)?function(){return new A.XMLHttpRequest}:function(){try{return new A.ActiveXObject("Microsoft.XMLHTTP")}catch(a){}},accepts:{xml:"application/xml, text/xml",html:"text/html",script:"text/javascript, application/javascript",json:"application/json, text/javascript",text:"text/plain",_default:"*/*"}},lastModified:{},etag:{},ajax:function(a){function b(){e.success&& +e.success.call(k,o,i,x);e.global&&f("ajaxSuccess",[x,e])}function d(){e.complete&&e.complete.call(k,x,i);e.global&&f("ajaxComplete",[x,e]);e.global&&!--c.active&&c.event.trigger("ajaxStop")}function f(q,p){(e.context?c(e.context):c.event).trigger(q,p)}var e=c.extend(true,{},c.ajaxSettings,a),j,i,o,k=a&&a.context||e,n=e.type.toUpperCase();if(e.data&&e.processData&&typeof e.data!=="string")e.data=c.param(e.data,e.traditional);if(e.dataType==="jsonp"){if(n==="GET")N.test(e.url)||(e.url+=(ka.test(e.url)? +"&":"?")+(e.jsonp||"callback")+"=?");else if(!e.data||!N.test(e.data))e.data=(e.data?e.data+"&":"")+(e.jsonp||"callback")+"=?";e.dataType="json"}if(e.dataType==="json"&&(e.data&&N.test(e.data)||N.test(e.url))){j=e.jsonpCallback||"jsonp"+sb++;if(e.data)e.data=(e.data+"").replace(N,"="+j+"$1");e.url=e.url.replace(N,"="+j+"$1");e.dataType="script";A[j]=A[j]||function(q){o=q;b();d();A[j]=w;try{delete A[j]}catch(p){}z&&z.removeChild(C)}}if(e.dataType==="script"&&e.cache===null)e.cache=false;if(e.cache=== +false&&n==="GET"){var r=J(),u=e.url.replace(wb,"$1_="+r+"$2");e.url=u+(u===e.url?(ka.test(e.url)?"&":"?")+"_="+r:"")}if(e.data&&n==="GET")e.url+=(ka.test(e.url)?"&":"?")+e.data;e.global&&!c.active++&&c.event.trigger("ajaxStart");r=(r=xb.exec(e.url))&&(r[1]&&r[1]!==location.protocol||r[2]!==location.host);if(e.dataType==="script"&&n==="GET"&&r){var z=s.getElementsByTagName("head")[0]||s.documentElement,C=s.createElement("script");C.src=e.url;if(e.scriptCharset)C.charset=e.scriptCharset;if(!j){var B= +false;C.onload=C.onreadystatechange=function(){if(!B&&(!this.readyState||this.readyState==="loaded"||this.readyState==="complete")){B=true;b();d();C.onload=C.onreadystatechange=null;z&&C.parentNode&&z.removeChild(C)}}}z.insertBefore(C,z.firstChild);return w}var E=false,x=e.xhr();if(x){e.username?x.open(n,e.url,e.async,e.username,e.password):x.open(n,e.url,e.async);try{if(e.data||a&&a.contentType)x.setRequestHeader("Content-Type",e.contentType);if(e.ifModified){c.lastModified[e.url]&&x.setRequestHeader("If-Modified-Since", +c.lastModified[e.url]);c.etag[e.url]&&x.setRequestHeader("If-None-Match",c.etag[e.url])}r||x.setRequestHeader("X-Requested-With","XMLHttpRequest");x.setRequestHeader("Accept",e.dataType&&e.accepts[e.dataType]?e.accepts[e.dataType]+", */*":e.accepts._default)}catch(ga){}if(e.beforeSend&&e.beforeSend.call(k,x,e)===false){e.global&&!--c.active&&c.event.trigger("ajaxStop");x.abort();return false}e.global&&f("ajaxSend",[x,e]);var g=x.onreadystatechange=function(q){if(!x||x.readyState===0||q==="abort"){E|| +d();E=true;if(x)x.onreadystatechange=c.noop}else if(!E&&x&&(x.readyState===4||q==="timeout")){E=true;x.onreadystatechange=c.noop;i=q==="timeout"?"timeout":!c.httpSuccess(x)?"error":e.ifModified&&c.httpNotModified(x,e.url)?"notmodified":"success";var p;if(i==="success")try{o=c.httpData(x,e.dataType,e)}catch(v){i="parsererror";p=v}if(i==="success"||i==="notmodified")j||b();else c.handleError(e,x,i,p);d();q==="timeout"&&x.abort();if(e.async)x=null}};try{var h=x.abort;x.abort=function(){x&&h.call(x); +g("abort")}}catch(l){}e.async&&e.timeout>0&&setTimeout(function(){x&&!E&&g("timeout")},e.timeout);try{x.send(n==="POST"||n==="PUT"||n==="DELETE"?e.data:null)}catch(m){c.handleError(e,x,null,m);d()}e.async||g();return x}},handleError:function(a,b,d,f){if(a.error)a.error.call(a.context||a,b,d,f);if(a.global)(a.context?c(a.context):c.event).trigger("ajaxError",[b,a,f])},active:0,httpSuccess:function(a){try{return!a.status&&location.protocol==="file:"||a.status>=200&&a.status<300||a.status===304||a.status=== +1223||a.status===0}catch(b){}return false},httpNotModified:function(a,b){var d=a.getResponseHeader("Last-Modified"),f=a.getResponseHeader("Etag");if(d)c.lastModified[b]=d;if(f)c.etag[b]=f;return a.status===304||a.status===0},httpData:function(a,b,d){var f=a.getResponseHeader("content-type")||"",e=b==="xml"||!b&&f.indexOf("xml")>=0;a=e?a.responseXML:a.responseText;e&&a.documentElement.nodeName==="parsererror"&&c.error("parsererror");if(d&&d.dataFilter)a=d.dataFilter(a,b);if(typeof a==="string")if(b=== +"json"||!b&&f.indexOf("json")>=0)a=c.parseJSON(a);else if(b==="script"||!b&&f.indexOf("javascript")>=0)c.globalEval(a);return a},param:function(a,b){function d(i,o){if(c.isArray(o))c.each(o,function(k,n){b||/\[\]$/.test(i)?f(i,n):d(i+"["+(typeof n==="object"||c.isArray(n)?k:"")+"]",n)});else!b&&o!=null&&typeof o==="object"?c.each(o,function(k,n){d(i+"["+k+"]",n)}):f(i,o)}function f(i,o){o=c.isFunction(o)?o():o;e[e.length]=encodeURIComponent(i)+"="+encodeURIComponent(o)}var e=[];if(b===w)b=c.ajaxSettings.traditional; +if(c.isArray(a)||a.jquery)c.each(a,function(){f(this.name,this.value)});else for(var j in a)d(j,a[j]);return e.join("&").replace(yb,"+")}});var la={},Ab=/toggle|show|hide/,Bb=/^([+-]=)?([\d+-.]+)(.*)$/,W,va=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]];c.fn.extend({show:function(a,b){if(a||a===0)return this.animate(K("show",3),a,b);else{a=0;for(b=this.length;a").appendTo("body");f=e.css("display");if(f==="none")f="block";e.remove();la[d]=f}c.data(this[a],"olddisplay",f)}}a=0;for(b=this.length;a=0;f--)if(d[f].elem===this){b&&d[f](true);d.splice(f,1)}});b||this.dequeue();return this}});c.each({slideDown:K("show",1),slideUp:K("hide",1),slideToggle:K("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"}},function(a,b){c.fn[a]=function(d,f){return this.animate(b,d,f)}});c.extend({speed:function(a,b,d){var f=a&&typeof a==="object"?a:{complete:d||!d&&b||c.isFunction(a)&&a,duration:a,easing:d&&b||b&&!c.isFunction(b)&&b};f.duration=c.fx.off?0:typeof f.duration=== +"number"?f.duration:c.fx.speeds[f.duration]||c.fx.speeds._default;f.old=f.complete;f.complete=function(){f.queue!==false&&c(this).dequeue();c.isFunction(f.old)&&f.old.call(this)};return f},easing:{linear:function(a,b,d,f){return d+f*a},swing:function(a,b,d,f){return(-Math.cos(a*Math.PI)/2+0.5)*f+d}},timers:[],fx:function(a,b,d){this.options=b;this.elem=a;this.prop=d;if(!b.orig)b.orig={}}});c.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this);(c.fx.step[this.prop]|| +c.fx.step._default)(this);if((this.prop==="height"||this.prop==="width")&&this.elem.style)this.elem.style.display="block"},cur:function(a){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];return(a=parseFloat(c.css(this.elem,this.prop,a)))&&a>-10000?a:parseFloat(c.curCSS(this.elem,this.prop))||0},custom:function(a,b,d){function f(j){return e.step(j)}this.startTime=J();this.start=a;this.end=b;this.unit=d||this.unit||"px";this.now=this.start; +this.pos=this.state=0;var e=this;f.elem=this.elem;if(f()&&c.timers.push(f)&&!W)W=setInterval(c.fx.tick,13)},show:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.show=true;this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur());c(this.elem).show()},hide:function(){this.options.orig[this.prop]=c.style(this.elem,this.prop);this.options.hide=true;this.custom(this.cur(),0)},step:function(a){var b=J(),d=true;if(a||b>=this.options.duration+this.startTime){this.now= +this.end;this.pos=this.state=1;this.update();this.options.curAnim[this.prop]=true;for(var f in this.options.curAnim)if(this.options.curAnim[f]!==true)d=false;if(d){if(this.options.display!=null){this.elem.style.overflow=this.options.overflow;a=c.data(this.elem,"olddisplay");this.elem.style.display=a?a:this.options.display;if(c.css(this.elem,"display")==="none")this.elem.style.display="block"}this.options.hide&&c(this.elem).hide();if(this.options.hide||this.options.show)for(var e in this.options.curAnim)c.style(this.elem, +e,this.options.orig[e]);this.options.complete.call(this.elem)}return false}else{e=b-this.startTime;this.state=e/this.options.duration;a=this.options.easing||(c.easing.swing?"swing":"linear");this.pos=c.easing[this.options.specialEasing&&this.options.specialEasing[this.prop]||a](this.state,e,0,1,this.options.duration);this.now=this.start+(this.end-this.start)*this.pos;this.update()}return true}};c.extend(c.fx,{tick:function(){for(var a=c.timers,b=0;b
    "; +a.insertBefore(b,a.firstChild);d=b.firstChild;f=d.firstChild;e=d.nextSibling.firstChild.firstChild;this.doesNotAddBorder=f.offsetTop!==5;this.doesAddBorderForTableAndCells=e.offsetTop===5;f.style.position="fixed";f.style.top="20px";this.supportsFixedPosition=f.offsetTop===20||f.offsetTop===15;f.style.position=f.style.top="";d.style.overflow="hidden";d.style.position="relative";this.subtractsBorderForOverflowNotVisible=f.offsetTop===-5;this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==j;a.removeChild(b); +c.offset.initialize=c.noop},bodyOffset:function(a){var b=a.offsetTop,d=a.offsetLeft;c.offset.initialize();if(c.offset.doesNotIncludeMarginInBodyOffset){b+=parseFloat(c.curCSS(a,"marginTop",true))||0;d+=parseFloat(c.curCSS(a,"marginLeft",true))||0}return{top:b,left:d}},setOffset:function(a,b,d){if(/static/.test(c.curCSS(a,"position")))a.style.position="relative";var f=c(a),e=f.offset(),j=parseInt(c.curCSS(a,"top",true),10)||0,i=parseInt(c.curCSS(a,"left",true),10)||0;if(c.isFunction(b))b=b.call(a, +d,e);d={top:b.top-e.top+j,left:b.left-e.left+i};"using"in b?b.using.call(a,d):f.css(d)}};c.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),d=this.offset(),f=/^body|html$/i.test(b[0].nodeName)?{top:0,left:0}:b.offset();d.top-=parseFloat(c.curCSS(a,"marginTop",true))||0;d.left-=parseFloat(c.curCSS(a,"marginLeft",true))||0;f.top+=parseFloat(c.curCSS(b[0],"borderTopWidth",true))||0;f.left+=parseFloat(c.curCSS(b[0],"borderLeftWidth",true))||0;return{top:d.top- +f.top,left:d.left-f.left}},offsetParent:function(){return this.map(function(){for(var a=this.offsetParent||s.body;a&&!/^body|html$/i.test(a.nodeName)&&c.css(a,"position")==="static";)a=a.offsetParent;return a})}});c.each(["Left","Top"],function(a,b){var d="scroll"+b;c.fn[d]=function(f){var e=this[0],j;if(!e)return null;if(f!==w)return this.each(function(){if(j=wa(this))j.scrollTo(!a?f:c(j).scrollLeft(),a?f:c(j).scrollTop());else this[d]=f});else return(j=wa(e))?"pageXOffset"in j?j[a?"pageYOffset": +"pageXOffset"]:c.support.boxModel&&j.document.documentElement[d]||j.document.body[d]:e[d]}});c.each(["Height","Width"],function(a,b){var d=b.toLowerCase();c.fn["inner"+b]=function(){return this[0]?c.css(this[0],d,false,"padding"):null};c.fn["outer"+b]=function(f){return this[0]?c.css(this[0],d,false,f?"margin":"border"):null};c.fn[d]=function(f){var e=this[0];if(!e)return f==null?null:this;if(c.isFunction(f))return this.each(function(j){var i=c(this);i[d](f.call(this,j,i[d]()))});return"scrollTo"in +e&&e.document?e.document.compatMode==="CSS1Compat"&&e.document.documentElement["client"+b]||e.document.body["client"+b]:e.nodeType===9?Math.max(e.documentElement["client"+b],e.body["scroll"+b],e.documentElement["scroll"+b],e.body["offset"+b],e.documentElement["offset"+b]):f===w?c.css(e,d):this.css(d,typeof f==="string"?f:f+"px")}});A.jQuery=A.$=c})(window); + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/jquery.dataTables.min.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/jquery.dataTables.min.js new file mode 100644 index 000000000..b5ee8585d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/jquery.dataTables.min.js @@ -0,0 +1,152 @@ +/* + * File: jquery.dataTables.min.js + * Version: 1.7.0 + * Author: Allan Jardine (www.sprymedia.co.uk) + * Info: www.datatables.net + * + * Copyright 2008-2010 Allan Jardine, all rights reserved. + * + * This source file is free software, under either the GPL v2 license or a + * BSD style license, as supplied with this software. + * + * This source file is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY + * or FITNESS FOR A PARTICULAR PURPOSE. See the license files for details. + */ +(function(j,Y,p){j.fn.dataTableSettings=[];var E=j.fn.dataTableSettings;j.fn.dataTableExt={};var m=j.fn.dataTableExt;m.sVersion="1.7.0";m.sErrMode="alert";m.iApiIndex=0;m.oApi={};m.afnFiltering=[];m.aoFeatures=[];m.ofnSearch={};m.afnSortData=[];m.oStdClasses={sPagePrevEnabled:"paginate_enabled_previous",sPagePrevDisabled:"paginate_disabled_previous",sPageNextEnabled:"paginate_enabled_next",sPageNextDisabled:"paginate_disabled_next",sPageJUINext:"",sPageJUIPrev:"",sPageButton:"paginate_button",sPageButtonActive:"paginate_active", +sPageButtonStaticDisabled:"paginate_button",sPageFirst:"first",sPagePrevious:"previous",sPageNext:"next",sPageLast:"last",sStripOdd:"odd",sStripEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"sorting_asc",sSortDesc:"sorting_desc",sSortable:"sorting",sSortableAsc:"sorting_asc_disabled",sSortableDesc:"sorting_desc_disabled", +sSortableNone:"sorting_disabled",sSortColumn:"sorting_",sSortJUIAsc:"",sSortJUIDesc:"",sSortJUI:"",sSortJUIAscAllowed:"",sSortJUIDescAllowed:"",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot",sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:""};m.oJUIClasses={sPagePrevEnabled:"fg-button ui-state-default ui-corner-left",sPagePrevDisabled:"fg-button ui-state-default ui-corner-left ui-state-disabled", +sPageNextEnabled:"fg-button ui-state-default ui-corner-right",sPageNextDisabled:"fg-button ui-state-default ui-corner-right ui-state-disabled",sPageJUINext:"ui-icon ui-icon-circle-arrow-e",sPageJUIPrev:"ui-icon ui-icon-circle-arrow-w",sPageButton:"fg-button ui-state-default",sPageButtonActive:"fg-button ui-state-default ui-state-disabled",sPageButtonStaticDisabled:"fg-button ui-state-default ui-state-disabled",sPageFirst:"first ui-corner-tl ui-corner-bl",sPagePrevious:"previous",sPageNext:"next", +sPageLast:"last ui-corner-tr ui-corner-br",sStripOdd:"odd",sStripEven:"even",sRowEmpty:"dataTables_empty",sWrapper:"dataTables_wrapper",sFilter:"dataTables_filter",sInfo:"dataTables_info",sPaging:"dataTables_paginate fg-buttonset fg-buttonset-multi paging_",sLength:"dataTables_length",sProcessing:"dataTables_processing",sSortAsc:"ui-state-default",sSortDesc:"ui-state-default",sSortable:"ui-state-default",sSortableAsc:"ui-state-default",sSortableDesc:"ui-state-default",sSortableNone:"ui-state-default", +sSortColumn:"sorting_",sSortJUIAsc:"css_right ui-icon ui-icon-triangle-1-n",sSortJUIDesc:"css_right ui-icon ui-icon-triangle-1-s",sSortJUI:"css_right ui-icon ui-icon-carat-2-n-s",sSortJUIAscAllowed:"css_right ui-icon ui-icon-carat-1-n",sSortJUIDescAllowed:"css_right ui-icon ui-icon-carat-1-s",sScrollWrapper:"dataTables_scroll",sScrollHead:"dataTables_scrollHead ui-state-default",sScrollHeadInner:"dataTables_scrollHeadInner",sScrollBody:"dataTables_scrollBody",sScrollFoot:"dataTables_scrollFoot ui-state-default", +sScrollFootInner:"dataTables_scrollFootInner",sFooterTH:"ui-state-default"};m.oPagination={two_button:{fnInit:function(g,l,q){var r,u,y;if(g.bJUI){r=p.createElement("a");u=p.createElement("a");y=p.createElement("span");y.className=g.oClasses.sPageJUINext;u.appendChild(y);y=p.createElement("span");y.className=g.oClasses.sPageJUIPrev;r.appendChild(y)}else{r=p.createElement("div");u=p.createElement("div")}r.className=g.oClasses.sPagePrevDisabled;u.className=g.oClasses.sPageNextDisabled;r.title=g.oLanguage.oPaginate.sPrevious; +u.title=g.oLanguage.oPaginate.sNext;l.appendChild(r);l.appendChild(u);j(r).click(function(){g.oApi._fnPageChange(g,"previous")&&q(g)});j(u).click(function(){g.oApi._fnPageChange(g,"next")&&q(g)});j(r).bind("selectstart",function(){return false});j(u).bind("selectstart",function(){return false});if(g.sTableId!==""&&typeof g.aanFeatures.p=="undefined"){l.setAttribute("id",g.sTableId+"_paginate");r.setAttribute("id",g.sTableId+"_previous");u.setAttribute("id",g.sTableId+"_next")}},fnUpdate:function(g){if(g.aanFeatures.p)for(var l= +g.aanFeatures.p,q=0,r=l.length;q=u-r){r=u-q+1;w=u}else{r=y-Math.ceil(q/2)+1;w=r+q-1}for(q=r;q<=w;q++)C+=y!=q?''+q+"":''+q+"";w=g.aanFeatures.p;var z,D=function(){g._iDisplayStart= +(this.innerHTML*1-1)*g._iDisplayLength;l(g);return false},L=function(){return false};q=0;for(r=w.length;ql?1:0},"string-desc":function(g,l){g=g.toLowerCase();l=l.toLowerCase();return gl?-1:0},"html-asc":function(g,l){g=g.replace(/<.*?>/g,"").toLowerCase(); +l=l.replace(/<.*?>/g,"").toLowerCase();return gl?1:0},"html-desc":function(g,l){g=g.replace(/<.*?>/g,"").toLowerCase();l=l.replace(/<.*?>/g,"").toLowerCase();return gl?-1:0},"date-asc":function(g,l){g=Date.parse(g);l=Date.parse(l);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(l)||l==="")l=Date.parse("01/01/1970 00:00:00");return g-l},"date-desc":function(g,l){g=Date.parse(g);l=Date.parse(l);if(isNaN(g)||g==="")g=Date.parse("01/01/1970 00:00:00");if(isNaN(l)||l=== +"")l=Date.parse("01/01/1970 00:00:00");return l-g},"numeric-asc":function(g,l){return(g=="-"||g===""?0:g*1)-(l=="-"||l===""?0:l*1)},"numeric-desc":function(g,l){return(l=="-"||l===""?0:l*1)-(g=="-"||g===""?0:g*1)}};m.aTypes=[function(g){if(g.length===0)return"numeric";var l,q=false;l=g.charAt(0);if("0123456789-".indexOf(l)==-1)return null;for(var r=1;r")!=-1)return"html";return null}];m.fnVersionCheck=function(g){var l=function(w,x){for(;w.length=parseInt(u,10)};m._oExternConfig={iNextUnique:0};j.fn.dataTable=function(g){function l(){this.fnRecordsTotal=function(){return this.oFeatures.bServerSide? +this._iRecordsTotal:this.aiDisplayMaster.length};this.fnRecordsDisplay=function(){return this.oFeatures.bServerSide?this._iRecordsDisplay:this.aiDisplay.length};this.fnDisplayEnd=function(){return this.oFeatures.bServerSide?this.oFeatures.bPaginate===false?this._iDisplayStart+this.aiDisplay.length:Math.min(this._iDisplayStart+this._iDisplayLength,this._iDisplayStart+this.aiDisplay.length):this._iDisplayEnd};this.sInstance=this.oInstance=null;this.oFeatures={bPaginate:true,bLengthChange:true,bFilter:true, +bSort:true,bInfo:true,bAutoWidth:true,bProcessing:false,bSortClasses:true,bStateSave:false,bServerSide:false};this.oScroll={sX:"",sXInner:"",sY:"",bCollapse:false,iBarWidth:0};this.aanFeatures=[];this.oLanguage={sProcessing:"Processing...",sLengthMenu:"Show _MENU_ entries",sZeroRecords:"No matching records found",sEmptyTable:"No data available in table",sInfo:"Showing _START_ to _END_ of _TOTAL_ entries",sInfoEmpty:"Showing 0 to 0 of 0 entries",sInfoFiltered:"(filtered from _MAX_ total entries)", +sInfoPostFix:"",sSearch:"Search:",sUrl:"",oPaginate:{sFirst:"First",sPrevious:"Previous",sNext:"Next",sLast:"Last"}};this.aoData=[];this.aiDisplay=[];this.aiDisplayMaster=[];this.aoColumns=[];this.iNextId=0;this.asDataSearch=[];this.oPreviousSearch={sSearch:"",bRegex:false,bSmart:true};this.aoPreSearchCols=[];this.aaSorting=[[0,"asc",0]];this.aaSortingFixed=null;this.asStripClasses=[];this.asDestoryStrips=[];this.fnFooterCallback=this.fnHeaderCallback=this.fnRowCallback=null;this.aoDrawCallback=[]; +this.fnInitComplete=null;this.sTableId="";this.nTableWrapper=this.nTBody=this.nTFoot=this.nTHead=this.nTable=null;this.iDefaultSortIndex=0;this.bInitialised=false;this.aoOpenRows=[];this.sDom="lfrtip";this.sPaginationType="two_button";this.iCookieDuration=7200;this.sCookiePrefix="SpryMedia_DataTables_";this.sAjaxSource=null;this.bAjaxDataGet=true;this.fnServerData=function(a,b,c){j.ajax({url:a,data:b,success:c,dataType:"json",cache:false,error:function(){alert("DataTables warning: JSON data from server failed to load or be parsed. This is most likely to be caused by a JSON formatting error.")}})}; +this.fnFormatNumber=function(a){if(a<1E3)return a;else{var b=a+"";a=b.split("");var c="";b=b.length;for(var d=0;d=a.fnRecordsDisplay()?0:a.iInitDisplayStart;a.iInitDisplayStart=-1;F(a)}if(!(a.oFeatures.bServerSide&&!oa(a))){if(a.aiDisplay.length!==0){var i=a._iDisplayStart,h=a._iDisplayEnd;if(a.oFeatures.bServerSide){i=0;h=a.aoData.length}for(i=i;itr",a.nTHead)[0],V(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);typeof a.fnFooterCallback=="function"&&a.fnFooterCallback.call(a.oInstance,j(">tr",a.nTFoot)[0],V(a),a._iDisplayStart,a.fnDisplayEnd(),a.aiDisplay);f= +p.createDocumentFragment();b=p.createDocumentFragment();if(a.nTBody){e=a.nTBody.parentNode;b.appendChild(a.nTBody);c=a.nTBody.childNodes;for(b=c.length-1;b>=0;b--)c[b].parentNode.removeChild(c[b]);b=0;for(c=d.length;bj(a.nTable.parentNode).width()&&U(a)}b=0;for(c=a.aoDrawCallback.length;b< +c;b++)a.aoDrawCallback[b].fn.call(a.oInstance,a);a.bSorted=false;a.bFiltered=false}}function L(a){if(a.oFeatures.bSort)O(a,a.oPreviousSearch);else if(a.oFeatures.bFilter)P(a,a.oPreviousSearch);else{F(a);D(a)}}function oa(a){if(a.bAjaxDataGet){K(a,true);var b=a.aoColumns.length,c=[],d;a.iDraw++;c.push({name:"sEcho",value:a.iDraw});c.push({name:"iColumns",value:b});c.push({name:"sColumns",value:aa(a)});c.push({name:"iDisplayStart",value:a._iDisplayStart});c.push({name:"iDisplayLength",value:a.oFeatures.bPaginate!== +false?a._iDisplayLength:-1});if(a.oFeatures.bFilter!==false){c.push({name:"sSearch",value:a.oPreviousSearch.sSearch});c.push({name:"bRegex",value:a.oPreviousSearch.bRegex});for(d=0;d")c=c.parentNode;else if(i=="l"&&a.oFeatures.bPaginate&&a.oFeatures.bLengthChange){f=ra(a);e=1}else if(i=="f"&&a.oFeatures.bFilter){f=sa(a);e=1}else if(i=="r"&&a.oFeatures.bProcessing){f=ta(a);e=1}else if(i=="t"){f=ua(a);e=1}else if(i=="i"&&a.oFeatures.bInfo){f=va(a);e=1}else if(i=="p"&&a.oFeatures.bPaginate){f=wa(a);e=1}else if(m.aoFeatures.length!==0){h=m.aoFeatures;k=0;for(o=h.length;kcaption",a.nTable);i=0;for(k=d.length;i0&&a.nTable.removeChild(i[0]);if(a.nTFoot!==null){k=a.nTable.getElementsByTagName("tfoot");k.length>0&&a.nTable.removeChild(k[0])}i= +a.nTHead.cloneNode(true);a.nTable.insertBefore(i,a.nTable.childNodes[0]);if(a.nTFoot!==null){k=a.nTFoot.cloneNode(true);a.nTable.insertBefore(k,a.nTable.childNodes[1])}var I=ca(i);f=0;for(e=I.length;ff-a.oScroll.iBarWidth)a.nTable.style.width=v(f)}else a.nTable.style.width=v(f);f=j(a.nTable).outerWidth();e=a.nTHead.getElementsByTagName("tr");i=i.getElementsByTagName("tr");M(function(A,G){o=A.style;o.paddingTop="0";o.paddingBottom="0";o.borderTopWidth="0";o.borderBottomWidth= +"0";o.height=0;s=j(A).width();G.style.width=v(s);H.push(s)},i,e);if(a.nTFoot!==null){h=k.getElementsByTagName("tr");k=a.nTFoot.getElementsByTagName("tr");M(function(A,G){o=A.style;o.paddingTop="0";o.paddingBottom="0";o.borderTopWidth="0";o.borderBottomWidth="0";s=j(A).width();G.style.width=v(s);H.push(s)},h,k)}M(function(A){A.innerHTML="";A.style.width=v(H.shift())},i);a.nTFoot!==null&&M(function(A){A.innerHTML="";A.style.width=v(H.shift())},h);if(j(a.nTable).outerWidth()d.offsetWidth?a.oScroll.iBarWidth:0;if(a.nTable.offsetHeight'; +var c=j("input",b);c.val(a.oPreviousSearch.sSearch.replace('"',"""));c.keyup(function(){for(var d=a.aanFeatures.f,f=0,e=d.length;f=0;d--){f=ga(a.aoData[a.aiDisplay[d]]._aData[c],a.aoColumns[c].sType);if(!b.test(f)){a.aiDisplay.splice(d, +1);e++}}}}function ya(a,b,c,d,f){var e=fa(b,d,f);if(typeof c=="undefined"||c===null)c=0;if(m.afnFiltering.length!==0)c=1;if(b.length<=0){a.aiDisplay.splice(0,a.aiDisplay.length);a.aiDisplay=a.aiDisplayMaster.slice()}else if(a.aiDisplay.length==a.aiDisplayMaster.length||a.oPreviousSearch.sSearch.length>b.length||c==1||b.indexOf(a.oPreviousSearch.sSearch)!==0){a.aiDisplay.splice(0,a.aiDisplay.length);Q(a,1);for(c=0;c/g,"");else if(typeof a=="string")return a.replace(/\n/g, +" ");return a}function O(a,b){var c=[],d=m.oSort,f=a.aoData,e,i,h,k;if(!a.oFeatures.bServerSide&&(a.aaSorting.length!==0||a.aaSortingFixed!==null)){c=a.aaSortingFixed!==null?a.aaSortingFixed.concat(a.aaSorting):a.aaSorting.slice();for(h=0;h0){e=a.aoColumns[c[c.length-1][0]].iDataSort;i=a.aoColumns[e].sType;k+="iTest = oSort['"+i+"-"+c[c.length-1][1]+"']( aoData[a]._aData["+e+"], aoData[b]._aData["+e+"] );if (iTest===0) return oSort['numeric-"+c[c.length-1][1]+"'](a, b); return iTest;}";eval(k);a.aiDisplayMaster.sort(this.ClosureDataTables.fn)}this.ClosureDataTables=undefined}}if(typeof b=="undefined"||b)W(a);a.bSorted=true;if(a.oFeatures.bFilter)P(a, +a.oPreviousSearch,1);else{a.aiDisplay=a.aiDisplayMaster.slice();a._iDisplayStart=0;F(a);D(a)}}function $(a,b,c,d){j(b).click(function(f){if(a.aoColumns[c].bSortable!==false){var e=function(){var i,h;if(f.shiftKey){for(var k=false,o=0;o=i)for(b=0;b=0?a._iDisplayStart-a._iDisplayLength:0;if(a._iDisplayStart<0)a._iDisplayStart=0}else if(b=="next")if(a._iDisplayLength>=0){if(a._iDisplayStart+a._iDisplayLength=0){b=parseInt((a.fnRecordsDisplay()-1)/a._iDisplayLength,10)+1;a._iDisplayStart=(b-1)*a._iDisplayLength}else a._iDisplayStart=0;else J(a,0,"Unknown paging action: "+b);return c!=a._iDisplayStart}function va(a){var b=p.createElement("div");b.className=a.oClasses.sInfo;if(typeof a.aanFeatures.i=="undefined"){a.aoDrawCallback.push({fn:Ca,sName:"information"});a.sTableId!==""&&b.setAttribute("id",a.sTableId+"_info")}return b} +function Ca(a){if(!(!a.oFeatures.bInfo||a.aanFeatures.i.length===0)){var b=j(a.aanFeatures.i[0]),c=a.fnFormatNumber(a.fnRecordsTotal()),d=a.fnFormatNumber(a._iDisplayStart+1),f=a.fnFormatNumber(a.fnDisplayEnd()),e=a.fnFormatNumber(a.fnRecordsDisplay());if(a.fnRecordsDisplay()===0&&a.fnRecordsDisplay()==a.fnRecordsTotal())b.html(a.oLanguage.sInfoEmpty+a.oLanguage.sInfoPostFix);else if(a.fnRecordsDisplay()===0)b.html(a.oLanguage.sInfoEmpty+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",c)+a.oLanguage.sInfoPostFix); +else a.fnRecordsDisplay()==a.fnRecordsTotal()?b.html(a.oLanguage.sInfo.replace("_START_",d).replace("_END_",f).replace("_TOTAL_",e)+a.oLanguage.sInfoPostFix):b.html(a.oLanguage.sInfo.replace("_START_",d).replace("_END_",f).replace("_TOTAL_",e)+" "+a.oLanguage.sInfoFiltered.replace("_MAX_",a.fnFormatNumber(a.fnRecordsTotal()))+a.oLanguage.sInfoPostFix);a=a.aanFeatures.i;if(a.length>1){b=b.html();c=1;for(d=a.length;c",c,d;if(a.aLengthMenu.length==2&&typeof a.aLengthMenu[0]=="object"&&typeof a.aLengthMenu[1]=="object"){c=0;for(d=a.aLengthMenu[0].length;c'+a.aLengthMenu[1][c]+""}else{c=0;for(d=a.aLengthMenu.length;c'+a.aLengthMenu[c]+""}b+="";var f=p.createElement("div");a.sTableId!==""&&typeof a.aanFeatures.l=="undefined"&&f.setAttribute("id",a.sTableId+ +"_length");f.className=a.oClasses.sLength;f.innerHTML=a.oLanguage.sLengthMenu.replace("_MENU_",b);j('select option[value="'+a._iDisplayLength+'"]',f).attr("selected",true);j("select",f).change(function(){var e=j(this).val(),i=a.aanFeatures.l;c=0;for(d=i.length;ca.aiDisplay.length||a._iDisplayLength==-1?a.aiDisplay.length:a._iDisplayStart+a._iDisplayLength}function Da(a,b){if(!a||a===null||a==="")return 0;if(typeof b=="undefined")b=p.getElementsByTagName("body")[0];var c=p.createElement("div");c.style.width=a;b.appendChild(c);a=c.offsetWidth;b.removeChild(c);return a}function ea(a){var b=0,c,d=0,f=a.aoColumns.length,e,i=j("th",a.nTHead);for(e= +0;etd",b);e.each(function(h){this.style.width="";h=da(a,h);if(h!==null&&a.aoColumns[h].sWidthOrig!=="")this.style.width=a.aoColumns[h].sWidthOrig});for(e=0;etd",b);if(f.length===0)f=j("thead tr:eq(0)>th",b);for(e=c=0;e0)a.aoColumns[e].sWidth=v(d);c++}a.nTable.style.width=v(j(b).outerWidth());b.parentNode.removeChild(b)}}function ia(a,b){if(a.oScroll.sX===""&&a.oScroll.sY!== +""){j(b).width();b.style.width=v(j(b).outerWidth()-a.oScroll.iBarWidth)}else if(a.oScroll.sX!=="")b.style.width=v(j(b).outerWidth())}function Ea(a,b,c){if(typeof c=="undefined"||c){c=Fa(a,b);b=N(a,b);if(c<0)return null;return a.aoData[c].nTr.getElementsByTagName("td")[b]}var d=-1,f,e;c=-1;var i=p.createElement("div");i.style.visibility="hidden";i.style.position="absolute";p.body.appendChild(i);f=0;for(e=a.aoData.length;fd){d=i.offsetWidth; +c=f}}p.body.removeChild(i);if(c>=0){b=N(a,b);if(a=a.aoData[c].nTr.getElementsByTagName("td")[b])return a}return null}function Fa(a,b){for(var c=0,d=-1,f=0;fc){c=e.length;d=f}}return d}function v(a){if(a===null)return"0px";if(typeof a=="number")return a+"px";if(a.indexOf("em")!=-1||a.indexOf("%")!=-1||a.indexOf("ex")!=-1||a.indexOf("px")!=-1)return a;return a+"px"}function La(a,b){if(a.length!=b.length)return 1;for(var c=0;cb&&a[d]--;c!=-1&&a.splice(c,1)}function qa(a,b){b=b.split(",");for(var c=[],d=0,f=a.aoColumns.length;d< +f;d++)for(var e=0;e4096){e=p.cookie.split(";");for(var h=0,k=e.length;h=d.aiDisplay.length){d._iDisplayStart-=d._iDisplayLength;if(d._iDisplayStart<0)d._iDisplayStart=0}if(typeof c=="undefined"||c){F(d);D(d)}return f};this.fnClearTable=function(a){var b=B(this[m.iApiIndex]);ba(b);if(typeof a=="undefined"||a)D(b)};this.fnOpen=function(a,b,c){var d=B(this[m.iApiIndex]);this.fnClose(a);var f=p.createElement("tr"),e=p.createElement("td");f.appendChild(e);e.className=c;e.colSpan=T(d);e.innerHTML=b;b=j("tr",d.nTBody);j.inArray(a,b)!=-1&&j(f).insertAfter(a); +d.aoOpenRows.push({nTr:f,nParent:a});return f};this.fnClose=function(a){for(var b=B(this[m.iApiIndex]),c=0;ctr",c.nTHead)[0];var h=j(">tr",c.nTFoot)[0],k=[],o=[];for(d=0;d< +f;d++){k.push(c.aoColumns[d].nTh);o.push(c.aoColumns[d].nTf)}if(b){for(d=b=0;d=T(c)){e.appendChild(k[a]);h&&h.appendChild(o[a]);d=0;for(f=c.aoData.length;dtd:eq("+i+")",c.aoData[d].nTr)[0])}}c.aoColumns[a].bVisible=true}else{e.removeChild(k[a]);h&&h.removeChild(o[a]);i=X(c);d=0;for(f=c.aoData.length;dtr:even",c).addClass(a.asDestoryStrips[0]);j(">tr:odd",c).addClass(a.asDestoryStrips[1]);b=0;for(d=E.length;bt<"F"ip>'}if(e.oScroll.sX!== +""||e.oScroll.sY!=="")e.oScroll.iBarWidth=Ja();if(typeof g.iDisplayStart!="undefined"&&typeof e.iInitDisplayStart=="undefined"){e.iInitDisplayStart=g.iDisplayStart;e._iDisplayStart=g.iDisplayStart}if(typeof g.bStateSave!="undefined"){e.oFeatures.bStateSave=g.bStateSave;Ia(e,g);e.aoDrawCallback.push({fn:Ga,sName:"state_save"})}if(typeof g.aaData!="undefined")h=true;if(typeof g!="undefined"&&typeof g.aoData!="undefined")g.aoColumns=g.aoData;if(typeof g.oLanguage!="undefined")if(typeof g.oLanguage.sUrl!= +"undefined"&&g.oLanguage.sUrl!==""){e.oLanguage.sUrl=g.oLanguage.sUrl;j.getJSON(e.oLanguage.sUrl,null,function(o){u(e,o,true)});i=true}else u(e,g.oLanguage,false)}else g={};if(typeof g.asStripClasses=="undefined"){e.asStripClasses.push(e.oClasses.sStripOdd);e.asStripClasses.push(e.oClasses.sStripEven)}c=false;d=j("tbody>tr",this);a=0;for(b=e.asStripClasses.length;a=0;a--){k=g.aoColumnDefs[a].aTargets;c=0;for(d=k.length;c=0){for(;e.aoColumns.length<=k[c];)y(e);C(e,k[c],g.aoColumnDefs[a])}else if(typeof k[c]=="number"&&k[c]<0)C(e,e.aoColumns.length+k[c],g.aoColumnDefs[a]);else if(typeof k[c]=="string"){b= +0;for(f=e.aoColumns.length;b0)e.nTFoot=this.getElementsByTagName("tfoot")[0];if(h)for(a=0;a y) ? 1 : 0)); +}; + +jQuery.fn.dataTableExt.oSort['percent-desc'] = function(a,b) { + var x = (a == "-") ? 0 : a.replace( /%/, "" ); + var y = (b == "-") ? 0 : b.replace( /%/, "" ); + x = parseFloat( x ); + y = parseFloat( y ); + return ((x < y) ? 1 : ((x > y) ? -1 : 0)); +}; \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/jquery.timeago.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/jquery.timeago.js new file mode 100644 index 000000000..0ada770a9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/jquery.timeago.js @@ -0,0 +1,141 @@ +/* + * timeago: a jQuery plugin, version: 0.9 (2010-06-21) + * @requires jQuery v1.2.3 or later + * + * Timeago is a jQuery plugin that makes it easy to support automatically + * updating fuzzy timestamps (e.g. "4 minutes ago" or "about 1 day ago"). + * + * For usage and examples, visit: + * http://timeago.yarp.com/ + * + * Licensed under the MIT: + * http://www.opensource.org/licenses/mit-license.php + * + * Copyright (c) 2008-2010, Ryan McGeary (ryanonjavascript -[at]- mcgeary [*dot*] org) + */ +(function($) { + $.timeago = function(timestamp) { + if (timestamp instanceof Date) return inWords(timestamp); + else if (typeof timestamp == "string") return inWords($.timeago.parse(timestamp)); + else return inWords($.timeago.datetime(timestamp)); + }; + var $t = $.timeago; + + $.extend($.timeago, { + settings: { + refreshMillis: 60000, + allowFuture: false, + strings: { + prefixAgo: null, + prefixFromNow: null, + suffixAgo: "ago", + suffixFromNow: "from now", + seconds: "less than a minute", + minute: "about a minute", + minutes: "%d minutes", + hour: "about an hour", + hours: "about %d hours", + day: "a day", + days: "%d days", + month: "about a month", + months: "%d months", + year: "about a year", + years: "%d years", + numbers: [] + } + }, + inWords: function(distanceMillis) { + var $l = this.settings.strings; + var prefix = $l.prefixAgo; + var suffix = $l.suffixAgo; + if (this.settings.allowFuture) { + if (distanceMillis < 0) { + prefix = $l.prefixFromNow; + suffix = $l.suffixFromNow; + } + distanceMillis = Math.abs(distanceMillis); + } + + var seconds = distanceMillis / 1000; + var minutes = seconds / 60; + var hours = minutes / 60; + var days = hours / 24; + var years = days / 365; + + function substitute(stringOrFunction, number) { + var string = $.isFunction(stringOrFunction) ? stringOrFunction(number) : stringOrFunction; + var value = ($l.numbers && $l.numbers[number]) || number; + return string.replace(/%d/i, value); + } + + var words = seconds < 45 && substitute($l.seconds, Math.round(seconds)) || + seconds < 90 && substitute($l.minute, 1) || + minutes < 45 && substitute($l.minutes, Math.round(minutes)) || + minutes < 90 && substitute($l.hour, 1) || + hours < 24 && substitute($l.hours, Math.round(hours)) || + hours < 48 && substitute($l.day, 1) || + days < 30 && substitute($l.days, Math.floor(days)) || + days < 60 && substitute($l.month, 1) || + days < 365 && substitute($l.months, Math.floor(days / 30)) || + years < 2 && substitute($l.year, 1) || + substitute($l.years, Math.floor(years)); + + return $.trim([prefix, words, suffix].join(" ")); + }, + parse: function(iso8601) { + var s = $.trim(iso8601); + s = s.replace(/\.\d\d\d/,""); // remove milliseconds + s = s.replace(/-/,"/").replace(/-/,"/"); + s = s.replace(/T/," ").replace(/Z/," UTC"); + s = s.replace(/([\+-]\d\d)\:?(\d\d)/," $1$2"); // -04:00 -> -0400 + return new Date(s); + }, + datetime: function(elem) { + // jQuery's `is()` doesn't play well with HTML5 in IE + var isTime = $(elem).get(0).tagName.toLowerCase() == "time"; // $(elem).is("time"); + var iso8601 = isTime ? $(elem).attr("datetime") : $(elem).attr("title"); + return $t.parse(iso8601); + } + }); + + $.fn.timeago = function() { + var self = this; + self.each(refresh); + + var $s = $t.settings; + if ($s.refreshMillis > 0) { + setInterval(function() { self.each(refresh); }, $s.refreshMillis); + } + return self; + }; + + function refresh() { + var data = prepareData(this); + if (!isNaN(data.datetime)) { + $(this).text(inWords(data.datetime)); + } + return this; + } + + function prepareData(element) { + element = $(element); + if (!element.data("timeago")) { + element.data("timeago", { datetime: $t.datetime(element) }); + var text = $.trim(element.text()); + if (text.length > 0) element.attr("title", text); + } + return element.data("timeago"); + } + + function inWords(date) { + return $t.inWords(distance(date)); + } + + function distance(date) { + return (new Date().getTime() - date.getTime()); + } + + // fix for IE6 suckage + document.createElement("abbr"); + document.createElement("time"); +})(jQuery); diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/jquery.url.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/jquery.url.js new file mode 100644 index 000000000..d1715ebcd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/jquery.url.js @@ -0,0 +1,174 @@ +// JQuery URL Parser +// Written by Mark Perkins, mark@allmarkedup.com +// License: http://unlicense.org/ (i.e. do what you want with it!) + +jQuery.url = function() +{ + var segments = {}; + + var parsed = {}; + + /** + * Options object. Only the URI and strictMode values can be changed via the setters below. + */ + var options = { + + url : window.location, // default URI is the page in which the script is running + + strictMode: false, // 'loose' parsing by default + + key: ["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"], // keys available to query + + q: { + name: "queryKey", + parser: /(?:^|&)([^&=]*)=?([^&]*)/g + }, + + parser: { + strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/, //less intuitive, more accurate to the specs + loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // more intuitive, fails on relative paths and deviates from specs + } + + }; + + /** + * Deals with the parsing of the URI according to the regex above. + * Written by Steven Levithan - see credits at top. + */ + var parseUri = function() + { + str = decodeURI( options.url ); + + var m = options.parser[ options.strictMode ? "strict" : "loose" ].exec( str ); + var uri = {}; + var i = 14; + + while ( i-- ) { + uri[ options.key[i] ] = m[i] || ""; + } + + uri[ options.q.name ] = {}; + uri[ options.key[12] ].replace( options.q.parser, function ( $0, $1, $2 ) { + if ($1) { + uri[options.q.name][$1] = $2; + } + }); + + return uri; + }; + + /** + * Returns the value of the passed in key from the parsed URI. + * + * @param string key The key whose value is required + */ + var key = function( key ) + { + if ( ! parsed.length ) + { + setUp(); // if the URI has not been parsed yet then do this first... + } + if ( key == "base" ) + { + if ( parsed.port !== null && parsed.port !== "" ) + { + return parsed.protocol+"://"+parsed.host+":"+parsed.port+"/"; + } + else + { + return parsed.protocol+"://"+parsed.host+"/"; + } + } + + return ( parsed[key] === "" ) ? null : parsed[key]; + }; + + /** + * Returns the value of the required query string parameter. + * + * @param string item The parameter whose value is required + */ + var param = function( item ) + { + if ( ! parsed.length ) + { + setUp(); // if the URI has not been parsed yet then do this first... + } + return ( parsed.queryKey[item] === null ) ? null : parsed.queryKey[item]; + }; + + /** + * 'Constructor' (not really!) function. + * Called whenever the URI changes to kick off re-parsing of the URI and splitting it up into segments. + */ + var setUp = function() + { + parsed = parseUri(); + + getSegments(); + }; + + /** + * Splits up the body of the URI into segments (i.e. sections delimited by '/') + */ + var getSegments = function() + { + var p = parsed.path; + segments = []; // clear out segments array + segments = parsed.path.length == 1 ? {} : ( p.charAt( p.length - 1 ) == "/" ? p.substring( 1, p.length - 1 ) : path = p.substring( 1 ) ).split("/"); + }; + + return { + + /** + * Sets the parsing mode - either strict or loose. Set to loose by default. + * + * @param string mode The mode to set the parser to. Anything apart from a value of 'strict' will set it to loose! + */ + setMode : function( mode ) + { + strictMode = mode == "strict" ? true : false; + return this; + }, + + /** + * Sets URI to parse if you don't want to to parse the current page's URI. + * Calling the function with no value for newUri resets it to the current page's URI. + * + * @param string newUri The URI to parse. + */ + setUrl : function( newUri ) + { + options.url = newUri === undefined ? window.location : newUri; + setUp(); + return this; + }, + + /** + * Returns the value of the specified URI segment. Segments are numbered from 1 to the number of segments. + * For example the URI http://test.com/about/company/ segment(1) would return 'about'. + * + * If no integer is passed into the function it returns the number of segments in the URI. + * + * @param int pos The position of the segment to return. Can be empty. + */ + segment : function( pos ) + { + if ( ! parsed.length ) + { + setUp(); // if the URI has not been parsed yet then do this first... + } + if ( pos === undefined ) + { + return segments.length; + } + return ( segments[pos] === "" || segments[pos] === undefined ) ? null : segments[pos]; + }, + + attr : key, // provides public access to private 'key' function - see above + + param : param // provides public access to private 'param' function - see above + + }; + +}(); \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/loading.gif b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/loading.gif new file mode 100644 index 000000000..3596a61f3 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/loading.gif differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/magnify.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/magnify.png new file mode 100644 index 000000000..6073b9530 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/magnify.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png new file mode 100644 index 000000000..5b5dab2ab Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_75_ffffff_40x100.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_75_ffffff_40x100.png new file mode 100644 index 000000000..ac8b229af Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_75_ffffff_40x100.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png new file mode 100644 index 000000000..ad3d6346e Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_65_ffffff_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_65_ffffff_1x400.png new file mode 100644 index 000000000..42ccba269 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_65_ffffff_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_dadada_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_dadada_1x400.png new file mode 100644 index 000000000..5a46b47cb Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_dadada_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png new file mode 100644 index 000000000..86c2baa65 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png new file mode 100644 index 000000000..4443fdc1a Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png new file mode 100644 index 000000000..7c9fa6c6e Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_222222_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_222222_256x240.png new file mode 100644 index 000000000..b273ff111 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_222222_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_2e83ff_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_2e83ff_256x240.png new file mode 100644 index 000000000..09d1cdc85 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_2e83ff_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_454545_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_454545_256x240.png new file mode 100644 index 000000000..59bd45b90 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_454545_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_888888_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_888888_256x240.png new file mode 100644 index 000000000..6d02426c1 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_888888_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_cd0a0a_256x240.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_cd0a0a_256x240.png new file mode 100644 index 000000000..2ab019b73 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_cd0a0a_256x240.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/jquery-ui-1.8.4.custom.css b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/jquery-ui-1.8.4.custom.css new file mode 100644 index 000000000..b8b2bbe50 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/smoothness/jquery-ui-1.8.4.custom.css @@ -0,0 +1,295 @@ +/* + * jQuery UI CSS Framework @VERSION + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + */ + +/* Layout helpers +----------------------------------*/ +.ui-helper-hidden { display: none; } +.ui-helper-hidden-accessible { position: absolute; left: -99999999px; } +.ui-helper-reset { margin: 0; padding: 0; border: 0; outline: 0; line-height: 1.3; text-decoration: none; font-size: 100%; list-style: none; } +.ui-helper-clearfix:after { content: "."; display: block; height: 0; clear: both; visibility: hidden; } +.ui-helper-clearfix { display: inline-block; } +/* required comment for clearfix to work in Opera \*/ +* html .ui-helper-clearfix { height:1%; } +.ui-helper-clearfix { display:block; } +/* end clearfix */ +.ui-helper-zfix { width: 100%; height: 100%; top: 0; left: 0; position: absolute; opacity: 0; filter:Alpha(Opacity=0); } + + +/* Interaction Cues +----------------------------------*/ +.ui-state-disabled { cursor: default !important; } + + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { display: block; text-indent: -99999px; overflow: hidden; background-repeat: no-repeat; } + + +/* Misc visuals +----------------------------------*/ + +/* Overlays */ +.ui-widget-overlay { position: absolute; top: 0; left: 0; width: 100%; height: 100%; } + + +/* + * jQuery UI CSS Framework @VERSION + * + * Copyright 2010, AUTHORS.txt (http://jqueryui.com/about) + * Dual licensed under the MIT or GPL Version 2 licenses. + * http://jquery.org/license + * + * http://docs.jquery.com/UI/Theming/API + * + * To view and modify this theme, visit http://jqueryui.com/themeroller/?ffDefault=Verdana,Arial,sans-serif&fwDefault=normal&fsDefault=1.1em&cornerRadius=4px&bgColorHeader=cccccc&bgTextureHeader=03_highlight_soft.png&bgImgOpacityHeader=75&borderColorHeader=aaaaaa&fcHeader=222222&iconColorHeader=222222&bgColorContent=ffffff&bgTextureContent=01_flat.png&bgImgOpacityContent=75&borderColorContent=aaaaaa&fcContent=222222&iconColorContent=222222&bgColorDefault=e6e6e6&bgTextureDefault=02_glass.png&bgImgOpacityDefault=75&borderColorDefault=d3d3d3&fcDefault=555555&iconColorDefault=888888&bgColorHover=dadada&bgTextureHover=02_glass.png&bgImgOpacityHover=75&borderColorHover=999999&fcHover=212121&iconColorHover=454545&bgColorActive=ffffff&bgTextureActive=02_glass.png&bgImgOpacityActive=65&borderColorActive=aaaaaa&fcActive=212121&iconColorActive=454545&bgColorHighlight=fbf9ee&bgTextureHighlight=02_glass.png&bgImgOpacityHighlight=55&borderColorHighlight=fcefa1&fcHighlight=363636&iconColorHighlight=2e83ff&bgColorError=fef1ec&bgTextureError=02_glass.png&bgImgOpacityError=95&borderColorError=cd0a0a&fcError=cd0a0a&iconColorError=cd0a0a&bgColorOverlay=aaaaaa&bgTextureOverlay=01_flat.png&bgImgOpacityOverlay=0&opacityOverlay=30&bgColorShadow=aaaaaa&bgTextureShadow=01_flat.png&bgImgOpacityShadow=0&opacityShadow=30&thicknessShadow=8px&offsetTopShadow=-8px&offsetLeftShadow=-8px&cornerRadiusShadow=8px + */ + + +/* Component containers +----------------------------------*/ +.ui-widget { font-family: Verdana,Arial,sans-serif; font-size: 1.1em; } +.ui-widget .ui-widget { font-size: 1em; } +.ui-widget input, .ui-widget select, .ui-widget textarea, .ui-widget button { font-family: Verdana,Arial,sans-serif; font-size: 1em; } +.ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_flat_75_ffffff_40x100.png) 50% 50% repeat-x; color: #222222; } +.ui-widget-content a { color: #222222; } +.ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(images/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; } +.ui-widget-header a { color: #222222; } + +/* Interaction states +----------------------------------*/ +.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(images/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; } +.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; } +.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(images/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; } +.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; } +.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(images/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; } +.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; } +.ui-widget :active { outline: none; } + +/* Interaction Cues +----------------------------------*/ +.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(images/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; } +.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; } +.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(images/ui-bg_glass_95_fef1ec_1x400.png) 50% 50% repeat-x; color: #cd0a0a; } +.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; } +.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; } +.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; } +.ui-priority-secondary, .ui-widget-content .ui-priority-secondary, .ui-widget-header .ui-priority-secondary { opacity: .7; filter:Alpha(Opacity=70); font-weight: normal; } +.ui-state-disabled, .ui-widget-content .ui-state-disabled, .ui-widget-header .ui-state-disabled { opacity: .35; filter:Alpha(Opacity=35); background-image: none; } + +/* Icons +----------------------------------*/ + +/* states and images */ +.ui-icon { width: 16px; height: 16px; background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-content .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } +.ui-widget-header .ui-icon {background-image: url(images/ui-icons_222222_256x240.png); } +.ui-state-default .ui-icon { background-image: url(images/ui-icons_888888_256x240.png); } +.ui-state-hover .ui-icon, .ui-state-focus .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } +.ui-state-active .ui-icon {background-image: url(images/ui-icons_454545_256x240.png); } +.ui-state-highlight .ui-icon {background-image: url(images/ui-icons_2e83ff_256x240.png); } +.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {background-image: url(images/ui-icons_cd0a0a_256x240.png); } + +/* positioning */ +.ui-icon-carat-1-n { background-position: 0 0; } +.ui-icon-carat-1-ne { background-position: -16px 0; } +.ui-icon-carat-1-e { background-position: -32px 0; } +.ui-icon-carat-1-se { background-position: -48px 0; } +.ui-icon-carat-1-s { background-position: -64px 0; } +.ui-icon-carat-1-sw { background-position: -80px 0; } +.ui-icon-carat-1-w { background-position: -96px 0; } +.ui-icon-carat-1-nw { background-position: -112px 0; } +.ui-icon-carat-2-n-s { background-position: -128px 0; } +.ui-icon-carat-2-e-w { background-position: -144px 0; } +.ui-icon-triangle-1-n { background-position: 0 -16px; } +.ui-icon-triangle-1-ne { background-position: -16px -16px; } +.ui-icon-triangle-1-e { background-position: -32px -16px; } +.ui-icon-triangle-1-se { background-position: -48px -16px; } +.ui-icon-triangle-1-s { background-position: -64px -16px; } +.ui-icon-triangle-1-sw { background-position: -80px -16px; } +.ui-icon-triangle-1-w { background-position: -96px -16px; } +.ui-icon-triangle-1-nw { background-position: -112px -16px; } +.ui-icon-triangle-2-n-s { background-position: -128px -16px; } +.ui-icon-triangle-2-e-w { background-position: -144px -16px; } +.ui-icon-arrow-1-n { background-position: 0 -32px; } +.ui-icon-arrow-1-ne { background-position: -16px -32px; } +.ui-icon-arrow-1-e { background-position: -32px -32px; } +.ui-icon-arrow-1-se { background-position: -48px -32px; } +.ui-icon-arrow-1-s { background-position: -64px -32px; } +.ui-icon-arrow-1-sw { background-position: -80px -32px; } +.ui-icon-arrow-1-w { background-position: -96px -32px; } +.ui-icon-arrow-1-nw { background-position: -112px -32px; } +.ui-icon-arrow-2-n-s { background-position: -128px -32px; } +.ui-icon-arrow-2-ne-sw { background-position: -144px -32px; } +.ui-icon-arrow-2-e-w { background-position: -160px -32px; } +.ui-icon-arrow-2-se-nw { background-position: -176px -32px; } +.ui-icon-arrowstop-1-n { background-position: -192px -32px; } +.ui-icon-arrowstop-1-e { background-position: -208px -32px; } +.ui-icon-arrowstop-1-s { background-position: -224px -32px; } +.ui-icon-arrowstop-1-w { background-position: -240px -32px; } +.ui-icon-arrowthick-1-n { background-position: 0 -48px; } +.ui-icon-arrowthick-1-ne { background-position: -16px -48px; } +.ui-icon-arrowthick-1-e { background-position: -32px -48px; } +.ui-icon-arrowthick-1-se { background-position: -48px -48px; } +.ui-icon-arrowthick-1-s { background-position: -64px -48px; } +.ui-icon-arrowthick-1-sw { background-position: -80px -48px; } +.ui-icon-arrowthick-1-w { background-position: -96px -48px; } +.ui-icon-arrowthick-1-nw { background-position: -112px -48px; } +.ui-icon-arrowthick-2-n-s { background-position: -128px -48px; } +.ui-icon-arrowthick-2-ne-sw { background-position: -144px -48px; } +.ui-icon-arrowthick-2-e-w { background-position: -160px -48px; } +.ui-icon-arrowthick-2-se-nw { background-position: -176px -48px; } +.ui-icon-arrowthickstop-1-n { background-position: -192px -48px; } +.ui-icon-arrowthickstop-1-e { background-position: -208px -48px; } +.ui-icon-arrowthickstop-1-s { background-position: -224px -48px; } +.ui-icon-arrowthickstop-1-w { background-position: -240px -48px; } +.ui-icon-arrowreturnthick-1-w { background-position: 0 -64px; } +.ui-icon-arrowreturnthick-1-n { background-position: -16px -64px; } +.ui-icon-arrowreturnthick-1-e { background-position: -32px -64px; } +.ui-icon-arrowreturnthick-1-s { background-position: -48px -64px; } +.ui-icon-arrowreturn-1-w { background-position: -64px -64px; } +.ui-icon-arrowreturn-1-n { background-position: -80px -64px; } +.ui-icon-arrowreturn-1-e { background-position: -96px -64px; } +.ui-icon-arrowreturn-1-s { background-position: -112px -64px; } +.ui-icon-arrowrefresh-1-w { background-position: -128px -64px; } +.ui-icon-arrowrefresh-1-n { background-position: -144px -64px; } +.ui-icon-arrowrefresh-1-e { background-position: -160px -64px; } +.ui-icon-arrowrefresh-1-s { background-position: -176px -64px; } +.ui-icon-arrow-4 { background-position: 0 -80px; } +.ui-icon-arrow-4-diag { background-position: -16px -80px; } +.ui-icon-extlink { background-position: -32px -80px; } +.ui-icon-newwin { background-position: -48px -80px; } +.ui-icon-refresh { background-position: -64px -80px; } +.ui-icon-shuffle { background-position: -80px -80px; } +.ui-icon-transfer-e-w { background-position: -96px -80px; } +.ui-icon-transferthick-e-w { background-position: -112px -80px; } +.ui-icon-folder-collapsed { background-position: 0 -96px; } +.ui-icon-folder-open { background-position: -16px -96px; } +.ui-icon-document { background-position: -32px -96px; } +.ui-icon-document-b { background-position: -48px -96px; } +.ui-icon-note { background-position: -64px -96px; } +.ui-icon-mail-closed { background-position: -80px -96px; } +.ui-icon-mail-open { background-position: -96px -96px; } +.ui-icon-suitcase { background-position: -112px -96px; } +.ui-icon-comment { background-position: -128px -96px; } +.ui-icon-person { background-position: -144px -96px; } +.ui-icon-print { background-position: -160px -96px; } +.ui-icon-trash { background-position: -176px -96px; } +.ui-icon-locked { background-position: -192px -96px; } +.ui-icon-unlocked { background-position: -208px -96px; } +.ui-icon-bookmark { background-position: -224px -96px; } +.ui-icon-tag { background-position: -240px -96px; } +.ui-icon-home { background-position: 0 -112px; } +.ui-icon-flag { background-position: -16px -112px; } +.ui-icon-calendar { background-position: -32px -112px; } +.ui-icon-cart { background-position: -48px -112px; } +.ui-icon-pencil { background-position: -64px -112px; } +.ui-icon-clock { background-position: -80px -112px; } +.ui-icon-disk { background-position: -96px -112px; } +.ui-icon-calculator { background-position: -112px -112px; } +.ui-icon-zoomin { background-position: -128px -112px; } +.ui-icon-zoomout { background-position: -144px -112px; } +.ui-icon-search { background-position: -160px -112px; } +.ui-icon-wrench { background-position: -176px -112px; } +.ui-icon-gear { background-position: -192px -112px; } +.ui-icon-heart { background-position: -208px -112px; } +.ui-icon-star { background-position: -224px -112px; } +.ui-icon-link { background-position: -240px -112px; } +.ui-icon-cancel { background-position: 0 -128px; } +.ui-icon-plus { background-position: -16px -128px; } +.ui-icon-plusthick { background-position: -32px -128px; } +.ui-icon-minus { background-position: -48px -128px; } +.ui-icon-minusthick { background-position: -64px -128px; } +.ui-icon-close { background-position: -80px -128px; } +.ui-icon-closethick { background-position: -96px -128px; } +.ui-icon-key { background-position: -112px -128px; } +.ui-icon-lightbulb { background-position: -128px -128px; } +.ui-icon-scissors { background-position: -144px -128px; } +.ui-icon-clipboard { background-position: -160px -128px; } +.ui-icon-copy { background-position: -176px -128px; } +.ui-icon-contact { background-position: -192px -128px; } +.ui-icon-image { background-position: -208px -128px; } +.ui-icon-video { background-position: -224px -128px; } +.ui-icon-script { background-position: -240px -128px; } +.ui-icon-alert { background-position: 0 -144px; } +.ui-icon-info { background-position: -16px -144px; } +.ui-icon-notice { background-position: -32px -144px; } +.ui-icon-help { background-position: -48px -144px; } +.ui-icon-check { background-position: -64px -144px; } +.ui-icon-bullet { background-position: -80px -144px; } +.ui-icon-radio-off { background-position: -96px -144px; } +.ui-icon-radio-on { background-position: -112px -144px; } +.ui-icon-pin-w { background-position: -128px -144px; } +.ui-icon-pin-s { background-position: -144px -144px; } +.ui-icon-play { background-position: 0 -160px; } +.ui-icon-pause { background-position: -16px -160px; } +.ui-icon-seek-next { background-position: -32px -160px; } +.ui-icon-seek-prev { background-position: -48px -160px; } +.ui-icon-seek-end { background-position: -64px -160px; } +.ui-icon-seek-start { background-position: -80px -160px; } +/* ui-icon-seek-first is deprecated, use ui-icon-seek-start instead */ +.ui-icon-seek-first { background-position: -80px -160px; } +.ui-icon-stop { background-position: -96px -160px; } +.ui-icon-eject { background-position: -112px -160px; } +.ui-icon-volume-off { background-position: -128px -160px; } +.ui-icon-volume-on { background-position: -144px -160px; } +.ui-icon-power { background-position: 0 -176px; } +.ui-icon-signal-diag { background-position: -16px -176px; } +.ui-icon-signal { background-position: -32px -176px; } +.ui-icon-battery-0 { background-position: -48px -176px; } +.ui-icon-battery-1 { background-position: -64px -176px; } +.ui-icon-battery-2 { background-position: -80px -176px; } +.ui-icon-battery-3 { background-position: -96px -176px; } +.ui-icon-circle-plus { background-position: 0 -192px; } +.ui-icon-circle-minus { background-position: -16px -192px; } +.ui-icon-circle-close { background-position: -32px -192px; } +.ui-icon-circle-triangle-e { background-position: -48px -192px; } +.ui-icon-circle-triangle-s { background-position: -64px -192px; } +.ui-icon-circle-triangle-w { background-position: -80px -192px; } +.ui-icon-circle-triangle-n { background-position: -96px -192px; } +.ui-icon-circle-arrow-e { background-position: -112px -192px; } +.ui-icon-circle-arrow-s { background-position: -128px -192px; } +.ui-icon-circle-arrow-w { background-position: -144px -192px; } +.ui-icon-circle-arrow-n { background-position: -160px -192px; } +.ui-icon-circle-zoomin { background-position: -176px -192px; } +.ui-icon-circle-zoomout { background-position: -192px -192px; } +.ui-icon-circle-check { background-position: -208px -192px; } +.ui-icon-circlesmall-plus { background-position: 0 -208px; } +.ui-icon-circlesmall-minus { background-position: -16px -208px; } +.ui-icon-circlesmall-close { background-position: -32px -208px; } +.ui-icon-squaresmall-plus { background-position: -48px -208px; } +.ui-icon-squaresmall-minus { background-position: -64px -208px; } +.ui-icon-squaresmall-close { background-position: -80px -208px; } +.ui-icon-grip-dotted-vertical { background-position: 0 -224px; } +.ui-icon-grip-dotted-horizontal { background-position: -16px -224px; } +.ui-icon-grip-solid-vertical { background-position: -32px -224px; } +.ui-icon-grip-solid-horizontal { background-position: -48px -224px; } +.ui-icon-gripsmall-diagonal-se { background-position: -64px -224px; } +.ui-icon-grip-diagonal-se { background-position: -80px -224px; } + + +/* Misc visuals +----------------------------------*/ + +/* Corner radius */ +.ui-corner-tl { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; } +.ui-corner-tr { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } +.ui-corner-bl { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } +.ui-corner-br { -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-top { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; } +.ui-corner-bottom { -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-right { -moz-border-radius-topright: 4px; -webkit-border-top-right-radius: 4px; border-top-right-radius: 4px; -moz-border-radius-bottomright: 4px; -webkit-border-bottom-right-radius: 4px; border-bottom-right-radius: 4px; } +.ui-corner-left { -moz-border-radius-topleft: 4px; -webkit-border-top-left-radius: 4px; border-top-left-radius: 4px; -moz-border-radius-bottomleft: 4px; -webkit-border-bottom-left-radius: 4px; border-bottom-left-radius: 4px; } +.ui-corner-all { -moz-border-radius: 4px; -webkit-border-radius: 4px; border-radius: 4px; } + +/* Overlays */ +.ui-widget-overlay { background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); } +.ui-widget-shadow { margin: -8px 0 0 -8px; padding: 8px; background: #aaaaaa url(images/ui-bg_flat_0_aaaaaa_40x100.png) 50% 50% repeat-x; opacity: .30;filter:Alpha(Opacity=30); -moz-border-radius: 8px; -webkit-border-radius: 8px; border-radius: 8px; } \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/stylesheet.css b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/stylesheet.css new file mode 100644 index 000000000..9b50a9b05 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/assets/0.4.4/stylesheet.css @@ -0,0 +1,341 @@ +/* ----------------------------------------------------------------------- + + + Blueprint CSS Framework 0.9 + http://blueprintcss.org + + * Copyright (c) 2007-Present. See LICENSE for more info. + * See README for instructions on how to use Blueprint. + * For credits and origins, see AUTHORS. + * This is a compressed file. See the sources in the 'src' directory. + +----------------------------------------------------------------------- */ + +/* reset.css */ +html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, code, del, dfn, em, img, q, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, dialog, figure, footer, header, hgroup, nav, section {margin:0;padding:0;border:0;font-weight:inherit;font-style:inherit;font-size:100%;font-family:inherit;vertical-align:baseline;} +article, aside, dialog, figure, footer, header, hgroup, nav, section {display:block;} +body {line-height:1.5;} +table {border-collapse:separate;border-spacing:0;} +caption, th, td {text-align:left;font-weight:normal;} +table, td, th {vertical-align:middle;} +blockquote:before, blockquote:after, q:before, q:after {content:"";} +blockquote, q {quotes:"" "";} +a img {border:none;} + +/* typography.css */ +html {font-size:100.01%;} +body {font-size:82%;color:#222;background:#fff;font-family:"Helvetica Neue", Arial, Helvetica, sans-serif;} +h1, h2, h3, h4, h5, h6 {font-weight:normal;color:#111;} +h1 {font-size:3em;line-height:1;margin-bottom:0.5em;} +h2 {font-size:2em;margin-bottom:0.75em;} +h3 {font-size:1.5em;line-height:1;margin-bottom:1em;} +h4 {font-size:1.2em;line-height:1.25;margin-bottom:1.25em;} +h5 {font-size:1em;font-weight:bold;margin-bottom:1.5em;} +h6 {font-size:1em;font-weight:bold;} +h1 img, h2 img, h3 img, h4 img, h5 img, h6 img {margin:0;} +p {margin:0 0 1.5em;} +p img.left {float:left;margin:1.5em 1.5em 1.5em 0;padding:0;} +p img.right {float:right;margin:1.5em 0 1.5em 1.5em;} +a:focus, a:hover {color:#000;} +a {color:#009;text-decoration:underline;} +blockquote {margin:1.5em;color:#666;font-style:italic;} +strong {font-weight:bold;} +em, dfn {font-style:italic;} +dfn {font-weight:bold;} +sup, sub {line-height:0;} +abbr, acronym {border-bottom:1px dotted #666;} +address {margin:0 0 1.5em;font-style:italic;} +del {color:#666;} +pre {margin:1.5em 0;white-space:pre;} +pre, code, tt {font:1em 'andale mono', 'lucida console', monospace;line-height:1.5;} +li ul, li ol {margin:0;} +ul, ol {margin:0 1.5em 1.5em 0;padding-left:3.333em;} +ul {list-style-type:disc;} +ol {list-style-type:decimal;} +dl {margin:0 0 1.5em 0;} +dl dt {font-weight:bold;} +dd {margin-left:1.5em;} +table {margin-bottom:1.4em;width:100%;} +th {font-weight:bold;} +thead th {background:#c3d9ff;} +th, td, caption {padding:4px 10px 4px 5px;} +tr.even td {background:#efefef;} +tfoot {font-style:italic;} +caption {background:#eee;} +.small {font-size:.8em;margin-bottom:1.875em;line-height:1.875em;} +.large {font-size:1.2em;line-height:2.5em;margin-bottom:1.25em;} +.hide {display:none;} +.quiet {color:#666;} +.loud {color:#000;} +.highlight {background:#ff0;} +.added {background:#060;color:#fff;} +.removed {background:#900;color:#fff;} +.first {margin-left:0;padding-left:0;} +.last {margin-right:0;padding-right:0;} +.top {margin-top:0;padding-top:0;} +.bottom {margin-bottom:0;padding-bottom:0;} + +/* forms.css */ +label {font-weight:bold;} +fieldset {padding:1.4em;margin:0 0 1.5em 0;border:1px solid #ccc;} +legend {font-weight:bold;font-size:1.2em;} +input[type=text], input[type=password], input.text, input.title, textarea, select {background-color:#fff;border:1px solid #bbb;} +input[type=text]:focus, input[type=password]:focus, input.text:focus, input.title:focus, textarea:focus, select:focus {border-color:#666;} +input[type=text], input[type=password], input.text, input.title, textarea, select {margin:0.5em 0;} +input.text, input.title {width:300px;padding:5px;} +input.title {font-size:1.5em;} +textarea {width:390px;height:250px;padding:5px;} +input[type=checkbox], input[type=radio], input.checkbox, input.radio {position:relative;top:.25em;} +form.inline {line-height:3;} +form.inline p {margin-bottom:0;} +.error, .notice, .success {padding:.8em;margin-bottom:1em;border:2px solid #ddd;} +.error {background:#FBE3E4;color:#8a1f11;border-color:#FBC2C4;} +.notice {background:#FFF6BF;color:#514721;border-color:#FFD324;} +.success {background:#E6EFC2;color:#264409;border-color:#C6D880;} +.error a {color:#8a1f11;} +.notice a {color:#514721;} +.success a {color:#264409;} +.box {padding:1.5em;margin-bottom:1.5em;background:#E5ECF9;} +hr {background:#ddd;color:#ddd;clear:both;float:none;width:100%;height:.1em;margin:0 0 1.45em;border:none;} +hr.space {background:#fff;color:#fff;visibility:hidden;} +.clearfix:after, .container:after {content:"\0020";display:block;height:0;clear:both;visibility:hidden;overflow:hidden;} +.clearfix, .container {display:block;} +.clear {clear:both;} + +#loading { + position: fixed; + left: 40%; + top: 50%; +} + +a { + color: #600; + text-decoration: none; +} + +a:hover { + color: #900; + text-decoration: underline; +} + +body { + font-family: "Lucida Grande", Helvetica, "Helvetica Neue", Arial, sans-serif; + padding: 12px; + background-color: #333; +} + +h1, h2, h3, h4 { + color: #1C2324; + margin: 0; + padding: 0; + margin-bottom: 12px; +} + +table { + width: 100%; +} + +#content { + clear: left; + background-color: white; + border: 2px solid #ddd; + border-top: 8px solid #ddd; + padding: 18px; + -webkit-border-bottom-left-radius: 5px; + -webkit-border-bottom-right-radius: 5px; + -webkit-border-top-right-radius: 5px; + -moz-border-radius-bottomleft: 5px; + -moz-border-radius-bottomright: 5px; + -moz-border-radius-topright: 5px; + border-bottom-left-radius: 5px; + border-bottom-right-radius: 5px; + border-top-right-radius: 5px; +} + +.dataTables_filter, .dataTables_info { + padding: 2px 6px; +} + +abbr.timeago { + text-decoration: none; + border: none; + font-weight: bold; +} + +.timestamp { + float: right; + color: #ddd; +} + +.group_tabs { + list-style: none; + float: left; + margin: 0; + padding: 0; +} +.group_tabs li { + display: inline; + float: left; +} + +.group_tabs li a { + font-family: Helvetica, Arial, sans-serif; + display: block; + float: left; + text-decoration: none; + padding: 4px 8px; + background-color: #aaa; + background: -webkit-gradient(linear, 0 0, 0 bottom, from(#DDD), to(#aaa)); + background: -moz-linear-gradient(#DDD, #aaa); + background: linear-gradient(#DDD, #aaa); + text-shadow: #e5e5e5 1px 1px 0px; + border-bottom: none; + color: #333; + font-weight: bold; + margin-right: 8px; + border-top: 1px solid #efefef; + -webkit-border-top-left-radius: 2px; + -webkit-border-top-right-radius: 2px; + -moz-border-radius-topleft: 2px; + -moz-border-radius-topright: 2px; + border-top-left-radius: 2px; + border-top-right-radius: 2px; +} + +.group_tabs li a:hover { + background-color: #ccc; + background: -webkit-gradient(linear, 0 0, 0 bottom, from(#eee), to(#aaa)); + background: -moz-linear-gradient(#eee, #aaa); + background: linear-gradient(#eee, #aaa); +} + +.group_tabs li a:active { + padding-top: 5px; + padding-bottom: 3px; +} + +.group_tabs li.active a { + color: black; + text-shadow: #fff 1px 1px 0px; + background-color: #ddd; + background: -webkit-gradient(linear, 0 0, 0 bottom, from(#fff), to(#ddd)); + background: -moz-linear-gradient(#fff, #ddd); + background: linear-gradient(#fff, #ddd); +} + +.file_list { + margin-bottom: 18px; +} + +a.src_link { + background: url('./magnify.png') no-repeat left 50%; + padding-left: 18px; +} + +tr, td { + margin: 0; + padding: 0; +} + +th { + white-space: nowrap; +} + +th.ui-state-default { + cursor: pointer; +} + +th span.ui-icon { + float: left; +} + +td { + padding: 4px 8px; +} + +.source_table td { + padding: 2px 8px; +} + + +.source_table { + overflow: auto; +} + +.source_table table { + width: 95%; +} + +.source_table thead td { + background-color: white; +} + +.source_table thead th { + background-color: white; +} + +.source_table td.hits { + text-align: right; +} + +.source_table h3, .source_table h4 { + padding: 0; + margin: 0; + margin-bottom: 4px; +} + +td pre { + margin: 0; + padding: 0; + color: #222; + font-family: "Monaco", "Inconsolata", "Consolas", monospace; +} + +.line_number { + width: 20px; + font-weight: bold; +} + +#footer { + color: #ddd; + font-size: 12px; + font-weight: bold; + margin-top: 12px; + text-align: right; +} +#footer a { + color: #eee; + text-decoration: underline; +} +#footer a:hover { + color: #fff; + text-decoration: none; +} + +.green { + color: #090; +} +.red { + color: #900; +} +.yellow { + color: #da0; +} +.hit.odd td { + background-color: #bbdbb6; +} +.hit.even td { + background-color: #cde1c9; +} +.miss.odd td { + background-color: #f19683; +} +.miss.even td { + background-color: #efb5a8; +} +.never.odd td { + background-color: #efefef; +} +.never.even td { + background-color: #f4f4f4; +} \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/covered_percent b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/covered_percent new file mode 100644 index 000000000..573541ac9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/covered_percent @@ -0,0 +1 @@ +0 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/index.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/index.html new file mode 100644 index 000000000..dd35333de --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/index.html @@ -0,0 +1,71 @@ + + + + Code coverage for Sorter + + + + + + + + + + + + + + + +
    + loading +
    + + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/resultset.yml b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/resultset.yml new file mode 100644 index 000000000..f09809b66 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/coverage/resultset.yml @@ -0,0 +1,22 @@ +--- +! '/tmp/textmate-command-51934.rb ': + :original_result: {} + :created_at: 2011-04-07 08:53:44.276394000 +10:00 +! '/tmp/textmate-command-51953.rb ': + :original_result: {} + :created_at: 2011-04-07 08:53:56.992279000 +10:00 +! '/tmp/textmate-command-51982.rb ': + :original_result: {} + :created_at: 2011-04-07 08:54:04.643474000 +10:00 +! '/tmp/textmate-command-52012.rb ': + :original_result: {} + :created_at: 2011-04-07 08:54:15.113156000 +10:00 +! '/tmp/textmate-command-52049.rb ': + :original_result: {} + :created_at: 2011-04-07 08:54:44.655413000 +10:00 +! '/tmp/textmate-command-52077.rb ': + :original_result: {} + :created_at: 2011-04-07 08:54:48.711339000 +10:00 +! '/tmp/textmate-command-52499.rb ': + :original_result: {} + :created_at: 2011-04-07 09:03:56.142377000 +10:00 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/immutable_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/immutable_spec.rb new file mode 100644 index 000000000..d864f6e27 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/sorter/immutable_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +require 'hamster/immutable' +require 'hamster/sorter' + +describe Hamster::Sorter do + + it "includes Immutable" do + Hamster::Sorter.should include(Hamster::Immutable) + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/clear_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/clear_spec.rb new file mode 100644 index 000000000..4ab8be653 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/clear_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +require 'hamster/stack' + +describe Hamster::Stack do + + describe "#stack" do + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values}" do + + before do + @original = Hamster.stack(*values) + @result = @original.clear + end + + it "preserves the original" do + @original.should == Hamster.stack(*values) + end + + it "returns an empty list" do + @result.should equal(Hamster.stack) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/construction_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/construction_spec.rb new file mode 100644 index 000000000..6d407c651 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/construction_spec.rb @@ -0,0 +1,43 @@ +require 'spec_helper' + +require 'hamster/stack' + +describe Hamster do + + describe ".stack" do + + describe "with no arguments" do + + before do + @stack = Hamster.stack + end + + it "always returns the same instance" do + @stack.should equal(Hamster.stack) + end + + it "returns an empty stack" do + @stack.should be_empty + end + + end + + describe "with a number of items" do + + before do + @stack = Hamster.stack("A", "B", "C") + end + + it "always returns a different instance" do + @stack.should_not equal(Hamster.stack("A", "B", "C")) + end + + it "is the same as repeatedly using #push" do + @stack.should == Hamster.stack.push("A").push("B").push("C") + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/copying_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/copying_spec.rb new file mode 100644 index 000000000..f01790534 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/copying_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +require 'hamster/stack' + +describe Hamster::Stack do + + [:dup, :clone].each do |method| + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values.inspect}" do + + before do + @stack = Hamster.stack(*values) + end + + it "returns self" do + @stack.send(method).should equal(@stack) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/empty_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/empty_spec.rb new file mode 100644 index 000000000..d8a02c622 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/empty_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +require 'hamster/stack' + +describe Hamster::Stack do + + describe "#empty?" do + + [ + [[], true], + [["A"], false], + [["A", "B", "C"], false], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @stack = Hamster.stack(*values) + end + + it "returns #{expected.inspect}" do + @stack.empty?.should == expected + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/eql_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/eql_spec.rb new file mode 100644 index 000000000..1adc1cee2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/eql_spec.rb @@ -0,0 +1,60 @@ +require 'spec_helper' + +require 'hamster/stack' + +describe Hamster::Stack do + + [:eql?, :==].each do |method| + + describe "##{method}" do + + describe "returns false when comparing with" do + + before do + @stack = Hamster.stack("A", "B", "C") + end + + it "a list" do + @stack.send(method, Hamster.list("C", "B", "A")).should == false + end + + it "an aribtrary object" do + @stack.send(method, Object.new).should == false + end + + end + + [ + [[], [], true], + [["A"], [], false], + [["A"], ["A"], true], + [["A"], ["B"], false], + [["A", "B"], ["A"], false], + [["A", "B", "C"], ["A", "B", "C"], true], + [["C", "A", "B"], ["A", "B", "C"], false], + ].each do |a, b, expected| + + describe "returns #{expected.inspect}" do + + before do + @a = Hamster.stack(*a) + @b = Hamster.stack(*b) + end + + it "for #{a.inspect} and #{b.inspect}" do + @a.send(method, @b).should == expected + end + + it "for #{b.inspect} and #{a.inspect}" do + @b.send(method, @a).should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/immutable_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/immutable_spec.rb new file mode 100644 index 000000000..65da92a09 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/immutable_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +require 'hamster/immutable' +require 'hamster/stack' + +describe Hamster::Stack do + + it "includes Immutable" do + Hamster::Stack.should include(Hamster::Immutable) + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/inspect_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/inspect_spec.rb new file mode 100644 index 000000000..c9b9dfdce --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/inspect_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +require 'hamster/stack' + +describe Hamster::Stack do + + describe "#inspect" do + + [ + [[], "[]"], + [["A"], "[\"A\"]"], + [["A", "B", "C"], "[\"C\", \"B\", \"A\"]"] + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @stack = Hamster.stack(*values) + end + + it "returns #{expected.inspect}" do + @stack.inspect.should == expected + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/peek_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/peek_spec.rb new file mode 100644 index 000000000..3328640d3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/peek_spec.rb @@ -0,0 +1,40 @@ +require 'spec_helper' + +require 'hamster/stack' + +describe Hamster::Stack do + + [:peek, :top].each do |method| + + describe "##{method}" do + + [ + [[], nil], + [["A"], "A"], + [["A", "B", "C"], "C"], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.stack(*values) + @result = @original.send(method) + end + + it "preserves the original" do + @original.should == Hamster.stack(*values) + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/pop_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/pop_spec.rb new file mode 100644 index 000000000..c867d1ece --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/pop_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' + +require 'hamster/stack' + +describe Hamster::Stack do + + [:pop, :dequeue].each do |method| + + describe "##{method}" do + + [ + [[], []], + [["A"], []], + [["A", "B"], ["A"]], + [["A", "B", "C"], ["A", "B"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.stack(*values) + @result = @original.send(method) + end + + it "preserves the original" do + @original.should == Hamster.stack(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.stack(*expected) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/push_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/push_spec.rb new file mode 100644 index 000000000..67b32c0b6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/push_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' + +require 'hamster/stack' + +describe Hamster::Stack do + + [:push, :<<, :enqueue].each do |method| + + describe "##{method}" do + + [ + [[], "A", ["A"]], + [["A"], "B", ["A", "B"]], + [["A"], "A", ["A", "A"]], + [["A", "B", "C"], "D", ["A", "B", "C", "D"]], + ].each do |values, new_value, expected| + + describe "on #{values.inspect} with #{new_value.inspect}" do + + before do + @original = Hamster.stack(*values) + @result = @original.send(method, new_value) + end + + it "preserves the original" do + @original.should == Hamster.stack(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.stack(*expected) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/size_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/size_spec.rb new file mode 100644 index 000000000..1f73d3325 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/size_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +require 'hamster/stack' + +describe Hamster::Stack do + + [:size, :length].each do |method| + + describe "##{method}" do + + [ + [[], 0], + [["A"], 1], + [["A", "B", "C"], 3], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @stack = Hamster.stack(*values) + end + + it "returns #{expected.inspect}" do + @stack.send(method).should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/to_a_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/to_a_spec.rb new file mode 100644 index 000000000..0b4c8edcb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/to_a_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +require 'hamster/stack' + +describe Hamster::Stack do + + [:to_a, :entries].each do |method| + + describe "##{method}" do + + [ + [[], []], + [["A"], ["A"]], + [["A", "B", "C"], ["C", "B", "A"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @stack = Hamster.stack(*values) + @result = @stack.send(method) + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + it "returns a mutable array" do + @result.last.should_not == "The End" + @result << "The End" + @result.last.should == "The End" + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/to_ary.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/to_ary.rb new file mode 100644 index 000000000..58adc05de --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/to_ary.rb @@ -0,0 +1,44 @@ +require 'spec_helper' + +require 'hamster/stack' + +describe Hamster::Stack do + + describe "#to_ary" do + + describe "enables implicit conversion to" do + + before do + @stack = Hamster.stack("D", "C", "B", "A") + end + + it "block parameters" do + def func(&block) + yield(@stack) + end + func do |a, b, *c| + a.should == "A" + b.should == "B" + c.should == ["C", "D"] + end + end + + it "method arguments" do + def func(a, b, *c) + a.should == "A" + b.should == "B" + c.should == ["C", "D"] + end + func(*@stack) + end + + it "works with splat" do + array = *@stack + array.should == ["A", "B", "C", "D"] + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/to_list_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/to_list_spec.rb new file mode 100644 index 000000000..ef83eca28 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/stack/to_list_spec.rb @@ -0,0 +1,33 @@ +require 'spec_helper' + +require 'hamster/stack' +require 'hamster/list' + +describe Hamster::Stack do + + describe "#to_list" do + + [ + [[], []], + [["A"], ["A"]], + [["A", "B", "C"], ["C", "B", "A"]], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @stack = Hamster.stack(*values) + @result = @stack.to_list + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.list(*expected) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/trie/remove_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/trie/remove_spec.rb new file mode 100644 index 000000000..f6f867a7c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/trie/remove_spec.rb @@ -0,0 +1,117 @@ +# require 'spec_helper' +# +# describe Hamster::Hash do +# +# describe "#remove" do +# +# describe "the last key" do +# +# before do +# @hash = Hamster::Hash.new.put("A", "aye").remove("A") +# end +# +# it "no longer provides access to the removed key" do +# @hash.has_key?("A").should == false +# end +# +# end +# +# describe "with an existing key" do +# +# before do +# @original = Hamster::Hash.new.put("A", "aye").put("B", "bee") +# @copy = @original.remove("A") +# end +# +# it "returns a modified copy" do +# @copy.should_not equal(@original) +# end +# +# describe "the original" do +# +# it "still has the original key/value pairs" do +# @original.get("A").should == "aye" +# @original.get("B").should == "bee" +# end +# +# it "still has the original size" do +# @original.size.should == 2 +# end +# +# end +# +# describe "the modified copy" do +# +# it "has all but the removed original key/value pairs" do +# @copy.get("B").should == "bee" +# end +# +# it "doesn't have the removed key" do +# @copy.has_key?("A").should == false +# end +# +# it "has a size one less than the original" do +# @copy.size.should == 1 +# end +# +# end +# +# end +# +# describe "with non-existing keys" do +# +# before do +# @original = Hamster::Hash.new.put("A", "aye") +# @copy = @original.remove("missing") +# end +# +# it "returns self" do +# @copy.should equal(@original) +# end +# +# describe "the original" do +# +# it "still has the original key/value pairs" do +# @original.get("A").should == "aye" +# end +# +# it "still has the original size" do +# @original.size.should == 1 +# end +# +# end +# +# end +# +# describe "with keys of the same hash value" do +# +# class Key +# def hash; 1; end +# end +# +# def instance_count +# ObjectSpace.garbage_collect +# ObjectSpace.each_object(Hamster::Trie) {} +# end +# +# before do +# @a = Key.new +# @b = Key.new +# @original = Hamster::Hash.new.put(@a, "aye").put(@b, "bee") +# end +# +# it "no longer provides access to the removed key" do +# copy = @original.remove(@b) +# copy.has_key?(@b).should == false +# end +# +# it "provides access to the remaining keys" do +# copy = @original.remove(@a) +# copy.get(@b).should == "bee" +# end +# +# end +# +# end +# +# end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/copying_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/copying_spec.rb new file mode 100644 index 000000000..c506635c5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/copying_spec.rb @@ -0,0 +1,24 @@ +require 'spec_helper' + +require 'hamster/tuple' + +describe Hamster::Tuple do + + [:dup, :clone].each do |method| + + describe "#{method}" do + + before do + @original = Hamster::Tuple.new("A", "B") + @result = @original.send(method) + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/eql_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/eql_spec.rb new file mode 100644 index 000000000..f95cfe10c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/eql_spec.rb @@ -0,0 +1,61 @@ +require 'spec_helper' + +require 'hamster/tuple' + +describe Hamster::Tuple do + + [:eql?, :==].each do |method| + + describe "##{method}" do + + describe "returns false when comparing with" do + + before do + @tuple = Hamster::Tuple.new("A", "B", "C") + end + + it "an array with the same values" do + @tuple.send(method, ["A", "B", "C"]).should == false + end + + it "an aribtrary object" do + @tuple.send(method, Object.new).should == false + end + + end + + [ + [[], [], true], + [[], [nil], false], + [["A"], [], false], + [["A"], ["A"], true], + [["A"], ["B"], false], + [["A", "B"], ["A"], false], + [["A", "B", "C"], ["A", "B", "C"], true], + [["C", "A", "B"], ["A", "B", "C"], false], + ].each do |a, b, expected| + + describe "returns #{expected.inspect}" do + + before do + @a = Hamster::Tuple.new(*a) + @b = Hamster::Tuple.new(*b) + end + + it "for #{a.inspect} and #{b.inspect}" do + @a.send(method, @b).should == expected + end + + it "for #{b.inspect} and #{a.inspect}" do + @b.send(method, @a).should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/first_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/first_spec.rb new file mode 100644 index 000000000..66c321585 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/first_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +require 'hamster/tuple' + +describe Hamster::Tuple do + + describe "#first" do + + before do + @tuple = Hamster::Tuple.new("A", "B") + end + + it "returns the first value" do + @tuple.first.should == "A" + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/immutable_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/immutable_spec.rb new file mode 100644 index 000000000..8d045d458 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/immutable_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +require 'hamster/immutable' +require 'hamster/tuple' + +describe Hamster::Tuple do + + it "includes Immutable" do + Hamster::Tuple.should include(Hamster::Immutable) + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/inspect_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/inspect_spec.rb new file mode 100644 index 000000000..f40631b56 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/inspect_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +require 'hamster/tuple' + +describe Hamster::Tuple do + + describe "#inspect" do + + before do + @list = Hamster::Tuple.new("A", "B") + end + + it "returns a string with the inspected values" do + @list.inspect.should == "(\"A\", \"B\")" + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/last_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/last_spec.rb new file mode 100644 index 000000000..1f7cf5cab --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/last_spec.rb @@ -0,0 +1,19 @@ +require 'spec_helper' + +require 'hamster/tuple' + +describe Hamster::Tuple do + + describe "#last" do + + before do + @tuple = Hamster::Tuple.new("A", "B") + end + + it "returns the last value" do + @tuple.last.should == "B" + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/to_a_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/to_a_spec.rb new file mode 100644 index 000000000..1c8841df1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/to_a_spec.rb @@ -0,0 +1,38 @@ +require 'spec_helper' + +require 'hamster/tuple' + +describe Hamster::Tuple do + + describe "#to_a" do + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values.inspect}" do + + before do + @tuple = Hamster::Tuple.new(*values) + @result = @tuple.to_a + end + + it "returns #{values.inspect}" do + @result.should == values + end + + it "returns a mutable array" do + @result.last.should_not == "The End" + @result << "The End" + @result.last.should == "The End" + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/to_ary_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/to_ary_spec.rb new file mode 100644 index 000000000..c6ca13225 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/tuple/to_ary_spec.rb @@ -0,0 +1,44 @@ +require 'spec_helper' + +require 'hamster/tuple' + +describe Hamster::Tuple do + + describe "#to_ary" do + + describe "enables implicit conversion to" do + + before do + @tuple = Hamster::Tuple.new("A", "B", "C", "D") + end + + it "block parameters" do + def func(&block) + yield(@tuple) + end + func do |a, b, *c| + a.should == "A" + b.should == "B" + c.should == ["C", "D"] + end + end + + it "method arguments" do + def func(a, b, *c) + a.should == "A" + b.should == "B" + c.should == ["C", "D"] + end + func(*@tuple) + end + + it "works with splat" do + array = *@tuple + array.should == ["A", "B", "C", "D"] + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/undefined/erase_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/undefined/erase_spec.rb new file mode 100644 index 000000000..b8def49dc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/undefined/erase_spec.rb @@ -0,0 +1,47 @@ +require 'spec_helper' + +require 'hamster/undefined' + +describe Hamster::Undefined do + + describe "#erase" do + + describe "with Undefined" do + + before do + @result = Hamster::Undefined.erase(Hamster::Undefined) + end + + it "returns nil" do + @result.should be_nil + end + + end + + describe "with nil" do + + before do + @result = Hamster::Undefined.erase(nil) + end + + it "returns nil" do + @result.should be_nil + end + + end + + describe "otherwise" do + + before do + @result = Hamster::Undefined.erase("Hello") + end + + it "returns the value unchanged" do + @result.should == "Hello" + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/add_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/add_spec.rb new file mode 100644 index 000000000..d5b1f7685 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/add_spec.rb @@ -0,0 +1,41 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + [:add, :<<, :cons].each do |method| + + describe "##{method}" do + + [ + [[], "A", ["A"]], + [["A"], "B", ["A", "B"]], + [["A"], "A", ["A", "A"]], + [["A", "B", "C"], "D", ["A", "B", "C", "D"]], + ].each do |values, new_value, expected| + + describe "on #{values.inspect} with #{new_value.inspect}" do + + before do + @original = Hamster.vector(*values) + @result = @original.send(method, new_value) + end + + it "preserves the original" do + @original.should == Hamster.vector(*values) + end + + it "returns #{expected.inspect}" do + @result.should == Hamster.vector(*expected) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/any_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/any_spec.rb new file mode 100644 index 000000000..6b341dac3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/any_spec.rb @@ -0,0 +1,67 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + [:any?, :exist?, :exists?].each do |method| + + describe "##{method}" do + + describe "when empty" do + + before do + @vector = Hamster.vector + end + + it "with a block returns false" do + @vector.send(method) {}.should == false + end + + it "with no block returns false" do + @vector.send(method).should == false + end + + end + + describe "when not empty" do + + describe "with a block" do + + before do + @vector = Hamster.vector("A", "B", "C", nil) + end + + ["A", "B", "C", nil].each do |value| + + it "returns true if the block ever returns true (#{value.inspect})" do + @vector.send(method) { |item| item == value }.should == true + end + + end + + it "returns false if the block always returns false" do + @vector.send(method) { |item| item == "D" }.should == false + end + + end + + describe "with no block" do + + it "returns true if any value is truthy" do + Hamster.vector(nil, false, "A", true).send(method).should == true + end + + it "returns false if all values are falsey" do + Hamster.vector(nil, false).send(method).should == false + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/clear_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/clear_spec.rb new file mode 100644 index 000000000..3801aaa96 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/clear_spec.rb @@ -0,0 +1,36 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + describe "#clear" do + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values}" do + + before do + @original = Hamster.vector(*values) + @result = @original.clear + end + + it "preserves the original" do + @original.should == Hamster.vector(*values) + end + + it "returns an empty vector" do + @result.should equal(Hamster.vector) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/copying_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/copying_spec.rb new file mode 100644 index 000000000..748d5e182 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/copying_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + [:dup, :clone].each do |method| + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values.inspect}" do + + before do + @original = Hamster.vector(*values) + @result = @original.send(method) + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/each_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/each_spec.rb new file mode 100644 index 000000000..b9022d302 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/each_spec.rb @@ -0,0 +1,46 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + [:each, :foreach].each do |method| + + describe "##{method}" do + + describe "with no block" do + + before do + @vector = Hamster.vector("A", "B", "C") + @result = @vector.send(method) + end + + it "returns self" do + @result.should equal(@vector) + end + + end + + describe "with a block" do + + before do + @vector = Hamster.vector(*(1..1025)) + @items = [] + @result = @vector.send(method) { |item| @items << item } + end + + it "returns nil" do + @result.should be_nil + end + + it "iterates over the items in order" do + @items.should == (1..1025).to_a + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/each_with_index_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/each_with_index_spec.rb new file mode 100644 index 000000000..cdbe2f01a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/each_with_index_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + describe "#each_with_index" do + + describe "with no block" do + + before do + @vector = Hamster.vector("A", "B", "C") + @result = @vector.each_with_index + end + + it "returns self" do + @result.should equal(@vector) + end + + end + + describe "with a block" do + + before do + @vector = Hamster.vector(*(1..1025)) + @pairs = [] + @result = @vector.each_with_index { |item, index| @pairs << [item, index] } + end + + it "returns nil" do + @result.should be_nil + end + + it "iterates over the items in order" do + @pairs.should == (1..@vector.size).zip(0..@vector.size.pred) + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/empty_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/empty_spec.rb new file mode 100644 index 000000000..a5bbf634c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/empty_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + [:empty?, :null?].each do |method| + + describe "##{method}" do + + [ + [[], true], + [["A"], false], + [["A", "B", "C"], false], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @vector = Hamster.vector(*values) + end + + it "returns #{expected.inspect}" do + @vector.send(method).should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/eql_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/eql_spec.rb new file mode 100644 index 000000000..ce64527f6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/eql_spec.rb @@ -0,0 +1,65 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + [:eql?, :==].each do |method| + + describe "##{method}" do + + describe "returns false when comparing with" do + + before do + @vector = Hamster.vector("A", "B", "C") + end + + it "an array with the same contents" do + @vector.send(method, ["A", "B", "C"]).should == false + end + + it "an aribtrary object" do + @vector.send(method, Object.new).should == false + end + + end + + it "returns false when comparing an empty vector with an empty array" do + Hamster.vector.send(method, []).should == false + end + + [ + [[], [], true], + [[], [nil], false], + [["A"], [], false], + [["A"], ["A"], true], + [["A"], ["B"], false], + [["A", "B"], ["A"], false], + [["A", "B", "C"], ["A", "B", "C"], true], + [["C", "A", "B"], ["A", "B", "C"], false], + ].each do |a, b, expected| + + describe "returns #{expected.inspect}" do + + before do + @a = Hamster.vector(*a) + @b = Hamster.vector(*b) + end + + it "for vectors #{a.inspect} and #{b.inspect}" do + @a.send(method, @b).should == expected + end + + it "for vectors #{b.inspect} and #{a.inspect}" do + @b.send(method, @a).should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/filter_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/filter_spec.rb new file mode 100644 index 000000000..2888ee79d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/filter_spec.rb @@ -0,0 +1,63 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + [:filter, :select, :find_all].each do |method| + + describe "##{method}" do + + before do + @original = Hamster.vector("A", "B", "C") + end + + describe "with a block" do + + before do + @result = @original.send(method) { |item| item == "A" } + end + + it "preserves the original" do + @original.should == Hamster.vector("A", "B", "C") + end + + it "returns a vector with the matching values" do + @result.should == Hamster.vector("A") + end + + end + + describe "with no block" do + + before do + @result = @original.send(method) + end + + it "returns self" do + @result.should equal(@original) + end + + end + + describe "when nothing matches" do + + before do + @result = @original.send(method) { |item| false } + end + + it "preserves the original" do + @original.should == Hamster.vector("A", "B", "C") + end + + it "returns an empty vector" do + @result.should equal(Hamster.vector) + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/first_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/first_spec.rb new file mode 100644 index 000000000..8fd4898d5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/first_spec.rb @@ -0,0 +1,35 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + [:first, :head].each do |method| + + describe "##{method}" do + + [ + [[], nil], + [["A"], "A"], + [["A", "B", "C"], "A"], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @vector = Hamster.vector(*values) + end + + it "returns #{expected.inspect}" do + @vector.send(method).should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/get_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/get_spec.rb new file mode 100644 index 000000000..f1654463f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/get_spec.rb @@ -0,0 +1,81 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + [:get, :[], :at].each do |method| + + describe "##{method}" do + + describe "when empty" do + + before do + @vector = Hamster.vector + end + + it "always returns nil" do + (-1..1).each do |i| + @vector.send(method, i).should be_nil + end + end + + end + + describe "when not empty" do + + before do + @vector = Hamster.vector(*(1..1025)) + end + + describe "with a positive index" do + + describe "within the absolute bounds of the vector" do + + it "returns the value at the specified index from the head" do + (0..(@vector.size - 1)).each do |i| + @vector.send(method, i).should == i + 1 + end + end + + end + + describe "outside the absolute bounds of the vector" do + + it "returns nil" do + @vector.send(method, @vector.size).should be_nil + end + + end + + end + + describe "with a negative index" do + + describe "within the absolute bounds of the vector" do + + it "returns the value at the specified index from the tail" do + (-@vector.size..-1).each do |i| + @vector.send(method, i).should == @vector.size + i + 1 + end + end + + end + + describe "outside the absolute bounds of the vector" do + + it "returns nil" do + @vector.send(method, -@vector.size.next).should be_nil + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/include_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/include_spec.rb new file mode 100644 index 000000000..91269aa42 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/include_spec.rb @@ -0,0 +1,45 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + [:include?, :member?, :contains?, :elem?].each do |method| + + describe "##{method}" do + + [ + [[], "A", false], + [[], nil, false], + [["A"], "A", true], + [["A"], "B", false], + [["A"], nil, false], + [["A", "B", nil], "A", true], + [["A", "B", nil], "B", true], + [["A", "B", nil], nil, true], + [["A", "B", nil], "C", false], + [[2], 2, true], + [[2], 2.0, true], + [[2.0], 2.0, true], + [[2.0], 2, true], + ].each do |values, item, expected| + + describe "on #{values.inspect}" do + + before do + @vector = Hamster.vector(*values) + end + + it "returns #{expected.inspect}" do + @vector.send(method, item).should == expected + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/inspect_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/inspect_spec.rb new file mode 100644 index 000000000..fc338690f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/inspect_spec.rb @@ -0,0 +1,31 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + describe "#inspect" do + + [ + [[], "[]"], + [["A"], "[\"A\"]"], + [["A", "B", "C"], "[\"A\", \"B\", \"C\"]"] + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @vector = Hamster.vector(*values) + end + + it "returns #{expected.inspect}" do + @vector.inspect.should == expected + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/last_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/last_spec.rb new file mode 100644 index 000000000..8446efdd2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/last_spec.rb @@ -0,0 +1,32 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + describe "#last" do + + [ + [[], nil], + [["A"], "A"], + [["A", "B", "C"], "C"], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + original = Hamster.vector(*values) + @result = original.last + end + + it "returns #{expected.inspect}" do + @result.should == expected + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/map_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/map_spec.rb new file mode 100644 index 000000000..6fe0eefa1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/map_spec.rb @@ -0,0 +1,64 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + [:map, :collect].each do |method| + + describe "##{method}" do + + describe "when empty" do + + before do + @original = Hamster.vector + @mapped = @original.send(method) {} + end + + it "returns self" do + @mapped.should equal(@original) + end + + end + + describe "when not empty" do + + before do + @original = Hamster.vector("A", "B", "C") + end + + describe "with a block" do + + before do + @mapped = @original.send(method, &:downcase) + end + + it "preserves the original values" do + @original.should == Hamster.vector("A", "B", "C") + end + + it "returns a new vector with the mapped values" do + @mapped.should == Hamster.vector("a", "b", "c") + end + + end + + describe "with no block" do + + before do + @result = @original.send(method) + end + + it "returns self" do + @result.should equal(@original) + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/reduce_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/reduce_spec.rb new file mode 100644 index 000000000..dbb6e8923 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/reduce_spec.rb @@ -0,0 +1,87 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + [:reduce, :inject, :fold, :foldr].each do |method| + + describe "##{method}" do + + [ + [[], 10, 10], + [[1], 10, 9], + [[1, 2, 3], 10, 4], + ].each do |values, initial, expected| + + describe "on #{values.inspect}" do + + before do + @vector = Hamster.vector(*values) + end + + describe "with an initial value of #{initial}" do + + describe "and a block" do + + it "returns #{expected.inspect}" do + @vector.send(method, initial) { |memo, item| memo - item }.should == expected + end + + end + + describe "and no block" do + + it "returns the memo" do + @vector.send(method, initial).should == initial + end + + end + + end + + end + + end + + [ + [[], nil], + [[1], 1], + [[1, 2, 3], -4], + ].each do |values, expected| + + describe "on #{values.inspect}" do + + before do + @vector = Hamster.vector(*values) + end + + describe "with no initial value" do + + describe "and a block" do + + it "returns #{expected.inspect}" do + @vector.send(method) { |memo, item| memo - item }.should == expected + end + + end + + describe "and no block" do + + it "returns nil" do + @vector.send(method).should be_nil + end + + end + + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/set_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/set_spec.rb new file mode 100644 index 000000000..af13d522f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/set_spec.rb @@ -0,0 +1,153 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + describe "#set" do + + describe "when empty" do + + before do + @vector = Hamster.vector + end + + it "always raises an error" do + (-1..1).each do |i| + lambda { @vector.set(i) }.should raise_error + end + end + + end + + describe "when not empty" do + + before do + @original = Hamster.vector("A", "B", "C") + end + + describe "with a block" do + + describe "and a positive index" do + + describe "within the absolute bounds of the vector" do + + it "passes the current value to the block" do + @original.set(1) { |value| value.should == "B" } + end + + it "replaces the value with the result of the block" do + result = @original.set(1) { |value| "FLIBBLE" } + result.should == Hamster.vector("A", "FLIBBLE", "C") + end + + it "supports to_proc methods" do + result = @original.set(1, &:downcase) + result.should == Hamster.vector("A", "b", "C") + end + + end + + describe "outside the absolute bounds of the vector" do + + it "raises an error" do + lambda { @original.set(@original.size) {} }.should raise_error + end + + end + + end + + describe "and a negative index" do + + describe "within the absolute bounds of the vector" do + + it "passes the current value to the block" do + @original.set(-2) { |value| value.should == "B" } + end + + it "replaces the value with the result of the block" do + result = @original.set(-2) { |value| "FLIBBLE" } + result.should == Hamster.vector("A", "FLIBBLE", "C") + end + + it "supports to_proc methods" do + result = @original.set(-2, &:downcase) + result.should == Hamster.vector("A", "b", "C") + end + + end + + describe "outside the absolute bounds of the vector" do + + it "raises an error" do + lambda { @original.set(-@original.size.next) {} }.should raise_error + end + + end + + end + + end + + describe "with a value" do + + describe "and a positive index" do + + describe "within the absolute bounds of the vector" do + + before do + @result = @original.set(1, "FLIBBLE") + end + + it "preserves the original" do + @original.should == Hamster.vector("A", "B", "C") + end + + it "sets the new value at the specified index" do + @result.should == Hamster.vector("A", "FLIBBLE", "C") + end + + end + + describe "outside the absolute bounds of the vector" do + + it "raises an error" do + lambda { @original.set(@original.size, "FLIBBLE") }.should raise_error + end + + end + + end + + describe "with a negative index" do + + before do + @result = @original.set(-2, "FLIBBLE") + end + + it "preserves the original" do + @original.should == Hamster.vector("A", "B", "C") + end + + it "sets the new value at the specified index" do + @result.should == Hamster.vector("A", "FLIBBLE", "C") + end + + end + + describe "outside the absolute bounds of the vector" do + + it "raises an error" do + lambda { @original.set(-@original.size.next, "FLIBBLE") }.should raise_error + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/size_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/size_spec.rb new file mode 100644 index 000000000..e98b0c1d1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/size_spec.rb @@ -0,0 +1,27 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + [:size, :length].each do |method| + + describe "##{method}" do + + [ + [[], 0], + [["A"], 1], + [["A", "B", "C"], 3], + ].each do |values, result| + + it "returns #{result} for #{values.inspect}" do + Hamster.vector(*values).send(method).should == result + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/to_a_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/to_a_spec.rb new file mode 100644 index 000000000..0ec39bfe9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/to_a_spec.rb @@ -0,0 +1,42 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + [:to_a, :entries].each do |method| + + describe "##{method}" do + + [ + [], + ["A"], + ["A", "B", "C"], + ].each do |values| + + describe "on #{values.inspect}" do + + before do + @vector = Hamster.vector(*values) + @result = @vector.send(method) + end + + it "returns #{values.inspect}" do + @result.should == values + end + + it "returns a mutable array" do + @result.last.should_not == "The End" + @result << "The End" + @result.last.should == "The End" + end + + end + + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/to_ary_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/to_ary_spec.rb new file mode 100644 index 000000000..5c566b77e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/hamster/vector/to_ary_spec.rb @@ -0,0 +1,44 @@ +require 'spec_helper' + +require 'hamster/vector' + +describe Hamster::Vector do + + describe "#to_ary" do + + describe "enables implicit conversion to" do + + before do + @vector = Hamster.vector("A", "B", "C", "D") + end + + it "block parameters" do + def func(&block) + yield(@vector) + end + func do |a, b, *c| + a.should == "A" + b.should == "B" + c.should == ["C", "D"] + end + end + + it "method arguments" do + def func(a, b, *c) + a.should == "A" + b.should == "B" + c.should == ["C", "D"] + end + func(*@vector) + end + + it "works with splat" do + array = *@vector + array.should == ["A", "B", "C", "D"] + end + + end + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/spec_helper.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/spec_helper.rb new file mode 100644 index 000000000..d24a6c15a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/spec/spec_helper.rb @@ -0,0 +1,42 @@ +# Common spec-related code goes here + +require 'simplecov' +SimpleCov.start +SimpleCov.at_exit do + SimpleCov.result.format! + open("#{SimpleCov.coverage_dir}/covered_percent", "w") do |f| + f.puts SimpleCov.result.covered_percent.to_s + end +end + +STACK_OVERFLOW_DEPTH = if RUBY_ENGINE == "ruby" + def calculate_stack_overflow_depth(n) + calculate_stack_overflow_depth(n + 1) + rescue SystemStackError + n + end + calculate_stack_overflow_depth(2) +else + 16384 +end + +class DeterministicHash + + def initialize(value, hash) + @value = value + @hash = hash + end + + def to_s + @value.to_s + end + + def inspect + @value.inspect + end + + def hash + @hash + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/tasks/bundler.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/tasks/bundler.rb new file mode 100644 index 000000000..14cfe0b57 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/tasks/bundler.rb @@ -0,0 +1,2 @@ +require 'bundler' +Bundler::GemHelper.install_tasks diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/tasks/publish.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/tasks/publish.rb new file mode 100644 index 000000000..eade78a03 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/tasks/publish.rb @@ -0,0 +1,12 @@ +desc "Build and publish the latest gem" +task :publish do + require File.expand_path('../../lib/hamster/version', __FILE__) + + gem_name = "hamster-#{Hamster::VERSION}.gem" + + sh <<-CMD +gem build hamster.gemspec && +gem push #{gem_name} && +rm #{gem_name} +CMD +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/tasks/spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/tasks/spec.rb new file mode 100644 index 000000000..ac5cdd02a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/hamster-0.4.3/tasks/spec.rb @@ -0,0 +1,13 @@ +require 'rspec/core/rake_task' + +desc "Run specifications" +RSpec::Core::RakeTask.new(:spec) + +# task :spec do +# covered_threshold = 100 +# covered_percent = Float(File.read("coverage/covered_percent")) +# if covered_percent < covered_threshold +# $stderr.puts "" +# raise "Insufficient unit-test coverage (#{covered_percent} < #{covered_threshold})" +# end +# end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/.gitignore b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/.gitignore new file mode 100644 index 000000000..de31a456f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/.gitignore @@ -0,0 +1,2 @@ +doc +pkg diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/AUTHORS b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/AUTHORS new file mode 100644 index 000000000..b53016fd8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/AUTHORS @@ -0,0 +1,3 @@ +James Edward Gray II:: {james@grayproductions.net}[mailto:james@grayproductions.net] +Gregory Brown:: {gregory.t.brown@gmail.com}[mailto:gregory.t.brown@gmail.com] +Richard LeBer:: {richard.leber@gmail.com}[mailto:richard.leber@gmail.com] \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/CHANGELOG b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/CHANGELOG new file mode 100644 index 000000000..a6dbe4d72 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/CHANGELOG @@ -0,0 +1,357 @@ += Change Log + +Below is a complete listing of changes for each revision of HighLine. + +== 1.6.21 + +* Improved Windows integration (by Ronie Henrich). +* Clarified menu choice error messages (by Keith Bennett). + +== 1.6.20 + +* Fixed a bug with FFI::NCurses integration (by agentdave). +* Improved StringExtensions performance (by John Leach). +* Various JRuby fixes (by presidentbeef). + +== 1.6.19 + +* Fixed `terminal_size()` with jline2 (by presidentbeef). + +== 1.6.18 + +* Fixed a long supported interface that was accidentally broken with a recent change (by Rubem Nakamura Carneiro). + +== 1.6.17 + +* Added encoding support to menus (by David Lyons). +* Some minor fixes to SystemExtensions (by whiteleaf and presidentbeef). + +== 1.6.16 + +* Added the new indention feature (by davispuh). +* Separated auto-completion from the answer type (by davispuh). +* Improved JRuby support (by rsutphin). +* General code clean up (by stomar). +* Made HighLine#say() a little smarter with regard to color escapes (by Kenneth Murphy). + +== 1.6.15 + +* Added support for nil arguments in lists (by Eric Saxby). +* Fixed HighLine's termios integration (by Jens Wille). + +== 1.6.14 + +* Added JRuby 1.7 support (by Mina Nagy). +* Take into account color escape sequences when wrapping text (by Mark J. + Titorenko). + +== 1.6.13 + +* Removed unneeded Shebang lines (by Scott Gonyea). +* Protect the String passed to Question.new from modification (by michael). +* Added a retype-to-verify setting (by michael). + +== 1.6.12 + +* Silenced warnings (by James McEwan). + +== 1.6.11 + +* Fixed a bad test. (Fix by Diego Elio Pettenò.) + +== 1.6.10 + +* Fixed a regression that prevented asking for String arguments (by Jeffery + Sman.) +* Fixed a testing incompatibility (by Hans de Graaff.) + +== 1.6.9 + +* The new list modes now properly ignore escapes when sizing. +* Added a project gemspec file. +* Fixed a bug that prevented the use of termios (by tomdz). +* Switch to JLine to provide better echo support on JRuby (by tomdz). + +== 1.6.8 + +* Fix missing ERASE_CHAR reference (by Aaron Gifford). + +== 1.6.7 + +* Fixed bug introduced in 1.6.6 attempted fix (by Aaron Gifford). + +== 1.6.6 + +* Fixed old style references causing HighLine::String errors (by Aaron Gifford). + +== 1.6.5 + +* HighLine#list() now correctly handles empty lists (fix by Lachlan Dowding). +* HighLine#list() now supports :uneven_columns_across and + :uneven_columns_down modes. + +== 1.6.4 + +* Add introspection methods to color_scheme: definition, keys, to_hash. +* Add tests for new methods. + +== 1.6.3 + +* Add color NONE. +* Add RGB color capability. +* Made 'color' available as a class or instance method of HighLine, for + instance: HighLine.color("foo", :blue)) or highline_obj.color("foo", :blue) + are now both possible and equivalent. +* Add HighLine::String class with convenience methods: #color (alias + #foreground), #on (alias #background), colors, and styles. See + lib/string_extensions.rb. +* Add (optional) ability to extend String with the same convenience methods from + HighLine::String, using Highline.colorize_strings. + +== 1.6.2 + +* Correctly handle STDIN being closed before we receive any data (fix by + mleinart). +* Try if msvcrt, if we can't load crtdll on Windows (fix by pepijnve). +* A fix for nil_on_handled not running the action (reported by Andrew Davey). + +== 1.6.1 + +* Fixed raw_no_echo_mode so that it uses stty -icanon rather than cbreak + as cbreak does not appear to be the posixly correct argument. It fails + on Solaris if cbreak is used. +* Fixed an issue that kept Menu from showing the correct choices for + disambiguation. +* Removed a circular require that kept Ruby 1.9.2 from loading HighLine. +* Fixed a bug that caused infinite looping when wrapping text without spaces. +* Fixed it so that :auto paging accounts for the two lines it adds. +* On JRuby, improved error message about ffi-ncurses. Before 1.5.3, + HighLine was silently swallowing error messages when ffi-ncurses gem + was installed without ncurses present on the system. +* Reverted Aaron Simmons's patch to allow redirecting STDIN on Windows. This + is the only way we could find to restore HighLine's character reading to + working order. + +== 1.5.2 + +* Added support for using the ffi-ncurses gem which is supported in JRuby. +* Added gem build instructions. + +== 1.5.1 + +* Fixed the long standing echo true bug. + (reported by Lauri Tuominen) +* Improved Windows API calls to support the redirection of STDIN. + (patch by Aaron Simmons) +* Updated gem specification to avoid a deprecated call. +* Made a minor documentation clarification about character mode support. +* Worked around some API changes in Ruby's standard library in Ruby 1.9. + (patch by Jake Benilov) + +== 1.5.0 + +* Fixed a bug that would prevent Readline from showing all completions. + (reported by Yaohan Chen) +* Added the ability to pass a block to HighLine#agree(). + (patch by Yaohan Chen) + +== 1.4.0 + +* Made the code grabbing terminal size a little more cross-platform by + adding support for Solaris. (patch by Ronald Braswell and Coey Minear) + +== 1.2.9 + +* Additional work on the backspacing issue. (patch by Jeremy Hinegardner) +* Fixed Readline prompt bug. (patch by Jeremy Hinegardner) + +== 1.2.8 + +* Fixed backspacing past the prompt and interrupting a prompt bugs. + (patch by Jeremy Hinegardner) + +== 1.2.7 + +* Fixed the stty indent bug. +* Fixed the echo backspace bug. +* Added HighLine::track_eof=() setting to work are threaded eof?() calls. + +== 1.2.6 + +Patch by Jeremy Hinegardner: + +* Added ColorScheme support. +* Added HighLine::Question.overwrite mode. +* Various documentation fixes. + +== 1.2.5 + +* Really fixed the bug I tried to fix in 1.2.4. + +== 1.2.4 + +* Fixed a crash causing bug when using menus, reported by Patrick Hof. + +== 1.2.3 + +* Treat Cygwin like a Posix OS, instead of a native Windows environment. + +== 1.2.2 + +* Minor documentation corrections. +* Applied Thomas Werschleiln's patch to fix termio buffering on Solaris. +* Applied Justin Bailey's patch to allow canceling paged output. +* Fixed a documentation bug in the description of character case settings. +* Added a notice about termios in HighLine::Question#echo. +* Finally working around the infamous "fast typing" bug + +== 1.2.1 + +* Applied Justin Bailey's fix for the page_print() infinite loop bug. +* Made a SystemExtensions module to expose OS level functionality other + libraries may want to access. +* Publicly exposed the get_character() method, per user requests. +* Added terminal_size(), output_cols(), and output_rows() methods. +* Added :auto setting for warp_at=() and page_at=(). + +== 1.2.0 + +* Improved RubyForge and gem spec project descriptions. +* Added basic examples to README. +* Added a VERSION constant. +* Added support for hidden menu commands. +* Added Object.or_ask() when using highline/import. + +== 1.0.4 + +* Moved the HighLine project to Subversion. +* HighLine's color escapes can now be disabled. +* Fixed EOF bug introduced in the last release. +* Updated HighLine web page. +* Moved to a forked development/stable version numbering. + +== 1.0.2 + +* Removed old and broken help tests. +* Fixed test case typo found by David A. Black. +* Added ERb escapes processing to lists, for coloring list items. Color escapes + do not add to list element size. +* HighLine now throws EOFError when input is exhausted. + +== 1.0.1 + +* Minor bug fix: Moved help initialization to before response building, so help + would show up in the default responses. + +== 1.0.0 + +* Fixed documentation typo pointed out by Gavin Kistner. +* Added gather = ... option to question for fetching entire Arrays or + Hashes filled with answers. You can set +gather+ to a count of answers to + collect, a String or Regexp matching the end of input, or a Hash where each + key can be used in a new question. +* Added File support to HighLine.ask(). You can specify a _directory_ and a + _glob_ pattern that combine into a list of file choices the user can select + from. You can choose to receive the user's answer as an open filehandle or as + a Pathname object. +* Added Readline support for history and editing. +* Added tab completion for menu and file selection selection (requires + Readline). +* Added an optional character limit for input. +* Added a complete help system to HighLine's shell menu creation tools. + +== 0.6.1 + +* Removed termios dependancy in gem, to fix Windows' install. + +== 0.6.0 + +* Implemented HighLine.choose() for menu handling. + * Provided shortcut choose(item1, item2, ...) for simple menus. + * Allowed Ruby code to be attached to each menu item, to create a complete + menu solution. + * Provided for total customization of the menu layout. + * Allowed for menu selection by index, name or both. + * Added a _shell_ mode to allow menu selection with additional details + following the name. +* Added a list() utility method that can be invoked just like color(). It can + layout Arrays for you in any output in the modes :columns_across, + :columns_down, :inline and :rows +* Added support for echo = "*" style settings. User code can now + choose the echo character this way. +* Modified HighLine to user the "termios" library for character input, if + available. Will return to old behavior (using "stty"), if "termios" cannot be + loaded. +* Improved "stty" state restoring code. +* Fixed "stty" code to handle interrupt signals. +* Improved the default auto-complete error message and exposed this message + through the +responses+ interface as :no_completion. + +== 0.5.0 + +* Implemented echo = false for HighLine::Question objects, primarily to + make fetching passwords trivial. +* Fixed an auto-complete bug that could cause a crash when the user gave an + answer that didn't complete to any valid choice. +* Implemented +case+ for HighLine::Question objects to provide character case + conversions on given answers. Can be set to :up, :down, or + :capitalize. +* Exposed @answer to the response system, to allow response that are + aware of incorrect input. +* Implemented +confirm+ for HighLine::Question objects to allow for verification + for sensitive user choices. If set to +true+, user will have to answer an + "Are you sure? " question. Can also be set to the question to confirm with + the user. + +== 0.4.0 + +* Added @wrap_at and @page_at settings and accessors to + HighLine, to control text flow. +* Implemented line wrapping with adjustable limit. +* Implemented paged printing with adjustable limit. + +== 0.3.0 + +* Added support for installing with setup.rb. +* All output is now treated as an ERb sequence, allowing Ruby code to be + embedded in output strings. +* Added support for ANSI color sequences in say(). (And everything else + by extension.) +* Added whitespace handling for answers. Can be set to :strip, + :chomp, :collapse, :strip_and_collapse, + :chomp_and_collapse, :remove, or :none. +* Exposed question details to ERb completion through @question, to allow for + intelligent responses. +* Simplified HighLine internals using @question. +* Added support for fetching single character input either with getc() or + HighLine's own cross-platform terminal input routine. +* Improved type conversion to handle user defined classes. + +== 0.2.0 + +* Added Unit Tests to cover an already fixed output bug in the future. +* Added Rakefile and setup test action (default). +* Renamed HighLine::Answer to HighLine::Question to better illustrate its role. +* Renamed fetch_line() to get_response() to better define its goal. +* Simplified explain_error in terms of the Question object. +* Renamed accept?() to in_range?() to better define purpose. +* Reworked valid?() into valid_answer?() to better fit Question object. +* Reworked @member into @in, to make it easier to remember and + switched implementation to include?(). +* Added range checks for @above and @below. +* Fixed the bug causing ask() to swallow NoMethodErrors. +* Rolled ask_on_error() into responses. +* Redirected imports to Kernel from Object. +* Added support for validate = lambda { ... }. +* Added default answer support. +* Fixed bug that caused ask() to die with an empty question. +* Added complete documentation. +* Improve the implemetation of agree() to be the intended "yes" or "no" only + question. +* Added Rake tasks for documentation and packaging. +* Moved project to RubyForge. + +== 0.1.0 + +* Initial release as the solution to + {Ruby Quiz #29}[http://www.rubyquiz.com/quiz29.html]. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/COPYING b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/COPYING new file mode 100644 index 000000000..d60c31a97 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/COPYING @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/INSTALL b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/INSTALL new file mode 100644 index 000000000..01edf79b8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/INSTALL @@ -0,0 +1,55 @@ += Installing HighLine + +RubyGems is the preferred easy install method for HighLine. However, you can +install HighLine manually as described below. + +== Installing the Gem + +HighLine is intended to be installed via the +RubyGems[http://rubyforge.org/projects/rubygems/] system. To get the latest +version, simply enter the following into your command prompt: + + $ sudo gem install highline + +You must have RubyGems[http://rubyforge.org/projects/rubygems/] installed for +the above to work. + +If you want to build the gem locally, make sure you have +Rake[http://rubyforge.org/projects/rake/] installed then run the following +command: + + $ rake package + +== Installing Manually + +Download the latest version of HighLine from the +{RubyForge project page}[http://rubyforge.org/frs/?group_id=683]. Navigate to +the root project directory and enter: + + $ sudo ruby setup.rb + +== Installing HighLine on JRuby + +If you are using HighLine on JRuby, many features will not work properly +without a working ncurses installation. First, ensure that you have +ncurses installed and then install the ffi-ncurses gem. + +If ffi-ncurses fails to find your ncurses library, you may need to set the +RUBY_FFI_NCURSES envirionment variable, i.e: + + RUBY_FFI_NCURSES_LIB=ncursesw ruby examples/hello.rb + +For details, see the ffi-ncurses documentation at: +http://github.com/seanohalpin/ffi-ncurses + +== Using termios + +While not a requirement, HighLine will take advantage of the termios library if +installed (on Unix). This slightly improves HighLine's character reading +capabilities and thus is recommended for all Unix users. + +If using the HighLine gem, you should be able to add termios as easily as: + + $ sudo gem install termios + +For manual installs, consult the termios documentation. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/LICENSE b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/LICENSE new file mode 100644 index 000000000..ff6f232c8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/LICENSE @@ -0,0 +1,7 @@ += License Terms + +Distributed under the user's choice of the {GPL Version 2}[http://www.gnu.org/licenses/old-licenses/gpl-2.0.html] (see COPYING for details) or the +{Ruby software license}[http://www.ruby-lang.org/en/LICENSE.txt] by +James Edward Gray II and Greg Brown. + +Please email James[mailto:james@grayproductions.net] with any questions. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/README.rdoc b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/README.rdoc new file mode 100644 index 000000000..1d900291f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/README.rdoc @@ -0,0 +1,67 @@ += Read Me + +by James Edward Gray II + +== Description + +Welcome to HighLine. + +HighLine was designed to ease the tedious tasks of doing console input and +output with low-level methods like gets() and puts(). HighLine provides a +robust system for requesting data from a user, without needing to code all the +error checking and validation rules and without needing to convert the typed +Strings into what your program really needs. Just tell HighLine what you're +after, and let it do all the work. + +== Documentation + +See HighLine and HighLine::Question for documentation. + +Start hacking in your code with HighLine with: + + require 'highline/import' + +== Examples + +Basic usage: + + ask("Company? ") { |q| q.default = "none" } + +Validation: + + ask("Age? ", Integer) { |q| q.in = 0..105 } + ask("Name? (last, first) ") { |q| q.validate = /\A\w+, ?\w+\Z/ } + +Type conversion for answers: + + ask("Birthday? ", Date) + ask("Interests? (comma sep list) ", lambda { |str| str.split(/,\s*/) }) + +Reading passwords: + + ask("Enter your password: ") { |q| q.echo = false } + ask("Enter your password: ") { |q| q.echo = "x" } + +ERb based output (with HighLine's ANSI color tools): + + say("This should be <%= color('bold', BOLD) %>!") + +Menus: + + choose do |menu| + menu.prompt = "Please choose your favorite programming language? " + + menu.choice(:ruby) { say("Good choice!") } + menu.choices(:python, :perl) { say("Not from around here, are you?") } + end + +For more examples see the examples/ directory of this project. + +== Installing + +See the INSTALL file for instructions. + +== Questions and/or Comments + +Feel free to email {James Edward Gray II}[mailto:james@grayproductions.net] or +{Gregory Brown}[mailto:gregory.t.brown@gmail.com] with any questions. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/Rakefile new file mode 100644 index 000000000..a304ed2f0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/Rakefile @@ -0,0 +1,50 @@ +require "rdoc/task" +require "rake/testtask" +require "rubygems/package_task" + +require "rubygems" + +task :default => [:test] + +Rake::TestTask.new do |test| + test.libs << "test" + test.test_files = [ "test/ts_all.rb"] + test.verbose = true + test.ruby_opts << "-w" +end + +Rake::RDocTask.new do |rdoc| + rdoc.rdoc_files.include( "README.rdoc", "INSTALL", + "TODO", "CHANGELOG", + "AUTHORS", "COPYING", + "LICENSE", "lib/" ) + rdoc.main = "README.rdoc" + rdoc.rdoc_dir = "doc/html" + rdoc.title = "HighLine Documentation" +end + +desc "Upload current documentation to Rubyforge" +task :upload_docs => [:rdoc] do + sh "scp -r doc/html/* " + + "bbazzarrakk@rubyforge.org:/var/www/gforge-projects/highline/doc/" + sh "scp -r site/* " + + "bbazzarrakk@rubyforge.org:/var/www/gforge-projects/highline/" +end + +load(File.join(File.dirname(__FILE__), "highline.gemspec")) +Gem::PackageTask.new(SPEC) do |package| + # do nothing: I just need a gem but this block is required +end + +desc "Show library's code statistics" +task :stats do + require 'code_statistics' + CodeStatistics.new( ["HighLine", "lib"], + ["Functionals", "examples"], + ["Units", "test"] ).to_s +end + +desc "Add new files to Subversion" +task :add_to_svn do + sh %Q{svn status | ruby -nae 'system "svn add \#{$F[1]}" if $F[0] == "?"' } +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/TODO b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/TODO new file mode 100644 index 000000000..89c5306ed --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/TODO @@ -0,0 +1,6 @@ += To Do List + +The following is a list of planned expansions for HighLine, in no particular +order. + +* Rent this space. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/ansi_colors.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/ansi_colors.rb new file mode 100644 index 000000000..2a86e380c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/ansi_colors.rb @@ -0,0 +1,38 @@ +#!/usr/bin/env ruby + +# ansi_colors.rb +# +# Created by James Edward Gray II on 2005-05-03. +# Copyright 2005 Gray Productions. All rights reserved. + +require "rubygems" +require "highline/import" + +# Supported color sequences. +colors = %w{black red green yellow blue magenta cyan white} + +# Using color() with symbols. +colors.each_with_index do |c, i| + say("This should be <%= color('#{c}', :#{c}) %>!") + if i == 0 + say( "This should be " + + "<%= color('white on #{c}', :white, :on_#{c}) %>!") + else + say( "This should be " + + "<%= color( '#{colors[i - 1]} on #{c}', + :#{colors[i - 1]}, :on_#{c} ) %>!") + end +end + +# Using color with constants. +say("This should be <%= color('bold', BOLD) %>!") +say("This should be <%= color('underlined', UNDERLINE) %>!") + +# Using constants only. +say("This might even <%= BLINK %>blink<%= CLEAR %>!") + +# It even works with list wrapping. +erb_digits = %w{Zero One Two Three Four} + + ["<%= color('Five', :blue) %%>"] + + %w{Six Seven Eight Nine} +say("<%= list(#{erb_digits.inspect}, :columns_down, 3) %>") diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/asking_for_arrays.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/asking_for_arrays.rb new file mode 100644 index 000000000..64caeaf19 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/asking_for_arrays.rb @@ -0,0 +1,18 @@ +#!/usr/bin/env ruby + +# asking_for_arrays.rb +# +# Created by James Edward Gray II on 2005-07-05. +# Copyright 2005 Gray Productions. All rights reserved. + +require "rubygems" +require "highline/import" +require "pp" + +grades = ask( "Enter test scores (or a blank line to quit):", + lambda { |ans| ans =~ /^-?\d+$/ ? Integer(ans) : ans} ) do |q| + q.gather = "" +end + +say("Grades:") +pp grades diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/basic_usage.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/basic_usage.rb new file mode 100644 index 000000000..3f9b5aa4e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/basic_usage.rb @@ -0,0 +1,75 @@ +#!/usr/bin/env ruby + +# basic_usage.rb +# +# Created by James Edward Gray II on 2005-04-28. +# Copyright 2005 Gray Productions. All rights reserved. + +require "rubygems" +require "highline/import" +require "yaml" + +contacts = [ ] + +class NameClass + def self.parse( string ) + if string =~ /^\s*(\w+),\s*(\w+)\s*$/ + self.new($2, $1) + else + raise ArgumentError, "Invalid name format." + end + end + + def initialize(first, last) + @first, @last = first, last + end + + attr_reader :first, :last +end + +begin + entry = Hash.new + + # basic output + say("Enter a contact:") + + # basic input + entry[:name] = ask("Name? (last, first) ", NameClass) do |q| + q.validate = /\A\w+, ?\w+\Z/ + end + entry[:company] = ask("Company? ") { |q| q.default = "none" } + entry[:address] = ask("Address? ") + entry[:city] = ask("City? ") + entry[:state] = ask("State? ") do |q| + q.case = :up + q.validate = /\A[A-Z]{2}\Z/ + end + entry[:zip] = ask("Zip? ") do |q| + q.validate = /\A\d{5}(?:-?\d{4})?\Z/ + end + entry[:phone] = ask( "Phone? ", + lambda { |p| p.delete("^0-9"). + sub(/\A(\d{3})/, '(\1) '). + sub(/(\d{4})\Z/, '-\1') } ) do |q| + q.validate = lambda { |p| p.delete("^0-9").length == 10 } + q.responses[:not_valid] = "Enter a phone numer with area code." + end + entry[:age] = ask("Age? ", Integer) { |q| q.in = 0..105 } + entry[:birthday] = ask("Birthday? ", Date) + entry[:interests] = ask( "Interests? (comma separated list) ", + lambda { |str| str.split(/,\s*/) } ) + entry[:description] = ask("Enter a description for this contact.") do |q| + q.whitespace = :strip_and_collapse + end + + contacts << entry +# shortcut for yes and no questions +end while agree("Enter another contact? ", true) + +if agree("Save these contacts? ", true) + file_name = ask("Enter a file name: ") do |q| + q.validate = /\A\w+\Z/ + q.confirm = true + end + File.open("#{file_name}.yaml", "w") { |file| YAML.dump(contacts, file) } +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/color_scheme.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/color_scheme.rb new file mode 100644 index 000000000..1fe8863f8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/color_scheme.rb @@ -0,0 +1,32 @@ +#!/usr/bin/env ruby -w + +# color_scheme.rb +# +# Created by Jeremy Hinegardner on 2007-01-24 +# Copyright 2007 Jeremy Hinegardner. All rights reserved + +require 'rubygems' +require 'highline/import' + +# Create a color scheme, naming color patterns with symbol names. +ft = HighLine::ColorScheme.new do |cs| + cs[:headline] = [ :bold, :yellow, :on_black ] + cs[:horizontal_line] = [ :bold, :white, :on_blue] + cs[:even_row] = [ :green ] + cs[:odd_row] = [ :magenta ] + end + +# Assign that color scheme to HighLine... +HighLine.color_scheme = ft + +# ...and use it. +say("<%= color('Headline', :headline) %>") +say("<%= color('-'*20, :horizontal_line) %>") + +# Setup a toggle for rows. +i = true +("A".."D").each do |row| + row_color = i ? :even_row : :odd_row + say("<%= color('#{row}', '#{row_color}') %>") + i = !i +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/get_character.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/get_character.rb new file mode 100644 index 000000000..c22d41279 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/get_character.rb @@ -0,0 +1,12 @@ +#!/usr/bin/env ruby + +require "rubygems" +require "highline/import" + +choices = "ynaq" +answer = ask("Your choice [#{choices}]? ") do |q| + q.echo = false + q.character = true + q.validate = /\A[#{choices}]\Z/ + end +say("Your choice: #{answer}") diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/limit.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/limit.rb new file mode 100644 index 000000000..8b4d19055 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/limit.rb @@ -0,0 +1,12 @@ +#!/usr/bin/env ruby -w + +# limit.rb +# +# Created by James Edward Gray II on 2008-11-12. +# Copyright 2008 Gray Productions. All rights reserved. + +require "rubygems" +require "highline/import" + +text = ask("Enter text (max 10 chars): ") { |q| q.limit = 10 } +puts "You entered: #{text}!" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/menus.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/menus.rb new file mode 100644 index 000000000..c2bd5e397 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/menus.rb @@ -0,0 +1,65 @@ +#!/usr/bin/env ruby + +require "rubygems" +require "highline/import" + +# The old way, using ask() and say()... +choices = %w{ruby python perl} +say("This is the old way using ask() and say()...") +say("Please choose your favorite programming language:") +say(choices.map { |c| " #{c}\n" }.join) + +case ask("? ", choices) +when "ruby" + say("Good choice!") +else + say("Not from around here, are you?") +end + +# The new and improved choose()... +say("\nThis is the new mode (default)...") +choose do |menu| + menu.prompt = "Please choose your favorite programming language? " + + menu.choice :ruby do say("Good choice!") end + menu.choices(:python, :perl) do say("Not from around here, are you?") end +end + +say("\nThis is letter indexing...") +choose do |menu| + menu.index = :letter + menu.index_suffix = ") " + + menu.prompt = "Please choose your favorite programming language? " + + menu.choice :ruby do say("Good choice!") end + menu.choices(:python, :perl) do say("Not from around here, are you?") end +end + +say("\nThis is with a different layout...") +choose do |menu| + menu.layout = :one_line + + menu.header = "Languages" + menu.prompt = "Favorite? " + + menu.choice :ruby do say("Good choice!") end + menu.choices(:python, :perl) do say("Not from around here, are you?") end +end + +say("\nYou can even build shells...") +loop do + choose do |menu| + menu.layout = :menu_only + + menu.shell = true + + menu.choice(:load, "Load a file.") do |command, details| + say("Loading file with options: #{details}...") + end + menu.choice(:save, "Save a file.") do |command, details| + say("Saving file with options: #{details}...") + end + menu.choice(:quit, "Exit program.") { exit } + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/overwrite.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/overwrite.rb new file mode 100644 index 000000000..04f3d8b62 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/overwrite.rb @@ -0,0 +1,19 @@ +#!/usr/bin/env ruby + +# overwrite.rb +# +# Created by Jeremy Hinegardner on 2007-01-24 +# Copyright 2007 Jeremy Hinegardner. All rights reserved + +require 'rubygems' +require 'highline/import' + +prompt = "here is your password:" +ask( + "#{prompt} <%= color('mypassword', RED, BOLD) %> (Press Any Key to blank) " +) do |q| + q.overwrite = true + q.echo = false # overwrite works best when echo is false. + q.character = true # if this is set to :getc then overwrite does not work +end +say("<%= color('Look! blanked out!', GREEN) %>") diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/page_and_wrap.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/page_and_wrap.rb new file mode 100644 index 000000000..25cd6ef9d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/page_and_wrap.rb @@ -0,0 +1,322 @@ +#!/usr/bin/env ruby + +# page_and_wrap.rb +# +# Created by James Edward Gray II on 2005-05-07. +# Copyright 2005 Gray Productions. All rights reserved. + +require "rubygems" +require "highline/import" + +$terminal.wrap_at = 80 +$terminal.page_at = 22 + +say(<: ") do |q| + q.echo = '*' + q.verify_match = true + q.gather = {"Enter a password" => '', + "Please type it again for verification" => ''} +end + +puts "Your password is now #{pass}!" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/trapping_eof.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/trapping_eof.rb new file mode 100644 index 000000000..a63188c93 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/trapping_eof.rb @@ -0,0 +1,22 @@ +#!/usr/bin/env ruby + +# trapping_eof.rb +# +# Created by James Edward Gray II on 2006-02-20. +# Copyright 2006 Gray Productions. All rights reserved. + +require "rubygems" +require "highline/import" + +loop do + begin + name = ask("What's your name?") + break if name == "exit" + puts "Hello, #{name}!" + rescue EOFError # HighLine throws this if @input.eof? + break + end +end + +puts "Goodbye, dear friend." +exit diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/using_readline.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/using_readline.rb new file mode 100644 index 000000000..d8c072af2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/examples/using_readline.rb @@ -0,0 +1,17 @@ +#!/usr/bin/env ruby + +# using_readline.rb +# +# Created by James Edward Gray II on 2005-07-06. +# Copyright 2005 Gray Productions. All rights reserved. + +require "rubygems" +require "highline/import" + +loop do + cmd = ask("Enter command: ", %w{save sample load reset quit}) do |q| + q.readline = true + end + say("Executing \"#{cmd}\"...") + break if cmd == "quit" +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/highline.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/highline.gemspec new file mode 100644 index 000000000..51a759485 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/highline.gemspec @@ -0,0 +1,37 @@ +DIR = File.dirname(__FILE__) +LIB = File.join(DIR, *%w[lib highline.rb]) +GEM_VERSION = open(LIB) { |lib| + lib.each { |line| + if v = line[/^\s*VERSION\s*=\s*(['"])(\d+\.\d+\.\d+)\1/, 2] + break v + end + } +} + +SPEC = Gem::Specification.new do |spec| + spec.name = "highline" + spec.version = GEM_VERSION + spec.platform = Gem::Platform::RUBY + spec.summary = "HighLine is a high-level command-line IO library." + spec.files = `git ls-files`.split("\n") + + spec.test_files = `git ls-files -- test/*.rb`.split("\n") + spec.has_rdoc = true + spec.extra_rdoc_files = %w[README.rdoc INSTALL TODO CHANGELOG LICENSE] + spec.rdoc_options << '--title' << 'HighLine Documentation' << + '--main' << 'README' + + spec.require_path = 'lib' + + spec.author = "James Edward Gray II" + spec.email = "james@graysoftinc.com" + spec.rubyforge_project = "highline" + spec.homepage = "http://highline.rubyforge.org" + spec.license = "Ruby" + spec.description = <:erase_line, :builtin=>true, :code=>"\e[K") # Erase the current line of terminal output + ERASE_CHAR_STYLE = Style.new(:name=>:erase_char, :builtin=>true, :code=>"\e[P") # Erase the character under the cursor. + CLEAR_STYLE = Style.new(:name=>:clear, :builtin=>true, :code=>"\e[0m") # Clear color settings + RESET_STYLE = Style.new(:name=>:reset, :builtin=>true, :code=>"\e[0m") # Alias for CLEAR. + BOLD_STYLE = Style.new(:name=>:bold, :builtin=>true, :code=>"\e[1m") # Bold; Note: bold + a color works as you'd expect, + # for example bold black. Bold without a color displays + # the system-defined bold color (e.g. red on Mac iTerm) + DARK_STYLE = Style.new(:name=>:dark, :builtin=>true, :code=>"\e[2m") # Dark; support uncommon + UNDERLINE_STYLE = Style.new(:name=>:underline, :builtin=>true, :code=>"\e[4m") # Underline + UNDERSCORE_STYLE = Style.new(:name=>:underscore, :builtin=>true, :code=>"\e[4m") # Alias for UNDERLINE + BLINK_STYLE = Style.new(:name=>:blink, :builtin=>true, :code=>"\e[5m") # Blink; support uncommon + REVERSE_STYLE = Style.new(:name=>:reverse, :builtin=>true, :code=>"\e[7m") # Reverse foreground and background + CONCEALED_STYLE = Style.new(:name=>:concealed, :builtin=>true, :code=>"\e[8m") # Concealed; support uncommon + + STYLES = %w{CLEAR RESET BOLD DARK UNDERLINE UNDERSCORE BLINK REVERSE CONCEALED} + + # These RGB colors are approximate; see http://en.wikipedia.org/wiki/ANSI_escape_code + BLACK_STYLE = Style.new(:name=>:black, :builtin=>true, :code=>"\e[30m", :rgb=>[ 0, 0, 0]) + RED_STYLE = Style.new(:name=>:red, :builtin=>true, :code=>"\e[31m", :rgb=>[128, 0, 0]) + GREEN_STYLE = Style.new(:name=>:green, :builtin=>true, :code=>"\e[32m", :rgb=>[ 0,128, 0]) + BLUE_STYLE = Style.new(:name=>:blue, :builtin=>true, :code=>"\e[34m", :rgb=>[ 0, 0,128]) + YELLOW_STYLE = Style.new(:name=>:yellow, :builtin=>true, :code=>"\e[33m", :rgb=>[128,128, 0]) + MAGENTA_STYLE = Style.new(:name=>:magenta, :builtin=>true, :code=>"\e[35m", :rgb=>[128, 0,128]) + CYAN_STYLE = Style.new(:name=>:cyan, :builtin=>true, :code=>"\e[36m", :rgb=>[ 0,128,128]) + # On Mac OSX Terminal, white is actually gray + WHITE_STYLE = Style.new(:name=>:white, :builtin=>true, :code=>"\e[37m", :rgb=>[192,192,192]) + # Alias for WHITE, since WHITE is actually a light gray on Macs + GRAY_STYLE = Style.new(:name=>:gray, :builtin=>true, :code=>"\e[37m", :rgb=>[192,192,192]) + # On Mac OSX Terminal, this is black foreground, or bright white background. + # Also used as base for RGB colors, if available + NONE_STYLE = Style.new(:name=>:none, :builtin=>true, :code=>"\e[38m", :rgb=>[ 0, 0, 0]) + + BASIC_COLORS = %w{BLACK RED GREEN YELLOW BLUE MAGENTA CYAN WHITE GRAY NONE} + + colors = BASIC_COLORS.dup + BASIC_COLORS.each do |color| + bright_color = "BRIGHT_#{color}" + colors << bright_color + const_set bright_color+'_STYLE', const_get(color + '_STYLE').bright + end + COLORS = colors + + colors.each do |color| + const_set color, const_get("#{color}_STYLE").code + const_set "ON_#{color}_STYLE", const_get("#{color}_STYLE").on + const_set "ON_#{color}", const_get("ON_#{color}_STYLE").code + end + ON_NONE_STYLE.rgb = [255,255,255] # Override; white background + + STYLES.each do |style| + const_set style, const_get("#{style}_STYLE").code + end + + # For RGB colors: + def self.const_missing(name) + if name.to_s =~ /^(ON_)?(RGB_)([A-F0-9]{6})(_STYLE)?$/ # RGB color + on = $1 + suffix = $4 + if suffix + code_name = $1.to_s + $2 + $3 + else + code_name = name.to_s + end + style_name = code_name + '_STYLE' + style = Style.rgb($3) + style = style.on if on + const_set(style_name, style) + const_set(code_name, style.code) + if suffix + style + else + style.code + end + else + raise NameError, "Bad color or uninitialized constant #{name}" + end + end + + # + # Create an instance of HighLine, connected to the streams _input_ + # and _output_. + # + def initialize( input = $stdin, output = $stdout, + wrap_at = nil, page_at = nil, indent_size=3, indent_level=0 ) + @input = input + @output = output + + @multi_indent = true + @indent_size = indent_size + @indent_level = indent_level + + self.wrap_at = wrap_at + self.page_at = page_at + + @question = nil + @answer = nil + @menu = nil + @header = nil + @prompt = nil + @gather = nil + @answers = nil + @key = nil + + initialize_system_extensions if respond_to?(:initialize_system_extensions) + end + + include HighLine::SystemExtensions + + # The current column setting for wrapping output. + attr_reader :wrap_at + # The current row setting for paging output. + attr_reader :page_at + # Indentation over multiple lines + attr_accessor :multi_indent + # The indentation size + attr_accessor :indent_size + # The indentation level + attr_accessor :indent_level + + # + # A shortcut to HighLine.ask() a question that only accepts "yes" or "no" + # answers ("y" and "n" are allowed) and returns +true+ or +false+ + # (+true+ for "yes"). If provided a +true+ value, _character_ will cause + # HighLine to fetch a single character response. A block can be provided + # to further configure the question as in HighLine.ask() + # + # Raises EOFError if input is exhausted. + # + def agree( yes_or_no_question, character = nil ) + ask(yes_or_no_question, lambda { |yn| yn.downcase[0] == ?y}) do |q| + q.validate = /\Ay(?:es)?|no?\Z/i + q.responses[:not_valid] = 'Please enter "yes" or "no".' + q.responses[:ask_on_error] = :question + q.character = character + + yield q if block_given? + end + end + + # + # This method is the primary interface for user input. Just provide a + # _question_ to ask the user, the _answer_type_ you want returned, and + # optionally a code block setting up details of how you want the question + # handled. See HighLine.say() for details on the format of _question_, and + # HighLine::Question for more information about _answer_type_ and what's + # valid in the code block. + # + # If @question is set before ask() is called, parameters are + # ignored and that object (must be a HighLine::Question) is used to drive + # the process instead. + # + # Raises EOFError if input is exhausted. + # + def ask( question, answer_type = String, &details ) # :yields: question + @question ||= Question.new(question, answer_type, &details) + + return gather if @question.gather + + # readline() needs to handle its own output, but readline only supports + # full line reading. Therefore if @question.echo is anything but true, + # the prompt will not be issued. And we have to account for that now. + # Also, JRuby-1.7's ConsoleReader.readLine() needs to be passed the prompt + # to handle line editing properly. + say(@question) unless ((JRUBY or @question.readline) and @question.echo == true) + + begin + @answer = @question.answer_or_default(get_response) + unless @question.valid_answer?(@answer) + explain_error(:not_valid) + raise QuestionError + end + + @answer = @question.convert(@answer) + + if @question.in_range?(@answer) + if @question.confirm + # need to add a layer of scope to ask a question inside a + # question, without destroying instance data + context_change = self.class.new(@input, @output, @wrap_at, @page_at, @indent_size, @indent_level) + if @question.confirm == true + confirm_question = "Are you sure? " + else + # evaluate ERb under initial scope, so it will have + # access to @question and @answer + template = ERB.new(@question.confirm, nil, "%") + confirm_question = template.result(binding) + end + unless context_change.agree(confirm_question) + explain_error(nil) + raise QuestionError + end + end + + @answer + else + explain_error(:not_in_range) + raise QuestionError + end + rescue QuestionError + retry + rescue ArgumentError, NameError => error + raise if error.is_a?(NoMethodError) + if error.message =~ /ambiguous/ + # the assumption here is that OptionParser::Completion#complete + # (used for ambiguity resolution) throws exceptions containing + # the word 'ambiguous' whenever resolution fails + explain_error(:ambiguous_completion) + else + explain_error(:invalid_type) + end + retry + rescue Question::NoAutoCompleteMatch + explain_error(:no_completion) + retry + ensure + @question = nil # Reset Question object. + end + end + + # + # This method is HighLine's menu handler. For simple usage, you can just + # pass all the menu items you wish to display. At that point, choose() will + # build and display a menu, walk the user through selection, and return + # their choice among the provided items. You might use this in a case + # statement for quick and dirty menus. + # + # However, choose() is capable of much more. If provided, a block will be + # passed a HighLine::Menu object to configure. Using this method, you can + # customize all the details of menu handling from index display, to building + # a complete shell-like menuing system. See HighLine::Menu for all the + # methods it responds to. + # + # Raises EOFError if input is exhausted. + # + def choose( *items, &details ) + @menu = @question = Menu.new(&details) + @menu.choices(*items) unless items.empty? + + # Set auto-completion + @menu.completion = @menu.options + # Set _answer_type_ so we can double as the Question for ask(). + @menu.answer_type = if @menu.shell + lambda do |command| # shell-style selection + first_word = command.to_s.split.first || "" + + options = @menu.options + options.extend(OptionParser::Completion) + answer = options.complete(first_word) + + if answer.nil? + raise Question::NoAutoCompleteMatch + end + + [answer.last, command.sub(/^\s*#{first_word}\s*/, "")] + end + else + @menu.options # normal menu selection, by index or name + end + + # Provide hooks for ERb layouts. + @header = @menu.header + @prompt = @menu.prompt + + if @menu.shell + selected = ask("Ignored", @menu.answer_type) + @menu.select(self, *selected) + else + selected = ask("Ignored", @menu.answer_type) + @menu.select(self, selected) + end + end + + # + # This method provides easy access to ANSI color sequences, without the user + # needing to remember to CLEAR at the end of each sequence. Just pass the + # _string_ to color, followed by a list of _colors_ you would like it to be + # affected by. The _colors_ can be HighLine class constants, or symbols + # (:blue for BLUE, for example). A CLEAR will automatically be embedded to + # the end of the returned String. + # + # This method returns the original _string_ unchanged if HighLine::use_color? + # is +false+. + # + def self.color( string, *colors ) + return string unless self.use_color? + Style(*colors).color(string) + end + + # In case you just want the color code, without the embedding and the CLEAR + def self.color_code(*colors) + Style(*colors).code + end + + # Works as an instance method, same as the class method + def color_code(*colors) + self.class.color_code(*colors) + end + + # Works as an instance method, same as the class method + def color(*args) + self.class.color(*args) + end + + # Remove color codes from a string + def self.uncolor(string) + Style.uncolor(string) + end + + # Works as an instance method, same as the class method + def uncolor(string) + self.class.uncolor(string) + end + + # + # This method is a utility for quickly and easily laying out lists. It can + # be accessed within ERb replacements of any text that will be sent to the + # user. + # + # The only required parameter is _items_, which should be the Array of items + # to list. A specified _mode_ controls how that list is formed and _option_ + # has different effects, depending on the _mode_. Recognized modes are: + # + # :columns_across:: _items_ will be placed in columns, + # flowing from left to right. If given, + # _option_ is the number of columns to be + # used. When absent, columns will be + # determined based on _wrap_at_ or a + # default of 80 characters. + # :columns_down:: Identical to :columns_across, + # save flow goes down. + # :uneven_columns_across:: Like :columns_across but each + # column is sized independently. + # :uneven_columns_down:: Like :columns_down but each + # column is sized independently. + # :inline:: All _items_ are placed on a single line. + # The last two _items_ are separated by + # _option_ or a default of " or ". All + # other _items_ are separated by ", ". + # :rows:: The default mode. Each of the _items_ is + # placed on its own line. The _option_ + # parameter is ignored in this mode. + # + # Each member of the _items_ Array is passed through ERb and thus can contain + # their own expansions. Color escape expansions do not contribute to the + # final field width. + # + def list( items, mode = :rows, option = nil ) + items = items.to_ary.map do |item| + if item.nil? + "" + else + ERB.new(item, nil, "%").result(binding) + end + end + + if items.empty? + "" + else + case mode + when :inline + option = " or " if option.nil? + + if items.size == 1 + items.first + else + items[0..-2].join(", ") + "#{option}#{items.last}" + end + when :columns_across, :columns_down + max_length = actual_length( + items.max { |a, b| actual_length(a) <=> actual_length(b) } + ) + + if option.nil? + limit = @wrap_at || 80 + option = (limit + 2) / (max_length + 2) + end + + items = items.map do |item| + pad = max_length + (item.to_s.length - actual_length(item)) + "%-#{pad}s" % item + end + row_count = (items.size / option.to_f).ceil + + if mode == :columns_across + rows = Array.new(row_count) { Array.new } + items.each_with_index do |item, index| + rows[index / option] << item + end + + rows.map { |row| row.join(" ") + "\n" }.join + else + columns = Array.new(option) { Array.new } + items.each_with_index do |item, index| + columns[index / row_count] << item + end + + list = "" + columns.first.size.times do |index| + list << columns.map { |column| column[index] }. + compact.join(" ") + "\n" + end + list + end + when :uneven_columns_across + if option.nil? + limit = @wrap_at || 80 + items.size.downto(1) do |column_count| + row_count = (items.size / column_count.to_f).ceil + rows = Array.new(row_count) { Array.new } + items.each_with_index do |item, index| + rows[index / column_count] << item + end + + widths = Array.new(column_count, 0) + rows.each do |row| + row.each_with_index do |field, column| + size = actual_length(field) + widths[column] = size if size > widths[column] + end + end + + if column_count == 1 or + widths.inject(0) { |sum, n| sum + n + 2 } <= limit + 2 + return rows.map { |row| + row.zip(widths).map { |field, i| + "%-#{i + (field.to_s.length - actual_length(field))}s" % field + }.join(" ") + "\n" + }.join + end + end + else + row_count = (items.size / option.to_f).ceil + rows = Array.new(row_count) { Array.new } + items.each_with_index do |item, index| + rows[index / option] << item + end + + widths = Array.new(option, 0) + rows.each do |row| + row.each_with_index do |field, column| + size = actual_length(field) + widths[column] = size if size > widths[column] + end + end + + return rows.map { |row| + row.zip(widths).map { |field, i| + "%-#{i + (field.to_s.length - actual_length(field))}s" % field + }.join(" ") + "\n" + }.join + end + when :uneven_columns_down + if option.nil? + limit = @wrap_at || 80 + items.size.downto(1) do |column_count| + row_count = (items.size / column_count.to_f).ceil + columns = Array.new(column_count) { Array.new } + items.each_with_index do |item, index| + columns[index / row_count] << item + end + + widths = Array.new(column_count, 0) + columns.each_with_index do |column, i| + column.each do |field| + size = actual_length(field) + widths[i] = size if size > widths[i] + end + end + + if column_count == 1 or + widths.inject(0) { |sum, n| sum + n + 2 } <= limit + 2 + list = "" + columns.first.size.times do |index| + list << columns.zip(widths).map { |column, width| + field = column[index] + "%-#{width + (field.to_s.length - actual_length(field))}s" % + field + }.compact.join(" ").strip + "\n" + end + return list + end + end + else + row_count = (items.size / option.to_f).ceil + columns = Array.new(option) { Array.new } + items.each_with_index do |item, index| + columns[index / row_count] << item + end + + widths = Array.new(option, 0) + columns.each_with_index do |column, i| + column.each do |field| + size = actual_length(field) + widths[i] = size if size > widths[i] + end + end + + list = "" + columns.first.size.times do |index| + list << columns.zip(widths).map { |column, width| + field = column[index] + "%-#{width + (field.to_s.length - actual_length(field))}s" % field + }.compact.join(" ").strip + "\n" + end + return list + end + else + items.map { |i| "#{i}\n" }.join + end + end + end + + # + # The basic output method for HighLine objects. If the provided _statement_ + # ends with a space or tab character, a newline will not be appended (output + # will be flush()ed). All other cases are passed straight to Kernel.puts(). + # + # The _statement_ parameter is processed as an ERb template, supporting + # embedded Ruby code. The template is evaluated with a binding inside + # the HighLine instance, providing easy access to the ANSI color constants + # and the HighLine.color() method. + # + def say( statement ) + statement = format_statement(statement) + return unless statement.length > 0 + + # Don't add a newline if statement ends with whitespace, OR + # if statement ends with whitespace before a color escape code. + if /[ \t](\e\[\d+(;\d+)*m)?\Z/ =~ statement + @output.print(indentation+statement) + @output.flush + else + @output.puts(indentation+statement) + end + end + + # + # Set to an integer value to cause HighLine to wrap output lines at the + # indicated character limit. When +nil+, the default, no wrapping occurs. If + # set to :auto, HighLine will attempt to determine the columns + # available for the @output or use a sensible default. + # + def wrap_at=( setting ) + @wrap_at = setting == :auto ? output_cols : setting + end + + # + # Set to an integer value to cause HighLine to page output lines over the + # indicated line limit. When +nil+, the default, no paging occurs. If + # set to :auto, HighLine will attempt to determine the rows available + # for the @output or use a sensible default. + # + def page_at=( setting ) + @page_at = setting == :auto ? output_rows - 2 : setting + end + + # + # Outputs indentation with current settings + # + def indentation + return ' '*@indent_size*@indent_level + end + + # + # Executes block or outputs statement with indentation + # + def indent(increase=1, statement=nil, multiline=nil) + @indent_level += increase + multi = @multi_indent + @multi_indent = multiline unless multiline.nil? + begin + if block_given? + yield self + else + say(statement) + end + rescue + @multi_indent = multi + @indent_level -= increase + raise + end + @multi_indent = multi + @indent_level -= increase + end + + # + # Outputs newline + # + def newline + @output.puts + end + + # + # Returns the number of columns for the console, or a default it they cannot + # be determined. + # + def output_cols + return 80 unless @output.tty? + terminal_size.first + rescue + return 80 + end + + # + # Returns the number of rows for the console, or a default if they cannot be + # determined. + # + def output_rows + return 24 unless @output.tty? + terminal_size.last + rescue + return 24 + end + + private + + def format_statement statement + statement = statement.dup.to_str + return statement unless statement.length > 0 + + # Allow non-ascii menu prompts in ruby > 1.9.2. ERB eval the menu statement + # with the environment's default encoding(usually utf8) + statement.force_encoding(Encoding.default_external) if defined?(Encoding) && Encoding.default_external + + template = ERB.new(statement, nil, "%") + statement = template.result(binding) + + statement = wrap(statement) unless @wrap_at.nil? + statement = page_print(statement) unless @page_at.nil? + + statement = statement.gsub(/\n(?!$)/,"\n#{indentation}") if @multi_indent + + statement + end + + # + # A helper method for sending the output stream and error and repeat + # of the question. + # + def explain_error( error ) + say(@question.responses[error]) unless error.nil? + if @question.responses[:ask_on_error] == :question + say(@question) + elsif @question.responses[:ask_on_error] + say(@question.responses[:ask_on_error]) + end + end + + # + # Collects an Array/Hash full of answers as described in + # HighLine::Question.gather(). + # + # Raises EOFError if input is exhausted. + # + def gather( ) + original_question = @question + original_question_string = @question.question + original_gather = @question.gather + + verify_match = @question.verify_match + @question.gather = false + + begin # when verify_match is set this loop will repeat until unique_answers == 1 + @answers = [ ] + @gather = original_gather + original_question.question = original_question_string + + case @gather + when Integer + @answers << ask(@question) + @gather -= 1 + + original_question.question = "" + until @gather.zero? + @question = original_question + @answers << ask(@question) + @gather -= 1 + end + when ::String, Regexp + @answers << ask(@question) + + original_question.question = "" + until (@gather.is_a?(::String) and @answers.last.to_s == @gather) or + (@gather.is_a?(Regexp) and @answers.last.to_s =~ @gather) + @question = original_question + @answers << ask(@question) + end + + @answers.pop + when Hash + @answers = { } + @gather.keys.sort.each do |key| + @question = original_question + @key = key + @answers[key] = ask(@question) + end + end + + if verify_match && (unique_answers(@answers).size > 1) + @question = original_question + explain_error(:mismatch) + else + verify_match = false + end + + end while verify_match + + original_question.verify_match ? @answer : @answers + end + + # + # A helper method used by HighLine::Question.verify_match + # for finding whether a list of answers match or differ + # from each other. + # + def unique_answers(list = @answers) + (list.respond_to?(:values) ? list.values : list).uniq + end + + # + # Read a line of input from the input stream and process whitespace as + # requested by the Question object. + # + # If Question's _readline_ property is set, that library will be used to + # fetch input. *WARNING*: This ignores the currently set input stream. + # + # Raises EOFError if input is exhausted. + # + def get_line( ) + if @question.readline + require "readline" # load only if needed + + # capture say()'s work in a String to feed to readline() + old_output = @output + @output = StringIO.new + say(@question) + question = @output.string + @output = old_output + + # prep auto-completion + Readline.completion_proc = lambda do |string| + @question.selection.grep(/\A#{Regexp.escape(string)}/) + end + + # work-around ugly readline() warnings + old_verbose = $VERBOSE + $VERBOSE = nil + raw_answer = Readline.readline(question, true) + if raw_answer.nil? + if @@track_eof + raise EOFError, "The input stream is exhausted." + else + raw_answer = String.new # Never return nil + end + end + answer = @question.change_case( + @question.remove_whitespace(raw_answer)) + $VERBOSE = old_verbose + + answer + else + if JRUBY + statement = format_statement(@question) + raw_answer = @java_console.readLine(statement, nil) + + raise EOFError, "The input stream is exhausted." if raw_answer.nil? and + @@track_eof + else + raise EOFError, "The input stream is exhausted." if @@track_eof and + @input.eof? + raw_answer = @input.gets + end + + @question.change_case(@question.remove_whitespace(raw_answer)) + end + end + + # + # Return a line or character of input, as requested for this question. + # Character input will be returned as a single character String, + # not an Integer. + # + # This question's _first_answer_ will be returned instead of input, if set. + # + # Raises EOFError if input is exhausted. + # + def get_response( ) + return @question.first_answer if @question.first_answer? + + if @question.character.nil? + if @question.echo == true and @question.limit.nil? + get_line + else + raw_no_echo_mode + + line = "" + backspace_limit = 0 + begin + + while character = get_character(@input) + # honor backspace and delete + if character == 127 or character == 8 + line.slice!(-1, 1) + backspace_limit -= 1 + else + line << character.chr + backspace_limit = line.size + end + # looking for carriage return (decimal 13) or + # newline (decimal 10) in raw input + break if character == 13 or character == 10 + if @question.echo != false + if character == 127 or character == 8 + # only backspace if we have characters on the line to + # eliminate, otherwise we'll tromp over the prompt + if backspace_limit >= 0 then + @output.print("\b#{HighLine.Style(:erase_char).code}") + else + # do nothing + end + else + if @question.echo == true + @output.print(character.chr) + else + @output.print(@question.echo) + end + end + @output.flush + end + break if @question.limit and line.size == @question.limit + end + ensure + restore_mode + end + if @question.overwrite + @output.print("\r#{HighLine.Style(:erase_line).code}") + @output.flush + else + say("\n") + end + + @question.change_case(@question.remove_whitespace(line)) + end + else + if JRUBY #prompt has not been shown + say @question + end + + raw_no_echo_mode + begin + if @question.character == :getc + response = @input.getbyte.chr + else + response = get_character(@input).chr + if @question.overwrite + @output.print("\r#{HighLine.Style(:erase_line).code}") + @output.flush + else + echo = if @question.echo == true + response + elsif @question.echo != false + @question.echo + else + "" + end + say("#{echo}\n") + end + end + ensure + restore_mode + end + @question.change_case(response) + end + end + + # + # Page print a series of at most _page_at_ lines for _output_. After each + # page is printed, HighLine will pause until the user presses enter/return + # then display the next page of data. + # + # Note that the final page of _output_ is *not* printed, but returned + # instead. This is to support any special handling for the final sequence. + # + def page_print( output ) + lines = output.scan(/[^\n]*\n?/) + while lines.size > @page_at + @output.puts lines.slice!(0...@page_at).join + @output.puts + # Return last line if user wants to abort paging + return (["...\n"] + lines.slice(-2,1)).join unless continue_paging? + end + return lines.join + end + + # + # Ask user if they wish to continue paging output. Allows them to type "q" to + # cancel the paging process. + # + def continue_paging? + command = HighLine.new(@input, @output).ask( + "-- press enter/return to continue or q to stop -- " + ) { |q| q.character = true } + command !~ /\A[qQ]\Z/ # Only continue paging if Q was not hit. + end + + # + # Wrap a sequence of _lines_ at _wrap_at_ characters per line. Existing + # newlines will not be affected by this process, but additional newlines + # may be added. + # + def wrap( text ) + wrapped = [ ] + text.each_line do |line| + # take into account color escape sequences when wrapping + wrap_at = @wrap_at + (line.length - actual_length(line)) + while line =~ /([^\n]{#{wrap_at + 1},})/ + search = $1.dup + replace = $1.dup + if index = replace.rindex(" ", wrap_at) + replace[index, 1] = "\n" + replace.sub!(/\n[ \t]+/, "\n") + line.sub!(search, replace) + else + line[$~.begin(1) + wrap_at, 0] = "\n" + end + end + wrapped << line + end + return wrapped.join + end + + # + # Returns the length of the passed +string_with_escapes+, minus and color + # sequence escapes. + # + def actual_length( string_with_escapes ) + string_with_escapes.to_s.gsub(/\e\[\d{1,2}m/, "").length + end +end + +require "highline/string_extensions" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/color_scheme.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/color_scheme.rb new file mode 100644 index 000000000..601781fc7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/color_scheme.rb @@ -0,0 +1,134 @@ +# color_scheme.rb +# +# Created by Jeremy Hinegardner on 2007-01-24 +# Copyright 2007. All rights reserved +# +# This is Free Software. See LICENSE and COPYING for details + +class HighLine + # + # ColorScheme objects encapsulate a named set of colors to be used in the + # HighLine.colors() method call. For example, by applying a ColorScheme that + # has a :warning color then the following could be used: + # + # colors("This is a warning", :warning) + # + # A ColorScheme contains named sets of HighLine color constants. + # + # Example: Instantiating a color scheme, applying it to HighLine, + # and using it: + # + # ft = HighLine::ColorScheme.new do |cs| + # cs[:headline] = [ :bold, :yellow, :on_black ] + # cs[:horizontal_line] = [ :bold, :white ] + # cs[:even_row] = [ :green ] + # cs[:odd_row] = [ :magenta ] + # end + # + # HighLine.color_scheme = ft + # say("<%= color('Headline', :headline) %>") + # say("<%= color('-'*20, :horizontal_line) %>") + # i = true + # ("A".."D").each do |row| + # if i then + # say("<%= color('#{row}', :even_row ) %>") + # else + # say("<%= color('#{row}', :odd_row) %>") + # end + # i = !i + # end + # + # + class ColorScheme + # + # Create an instance of HighLine::ColorScheme. The customization can + # happen as a passed in Hash or via the yielded block. Keys are + # converted to :symbols and values are converted to HighLine + # constants. + # + def initialize( h = nil ) + @scheme = Hash.new + load_from_hash(h) unless h.nil? + yield self if block_given? + end + + # Load multiple colors from key/value pairs. + def load_from_hash( h ) + h.each_pair do |color_tag, constants| + self[color_tag] = constants + end + end + + # Does this color scheme include the given tag name? + def include?( color_tag ) + @scheme.keys.include?(to_symbol(color_tag)) + end + + # Allow the scheme to be accessed like a Hash. + def []( color_tag ) + @scheme[to_symbol(color_tag)] + end + + # Retrieve the original form of the scheme + def definition( color_tag ) + style = @scheme[to_symbol(color_tag)] + style && style.list + end + + # Retrieve the keys in the scheme + def keys + @scheme.keys + end + + # Allow the scheme to be set like a Hash. + def []=( color_tag, constants ) + @scheme[to_symbol(color_tag)] = HighLine::Style.new(:name=>color_tag.to_s.downcase.to_sym, + :list=>constants, :no_index=>true) + end + + # Retrieve the color scheme hash (in original definition format) + def to_hash + @scheme.inject({}) { |hsh, pair| key, value = pair; hsh[key] = value.list; hsh } + end + + + private + + # Return a normalized representation of a color name. + def to_symbol( t ) + t.to_s.downcase + end + + # Return a normalized representation of a color setting. + def to_constant( v ) + v = v.to_s if v.is_a?(Symbol) + if v.is_a?(::String) then + HighLine.const_get(v.upcase) + else + v + end + end + end + + # A sample ColorScheme. + class SampleColorScheme < ColorScheme + # + # Builds the sample scheme with settings for :critical, + # :error, :warning, :notice, :info, + # :debug, :row_even, and :row_odd colors. + # + def initialize( h = nil ) + scheme = { + :critical => [ :yellow, :on_red ], + :error => [ :bold, :red ], + :warning => [ :bold, :yellow ], + :notice => [ :bold, :magenta ], + :info => [ :bold, :cyan ], + :debug => [ :bold, :green ], + :row_even => [ :cyan ], + :row_odd => [ :magenta ] + } + super(scheme) + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/compatibility.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/compatibility.rb new file mode 100644 index 000000000..7a9981944 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/compatibility.rb @@ -0,0 +1,16 @@ +unless STDIN.respond_to? :getbyte + class IO + alias_method :getbyte, :getc + end + + class StringIO + alias_method :getbyte, :getc + end +end + +unless "".respond_to? :each_line + # Not a perfect translation, but sufficient for our needs. + class String + alias_method :each_line, :each + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/import.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/import.rb new file mode 100644 index 000000000..95f03015c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/import.rb @@ -0,0 +1,41 @@ +# import.rb +# +# Created by James Edward Gray II on 2005-04-26. +# Copyright 2005 Gray Productions. All rights reserved. +# +# This is Free Software. See LICENSE and COPYING for details. + +require "highline" +require "forwardable" + +$terminal = HighLine.new + +# +# require "highline/import" adds shortcut methods to Kernel, making +# agree(), ask(), choose() and say() globally available. This is handy for +# quick and dirty input and output. These methods use the HighLine object in +# the global variable $terminal, which is initialized to used +# $stdin and $stdout (you are free to change this). +# Otherwise, these methods are identical to their HighLine counterparts, see that +# class for detailed explanations. +# +module Kernel + extend Forwardable + def_delegators :$terminal, :agree, :ask, :choose, :say +end + +class Object + # + # Tries this object as a _first_answer_ for a HighLine::Question. See that + # attribute for details. + # + # *Warning*: This Object will be passed to String() before set. + # + def or_ask( *args, &details ) + ask(*args) do |question| + question.first_answer = String(self) unless nil? + + details.call(question) unless details.nil? + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/menu.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/menu.rb new file mode 100644 index 000000000..636c1e4c4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/menu.rb @@ -0,0 +1,381 @@ +# menu.rb +# +# Created by Gregory Thomas Brown on 2005-05-10. +# Copyright 2005. All rights reserved. +# +# This is Free Software. See LICENSE and COPYING for details. + +require "highline/question" + +class HighLine + # + # Menu objects encapsulate all the details of a call to HighLine.choose(). + # Using the accessors and Menu.choice() and Menu.choices(), the block passed + # to HighLine.choose() can detail all aspects of menu display and control. + # + class Menu < Question + # + # Create an instance of HighLine::Menu. All customization is done + # through the passed block, which should call accessors and choice() and + # choices() as needed to define the Menu. Note that Menus are also + # Questions, so all that functionality is available to the block as + # well. + # + def initialize( ) + # + # Initialize Question objects with ignored values, we'll + # adjust ours as needed. + # + super("Ignored", [ ], &nil) # avoiding passing the block along + + @items = [ ] + @hidden_items = [ ] + @help = Hash.new("There's no help for that topic.") + + @index = :number + @index_suffix = ". " + @select_by = :index_or_name + @flow = :rows + @list_option = nil + @header = nil + @prompt = "? " + @layout = :list + @shell = false + @nil_on_handled = false + + # Override Questions responses, we'll set our own. + @responses = { } + # Context for action code. + @highline = nil + + yield self if block_given? + + init_help if @shell and not @help.empty? + end + + # + # An _index_ to append to each menu item in display. See + # Menu.index=() for details. + # + attr_reader :index + # + # The String placed between an _index_ and a menu item. Defaults to + # ". ". Switches to " ", when _index_ is set to a String (like "-"). + # + attr_accessor :index_suffix + # + # The _select_by_ attribute controls how the user is allowed to pick a + # menu item. The available choices are: + # + # :index:: The user is allowed to type the numerical + # or alphabetical index for their selection. + # :index_or_name:: Allows both methods from the + # :index option and the + # :name option. + # :name:: Menu items are selected by typing a portion + # of the item name that will be + # auto-completed. + # + attr_accessor :select_by + # + # This attribute is passed directly on as the mode to HighLine.list() by + # all the preset layouts. See that method for appropriate settings. + # + attr_accessor :flow + # + # This setting is passed on as the third parameter to HighLine.list() + # by all the preset layouts. See that method for details of its + # effects. Defaults to +nil+. + # + attr_accessor :list_option + # + # Used by all the preset layouts to display title and/or introductory + # information, when set. Defaults to +nil+. + # + attr_accessor :header + # + # Used by all the preset layouts to ask the actual question to fetch a + # menu selection from the user. Defaults to "? ". + # + attr_accessor :prompt + # + # An ERb _layout_ to use when displaying this Menu object. See + # Menu.layout=() for details. + # + attr_reader :layout + # + # When set to +true+, responses are allowed to be an entire line of + # input, including details beyond the command itself. Only the first + # "word" of input will be matched against the menu choices, but both the + # command selected and the rest of the line will be passed to provided + # action blocks. Defaults to +false+. + # + attr_accessor :shell + # + # When +true+, any selected item handled by provided action code will + # return +nil+, instead of the results to the action code. This may + # prove handy when dealing with mixed menus where only the names of + # items without any code (and +nil+, of course) will be returned. + # Defaults to +false+. + # + attr_accessor :nil_on_handled + + # + # Adds _name_ to the list of available menu items. Menu items will be + # displayed in the order they are added. + # + # An optional _action_ can be associated with this name and if provided, + # it will be called if the item is selected. The result of the method + # will be returned, unless _nil_on_handled_ is set (when you would get + # +nil+ instead). In _shell_ mode, a provided block will be passed the + # command chosen and any details that followed the command. Otherwise, + # just the command is passed. The @highline variable is set to + # the current HighLine context before the action code is called and can + # thus be used for adding output and the like. + # + def choice( name, help = nil, &action ) + @items << [name, action] + + @help[name.to_s.downcase] = help unless help.nil? + update_responses # rebuild responses based on our settings + end + + # + # A shortcut for multiple calls to the sister method choice(). Be + # warned: An _action_ set here will apply to *all* provided + # _names_. This is considered to be a feature, so you can easily + # hand-off interface processing to a different chunk of code. + # + def choices( *names, &action ) + names.each { |n| choice(n, &action) } + end + + # Identical to choice(), but the item will not be listed for the user. + def hidden( name, help = nil, &action ) + @hidden_items << [name, action] + + @help[name.to_s.downcase] = help unless help.nil? + end + + # + # Sets the indexing style for this Menu object. Indexes are appended to + # menu items, when displayed in list form. The available settings are: + # + # :number:: Menu items will be indexed numerically, starting + # with 1. This is the default method of indexing. + # :letter:: Items will be indexed alphabetically, starting + # with a. + # :none:: No index will be appended to menu items. + # any String:: Will be used as the literal _index_. + # + # Setting the _index_ to :none or a literal String also adjusts + # _index_suffix_ to a single space and _select_by_ to :name. + # Because of this, you should make a habit of setting the _index_ first. + # + def index=( style ) + @index = style + + # Default settings. + if @index == :none or @index.is_a?(::String) + @index_suffix = " " + @select_by = :name + end + end + + # + # Initializes the help system by adding a :help choice, some + # action code, and the default help listing. + # + def init_help( ) + return if @items.include?(:help) + + topics = @help.keys.sort + help_help = @help.include?("help") ? @help["help"] : + "This command will display helpful messages about " + + "functionality, like this one. To see the help for " + + "a specific topic enter:\n\thelp [TOPIC]\nTry asking " + + "for help on any of the following:\n\n" + + "<%= list(#{topics.inspect}, :columns_across) %>" + choice(:help, help_help) do |command, topic| + topic.strip! + topic.downcase! + if topic.empty? + @highline.say(@help["help"]) + else + @highline.say("= #{topic}\n\n#{@help[topic]}") + end + end + end + + # + # Used to set help for arbitrary topics. Use the topic "help" + # to override the default message. + # + def help( topic, help ) + @help[topic] = help + end + + # + # Setting a _layout_ with this method also adjusts some other attributes + # of the Menu object, to ideal defaults for the chosen _layout_. To + # account for that, you probably want to set a _layout_ first in your + # configuration block, if needed. + # + # Accepted settings for _layout_ are: + # + # :list:: The default _layout_. The _header_ if set + # will appear at the top on its own line with + # a trailing colon. Then the list of menu + # items will follow. Finally, the _prompt_ + # will be used as the ask()-like question. + # :one_line:: A shorter _layout_ that fits on one line. + # The _header_ comes first followed by a + # colon and spaces, then the _prompt_ with menu + # items between trailing parenthesis. + # :menu_only:: Just the menu items, followed up by a likely + # short _prompt_. + # any ERb String:: Will be taken as the literal _layout_. This + # String can access @header, + # @menu and @prompt, but is + # otherwise evaluated in the typical HighLine + # context, to provide access to utilities like + # HighLine.list() primarily. + # + # If set to either :one_line, or :menu_only, _index_ + # will default to :none and _flow_ will default to + # :inline. + # + def layout=( new_layout ) + @layout = new_layout + + # Default settings. + case @layout + when :one_line, :menu_only + self.index = :none + @flow = :inline + end + end + + # + # This method returns all possible options for auto-completion, based + # on the settings of _index_ and _select_by_. + # + def options( ) + # add in any hidden menu commands + @items.concat(@hidden_items) + + by_index = if @index == :letter + l_index = "`" + @items.map { "#{l_index.succ!}" } + else + (1 .. @items.size).collect { |s| String(s) } + end + by_name = @items.collect { |c| c.first } + + case @select_by + when :index then + by_index + when :name + by_name + else + by_index + by_name + end + ensure + # make sure the hidden items are removed, before we return + @items.slice!(@items.size - @hidden_items.size, @hidden_items.size) + end + + # + # This method processes the auto-completed user selection, based on the + # rules for this Menu object. If an action was provided for the + # selection, it will be executed as described in Menu.choice(). + # + def select( highline_context, selection, details = nil ) + # add in any hidden menu commands + @items.concat(@hidden_items) + + # Find the selected action. + name, action = if selection =~ /^\d+$/ + @items[selection.to_i - 1] + else + l_index = "`" + index = @items.map { "#{l_index.succ!}" }.index(selection) + @items.find { |c| c.first == selection } or @items[index] + end + + # Run or return it. + if not action.nil? + @highline = highline_context + if @shell + result = action.call(name, details) + else + result = action.call(name) + end + @nil_on_handled ? nil : result + elsif action.nil? + name + else + nil + end + ensure + # make sure the hidden items are removed, before we return + @items.slice!(@items.size - @hidden_items.size, @hidden_items.size) + end + + # + # Allows Menu objects to pass as Arrays, for use with HighLine.list(). + # This method returns all menu items to be displayed, complete with + # indexes. + # + def to_ary( ) + case @index + when :number + @items.map { |c| "#{@items.index(c) + 1}#{@index_suffix}#{c.first}" } + when :letter + l_index = "`" + @items.map { |c| "#{l_index.succ!}#{@index_suffix}#{c.first}" } + when :none + @items.map { |c| "#{c.first}" } + else + @items.map { |c| "#{index}#{@index_suffix}#{c.first}" } + end + end + + # + # Allows Menu to behave as a String, just like Question. Returns the + # _layout_ to be rendered, which is used by HighLine.say(). + # + def to_str( ) + case @layout + when :list + '<%= if @header.nil? then '' else "#{@header}:\n" end %>' + + "<%= list( @menu, #{@flow.inspect}, + #{@list_option.inspect} ) %>" + + "<%= @prompt %>" + when :one_line + '<%= if @header.nil? then '' else "#{@header}: " end %>' + + "<%= @prompt %>" + + "(<%= list( @menu, #{@flow.inspect}, + #{@list_option.inspect} ) %>)" + + "<%= @prompt[/\s*$/] %>" + when :menu_only + "<%= list( @menu, #{@flow.inspect}, + #{@list_option.inspect} ) %><%= @prompt %>" + else + @layout + end + end + + # + # This method will update the intelligent responses to account for + # Menu specific differences. Calls the superclass' (Question's) + # build_responses method, overriding its default arguments to specify + # 'options' will be used to populate choice lists, and that + # the newly built hash will predominate over the preexisting hash + # for any keys that are the same. + # + def update_responses( ) + build_responses(options, true) + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/question.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/question.rb new file mode 100755 index 000000000..d5baa119d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/question.rb @@ -0,0 +1,481 @@ +# question.rb +# +# Created by James Edward Gray II on 2005-04-26. +# Copyright 2005 Gray Productions. All rights reserved. +# +# This is Free Software. See LICENSE and COPYING for details. + +require "optparse" +require "date" +require "pathname" + +class HighLine + # + # Question objects contain all the details of a single invocation of + # HighLine.ask(). The object is initialized by the parameters passed to + # HighLine.ask() and then queried to make sure each step of the input + # process is handled according to the users wishes. + # + class Question + # An internal HighLine error. User code does not need to trap this. + class NoAutoCompleteMatch < StandardError + # do nothing, just creating a unique error type + end + + # + # Create an instance of HighLine::Question. Expects a _question_ to ask + # (can be "") and an _answer_type_ to convert the answer to. + # The _answer_type_ parameter must be a type recognized by + # Question.convert(). If given, a block is yielded the new Question + # object to allow custom initialization. + # + def initialize( question, answer_type ) + # initialize instance data + @question = question.dup + @answer_type = answer_type + @completion = @answer_type + + @character = nil + @limit = nil + @echo = true + @readline = false + @whitespace = :strip + @case = nil + @default = nil + @validate = nil + @above = nil + @below = nil + @in = nil + @confirm = nil + @gather = false + @verify_match = false + @first_answer = nil + @directory = Pathname.new(File.expand_path(File.dirname($0))) + @glob = "*" + @responses = Hash.new + @overwrite = false + + # allow block to override settings + yield self if block_given? + + # finalize responses based on settings + build_responses + end + + # The ERb template of the question to be asked. + attr_accessor :question + # The type that will be used to convert this answer. + attr_accessor :answer_type + # For Auto-completion + attr_accessor :completion + # + # Can be set to +true+ to use HighLine's cross-platform character reader + # instead of fetching an entire line of input. (Note: HighLine's character + # reader *ONLY* supports STDIN on Windows and Unix.) Can also be set to + # :getc to use that method on the input stream. + # + # *WARNING*: The _echo_ and _overwrite_ attributes for a question are + # ignored when using the :getc method. + # + attr_accessor :character + # + # Allows you to set a character limit for input. + # + # *WARNING*: This option forces a character by character read. + # + attr_accessor :limit + # + # Can be set to +true+ or +false+ to control whether or not input will + # be echoed back to the user. A setting of +true+ will cause echo to + # match input, but any other true value will be treated as a String to + # echo for each character typed. + # + # This requires HighLine's character reader. See the _character_ + # attribute for details. + # + # *Note*: When using HighLine to manage echo on Unix based systems, we + # recommend installing the termios gem. Without it, it's possible to type + # fast enough to have letters still show up (when reading character by + # character only). + # + attr_accessor :echo + # + # Use the Readline library to fetch input. This allows input editing as + # well as keeping a history. In addition, tab will auto-complete + # within an Array of choices or a file listing. + # + # *WARNING*: This option is incompatible with all of HighLine's + # character reading modes and it causes HighLine to ignore the + # specified _input_ stream. + # + attr_accessor :readline + # + # Used to control whitespace processing for the answer to this question. + # See HighLine::Question.remove_whitespace() for acceptable settings. + # + attr_accessor :whitespace + # + # Used to control character case processing for the answer to this question. + # See HighLine::Question.change_case() for acceptable settings. + # + attr_accessor :case + # Used to provide a default answer to this question. + attr_accessor :default + # + # If set to a Regexp, the answer must match (before type conversion). + # Can also be set to a Proc which will be called with the provided + # answer to validate with a +true+ or +false+ return. + # + attr_accessor :validate + # Used to control range checks for answer. + attr_accessor :above, :below + # If set, answer must pass an include?() check on this object. + attr_accessor :in + # + # Asks a yes or no confirmation question, to ensure a user knows what + # they have just agreed to. If set to +true+ the question will be, + # "Are you sure? " Any other true value for this attribute is assumed + # to be the question to ask. When +false+ or +nil+ (the default), + # answers are not confirmed. + # + attr_accessor :confirm + # + # When set, the user will be prompted for multiple answers which will + # be collected into an Array or Hash and returned as the final answer. + # + # You can set _gather_ to an Integer to have an Array of exactly that + # many answers collected, or a String/Regexp to match an end input which + # will not be returned in the Array. + # + # Optionally _gather_ can be set to a Hash. In this case, the question + # will be asked once for each key and the answers will be returned in a + # Hash, mapped by key. The @key variable is set before each + # question is evaluated, so you can use it in your question. + # + attr_accessor :gather + # + # When set to +true+ multiple entries will be collected according to + # the setting for _gather_, except they will be required to match + # each other. Multiple identical entries will return a single answer. + # + attr_accessor :verify_match + # + # When set to a non *nil* value, this will be tried as an answer to the + # question. If this answer passes validations, it will become the result + # without the user ever being prompted. Otherwise this value is discarded, + # and this Question is resolved as a normal call to HighLine.ask(). + # + attr_writer :first_answer + # + # The directory from which a user will be allowed to select files, when + # File or Pathname is specified as an _answer_type_. Initially set to + # Pathname.new(File.expand_path(File.dirname($0))). + # + attr_accessor :directory + # + # The glob pattern used to limit file selection when File or Pathname is + # specified as an _answer_type_. Initially set to "*". + # + attr_accessor :glob + # + # A Hash that stores the various responses used by HighLine to notify + # the user. The currently used responses and their purpose are as + # follows: + # + # :ambiguous_completion:: Used to notify the user of an + # ambiguous answer the auto-completion + # system cannot resolve. + # :ask_on_error:: This is the question that will be + # redisplayed to the user in the event + # of an error. Can be set to + # :question to repeat the + # original question. + # :invalid_type:: The error message shown when a type + # conversion fails. + # :no_completion:: Used to notify the user that their + # selection does not have a valid + # auto-completion match. + # :not_in_range:: Used to notify the user that a + # provided answer did not satisfy + # the range requirement tests. + # :not_valid:: The error message shown when + # validation checks fail. + # + attr_reader :responses + # + # When set to +true+ the question is asked, but output does not progress to + # the next line. The Cursor is moved back to the beginning of the question + # line and it is cleared so that all the contents of the line disappear from + # the screen. + # + attr_accessor :overwrite + + # + # Returns the provided _answer_string_ or the default answer for this + # Question if a default was set and the answer is empty. + # + def answer_or_default( answer_string ) + if answer_string.length == 0 and not @default.nil? + @default + else + answer_string + end + end + + # + # Called late in the initialization process to build intelligent + # responses based on the details of this Question object. + # Also used by Menu#update_responses. + # + def build_responses(message_source = answer_type, new_hash_wins = false) + + append_default unless default.nil? + + choice_error_str_func = lambda do + message_source.is_a?(Array) \ + ? '[' + message_source.map { |s| "#{s}" }.join(', ') + ']' \ + : message_source.inspect + end + + old_hash = @responses + + new_hash = { :ambiguous_completion => + "Ambiguous choice. Please choose one of " + + choice_error_str_func.call + '.', + :ask_on_error => + "? ", + :invalid_type => + "You must enter a valid #{message_source}.", + :no_completion => + "You must choose one of " + choice_error_str_func.call + '.', + :not_in_range => + "Your answer isn't within the expected range " + + "(#{expected_range}).", + :mismatch => + "Your entries didn't match.", + :not_valid => + "Your answer isn't valid (must match " + + "#{@validate.inspect})." } + + @responses = new_hash_wins ? old_hash.merge(new_hash) : new_hash.merge(old_hash) + end + + # + # Returns the provided _answer_string_ after changing character case by + # the rules of this Question. Valid settings for whitespace are: + # + # +nil+:: Do not alter character case. + # (Default.) + # :up:: Calls upcase(). + # :upcase:: Calls upcase(). + # :down:: Calls downcase(). + # :downcase:: Calls downcase(). + # :capitalize:: Calls capitalize(). + # + # An unrecognized choice (like :none) is treated as +nil+. + # + def change_case( answer_string ) + if [:up, :upcase].include?(@case) + answer_string.upcase + elsif [:down, :downcase].include?(@case) + answer_string.downcase + elsif @case == :capitalize + answer_string.capitalize + else + answer_string + end + end + + # + # Transforms the given _answer_string_ into the expected type for this + # Question. Currently supported conversions are: + # + # [...]:: Answer must be a member of the passed Array. + # Auto-completion is used to expand partial + # answers. + # lambda {...}:: Answer is passed to lambda for conversion. + # Date:: Date.parse() is called with answer. + # DateTime:: DateTime.parse() is called with answer. + # File:: The entered file name is auto-completed in + # terms of _directory_ + _glob_, opened, and + # returned. + # Float:: Answer is converted with Kernel.Float(). + # Integer:: Answer is converted with Kernel.Integer(). + # +nil+:: Answer is left in String format. (Default.) + # Pathname:: Same as File, save that a Pathname object is + # returned. + # String:: Answer is converted with Kernel.String(). + # HighLine::String:: Answer is converted with HighLine::String() + # Regexp:: Answer is fed to Regexp.new(). + # Symbol:: The method to_sym() is called on answer and + # the result returned. + # any other Class:: The answer is passed on to + # Class.parse(). + # + # This method throws ArgumentError, if the conversion cannot be + # completed for any reason. + # + def convert( answer_string ) + if @answer_type.nil? + answer_string + elsif [::String, HighLine::String].include?(@answer_type) + HighLine::String(answer_string) + elsif [Float, Integer, String].include?(@answer_type) + Kernel.send(@answer_type.to_s.to_sym, answer_string) + elsif @answer_type == Symbol + answer_string.to_sym + elsif @answer_type == Regexp + Regexp.new(answer_string) + elsif @answer_type.is_a?(Array) or [File, Pathname].include?(@answer_type) + # cheating, using OptionParser's Completion module + choices = selection + choices.extend(OptionParser::Completion) + answer = choices.complete(answer_string) + if answer.nil? + raise NoAutoCompleteMatch + end + if @answer_type.is_a?(Array) + answer.last + elsif @answer_type == File + File.open(File.join(@directory.to_s, answer.last)) + else + Pathname.new(File.join(@directory.to_s, answer.last)) + end + elsif [Date, DateTime].include?(@answer_type) or @answer_type.is_a?(Class) + @answer_type.parse(answer_string) + elsif @answer_type.is_a?(Proc) + @answer_type[answer_string] + end + end + + # Returns an English explanation of the current range settings. + def expected_range( ) + expected = [ ] + + expected << "above #{@above}" unless @above.nil? + expected << "below #{@below}" unless @below.nil? + expected << "included in #{@in.inspect}" unless @in.nil? + + case expected.size + when 0 then "" + when 1 then expected.first + when 2 then expected.join(" and ") + else expected[0..-2].join(", ") + ", and #{expected.last}" + end + end + + # Returns _first_answer_, which will be unset following this call. + def first_answer( ) + @first_answer + ensure + @first_answer = nil + end + + # Returns true if _first_answer_ is set. + def first_answer?( ) + not @first_answer.nil? + end + + # + # Returns +true+ if the _answer_object_ is greater than the _above_ + # attribute, less than the _below_ attribute and include?()ed in the + # _in_ attribute. Otherwise, +false+ is returned. Any +nil+ attributes + # are not checked. + # + def in_range?( answer_object ) + (@above.nil? or answer_object > @above) and + (@below.nil? or answer_object < @below) and + (@in.nil? or @in.include?(answer_object)) + end + + # + # Returns the provided _answer_string_ after processing whitespace by + # the rules of this Question. Valid settings for whitespace are: + # + # +nil+:: Do not alter whitespace. + # :strip:: Calls strip(). (Default.) + # :chomp:: Calls chomp(). + # :collapse:: Collapses all whitespace runs to a + # single space. + # :strip_and_collapse:: Calls strip(), then collapses all + # whitespace runs to a single space. + # :chomp_and_collapse:: Calls chomp(), then collapses all + # whitespace runs to a single space. + # :remove:: Removes all whitespace. + # + # An unrecognized choice (like :none) is treated as +nil+. + # + # This process is skipped for single character input. + # + def remove_whitespace( answer_string ) + if @whitespace.nil? + answer_string + elsif [:strip, :chomp].include?(@whitespace) + answer_string.send(@whitespace) + elsif @whitespace == :collapse + answer_string.gsub(/\s+/, " ") + elsif [:strip_and_collapse, :chomp_and_collapse].include?(@whitespace) + result = answer_string.send(@whitespace.to_s[/^[a-z]+/]) + result.gsub(/\s+/, " ") + elsif @whitespace == :remove + answer_string.gsub(/\s+/, "") + else + answer_string + end + end + + # + # Returns an Array of valid answers to this question. These answers are + # only known when _answer_type_ is set to an Array of choices, File, or + # Pathname. Any other time, this method will return an empty Array. + # + def selection( ) + if @completion.is_a?(Array) + @completion + elsif [File, Pathname].include?(@completion) + Dir[File.join(@directory.to_s, @glob)].map do |file| + File.basename(file) + end + else + [ ] + end + end + + # Stringifies the question to be asked. + def to_str( ) + @question + end + + # + # Returns +true+ if the provided _answer_string_ is accepted by the + # _validate_ attribute or +false+ if it's not. + # + # It's important to realize that an answer is validated after whitespace + # and case handling. + # + def valid_answer?( answer_string ) + @validate.nil? or + (@validate.is_a?(Regexp) and answer_string =~ @validate) or + (@validate.is_a?(Proc) and @validate[answer_string]) + end + + private + + # + # Adds the default choice to the end of question between |...|. + # Trailing whitespace is preserved so the function of HighLine.say() is + # not affected. + # + def append_default( ) + if @question =~ /([\t ]+)\Z/ + @question << "|#{@default}|#{$1}" + elsif @question == "" + @question << "|#{@default}| " + elsif @question[-1, 1] == "\n" + @question[-2, 0] = " |#{@default}|" + else + @question << " |#{@default}|" + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/simulate.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/simulate.rb new file mode 100644 index 000000000..3596f599b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/simulate.rb @@ -0,0 +1,48 @@ +# simulate.rb +# +# Created by Andy Rossmeissl on 2012-04-29. +# Copyright 2005 Gray Productions. All rights reserved. +# +# This is Free Software. See LICENSE and COPYING for details. +# +# adapted from https://gist.github.com/194554 +class HighLine + + # Simulates Highline input for use in tests. + class Simulate + + # Creates a simulator with an array of Strings as a script + def initialize(strings) + @strings = strings + end + + # Simulate StringIO#gets by shifting a string off of the script + def gets + @strings.shift + end + + # Simulate StringIO#getbyte by shifting a single character off of the next line of the script + def getbyte + line = gets + if line.length > 0 + char = line.slice! 0 + @strings.unshift line + char + end + end + + # The simulator handles its own EOF + def eof? + false + end + + # A wrapper method that temporarily replaces the Highline instance in $terminal with an instance of this object for the duration of the block + def self.with(*strings) + @input = $terminal.instance_variable_get :@input + $terminal.instance_variable_set :@input, new(strings) + yield + ensure + $terminal.instance_variable_set :@input, @input + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/string_extensions.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/string_extensions.rb new file mode 100644 index 000000000..c72aff0e2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/string_extensions.rb @@ -0,0 +1,111 @@ +# Extensions for class String +# +# HighLine::String is a subclass of String with convenience methods added for colorization. +# +# Available convenience methods include: +# * 'color' method e.g. highline_string.color(:bright_blue, :underline) +# * colors e.g. highline_string.magenta +# * RGB colors e.g. highline_string.rgb_ff6000 +# or highline_string.rgb(255,96,0) +# * background colors e.g. highline_string.on_magenta +# * RGB background colors e.g. highline_string.on_rgb_ff6000 +# or highline_string.on_rgb(255,96,0) +# * styles e.g. highline_string.underline +# +# Additionally, convenience methods can be chained, for instance the following are equivalent: +# highline_string.bright_blue.blink.underline +# highline_string.color(:bright_blue, :blink, :underline) +# HighLine.color(highline_string, :bright_blue, :blink, :underline) +# +# For those less squeamish about possible conflicts, the same convenience methods can be +# added to the built-in String class, as follows: +# +# require 'highline' +# Highline.colorize_strings + +class HighLine + def self.String(s) + HighLine::String.new(s) + end + + module StringExtensions + def self.included(base) + HighLine::COLORS.each do |color| + color = color.downcase + base.class_eval <<-END + undef :#{color} if method_defined? :#{color} + def #{color} + color(:#{color}) + end + END + + base.class_eval <<-END + undef :on_#{color} if method_defined? :on_#{color} + def on_#{color} + on(:#{color}) + end + END + HighLine::STYLES.each do |style| + style = style.downcase + base.class_eval <<-END + undef :#{style} if method_defined? :#{style} + def #{style} + color(:#{style}) + end + END + end + end + + base.class_eval do + undef :color if method_defined? :color + undef :foreground if method_defined? :foreground + def color(*args) + self.class.new(HighLine.color(self, *args)) + end + alias_method :foreground, :color + + undef :on if method_defined? :on + def on(arg) + color(('on_' + arg.to_s).to_sym) + end + + undef :uncolor if method_defined? :uncolor + def uncolor + self.class.new(HighLine.uncolor(self)) + end + + undef :rgb if method_defined? :rgb + def rgb(*colors) + color_code = colors.map{|color| color.is_a?(Numeric) ? '%02x'%color : color.to_s}.join + raise "Bad RGB color #{colors.inspect}" unless color_code =~ /^[a-fA-F0-9]{6}/ + color("rgb_#{color_code}".to_sym) + end + + undef :on_rgb if method_defined? :on_rgb + def on_rgb(*colors) + color_code = colors.map{|color| color.is_a?(Numeric) ? '%02x'%color : color.to_s}.join + raise "Bad RGB color #{colors.inspect}" unless color_code =~ /^[a-fA-F0-9]{6}/ + color("on_rgb_#{color_code}".to_sym) + end + + # TODO Chain existing method_missing + undef :method_missing if method_defined? :method_missing + def method_missing(method, *args, &blk) + if method.to_s =~ /^(on_)?rgb_([0-9a-fA-F]{6})$/ + color(method) + else + raise NoMethodError, "undefined method `#{method}' for #<#{self.class}:#{'%#x'%self.object_id}>" + end + end + end + end + end + + class HighLine::String < ::String + include StringExtensions + end + + def self.colorize_strings + ::String.send(:include, StringExtensions) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/style.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/style.rb new file mode 100755 index 000000000..907f78692 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/style.rb @@ -0,0 +1,181 @@ +# color_scheme.rb +# +# Created by Richard LeBer on 2011-06-27. +# Copyright 2011. All rights reserved +# +# This is Free Software. See LICENSE and COPYING for details + +class HighLine + + def self.Style(*args) + args = args.compact.flatten + if args.size==1 + arg = args.first + if arg.is_a?(Style) + Style.list[arg.name] || Style.index(arg) + elsif arg.is_a?(::String) && arg =~ /^\e\[/ # arg is a code + if styles = Style.code_index[arg] + styles.first + else + Style.new(:code=>arg) + end + elsif style = Style.list[arg] + style + elsif HighLine.color_scheme && HighLine.color_scheme[arg] + HighLine.color_scheme[arg] + elsif arg.is_a?(Hash) + Style.new(arg) + elsif arg.to_s.downcase =~ /^rgb_([a-f0-9]{6})$/ + Style.rgb($1) + elsif arg.to_s.downcase =~ /^on_rgb_([a-f0-9]{6})$/ + Style.rgb($1).on + else + raise NameError, "#{arg.inspect} is not a defined Style" + end + else + name = args + Style.list[name] || Style.new(:list=>args) + end + end + + class Style + + def self.index(style) + if style.name + @@styles ||= {} + @@styles[style.name] = style + end + if !style.list + @@code_index ||= {} + @@code_index[style.code] ||= [] + @@code_index[style.code].reject!{|indexed_style| indexed_style.name == style.name} + @@code_index[style.code] << style + end + style + end + + def self.rgb_hex(*colors) + colors.map do |color| + color.is_a?(Numeric) ? '%02x'%color : color.to_s + end.join + end + + def self.rgb_parts(hex) + hex.scan(/../).map{|part| part.to_i(16)} + end + + def self.rgb(*colors) + hex = rgb_hex(*colors) + name = ('rgb_' + hex).to_sym + if style = list[name] + style + else + parts = rgb_parts(hex) + new(:name=>name, :code=>"\e[38;5;#{rgb_number(parts)}m", :rgb=>parts) + end + end + + def self.rgb_number(*parts) + parts = parts.flatten + 16 + parts.inject(0) {|kode, part| kode*6 + (part/256.0*6.0).floor} + end + + def self.ansi_rgb_to_hex(ansi_number) + raise "Invalid ANSI rgb code #{ansi_number}" unless (16..231).include?(ansi_number) + parts = (ansi_number-16).to_s(6).rjust(3,'0').scan(/./).map{|d| (d.to_i*255.0/6.0).ceil} + rgb_hex(*parts) + end + + def self.list + @@styles ||= {} + end + + def self.code_index + @@code_index ||= {} + end + + def self.uncolor(string) + string.gsub(/\e\[\d+(;\d+)*m/, '') + end + + attr_reader :name, :list + attr_accessor :rgb, :builtin + + # Single color/styles have :name, :code, :rgb (possibly), :builtin + # Compound styles have :name, :list, :builtin + def initialize(defn = {}) + @definition = defn + @name = defn[:name] + @code = defn[:code] + @rgb = defn[:rgb] + @list = defn[:list] + @builtin = defn[:builtin] + if @rgb + hex = self.class.rgb_hex(@rgb) + @name ||= 'rgb_' + hex + elsif @list + @name ||= @list + end + self.class.index self unless defn[:no_index] + end + + def dup + self.class.new(@definition) + end + + def to_hash + @definition + end + + def color(string) + code + string + HighLine::CLEAR + end + + def code + if @list + @list.map{|element| HighLine.Style(element).code}.join + else + @code + end + end + + def red + @rgb && @rgb[0] + end + + def green + @rgb && @rgb[1] + end + + def blue + @rgb && @rgb[2] + end + + def variant(new_name, options={}) + raise "Cannot create a variant of a style list (#{inspect})" if @list + new_code = options[:code] || code + if options[:increment] + raise "Unexpected code in #{inspect}" unless new_code =~ /^(.*?)(\d+)(.*)/ + new_code = $1 + ($2.to_i + options[:increment]).to_s + $3 + end + new_rgb = options[:rgb] || @rgb + self.class.new(self.to_hash.merge(:name=>new_name, :code=>new_code, :rgb=>new_rgb)) + end + + def on + new_name = ('on_'+@name.to_s).to_sym + self.class.list[new_name] ||= variant(new_name, :increment=>10) + end + + def bright + raise "Cannot create a bright variant of a style list (#{inspect})" if @list + new_name = ('bright_'+@name.to_s).to_sym + if style = self.class.list[new_name] + style + else + new_rgb = @rgb == [0,0,0] ? [128, 128, 128] : @rgb.map {|color| color==0 ? 0 : [color+128,255].min } + variant(new_name, :increment=>60, :rgb=>new_rgb) + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/system_extensions.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/system_extensions.rb new file mode 100755 index 000000000..29ce5387e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/lib/highline/system_extensions.rb @@ -0,0 +1,242 @@ +# system_extensions.rb +# +# Created by James Edward Gray II on 2006-06-14. +# Copyright 2006 Gray Productions. All rights reserved. +# +# This is Free Software. See LICENSE and COPYING for details. + +require "highline/compatibility" + +class HighLine + module SystemExtensions + JRUBY = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby' + + if JRUBY + def initialize_system_extensions + require 'java' + require 'readline' + if JRUBY_VERSION =~ /^1.7/ + java_import 'jline.console.ConsoleReader' + + input = @input && @input.to_inputstream + output = @output && @output.to_outputstream + + @java_console = ConsoleReader.new(input, output) + @java_console.set_history_enabled(false) + @java_console.set_bell_enabled(true) + @java_console.set_pagination_enabled(false) + @java_terminal = @java_console.getTerminal + elsif JRUBY_VERSION =~ /^1.6/ + java_import 'java.io.OutputStreamWriter' + java_import 'java.nio.channels.Channels' + java_import 'jline.ConsoleReader' + java_import 'jline.Terminal' + + @java_input = Channels.newInputStream(@input.to_channel) + @java_output = OutputStreamWriter.new(Channels.newOutputStream(@output.to_channel)) + @java_terminal = Terminal.getTerminal + @java_console = ConsoleReader.new(@java_input, @java_output) + @java_console.setUseHistory(false) + @java_console.setBellEnabled(true) + @java_console.setUsePagination(false) + end + end + end + + extend self + + # + # This section builds character reading and terminal size functions + # to suit the proper platform we're running on. Be warned: Here be + # dragons! + # + if RUBY_PLATFORM =~ /mswin(?!ce)|mingw|bccwin/i + begin + require "fiddle" + + module WinAPI + include Fiddle + Handle = RUBY_VERSION >= "2.0.0" ? Fiddle::Handle : DL::Handle + Kernel32 = Handle.new("kernel32") + Crt = Handle.new("msvcrt") rescue Handle.new("crtdll") + + def self._getch + @@_m_getch ||= Function.new(Crt["_getch"], [], TYPE_INT) + @@_m_getch.call + end + + def self.GetStdHandle(handle_type) + @@get_std_handle ||= Function.new(Kernel32["GetStdHandle"], [-TYPE_INT], -TYPE_INT) + @@get_std_handle.call(handle_type) + end + + def self.GetConsoleScreenBufferInfo(cons_handle, lp_buffer) + @@get_console_screen_buffer_info ||= + Function.new(Kernel32["GetConsoleScreenBufferInfo"], [TYPE_LONG, TYPE_VOIDP], TYPE_INT) + @@get_console_screen_buffer_info.call(cons_handle, lp_buffer) + end + end + rescue LoadError + require "dl/import" + + module WinAPI + if defined?(DL::Importer) + # Ruby 1.9 + extend DL::Importer + else + # Ruby 1.8 + extend DL::Importable + end + begin + dlload "msvcrt", "kernel32" + rescue DL::DLError + dlload "crtdll", "kernel32" + end + extern "unsigned long _getch()" + extern "unsigned long GetConsoleScreenBufferInfo(unsigned long, void*)" + extern "unsigned long GetStdHandle(unsigned long)" + + # Ruby 1.8 DL::Importable.import does mname[0,1].downcase so FooBar becomes fooBar + if defined?(getConsoleScreenBufferInfo) + alias_method :GetConsoleScreenBufferInfo, :getConsoleScreenBufferInfo + module_function :GetConsoleScreenBufferInfo + end + if defined?(getStdHandle) + alias_method :GetStdHandle, :getStdHandle + module_function :GetStdHandle + end + end + end + + CHARACTER_MODE = "Win32API" # For Debugging purposes only. + + # + # Windows savvy getc(). + # + # *WARNING*: This method ignores input and reads one + # character from +STDIN+! + # + def get_character( input = STDIN ) + WinAPI._getch + end + + # We do not define a raw_no_echo_mode for Windows as _getch turns off echo + def raw_no_echo_mode + end + + def restore_mode + end + + # A Windows savvy method to fetch the console columns, and rows. + def terminal_size + format = 'SSSSSssssSS' + buf = ([0] * format.size).pack(format) + stdout_handle = WinAPI.GetStdHandle(0xFFFFFFF5) + + WinAPI.GetConsoleScreenBufferInfo(stdout_handle, buf) + _, _, _, _, _, + left, top, right, bottom, _, _ = buf.unpack(format) + return right - left + 1, bottom - top + 1 + end + else # If we're not on Windows try... + begin + require "termios" # Unix, first choice termios. + + CHARACTER_MODE = "termios" # For Debugging purposes only. + + def raw_no_echo_mode + @state = Termios.getattr(@input) + new_settings = @state.dup + new_settings.c_lflag &= ~(Termios::ECHO | Termios::ICANON) + new_settings.c_cc[Termios::VMIN] = 1 + Termios.setattr(@input, Termios::TCSANOW, new_settings) + end + + def restore_mode + Termios.setattr(@input, Termios::TCSANOW, @state) + end + rescue LoadError # If our first choice fails, try using JLine + if JRUBY # if we are on JRuby. JLine is bundled with JRuby. + CHARACTER_MODE = "jline" # For Debugging purposes only. + + def terminal_size + if JRUBY_VERSION =~ /^1.7/ + [ @java_terminal.get_width, @java_terminal.get_height ] + else + [ @java_terminal.getTerminalWidth, @java_terminal.getTerminalHeight ] + end + end + + def raw_no_echo_mode + @state = @java_console.getEchoCharacter + @java_console.setEchoCharacter 0 + end + + def restore_mode + @java_console.setEchoCharacter @state + end + else # If we are not on JRuby, try ncurses + begin + require 'ffi-ncurses' + CHARACTER_MODE = "ncurses" # For Debugging purposes only. + + def raw_no_echo_mode + FFI::NCurses.initscr + FFI::NCurses.cbreak + end + + def restore_mode + FFI::NCurses.endwin + end + + # + # A ncurses savvy method to fetch the console columns, and rows. + # + def terminal_size + size = [80, 40] + FFI::NCurses.initscr + begin + size = FFI::NCurses.getmaxyx(FFI::NCurses.stdscr).reverse + ensure + FFI::NCurses.endwin + end + size + end + rescue LoadError # Finally, if all else fails, use stty + # *WARNING*: This requires the external "stty" program! + CHARACTER_MODE = "stty" # For Debugging purposes only. + + def raw_no_echo_mode + @state = `stty -g` + system "stty raw -echo -icanon isig" + end + + def restore_mode + system "stty #{@state}" + end + end + end + end + + # For termios and stty + if not method_defined?(:terminal_size) + # A Unix savvy method using stty to fetch the console columns, and rows. + # ... stty does not work in JRuby + def terminal_size + if /solaris/ =~ RUBY_PLATFORM and + `stty` =~ /\brows = (\d+).*\bcolumns = (\d+)/ + [$2, $1].map { |c| x.to_i } + else + `stty size`.split.map { |x| x.to_i }.reverse + end + end + end + end + + if not method_defined?(:get_character) + def get_character( input = STDIN ) + input.getbyte + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/setup.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/setup.rb new file mode 100644 index 000000000..dae3522b8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/setup.rb @@ -0,0 +1,1360 @@ +# +# setup.rb +# +# Copyright (c) 2000-2004 Minero Aoki +# +# This program is free software. +# You can distribute/modify this program under the terms of +# the GNU LGPL, Lesser General Public License version 2.1. +# + +unless Enumerable.method_defined?(:map) # Ruby 1.4.6 + module Enumerable + alias map collect + end +end + +unless File.respond_to?(:read) # Ruby 1.6 + def File.read(fname) + open(fname) {|f| + return f.read + } + end +end + +def File.binread(fname) + open(fname, 'rb') {|f| + return f.read + } +end + +# for corrupted windows stat(2) +def File.dir?(path) + File.directory?((path[-1,1] == '/') ? path : path + '/') +end + + +class SetupError < StandardError; end + +def setup_rb_error(msg) + raise SetupError, msg +end + +# +# Config +# + +if arg = ARGV.detect {|arg| /\A--rbconfig=/ =~ arg } + ARGV.delete(arg) + require arg.split(/=/, 2)[1] + $".push 'rbconfig.rb' +else + require 'rbconfig' +end + +def multipackage_install? + FileTest.directory?(File.dirname($0) + '/packages') +end + + +class ConfigItem + def initialize(name, template, default, desc) + @name = name.freeze + @template = template + @value = default + @default = default.dup.freeze + @description = desc + end + + attr_reader :name + attr_reader :description + + attr_accessor :default + alias help_default default + + def help_opt + "--#{@name}=#{@template}" + end + + def value + @value + end + + def eval(table) + @value.gsub(%r<\$([^/]+)>) { table[$1] } + end + + def set(val) + @value = check(val) + end + + private + + def check(val) + setup_rb_error "config: --#{name} requires argument" unless val + val + end +end + +class BoolItem < ConfigItem + def config_type + 'bool' + end + + def help_opt + "--#{@name}" + end + + private + + def check(val) + return 'yes' unless val + unless /\A(y(es)?|n(o)?|t(rue)?|f(alse))\z/i =~ val + setup_rb_error "config: --#{@name} accepts only yes/no for argument" + end + (/\Ay(es)?|\At(rue)/i =~ value) ? 'yes' : 'no' + end +end + +class PathItem < ConfigItem + def config_type + 'path' + end + + private + + def check(path) + setup_rb_error "config: --#{@name} requires argument" unless path + path[0,1] == '$' ? path : File.expand_path(path) + end +end + +class ProgramItem < ConfigItem + def config_type + 'program' + end +end + +class SelectItem < ConfigItem + def initialize(name, template, default, desc) + super + @ok = template.split('/') + end + + def config_type + 'select' + end + + private + + def check(val) + unless @ok.include?(val.strip) + setup_rb_error "config: use --#{@name}=#{@template} (#{val})" + end + val.strip + end +end + +class PackageSelectionItem < ConfigItem + def initialize(name, template, default, help_default, desc) + super name, template, default, desc + @help_default = help_default + end + + attr_reader :help_default + + def config_type + 'package' + end + + private + + def check(val) + unless File.dir?("packages/#{val}") + setup_rb_error "config: no such package: #{val}" + end + val + end +end + +class ConfigTable_class + + def initialize(items) + @items = items + @table = {} + items.each do |i| + @table[i.name] = i + end + ALIASES.each do |ali, name| + @table[ali] = @table[name] + end + end + + include Enumerable + + def each(&block) + @items.each(&block) + end + + def key?(name) + @table.key?(name) + end + + def lookup(name) + @table[name] or raise ArgumentError, "no such config item: #{name}" + end + + def add(item) + @items.push item + @table[item.name] = item + end + + def remove(name) + item = lookup(name) + @items.delete_if {|i| i.name == name } + @table.delete_if {|name, i| i.name == name } + item + end + + def new + dup() + end + + def savefile + '.config' + end + + def load + begin + t = dup() + File.foreach(savefile()) do |line| + k, v = *line.split(/=/, 2) + t[k] = v.strip + end + t + rescue Errno::ENOENT + setup_rb_error $!.message + "#{File.basename($0)} config first" + end + end + + def save + @items.each {|i| i.value } + File.open(savefile(), 'w') {|f| + @items.each do |i| + f.printf "%s=%s\n", i.name, i.value if i.value + end + } + end + + def [](key) + lookup(key).eval(self) + end + + def []=(key, val) + lookup(key).set val + end + +end + +c = ::Config::CONFIG + +rubypath = c['bindir'] + '/' + c['ruby_install_name'] + +major = c['MAJOR'].to_i +minor = c['MINOR'].to_i +teeny = c['TEENY'].to_i +version = "#{major}.#{minor}" + +# ruby ver. >= 1.4.4? +newpath_p = ((major >= 2) or + ((major == 1) and + ((minor >= 5) or + ((minor == 4) and (teeny >= 4))))) + +if c['rubylibdir'] + # V < 1.6.3 + _stdruby = c['rubylibdir'] + _siteruby = c['sitedir'] + _siterubyver = c['sitelibdir'] + _siterubyverarch = c['sitearchdir'] +elsif newpath_p + # 1.4.4 <= V <= 1.6.3 + _stdruby = "$prefix/lib/ruby/#{version}" + _siteruby = c['sitedir'] + _siterubyver = "$siteruby/#{version}" + _siterubyverarch = "$siterubyver/#{c['arch']}" +else + # V < 1.4.4 + _stdruby = "$prefix/lib/ruby/#{version}" + _siteruby = "$prefix/lib/ruby/#{version}/site_ruby" + _siterubyver = _siteruby + _siterubyverarch = "$siterubyver/#{c['arch']}" +end +libdir = '-* dummy libdir *-' +stdruby = '-* dummy rubylibdir *-' +siteruby = '-* dummy site_ruby *-' +siterubyver = '-* dummy site_ruby version *-' +parameterize = lambda {|path| + path.sub(/\A#{Regexp.quote(c['prefix'])}/, '$prefix')\ + .sub(/\A#{Regexp.quote(libdir)}/, '$libdir')\ + .sub(/\A#{Regexp.quote(stdruby)}/, '$stdruby')\ + .sub(/\A#{Regexp.quote(siteruby)}/, '$siteruby')\ + .sub(/\A#{Regexp.quote(siterubyver)}/, '$siterubyver') +} +libdir = parameterize.call(c['libdir']) +stdruby = parameterize.call(_stdruby) +siteruby = parameterize.call(_siteruby) +siterubyver = parameterize.call(_siterubyver) +siterubyverarch = parameterize.call(_siterubyverarch) + +if arg = c['configure_args'].split.detect {|arg| /--with-make-prog=/ =~ arg } + makeprog = arg.sub(/'/, '').split(/=/, 2)[1] +else + makeprog = 'make' +end + +common_conf = [ + PathItem.new('prefix', 'path', c['prefix'], + 'path prefix of target environment'), + PathItem.new('bindir', 'path', parameterize.call(c['bindir']), + 'the directory for commands'), + PathItem.new('libdir', 'path', libdir, + 'the directory for libraries'), + PathItem.new('datadir', 'path', parameterize.call(c['datadir']), + 'the directory for shared data'), + PathItem.new('mandir', 'path', parameterize.call(c['mandir']), + 'the directory for man pages'), + PathItem.new('sysconfdir', 'path', parameterize.call(c['sysconfdir']), + 'the directory for man pages'), + PathItem.new('stdruby', 'path', stdruby, + 'the directory for standard ruby libraries'), + PathItem.new('siteruby', 'path', siteruby, + 'the directory for version-independent aux ruby libraries'), + PathItem.new('siterubyver', 'path', siterubyver, + 'the directory for aux ruby libraries'), + PathItem.new('siterubyverarch', 'path', siterubyverarch, + 'the directory for aux ruby binaries'), + PathItem.new('rbdir', 'path', '$siterubyver', + 'the directory for ruby scripts'), + PathItem.new('sodir', 'path', '$siterubyverarch', + 'the directory for ruby extentions'), + PathItem.new('rubypath', 'path', rubypath, + 'the path to set to #! line'), + ProgramItem.new('rubyprog', 'name', rubypath, + 'the ruby program using for installation'), + ProgramItem.new('makeprog', 'name', makeprog, + 'the make program to compile ruby extentions'), + SelectItem.new('shebang', 'all/ruby/never', 'ruby', + 'shebang line (#!) editing mode'), + BoolItem.new('without-ext', 'yes/no', 'no', + 'does not compile/install ruby extentions') +] +class ConfigTable_class # open again + ALIASES = { + 'std-ruby' => 'stdruby', + 'site-ruby-common' => 'siteruby', # For backward compatibility + 'site-ruby' => 'siterubyver', # For backward compatibility + 'bin-dir' => 'bindir', + 'bin-dir' => 'bindir', + 'rb-dir' => 'rbdir', + 'so-dir' => 'sodir', + 'data-dir' => 'datadir', + 'ruby-path' => 'rubypath', + 'ruby-prog' => 'rubyprog', + 'ruby' => 'rubyprog', + 'make-prog' => 'makeprog', + 'make' => 'makeprog' + } +end +multipackage_conf = [ + PackageSelectionItem.new('with', 'name,name...', '', 'ALL', + 'package names that you want to install'), + PackageSelectionItem.new('without', 'name,name...', '', 'NONE', + 'package names that you do not want to install') +] +if multipackage_install? + ConfigTable = ConfigTable_class.new(common_conf + multipackage_conf) +else + ConfigTable = ConfigTable_class.new(common_conf) +end + + +module MetaConfigAPI + + def eval_file_ifexist(fname) + instance_eval File.read(fname), fname, 1 if File.file?(fname) + end + + def config_names + ConfigTable.map {|i| i.name } + end + + def config?(name) + ConfigTable.key?(name) + end + + def bool_config?(name) + ConfigTable.lookup(name).config_type == 'bool' + end + + def path_config?(name) + ConfigTable.lookup(name).config_type == 'path' + end + + def value_config?(name) + case ConfigTable.lookup(name).config_type + when 'bool', 'path' + true + else + false + end + end + + def add_config(item) + ConfigTable.add item + end + + def add_bool_config(name, default, desc) + ConfigTable.add BoolItem.new(name, 'yes/no', default ? 'yes' : 'no', desc) + end + + def add_path_config(name, default, desc) + ConfigTable.add PathItem.new(name, 'path', default, desc) + end + + def set_config_default(name, default) + ConfigTable.lookup(name).default = default + end + + def remove_config(name) + ConfigTable.remove(name) + end + +end + + +# +# File Operations +# + +module FileOperations + + def mkdir_p(dirname, prefix = nil) + dirname = prefix + File.expand_path(dirname) if prefix + $stderr.puts "mkdir -p #{dirname}" if verbose? + return if no_harm? + + # does not check '/'... it's too abnormal case + dirs = File.expand_path(dirname).split(%r<(?=/)>) + if /\A[a-z]:\z/i =~ dirs[0] + disk = dirs.shift + dirs[0] = disk + dirs[0] + end + dirs.each_index do |idx| + path = dirs[0..idx].join('') + Dir.mkdir path unless File.dir?(path) + end + end + + def rm_f(fname) + $stderr.puts "rm -f #{fname}" if verbose? + return if no_harm? + + if File.exist?(fname) or File.symlink?(fname) + File.chmod 0777, fname + File.unlink fname + end + end + + def rm_rf(dn) + $stderr.puts "rm -rf #{dn}" if verbose? + return if no_harm? + + Dir.chdir dn + Dir.foreach('.') do |fn| + next if fn == '.' + next if fn == '..' + if File.dir?(fn) + verbose_off { + rm_rf fn + } + else + verbose_off { + rm_f fn + } + end + end + Dir.chdir '..' + Dir.rmdir dn + end + + def move_file(src, dest) + File.unlink dest if File.exist?(dest) + begin + File.rename src, dest + rescue + File.open(dest, 'wb') {|f| f.write File.binread(src) } + File.chmod File.stat(src).mode, dest + File.unlink src + end + end + + def install(from, dest, mode, prefix = nil) + $stderr.puts "install #{from} #{dest}" if verbose? + return if no_harm? + + realdest = prefix ? prefix + File.expand_path(dest) : dest + realdest = File.join(realdest, File.basename(from)) if File.dir?(realdest) + str = File.binread(from) + if diff?(str, realdest) + verbose_off { + rm_f realdest if File.exist?(realdest) + } + File.open(realdest, 'wb') {|f| + f.write str + } + File.chmod mode, realdest + + File.open("#{objdir_root()}/InstalledFiles", 'a') {|f| + if prefix + f.puts realdest.sub(prefix, '') + else + f.puts realdest + end + } + end + end + + def diff?(new_content, path) + return true unless File.exist?(path) + new_content != File.binread(path) + end + + def command(str) + $stderr.puts str if verbose? + system str or raise RuntimeError, "'system #{str}' failed" + end + + def ruby(str) + command config('rubyprog') + ' ' + str + end + + def make(task = '') + command config('makeprog') + ' ' + task + end + + def extdir?(dir) + File.exist?(dir + '/MANIFEST') + end + + def all_files_in(dirname) + Dir.open(dirname) {|d| + return d.select {|ent| File.file?("#{dirname}/#{ent}") } + } + end + + REJECT_DIRS = %w( + CVS SCCS RCS CVS.adm .svn + ) + + def all_dirs_in(dirname) + Dir.open(dirname) {|d| + return d.select {|n| File.dir?("#{dirname}/#{n}") } - %w(. ..) - REJECT_DIRS + } + end + +end + + +# +# Main Installer +# + +module HookUtils + + def run_hook(name) + try_run_hook "#{curr_srcdir()}/#{name}" or + try_run_hook "#{curr_srcdir()}/#{name}.rb" + end + + def try_run_hook(fname) + return false unless File.file?(fname) + begin + instance_eval File.read(fname), fname, 1 + rescue + setup_rb_error "hook #{fname} failed:\n" + $!.message + end + true + end + +end + + +module HookScriptAPI + + def get_config(key) + @config[key] + end + + alias config get_config + + def set_config(key, val) + @config[key] = val + end + + # + # srcdir/objdir (works only in the package directory) + # + + #abstract srcdir_root + #abstract objdir_root + #abstract relpath + + def curr_srcdir + "#{srcdir_root()}/#{relpath()}" + end + + def curr_objdir + "#{objdir_root()}/#{relpath()}" + end + + def srcfile(path) + "#{curr_srcdir()}/#{path}" + end + + def srcexist?(path) + File.exist?(srcfile(path)) + end + + def srcdirectory?(path) + File.dir?(srcfile(path)) + end + + def srcfile?(path) + File.file? srcfile(path) + end + + def srcentries(path = '.') + Dir.open("#{curr_srcdir()}/#{path}") {|d| + return d.to_a - %w(. ..) + } + end + + def srcfiles(path = '.') + srcentries(path).select {|fname| + File.file?(File.join(curr_srcdir(), path, fname)) + } + end + + def srcdirectories(path = '.') + srcentries(path).select {|fname| + File.dir?(File.join(curr_srcdir(), path, fname)) + } + end + +end + + +class ToplevelInstaller + + Version = '3.3.1' + Copyright = 'Copyright (c) 2000-2004 Minero Aoki' + + TASKS = [ + [ 'all', 'do config, setup, then install' ], + [ 'config', 'saves your configurations' ], + [ 'show', 'shows current configuration' ], + [ 'setup', 'compiles ruby extentions and others' ], + [ 'install', 'installs files' ], + [ 'clean', "does `make clean' for each extention" ], + [ 'distclean',"does `make distclean' for each extention" ] + ] + + def ToplevelInstaller.invoke + instance().invoke + end + + @singleton = nil + + def ToplevelInstaller.instance + @singleton ||= new(File.dirname($0)) + @singleton + end + + include MetaConfigAPI + + def initialize(ardir_root) + @config = nil + @options = { 'verbose' => true } + @ardir = File.expand_path(ardir_root) + end + + def inspect + "#<#{self.class} #{__id__()}>" + end + + def invoke + run_metaconfigs + case task = parsearg_global() + when nil, 'all' + @config = load_config('config') + parsearg_config + init_installers + exec_config + exec_setup + exec_install + else + @config = load_config(task) + __send__ "parsearg_#{task}" + init_installers + __send__ "exec_#{task}" + end + end + + def run_metaconfigs + eval_file_ifexist "#{@ardir}/metaconfig" + end + + def load_config(task) + case task + when 'config' + ConfigTable.new + when 'clean', 'distclean' + if File.exist?(ConfigTable.savefile) + then ConfigTable.load + else ConfigTable.new + end + else + ConfigTable.load + end + end + + def init_installers + @installer = Installer.new(@config, @options, @ardir, File.expand_path('.')) + end + + # + # Hook Script API bases + # + + def srcdir_root + @ardir + end + + def objdir_root + '.' + end + + def relpath + '.' + end + + # + # Option Parsing + # + + def parsearg_global + valid_task = /\A(?:#{TASKS.map {|task,desc| task }.join '|'})\z/ + + while arg = ARGV.shift + case arg + when /\A\w+\z/ + setup_rb_error "invalid task: #{arg}" unless valid_task =~ arg + return arg + + when '-q', '--quiet' + @options['verbose'] = false + + when '--verbose' + @options['verbose'] = true + + when '-h', '--help' + print_usage $stdout + exit 0 + + when '-v', '--version' + puts "#{File.basename($0)} version #{Version}" + exit 0 + + when '--copyright' + puts Copyright + exit 0 + + else + setup_rb_error "unknown global option '#{arg}'" + end + end + + nil + end + + + def parsearg_no_options + unless ARGV.empty? + setup_rb_error "#{task}: unknown options: #{ARGV.join ' '}" + end + end + + alias parsearg_show parsearg_no_options + alias parsearg_setup parsearg_no_options + alias parsearg_clean parsearg_no_options + alias parsearg_distclean parsearg_no_options + + def parsearg_config + re = /\A--(#{ConfigTable.map {|i| i.name }.join('|')})(?:=(.*))?\z/ + @options['config-opt'] = [] + + while i = ARGV.shift + if /\A--?\z/ =~ i + @options['config-opt'] = ARGV.dup + break + end + m = re.match(i) or setup_rb_error "config: unknown option #{i}" + name, value = *m.to_a[1,2] + @config[name] = value + end + end + + def parsearg_install + @options['no-harm'] = false + @options['install-prefix'] = '' + while a = ARGV.shift + case a + when /\A--no-harm\z/ + @options['no-harm'] = true + when /\A--prefix=(.*)\z/ + path = $1 + path = File.expand_path(path) unless path[0,1] == '/' + @options['install-prefix'] = path + else + setup_rb_error "install: unknown option #{a}" + end + end + end + + def print_usage(out) + out.puts 'Typical Installation Procedure:' + out.puts " $ ruby #{File.basename $0} config" + out.puts " $ ruby #{File.basename $0} setup" + out.puts " # ruby #{File.basename $0} install (may require root privilege)" + out.puts + out.puts 'Detailed Usage:' + out.puts " ruby #{File.basename $0} " + out.puts " ruby #{File.basename $0} [] []" + + fmt = " %-24s %s\n" + out.puts + out.puts 'Global options:' + out.printf fmt, '-q,--quiet', 'suppress message outputs' + out.printf fmt, ' --verbose', 'output messages verbosely' + out.printf fmt, '-h,--help', 'print this message' + out.printf fmt, '-v,--version', 'print version and quit' + out.printf fmt, ' --copyright', 'print copyright and quit' + out.puts + out.puts 'Tasks:' + TASKS.each do |name, desc| + out.printf fmt, name, desc + end + + fmt = " %-24s %s [%s]\n" + out.puts + out.puts 'Options for CONFIG or ALL:' + ConfigTable.each do |item| + out.printf fmt, item.help_opt, item.description, item.help_default + end + out.printf fmt, '--rbconfig=path', 'rbconfig.rb to load',"running ruby's" + out.puts + out.puts 'Options for INSTALL:' + out.printf fmt, '--no-harm', 'only display what to do if given', 'off' + out.printf fmt, '--prefix=path', 'install path prefix', '$prefix' + out.puts + end + + # + # Task Handlers + # + + def exec_config + @installer.exec_config + @config.save # must be final + end + + def exec_setup + @installer.exec_setup + end + + def exec_install + @installer.exec_install + end + + def exec_show + ConfigTable.each do |i| + printf "%-20s %s\n", i.name, i.value + end + end + + def exec_clean + @installer.exec_clean + end + + def exec_distclean + @installer.exec_distclean + end + +end + + +class ToplevelInstallerMulti < ToplevelInstaller + + include HookUtils + include HookScriptAPI + include FileOperations + + def initialize(ardir) + super + @packages = all_dirs_in("#{@ardir}/packages") + raise 'no package exists' if @packages.empty? + end + + def run_metaconfigs + eval_file_ifexist "#{@ardir}/metaconfig" + @packages.each do |name| + eval_file_ifexist "#{@ardir}/packages/#{name}/metaconfig" + end + end + + def init_installers + @installers = {} + @packages.each do |pack| + @installers[pack] = Installer.new(@config, @options, + "#{@ardir}/packages/#{pack}", + "packages/#{pack}") + end + + with = extract_selection(config('with')) + without = extract_selection(config('without')) + @selected = @installers.keys.select {|name| + (with.empty? or with.include?(name)) \ + and not without.include?(name) + } + end + + def extract_selection(list) + a = list.split(/,/) + a.each do |name| + setup_rb_error "no such package: #{name}" unless @installers.key?(name) + end + a + end + + def print_usage(f) + super + f.puts 'Inluded packages:' + f.puts ' ' + @packages.sort.join(' ') + f.puts + end + + # + # multi-package metaconfig API + # + + attr_reader :packages + + def declare_packages(list) + raise 'package list is empty' if list.empty? + list.each do |name| + raise "directory packages/#{name} does not exist"\ + unless File.dir?("#{@ardir}/packages/#{name}") + end + @packages = list + end + + # + # Task Handlers + # + + def exec_config + run_hook 'pre-config' + each_selected_installers {|inst| inst.exec_config } + run_hook 'post-config' + @config.save # must be final + end + + def exec_setup + run_hook 'pre-setup' + each_selected_installers {|inst| inst.exec_setup } + run_hook 'post-setup' + end + + def exec_install + run_hook 'pre-install' + each_selected_installers {|inst| inst.exec_install } + run_hook 'post-install' + end + + def exec_clean + rm_f ConfigTable.savefile + run_hook 'pre-clean' + each_selected_installers {|inst| inst.exec_clean } + run_hook 'post-clean' + end + + def exec_distclean + rm_f ConfigTable.savefile + run_hook 'pre-distclean' + each_selected_installers {|inst| inst.exec_distclean } + run_hook 'post-distclean' + end + + # + # lib + # + + def each_selected_installers + Dir.mkdir 'packages' unless File.dir?('packages') + @selected.each do |pack| + $stderr.puts "Processing the package `#{pack}' ..." if @options['verbose'] + Dir.mkdir "packages/#{pack}" unless File.dir?("packages/#{pack}") + Dir.chdir "packages/#{pack}" + yield @installers[pack] + Dir.chdir '../..' + end + end + + def verbose? + @options['verbose'] + end + + def no_harm? + @options['no-harm'] + end + +end + + +class Installer + + FILETYPES = %w( bin lib ext data ) + + include HookScriptAPI + include HookUtils + include FileOperations + + def initialize(config, opt, srcroot, objroot) + @config = config + @options = opt + @srcdir = File.expand_path(srcroot) + @objdir = File.expand_path(objroot) + @currdir = '.' + end + + def inspect + "#<#{self.class} #{File.basename(@srcdir)}>" + end + + # + # Hook Script API base methods + # + + def srcdir_root + @srcdir + end + + def objdir_root + @objdir + end + + def relpath + @currdir + end + + # + # configs/options + # + + def no_harm? + @options['no-harm'] + end + + def verbose? + @options['verbose'] + end + + def verbose_off + begin + save, @options['verbose'] = @options['verbose'], false + yield + ensure + @options['verbose'] = save + end + end + + # + # TASK config + # + + def exec_config + exec_task_traverse 'config' + end + + def config_dir_bin(rel) + end + + def config_dir_lib(rel) + end + + def config_dir_ext(rel) + extconf if extdir?(curr_srcdir()) + end + + def extconf + opt = @options['config-opt'].join(' ') + command "#{config('rubyprog')} #{curr_srcdir()}/extconf.rb #{opt}" + end + + def config_dir_data(rel) + end + + # + # TASK setup + # + + def exec_setup + exec_task_traverse 'setup' + end + + def setup_dir_bin(rel) + all_files_in(curr_srcdir()).each do |fname| + adjust_shebang "#{curr_srcdir()}/#{fname}" + end + end + + def adjust_shebang(path) + return if no_harm? + tmpfile = File.basename(path) + '.tmp' + begin + File.open(path, 'rb') {|r| + first = r.gets + return unless File.basename(config('rubypath')) == 'ruby' + return unless File.basename(first.sub(/\A\#!/, '').split[0]) == 'ruby' + $stderr.puts "adjusting shebang: #{File.basename(path)}" if verbose? + File.open(tmpfile, 'wb') {|w| + w.print first.sub(/\A\#!\s*\S+/, '#! ' + config('rubypath')) + w.write r.read + } + move_file tmpfile, File.basename(path) + } + ensure + File.unlink tmpfile if File.exist?(tmpfile) + end + end + + def setup_dir_lib(rel) + end + + def setup_dir_ext(rel) + make if extdir?(curr_srcdir()) + end + + def setup_dir_data(rel) + end + + # + # TASK install + # + + def exec_install + rm_f 'InstalledFiles' + exec_task_traverse 'install' + end + + def install_dir_bin(rel) + install_files collect_filenames_auto(), "#{config('bindir')}/#{rel}", 0755 + end + + def install_dir_lib(rel) + install_files ruby_scripts(), "#{config('rbdir')}/#{rel}", 0644 + end + + def install_dir_ext(rel) + return unless extdir?(curr_srcdir()) + install_files ruby_extentions('.'), + "#{config('sodir')}/#{File.dirname(rel)}", + 0555 + end + + def install_dir_data(rel) + install_files collect_filenames_auto(), "#{config('datadir')}/#{rel}", 0644 + end + + def install_files(list, dest, mode) + mkdir_p dest, @options['install-prefix'] + list.each do |fname| + install fname, dest, mode, @options['install-prefix'] + end + end + + def ruby_scripts + collect_filenames_auto().select {|n| /\.rb\z/ =~ n } + end + + # picked up many entries from cvs-1.11.1/src/ignore.c + reject_patterns = %w( + core RCSLOG tags TAGS .make.state + .nse_depinfo #* .#* cvslog.* ,* .del-* *.olb + *~ *.old *.bak *.BAK *.orig *.rej _$* *$ + + *.org *.in .* + ) + mapping = { + '.' => '\.', + '$' => '\$', + '#' => '\#', + '*' => '.*' + } + REJECT_PATTERNS = Regexp.new('\A(?:' + + reject_patterns.map {|pat| + pat.gsub(/[\.\$\#\*]/) {|ch| mapping[ch] } + }.join('|') + + ')\z') + + def collect_filenames_auto + mapdir((existfiles() - hookfiles()).reject {|fname| + REJECT_PATTERNS =~ fname + }) + end + + def existfiles + all_files_in(curr_srcdir()) | all_files_in('.') + end + + def hookfiles + %w( pre-%s post-%s pre-%s.rb post-%s.rb ).map {|fmt| + %w( config setup install clean ).map {|t| sprintf(fmt, t) } + }.flatten + end + + def mapdir(filelist) + filelist.map {|fname| + if File.exist?(fname) # objdir + fname + else # srcdir + File.join(curr_srcdir(), fname) + end + } + end + + def ruby_extentions(dir) + Dir.open(dir) {|d| + ents = d.select {|fname| /\.#{::Config::CONFIG['DLEXT']}\z/ =~ fname } + if ents.empty? + setup_rb_error "no ruby extention exists: 'ruby #{$0} setup' first" + end + return ents + } + end + + # + # TASK clean + # + + def exec_clean + exec_task_traverse 'clean' + rm_f ConfigTable.savefile + rm_f 'InstalledFiles' + end + + def clean_dir_bin(rel) + end + + def clean_dir_lib(rel) + end + + def clean_dir_ext(rel) + return unless extdir?(curr_srcdir()) + make 'clean' if File.file?('Makefile') + end + + def clean_dir_data(rel) + end + + # + # TASK distclean + # + + def exec_distclean + exec_task_traverse 'distclean' + rm_f ConfigTable.savefile + rm_f 'InstalledFiles' + end + + def distclean_dir_bin(rel) + end + + def distclean_dir_lib(rel) + end + + def distclean_dir_ext(rel) + return unless extdir?(curr_srcdir()) + make 'distclean' if File.file?('Makefile') + end + + # + # lib + # + + def exec_task_traverse(task) + run_hook "pre-#{task}" + FILETYPES.each do |type| + if config('without-ext') == 'yes' and type == 'ext' + $stderr.puts 'skipping ext/* by user option' if verbose? + next + end + traverse task, type, "#{task}_dir_#{type}" + end + run_hook "post-#{task}" + end + + def traverse(task, rel, mid) + dive_into(rel) { + run_hook "pre-#{task}" + __send__ mid, rel.sub(%r[\A.*?(?:/|\z)], '') + all_dirs_in(curr_srcdir()).each do |d| + traverse task, "#{rel}/#{d}", mid + end + run_hook "post-#{task}" + } + end + + def dive_into(rel) + return unless File.dir?("#{@srcdir}/#{rel}") + + dir = File.basename(rel) + Dir.mkdir dir unless File.dir?(dir) + prevdir = Dir.pwd + Dir.chdir dir + $stderr.puts '---> ' + rel if verbose? + @currdir = rel + yield + Dir.chdir prevdir + $stderr.puts '<--- ' + rel if verbose? + @currdir = File.dirname(rel) + end + +end + + +if $0 == __FILE__ + begin + if multipackage_install? + ToplevelInstallerMulti.invoke + else + ToplevelInstaller.invoke + end + rescue SetupError + raise if $DEBUG + $stderr.puts $!.message + $stderr.puts "Try 'ruby #{$0} --help' for detailed usage." + exit 1 + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/site/.cvsignore b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/site/.cvsignore new file mode 100644 index 000000000..e43b0f988 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/site/.cvsignore @@ -0,0 +1 @@ +.DS_Store diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/site/highline.css b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/site/highline.css new file mode 100644 index 000000000..8ccc62a1f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/site/highline.css @@ -0,0 +1,65 @@ +body { + margin: 0; + padding: 0; + text-align: center; + background: #abc; + font: 13px Trebuchet MS, Lucida Sans Unicode, Arial, sans-serif; +} + +#container { + margin: 0 auto; + margin-top: 10px; + position: relative; + width: 785px; + background: #fff repeat; + padding-top: 20px; +} + +#container #header { + padding-top: 20px; + height: 141px; + width: 785px; + background: url(images/logo.png) center no-repeat; +} + +#container #content { + text-align: left; + margin-left: 230px; + width: 500px; +} + +#container #sidebar { + text-align: left; + position: absolute; + top: 181px; + left: 0; + width: 170px; + margin-right: 25px; +} + +#container #footer { + font: 9px Arial; + padding: 4px; + border-top: 1px solid; + color: #aaa; +} + +ul { + list-style: none; +} + +li { + border-bottom: 1px solid #e8e8e8; + padding-top: 10px; +} + +a { + text-decoration: none; + color: #15528a; +} + +pre { + padding: 5px; + padding-left: 20px; + font: 11px Courier; +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/site/images/logo.png b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/site/images/logo.png new file mode 100644 index 000000000..1323a59ae Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/site/images/logo.png differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/site/index.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/site/index.html new file mode 100644 index 000000000..d296aa201 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/site/index.html @@ -0,0 +1,58 @@ + + + HighLine + + + +
    + +
    +

    HighLine is about…

    + + +

    Saving time.

    + + +

    Command line interfaces are meant to be easy. So why shouldn’t building +them be easy, too? HighLine provides a solid toolset to help you get +the job done cleanly so you can focus on the real task at hand, +your task.

    + + +

    Clean and intuitive design.

    + + +

    Want to get a taste for how HighLine is used? Take a look at this simple +example, which asks a user for a zip code, automatically does validation, +and returns the result:

    + + +
    zip = ask("Zip?  ") { |q| q.validate = /\A\d{5}(?:-?\d{4})?\Z/ }
    + + +

    Hassle-free Installation.

    + + +

    Installation is easy via RubyGems. Simply enter the command:

    + + +
    sudo gem install highline
    + + +

    and you’ll be on your way! Of course, manual installation is an option, +too.

    +
    + + +
    + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/string_methods.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/string_methods.rb new file mode 100644 index 000000000..0ae2c5c5b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/string_methods.rb @@ -0,0 +1,32 @@ +# string_methods.rb +# +# Created by Richard LeBer 2011-06-27 +# +# This is Free Software. See LICENSE and COPYING for details. +# +# String class convenience methods + +module StringMethods + def test_color + assert_equal("\e[34mstring\e[0m", @string.color(:blue)) + assert_equal("\e[1m\e[47mstring\e[0m", @string.color(:bold,:on_white)) + assert_equal("\e[45mstring\e[0m", @string.on(:magenta)) + assert_equal("\e[36mstring\e[0m", @string.cyan) + assert_equal("\e[41m\e[5mstring\e[0m\e[0m", @string.blink.on_red) + assert_equal("\e[38;5;137mstring\e[0m", @string.color(:rgb_906030)) + assert_equal("\e[38;5;101mstring\e[0m", @string.rgb('606030')) + assert_equal("\e[38;5;107mstring\e[0m", @string.rgb('60','90','30')) + assert_equal("\e[38;5;107mstring\e[0m", @string.rgb(96,144,48)) + assert_equal("\e[38;5;173mstring\e[0m", @string.rgb_c06030) + assert_equal("\e[48;5;137mstring\e[0m", @string.color(:on_rgb_906030)) + assert_equal("\e[48;5;101mstring\e[0m", @string.on_rgb('606030')) + assert_equal("\e[48;5;107mstring\e[0m", @string.on_rgb('60','90','30')) + assert_equal("\e[48;5;107mstring\e[0m", @string.on_rgb(96,144,48)) + assert_equal("\e[48;5;173mstring\e[0m", @string.on_rgb_c06030) + end + + def test_uncolor + colored_string = HighLine::String("\e[38;5;137mstring\e[0m") + assert_equal "string", colored_string.uncolor + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_color_scheme.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_color_scheme.rb new file mode 100644 index 000000000..a6c6c1aa3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_color_scheme.rb @@ -0,0 +1,96 @@ +# tc_color_scheme.rb +# +# Created by Jeremy Hinegardner on 2007-01-24. +# Copyright 2007 Jeremy Hinegardner. All rights reserved. +# +# This is Free Software. See LICENSE and COPYING for details. + +require "test/unit" + +require "highline" +require "stringio" + +class TestColorScheme < Test::Unit::TestCase + def setup + @input = StringIO.new + @output = StringIO.new + @terminal = HighLine.new(@input, @output) + + @old_color_scheme = HighLine.color_scheme + end + + def teardown + HighLine.color_scheme = @old_color_scheme + end + + def test_using_color_scheme + assert_equal(false,HighLine.using_color_scheme?) + + HighLine.color_scheme = HighLine::ColorScheme.new + assert_equal(true,HighLine.using_color_scheme?) + end + + def test_scheme + HighLine.color_scheme = HighLine::SampleColorScheme.new + + @terminal.say("This should be <%= color('warning yellow', :warning) %>.") + assert_equal("This should be \e[1m\e[33mwarning yellow\e[0m.\n",@output.string) + @output.rewind + + @terminal.say("This should be <%= color('warning yellow', 'warning') %>.") + assert_equal("This should be \e[1m\e[33mwarning yellow\e[0m.\n",@output.string) + @output.rewind + + @terminal.say("This should be <%= color('warning yellow', 'WarNing') %>.") + assert_equal("This should be \e[1m\e[33mwarning yellow\e[0m.\n",@output.string) + @output.rewind + + # Check that keys are available, and as expected + assert_equal ["critical", "error", "warning", "notice", "info", "debug", "row_even", "row_odd"].sort, + HighLine.color_scheme.keys.sort + + # Color scheme doesn't care if we use symbols or strings, and is case-insensitive + warning1 = HighLine.color_scheme[:warning] + warning2 = HighLine.color_scheme["warning"] + warning3 = HighLine.color_scheme[:wArning] + warning4 = HighLine.color_scheme["warniNg"] + assert_instance_of HighLine::Style, warning1 + assert_instance_of HighLine::Style, warning2 + assert_instance_of HighLine::Style, warning3 + assert_instance_of HighLine::Style, warning4 + assert_equal warning1, warning2 + assert_equal warning1, warning3 + assert_equal warning1, warning4 + + # Nonexistent keys return nil + assert_nil HighLine.color_scheme[:nonexistent] + + # Same as above, for definitions + defn1 = HighLine.color_scheme.definition(:warning) + defn2 = HighLine.color_scheme.definition("warning") + defn3 = HighLine.color_scheme.definition(:wArning) + defn4 = HighLine.color_scheme.definition("warniNg") + assert_instance_of Array, defn1 + assert_instance_of Array, defn2 + assert_instance_of Array, defn3 + assert_instance_of Array, defn4 + assert_equal [:bold, :yellow], defn1 + assert_equal [:bold, :yellow], defn2 + assert_equal [:bold, :yellow], defn3 + assert_equal [:bold, :yellow], defn4 + assert_nil HighLine.color_scheme.definition(:nonexistent) + + color_scheme_hash = HighLine.color_scheme.to_hash + assert_instance_of Hash, color_scheme_hash + assert_equal ["critical", "error", "warning", "notice", "info", "debug", "row_even", "row_odd"].sort, + color_scheme_hash.keys.sort + assert_instance_of Array, HighLine.color_scheme.definition(:warning) + assert_equal [:bold, :yellow], HighLine.color_scheme.definition(:warning) + + # turn it back off, should raise an exception + HighLine.color_scheme = @old_color_scheme + assert_raises(NameError) { + @terminal.say("This should be <%= color('nothing at all', :error) %>.") + } + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_highline.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_highline.rb new file mode 100755 index 000000000..26e155237 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_highline.rb @@ -0,0 +1,1134 @@ +# tc_highline.rb +# +# Created by James Edward Gray II on 2005-04-26. +# Copyright 2005 Gray Productions. All rights reserved. +# +# This is Free Software. See LICENSE and COPYING for details. + +require "test/unit" + +require "highline" +require "stringio" + +if HighLine::CHARACTER_MODE == "Win32API" + class HighLine + # Override Windows' character reading so it's not tied to STDIN. + def get_character( input = STDIN ) + input.getc + end + end +end + +class TestHighLine < Test::Unit::TestCase + def setup + @input = StringIO.new + @output = StringIO.new + @terminal = HighLine.new(@input, @output) + end + + def test_agree + @input << "y\nyes\nYES\nHell no!\nNo\n" + @input.rewind + + assert_equal(true, @terminal.agree("Yes or no? ")) + assert_equal(true, @terminal.agree("Yes or no? ")) + assert_equal(true, @terminal.agree("Yes or no? ")) + assert_equal(false, @terminal.agree("Yes or no? ")) + + @input.truncate(@input.rewind) + @input << "yellow" + @input.rewind + + assert_equal(true, @terminal.agree("Yes or no? ", :getc)) + end + + def test_agree_with_block + @input << "\n\n" + @input.rewind + + assert_equal(true, @terminal.agree("Yes or no? ") { |q| q.default = "y" }) + assert_equal(false, @terminal.agree("Yes or no? ") { |q| q.default = "n" }) + end + + def test_ask + name = "James Edward Gray II" + @input << name << "\n" + @input.rewind + + assert_equal(name, @terminal.ask("What is your name? ")) + + assert_raise(EOFError) { @terminal.ask("Any input left? ") } + end + + def test_ask_string + name = "James Edward Gray II" + @input << name << "\n" + @input.rewind + + assert_equal(name, @terminal.ask("What is your name? ", String)) + + assert_raise(EOFError) { @terminal.ask("Any input left? ", String) } + end + + def test_indent + text = "Testing...\n" + @terminal.indent_level=1 + @terminal.say(text) + assert_equal(' '*3+text, @output.string) + + @output.truncate(@output.rewind) + @terminal.indent_level=3 + @terminal.say(text) + assert_equal(' '*9+text, @output.string) + + @output.truncate(@output.rewind) + @terminal.indent_level=0 + @terminal.indent_size=5 + @terminal.indent(2, text) + assert_equal(' '*10+text, @output.string) + + @output.truncate(@output.rewind) + @terminal.indent_size=4 + @terminal.indent { + @terminal.say(text) + } + assert_equal(' '*4+text, @output.string) + + @output.truncate(@output.rewind) + @terminal.indent_size=2 + @terminal.indent(3) { |t| + t.say(text) + } + assert_equal(' '*6+text, @output.string) + + @output.truncate(@output.rewind) + @terminal.indent { |t| + t.indent { + t.indent { + t.indent { |tt| + tt.say(text) + } + } + } + } + assert_equal(' '*8+text, @output.string) + + text = "Multi\nLine\nIndentation\n" + indent = ' '*4 + @terminal.indent_level=2 + @output.truncate(@output.rewind) + @terminal.say(text) + assert_equal("#{indent}Multi\n#{indent}Line\n#{indent}Indentation\n", @output.string) + + @output.truncate(@output.rewind) + @terminal.multi_indent = false + @terminal.say(text) + assert_equal("#{indent}Multi\nLine\nIndentation\n", @output.string) + + @output.truncate(@output.rewind) + @terminal.indent(0, text, true) + assert_equal("#{indent}Multi\n#{indent}Line\n#{indent}Indentation\n", @output.string) + end + + def test_newline + @terminal.newline + @terminal.newline + assert_equal("\n\n", @output.string) + end + + def test_bug_fixes + # auto-complete bug + @input << "ruby\nRuby\n" + @input.rewind + + languages = [:Perl, :Python, :Ruby] + answer = @terminal.ask( "What is your favorite programming language? ", + languages ) + assert_equal(languages.last, answer) + + @input.truncate(@input.rewind) + @input << "ruby\n" + @input.rewind + + answer = @terminal.ask( "What is your favorite programming language? ", + languages ) do |q| + q.case = :capitalize + end + assert_equal(languages.last, answer) + + # poor auto-complete error message + @input.truncate(@input.rewind) + @input << "lisp\nruby\n" + @input.rewind + @output.truncate(@output.rewind) + + answer = @terminal.ask( "What is your favorite programming language? ", + languages ) do |q| + q.case = :capitalize + end + assert_equal(languages.last, answer) + assert_equal( "What is your favorite programming language? " + + "You must choose one of [Perl, Python, Ruby].\n" + + "? ", @output.string ) + end + + def test_case_changes + @input << "jeg2\n" + @input.rewind + + answer = @terminal.ask("Enter your initials ") do |q| + q.case = :up + end + assert_equal("JEG2", answer) + + @input.truncate(@input.rewind) + @input << "cRaZY\n" + @input.rewind + + answer = @terminal.ask("Enter a search string: ") do |q| + q.case = :down + end + assert_equal("crazy", answer) + end + + def test_character_echo + @input << "password\r" + @input.rewind + + answer = @terminal.ask("Please enter your password: ") do |q| + q.echo = "*" + end + assert_equal("password", answer) + assert_equal("Please enter your password: ********\n", @output.string) + + @input.truncate(@input.rewind) + @input << "2" + @input.rewind + @output.truncate(@output.rewind) + + answer = @terminal.ask( "Select an option (1, 2 or 3): ", + Integer ) do |q| + q.echo = "*" + q.character = true + end + assert_equal(2, answer) + assert_equal("Select an option (1, 2 or 3): *\n", @output.string) + end + + def test_backspace_does_not_enter_prompt + @input << "\b\b" + @input.rewind + answer = @terminal.ask("Please enter your password: ") do |q| + q.echo = "*" + end + assert_equal("", answer) + assert_equal("Please enter your password: \n", @output.string) + end + + def test_readline_on_non_echo_question_has_prompt + @input << "you can't see me" + @input.rewind + answer = @terminal.ask("Please enter some hidden text: ") do |q| + q.readline = true + q.echo = "*" + end + assert_equal("you can't see me", answer) + assert_equal("Please enter some hidden text: ****************\n", @output.string) + end + + def test_character_reading + # WARNING: This method does NOT cover Unix and Windows savvy testing! + @input << "12345" + @input.rewind + + answer = @terminal.ask("Enter a single digit: ", Integer) do |q| + q.character = :getc + end + assert_equal(1, answer) + end + + def test_frozen_statement + @terminal.say('This is a frozen statement'.freeze) + assert_equal("This is a frozen statement\n", @output.string) + end + + def test_color + @terminal.say("This should be <%= BLUE %>blue<%= CLEAR %>!") + assert_equal("This should be \e[34mblue\e[0m!\n", @output.string) + + @output.truncate(@output.rewind) + + @terminal.say( "This should be " + + "<%= BOLD + ON_WHITE %>bold on white<%= CLEAR %>!" ) + assert_equal( "This should be \e[1m\e[47mbold on white\e[0m!\n", + @output.string ) + + @output.truncate(@output.rewind) + + @terminal.say("This should be <%= color('cyan', CYAN) %>!") + assert_equal("This should be \e[36mcyan\e[0m!\n", @output.string) + + @output.truncate(@output.rewind) + + @terminal.say( "This should be " + + "<%= color('blinking on red', :blink, :on_red) %>!" ) + assert_equal( "This should be \e[5m\e[41mblinking on red\e[0m!\n", + @output.string ) + + @output.truncate(@output.rewind) + + @terminal.say("This should be <%= NONE %>none<%= CLEAR %>!") + assert_equal("This should be \e[38mnone\e[0m!\n", @output.string) + + @output.truncate(@output.rewind) + + @terminal.say("This should be <%= RGB_906030 %>rgb_906030<%= CLEAR %>!") + assert_equal("This should be \e[38;5;137mrgb_906030\e[0m!\n", @output.string) + + @output.truncate(@output.rewind) + + @terminal.say("This should be <%= ON_RGB_C06030 %>on_rgb_c06030<%= CLEAR %>!") + assert_equal("This should be \e[48;5;173mon_rgb_c06030\e[0m!\n", @output.string) + + @output.truncate(@output.rewind) + + # Does class method work, too? + @terminal.say("This should be <%= HighLine.color('reverse underlined magenta', :reverse, :underline, :magenta) %>!") + assert_equal( "This should be \e[7m\e[4m\e[35mreverse underlined magenta\e[0m!\n", + @output.string ) + + @output.truncate(@output.rewind) + + # turn off color + old_setting = HighLine.use_color? + assert_nothing_raised(Exception) { HighLine.use_color = false } + @terminal.say("This should be <%= color('cyan', CYAN) %>!") + assert_equal("This should be cyan!\n", @output.string) + HighLine.use_color = old_setting + end + + def test_uncolor + # instance method + assert_equal( "This should be reverse underlined magenta!\n", + @terminal.uncolor("This should be \e[7m\e[4m\e[35mreverse underlined magenta\e[0m!\n") + ) + + @output.truncate(@output.rewind) + + # class method + assert_equal( "This should be reverse underlined magenta!\n", + HighLine.uncolor("This should be \e[7m\e[4m\e[35mreverse underlined magenta\e[0m!\n") + ) + + @output.truncate(@output.rewind) + + # RGB color + assert_equal( "This should be rgb_906030!\n", + @terminal.uncolor("This should be \e[38;5;137mrgb_906030\e[0m!\n") + ) + end + + def test_confirm + @input << "junk.txt\nno\nsave.txt\ny\n" + @input.rewind + + answer = @terminal.ask("Enter a filename: ") do |q| + q.confirm = "Are you sure you want to overwrite <%= @answer %>? " + q.responses[:ask_on_error] = :question + end + assert_equal("save.txt", answer) + assert_equal( "Enter a filename: " + + "Are you sure you want to overwrite junk.txt? " + + "Enter a filename: " + + "Are you sure you want to overwrite save.txt? ", + @output.string ) + + @input.truncate(@input.rewind) + @input << "junk.txt\nyes\nsave.txt\nn\n" + @input.rewind + @output.truncate(@output.rewind) + + answer = @terminal.ask("Enter a filename: ") do |q| + q.confirm = "Are you sure you want to overwrite <%= @answer %>? " + end + assert_equal("junk.txt", answer) + assert_equal( "Enter a filename: " + + "Are you sure you want to overwrite junk.txt? ", + @output.string ) + end + + def test_defaults + @input << "\nNo Comment\n" + @input.rewind + + answer = @terminal.ask("Are you sexually active? ") do |q| + q.validate = /\Ay(?:es)?|no?|no comment\Z/i + end + assert_equal("No Comment", answer) + + @input.truncate(@input.rewind) + @input << "\nYes\n" + @input.rewind + @output.truncate(@output.rewind) + + answer = @terminal.ask("Are you sexually active? ") do |q| + q.default = "No Comment" + q.validate = /\Ay(?:es)?|no?|no comment\Z/i + end + assert_equal("No Comment", answer) + assert_equal( "Are you sexually active? |No Comment| ", + @output.string ) + end + + def test_string_preservation + @input << "Maybe\nYes\n" + @input.rewind + + my_string = "Is that your final answer? " + + @terminal.ask(my_string) { |q| q.default = "Possibly" } + @terminal.ask(my_string) { |q| q.default = "Maybe" } + + assert_equal("Is that your final answer? ", my_string) + end + + def test_empty + @input << "\n" + @input.rewind + + answer = @terminal.ask("") do |q| + q.default = "yes" + q.validate = /\Ay(?:es)?|no?\Z/i + end + assert_equal("yes", answer) + end + + def test_erb + @terminal.say( "The integers from 1 to 10 are:\n" + + "% (1...10).each do |n|\n" + + "\t<%= n %>,\n" + + "% end\n" + + "\tand 10" ) + assert_equal( "The integers from 1 to 10 are:\n" + + "\t1,\n\t2,\n\t3,\n\t4,\n\t5,\n" + + "\t6,\n\t7,\n\t8,\n\t9,\n\tand 10\n", + @output.string ) + end + + def test_files + @input << "#{File.basename(__FILE__)[0, 5]}\n" + @input.rewind + + assert_equal "tc_hi\n",@input.read + @input.rewind + + file = @terminal.ask("Select a file: ", File) do |q| + q.directory = File.expand_path(File.dirname(__FILE__)) + q.glob = "*.rb" + end + assert_instance_of(File, file) + assert_equal("# tc_highline.rb\n", file.gets) + file.close + + @input.rewind + + pathname = @terminal.ask("Select a file: ", Pathname) do |q| + q.directory = File.expand_path(File.dirname(__FILE__)) + q.glob = "*.rb" + end + assert_instance_of(Pathname, pathname) + assert_equal(File.size(__FILE__), pathname.size) + end + + def test_gather + @input << "James\nDana\nStorm\nGypsy\n\n" + @input.rewind + + answers = @terminal.ask("Enter four names:") do |q| + q.gather = 4 + end + assert_equal(%w{James Dana Storm Gypsy}, answers) + assert_equal("\n", @input.gets) + assert_equal("Enter four names:\n", @output.string) + + @input.rewind + + answers = @terminal.ask("Enter four names:") do |q| + q.gather = "" + end + assert_equal(%w{James Dana Storm Gypsy}, answers) + + @input.rewind + + answers = @terminal.ask("Enter four names:") do |q| + q.gather = /^\s*$/ + end + assert_equal(%w{James Dana Storm Gypsy}, answers) + + @input.truncate(@input.rewind) + @input << "29\n49\n30\n" + @input.rewind + @output.truncate(@output.rewind) + + answers = @terminal.ask("<%= @key %>: ", Integer) do |q| + q.gather = { "Age" => 0, "Wife's Age" => 0, "Father's Age" => 0} + end + assert_equal( { "Age" => 29, "Wife's Age" => 30, "Father's Age" => 49}, + answers ) + assert_equal("Age: Father's Age: Wife's Age: ", @output.string) + end + + def test_typing_verification + @input << "all work and no play makes jack a dull boy\n" * 3 + @input.rewind + + answer = @terminal.ask("How's work? ") do |q| + q.gather = 3 + q.verify_match = true + end + assert_equal("all work and no play makes jack a dull boy", answer) + + @input.truncate(@input.rewind) + @input << "all play and no work makes jack a mere toy\n" + @input << "all work and no play makes jack a dull boy\n" * 5 + @input.rewind + @output.truncate(@output.rewind) + + answer = @terminal.ask("How are things going? ") do |q| + q.gather = 3 + q.verify_match = true + q.responses[:mismatch] = 'Typing mismatch!' + q.responses[:ask_on_error] = '' + end + assert_equal("all work and no play makes jack a dull boy", answer) + + # now try using a hash for gather + + @input.truncate(@input.rewind) + @input << "Password\nPassword\n" + @input.rewind + @output.truncate(@output.rewind) + + answer = @terminal.ask("<%= @key %>: ") do |q| + q.verify_match = true + q.gather = {"Enter a password" => '', "Please type it again" => ''} + end + assert_equal("Password", answer) + + @input.truncate(@input.rewind) + @input << "Password\nMistake\nPassword\nPassword\n" + @input.rewind + @output.truncate(@output.rewind) + + answer = @terminal.ask("<%= @key %>: ") do |q| + q.verify_match = true + q.responses[:mismatch] = 'Typing mismatch!' + q.responses[:ask_on_error] = '' + q.gather = {"Enter a password" => '', "Please type it again" => ''} + end + + assert_equal("Password", answer) + assert_equal( "Enter a password: " + + "Please type it again: " + + "Typing mismatch!\n" + + "Enter a password: " + + "Please type it again: ", @output.string ) + end + + def test_lists + digits = %w{Zero One Two Three Four Five Six Seven Eight Nine} + erb_digits = digits.dup + erb_digits[erb_digits.index("Five")] = "<%= color('Five', :blue) %%>" + + @terminal.say("<%= list(#{digits.inspect}) %>") + assert_equal(digits.map { |d| "#{d}\n" }.join, @output.string) + + @output.truncate(@output.rewind) + + @terminal.say("<%= list(#{digits.inspect}, :inline) %>") + assert_equal( digits[0..-2].join(", ") + " or #{digits.last}\n", + @output.string ) + + @output.truncate(@output.rewind) + + @terminal.say("<%= list(#{digits.inspect}, :inline, ' and ') %>") + assert_equal( digits[0..-2].join(", ") + " and #{digits.last}\n", + @output.string ) + + @output.truncate(@output.rewind) + + @terminal.say("<%= list(#{digits.inspect}, :columns_down, 3) %>") + assert_equal( "Zero Four Eight\n" + + "One Five Nine \n" + + "Two Six \n" + + "Three Seven\n", + @output.string ) + + @output.truncate(@output.rewind) + + @terminal.say("<%= list(#{erb_digits.inspect}, :columns_down, 3) %>") + assert_equal( "Zero Four Eight\n" + + "One \e[34mFive\e[0m Nine \n" + + "Two Six \n" + + "Three Seven\n", + @output.string ) + + colums_of_twenty = ["12345678901234567890"] * 5 + + @output.truncate(@output.rewind) + + @terminal.say("<%= list(#{colums_of_twenty.inspect}, :columns_down) %>") + assert_equal( "12345678901234567890 12345678901234567890 " + + "12345678901234567890\n" + + "12345678901234567890 12345678901234567890\n", + @output.string ) + + @output.truncate(@output.rewind) + + @terminal.say("<%= list(#{digits.inspect}, :columns_across, 3) %>") + assert_equal( "Zero One Two \n" + + "Three Four Five \n" + + "Six Seven Eight\n" + + "Nine \n", + @output.string ) + + colums_of_twenty.pop + + @output.truncate(@output.rewind) + + @terminal.say("<%= list( #{colums_of_twenty.inspect}, :columns_across ) %>") + assert_equal( "12345678901234567890 12345678901234567890 " + + "12345678901234567890\n" + + "12345678901234567890\n", + @output.string ) + + @output.truncate(@output.rewind) + + wide = %w[0123456789 a b c d e f g h i j k l m n o p q r s t u v w x y z] + + @terminal.say("<%= list( #{wide.inspect}, :uneven_columns_across ) %>") + assert_equal( "0123456789 a b c d e f g h i j k l m n o " + + "p q r s t u v w\n" + + "x y z\n", + @output.string ) + + @output.truncate(@output.rewind) + + @terminal.say("<%= list( #{wide.inspect}, :uneven_columns_across, 10 ) %>") + assert_equal( "0123456789 a b c d e f g h i\n" + + "j k l m n o p q r s\n" + + "t u v w x y z\n", + @output.string ) + + @output.truncate(@output.rewind) + + @terminal.say("<%= list( #{wide.inspect}, :uneven_columns_down ) %>") + assert_equal( "0123456789 b d f h j l n p r t v x z\n" + + "a c e g i k m o q s u w y\n", + @output.string ) + + @output.truncate(@output.rewind) + + @terminal.say("<%= list( #{wide.inspect}, :uneven_columns_down, 10 ) %>") + assert_equal( "0123456789 c f i l o r u x\n" + + "a d g j m p s v y\n" + + "b e h k n q t w z\n", + @output.string ) + end + + def test_lists_with_zero_items + modes = [nil, :rows, :inline, :columns_across, :columns_down] + modes.each do |mode| + result = @terminal.list([], mode) + assert_equal("", result) + end + end + + def test_lists_with_nil_items + modes = [nil] + modes.each do |mode| + result = @terminal.list([nil], mode) + assert_equal("\n", result) + end + end + + def test_lists_with_one_item + items = ['Zero'] + modes = { nil => "Zero\n", + :rows => "Zero\n", + :inline => "Zero", + :columns_across => "Zero\n", + :columns_down => "Zero\n" } + + modes.each do |mode, expected| + result = @terminal.list(items, mode) + assert_equal(expected, result) + end + end + + def test_lists_with_two_items + items = ['Zero', 'One'] + modes = { nil => "Zero\nOne\n", + :rows => "Zero\nOne\n", + :inline => "Zero or One", + :columns_across => "Zero One \n", + :columns_down => "Zero One \n" } + + modes.each do |mode, expected| + result = @terminal.list(items, mode) + assert_equal(expected, result) + end + end + + def test_lists_with_three_items + items = ['Zero', 'One', 'Two'] + modes = { nil => "Zero\nOne\nTwo\n", + :rows => "Zero\nOne\nTwo\n", + :inline => "Zero, One or Two", + :columns_across => "Zero One Two \n", + :columns_down => "Zero One Two \n" } + + modes.each do |mode, expected| + result = @terminal.list(items, mode) + assert_equal(expected, result) + end + end + + def test_mode + assert(%w[Win32API termios ncurses stty jline].include?(HighLine::CHARACTER_MODE), + "#{HighLine::CHARACTER_MODE} not in list") + end + + class NameClass + def self.parse( string ) + if string =~ /^\s*(\w+),\s*(\w+)\s+(\w+)\s*$/ + self.new($2, $3, $1) + else + raise ArgumentError, "Invalid name format." + end + end + + def initialize(first, middle, last) + @first, @middle, @last = first, middle, last + end + + attr_reader :first, :middle, :last + end + + def test_my_class_conversion + @input << "Gray, James Edward\n" + @input.rewind + + answer = @terminal.ask("Your name? ", NameClass) do |q| + q.validate = lambda do |name| + names = name.split(/,\s*/) + return false unless names.size == 2 + return false if names.first =~ /\s/ + names.last.split.size == 2 + end + end + assert_instance_of(NameClass, answer) + assert_equal("Gray", answer.last) + assert_equal("James", answer.first) + assert_equal("Edward", answer.middle) + end + + def test_no_echo + @input << "password\r" + @input.rewind + + answer = @terminal.ask("Please enter your password: ") do |q| + q.echo = false + end + assert_equal("password", answer) + assert_equal("Please enter your password: \n", @output.string) + + @input.rewind + @output.truncate(@output.rewind) + + answer = @terminal.ask("Pick a letter or number: ") do |q| + q.character = true + q.echo = false + end + assert_equal("p", answer) + assert_equal("a", @input.getc.chr) + assert_equal("Pick a letter or number: \n", @output.string) + end + + def test_paging + @terminal.page_at = 22 + + @input << "\n\n" + @input.rewind + + @terminal.say((1..50).map { |n| "This is line #{n}.\n"}.join) + assert_equal( (1..22).map { |n| "This is line #{n}.\n"}.join + + "\n-- press enter/return to continue or q to stop -- \n\n" + + (23..44).map { |n| "This is line #{n}.\n"}.join + + "\n-- press enter/return to continue or q to stop -- \n\n" + + (45..50).map { |n| "This is line #{n}.\n"}.join, + @output.string ) + end + + def test_range_requirements + @input << "112\n-541\n28\n" + @input.rewind + + answer = @terminal.ask("Tell me your age.", Integer) do |q| + q.in = 0..105 + end + assert_equal(28, answer) + assert_equal( "Tell me your age.\n" + + "Your answer isn't within the expected range " + + "(included in 0..105).\n" + + "? " + + "Your answer isn't within the expected range " + + "(included in 0..105).\n" + + "? ", @output.string ) + + @input.truncate(@input.rewind) + @input << "1\n-541\n28\n" + @input.rewind + @output.truncate(@output.rewind) + + answer = @terminal.ask("Tell me your age.", Integer) do |q| + q.above = 3 + end + assert_equal(28, answer) + assert_equal( "Tell me your age.\n" + + "Your answer isn't within the expected range " + + "(above 3).\n" + + "? " + + "Your answer isn't within the expected range " + + "(above 3).\n" + + "? ", @output.string ) + + @input.truncate(@input.rewind) + @input << "1\n28\n-541\n" + @input.rewind + @output.truncate(@output.rewind) + + answer = @terminal.ask("Lowest numer you can think of?", Integer) do |q| + q.below = 0 + end + assert_equal(-541, answer) + assert_equal( "Lowest numer you can think of?\n" + + "Your answer isn't within the expected range " + + "(below 0).\n" + + "? " + + "Your answer isn't within the expected range " + + "(below 0).\n" + + "? ", @output.string ) + + @input.truncate(@input.rewind) + @input << "1\n-541\n6\n" + @input.rewind + @output.truncate(@output.rewind) + + answer = @terminal.ask("Enter a low even number: ", Integer) do |q| + q.above = 0 + q.below = 10 + q.in = [2, 4, 6, 8] + end + assert_equal(6, answer) + assert_equal( "Enter a low even number: " + + "Your answer isn't within the expected range " + + "(above 0, below 10, and included in [2, 4, 6, 8]).\n" + + "? " + + "Your answer isn't within the expected range " + + "(above 0, below 10, and included in [2, 4, 6, 8]).\n" + + "? ", @output.string ) + end + + def test_reask + number = 61676 + @input << "Junk!\n" << number << "\n" + @input.rewind + + answer = @terminal.ask("Favorite number? ", Integer) + assert_kind_of(Integer, number) + assert_instance_of(Fixnum, number) + assert_equal(number, answer) + assert_equal( "Favorite number? " + + "You must enter a valid Integer.\n" + + "? ", @output.string ) + + @input.rewind + @output.truncate(@output.rewind) + + answer = @terminal.ask("Favorite number? ", Integer) do |q| + q.responses[:ask_on_error] = :question + q.responses[:invalid_type] = "Not a valid number!" + end + assert_kind_of(Integer, number) + assert_instance_of(Fixnum, number) + assert_equal(number, answer) + assert_equal( "Favorite number? " + + "Not a valid number!\n" + + "Favorite number? ", @output.string ) + + @input.truncate(@input.rewind) + @input << "gen\ngene\n" + @input.rewind + @output.truncate(@output.rewind) + + answer = @terminal.ask("Select a mode: ", [:generate, :gentle]) + assert_instance_of(Symbol, answer) + assert_equal(:generate, answer) + assert_equal( "Select a mode: " + + "Ambiguous choice. " + + "Please choose one of [generate, gentle].\n" + + "? ", @output.string ) + end + + def test_response_embedding + @input << "112\n-541\n28\n" + @input.rewind + + answer = @terminal.ask("Tell me your age.", Integer) do |q| + q.in = 0..105 + q.responses[:not_in_range] = "Need a <%= @question.answer_type %>" + + " <%= @question.expected_range %>." + end + assert_equal(28, answer) + assert_equal( "Tell me your age.\n" + + "Need a Integer included in 0..105.\n" + + "? " + + "Need a Integer included in 0..105.\n" + + "? ", @output.string ) + end + + def test_say + @terminal.say("This will have a newline.") + assert_equal("This will have a newline.\n", @output.string) + + @output.truncate(@output.rewind) + + @terminal.say("This will also have one newline.\n") + assert_equal("This will also have one newline.\n", @output.string) + + @output.truncate(@output.rewind) + + @terminal.say("This will not have a newline. ") + assert_equal("This will not have a newline. ", @output.string) + + @output.truncate(@output.rewind) + + @terminal.say("This will not\n end with a newline. ") + assert_equal("This will not\n end with a newline. ", @output.string) + + @output.truncate(@output.rewind) + + @terminal.say("This will \nend with a newline.") + assert_equal("This will \nend with a newline.\n", @output.string) + + @output.truncate(@output.rewind) + + colorized = @terminal.color("This will not have a newline. ", :green) + @terminal.say(colorized) + assert_equal("\e[32mThis will not have a newline. \e[0m", @output.string) + + @output.truncate(@output.rewind) + + colorized = @terminal.color("This will have a newline.", :green) + @terminal.say(colorized) + assert_equal("\e[32mThis will have a newline.\e[0m\n", @output.string) + end + + def test_terminal_size + assert_instance_of(Fixnum, @terminal.terminal_size[0]) + assert_instance_of(Fixnum, @terminal.terminal_size[1]) + end + + def test_type_conversion + number = 61676 + @input << number << "\n" + @input.rewind + + answer = @terminal.ask("Favorite number? ", Integer) + assert_kind_of(Integer, answer) + assert_instance_of(Fixnum, answer) + assert_equal(number, answer) + + @input.truncate(@input.rewind) + number = 1_000_000_000_000_000_000_000_000_000_000 + @input << number << "\n" + @input.rewind + + answer = @terminal.ask("Favorite number? ", Integer) + assert_kind_of(Integer, answer) + assert_instance_of(Bignum, answer) + assert_equal(number, answer) + + @input.truncate(@input.rewind) + number = 10.5002 + @input << number << "\n" + @input.rewind + + answer = @terminal.ask( "Favorite number? ", + lambda { |n| n.to_f.abs.round } ) + assert_kind_of(Integer, answer) + assert_instance_of(Fixnum, answer) + assert_equal(11, answer) + + @input.truncate(@input.rewind) + animal = :dog + @input << animal << "\n" + @input.rewind + + answer = @terminal.ask("Favorite animal? ", Symbol) + assert_instance_of(Symbol, answer) + assert_equal(animal, answer) + + @input.truncate(@input.rewind) + @input << "16th June 1976\n" + @input.rewind + + answer = @terminal.ask("Enter your birthday.", Date) + assert_instance_of(Date, answer) + assert_equal(16, answer.day) + assert_equal(6, answer.month) + assert_equal(1976, answer.year) + + @input.truncate(@input.rewind) + pattern = "^yes|no$" + @input << pattern << "\n" + @input.rewind + + answer = @terminal.ask("Give me a pattern to match with: ", Regexp) + assert_instance_of(Regexp, answer) + assert_equal(/#{pattern}/, answer) + + @input.truncate(@input.rewind) + @input << "gen\n" + @input.rewind + + answer = @terminal.ask("Select a mode: ", [:generate, :run]) + assert_instance_of(Symbol, answer) + assert_equal(:generate, answer) + end + + def test_validation + @input << "system 'rm -rf /'\n105\n0b101_001\n" + @input.rewind + + answer = @terminal.ask("Enter a binary number: ") do |q| + q.validate = /\A(?:0b)?[01_]+\Z/ + end + assert_equal("0b101_001", answer) + assert_equal( "Enter a binary number: " + + "Your answer isn't valid " + + "(must match /\\A(?:0b)?[01_]+\\Z/).\n" + + "? " + + "Your answer isn't valid " + + "(must match /\\A(?:0b)?[01_]+\\Z/).\n" + + "? ", @output.string ) + + @input.truncate(@input.rewind) + @input << "Gray II, James Edward\n" + + "Gray, Dana Ann Leslie\n" + + "Gray, James Edward\n" + @input.rewind + + answer = @terminal.ask("Your name? ") do |q| + q.validate = lambda do |name| + names = name.split(/,\s*/) + return false unless names.size == 2 + return false if names.first =~ /\s/ + names.last.split.size == 2 + end + end + assert_equal("Gray, James Edward", answer) + end + + def test_whitespace + @input << " A lot\tof \t space\t \there! \n" + @input.rewind + + answer = @terminal.ask("Enter a whitespace filled string: ") do |q| + q.whitespace = :chomp + end + assert_equal(" A lot\tof \t space\t \there! ", answer) + + @input.rewind + + answer = @terminal.ask("Enter a whitespace filled string: ") + assert_equal("A lot\tof \t space\t \there!", answer) + + @input.rewind + + answer = @terminal.ask("Enter a whitespace filled string: ") do |q| + q.whitespace = :strip_and_collapse + end + assert_equal("A lot of space here!", answer) + + @input.rewind + + answer = @terminal.ask("Enter a whitespace filled string: ") do |q| + q.whitespace = :remove + end + assert_equal("Alotofspacehere!", answer) + + @input.rewind + + answer = @terminal.ask("Enter a whitespace filled string: ") do |q| + q.whitespace = :none + end + assert_equal(" A lot\tof \t space\t \there! \n", answer) + end + + def test_wrap + @terminal.wrap_at = 80 + + @terminal.say("This is a very short line.") + assert_equal("This is a very short line.\n", @output.string) + + @output.truncate(@output.rewind) + + @terminal.say( "This is a long flowing paragraph meant to span " + + "several lines. This text should definitely be " + + "wrapped at the set limit, in the result. Your code " + + "does well with things like this.\n\n" + + " * This is a simple embedded list.\n" + + " * You're code should not mess with this...\n" + + " * Because it's already formatted correctly and " + + "does not\n" + + " exceed the limit!" ) + assert_equal( "This is a long flowing paragraph meant to span " + + "several lines. This text should\n" + + "definitely be wrapped at the set limit, in the " + + "result. Your code does well with\n" + + "things like this.\n\n" + + " * This is a simple embedded list.\n" + + " * You're code should not mess with this...\n" + + " * Because it's already formatted correctly and does " + + "not\n" + + " exceed the limit!\n", @output.string ) + + @output.truncate(@output.rewind) + + @terminal.say("-=" * 50) + assert_equal(("-=" * 40 + "\n") + ("-=" * 10 + "\n"), @output.string) + end + + def test_track_eof + assert_raise(EOFError) { @terminal.ask("Any input left? ") } + + # turn EOF tracking + old_setting = HighLine.track_eof? + assert_nothing_raised(Exception) { HighLine.track_eof = false } + begin + @terminal.ask("And now? ") # this will still blow up, nothing available + rescue + assert_not_equal(EOFError, $!.class) # but HighLine's safe guards are off + end + HighLine.track_eof = old_setting + end + + def test_version + assert_not_nil(HighLine::VERSION) + assert_instance_of(String, HighLine::VERSION) + assert(HighLine::VERSION.frozen?) + assert_match(/\A\d+\.\d+\.\d+\Z/, HighLine::VERSION) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_import.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_import.rb new file mode 100644 index 000000000..4077dfc35 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_import.rb @@ -0,0 +1,52 @@ +# tc_import.rb +# +# Created by James Edward Gray II on 2005-04-26. +# Copyright 2005 Gray Productions. All rights reserved. +# +# This is Free Software. See LICENSE and COPYING for details. + +require "test/unit" + +require "highline/import" +require "stringio" + +class TestImport < Test::Unit::TestCase + def test_import + assert_respond_to(self, :agree) + assert_respond_to(self, :ask) + assert_respond_to(self, :choose) + assert_respond_to(self, :say) + end + + def test_or_ask + old_terminal = $terminal + + input = StringIO.new + output = StringIO.new + $terminal = HighLine.new(input, output) + + input << "10\n" + input.rewind + + assert_equal(10, nil.or_ask("How much? ", Integer)) + + input.rewind + + assert_equal(20, "20".or_ask("How much? ", Integer)) + assert_equal(20, 20.or_ask("How much? ", Integer)) + + assert_equal(10, 20.or_ask("How much? ", Integer) { |q| q.in = 1..10 }) + ensure + $terminal = old_terminal + end + + def test_redirection + old_terminal = $terminal + + $terminal = HighLine.new(nil, (output = StringIO.new)) + say("Testing...") + assert_equal("Testing...\n", output.string) + ensure + $terminal = old_terminal + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_menu.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_menu.rb new file mode 100644 index 000000000..60f411459 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_menu.rb @@ -0,0 +1,439 @@ +# encoding: utf-8 +# tc_menu.rb +# +# Created by Gregory Thomas Brown on 2005-05-10. +# Copyright 2005. All rights reserved. +# +# This is Free Software. See LICENSE and COPYING for details. + +require "test/unit" + +require "highline" +require "stringio" + +class TestMenu < Test::Unit::TestCase + def setup + @input = StringIO.new + @output = StringIO.new + @terminal = HighLine.new(@input, @output) + end + + def test_choices + @input << "2\n" + @input.rewind + + output = @terminal.choose do |menu| + menu.choices("Sample1", "Sample2", "Sample3") + end + assert_equal("Sample2", output) + end + + def test_flow + @input << "Sample1\n" + @input.rewind + + @terminal.choose do |menu| + # Default: menu.flow = :rows + + menu.choice "Sample1" + menu.choice "Sample2" + menu.choice "Sample3" + end + assert_equal("1. Sample1\n2. Sample2\n3. Sample3\n? ", @output.string) + + @output.truncate(@output.rewind) + @input.rewind + + @terminal.choose do |menu| + menu.flow = :columns_across + + menu.choice "Sample1" + menu.choice "Sample2" + menu.choice "Sample3" + end + assert_equal("1. Sample1 2. Sample2 3. Sample3\n? ", @output.string) + + @output.truncate(@output.rewind) + @input.rewind + + @terminal.choose do |menu| + menu.flow = :inline + menu.index = :none + + menu.choice "Sample1" + menu.choice "Sample2" + menu.choice "Sample3" + end + assert_equal("Sample1, Sample2 or Sample3? ", @output.string) + end + + def test_unicode_flow + @input << "1\n" + @input.rewind + + @terminal.choose do |menu| + # Default: menu.flow = :rows + menu.choice "Unicode right single quotation mark: ’" + end + assert_equal("1. Unicode right single quotation mark: ’\n? ", @output.string) + end + + def test_help + @input << "help\nhelp load\nhelp rules\nhelp missing\n" + @input.rewind + + 4.times do + @terminal.choose do |menu| + menu.shell = true + + menu.choice(:load, "Load a file.") + menu.choice(:save, "Save data in file.") + menu.choice(:quit, "Exit program.") + + menu.help("rules", "The rules of this system are as follows...") + end + end + assert_equal( "1. load\n2. save\n3. quit\n4. help\n? " + + "This command will display helpful messages about " + + "functionality, like this one. To see the help for a " + + "specific topic enter:\n" + + "\thelp [TOPIC]\n" + + "Try asking for help on any of the following:\n" + + "\nload quit rules save \n" + + "1. load\n2. save\n3. quit\n4. help\n? " + + "= load\n\n" + + "Load a file.\n" + + "1. load\n2. save\n3. quit\n4. help\n? " + + "= rules\n\n" + + "The rules of this system are as follows...\n" + + "1. load\n2. save\n3. quit\n4. help\n? " + + "= missing\n\n" + + "There's no help for that topic.\n", @output.string ) + end + + def test_index + @input << "Sample1\n" + @input.rewind + + @terminal.choose do |menu| + # Default: menu.index = :number + + menu.choice "Sample1" + menu.choice "Sample2" + menu.choice "Sample3" + end + assert_equal("1. Sample1\n2. Sample2\n3. Sample3\n? ", @output.string) + + @output.truncate(@output.rewind) + @input.rewind + + @terminal.choose do |menu| + menu.index = :letter + menu.index_suffix = ") " + + menu.choice "Sample1" + menu.choice "Sample2" + menu.choice "Sample3" + end + assert_equal("a) Sample1\nb) Sample2\nc) Sample3\n? ", @output.string) + + @output.truncate(@output.rewind) + @input.rewind + + @terminal.choose do |menu| + menu.index = :none + + menu.choice "Sample1" + menu.choice "Sample2" + menu.choice "Sample3" + end + assert_equal("Sample1\nSample2\nSample3\n? ", @output.string) + + @output.truncate(@output.rewind) + @input.rewind + + @terminal.choose do |menu| + menu.index = "*" + + menu.choice "Sample1" + menu.choice "Sample2" + menu.choice "Sample3" + end + assert_equal("* Sample1\n* Sample2\n* Sample3\n? ", @output.string) + end + + def test_layouts + @input << "save\n" + @input.rewind + + @terminal.choose(:load, :save, :quit) # Default: layout = :list + assert_equal("1. load\n2. save\n3. quit\n? ", @output.string) + + @input.rewind + @output.truncate(@output.rewind) + + @terminal.choose(:load, :save, :quit) do |menu| + menu.header = "File Menu" + end + assert_equal( "File Menu:\n" + + "1. load\n2. save\n3. quit\n? ", @output.string ) + + @input.rewind + @output.truncate(@output.rewind) + + @terminal.choose(:load, :save, :quit) do |menu| + menu.layout = :one_line + menu.header = "File Menu" + menu.prompt = "Operation? " + end + assert_equal( "File Menu: Operation? " + + "(load, save or quit) ", @output.string ) + + @input.rewind + @output.truncate(@output.rewind) + + @terminal.choose(:load, :save, :quit) do |menu| + menu.layout = :menu_only + end + assert_equal("load, save or quit? ", @output.string) + + @input.rewind + @output.truncate(@output.rewind) + + @terminal.choose(:load, :save, :quit) do |menu| + menu.layout = '<%= list(@menu) %>File Menu: ' + end + assert_equal("1. load\n2. save\n3. quit\nFile Menu: ", @output.string) + end + + def test_list_option + @input << "l\n" + @input.rewind + + @terminal.choose(:load, :save, :quit) do |menu| + menu.layout = :menu_only + menu.list_option = ", or " + end + assert_equal("load, save, or quit? ", @output.string) + end + + def test_nil_on_handled + @input << "3\n3\n2\n" + @input.rewind + + # Shows that by default proc results are returned. + output = @terminal.choose do |menu| + menu.choice "Sample1" do "output1" end + menu.choice "Sample2" do "output2" end + menu.choice "Sample3" do "output3" end + end + assert_equal("output3", output) + + # + # Shows that they can be replaced with +nil+ by setting + # _nil_on_handled to +true+. + # + output = @terminal.choose do |menu| + menu.nil_on_handled = true + menu.choice "Sample1" do "output1" end + menu.choice "Sample2" do "output2" end + menu.choice "Sample3" do "output3" end + end + assert_equal(nil, output) + + # Shows that a menu item without a proc will be returned no matter what. + output = @terminal.choose do |menu| + menu.choice "Sample1" + menu.choice "Sample2" + menu.choice "Sample3" + end + assert_equal("Sample2", output) + end + + def test_passed_command + @input << "q\n" + @input.rewind + + selected = nil + @terminal.choose do |menu| + menu.choices(:load, :save, :quit) { |command| selected = command } + end + assert_equal(:quit, selected) + end + + def test_question_options + @input << "save\n" + @input.rewind + + answer = @terminal.choose(:Load, :Save, :Quit) do |menu| + menu.case = :capitalize + end + assert_equal(:Save, answer) + + @input.rewind + + answer = @terminal.choose(:Load, :Save, :Quit) do |menu| + menu.case = :capitalize + menu.character = :getc + end + assert_equal(:Save, answer) + assert_equal(?a, @input.getc) + end + + def test_select_by + @input << "Sample1\n2\n" + @input.rewind + + selected = @terminal.choose do |menu| + menu.choice "Sample1" + menu.choice "Sample2" + menu.choice "Sample3" + end + assert_equal("Sample1", selected) + + @input.rewind + + selected = @terminal.choose do |menu| + menu.select_by = :index + + menu.choice "Sample1" + menu.choice "Sample2" + menu.choice "Sample3" + end + assert_equal("Sample2", selected) + + @input.rewind + + selected = @terminal.choose do |menu| + menu.select_by = :name + + menu.choice "Sample1" + menu.choice "Sample2" + menu.choice "Sample3" + end + assert_equal("Sample1", selected) + end + + def test_hidden + @input << "Hidden\n4\n" + @input.rewind + + selected = @terminal.choose do |menu| + menu.choice "Sample1" + menu.choice "Sample2" + menu.choice "Sample3" + menu.hidden "Hidden!" + end + assert_equal("Hidden!", selected) + assert_equal("1. Sample1\n2. Sample2\n3. Sample3\n? ", @output.string) + + @input.rewind + + selected = @terminal.choose do |menu| + menu.select_by = :index + + menu.choice "Sample1" + menu.choice "Sample2" + menu.choice "Sample3" + menu.hidden "Hidden!" + end + assert_equal("Hidden!", selected) + + @input.rewind + + selected = @terminal.choose do |menu| + menu.select_by = :name + + menu.choice "Sample1" + menu.choice "Sample2" + menu.choice "Sample3" + menu.hidden "Hidden!" + end + assert_equal("Hidden!", selected) + + @input.rewind + end + + def test_select_by_letter + @input << "b\n" + @input.rewind + + selected = @terminal.choose do |menu| + menu.index = :letter + menu.choice :save + menu.choice :load + menu.choice :quit + end + assert_equal(:load, selected) + end + + def test_shell + @input << "save --some-option my_file.txt\n" + @input.rewind + + selected = nil + options = nil + answer = @terminal.choose do |menu| + menu.choices(:load, :quit) + menu.choice(:save) do |command, details| + selected = command + options = details + + "Saved!" + end + menu.shell = true + end + assert_equal("Saved!", answer) + assert_equal(:save, selected) + assert_equal("--some-option my_file.txt", options) + end + + def test_simple_menu_shortcut + @input << "3\n" + @input.rewind + + selected = @terminal.choose(:save, :load, :quit) + assert_equal(:quit, selected) + end + + def test_symbols + @input << "3\n" + @input.rewind + + selected = @terminal.choose do |menu| + menu.choices(:save, :load, :quit) + end + assert_equal(:quit, selected) + end + + def test_paged_print_infinite_loop_bug + @terminal.page_at = 5 + # Will page twice, so start with two new lines + @input << "\n\n3\n" + @input.rewind + + # Sadly this goes into an infinite loop without the fix to page_print + selected = @terminal.choose(* 1..10) + assert_equal(selected, 3) + end + + + def test_cancel_paging + # Tests that paging can be cancelled halfway through + @terminal.page_at = 5 + # Will page twice, so stop after first page and make choice 3 + @input << "q3\n" + @input.rewind + + selected = @terminal.choose(* 1..10) + assert_equal(selected, 3) + + # Make sure paging message appeared + assert( @output.string.index('press enter/return to continue or q to stop'), + "Paging message did not appear." ) + + # Make sure it only appeared once + assert( @output.string !~ /q to stop.*q to stop/m, + "Paging message appeared more than once." ) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_string_extension.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_string_extension.rb new file mode 100644 index 000000000..96e32e426 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_string_extension.rb @@ -0,0 +1,20 @@ +# tc_string_extension.rb +# +# Created by Richard LeBer 2011-06-27 +# +# This is Free Software. See LICENSE and COPYING for details. + +require "test/unit" + +require "highline" +require "stringio" +require "string_methods" + +class TestStringExtension < Test::Unit::TestCase + def setup + HighLine.colorize_strings + @string = "string" + end + + include StringMethods +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_string_highline.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_string_highline.rb new file mode 100644 index 000000000..a0428e822 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_string_highline.rb @@ -0,0 +1,38 @@ +# tc_highline_string.rb +# +# Created by Richard LeBer 2011-06-27 +# +# This is Free Software. See LICENSE and COPYING for details. + +require "test/unit" + +require "highline" +require "stringio" +require "string_methods" + +class TestHighLineString < Test::Unit::TestCase + def setup + @string = HighLine::String.new("string") + end + + def test_string_class + # Basic constructor + assert_equal HighLine::String, @string.class + assert_equal "string", @string + + # Alternative constructor method + new_string = HighLine::String("string") + assert_equal HighLine::String, new_string.class + assert_equal @string, new_string + + # String methods work + assert_equal 6, @string.size + assert_equal "STRING", @string.upcase + end + + include StringMethods + + def test_string_class_is_unchanged + assert_raise(::NoMethodError) { "string".color(:blue) } + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_style.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_style.rb new file mode 100755 index 000000000..8ae5244f9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/tc_style.rb @@ -0,0 +1,567 @@ +# tc_style.rb +# +# Created by Richard LeBer on 2011-06-11. +# +# This is Free Software. See LICENSE and COPYING for details. + +require "test/unit" + +require "highline" +require "stringio" + +class TestStyle < Test::Unit::TestCase + + def setup + @input = StringIO.new + @output = StringIO.new + @terminal = HighLine.new(@input, @output) + @style1 = HighLine::Style.new(:name=>:foo, :code=>"\e[99m", :rgb=>[1,2,3]) + @style2 = HighLine::Style.new(:name=>:lando, :code=>"\e[98m") + @style3 = HighLine::Style.new(:name=>[:foo, :lando], :list=>[:foo, :lando]) + @style4 = HighLine::Style(:rgb_654321) + end + + def teardown + # HighLine::Style.clear_index + end + + def test_style_method + # Retrieve a style from an existing Style (no new Style created) + new_style = @style1.dup # This will replace @style1 in the indexes + s = HighLine.Style(@style1) + assert_instance_of HighLine::Style, s + assert_same new_style, s # i.e. s===the latest style created, but not the one searched for + + # Retrieve a style from a new Style (no new Style created) + s2 = HighLine::Style.new(:name=>:bar, :code=>"\e[97m") + s = HighLine.Style(s2) + assert_instance_of HighLine::Style, s + assert_same s2, s + + # Create a builtin style from an existing ANSI escape string + s = HighLine.Style("\e[1m") + assert_instance_of HighLine::Style, s + assert_nil s.list + assert_equal "\e[1m", s.code + assert_equal :bold, s.name + + # Create a builtin style from a new ANSI escape string + s = HighLine.Style("\e[96m") + assert_instance_of HighLine::Style, s + assert_nil s.list + assert_equal "\e[96m", s.code + + # Create a builtin style from a symbol + s = HighLine.Style(:red) + assert_instance_of HighLine::Style, s + assert_nil s.list + assert_equal :red, s.name + + # Retrieve an existing style by name (no new Style created) + s = HighLine.Style(@style2.name) + assert_instance_of HighLine::Style, s + assert_same @style2, s + + # See below for color scheme tests + + # Create style from a Hash + s = HighLine.Style(:name=>:han, :code=>"blah", :rgb=>'phooey') + assert_instance_of HighLine::Style, s + assert_equal :han, s.name + assert_equal "blah", s.code + assert_equal "phooey", s.rgb + + # Create style from an RGB foreground color code + s = HighLine.Style(:rgb_1f2e3d) + assert_instance_of HighLine::Style, s + assert_equal :rgb_1f2e3d, s.name + assert_equal "\e[38;5;23m", s.code # Trust me; more testing below + assert_equal [31,46,61], s.rgb # 0x1f==31, 0x2e==46, 0x3d=61 + + # Create style from an RGB background color code + s = HighLine.Style(:on_rgb_1f2e3d) + assert_instance_of HighLine::Style, s + assert_equal :on_rgb_1f2e3d, s.name + assert_equal "\e[48;5;23m", s.code # Trust me; more testing below + assert_equal [31,46,61], s.rgb # 0x1f==31, 0x2e==46, 0x3d=61 + + # Create a style list + s1 = HighLine.Style(:bold, :red) + assert_instance_of HighLine::Style, s1 + assert_equal [:bold, :red], s1.list + + # Find an existing style list + s2 = HighLine.Style(:bold, :red) + assert_instance_of HighLine::Style, s2 + assert_same s1, s2 + + # Create a style list with nils + s1 = HighLine.Style(:underline, nil, :blue) + assert_instance_of HighLine::Style, s1 + assert_equal [:underline, :blue], s1.list + + # Raise an error for an undefined style + assert_raise(::NameError) { HighLine.Style(:fubar) } + end + + def test_no_color_scheme + HighLine.color_scheme = nil + assert_raise(::NameError) { HighLine.Style(:critical) } + end + + def test_with_color_scheme + HighLine.color_scheme = HighLine::SampleColorScheme.new + s = HighLine.Style(:critical) + assert_instance_of HighLine::Style, s + assert_equal :critical, s.name + assert_equal [:yellow, :on_red], s.list + end + + def test_builtin_foreground_colors_defined + HighLine::COLORS.each do |color| + style = HighLine.const_get(color+'_STYLE') + assert_instance_of HighLine::Style, style + assert_equal color.downcase.to_sym, style.name + assert style.builtin + code = HighLine.const_get(color) + assert_instance_of String, code, "Bad code for #{color}" + end + end + + def test_builtin_background_colors_defined + HighLine::COLORS.each do |color| + style = HighLine.const_get('ON_' + color+'_STYLE') + assert_instance_of HighLine::Style, style + assert_equal "ON_#{color}".downcase.to_sym, style.name + assert style.builtin + code = HighLine.const_get('ON_' + color) + assert_instance_of String, code, "Bad code for ON_#{color}" + end + end + + def test_builtin_styles_defined + HighLine::STYLES.each do |style_constant| + style = HighLine.const_get(style_constant+'_STYLE') + assert_instance_of HighLine::Style, style + assert_equal style_constant.downcase.to_sym, style.name + assert style.builtin + code = HighLine.const_get(style_constant) + assert_instance_of String, code, "Bad code for #{style_constant}" + end + end + + def test_index + # Add a Style with a new name and code + assert_nil HighLine::Style.list[:s1] + assert_nil HighLine::Style.code_index['foo'] + s1 = HighLine::Style.new(:name=>:s1, :code=>'foo') + assert_not_nil HighLine::Style.list[:s1] + assert_same s1, HighLine::Style.list[:s1] + assert_equal :s1, HighLine::Style.list[:s1].name + assert_equal 'foo', HighLine::Style.list[:s1].code + styles = HighLine::Style.list.size + codes = HighLine::Style.code_index.size + assert_instance_of Array, HighLine::Style.code_index['foo'] + assert_equal 1, HighLine::Style.code_index['foo'].size + assert_same s1, HighLine::Style.code_index['foo'].last + assert_equal :s1, HighLine::Style.code_index['foo'].last.name + assert_equal 'foo', HighLine::Style.code_index['foo'].last.code + + # Add another Style with a new name and code + assert_nil HighLine::Style.list[:s2] + assert_nil HighLine::Style.code_index['bar'] + s2 = HighLine::Style.new(:name=>:s2, :code=>'bar') + assert_equal styles+1, HighLine::Style.list.size + assert_equal codes+1, HighLine::Style.code_index.size + assert_not_nil HighLine::Style.list[:s2] + assert_same s2, HighLine::Style.list[:s2] + assert_equal :s2, HighLine::Style.list[:s2].name + assert_equal 'bar', HighLine::Style.list[:s2].code + assert_instance_of Array, HighLine::Style.code_index['bar'] + assert_equal 1, HighLine::Style.code_index['bar'].size + assert_same s2, HighLine::Style.code_index['bar'].last + assert_equal :s2, HighLine::Style.code_index['bar'].last.name + assert_equal 'bar', HighLine::Style.code_index['bar'].last.code + + # Add a Style with an existing name + s3_before = HighLine::Style.list[:s2] + assert_not_nil HighLine::Style.list[:s2] + assert_nil HighLine::Style.code_index['baz'] + s3 = HighLine::Style.new(:name=>:s2, :code=>'baz') + assert_not_same s2, s3 + assert_not_same s3_before, s3 + assert_equal styles+1, HighLine::Style.list.size + assert_equal codes+2, HighLine::Style.code_index.size + assert_not_nil HighLine::Style.list[:s2] + assert_same s3, HighLine::Style.list[:s2] + assert_not_same s2, HighLine::Style.list[:s2] + assert_equal :s2, HighLine::Style.list[:s2].name + assert_equal 'baz', HighLine::Style.list[:s2].code + assert_instance_of Array, HighLine::Style.code_index['baz'] + assert_equal 1, HighLine::Style.code_index['baz'].size + assert_same s3, HighLine::Style.code_index['baz'].last + assert_equal :s2, HighLine::Style.code_index['baz'].last.name + assert_equal 'baz', HighLine::Style.code_index['baz'].last.code + + # Add a Style with an existing code + assert_equal 1, HighLine::Style.code_index['baz'].size + s4 = HighLine::Style.new(:name=>:s4, :code=>'baz') + assert_equal styles+2, HighLine::Style.list.size + assert_equal codes+2, HighLine::Style.code_index.size + assert_not_nil HighLine::Style.list[:s4] + assert_same s4, HighLine::Style.list[:s4] + assert_equal :s4, HighLine::Style.list[:s4].name + assert_equal 'baz', HighLine::Style.list[:s4].code + assert_equal 2, HighLine::Style.code_index['baz'].size + assert_same s3, HighLine::Style.code_index['baz'].first # Unchanged from last time + assert_equal :s2, HighLine::Style.code_index['baz'].first.name # Unchanged from last time + assert_equal 'baz', HighLine::Style.code_index['baz'].first.code # Unchanged from last time + assert_same s4, HighLine::Style.code_index['baz'].last + assert_equal :s4, HighLine::Style.code_index['baz'].last.name + assert_equal 'baz', HighLine::Style.code_index['baz'].last.code + end + + def test_rgb_hex + assert_equal "abcdef", HighLine::Style.rgb_hex("abcdef") + assert_equal "ABCDEF", HighLine::Style.rgb_hex("AB","CD","EF") + assert_equal "010203", HighLine::Style.rgb_hex(1,2,3) + assert_equal "123456", HighLine::Style.rgb_hex(18,52,86) + end + + def test_rgb_parts + assert_equal [1,2,3], HighLine::Style.rgb_parts("010203") + assert_equal [18,52,86], HighLine::Style.rgb_parts("123456") + end + + def test_rgb + s = HighLine::Style.rgb(1, 2, 3) + assert_instance_of HighLine::Style, s + assert_equal :rgb_010203, s.name + assert_equal [1,2,3], s.rgb + assert_equal "\e[38;5;16m", s.code + + s = HighLine::Style.rgb("12", "34","56") + assert_instance_of HighLine::Style, s + assert_equal :rgb_123456, s.name + assert_equal [0x12, 0x34, 0x56], s.rgb + assert_equal "\e[38;5;24m", s.code + + s = HighLine::Style.rgb("abcdef") + assert_instance_of HighLine::Style, s + assert_equal :rgb_abcdef, s.name + assert_equal [0xab, 0xcd, 0xef], s.rgb + assert_equal "\e[38;5;189m", s.code + end + + def test_rgb_number + # ANSI RGB coding splits 0..255 into equal sixths, and then the + # red green and blue are encoded in base 6, plus 16, i.e. + # 16 + 36*(red_level) + 6*(green_level) + blue_level, + # where each of red_level, green_level, and blue_level are in + # the range 0..5 + + # This test logic works because 42 is just below 1/6 of 255, + # and 43 is just above + + assert_equal 16 + 0*36 + 0*6 + 0, HighLine::Style.rgb_number( 0, 0, 0) + assert_equal 16 + 0*36 + 0*6 + 0, HighLine::Style.rgb_number( 0, 0, 42) + assert_equal 16 + 0*36 + 0*6 + 1, HighLine::Style.rgb_number( 0, 0, 43) + + assert_equal 16 + 0*36 + 0*6 + 0, HighLine::Style.rgb_number( 0, 42, 0) + assert_equal 16 + 0*36 + 0*6 + 0, HighLine::Style.rgb_number( 0, 42, 42) + assert_equal 16 + 0*36 + 0*6 + 1, HighLine::Style.rgb_number( 0, 42, 43) + + assert_equal 16 + 0*36 + 1*6 + 0, HighLine::Style.rgb_number( 0, 43, 0) + assert_equal 16 + 0*36 + 1*6 + 0, HighLine::Style.rgb_number( 0, 43, 42) + assert_equal 16 + 0*36 + 1*6 + 1, HighLine::Style.rgb_number( 0, 43, 43) + + assert_equal 16 + 0*36 + 0*6 + 0, HighLine::Style.rgb_number( 42, 0, 0) + assert_equal 16 + 0*36 + 0*6 + 0, HighLine::Style.rgb_number( 42, 0, 42) + assert_equal 16 + 0*36 + 0*6 + 1, HighLine::Style.rgb_number( 42, 0, 43) + + assert_equal 16 + 0*36 + 0*6 + 0, HighLine::Style.rgb_number( 42, 42, 0) + assert_equal 16 + 0*36 + 0*6 + 0, HighLine::Style.rgb_number( 42, 42, 42) + assert_equal 16 + 0*36 + 0*6 + 1, HighLine::Style.rgb_number( 42, 42, 43) + + assert_equal 16 + 0*36 + 1*6 + 0, HighLine::Style.rgb_number( 42, 43, 0) + assert_equal 16 + 0*36 + 1*6 + 0, HighLine::Style.rgb_number( 42, 43, 42) + assert_equal 16 + 0*36 + 1*6 + 1, HighLine::Style.rgb_number( 42, 43, 43) + + assert_equal 16 + 1*36 + 0*6 + 0, HighLine::Style.rgb_number( 43, 0, 0) + assert_equal 16 + 1*36 + 0*6 + 0, HighLine::Style.rgb_number( 43, 0, 42) + assert_equal 16 + 1*36 + 0*6 + 1, HighLine::Style.rgb_number( 43, 0, 43) + + assert_equal 16 + 1*36 + 0*6 + 0, HighLine::Style.rgb_number( 43, 42, 0) + assert_equal 16 + 1*36 + 0*6 + 0, HighLine::Style.rgb_number( 43, 42, 42) + assert_equal 16 + 1*36 + 0*6 + 1, HighLine::Style.rgb_number( 43, 42, 43) + + assert_equal 16 + 1*36 + 1*6 + 0, HighLine::Style.rgb_number( 43, 43, 0) + assert_equal 16 + 1*36 + 1*6 + 0, HighLine::Style.rgb_number( 43, 43, 42) + assert_equal 16 + 1*36 + 1*6 + 1, HighLine::Style.rgb_number( 43, 43, 43) + + assert_equal 16 + 5*36 + 5*6 + 5, HighLine::Style.rgb_number(255,255,255) + end + + def test_ansi_rgb_to_hex + assert_equal "000000", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 0) + assert_equal "000000", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 0) + assert_equal "00002b", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 1) + + assert_equal "000000", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 0) + assert_equal "000000", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 0) + assert_equal "00002b", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 1) + + assert_equal "002b00", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 1*6 + 0) + assert_equal "002b00", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 1*6 + 0) + assert_equal "002b2b", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 1*6 + 1) + + assert_equal "000000", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 0) + assert_equal "000000", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 0) + assert_equal "00002b", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 1) + + assert_equal "000000", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 0) + assert_equal "000000", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 0) + assert_equal "00002b", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 0*6 + 1) + + assert_equal "002b00", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 1*6 + 0) + assert_equal "002b00", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 1*6 + 0) + assert_equal "002b2b", HighLine::Style.ansi_rgb_to_hex(16 + 0*36 + 1*6 + 1) + + assert_equal "2b0000", HighLine::Style.ansi_rgb_to_hex(16 + 1*36 + 0*6 + 0) + assert_equal "2b0000", HighLine::Style.ansi_rgb_to_hex(16 + 1*36 + 0*6 + 0) + assert_equal "2b002b", HighLine::Style.ansi_rgb_to_hex(16 + 1*36 + 0*6 + 1) + + assert_equal "2b0000", HighLine::Style.ansi_rgb_to_hex(16 + 1*36 + 0*6 + 0) + assert_equal "2b0000", HighLine::Style.ansi_rgb_to_hex(16 + 1*36 + 0*6 + 0) + assert_equal "2b002b", HighLine::Style.ansi_rgb_to_hex(16 + 1*36 + 0*6 + 1) + + assert_equal "2b2b00", HighLine::Style.ansi_rgb_to_hex(16 + 1*36 + 1*6 + 0) + assert_equal "2b2b00", HighLine::Style.ansi_rgb_to_hex(16 + 1*36 + 1*6 + 0) + assert_equal "2b2b2b", HighLine::Style.ansi_rgb_to_hex(16 + 1*36 + 1*6 + 1) + + # 0xd5 is the smallest number where n/255.0*6.0 > 5 + assert_equal "d5d5d5", HighLine::Style.ansi_rgb_to_hex(16 + 5*36 + 5*6 + 5) + end + + def test_list + list_size = HighLine::Style.list.size + # Add a Style with a new name and code + assert_nil HighLine::Style.list[:s5] + s5 = HighLine::Style.new(:name=>:s5, :code=>'foo') + assert_not_nil HighLine::Style.list[:s5] + assert_equal list_size+1, HighLine::Style.list.size + assert_not_nil HighLine::Style.list[:s5] + assert_same s5, HighLine::Style.list[:s5] + assert_equal :s5, HighLine::Style.list[:s5].name + assert_equal 'foo', HighLine::Style.list[:s5].code + + # Add another Style with a new name and code + assert_nil HighLine::Style.list[:s6] + s6 = HighLine::Style.new(:name=>:s6, :code=>'bar') + assert_equal list_size+2, HighLine::Style.list.size + assert_not_nil HighLine::Style.list[:s6] + assert_same s6, HighLine::Style.list[:s6] + assert_equal :s6, HighLine::Style.list[:s6].name + assert_equal 'bar', HighLine::Style.list[:s6].code + + # Add a Style with an existing name + s7 = HighLine::Style.new(:name=>:s6, :code=>'baz') + assert_equal list_size+2, HighLine::Style.list.size # No net addition to list + assert_not_nil HighLine::Style.list[:s6] + assert_same s7, HighLine::Style.list[:s6] # New one replaces old one + assert_not_same s6, HighLine::Style.list[:s6] + assert_equal :s6, HighLine::Style.list[:s6].name + assert_equal 'baz', HighLine::Style.list[:s6].code + end + + def test_code_index + list_size = HighLine::Style.code_index.size + + # Add a Style with a new name and code + assert_nil HighLine::Style.code_index['chewie'] + HighLine::Style.new(:name=>:s8, :code=>'chewie') + assert_equal list_size+1, HighLine::Style.code_index.size + assert_instance_of Array, HighLine::Style.code_index['chewie'] + assert_equal 1, HighLine::Style.code_index['chewie'].size + assert_equal :s8, HighLine::Style.code_index['chewie'].last.name + assert_equal 'chewie', HighLine::Style.code_index['chewie'].last.code + + # Add another Style with a new name and code + assert_nil HighLine::Style.code_index['c3po'] + HighLine::Style.new(:name=>:s9, :code=>'c3po') + assert_equal list_size+2, HighLine::Style.code_index.size + assert_instance_of Array, HighLine::Style.code_index['c3po'] + assert_equal 1, HighLine::Style.code_index['c3po'].size + assert_equal :s9, HighLine::Style.code_index['c3po'].last.name + assert_equal 'c3po', HighLine::Style.code_index['c3po'].last.code + + # Add a Style with an existing code + assert_equal 1, HighLine::Style.code_index['c3po'].size + HighLine::Style.new(:name=>:s10, :code=>'c3po') + assert_equal list_size+2, HighLine::Style.code_index.size + assert_equal 2, HighLine::Style.code_index['c3po'].size + assert_equal :s10, HighLine::Style.code_index['c3po'].last.name + assert_equal 'c3po', HighLine::Style.code_index['c3po'].last.code + end + + def test_uncolor + # Normal color + assert_equal "This should be reverse underlined magenta!\n", + HighLine::Style.uncolor("This should be \e[7m\e[4m\e[35mreverse underlined magenta\e[0m!\n" ) + + # RGB color + assert_equal "This should be rgb_906030!\n", + HighLine::Style.uncolor("This should be \e[38;5;137mrgb_906030\e[0m!\n" ) + end + + def test_color + assert_equal "\e[99mstring\e[0m", @style1.color("string") # simple style + assert_equal "\e[99m\e[98mstring\e[0m", @style3.color("string") # Style list + end + + def test_code + assert_equal "\e[99m", @style1.code # simple style + assert_equal "\e[99m\e[98m", @style3.code # Style list + end + + def test_red + assert_equal 0x65, @style4.red + assert_equal 0, HighLine::Style(:none).red # Probably reliable + assert_equal 0, HighLine::Style(:black).red # Probably reliable + assert_equal 255, HighLine::Style(:bright_magenta).red # Seems to be reliable + assert_equal 255, HighLine::Style(:on_none).red # Probably reliable + end + + def test_green + assert_equal 0x43, @style4.green + assert_equal 0, HighLine::Style(:none).green # Probably reliable + assert_equal 0, HighLine::Style(:black).green # Probably reliable + assert 240 <= HighLine::Style(:bright_cyan).green # Probably reliable + assert_equal 255, HighLine::Style(:on_none).green # Probably reliable + end + + def test_blue + assert_equal 0x21, @style4.blue + assert_equal 0, HighLine::Style(:none).blue # Probably reliable + assert_equal 0, HighLine::Style(:black).blue # Probably reliable + assert_equal 255, HighLine::Style(:bright_blue).blue # Probably reliable + assert_equal 255, HighLine::Style(:on_none).blue # Probably reliable + end + + def test_builtin + assert HighLine::Style(:red).builtin + assert !@style1.builtin + end + + def test_variant + style1_name = @style1.name + style1_code = @style1.code + style1_rgb = @style1.rgb + + s1 = @style1.variant(:new_foo1, :code=>'abracadabra') + assert_instance_of HighLine::Style, s1 + assert_not_same @style1, s1 # This is a copy + assert_equal :new_foo1, s1.name # Changed + assert_equal 'abracadabra', s1.code # Changed + assert_equal [1,2,3], s1.rgb # Unchanged + + s2 = @style1.variant(:new_foo2, :increment=>-15) + assert_instance_of HighLine::Style, s2 + assert_not_same @style1, s2 # This is a copy + assert_equal :new_foo2, s2.name # Changed + assert_equal "\e[84m", s2.code # 99 (original code) - 15 + assert_equal [1,2,3], s2.rgb # Unchanged + + s3 = @style1.variant(:new_foo3, :code=>"\e[55m", :increment=>15) + assert_instance_of HighLine::Style, s3 + assert_not_same @style1, s3 # This is a copy + assert_equal :new_foo3, s3.name # Changed + assert_equal "\e[70m", s3.code # 99 (new code) + 15 + assert_equal [1,2,3], s3.rgb # Unchanged + + s4 = @style1.variant(:new_foo4, :code=>"\e[55m", :increment=>15, :rgb=>"blah") + assert_instance_of HighLine::Style, s4 + assert_not_same @style1, s4 # This is a copy + assert_equal :new_foo4, s4.name # Changed + assert_equal "\e[70m", s4.code # 99 (new code) + 15 + assert_equal 'blah', s4.rgb # Changed + + s5 = @style1.variant(:new_foo5) + assert_instance_of HighLine::Style, s5 + assert_not_same @style1, s5 # This is a copy + assert_equal :new_foo5, s5.name # Changed + assert_equal "\e[99m", s5.code # Unchanged + assert_equal [1,2,3], s5.rgb # Unchanged + + # No @style1's have been harmed in the running of this test + assert_equal style1_name, @style1.name + assert_equal style1_code, @style1.code + assert_equal style1_rgb, @style1.rgb + + assert_raise(::RuntimeError) { @style3.variant(:new_foo6) } # Can't create a variant of a list style + end + + def test_on + style1_name = @style1.name + style1_code = @style1.code + style1_rgb = @style1.rgb + + s1 = @style1.on + assert_instance_of HighLine::Style, s1 + assert_not_same @style1, s1 # This is a copy + assert_equal :on_foo, s1.name # Changed + assert_equal "\e[109m", s1.code # Changed + assert_equal [1,2,3], s1.rgb # Unchanged + + # No @style1's have been harmed in the running of this test + assert_equal style1_name, @style1.name + assert_equal style1_code, @style1.code + assert_equal style1_rgb, @style1.rgb + + assert_raise(::RuntimeError) { @style3.on } # Can't create a variant of a list style + end + + def test_bright + style1_name = @style1.name + style1_code = @style1.code + style1_rgb = @style1.rgb + + s1 = @style1.bright + assert_instance_of HighLine::Style, s1 + assert_not_same @style1, s1 # This is a copy + assert_equal :bright_foo, s1.name # Changed + assert_equal "\e[159m", s1.code # Changed + assert_equal [129,130,131], s1.rgb # Changed + + # No @style1's have been harmed in the running of this test + assert_equal style1_name, @style1.name + assert_equal style1_code, @style1.code + assert_equal style1_rgb, @style1.rgb + + s2_base = HighLine::Style.new(:name=>:leia, :code=>"\e[92m", :rgb=>[0,0,14]) + s2 = s2_base.bright + assert_instance_of HighLine::Style, s2 + assert_not_same s2_base, s2 # This is a copy + assert_equal :bright_leia, s2.name # Changed + assert_equal "\e[152m", s2.code # Changed + assert_equal [0,0,142], s2.rgb # Changed + + s3_base = HighLine::Style.new(:name=>:luke, :code=>"\e[93m", :rgb=>[20,21,0]) + s3 = s3_base.bright + assert_instance_of HighLine::Style, s3 + assert_not_same s3_base, s3 # This is a copy + assert_equal :bright_luke, s3.name # Changed + assert_equal "\e[153m", s3.code # Changed + assert_equal [148,149,0], s3.rgb # Changed + + s4_base = HighLine::Style.new(:name=>:r2d2, :code=>"\e[94m", :rgb=>[0,0,0]) + s4 = s4_base.bright + assert_instance_of HighLine::Style, s4 + assert_not_same s4_base, s4 # This is a copy + assert_equal :bright_r2d2, s4.name # Changed + assert_equal "\e[154m", s4.code # Changed + assert_equal [128,128,128], s4.rgb # Changed; special case + + assert_raise(::RuntimeError) { @style3.bright } # Can't create a variant of a list style + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/ts_all.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/ts_all.rb new file mode 100644 index 000000000..ccd338e97 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/highline-1.6.21/test/ts_all.rb @@ -0,0 +1,16 @@ +# ts_all.rb +# +# Created by James Edward Gray II on 2005-04-26. +# Copyright 2005 Gray Productions. All rights reserved. +# +# This is Free Software. See LICENSE and COPYING for details. + +require "test/unit" + +require "tc_highline" +require "tc_import" +require "tc_menu" +require "tc_style" +require "tc_color_scheme" +require "tc_string_highline" +require "tc_string_extension" \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/.gitignore b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/.gitignore new file mode 100644 index 000000000..5ef62afbd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/.gitignore @@ -0,0 +1,16 @@ +.*.sw[pon] +*.bundle +coverage +tags +pkg +.nfs.* +.idea +java/Json.iml +Gemfile.lock +.rvmrc +*.rbc +.rbx +.AppleDouble +.DS_Store +*/**/Makefile +*/**/*.o diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/.travis.yml b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/.travis.yml new file mode 100644 index 000000000..22cb59f39 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/.travis.yml @@ -0,0 +1,26 @@ +# Passes arguments to bundle install (http://gembundler.com/man/bundle-install.1.html) +#bundler_args: --binstubs +language: ruby + +# Specify which ruby versions you wish to run your tests on, each version will be used +rvm: + - 1.8.7 + - 1.9.2 + - 1.9.3 + - 2.0.0 + - 2.1 + - 2.2.1 + - 2.2.2 + - 2.2 + - ree + - rbx-2 + - jruby-18mode + - jruby-19mode + - ruby-head +matrix: + allow_failures: + - rvm: rbx-2 + - rvm: ruby-head +script: "bundle exec rake" + +sudo: false diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/CHANGES b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/CHANGES new file mode 100644 index 000000000..8ffecf7c5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/CHANGES @@ -0,0 +1,295 @@ +2015-06-01 (1.8.3) + * Fix potential memory leak, thx to nobu. +2015-01-08 (1.8.2) + * Some performance improvements by Vipul A M . + * Fix by Jason R. Clark to avoid mutation of + JSON.dump_default_options. + * More tests by Michael Mac-Vicar and fixing + space_before accessor in generator. + * Performance on Jruby improvemed by Ben Browning . + * Some fixes to be compatible with the new Ruby 2.2 by Zachary Scott + and SHIBATA Hiroshi . +2013-05-13 (1.8.1) + * Remove Rubinius exception since transcoding should be working now. +2013-05-13 (1.8.0) + * Fix https://github.com/flori/json/issues/162 reported by Marc-Andre + Lafortune . Thanks! + * Applied patches by Yui NARUSE to suppress warning with + -Wchar-subscripts and better validate UTF-8 strings. + * Applied patch by ginriki@github to remove unnecessary if. + * Add load/dump interface to JSON::GenericObject to make + serialize :some_attribute, JSON::GenericObject + work in Rails active models for convenient SomeModel#some_attribute.foo.bar + access to serialised JSON data. +2013-02-04 (1.7.7) + * Security fix for JSON create_additions default value and + JSON::GenericObject. It should not be possible to create additions unless + explicitely requested by setting the create_additions argument to true or + using the JSON.load/dump interface. If JSON::GenericObject is supposed to + be automatically deserialised, this has to be explicitely enabled by + setting + JSON::GenericObject.json_creatable = true + as well. + * Remove useless assert in fbuffer implementation. + * Apply patch attached to https://github.com/flori/json/issues#issue/155 + provided by John Shahid , Thx! + * Add license information to rubygems spec data, reported by Jordi Massaguer Pla . + * Improve documentation, thx to Zachary Scott . +2012-11-29 (1.7.6) + * Add GeneratorState#merge alias for JRuby, fix state accessor methods. Thx to + jvshahid@github. + * Increase hash likeness of state objects. +2012-08-17 (1.7.5) + * Fix compilation of extension on older rubies. +2012-07-26 (1.7.4) + * Fix compilation problem on AIX, see https://github.com/flori/json/issues/142 +2012-05-12 (1.7.3) + * Work around Rubinius encoding issues using iconv for conversion instead. +2012-05-11 (1.7.2) + * Fix some encoding issues, that cause problems for the pure and the + extension variant in jruby 1.9 mode. +2012-04-28 (1.7.1) + * Some small fixes for building +2012-04-28 (1.7.0) + * Add JSON::GenericObject for method access to objects transmitted via JSON. +2012-04-27 (1.6.7) + * Fix possible crash when trying to parse nil value. +2012-02-11 (1.6.6) + * Propagate src encoding to values made from it (fixes 1.9 mode converting + everything to ascii-8bit; harmless for 1.8 mode too) (Thomas E. Enebo + ), should fix + https://github.com/flori/json/issues#issue/119. + * Fix https://github.com/flori/json/issues#issue/124 Thx to Jason Hutchens. + * Fix https://github.com/flori/json/issues#issue/117 +2012-01-15 (1.6.5) + * Vit Ondruch reported a bug that shows up when using + optimisation under GCC 4.7. Thx to him, Bohuslav Kabrda + and Yui NARUSE for debugging and + developing a patch fix. +2011-12-24 (1.6.4) + * Patches that improve speed on JRuby contributed by Charles Oliver Nutter + . + * Support object_class/array_class with duck typed hash/array. +2011-12-01 (1.6.3) + * Let JSON.load('') return nil as well to make mysql text columns (default to + '') work better for serialization. +2011-11-21 (1.6.2) + * Add support for OpenStruct and BigDecimal. + * Fix bug when parsing nil in quirks_mode. + * Make JSON.dump and JSON.load methods better cooperate with Rails' serialize + method. Just use: serialize :value, JSON + * Fix bug with time serialization concerning nanoseconds. Thanks for the + patch go to Josh Partlow (jpartlow@github). + * Improve parsing speed for JSON numbers (integers and floats) in a similar way to + what Evan Phoenix suggested in: + https://github.com/flori/json/pull/103 +2011-09-18 (1.6.1) + * Using -target 1.5 to force Java bits to compile with 1.5. +2011-09-12 (1.6.0) + * Extract utilities (prettifier and GUI-editor) in its own gem json-utils. + * Split json/add/core into different files for classes to be serialised. +2011-08-31 (1.5.4) + * Fix memory leak when used from multiple JRuby. (Patch by + jfirebaugh@github). + * Apply patch by Eric Wong that fixes garbage collection problem + reported in https://github.com/flori/json/issues/46. + * Add :quirks_mode option to parser and generator. + * Add support for Rational and Complex number additions via json/add/complex + and json/add/rational requires. +2011-06-20 (1.5.3) + * Alias State#configure method as State#merge to increase duck type synonymy with Hash. + * Add as_json methods in json/add/core, so rails can create its json objects + the new way. +2011-05-11 (1.5.2) + * Apply documentation patch by Cory Monty . + * Add gemspecs for json and json_pure. + * Fix bug in jruby pretty printing. + * Fix bug in object_class and array_class when inheriting from Hash or Array. +2011-01-24 (1.5.1) + * Made rake-compiler build a fat binary gem. This should fix issue + https://github.com/flori/json/issues#issue/54. +2011-01-22 (1.5.0) + * Included Java source codes for the Jruby extension made by Daniel Luz + . + * Output full exception message of deep_const_get to aid debugging. + * Fixed an issue with ruby 1.9 Module#const_defined? method, that was + reported by Riley Goodside. +2010-08-09 (1.4.6) + * Fixed oversight reported in http://github.com/flori/json/issues/closed#issue/23, + always create a new object from the state prototype. + * Made pure and ext api more similar again. +2010-08-07 (1.4.5) + * Manage data structure nesting depth in state object during generation. This + should reduce problems with to_json method definіtions that only have one + argument. + * Some fixes in the state objects and additional tests. +2010-08-06 (1.4.4) + * Fixes build problem for rubinius under OS X, http://github.com/flori/json/issues/closed#issue/25 + * Fixes crashes described in http://github.com/flori/json/issues/closed#issue/21 and + http://github.com/flori/json/issues/closed#issue/23 +2010-05-05 (1.4.3) + * Fixed some test assertions, from Ruby r27587 and r27590, patch by nobu. + * Fixed issue http://github.com/flori/json/issues/#issue/20 reported by + electronicwhisper@github. Thx! +2010-04-26 (1.4.2) + * Applied patch from naruse Yui NARUSE to make building with + Microsoft Visual C possible again. + * Applied patch from devrandom in order to allow building of + json_pure if extensiontask is not present. + * Thanks to Dustin Schneider , who reported a memory + leak, which is fixed in this release. + * Applied 993f261ccb8f911d2ae57e9db48ec7acd0187283 patch from josh@github. +2010-04-25 (1.4.1) + * Fix for a bug reported by Dan DeLeo , caused by T_FIXNUM + being different on 32bit/64bit architectures. +2010-04-23 (1.4.0) + * Major speed improvements and building with simplified + directory/file-structure. + * Extension should at least be comapatible with MRI, YARV and Rubinius. +2010-04-07 (1.2.4) + * Triger const_missing callback to make Rails' dynamic class loading work. +2010-03-11 (1.2.3) + * Added a State#[] method which returns an attribute's value in order to + increase duck type compatibility to Hash. +2010-02-27 (1.2.2) + * Made some changes to make the building of the parser/generator compatible + to Rubinius. +2009-11-25 (1.2.1) + * Added :symbolize_names option to Parser, which returns symbols instead of + strings in object names/keys. +2009-10-01 (1.2.0) + * fast_generate now raises an exeception for nan and infinite floats. + * On Ruby 1.8 json supports parsing of UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, + and UTF-32LE JSON documents now. Under Ruby 1.9 the M17n conversion + functions are used to convert from all supported encodings. ASCII-8BIT + encoded strings are handled like all strings under Ruby 1.8 were. + * Better documentation +2009-08-23 (1.1.9) + * Added forgotten main doc file extra_rdoc_files. +2009-08-23 (1.1.8) + * Applied a patch by OZAWA Sakuro to make json/pure + work in environments that don't provide iconv. + * Applied patch by okkez_ in order to fix Ruby Bug #1768: + http://redmine.ruby-lang.org/issues/show/1768. + * Finally got around to avoid the rather paranoid escaping of ?/ characters + in the generator's output. The parsers aren't affected by this change. + Thanks to Rich Apodaca for the suggestion. +2009-06-29 (1.1.7) + * Security Fix for JSON::Pure::Parser. A specially designed string could + cause catastrophic backtracking in one of the parser's regular expressions + in earlier 1.1.x versions. JSON::Ext::Parser isn't affected by this issue. + Thanks to Bartosz Blimke for reporting this + problem. + * This release also uses a less strict ruby version requirement for the + creation of the mswin32 native gem. +2009-05-10 (1.1.6) + * No changes. І tested native linux gems in the last release and they don't + play well with different ruby versions other than the one the gem was built + with. This release is just to bump the version number in order to skip the + native gem on rubyforge. +2009-05-10 (1.1.5) + * Started to build gems with rake-compiler gem. + * Applied patch object/array class patch from Brian Candler + and fixes. +2009-04-01 (1.1.4) + * Fixed a bug in the creation of serialized generic rails objects reported by + Friedrich Graeter . + * Deleted tests/runner.rb, we're using testrb instead. + * Editor supports Infinity in numbers now. + * Made some changes in order to get the library to compile/run under Ruby + 1.9. + * Improved speed of the code path for the fast_generate method in the pure + variant. +2008-07-10 (1.1.3) + * Wesley Beary reported a bug in json/add/core's DateTime + handling: If the nominator and denominator of the offset were divisible by + each other Ruby's Rational#to_s returns them as an integer not a fraction + with '/'. This caused a ZeroDivisionError during parsing. + * Use Date#start and DateTime#start instead of sg method, while + remaining backwards compatible. + * Supports ragel >= 6.0 now. + * Corrected some tests. + * Some minor changes. +2007-11-27 (1.1.2) + * Remember default dir (last used directory) in editor. + * JSON::Editor.edit method added, the editor can now receive json texts from + the clipboard via C-v. + * Load json texts from an URL pasted via middle button press. + * Added :create_additions option to Parser. This makes it possible to disable + the creation of additions by force, in order to treat json texts as data + while having additions loaded. + * Jacob Maine reported, that JSON(:foo) outputs a JSON + object if the rails addition is enabled, which is wrong. It now outputs a + JSON string "foo" instead, like suggested by Jacob Maine. + * Discovered a bug in the Ruby Bugs Tracker on rubyforge, that was reported + by John Evans lgastako@gmail.com. He could produce a crash in the JSON + generator by returning something other than a String instance from a + to_json method. I now guard against this by doing a rather crude type + check, which raises an exception instead of crashing. +2007-07-06 (1.1.1) + * Yui NARUSE sent some patches to fix tests for Ruby + 1.9. I applied them and adapted some of them a bit to run both on 1.8 and + 1.9. + * Introduced a JSON.parse! method without depth checking for people who like + danger. + * Made generate and pretty_generate methods configurable by an options hash. + * Added :allow_nan option to parser and generator in order to handle NaN, + Infinity, and -Infinity correctly - if requested. Floats, which aren't numbers, + aren't valid JSON according to RFC4627, so by default an exception will be + raised if any of these symbols are encountered. Thanks to Andrea Censi + for his hint about this. + * Fixed some more tests for Ruby 1.9. + * Implemented dump/load interface of Marshal as suggested in ruby-core:11405 + by murphy . + * Implemented the max_nesting feature for generate methods, too. + * Added some implementations for ruby core's custom objects for + serialisation/deserialisation purposes. +2007-05-21 (1.1.0) + * Implemented max_nesting feature for parser to avoid stack overflows for + data from untrusted sources. If you trust the source, you can disable it + with the option max_nesting => false. + * Piers Cawley reported a bug, that not every + character can be escaped by ?\ as required by RFC4627. There's a + contradiction between David Crockford's JSON checker test vectors (in + tests/fixtures) and RFC4627, though. I decided to stick to the RFC, because + the JSON checker seems to be a bit older than the RFC. + * Extended license to Ruby License, which includes the GPL. + * Added keyboard shortcuts, and 'Open location' menu item to edit_json.rb. +2007-05-09 (1.0.4) + * Applied a patch from Yui NARUSE to make JSON compile + under Ruby 1.9. Thank you very much for mailing it to me! + * Made binary variants of JSON fail early, instead of falling back to the + pure version. This should avoid overshadowing of eventual problems while + loading of the binary. +2007-03-24 (1.0.3) + * Improved performance of pure variant a bit. + * The ext variant of this release supports the mswin32 platform. Ugh! +2007-03-24 (1.0.2) + * Ext Parser didn't parse 0e0 correctly into 0.0: Fixed! +2007-03-24 (1.0.1) + * Forgot some object files in the build dir. I really like that - not! +2007-03-24 (1.0.0) + * Added C implementations for the JSON generator and a ragel based JSON + parser in C. + * Much more tests, especially fixtures from json.org. + * Further improved conformance to RFC4627. +2007-02-09 (0.4.3) + * Conform more to RFC4627 for JSON: This means JSON strings + now always must contain exactly one object "{ ... }" or array "[ ... ]" in + order to be parsed without raising an exception. The definition of what + constitutes a whitespace is narrower in JSON than in Ruby ([ \t\r\n]), and + there are differences in floats and integers (no octals or hexadecimals) as + well. + * Added aliases generate and pretty_generate of unparse and pretty_unparse. + * Fixed a test case. + * Catch an Iconv::InvalidEncoding exception, that seems to occur on some Sun + boxes with SunOS 5.8, if iconv doesn't support utf16 conversions. This was + reported by Andrew R Jackson , thanks a bunch! +2006-08-25 (0.4.2) + * Fixed a bug in handling solidi (/-characters), that was reported by + Kevin Gilpin . +2006-02-06 (0.4.1) + * Fixed a bug related to escaping with backslashes. Thanks for the report go + to Florian Munz . +2005-09-23 (0.4.0) + * Initial Rubyforge Version diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/COPYING b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/COPYING new file mode 100644 index 000000000..c3a2126d5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/COPYING @@ -0,0 +1,58 @@ +Ruby is copyrighted free software by Yukihiro Matsumoto . +You can redistribute it and/or modify it under either the terms of the GPL +(see GPL file), or the conditions below: + + 1. You may make and give away verbatim copies of the source form of the + software without restriction, provided that you duplicate all of the + original copyright notices and associated disclaimers. + + 2. You may modify your copy of the software in any way, provided that + you do at least ONE of the following: + + a) place your modifications in the Public Domain or otherwise + make them Freely Available, such as by posting said + modifications to Usenet or an equivalent medium, or by allowing + the author to include your modifications in the software. + + b) use the modified software only within your corporation or + organization. + + c) rename any non-standard executables so the names do not conflict + with standard executables, which must also be provided. + + d) make other distribution arrangements with the author. + + 3. You may distribute the software in object code or executable + form, provided that you do at least ONE of the following: + + a) distribute the executables and library files of the software, + together with instructions (in the manual page or equivalent) + on where to get the original distribution. + + b) accompany the distribution with the machine-readable source of + the software. + + c) give non-standard executables non-standard names, with + instructions on where to get the original software distribution. + + d) make other distribution arrangements with the author. + + 4. You may modify and include the part of the software into any other + software (possibly commercial). But some files in the distribution + are not written by the author, so that they are not under this terms. + + They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some + files under the ./missing directory. See each file for the copying + condition. + + 5. The scripts and library files supplied as input to or produced as + output from the software do not automatically fall under the + copyright of the software, but belong to whomever generated them, + and may be sold commercially, and may be aggregated with this + software. + + 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE. + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/COPYING-json-jruby b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/COPYING-json-jruby new file mode 100644 index 000000000..137a3da2b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/COPYING-json-jruby @@ -0,0 +1,57 @@ +JSON-JRuby is copyrighted free software by Daniel Luz , +and is a derivative work of Florian Frank's json library . +You can redistribute it and/or modify it under either the terms of the GPL +version 2 (see the file GPL), or the conditions below: + + 1. You may make and give away verbatim copies of the source form of the + software without restriction, provided that you duplicate all of the + original copyright notices and associated disclaimers. + + 2. You may modify your copy of the software in any way, provided that + you do at least ONE of the following: + + a) place your modifications in the Public Domain or otherwise + make them Freely Available, such as by posting said + modifications to Usenet or an equivalent medium, or by allowing + the author to include your modifications in the software. + + b) use the modified software only within your corporation or + organization. + + c) give non-standard binaries non-standard names, with + instructions on where to get the original software distribution. + + d) make other distribution arrangements with the author. + + 3. You may distribute the software in object code or binary form, + provided that you do at least ONE of the following: + + a) distribute the binaries and library files of the software, + together with instructions (in the manual page or equivalent) + on where to get the original distribution. + + b) accompany the distribution with the machine-readable source of + the software. + + c) give non-standard binaries non-standard names, with + instructions on where to get the original software distribution. + + d) make other distribution arrangements with the author. + + 4. You may modify and include the part of the software into any other + software (possibly commercial). But some files in the distribution + are not written by the author, so that they are not under these terms. + + For the list of those files and their copying conditions, see the + file LEGAL. + + 5. The scripts and library files supplied as input to or produced as + output from the software do not automatically fall under the + copyright of the software, but belong to whomever generated them, + and may be sold commercially, and may be aggregated with this + software. + + 6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR + IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED + WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + PURPOSE. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/GPL b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/GPL new file mode 100644 index 000000000..db2fc4505 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/GPL @@ -0,0 +1,340 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/Gemfile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/Gemfile new file mode 100644 index 000000000..ef9ce01fc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/Gemfile @@ -0,0 +1,10 @@ +# vim: set ft=ruby: + +source 'https://rubygems.org' + +gemspec :name => 'json' +gemspec :name => 'json_pure' +gemspec :name => 'json-java' + +gem 'utils' +gem 'test-unit' diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/README-json-jruby.markdown b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/README-json-jruby.markdown new file mode 100644 index 000000000..13368378d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/README-json-jruby.markdown @@ -0,0 +1,33 @@ +JSON-JRuby +========== + +JSON-JRuby is a port of Florian Frank's native +[`json` library](http://json.rubyforge.org/) to JRuby. +It aims to be a perfect drop-in replacement for `json_pure`. + + +Development version +=================== + +The latest version is available from the +[Git repository](http://github.com/mernen/json-jruby/tree): + + git clone git://github.com/mernen/json-jruby.git + + +Compiling +========= + +You'll need JRuby version 1.2 or greater to build JSON-JRuby. +Its path must be set on the `jruby.dir` property of +`nbproject/project.properties` (defaults to `../jruby`). + +Additionally, you'll need [Ant](http://ant.apache.org/), and +[Ragel](http://www.cs.queensu.ca/~thurston/ragel/) 6.4 or greater. + +Then, from the folder where the sources are located, type: + + ant clean jar + +to clean any leftovers from previous builds and generate the `.jar` files. +To generate a RubyGem, specify the `gem` action rather than `jar`. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/README.rdoc b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/README.rdoc new file mode 100644 index 000000000..ebb8b82d1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/README.rdoc @@ -0,0 +1,358 @@ += JSON implementation for Ruby {}[http://travis-ci.org/flori/json] + +== Description + +This is a implementation of the JSON specification according to RFC 4627 +http://www.ietf.org/rfc/rfc4627.txt . Starting from version 1.0.0 on there +will be two variants available: + +* A pure ruby variant, that relies on the iconv and the stringscan + extensions, which are both part of the ruby standard library. +* The quite a bit faster native extension variant, which is in parts + implemented in C or Java and comes with its own unicode conversion + functions and a parser generated by the ragel state machine compiler + http://www.cs.queensu.ca/~thurston/ragel . + +Both variants of the JSON generator generate UTF-8 character sequences by +default. If an :ascii_only option with a true value is given, they escape all +non-ASCII and control characters with \uXXXX escape sequences, and support +UTF-16 surrogate pairs in order to be able to generate the whole range of +unicode code points. + +All strings, that are to be encoded as JSON strings, should be UTF-8 byte +sequences on the Ruby side. To encode raw binary strings, that aren't UTF-8 +encoded, please use the to_json_raw_object method of String (which produces +an object, that contains a byte array) and decode the result on the receiving +endpoint. + +The JSON parsers can parse UTF-8, UTF-16BE, UTF-16LE, UTF-32BE, and UTF-32LE +JSON documents under Ruby 1.8. Under Ruby 1.9 they take advantage of Ruby's +M17n features and can parse all documents which have the correct +String#encoding set. If a document string has ASCII-8BIT as an encoding the +parser attempts to figure out which of the UTF encodings from above it is and +trys to parse it. + +== Installation + +It's recommended to use the extension variant of JSON, because it's faster than +the pure ruby variant. If you cannot build it on your system, you can settle +for the latter. + +Just type into the command line as root: + + # rake install + +The above command will build the extensions and install them on your system. + + # rake install_pure + +or + + # ruby install.rb + +will just install the pure ruby implementation of JSON. + +If you use Rubygems you can type + + # gem install json + +instead, to install the newest JSON version. + +There is also a pure ruby json only variant of the gem, that can be installed +with: + + # gem install json_pure + +== Compiling the extensions yourself + +If you want to build the extensions yourself you need rake: + + You can get it from rubyforge: + http://rubyforge.org/projects/rake + + or just type + + # gem install rake + + for the installation via rubygems. + +If you want to create the parser.c file from its parser.rl file or draw nice +graphviz images of the state machines, you need ragel from: http://www.cs.queensu.ca/~thurston/ragel + + +== Usage + +To use JSON you can + require 'json' +to load the installed variant (either the extension 'json' or the pure +variant 'json_pure'). If you have installed the extension variant, you can +pick either the extension variant or the pure variant by typing + require 'json/ext' +or + require 'json/pure' + +Now you can parse a JSON document into a ruby data structure by calling + + JSON.parse(document) + +If you want to generate a JSON document from a ruby data structure call + JSON.generate(data) + +You can also use the pretty_generate method (which formats the output more +verbosely and nicely) or fast_generate (which doesn't do any of the security +checks generate performs, e. g. nesting deepness checks). + +To create a valid JSON document you have to make sure, that the output is +embedded in either a JSON array [] or a JSON object {}. The easiest way to do +this, is by putting your values in a Ruby Array or Hash instance. + +There are also the JSON and JSON[] methods which use parse on a String or +generate a JSON document from an array or hash: + + document = JSON 'test' => 23 # => "{\"test\":23}" + document = JSON['test'] => 23 # => "{\"test\":23}" + +and + + data = JSON '{"test":23}' # => {"test"=>23} + data = JSON['{"test":23}'] # => {"test"=>23} + +You can choose to load a set of common additions to ruby core's objects if +you + require 'json/add/core' + +After requiring this you can, e. g., serialise/deserialise Ruby ranges: + + JSON JSON(1..10) # => 1..10 + +To find out how to add JSON support to other or your own classes, read the +section "More Examples" below. + +To get the best compatibility to rails' JSON implementation, you can + require 'json/add/rails' + +Both of the additions attempt to require 'json' (like above) first, if it has +not been required yet. + +== More Examples + +To create a JSON document from a ruby data structure, you can call +JSON.generate like that: + + json = JSON.generate [1, 2, {"a"=>3.141}, false, true, nil, 4..10] + # => "[1,2,{\"a\":3.141},false,true,null,\"4..10\"]" + +To get back a ruby data structure from a JSON document, you have to call +JSON.parse on it: + + JSON.parse json + # => [1, 2, {"a"=>3.141}, false, true, nil, "4..10"] + +Note, that the range from the original data structure is a simple +string now. The reason for this is, that JSON doesn't support ranges +or arbitrary classes. In this case the json library falls back to call +Object#to_json, which is the same as #to_s.to_json. + +It's possible to add JSON support serialization to arbitrary classes by +simply implementing a more specialized version of the #to_json method, that +should return a JSON object (a hash converted to JSON with #to_json) like +this (don't forget the *a for all the arguments): + + class Range + def to_json(*a) + { + 'json_class' => self.class.name, # = 'Range' + 'data' => [ first, last, exclude_end? ] + }.to_json(*a) + end + end + +The hash key 'json_class' is the class, that will be asked to deserialise the +JSON representation later. In this case it's 'Range', but any namespace of +the form 'A::B' or '::A::B' will do. All other keys are arbitrary and can be +used to store the necessary data to configure the object to be deserialised. + +If a the key 'json_class' is found in a JSON object, the JSON parser checks +if the given class responds to the json_create class method. If so, it is +called with the JSON object converted to a Ruby hash. So a range can +be deserialised by implementing Range.json_create like this: + + class Range + def self.json_create(o) + new(*o['data']) + end + end + +Now it possible to serialise/deserialise ranges as well: + + json = JSON.generate [1, 2, {"a"=>3.141}, false, true, nil, 4..10] + # => "[1,2,{\"a\":3.141},false,true,null,{\"json_class\":\"Range\",\"data\":[4,10,false]}]" + JSON.parse json + # => [1, 2, {"a"=>3.141}, false, true, nil, 4..10] + +JSON.generate always creates the shortest possible string representation of a +ruby data structure in one line. This is good for data storage or network +protocols, but not so good for humans to read. Fortunately there's also +JSON.pretty_generate (or JSON.pretty_generate) that creates a more readable +output: + + puts JSON.pretty_generate([1, 2, {"a"=>3.141}, false, true, nil, 4..10]) + [ + 1, + 2, + { + "a": 3.141 + }, + false, + true, + null, + { + "json_class": "Range", + "data": [ + 4, + 10, + false + ] + } + ] + +There are also the methods Kernel#j for generate, and Kernel#jj for +pretty_generate output to the console, that work analogous to Core Ruby's p and +the pp library's pp methods. + +The script tools/server.rb contains a small example if you want to test, how +receiving a JSON object from a webrick server in your browser with the +javasript prototype library http://www.prototypejs.org works. + +== Speed Comparisons + +I have created some benchmark results (see the benchmarks/data-p4-3Ghz +subdir of the package) for the JSON-parser to estimate the speed up in the C +extension: + + Comparing times (call_time_mean): + 1 ParserBenchmarkExt#parser 900 repeats: + 553.922304770 ( real) -> 21.500x + 0.001805307 + 2 ParserBenchmarkYAML#parser 1000 repeats: + 224.513358139 ( real) -> 8.714x + 0.004454078 + 3 ParserBenchmarkPure#parser 1000 repeats: + 26.755020642 ( real) -> 1.038x + 0.037376163 + 4 ParserBenchmarkRails#parser 1000 repeats: + 25.763381731 ( real) -> 1.000x + 0.038814780 + calls/sec ( time) -> speed covers + secs/call + +In the table above 1 is JSON::Ext::Parser, 2 is YAML.load with YAML +compatbile JSON document, 3 is is JSON::Pure::Parser, and 4 is +ActiveSupport::JSON.decode. The ActiveSupport JSON-decoder converts the +input first to YAML and then uses the YAML-parser, the conversion seems to +slow it down so much that it is only as fast as the JSON::Pure::Parser! + +If you look at the benchmark data you can see that this is mostly caused by +the frequent high outliers - the median of the Rails-parser runs is still +overall smaller than the median of the JSON::Pure::Parser runs: + + Comparing times (call_time_median): + 1 ParserBenchmarkExt#parser 900 repeats: + 800.592479481 ( real) -> 26.936x + 0.001249075 + 2 ParserBenchmarkYAML#parser 1000 repeats: + 271.002390644 ( real) -> 9.118x + 0.003690004 + 3 ParserBenchmarkRails#parser 1000 repeats: + 30.227910865 ( real) -> 1.017x + 0.033082008 + 4 ParserBenchmarkPure#parser 1000 repeats: + 29.722384421 ( real) -> 1.000x + 0.033644676 + calls/sec ( time) -> speed covers + secs/call + +I have benchmarked the JSON-Generator as well. This generated a few more +values, because there are different modes that also influence the achieved +speed: + + Comparing times (call_time_mean): + 1 GeneratorBenchmarkExt#generator_fast 1000 repeats: + 547.354332608 ( real) -> 15.090x + 0.001826970 + 2 GeneratorBenchmarkExt#generator_safe 1000 repeats: + 443.968212317 ( real) -> 12.240x + 0.002252414 + 3 GeneratorBenchmarkExt#generator_pretty 900 repeats: + 375.104545883 ( real) -> 10.341x + 0.002665923 + 4 GeneratorBenchmarkPure#generator_fast 1000 repeats: + 49.978706968 ( real) -> 1.378x + 0.020008521 + 5 GeneratorBenchmarkRails#generator 1000 repeats: + 38.531868759 ( real) -> 1.062x + 0.025952543 + 6 GeneratorBenchmarkPure#generator_safe 1000 repeats: + 36.927649925 ( real) -> 1.018x 7 (>=3859) + 0.027079979 + 7 GeneratorBenchmarkPure#generator_pretty 1000 repeats: + 36.272134441 ( real) -> 1.000x 6 (>=3859) + 0.027569373 + calls/sec ( time) -> speed covers + secs/call + +In the table above 1-3 are JSON::Ext::Generator methods. 4, 6, and 7 are +JSON::Pure::Generator methods and 5 is the Rails JSON generator. It is now a +bit faster than the generator_safe and generator_pretty methods of the pure +variant but slower than the others. + +To achieve the fastest JSON document output, you can use the fast_generate +method. Beware, that this will disable the checking for circular Ruby data +structures, which may cause JSON to go into an infinite loop. + +Here are the median comparisons for completeness' sake: + + Comparing times (call_time_median): + 1 GeneratorBenchmarkExt#generator_fast 1000 repeats: + 708.258020939 ( real) -> 16.547x + 0.001411915 + 2 GeneratorBenchmarkExt#generator_safe 1000 repeats: + 569.105020353 ( real) -> 13.296x + 0.001757145 + 3 GeneratorBenchmarkExt#generator_pretty 900 repeats: + 482.825371244 ( real) -> 11.280x + 0.002071142 + 4 GeneratorBenchmarkPure#generator_fast 1000 repeats: + 62.717626652 ( real) -> 1.465x + 0.015944481 + 5 GeneratorBenchmarkRails#generator 1000 repeats: + 43.965681162 ( real) -> 1.027x + 0.022745013 + 6 GeneratorBenchmarkPure#generator_safe 1000 repeats: + 43.929073409 ( real) -> 1.026x 7 (>=3859) + 0.022763968 + 7 GeneratorBenchmarkPure#generator_pretty 1000 repeats: + 42.802514491 ( real) -> 1.000x 6 (>=3859) + 0.023363113 + calls/sec ( time) -> speed covers + secs/call + +== Author + +Florian Frank + +== License + +Ruby License, see the COPYING file included in the source distribution. The +Ruby License includes the GNU General Public License (GPL), Version 2, so see +the file GPL as well. + +== Download + +The latest version of this library can be downloaded at + +* http://rubyforge.org/frs?group_id=953 + +Online Documentation should be located at + +* http://json.rubyforge.org diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/Rakefile new file mode 100644 index 000000000..1d13c2cab --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/Rakefile @@ -0,0 +1,412 @@ +begin + require 'rubygems/package_task' +rescue LoadError +end + +require 'rbconfig' +include\ + begin + RbConfig + rescue NameError + Config + end + +require 'rake/clean' +CLOBBER.include 'doc', 'Gemfile.lock' +CLEAN.include FileList['diagrams/*.*'], 'doc', 'coverage', 'tmp', + FileList["ext/**/{Makefile,mkmf.log}"], 'build', 'dist', FileList['**/*.rbc'], + FileList["{ext,lib}/**/*.{so,bundle,#{CONFIG['DLEXT']},o,obj,pdb,lib,manifest,exp,def,jar,class,dSYM}"], + FileList['java/src/**/*.class'] + +require 'rake/testtask' +class UndocumentedTestTask < Rake::TestTask + def desc(*) end +end + +def skip_sdoc(src) + src.gsub(/^.*sdoc.*/) { |s| s + ' if RUBY_VERSION > "1.8.6"' } +end + +MAKE = ENV['MAKE'] || %w[gmake make].find { |c| system(c, '-v') } +BUNDLE = ENV['BUNDLE'] || %w[bundle].find { |c| system(c, '-v') } +PKG_NAME = 'json' +PKG_TITLE = 'JSON Implementation for Ruby' +PKG_VERSION = File.read('VERSION').chomp +PKG_FILES = FileList[`git ls-files`.split(/\n/)] + +EXT_ROOT_DIR = 'ext/json/ext' +EXT_PARSER_DIR = "#{EXT_ROOT_DIR}/parser" +EXT_PARSER_DL = "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}" +RAGEL_PATH = "#{EXT_PARSER_DIR}/parser.rl" +EXT_PARSER_SRC = "#{EXT_PARSER_DIR}/parser.c" +EXT_GENERATOR_DIR = "#{EXT_ROOT_DIR}/generator" +EXT_GENERATOR_DL = "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}" +EXT_GENERATOR_SRC = "#{EXT_GENERATOR_DIR}/generator.c" + +JAVA_DIR = "java/src/json/ext" +JAVA_RAGEL_PATH = "#{JAVA_DIR}/Parser.rl" +JAVA_PARSER_SRC = "#{JAVA_DIR}/Parser.java" +JAVA_SOURCES = FileList["#{JAVA_DIR}/*.java"] +JAVA_CLASSES = [] +JRUBY_PARSER_JAR = File.expand_path("lib/json/ext/parser.jar") +JRUBY_GENERATOR_JAR = File.expand_path("lib/json/ext/generator.jar") + +RAGEL_CODEGEN = %w[rlcodegen rlgen-cd ragel].find { |c| system(c, '-v') } +RAGEL_DOTGEN = %w[rlgen-dot rlgen-cd ragel].find { |c| system(c, '-v') } + +desc "Installing library (pure)" +task :install_pure => :version do + ruby 'install.rb' +end + +task :install_ext_really do + sitearchdir = CONFIG["sitearchdir"] + cd 'ext' do + for file in Dir["json/ext/*.#{CONFIG['DLEXT']}"] + d = File.join(sitearchdir, file) + mkdir_p File.dirname(d) + install(file, d) + end + warn " *** Installed EXT ruby library." + end +end + +desc "Installing library (extension)" +task :install_ext => [ :compile, :install_pure, :install_ext_really ] + +desc "Installing library (extension)" +task :install => :install_ext + +if defined?(Gem) and defined?(Gem::PackageTask) + spec_pure = Gem::Specification.new do |s| + s.name = 'json_pure' + s.version = PKG_VERSION + s.summary = PKG_TITLE + s.description = "This is a JSON implementation in pure Ruby." + + s.files = PKG_FILES + + s.require_path = 'lib' + s.add_development_dependency 'permutation' + s.add_development_dependency 'sdoc', '~>0.3.16' + s.add_development_dependency 'rake', '~>0.9.2' + + s.extra_rdoc_files << 'README.rdoc' + s.rdoc_options << + '--title' << 'JSON implemention for ruby' << '--main' << 'README.rdoc' + s.test_files.concat Dir['./tests/test_*.rb'] + + s.author = "Florian Frank" + s.email = "flori@ping.de" + s.homepage = "http://flori.github.com/#{PKG_NAME}" + s.license = 'Ruby' + end + + desc 'Creates a json_pure.gemspec file' + task :gemspec_pure => :version do + File.open('json_pure.gemspec', 'w') do |gemspec| + gemspec.write skip_sdoc(spec_pure.to_ruby) + end + end + + Gem::PackageTask.new(spec_pure) do |pkg| + pkg.need_tar = true + pkg.package_files = PKG_FILES + end + + spec_ext = Gem::Specification.new do |s| + s.name = 'json' + s.version = PKG_VERSION + s.summary = PKG_TITLE + s.description = "This is a JSON implementation as a Ruby extension in C." + + s.files = PKG_FILES + + s.extensions = FileList['ext/**/extconf.rb'] + + s.require_path = 'lib' + s.add_development_dependency 'permutation' + s.add_development_dependency 'sdoc', '~>0.3.16' + + s.extra_rdoc_files << 'README.rdoc' + s.rdoc_options << + '--title' << 'JSON implemention for Ruby' << '--main' << 'README.rdoc' + s.test_files.concat Dir['./tests/test_*.rb'] + + s.author = "Florian Frank" + s.email = "flori@ping.de" + s.homepage = "http://flori.github.com/#{PKG_NAME}" + s.license = 'Ruby' + end + + desc 'Creates a json.gemspec file' + task :gemspec_ext => :version do + File.open('json.gemspec', 'w') do |gemspec| + gemspec.write skip_sdoc(spec_ext.to_ruby) + end + end + + Gem::PackageTask.new(spec_ext) do |pkg| + pkg.need_tar = true + pkg.package_files = PKG_FILES + end + + + desc 'Create all gemspec files' + task :gemspec => [ :gemspec_pure, :gemspec_ext ] +end + +desc m = "Writing version information for #{PKG_VERSION}" +task :version do + puts m + File.open(File.join('lib', 'json', 'version.rb'), 'w') do |v| + v.puts < [ :clean, :do_test_pure ] + +UndocumentedTestTask.new do |t| + t.name = 'do_test_pure' + t.libs << 'lib' + t.test_files = FileList['tests/test_*.rb'] + t.verbose = true + t.options = '-v' +end + +desc "Testing library (pure ruby and extension)" +task :test do + sh "env JSON=pure #{BUNDLE} exec rake test_pure" or exit 1 + sh "env JSON=ext #{BUNDLE} exec rake test_ext" or exit 1 +end + +namespace :gems do + desc 'Install all development gems' + task :install do + sh "#{BUNDLE}" + end +end + +if defined?(RUBY_ENGINE) and RUBY_ENGINE == 'jruby' + if ENV.key?('JAVA_HOME') + warn " *** JAVA_HOME was set to #{ENV['JAVA_HOME'].inspect}" + elsif File.directory?(local_java = '/usr/local/java/jdk') || + File.directory?(local_java = '/usr/lib/jvm/java-6-openjdk') + then + ENV['JAVA_HOME'] = local_java + end + if ENV['JAVA_HOME'] + warn " *** JAVA_HOME is set to #{ENV['JAVA_HOME'].inspect}" + ENV['PATH'] = ENV['PATH'].split(/:/).unshift(java_path = "#{ENV['JAVA_HOME']}/bin") * ':' + warn " *** java binaries are assumed to be in #{java_path.inspect}" + else + warn " *** JAVA_HOME was not set or could not be guessed!" + exit 1 + end + + file JAVA_PARSER_SRC => JAVA_RAGEL_PATH do + cd JAVA_DIR do + if RAGEL_CODEGEN == 'ragel' + sh "ragel Parser.rl -J -o Parser.java" + else + sh "ragel -x Parser.rl | #{RAGEL_CODEGEN} -J" + end + end + end + + desc "Generate parser for java with ragel" + task :ragel => JAVA_PARSER_SRC + + desc "Delete the ragel generated Java source" + task :ragel_clean do + rm_rf JAVA_PARSER_SRC + end + + JRUBY_JAR = File.join(CONFIG["libdir"], "jruby.jar") + if File.exist?(JRUBY_JAR) + JAVA_SOURCES.each do |src| + classpath = (Dir['java/lib/*.jar'] << 'java/src' << JRUBY_JAR) * ':' + obj = src.sub(/\.java\Z/, '.class') + file obj => src do + sh 'javac', '-classpath', classpath, '-source', '1.5', '-target', '1.5', src + end + JAVA_CLASSES << obj + end + else + warn "WARNING: Cannot find jruby in path => Cannot build jruby extension!" + end + + desc "Compiling jruby extension" + task :compile => JAVA_CLASSES + + desc "Package the jruby gem" + task :jruby_gem => :create_jar do + sh 'gem build json-java.gemspec' + mkdir_p 'pkg' + mv "json-#{PKG_VERSION}-java.gem", 'pkg' + end + + desc "Testing library (jruby)" + task :test_ext => [ :create_jar, :do_test_ext ] + + UndocumentedTestTask.new do |t| + t.name = 'do_test_ext' + t.libs << 'lib' + t.test_files = FileList['tests/test_*.rb'] + t.verbose = true + t.options = '-v' + end + + file JRUBY_PARSER_JAR => :compile do + cd 'java/src' do + parser_classes = FileList[ + "json/ext/ByteListTranscoder*.class", + "json/ext/OptionsReader*.class", + "json/ext/Parser*.class", + "json/ext/RuntimeInfo*.class", + "json/ext/StringDecoder*.class", + "json/ext/Utils*.class" + ] + sh 'jar', 'cf', File.basename(JRUBY_PARSER_JAR), *parser_classes + mv File.basename(JRUBY_PARSER_JAR), File.dirname(JRUBY_PARSER_JAR) + end + end + + desc "Create parser jar" + task :create_parser_jar => JRUBY_PARSER_JAR + + file JRUBY_GENERATOR_JAR => :compile do + cd 'java/src' do + generator_classes = FileList[ + "json/ext/ByteListTranscoder*.class", + "json/ext/OptionsReader*.class", + "json/ext/Generator*.class", + "json/ext/RuntimeInfo*.class", + "json/ext/StringEncoder*.class", + "json/ext/Utils*.class" + ] + sh 'jar', 'cf', File.basename(JRUBY_GENERATOR_JAR), *generator_classes + mv File.basename(JRUBY_GENERATOR_JAR), File.dirname(JRUBY_GENERATOR_JAR) + end + end + + desc "Create generator jar" + task :create_generator_jar => JRUBY_GENERATOR_JAR + + desc "Create parser and generator jars" + task :create_jar => [ :create_parser_jar, :create_generator_jar ] + + desc "Build all gems and archives for a new release of the jruby extension." + task :build => [ :clean, :version, :jruby_gem ] + + task :release => :build +else + desc "Compiling extension" + task :compile => [ EXT_PARSER_DL, EXT_GENERATOR_DL ] + + file EXT_PARSER_DL => EXT_PARSER_SRC do + cd EXT_PARSER_DIR do + ruby 'extconf.rb' + sh MAKE + end + cp "#{EXT_PARSER_DIR}/parser.#{CONFIG['DLEXT']}", EXT_ROOT_DIR + end + + file EXT_GENERATOR_DL => EXT_GENERATOR_SRC do + cd EXT_GENERATOR_DIR do + ruby 'extconf.rb' + sh MAKE + end + cp "#{EXT_GENERATOR_DIR}/generator.#{CONFIG['DLEXT']}", EXT_ROOT_DIR + end + + desc "Testing library (extension)" + task :test_ext => [ :compile, :do_test_ext ] + + UndocumentedTestTask.new do |t| + t.name = 'do_test_ext' + t.libs << 'ext' << 'lib' + t.test_files = FileList['tests/test_*.rb'] + t.verbose = true + t.options = '-v' + end + + desc "Create RDOC documentation" + task :doc => [ :version, EXT_PARSER_SRC ] do + sh "sdoc -o doc -t '#{PKG_TITLE}' -m README.rdoc README.rdoc lib/json.rb #{FileList['lib/json/**/*.rb']} #{EXT_PARSER_SRC} #{EXT_GENERATOR_SRC}" + end + + desc "Generate parser with ragel" + task :ragel => EXT_PARSER_SRC + + desc "Delete the ragel generated C source" + task :ragel_clean do + rm_rf EXT_PARSER_SRC + end + + desc "Update the tags file" + task :tags do + system 'ctags', *Dir['**/*.{rb,c,h,java}'] + end + + file EXT_PARSER_SRC => RAGEL_PATH do + cd EXT_PARSER_DIR do + if RAGEL_CODEGEN == 'ragel' + sh "ragel parser.rl -G2 -o parser.c" + else + sh "ragel -x parser.rl | #{RAGEL_CODEGEN} -G2" + end + src = File.read("parser.c").gsub(/[ \t]+$/, '') + File.open("parser.c", "w") {|f| f.print src} + end + end + + desc "Generate diagrams of ragel parser (ps)" + task :ragel_dot_ps do + root = 'diagrams' + specs = [] + File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 } + for s in specs + if RAGEL_DOTGEN == 'ragel' + sh "ragel #{RAGEL_PATH} -S#{s} -p -V | dot -Tps -o#{root}/#{s}.ps" + else + sh "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tps -o#{root}/#{s}.ps" + end + end + end + + desc "Generate diagrams of ragel parser (png)" + task :ragel_dot_png do + root = 'diagrams' + specs = [] + File.new(RAGEL_PATH).grep(/^\s*machine\s*(\S+);\s*$/) { specs << $1 } + for s in specs + if RAGEL_DOTGEN == 'ragel' + sh "ragel #{RAGEL_PATH} -S#{s} -p -V | dot -Tpng -o#{root}/#{s}.png" + else + sh "ragel -x #{RAGEL_PATH} -S#{s} | #{RAGEL_DOTGEN} -p|dot -Tpng -o#{root}/#{s}.png" + end + end + end + + desc "Generate diagrams of ragel parser" + task :ragel_dot => [ :ragel_dot_png, :ragel_dot_ps ] + + desc "Build all gems and archives for a new release of json and json_pure." + task :build => [ :clean, :gemspec, :package ] + + task :release => :build +end + +desc "Compile in the the source directory" +task :default => [ :clean, :gemspec, :test ] diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/TODO b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/TODO new file mode 100644 index 000000000..8b1378917 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/TODO @@ -0,0 +1 @@ + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/VERSION b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/VERSION new file mode 100644 index 000000000..a7ee35a3e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/VERSION @@ -0,0 +1 @@ +1.8.3 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/data/example.json b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/data/example.json new file mode 100644 index 000000000..88b4e8265 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/data/example.json @@ -0,0 +1 @@ +{"a":2,"b":3.141,"TIME":"2007-03-14T11:52:40","c":"c","d":[1,"b",3.14],"COUNT":666,"e":{"foo":"bar"},"foo":"B\u00e4r","g":"\u677e\u672c\u884c\u5f18","h":1000.0,"bar":"\u00a9 \u2260 \u20ac!","i":0.001,"j":"\ud840\udc01"} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/data/index.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/data/index.html new file mode 100644 index 000000000..abe6fdbfa --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/data/index.html @@ -0,0 +1,38 @@ + + + + Javascript Example + + + + + +

    Fetching object from server

    +
    + Wait...
    + +
    + + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/data/prototype.js b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/data/prototype.js new file mode 100644 index 000000000..5c7346294 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/json-1.8.3/data/prototype.js @@ -0,0 +1,4184 @@ +/* Prototype JavaScript framework, version 1.6.0 + * (c) 2005-2007 Sam Stephenson + * + * Prototype is freely distributable under the terms of an MIT-style license. + * For details, see the Prototype web site: http://www.prototypejs.org/ + * + *--------------------------------------------------------------------------*/ + +var Prototype = { + Version: '1.6.0', + + Browser: { + IE: !!(window.attachEvent && !window.opera), + Opera: !!window.opera, + WebKit: navigator.userAgent.indexOf('AppleWebKit/') > -1, + Gecko: navigator.userAgent.indexOf('Gecko') > -1 && navigator.userAgent.indexOf('KHTML') == -1, + MobileSafari: !!navigator.userAgent.match(/Apple.*Mobile.*Safari/) + }, + + BrowserFeatures: { + XPath: !!document.evaluate, + ElementExtensions: !!window.HTMLElement, + SpecificElementExtensions: + document.createElement('div').__proto__ && + document.createElement('div').__proto__ !== + document.createElement('form').__proto__ + }, + + ScriptFragment: ']*>([\\S\\s]*?)<\/script>', + JSONFilter: /^\/\*-secure-([\s\S]*)\*\/\s*$/, + + emptyFunction: function() { }, + K: function(x) { return x } +}; + +if (Prototype.Browser.MobileSafari) + Prototype.BrowserFeatures.SpecificElementExtensions = false; + +if (Prototype.Browser.WebKit) + Prototype.BrowserFeatures.XPath = false; + +/* Based on Alex Arnell's inheritance implementation. */ +var Class = { + create: function() { + var parent = null, properties = $A(arguments); + if (Object.isFunction(properties[0])) + parent = properties.shift(); + + function klass() { + this.initialize.apply(this, arguments); + } + + Object.extend(klass, Class.Methods); + klass.superclass = parent; + klass.subclasses = []; + + if (parent) { + var subclass = function() { }; + subclass.prototype = parent.prototype; + klass.prototype = new subclass; + parent.subclasses.push(klass); + } + + for (var i = 0; i < properties.length; i++) + klass.addMethods(properties[i]); + + if (!klass.prototype.initialize) + klass.prototype.initialize = Prototype.emptyFunction; + + klass.prototype.constructor = klass; + + return klass; + } +}; + +Class.Methods = { + addMethods: function(source) { + var ancestor = this.superclass && this.superclass.prototype; + var properties = Object.keys(source); + + if (!Object.keys({ toString: true }).length) + properties.push("toString", "valueOf"); + + for (var i = 0, length = properties.length; i < length; i++) { + var property = properties[i], value = source[property]; + if (ancestor && Object.isFunction(value) && + value.argumentNames().first() == "$super") { + var method = value, value = Object.extend((function(m) { + return function() { return ancestor[m].apply(this, arguments) }; + })(property).wrap(method), { + valueOf: function() { return method }, + toString: function() { return method.toString() } + }); + } + this.prototype[property] = value; + } + + return this; + } +}; + +var Abstract = { }; + +Object.extend = function(destination, source) { + for (var property in source) + destination[property] = source[property]; + return destination; +}; + +Object.extend(Object, { + inspect: function(object) { + try { + if (object === undefined) return 'undefined'; + if (object === null) return 'null'; + return object.inspect ? object.inspect() : object.toString(); + } catch (e) { + if (e instanceof RangeError) return '...'; + throw e; + } + }, + + toJSON: function(object) { + var type = typeof object; + switch (type) { + case 'undefined': + case 'function': + case 'unknown': return; + case 'boolean': return object.toString(); + } + + if (object === null) return 'null'; + if (object.toJSON) return object.toJSON(); + if (Object.isElement(object)) return; + + var results = []; + for (var property in object) { + var value = Object.toJSON(object[property]); + if (value !== undefined) + results.push(property.toJSON() + ': ' + value); + } + + return '{' + results.join(', ') + '}'; + }, + + toQueryString: function(object) { + return $H(object).toQueryString(); + }, + + toHTML: function(object) { + return object && object.toHTML ? object.toHTML() : String.interpret(object); + }, + + keys: function(object) { + var keys = []; + for (var property in object) + keys.push(property); + return keys; + }, + + values: function(object) { + var values = []; + for (var property in object) + values.push(object[property]); + return values; + }, + + clone: function(object) { + return Object.extend({ }, object); + }, + + isElement: function(object) { + return object && object.nodeType == 1; + }, + + isArray: function(object) { + return object && object.constructor === Array; + }, + + isHash: function(object) { + return object instanceof Hash; + }, + + isFunction: function(object) { + return typeof object == "function"; + }, + + isString: function(object) { + return typeof object == "string"; + }, + + isNumber: function(object) { + return typeof object == "number"; + }, + + isUndefined: function(object) { + return typeof object == "undefined"; + } +}); + +Object.extend(Function.prototype, { + argumentNames: function() { + var names = this.toString().match(/^[\s\(]*function[^(]*\((.*?)\)/)[1].split(",").invoke("strip"); + return names.length == 1 && !names[0] ? [] : names; + }, + + bind: function() { + if (arguments.length < 2 && arguments[0] === undefined) return this; + var __method = this, args = $A(arguments), object = args.shift(); + return function() { + return __method.apply(object, args.concat($A(arguments))); + } + }, + + bindAsEventListener: function() { + var __method = this, args = $A(arguments), object = args.shift(); + return function(event) { + return __method.apply(object, [event || window.event].concat(args)); + } + }, + + curry: function() { + if (!arguments.length) return this; + var __method = this, args = $A(arguments); + return function() { + return __method.apply(this, args.concat($A(arguments))); + } + }, + + delay: function() { + var __method = this, args = $A(arguments), timeout = args.shift() * 1000; + return window.setTimeout(function() { + return __method.apply(__method, args); + }, timeout); + }, + + wrap: function(wrapper) { + var __method = this; + return function() { + return wrapper.apply(this, [__method.bind(this)].concat($A(arguments))); + } + }, + + methodize: function() { + if (this._methodized) return this._methodized; + var __method = this; + return this._methodized = function() { + return __method.apply(null, [this].concat($A(arguments))); + }; + } +}); + +Function.prototype.defer = Function.prototype.delay.curry(0.01); + +Date.prototype.toJSON = function() { + return '"' + this.getUTCFullYear() + '-' + + (this.getUTCMonth() + 1).toPaddedString(2) + '-' + + this.getUTCDate().toPaddedString(2) + 'T' + + this.getUTCHours().toPaddedString(2) + ':' + + this.getUTCMinutes().toPaddedString(2) + ':' + + this.getUTCSeconds().toPaddedString(2) + 'Z"'; +}; + +var Try = { + these: function() { + var returnValue; + + for (var i = 0, length = arguments.length; i < length; i++) { + var lambda = arguments[i]; + try { + returnValue = lambda(); + break; + } catch (e) { } + } + + return returnValue; + } +}; + +RegExp.prototype.match = RegExp.prototype.test; + +RegExp.escape = function(str) { + return String(str).replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1'); +}; + +/*--------------------------------------------------------------------------*/ + +var PeriodicalExecuter = Class.create({ + initialize: function(callback, frequency) { + this.callback = callback; + this.frequency = frequency; + this.currentlyExecuting = false; + + this.registerCallback(); + }, + + registerCallback: function() { + this.timer = setInterval(this.onTimerEvent.bind(this), this.frequency * 1000); + }, + + execute: function() { + this.callback(this); + }, + + stop: function() { + if (!this.timer) return; + clearInterval(this.timer); + this.timer = null; + }, + + onTimerEvent: function() { + if (!this.currentlyExecuting) { + try { + this.currentlyExecuting = true; + this.execute(); + } finally { + this.currentlyExecuting = false; + } + } + } +}); +Object.extend(String, { + interpret: function(value) { + return value == null ? '' : String(value); + }, + specialChar: { + '\b': '\\b', + '\t': '\\t', + '\n': '\\n', + '\f': '\\f', + '\r': '\\r', + '\\': '\\\\' + } +}); + +Object.extend(String.prototype, { + gsub: function(pattern, replacement) { + var result = '', source = this, match; + replacement = arguments.callee.prepareReplacement(replacement); + + while (source.length > 0) { + if (match = source.match(pattern)) { + result += source.slice(0, match.index); + result += String.interpret(replacement(match)); + source = source.slice(match.index + match[0].length); + } else { + result += source, source = ''; + } + } + return result; + }, + + sub: function(pattern, replacement, count) { + replacement = this.gsub.prepareReplacement(replacement); + count = count === undefined ? 1 : count; + + return this.gsub(pattern, function(match) { + if (--count < 0) return match[0]; + return replacement(match); + }); + }, + + scan: function(pattern, iterator) { + this.gsub(pattern, iterator); + return String(this); + }, + + truncate: function(length, truncation) { + length = length || 30; + truncation = truncation === undefined ? '...' : truncation; + return this.length > length ? + this.slice(0, length - truncation.length) + truncation : String(this); + }, + + strip: function() { + return this.replace(/^\s+/, '').replace(/\s+$/, ''); + }, + + stripTags: function() { + return this.replace(/<\/?[^>]+>/gi, ''); + }, + + stripScripts: function() { + return this.replace(new RegExp(Prototype.ScriptFragment, 'img'), ''); + }, + + extractScripts: function() { + var matchAll = new RegExp(Prototype.ScriptFragment, 'img'); + var matchOne = new RegExp(Prototype.ScriptFragment, 'im'); + return (this.match(matchAll) || []).map(function(scriptTag) { + return (scriptTag.match(matchOne) || ['', ''])[1]; + }); + }, + + evalScripts: function() { + return this.extractScripts().map(function(script) { return eval(script) }); + }, + + escapeHTML: function() { + var self = arguments.callee; + self.text.data = this; + return self.div.innerHTML; + }, + + unescapeHTML: function() { + var div = new Element('div'); + div.innerHTML = this.stripTags(); + return div.childNodes[0] ? (div.childNodes.length > 1 ? + $A(div.childNodes).inject('', function(memo, node) { return memo+node.nodeValue }) : + div.childNodes[0].nodeValue) : ''; + }, + + toQueryParams: function(separator) { + var match = this.strip().match(/([^?#]*)(#.*)?$/); + if (!match) return { }; + + return match[1].split(separator || '&').inject({ }, function(hash, pair) { + if ((pair = pair.split('='))[0]) { + var key = decodeURIComponent(pair.shift()); + var value = pair.length > 1 ? pair.join('=') : pair[0]; + if (value != undefined) value = decodeURIComponent(value); + + if (key in hash) { + if (!Object.isArray(hash[key])) hash[key] = [hash[key]]; + hash[key].push(value); + } + else hash[key] = value; + } + return hash; + }); + }, + + toArray: function() { + return this.split(''); + }, + + succ: function() { + return this.slice(0, this.length - 1) + + String.fromCharCode(this.charCodeAt(this.length - 1) + 1); + }, + + times: function(count) { + return count < 1 ? '' : new Array(count + 1).join(this); + }, + + camelize: function() { + var parts = this.split('-'), len = parts.length; + if (len == 1) return parts[0]; + + var camelized = this.charAt(0) == '-' + ? parts[0].charAt(0).toUpperCase() + parts[0].substring(1) + : parts[0]; + + for (var i = 1; i < len; i++) + camelized += parts[i].charAt(0).toUpperCase() + parts[i].substring(1); + + return camelized; + }, + + capitalize: function() { + return this.charAt(0).toUpperCase() + this.substring(1).toLowerCase(); + }, + + underscore: function() { + return this.gsub(/::/, '/').gsub(/([A-Z]+)([A-Z][a-z])/,'#{1}_#{2}').gsub(/([a-z\d])([A-Z])/,'#{1}_#{2}').gsub(/-/,'_').toLowerCase(); + }, + + dasherize: function() { + return this.gsub(/_/,'-'); + }, + + inspect: function(useDoubleQuotes) { + var escapedString = this.gsub(/[\x00-\x1f\\]/, function(match) { + var character = String.specialChar[match[0]]; + return character ? character : '\\u00' + match[0].charCodeAt().toPaddedString(2, 16); + }); + if (useDoubleQuotes) return '"' + escapedString.replace(/"/g, '\\"') + '"'; + return "'" + escapedString.replace(/'/g, '\\\'') + "'"; + }, + + toJSON: function() { + return this.inspect(true); + }, + + unfilterJSON: function(filter) { + return this.sub(filter || Prototype.JSONFilter, '#{1}'); + }, + + isJSON: function() { + var str = this.replace(/\\./g, '@').replace(/"[^"\\\n\r]*"/g, ''); + return (/^[,:{}\[\]0-9.\-+Eaeflnr-u \n\r\t]*$/).test(str); + }, + + evalJSON: function(sanitize) { + var json = this.unfilterJSON(); + try { + if (!sanitize || json.isJSON()) return eval('(' + json + ')'); + } catch (e) { } + throw new SyntaxError('Badly formed JSON string: ' + this.inspect()); + }, + + include: function(pattern) { + return this.indexOf(pattern) > -1; + }, + + startsWith: function(pattern) { + return this.indexOf(pattern) === 0; + }, + + endsWith: function(pattern) { + var d = this.length - pattern.length; + return d >= 0 && this.lastIndexOf(pattern) === d; + }, + + empty: function() { + return this == ''; + }, + + blank: function() { + return /^\s*$/.test(this); + }, + + interpolate: function(object, pattern) { + return new Template(this, pattern).evaluate(object); + } +}); + +if (Prototype.Browser.WebKit || Prototype.Browser.IE) Object.extend(String.prototype, { + escapeHTML: function() { + return this.replace(/&/g,'&').replace(//g,'>'); + }, + unescapeHTML: function() { + return this.replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); + } +}); + +String.prototype.gsub.prepareReplacement = function(replacement) { + if (Object.isFunction(replacement)) return replacement; + var template = new Template(replacement); + return function(match) { return template.evaluate(match) }; +}; + +String.prototype.parseQuery = String.prototype.toQueryParams; + +Object.extend(String.prototype.escapeHTML, { + div: document.createElement('div'), + text: document.createTextNode('') +}); + +with (String.prototype.escapeHTML) div.appendChild(text); + +var Template = Class.create({ + initialize: function(template, pattern) { + this.template = template.toString(); + this.pattern = pattern || Template.Pattern; + }, + + evaluate: function(object) { + if (Object.isFunction(object.toTemplateReplacements)) + object = object.toTemplateReplacements(); + + return this.template.gsub(this.pattern, function(match) { + if (object == null) return ''; + + var before = match[1] || ''; + if (before == '\\') return match[2]; + + var ctx = object, expr = match[3]; + var pattern = /^([^.[]+|\[((?:.*?[^\\])?)\])(\.|\[|$)/, match = pattern.exec(expr); + if (match == null) return before; + + while (match != null) { + var comp = match[1].startsWith('[') ? match[2].gsub('\\\\]', ']') : match[1]; + ctx = ctx[comp]; + if (null == ctx || '' == match[3]) break; + expr = expr.substring('[' == match[3] ? match[1].length : match[0].length); + match = pattern.exec(expr); + } + + return before + String.interpret(ctx); + }.bind(this)); + } +}); +Template.Pattern = /(^|.|\r|\n)(#\{(.*?)\})/; + +var $break = { }; + +var Enumerable = { + each: function(iterator, context) { + var index = 0; + iterator = iterator.bind(context); + try { + this._each(function(value) { + iterator(value, index++); + }); + } catch (e) { + if (e != $break) throw e; + } + return this; + }, + + eachSlice: function(number, iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var index = -number, slices = [], array = this.toArray(); + while ((index += number) < array.length) + slices.push(array.slice(index, index+number)); + return slices.collect(iterator, context); + }, + + all: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var result = true; + this.each(function(value, index) { + result = result && !!iterator(value, index); + if (!result) throw $break; + }); + return result; + }, + + any: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var result = false; + this.each(function(value, index) { + if (result = !!iterator(value, index)) + throw $break; + }); + return result; + }, + + collect: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var results = []; + this.each(function(value, index) { + results.push(iterator(value, index)); + }); + return results; + }, + + detect: function(iterator, context) { + iterator = iterator.bind(context); + var result; + this.each(function(value, index) { + if (iterator(value, index)) { + result = value; + throw $break; + } + }); + return result; + }, + + findAll: function(iterator, context) { + iterator = iterator.bind(context); + var results = []; + this.each(function(value, index) { + if (iterator(value, index)) + results.push(value); + }); + return results; + }, + + grep: function(filter, iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var results = []; + + if (Object.isString(filter)) + filter = new RegExp(filter); + + this.each(function(value, index) { + if (filter.match(value)) + results.push(iterator(value, index)); + }); + return results; + }, + + include: function(object) { + if (Object.isFunction(this.indexOf)) + if (this.indexOf(object) != -1) return true; + + var found = false; + this.each(function(value) { + if (value == object) { + found = true; + throw $break; + } + }); + return found; + }, + + inGroupsOf: function(number, fillWith) { + fillWith = fillWith === undefined ? null : fillWith; + return this.eachSlice(number, function(slice) { + while(slice.length < number) slice.push(fillWith); + return slice; + }); + }, + + inject: function(memo, iterator, context) { + iterator = iterator.bind(context); + this.each(function(value, index) { + memo = iterator(memo, value, index); + }); + return memo; + }, + + invoke: function(method) { + var args = $A(arguments).slice(1); + return this.map(function(value) { + return value[method].apply(value, args); + }); + }, + + max: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var result; + this.each(function(value, index) { + value = iterator(value, index); + if (result == undefined || value >= result) + result = value; + }); + return result; + }, + + min: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var result; + this.each(function(value, index) { + value = iterator(value, index); + if (result == undefined || value < result) + result = value; + }); + return result; + }, + + partition: function(iterator, context) { + iterator = iterator ? iterator.bind(context) : Prototype.K; + var trues = [], falses = []; + this.each(function(value, index) { + (iterator(value, index) ? + trues : falses).push(value); + }); + return [trues, falses]; + }, + + pluck: function(property) { + var results = []; + this.each(function(value) { + results.push(value[property]); + }); + return results; + }, + + reject: function(iterator, context) { + iterator = iterator.bind(context); + var results = []; + this.each(function(value, index) { + if (!iterator(value, index)) + results.push(value); + }); + return results; + }, + + sortBy: function(iterator, context) { + iterator = iterator.bind(context); + return this.map(function(value, index) { + return {value: value, criteria: iterator(value, index)}; + }).sort(function(left, right) { + var a = left.criteria, b = right.criteria; + return a < b ? -1 : a > b ? 1 : 0; + }).pluck('value'); + }, + + toArray: function() { + return this.map(); + }, + + zip: function() { + var iterator = Prototype.K, args = $A(arguments); + if (Object.isFunction(args.last())) + iterator = args.pop(); + + var collections = [this].concat(args).map($A); + return this.map(function(value, index) { + return iterator(collections.pluck(index)); + }); + }, + + size: function() { + return this.toArray().length; + }, + + inspect: function() { + return '#'; + } +}; + +Object.extend(Enumerable, { + map: Enumerable.collect, + find: Enumerable.detect, + select: Enumerable.findAll, + filter: Enumerable.findAll, + member: Enumerable.include, + entries: Enumerable.toArray, + every: Enumerable.all, + some: Enumerable.any +}); +function $A(iterable) { + if (!iterable) return []; + if (iterable.toArray) return iterable.toArray(); + var length = iterable.length, results = new Array(length); + while (length--) results[length] = iterable[length]; + return results; +} + +if (Prototype.Browser.WebKit) { + function $A(iterable) { + if (!iterable) return []; + if (!(Object.isFunction(iterable) && iterable == '[object NodeList]') && + iterable.toArray) return iterable.toArray(); + var length = iterable.length, results = new Array(length); + while (length--) results[length] = iterable[length]; + return results; + } +} + +Array.from = $A; + +Object.extend(Array.prototype, Enumerable); + +if (!Array.prototype._reverse) Array.prototype._reverse = Array.prototype.reverse; + +Object.extend(Array.prototype, { + _each: function(iterator) { + for (var i = 0, length = this.length; i < length; i++) + iterator(this[i]); + }, + + clear: function() { + this.length = 0; + return this; + }, + + first: function() { + return this[0]; + }, + + last: function() { + return this[this.length - 1]; + }, + + compact: function() { + return this.select(function(value) { + return value != null; + }); + }, + + flatten: function() { + return this.inject([], function(array, value) { + return array.concat(Object.isArray(value) ? + value.flatten() : [value]); + }); + }, + + without: function() { + var values = $A(arguments); + return this.select(function(value) { + return !values.include(value); + }); + }, + + reverse: function(inline) { + return (inline !== false ? this : this.toArray())._reverse(); + }, + + reduce: function() { + return this.length > 1 ? this : this[0]; + }, + + uniq: function(sorted) { + return this.inject([], function(array, value, index) { + if (0 == index || (sorted ? array.last() != value : !array.include(value))) + array.push(value); + return array; + }); + }, + + intersect: function(array) { + return this.uniq().findAll(function(item) { + return array.detect(function(value) { return item === value }); + }); + }, + + clone: function() { + return [].concat(this); + }, + + size: function() { + return this.length; + }, + + inspect: function() { + return '[' + this.map(Object.inspect).join(', ') + ']'; + }, + + toJSON: function() { + var results = []; + this.each(function(object) { + var value = Object.toJSON(object); + if (value !== undefined) results.push(value); + }); + return '[' + results.join(', ') + ']'; + } +}); + +// use native browser JS 1.6 implementation if available +if (Object.isFunction(Array.prototype.forEach)) + Array.prototype._each = Array.prototype.forEach; + +if (!Array.prototype.indexOf) Array.prototype.indexOf = function(item, i) { + i || (i = 0); + var length = this.length; + if (i < 0) i = length + i; + for (; i < length; i++) + if (this[i] === item) return i; + return -1; +}; + +if (!Array.prototype.lastIndexOf) Array.prototype.lastIndexOf = function(item, i) { + i = isNaN(i) ? this.length : (i < 0 ? this.length + i : i) + 1; + var n = this.slice(0, i).reverse().indexOf(item); + return (n < 0) ? n : i - n - 1; +}; + +Array.prototype.toArray = Array.prototype.clone; + +function $w(string) { + if (!Object.isString(string)) return []; + string = string.strip(); + return string ? string.split(/\s+/) : []; +} + +if (Prototype.Browser.Opera){ + Array.prototype.concat = function() { + var array = []; + for (var i = 0, length = this.length; i < length; i++) array.push(this[i]); + for (var i = 0, length = arguments.length; i < length; i++) { + if (Object.isArray(arguments[i])) { + for (var j = 0, arrayLength = arguments[i].length; j < arrayLength; j++) + array.push(arguments[i][j]); + } else { + array.push(arguments[i]); + } + } + return array; + }; +} +Object.extend(Number.prototype, { + toColorPart: function() { + return this.toPaddedString(2, 16); + }, + + succ: function() { + return this + 1; + }, + + times: function(iterator) { + $R(0, this, true).each(iterator); + return this; + }, + + toPaddedString: function(length, radix) { + var string = this.toString(radix || 10); + return '0'.times(length - string.length) + string; + }, + + toJSON: function() { + return isFinite(this) ? this.toString() : 'null'; + } +}); + +$w('abs round ceil floor').each(function(method){ + Number.prototype[method] = Math[method].methodize(); +}); +function $H(object) { + return new Hash(object); +}; + +var Hash = Class.create(Enumerable, (function() { + if (function() { + var i = 0, Test = function(value) { this.key = value }; + Test.prototype.key = 'foo'; + for (var property in new Test('bar')) i++; + return i > 1; + }()) { + function each(iterator) { + var cache = []; + for (var key in this._object) { + var value = this._object[key]; + if (cache.include(key)) continue; + cache.push(key); + var pair = [key, value]; + pair.key = key; + pair.value = value; + iterator(pair); + } + } + } else { + function each(iterator) { + for (var key in this._object) { + var value = this._object[key], pair = [key, value]; + pair.key = key; + pair.value = value; + iterator(pair); + } + } + } + + function toQueryPair(key, value) { + if (Object.isUndefined(value)) return key; + return key + '=' + encodeURIComponent(String.interpret(value)); + } + + return { + initialize: function(object) { + this._object = Object.isHash(object) ? object.toObject() : Object.clone(object); + }, + + _each: each, + + set: function(key, value) { + return this._object[key] = value; + }, + + get: function(key) { + return this._object[key]; + }, + + unset: function(key) { + var value = this._object[key]; + delete this._object[key]; + return value; + }, + + toObject: function() { + return Object.clone(this._object); + }, + + keys: function() { + return this.pluck('key'); + }, + + values: function() { + return this.pluck('value'); + }, + + index: function(value) { + var match = this.detect(function(pair) { + return pair.value === value; + }); + return match && match.key; + }, + + merge: function(object) { + return this.clone().update(object); + }, + + update: function(object) { + return new Hash(object).inject(this, function(result, pair) { + result.set(pair.key, pair.value); + return result; + }); + }, + + toQueryString: function() { + return this.map(function(pair) { + var key = encodeURIComponent(pair.key), values = pair.value; + + if (values && typeof values == 'object') { + if (Object.isArray(values)) + return values.map(toQueryPair.curry(key)).join('&'); + } + return toQueryPair(key, values); + }).join('&'); + }, + + inspect: function() { + return '#'; + }, + + toJSON: function() { + return Object.toJSON(this.toObject()); + }, + + clone: function() { + return new Hash(this); + } + } +})()); + +Hash.prototype.toTemplateReplacements = Hash.prototype.toObject; +Hash.from = $H; +var ObjectRange = Class.create(Enumerable, { + initialize: function(start, end, exclusive) { + this.start = start; + this.end = end; + this.exclusive = exclusive; + }, + + _each: function(iterator) { + var value = this.start; + while (this.include(value)) { + iterator(value); + value = value.succ(); + } + }, + + include: function(value) { + if (value < this.start) + return false; + if (this.exclusive) + return value < this.end; + return value <= this.end; + } +}); + +var $R = function(start, end, exclusive) { + return new ObjectRange(start, end, exclusive); +}; + +var Ajax = { + getTransport: function() { + return Try.these( + function() {return new XMLHttpRequest()}, + function() {return new ActiveXObject('Msxml2.XMLHTTP')}, + function() {return new ActiveXObject('Microsoft.XMLHTTP')} + ) || false; + }, + + activeRequestCount: 0 +}; + +Ajax.Responders = { + responders: [], + + _each: function(iterator) { + this.responders._each(iterator); + }, + + register: function(responder) { + if (!this.include(responder)) + this.responders.push(responder); + }, + + unregister: function(responder) { + this.responders = this.responders.without(responder); + }, + + dispatch: function(callback, request, transport, json) { + this.each(function(responder) { + if (Object.isFunction(responder[callback])) { + try { + responder[callback].apply(responder, [request, transport, json]); + } catch (e) { } + } + }); + } +}; + +Object.extend(Ajax.Responders, Enumerable); + +Ajax.Responders.register({ + onCreate: function() { Ajax.activeRequestCount++ }, + onComplete: function() { Ajax.activeRequestCount-- } +}); + +Ajax.Base = Class.create({ + initialize: function(options) { + this.options = { + method: 'post', + asynchronous: true, + contentType: 'application/x-www-form-urlencoded', + encoding: 'UTF-8', + parameters: '', + evalJSON: true, + evalJS: true + }; + Object.extend(this.options, options || { }); + + this.options.method = this.options.method.toLowerCase(); + if (Object.isString(this.options.parameters)) + this.options.parameters = this.options.parameters.toQueryParams(); + } +}); + +Ajax.Request = Class.create(Ajax.Base, { + _complete: false, + + initialize: function($super, url, options) { + $super(options); + this.transport = Ajax.getTransport(); + this.request(url); + }, + + request: function(url) { + this.url = url; + this.method = this.options.method; + var params = Object.clone(this.options.parameters); + + if (!['get', 'post'].include(this.method)) { + // simulate other verbs over post + params['_method'] = this.method; + this.method = 'post'; + } + + this.parameters = params; + + if (params = Object.toQueryString(params)) { + // when GET, append parameters to URL + if (this.method == 'get') + this.url += (this.url.include('?') ? '&' : '?') + params; + else if (/Konqueror|Safari|KHTML/.test(navigator.userAgent)) + params += '&_='; + } + + try { + var response = new Ajax.Response(this); + if (this.options.onCreate) this.options.onCreate(response); + Ajax.Responders.dispatch('onCreate', this, response); + + this.transport.open(this.method.toUpperCase(), this.url, + this.options.asynchronous); + + if (this.options.asynchronous) this.respondToReadyState.bind(this).defer(1); + + this.transport.onreadystatechange = this.onStateChange.bind(this); + this.setRequestHeaders(); + + this.body = this.method == 'post' ? (this.options.postBody || params) : null; + this.transport.send(this.body); + + /* Force Firefox to handle ready state 4 for synchronous requests */ + if (!this.options.asynchronous && this.transport.overrideMimeType) + this.onStateChange(); + + } + catch (e) { + this.dispatchException(e); + } + }, + + onStateChange: function() { + var readyState = this.transport.readyState; + if (readyState > 1 && !((readyState == 4) && this._complete)) + this.respondToReadyState(this.transport.readyState); + }, + + setRequestHeaders: function() { + var headers = { + 'X-Requested-With': 'XMLHttpRequest', + 'X-Prototype-Version': Prototype.Version, + 'Accept': 'text/javascript, text/html, application/xml, text/xml, */*' + }; + + if (this.method == 'post') { + headers['Content-type'] = this.options.contentType + + (this.options.encoding ? '; charset=' + this.options.encoding : ''); + + /* Force "Connection: close" for older Mozilla browsers to work + * around a bug where XMLHttpRequest sends an incorrect + * Content-length header. See Mozilla Bugzilla #246651. + */ + if (this.transport.overrideMimeType && + (navigator.userAgent.match(/Gecko\/(\d{4})/) || [0,2005])[1] < 2005) + headers['Connection'] = 'close'; + } + + // user-defined headers + if (typeof this.options.requestHeaders == 'object') { + var extras = this.options.requestHeaders; + + if (Object.isFunction(extras.push)) + for (var i = 0, length = extras.length; i < length; i += 2) + headers[extras[i]] = extras[i+1]; + else + $H(extras).each(function(pair) { headers[pair.key] = pair.value }); + } + + for (var name in headers) + this.transport.setRequestHeader(name, headers[name]); + }, + + success: function() { + var status = this.getStatus(); + return !status || (status >= 200 && status < 300); + }, + + getStatus: function() { + try { + return this.transport.status || 0; + } catch (e) { return 0 } + }, + + respondToReadyState: function(readyState) { + var state = Ajax.Request.Events[readyState], response = new Ajax.Response(this); + + if (state == 'Complete') { + try { + this._complete = true; + (this.options['on' + response.status] + || this.options['on' + (this.success() ? 'Success' : 'Failure')] + || Prototype.emptyFunction)(response, response.headerJSON); + } catch (e) { + this.dispatchException(e); + } + + var contentType = response.getHeader('Content-type'); + if (this.options.evalJS == 'force' + || (this.options.evalJS && contentType + && contentType.match(/^\s*(text|application)\/(x-)?(java|ecma)script(;.*)?\s*$/i))) + this.evalResponse(); + } + + try { + (this.options['on' + state] || Prototype.emptyFunction)(response, response.headerJSON); + Ajax.Responders.dispatch('on' + state, this, response, response.headerJSON); + } catch (e) { + this.dispatchException(e); + } + + if (state == 'Complete') { + // avoid memory leak in MSIE: clean up + this.transport.onreadystatechange = Prototype.emptyFunction; + } + }, + + getHeader: function(name) { + try { + return this.transport.getResponseHeader(name); + } catch (e) { return null } + }, + + evalResponse: function() { + try { + return eval((this.transport.responseText || '').unfilterJSON()); + } catch (e) { + this.dispatchException(e); + } + }, + + dispatchException: function(exception) { + (this.options.onException || Prototype.emptyFunction)(this, exception); + Ajax.Responders.dispatch('onException', this, exception); + } +}); + +Ajax.Request.Events = + ['Uninitialized', 'Loading', 'Loaded', 'Interactive', 'Complete']; + +Ajax.Response = Class.create({ + initialize: function(request){ + this.request = request; + var transport = this.transport = request.transport, + readyState = this.readyState = transport.readyState; + + if((readyState > 2 && !Prototype.Browser.IE) || readyState == 4) { + this.status = this.getStatus(); + this.statusText = this.getStatusText(); + this.responseText = String.interpret(transport.responseText); + this.headerJSON = this._getHeaderJSON(); + } + + if(readyState == 4) { + var xml = transport.responseXML; + this.responseXML = xml === undefined ? null : xml; + this.responseJSON = this._getResponseJSON(); + } + }, + + status: 0, + statusText: '', + + getStatus: Ajax.Request.prototype.getStatus, + + getStatusText: function() { + try { + return this.transport.statusText || ''; + } catch (e) { return '' } + }, + + getHeader: Ajax.Request.prototype.getHeader, + + getAllHeaders: function() { + try { + return this.getAllResponseHeaders(); + } catch (e) { return null } + }, + + getResponseHeader: function(name) { + return this.transport.getResponseHeader(name); + }, + + getAllResponseHeaders: function() { + return this.transport.getAllResponseHeaders(); + }, + + _getHeaderJSON: function() { + var json = this.getHeader('X-JSON'); + if (!json) return null; + json = decodeURIComponent(escape(json)); + try { + return json.evalJSON(this.request.options.sanitizeJSON); + } catch (e) { + this.request.dispatchException(e); + } + }, + + _getResponseJSON: function() { + var options = this.request.options; + if (!options.evalJSON || (options.evalJSON != 'force' && + !(this.getHeader('Content-type') || '').include('application/json'))) + return null; + try { + return this.transport.responseText.evalJSON(options.sanitizeJSON); + } catch (e) { + this.request.dispatchException(e); + } + } +}); + +Ajax.Updater = Class.create(Ajax.Request, { + initialize: function($super, container, url, options) { + this.container = { + success: (container.success || container), + failure: (container.failure || (container.success ? null : container)) + }; + + options = options || { }; + var onComplete = options.onComplete; + options.onComplete = (function(response, param) { + this.updateContent(response.responseText); + if (Object.isFunction(onComplete)) onComplete(response, param); + }).bind(this); + + $super(url, options); + }, + + updateContent: function(responseText) { + var receiver = this.container[this.success() ? 'success' : 'failure'], + options = this.options; + + if (!options.evalScripts) responseText = responseText.stripScripts(); + + if (receiver = $(receiver)) { + if (options.insertion) { + if (Object.isString(options.insertion)) { + var insertion = { }; insertion[options.insertion] = responseText; + receiver.insert(insertion); + } + else options.insertion(receiver, responseText); + } + else receiver.update(responseText); + } + + if (this.success()) { + if (this.onComplete) this.onComplete.bind(this).defer(); + } + } +}); + +Ajax.PeriodicalUpdater = Class.create(Ajax.Base, { + initialize: function($super, container, url, options) { + $super(options); + this.onComplete = this.options.onComplete; + + this.frequency = (this.options.frequency || 2); + this.decay = (this.options.decay || 1); + + this.updater = { }; + this.container = container; + this.url = url; + + this.start(); + }, + + start: function() { + this.options.onComplete = this.updateComplete.bind(this); + this.onTimerEvent(); + }, + + stop: function() { + this.updater.options.onComplete = undefined; + clearTimeout(this.timer); + (this.onComplete || Prototype.emptyFunction).apply(this, arguments); + }, + + updateComplete: function(response) { + if (this.options.decay) { + this.decay = (response.responseText == this.lastText ? + this.decay * this.options.decay : 1); + + this.lastText = response.responseText; + } + this.timer = this.onTimerEvent.bind(this).delay(this.decay * this.frequency); + }, + + onTimerEvent: function() { + this.updater = new Ajax.Updater(this.container, this.url, this.options); + } +}); +function $(element) { + if (arguments.length > 1) { + for (var i = 0, elements = [], length = arguments.length; i < length; i++) + elements.push($(arguments[i])); + return elements; + } + if (Object.isString(element)) + element = document.getElementById(element); + return Element.extend(element); +} + +if (Prototype.BrowserFeatures.XPath) { + document._getElementsByXPath = function(expression, parentElement) { + var results = []; + var query = document.evaluate(expression, $(parentElement) || document, + null, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE, null); + for (var i = 0, length = query.snapshotLength; i < length; i++) + results.push(Element.extend(query.snapshotItem(i))); + return results; + }; +} + +/*--------------------------------------------------------------------------*/ + +if (!window.Node) var Node = { }; + +if (!Node.ELEMENT_NODE) { + // DOM level 2 ECMAScript Language Binding + Object.extend(Node, { + ELEMENT_NODE: 1, + ATTRIBUTE_NODE: 2, + TEXT_NODE: 3, + CDATA_SECTION_NODE: 4, + ENTITY_REFERENCE_NODE: 5, + ENTITY_NODE: 6, + PROCESSING_INSTRUCTION_NODE: 7, + COMMENT_NODE: 8, + DOCUMENT_NODE: 9, + DOCUMENT_TYPE_NODE: 10, + DOCUMENT_FRAGMENT_NODE: 11, + NOTATION_NODE: 12 + }); +} + +(function() { + var element = this.Element; + this.Element = function(tagName, attributes) { + attributes = attributes || { }; + tagName = tagName.toLowerCase(); + var cache = Element.cache; + if (Prototype.Browser.IE && attributes.name) { + tagName = '<' + tagName + ' name="' + attributes.name + '">'; + delete attributes.name; + return Element.writeAttribute(document.createElement(tagName), attributes); + } + if (!cache[tagName]) cache[tagName] = Element.extend(document.createElement(tagName)); + return Element.writeAttribute(cache[tagName].cloneNode(false), attributes); + }; + Object.extend(this.Element, element || { }); +}).call(window); + +Element.cache = { }; + +Element.Methods = { + visible: function(element) { + return $(element).style.display != 'none'; + }, + + toggle: function(element) { + element = $(element); + Element[Element.visible(element) ? 'hide' : 'show'](element); + return element; + }, + + hide: function(element) { + $(element).style.display = 'none'; + return element; + }, + + show: function(element) { + $(element).style.display = ''; + return element; + }, + + remove: function(element) { + element = $(element); + element.parentNode.removeChild(element); + return element; + }, + + update: function(element, content) { + element = $(element); + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) return element.update().insert(content); + content = Object.toHTML(content); + element.innerHTML = content.stripScripts(); + content.evalScripts.bind(content).defer(); + return element; + }, + + replace: function(element, content) { + element = $(element); + if (content && content.toElement) content = content.toElement(); + else if (!Object.isElement(content)) { + content = Object.toHTML(content); + var range = element.ownerDocument.createRange(); + range.selectNode(element); + content.evalScripts.bind(content).defer(); + content = range.createContextualFragment(content.stripScripts()); + } + element.parentNode.replaceChild(content, element); + return element; + }, + + insert: function(element, insertions) { + element = $(element); + + if (Object.isString(insertions) || Object.isNumber(insertions) || + Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML))) + insertions = {bottom:insertions}; + + var content, t, range; + + for (position in insertions) { + content = insertions[position]; + position = position.toLowerCase(); + t = Element._insertionTranslations[position]; + + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) { + t.insert(element, content); + continue; + } + + content = Object.toHTML(content); + + range = element.ownerDocument.createRange(); + t.initializeRange(element, range); + t.insert(element, range.createContextualFragment(content.stripScripts())); + + content.evalScripts.bind(content).defer(); + } + + return element; + }, + + wrap: function(element, wrapper, attributes) { + element = $(element); + if (Object.isElement(wrapper)) + $(wrapper).writeAttribute(attributes || { }); + else if (Object.isString(wrapper)) wrapper = new Element(wrapper, attributes); + else wrapper = new Element('div', wrapper); + if (element.parentNode) + element.parentNode.replaceChild(wrapper, element); + wrapper.appendChild(element); + return wrapper; + }, + + inspect: function(element) { + element = $(element); + var result = '<' + element.tagName.toLowerCase(); + $H({'id': 'id', 'className': 'class'}).each(function(pair) { + var property = pair.first(), attribute = pair.last(); + var value = (element[property] || '').toString(); + if (value) result += ' ' + attribute + '=' + value.inspect(true); + }); + return result + '>'; + }, + + recursivelyCollect: function(element, property) { + element = $(element); + var elements = []; + while (element = element[property]) + if (element.nodeType == 1) + elements.push(Element.extend(element)); + return elements; + }, + + ancestors: function(element) { + return $(element).recursivelyCollect('parentNode'); + }, + + descendants: function(element) { + return $A($(element).getElementsByTagName('*')).each(Element.extend); + }, + + firstDescendant: function(element) { + element = $(element).firstChild; + while (element && element.nodeType != 1) element = element.nextSibling; + return $(element); + }, + + immediateDescendants: function(element) { + if (!(element = $(element).firstChild)) return []; + while (element && element.nodeType != 1) element = element.nextSibling; + if (element) return [element].concat($(element).nextSiblings()); + return []; + }, + + previousSiblings: function(element) { + return $(element).recursivelyCollect('previousSibling'); + }, + + nextSiblings: function(element) { + return $(element).recursivelyCollect('nextSibling'); + }, + + siblings: function(element) { + element = $(element); + return element.previousSiblings().reverse().concat(element.nextSiblings()); + }, + + match: function(element, selector) { + if (Object.isString(selector)) + selector = new Selector(selector); + return selector.match($(element)); + }, + + up: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return $(element.parentNode); + var ancestors = element.ancestors(); + return expression ? Selector.findElement(ancestors, expression, index) : + ancestors[index || 0]; + }, + + down: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return element.firstDescendant(); + var descendants = element.descendants(); + return expression ? Selector.findElement(descendants, expression, index) : + descendants[index || 0]; + }, + + previous: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return $(Selector.handlers.previousElementSibling(element)); + var previousSiblings = element.previousSiblings(); + return expression ? Selector.findElement(previousSiblings, expression, index) : + previousSiblings[index || 0]; + }, + + next: function(element, expression, index) { + element = $(element); + if (arguments.length == 1) return $(Selector.handlers.nextElementSibling(element)); + var nextSiblings = element.nextSiblings(); + return expression ? Selector.findElement(nextSiblings, expression, index) : + nextSiblings[index || 0]; + }, + + select: function() { + var args = $A(arguments), element = $(args.shift()); + return Selector.findChildElements(element, args); + }, + + adjacent: function() { + var args = $A(arguments), element = $(args.shift()); + return Selector.findChildElements(element.parentNode, args).without(element); + }, + + identify: function(element) { + element = $(element); + var id = element.readAttribute('id'), self = arguments.callee; + if (id) return id; + do { id = 'anonymous_element_' + self.counter++ } while ($(id)); + element.writeAttribute('id', id); + return id; + }, + + readAttribute: function(element, name) { + element = $(element); + if (Prototype.Browser.IE) { + var t = Element._attributeTranslations.read; + if (t.values[name]) return t.values[name](element, name); + if (t.names[name]) name = t.names[name]; + if (name.include(':')) { + return (!element.attributes || !element.attributes[name]) ? null : + element.attributes[name].value; + } + } + return element.getAttribute(name); + }, + + writeAttribute: function(element, name, value) { + element = $(element); + var attributes = { }, t = Element._attributeTranslations.write; + + if (typeof name == 'object') attributes = name; + else attributes[name] = value === undefined ? true : value; + + for (var attr in attributes) { + var name = t.names[attr] || attr, value = attributes[attr]; + if (t.values[attr]) name = t.values[attr](element, value); + if (value === false || value === null) + element.removeAttribute(name); + else if (value === true) + element.setAttribute(name, name); + else element.setAttribute(name, value); + } + return element; + }, + + getHeight: function(element) { + return $(element).getDimensions().height; + }, + + getWidth: function(element) { + return $(element).getDimensions().width; + }, + + classNames: function(element) { + return new Element.ClassNames(element); + }, + + hasClassName: function(element, className) { + if (!(element = $(element))) return; + var elementClassName = element.className; + return (elementClassName.length > 0 && (elementClassName == className || + new RegExp("(^|\\s)" + className + "(\\s|$)").test(elementClassName))); + }, + + addClassName: function(element, className) { + if (!(element = $(element))) return; + if (!element.hasClassName(className)) + element.className += (element.className ? ' ' : '') + className; + return element; + }, + + removeClassName: function(element, className) { + if (!(element = $(element))) return; + element.className = element.className.replace( + new RegExp("(^|\\s+)" + className + "(\\s+|$)"), ' ').strip(); + return element; + }, + + toggleClassName: function(element, className) { + if (!(element = $(element))) return; + return element[element.hasClassName(className) ? + 'removeClassName' : 'addClassName'](className); + }, + + // removes whitespace-only text node children + cleanWhitespace: function(element) { + element = $(element); + var node = element.firstChild; + while (node) { + var nextNode = node.nextSibling; + if (node.nodeType == 3 && !/\S/.test(node.nodeValue)) + element.removeChild(node); + node = nextNode; + } + return element; + }, + + empty: function(element) { + return $(element).innerHTML.blank(); + }, + + descendantOf: function(element, ancestor) { + element = $(element), ancestor = $(ancestor); + + if (element.compareDocumentPosition) + return (element.compareDocumentPosition(ancestor) & 8) === 8; + + if (element.sourceIndex && !Prototype.Browser.Opera) { + var e = element.sourceIndex, a = ancestor.sourceIndex, + nextAncestor = ancestor.nextSibling; + if (!nextAncestor) { + do { ancestor = ancestor.parentNode; } + while (!(nextAncestor = ancestor.nextSibling) && ancestor.parentNode); + } + if (nextAncestor) return (e > a && e < nextAncestor.sourceIndex); + } + + while (element = element.parentNode) + if (element == ancestor) return true; + return false; + }, + + scrollTo: function(element) { + element = $(element); + var pos = element.cumulativeOffset(); + window.scrollTo(pos[0], pos[1]); + return element; + }, + + getStyle: function(element, style) { + element = $(element); + style = style == 'float' ? 'cssFloat' : style.camelize(); + var value = element.style[style]; + if (!value) { + var css = document.defaultView.getComputedStyle(element, null); + value = css ? css[style] : null; + } + if (style == 'opacity') return value ? parseFloat(value) : 1.0; + return value == 'auto' ? null : value; + }, + + getOpacity: function(element) { + return $(element).getStyle('opacity'); + }, + + setStyle: function(element, styles) { + element = $(element); + var elementStyle = element.style, match; + if (Object.isString(styles)) { + element.style.cssText += ';' + styles; + return styles.include('opacity') ? + element.setOpacity(styles.match(/opacity:\s*(\d?\.?\d*)/)[1]) : element; + } + for (var property in styles) + if (property == 'opacity') element.setOpacity(styles[property]); + else + elementStyle[(property == 'float' || property == 'cssFloat') ? + (elementStyle.styleFloat === undefined ? 'cssFloat' : 'styleFloat') : + property] = styles[property]; + + return element; + }, + + setOpacity: function(element, value) { + element = $(element); + element.style.opacity = (value == 1 || value === '') ? '' : + (value < 0.00001) ? 0 : value; + return element; + }, + + getDimensions: function(element) { + element = $(element); + var display = $(element).getStyle('display'); + if (display != 'none' && display != null) // Safari bug + return {width: element.offsetWidth, height: element.offsetHeight}; + + // All *Width and *Height properties give 0 on elements with display none, + // so enable the element temporarily + var els = element.style; + var originalVisibility = els.visibility; + var originalPosition = els.position; + var originalDisplay = els.display; + els.visibility = 'hidden'; + els.position = 'absolute'; + els.display = 'block'; + var originalWidth = element.clientWidth; + var originalHeight = element.clientHeight; + els.display = originalDisplay; + els.position = originalPosition; + els.visibility = originalVisibility; + return {width: originalWidth, height: originalHeight}; + }, + + makePositioned: function(element) { + element = $(element); + var pos = Element.getStyle(element, 'position'); + if (pos == 'static' || !pos) { + element._madePositioned = true; + element.style.position = 'relative'; + // Opera returns the offset relative to the positioning context, when an + // element is position relative but top and left have not been defined + if (window.opera) { + element.style.top = 0; + element.style.left = 0; + } + } + return element; + }, + + undoPositioned: function(element) { + element = $(element); + if (element._madePositioned) { + element._madePositioned = undefined; + element.style.position = + element.style.top = + element.style.left = + element.style.bottom = + element.style.right = ''; + } + return element; + }, + + makeClipping: function(element) { + element = $(element); + if (element._overflow) return element; + element._overflow = Element.getStyle(element, 'overflow') || 'auto'; + if (element._overflow !== 'hidden') + element.style.overflow = 'hidden'; + return element; + }, + + undoClipping: function(element) { + element = $(element); + if (!element._overflow) return element; + element.style.overflow = element._overflow == 'auto' ? '' : element._overflow; + element._overflow = null; + return element; + }, + + cumulativeOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + } while (element); + return Element._returnOffset(valueL, valueT); + }, + + positionedOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + element = element.offsetParent; + if (element) { + if (element.tagName == 'BODY') break; + var p = Element.getStyle(element, 'position'); + if (p == 'relative' || p == 'absolute') break; + } + } while (element); + return Element._returnOffset(valueL, valueT); + }, + + absolutize: function(element) { + element = $(element); + if (element.getStyle('position') == 'absolute') return; + // Position.prepare(); // To be done manually by Scripty when it needs it. + + var offsets = element.positionedOffset(); + var top = offsets[1]; + var left = offsets[0]; + var width = element.clientWidth; + var height = element.clientHeight; + + element._originalLeft = left - parseFloat(element.style.left || 0); + element._originalTop = top - parseFloat(element.style.top || 0); + element._originalWidth = element.style.width; + element._originalHeight = element.style.height; + + element.style.position = 'absolute'; + element.style.top = top + 'px'; + element.style.left = left + 'px'; + element.style.width = width + 'px'; + element.style.height = height + 'px'; + return element; + }, + + relativize: function(element) { + element = $(element); + if (element.getStyle('position') == 'relative') return; + // Position.prepare(); // To be done manually by Scripty when it needs it. + + element.style.position = 'relative'; + var top = parseFloat(element.style.top || 0) - (element._originalTop || 0); + var left = parseFloat(element.style.left || 0) - (element._originalLeft || 0); + + element.style.top = top + 'px'; + element.style.left = left + 'px'; + element.style.height = element._originalHeight; + element.style.width = element._originalWidth; + return element; + }, + + cumulativeScrollOffset: function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.scrollTop || 0; + valueL += element.scrollLeft || 0; + element = element.parentNode; + } while (element); + return Element._returnOffset(valueL, valueT); + }, + + getOffsetParent: function(element) { + if (element.offsetParent) return $(element.offsetParent); + if (element == document.body) return $(element); + + while ((element = element.parentNode) && element != document.body) + if (Element.getStyle(element, 'position') != 'static') + return $(element); + + return $(document.body); + }, + + viewportOffset: function(forElement) { + var valueT = 0, valueL = 0; + + var element = forElement; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + + // Safari fix + if (element.offsetParent == document.body && + Element.getStyle(element, 'position') == 'absolute') break; + + } while (element = element.offsetParent); + + element = forElement; + do { + if (!Prototype.Browser.Opera || element.tagName == 'BODY') { + valueT -= element.scrollTop || 0; + valueL -= element.scrollLeft || 0; + } + } while (element = element.parentNode); + + return Element._returnOffset(valueL, valueT); + }, + + clonePosition: function(element, source) { + var options = Object.extend({ + setLeft: true, + setTop: true, + setWidth: true, + setHeight: true, + offsetTop: 0, + offsetLeft: 0 + }, arguments[2] || { }); + + // find page position of source + source = $(source); + var p = source.viewportOffset(); + + // find coordinate system to use + element = $(element); + var delta = [0, 0]; + var parent = null; + // delta [0,0] will do fine with position: fixed elements, + // position:absolute needs offsetParent deltas + if (Element.getStyle(element, 'position') == 'absolute') { + parent = element.getOffsetParent(); + delta = parent.viewportOffset(); + } + + // correct by body offsets (fixes Safari) + if (parent == document.body) { + delta[0] -= document.body.offsetLeft; + delta[1] -= document.body.offsetTop; + } + + // set position + if (options.setLeft) element.style.left = (p[0] - delta[0] + options.offsetLeft) + 'px'; + if (options.setTop) element.style.top = (p[1] - delta[1] + options.offsetTop) + 'px'; + if (options.setWidth) element.style.width = source.offsetWidth + 'px'; + if (options.setHeight) element.style.height = source.offsetHeight + 'px'; + return element; + } +}; + +Element.Methods.identify.counter = 1; + +Object.extend(Element.Methods, { + getElementsBySelector: Element.Methods.select, + childElements: Element.Methods.immediateDescendants +}); + +Element._attributeTranslations = { + write: { + names: { + className: 'class', + htmlFor: 'for' + }, + values: { } + } +}; + + +if (!document.createRange || Prototype.Browser.Opera) { + Element.Methods.insert = function(element, insertions) { + element = $(element); + + if (Object.isString(insertions) || Object.isNumber(insertions) || + Object.isElement(insertions) || (insertions && (insertions.toElement || insertions.toHTML))) + insertions = { bottom: insertions }; + + var t = Element._insertionTranslations, content, position, pos, tagName; + + for (position in insertions) { + content = insertions[position]; + position = position.toLowerCase(); + pos = t[position]; + + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) { + pos.insert(element, content); + continue; + } + + content = Object.toHTML(content); + tagName = ((position == 'before' || position == 'after') + ? element.parentNode : element).tagName.toUpperCase(); + + if (t.tags[tagName]) { + var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); + if (position == 'top' || position == 'after') fragments.reverse(); + fragments.each(pos.insert.curry(element)); + } + else element.insertAdjacentHTML(pos.adjacency, content.stripScripts()); + + content.evalScripts.bind(content).defer(); + } + + return element; + }; +} + +if (Prototype.Browser.Opera) { + Element.Methods._getStyle = Element.Methods.getStyle; + Element.Methods.getStyle = function(element, style) { + switch(style) { + case 'left': + case 'top': + case 'right': + case 'bottom': + if (Element._getStyle(element, 'position') == 'static') return null; + default: return Element._getStyle(element, style); + } + }; + Element.Methods._readAttribute = Element.Methods.readAttribute; + Element.Methods.readAttribute = function(element, attribute) { + if (attribute == 'title') return element.title; + return Element._readAttribute(element, attribute); + }; +} + +else if (Prototype.Browser.IE) { + $w('positionedOffset getOffsetParent viewportOffset').each(function(method) { + Element.Methods[method] = Element.Methods[method].wrap( + function(proceed, element) { + element = $(element); + var position = element.getStyle('position'); + if (position != 'static') return proceed(element); + element.setStyle({ position: 'relative' }); + var value = proceed(element); + element.setStyle({ position: position }); + return value; + } + ); + }); + + Element.Methods.getStyle = function(element, style) { + element = $(element); + style = (style == 'float' || style == 'cssFloat') ? 'styleFloat' : style.camelize(); + var value = element.style[style]; + if (!value && element.currentStyle) value = element.currentStyle[style]; + + if (style == 'opacity') { + if (value = (element.getStyle('filter') || '').match(/alpha\(opacity=(.*)\)/)) + if (value[1]) return parseFloat(value[1]) / 100; + return 1.0; + } + + if (value == 'auto') { + if ((style == 'width' || style == 'height') && (element.getStyle('display') != 'none')) + return element['offset' + style.capitalize()] + 'px'; + return null; + } + return value; + }; + + Element.Methods.setOpacity = function(element, value) { + function stripAlpha(filter){ + return filter.replace(/alpha\([^\)]*\)/gi,''); + } + element = $(element); + var currentStyle = element.currentStyle; + if ((currentStyle && !currentStyle.hasLayout) || + (!currentStyle && element.style.zoom == 'normal')) + element.style.zoom = 1; + + var filter = element.getStyle('filter'), style = element.style; + if (value == 1 || value === '') { + (filter = stripAlpha(filter)) ? + style.filter = filter : style.removeAttribute('filter'); + return element; + } else if (value < 0.00001) value = 0; + style.filter = stripAlpha(filter) + + 'alpha(opacity=' + (value * 100) + ')'; + return element; + }; + + Element._attributeTranslations = { + read: { + names: { + 'class': 'className', + 'for': 'htmlFor' + }, + values: { + _getAttr: function(element, attribute) { + return element.getAttribute(attribute, 2); + }, + _getAttrNode: function(element, attribute) { + var node = element.getAttributeNode(attribute); + return node ? node.value : ""; + }, + _getEv: function(element, attribute) { + var attribute = element.getAttribute(attribute); + return attribute ? attribute.toString().slice(23, -2) : null; + }, + _flag: function(element, attribute) { + return $(element).hasAttribute(attribute) ? attribute : null; + }, + style: function(element) { + return element.style.cssText.toLowerCase(); + }, + title: function(element) { + return element.title; + } + } + } + }; + + Element._attributeTranslations.write = { + names: Object.clone(Element._attributeTranslations.read.names), + values: { + checked: function(element, value) { + element.checked = !!value; + }, + + style: function(element, value) { + element.style.cssText = value ? value : ''; + } + } + }; + + Element._attributeTranslations.has = {}; + + $w('colSpan rowSpan vAlign dateTime accessKey tabIndex ' + + 'encType maxLength readOnly longDesc').each(function(attr) { + Element._attributeTranslations.write.names[attr.toLowerCase()] = attr; + Element._attributeTranslations.has[attr.toLowerCase()] = attr; + }); + + (function(v) { + Object.extend(v, { + href: v._getAttr, + src: v._getAttr, + type: v._getAttr, + action: v._getAttrNode, + disabled: v._flag, + checked: v._flag, + readonly: v._flag, + multiple: v._flag, + onload: v._getEv, + onunload: v._getEv, + onclick: v._getEv, + ondblclick: v._getEv, + onmousedown: v._getEv, + onmouseup: v._getEv, + onmouseover: v._getEv, + onmousemove: v._getEv, + onmouseout: v._getEv, + onfocus: v._getEv, + onblur: v._getEv, + onkeypress: v._getEv, + onkeydown: v._getEv, + onkeyup: v._getEv, + onsubmit: v._getEv, + onreset: v._getEv, + onselect: v._getEv, + onchange: v._getEv + }); + })(Element._attributeTranslations.read.values); +} + +else if (Prototype.Browser.Gecko && /rv:1\.8\.0/.test(navigator.userAgent)) { + Element.Methods.setOpacity = function(element, value) { + element = $(element); + element.style.opacity = (value == 1) ? 0.999999 : + (value === '') ? '' : (value < 0.00001) ? 0 : value; + return element; + }; +} + +else if (Prototype.Browser.WebKit) { + Element.Methods.setOpacity = function(element, value) { + element = $(element); + element.style.opacity = (value == 1 || value === '') ? '' : + (value < 0.00001) ? 0 : value; + + if (value == 1) + if(element.tagName == 'IMG' && element.width) { + element.width++; element.width--; + } else try { + var n = document.createTextNode(' '); + element.appendChild(n); + element.removeChild(n); + } catch (e) { } + + return element; + }; + + // Safari returns margins on body which is incorrect if the child is absolutely + // positioned. For performance reasons, redefine Position.cumulativeOffset for + // KHTML/WebKit only. + Element.Methods.cumulativeOffset = function(element) { + var valueT = 0, valueL = 0; + do { + valueT += element.offsetTop || 0; + valueL += element.offsetLeft || 0; + if (element.offsetParent == document.body) + if (Element.getStyle(element, 'position') == 'absolute') break; + + element = element.offsetParent; + } while (element); + + return Element._returnOffset(valueL, valueT); + }; +} + +if (Prototype.Browser.IE || Prototype.Browser.Opera) { + // IE and Opera are missing .innerHTML support for TABLE-related and SELECT elements + Element.Methods.update = function(element, content) { + element = $(element); + + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) return element.update().insert(content); + + content = Object.toHTML(content); + var tagName = element.tagName.toUpperCase(); + + if (tagName in Element._insertionTranslations.tags) { + $A(element.childNodes).each(function(node) { element.removeChild(node) }); + Element._getContentFromAnonymousElement(tagName, content.stripScripts()) + .each(function(node) { element.appendChild(node) }); + } + else element.innerHTML = content.stripScripts(); + + content.evalScripts.bind(content).defer(); + return element; + }; +} + +if (document.createElement('div').outerHTML) { + Element.Methods.replace = function(element, content) { + element = $(element); + + if (content && content.toElement) content = content.toElement(); + if (Object.isElement(content)) { + element.parentNode.replaceChild(content, element); + return element; + } + + content = Object.toHTML(content); + var parent = element.parentNode, tagName = parent.tagName.toUpperCase(); + + if (Element._insertionTranslations.tags[tagName]) { + var nextSibling = element.next(); + var fragments = Element._getContentFromAnonymousElement(tagName, content.stripScripts()); + parent.removeChild(element); + if (nextSibling) + fragments.each(function(node) { parent.insertBefore(node, nextSibling) }); + else + fragments.each(function(node) { parent.appendChild(node) }); + } + else element.outerHTML = content.stripScripts(); + + content.evalScripts.bind(content).defer(); + return element; + }; +} + +Element._returnOffset = function(l, t) { + var result = [l, t]; + result.left = l; + result.top = t; + return result; +}; + +Element._getContentFromAnonymousElement = function(tagName, html) { + var div = new Element('div'), t = Element._insertionTranslations.tags[tagName]; + div.innerHTML = t[0] + html + t[1]; + t[2].times(function() { div = div.firstChild }); + return $A(div.childNodes); +}; + +Element._insertionTranslations = { + before: { + adjacency: 'beforeBegin', + insert: function(element, node) { + element.parentNode.insertBefore(node, element); + }, + initializeRange: function(element, range) { + range.setStartBefore(element); + } + }, + top: { + adjacency: 'afterBegin', + insert: function(element, node) { + element.insertBefore(node, element.firstChild); + }, + initializeRange: function(element, range) { + range.selectNodeContents(element); + range.collapse(true); + } + }, + bottom: { + adjacency: 'beforeEnd', + insert: function(element, node) { + element.appendChild(node); + } + }, + after: { + adjacency: 'afterEnd', + insert: function(element, node) { + element.parentNode.insertBefore(node, element.nextSibling); + }, + initializeRange: function(element, range) { + range.setStartAfter(element); + } + }, + tags: { + TABLE: ['', '
    ', 1], + TBODY: ['', '
    ', 2], + TR: ['', '
    ', 3], + TD: ['
    ', '
    ', 4], + SELECT: ['', 1] + } +}; + +(function() { + this.bottom.initializeRange = this.top.initializeRange; + Object.extend(this.tags, { + THEAD: this.tags.TBODY, + TFOOT: this.tags.TBODY, + TH: this.tags.TD + }); +}).call(Element._insertionTranslations); + +Element.Methods.Simulated = { + hasAttribute: function(element, attribute) { + attribute = Element._attributeTranslations.has[attribute] || attribute; + var node = $(element).getAttributeNode(attribute); + return node && node.specified; + } +}; + +Element.Methods.ByTag = { }; + +Object.extend(Element, Element.Methods); + +if (!Prototype.BrowserFeatures.ElementExtensions && + document.createElement('div').__proto__) { + window.HTMLElement = { }; + window.HTMLElement.prototype = document.createElement('div').__proto__; + Prototype.BrowserFeatures.ElementExtensions = true; +} + +Element.extend = (function() { + if (Prototype.BrowserFeatures.SpecificElementExtensions) + return Prototype.K; + + var Methods = { }, ByTag = Element.Methods.ByTag; + + var extend = Object.extend(function(element) { + if (!element || element._extendedByPrototype || + element.nodeType != 1 || element == window) return element; + + var methods = Object.clone(Methods), + tagName = element.tagName, property, value; + + // extend methods for specific tags + if (ByTag[tagName]) Object.extend(methods, ByTag[tagName]); + + for (property in methods) { + value = methods[property]; + if (Object.isFunction(value) && !(property in element)) + element[property] = value.methodize(); + } + + element._extendedByPrototype = Prototype.emptyFunction; + return element; + + }, { + refresh: function() { + // extend methods for all tags (Safari doesn't need this) + if (!Prototype.BrowserFeatures.ElementExtensions) { + Object.extend(Methods, Element.Methods); + Object.extend(Methods, Element.Methods.Simulated); + } + } + }); + + extend.refresh(); + return extend; +})(); + +Element.hasAttribute = function(element, attribute) { + if (element.hasAttribute) return element.hasAttribute(attribute); + return Element.Methods.Simulated.hasAttribute(element, attribute); +}; + +Element.addMethods = function(methods) { + var F = Prototype.BrowserFeatures, T = Element.Methods.ByTag; + + if (!methods) { + Object.extend(Form, Form.Methods); + Object.extend(Form.Element, Form.Element.Methods); + Object.extend(Element.Methods.ByTag, { + "FORM": Object.clone(Form.Methods), + "INPUT": Object.clone(Form.Element.Methods), + "SELECT": Object.clone(Form.Element.Methods), + "TEXTAREA": Object.clone(Form.Element.Methods) + }); + } + + if (arguments.length == 2) { + var tagName = methods; + methods = arguments[1]; + } + + if (!tagName) Object.extend(Element.Methods, methods || { }); + else { + if (Object.isArray(tagName)) tagName.each(extend); + else extend(tagName); + } + + function extend(tagName) { + tagName = tagName.toUpperCase(); + if (!Element.Methods.ByTag[tagName]) + Element.Methods.ByTag[tagName] = { }; + Object.extend(Element.Methods.ByTag[tagName], methods); + } + + function copy(methods, destination, onlyIfAbsent) { + onlyIfAbsent = onlyIfAbsent || false; + for (var property in methods) { + var value = methods[property]; + if (!Object.isFunction(value)) continue; + if (!onlyIfAbsent || !(property in destination)) + destination[property] = value.methodize(); + } + } + + function findDOMClass(tagName) { + var klass; + var trans = { + "OPTGROUP": "OptGroup", "TEXTAREA": "TextArea", "P": "Paragraph", + "FIELDSET": "FieldSet", "UL": "UList", "OL": "OList", "DL": "DList", + "DIR": "Directory", "H1": "Heading", "H2": "Heading", "H3": "Heading", + "H4": "Heading", "H5": "Heading", "H6": "Heading", "Q": "Quote", + "INS": "Mod", "DEL": "Mod", "A": "Anchor", "IMG": "Image", "CAPTION": + "TableCaption", "COL": "TableCol", "COLGROUP": "TableCol", "THEAD": + "TableSection", "TFOOT": "TableSection", "TBODY": "TableSection", "TR": + "TableRow", "TH": "TableCell", "TD": "TableCell", "FRAMESET": + "FrameSet", "IFRAME": "IFrame" + }; + if (trans[tagName]) klass = 'HTML' + trans[tagName] + 'Element'; + if (window[klass]) return window[klass]; + klass = 'HTML' + tagName + 'Element'; + if (window[klass]) return window[klass]; + klass = 'HTML' + tagName.capitalize() + 'Element'; + if (window[klass]) return window[klass]; + + window[klass] = { }; + window[klass].prototype = document.createElement(tagName).__proto__; + return window[klass]; + } + + if (F.ElementExtensions) { + copy(Element.Methods, HTMLElement.prototype); + copy(Element.Methods.Simulated, HTMLElement.prototype, true); + } + + if (F.SpecificElementExtensions) { + for (var tag in Element.Methods.ByTag) { + var klass = findDOMClass(tag); + if (Object.isUndefined(klass)) continue; + copy(T[tag], klass.prototype); + } + } + + Object.extend(Element, Element.Methods); + delete Element.ByTag; + + if (Element.extend.refresh) Element.extend.refresh(); + Element.cache = { }; +}; + +document.viewport = { + getDimensions: function() { + var dimensions = { }; + $w('width height').each(function(d) { + var D = d.capitalize(); + dimensions[d] = self['inner' + D] || + (document.documentElement['client' + D] || document.body['client' + D]); + }); + return dimensions; + }, + + getWidth: function() { + return this.getDimensions().width; + }, + + getHeight: function() { + return this.getDimensions().height; + }, + + getScrollOffsets: function() { + return Element._returnOffset( + window.pageXOffset || document.documentElement.scrollLeft || document.body.scrollLeft, + window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop); + } +}; +/* Portions of the Selector class are derived from Jack Slocum’s DomQuery, + * part of YUI-Ext version 0.40, distributed under the terms of an MIT-style + * license. Please see http://www.yui-ext.com/ for more information. */ + +var Selector = Class.create({ + initialize: function(expression) { + this.expression = expression.strip(); + this.compileMatcher(); + }, + + compileMatcher: function() { + // Selectors with namespaced attributes can't use the XPath version + if (Prototype.BrowserFeatures.XPath && !(/(\[[\w-]*?:|:checked)/).test(this.expression)) + return this.compileXPathMatcher(); + + var e = this.expression, ps = Selector.patterns, h = Selector.handlers, + c = Selector.criteria, le, p, m; + + if (Selector._cache[e]) { + this.matcher = Selector._cache[e]; + return; + } + + this.matcher = ["this.matcher = function(root) {", + "var r = root, h = Selector.handlers, c = false, n;"]; + + while (e && le != e && (/\S/).test(e)) { + le = e; + for (var i in ps) { + p = ps[i]; + if (m = e.match(p)) { + this.matcher.push(Object.isFunction(c[i]) ? c[i](m) : + new Template(c[i]).evaluate(m)); + e = e.replace(m[0], ''); + break; + } + } + } + + this.matcher.push("return h.unique(n);\n}"); + eval(this.matcher.join('\n')); + Selector._cache[this.expression] = this.matcher; + }, + + compileXPathMatcher: function() { + var e = this.expression, ps = Selector.patterns, + x = Selector.xpath, le, m; + + if (Selector._cache[e]) { + this.xpath = Selector._cache[e]; return; + } + + this.matcher = ['.//*']; + while (e && le != e && (/\S/).test(e)) { + le = e; + for (var i in ps) { + if (m = e.match(ps[i])) { + this.matcher.push(Object.isFunction(x[i]) ? x[i](m) : + new Template(x[i]).evaluate(m)); + e = e.replace(m[0], ''); + break; + } + } + } + + this.xpath = this.matcher.join(''); + Selector._cache[this.expression] = this.xpath; + }, + + findElements: function(root) { + root = root || document; + if (this.xpath) return document._getElementsByXPath(this.xpath, root); + return this.matcher(root); + }, + + match: function(element) { + this.tokens = []; + + var e = this.expression, ps = Selector.patterns, as = Selector.assertions; + var le, p, m; + + while (e && le !== e && (/\S/).test(e)) { + le = e; + for (var i in ps) { + p = ps[i]; + if (m = e.match(p)) { + // use the Selector.assertions methods unless the selector + // is too complex. + if (as[i]) { + this.tokens.push([i, Object.clone(m)]); + e = e.replace(m[0], ''); + } else { + // reluctantly do a document-wide search + // and look for a match in the array + return this.findElements(document).include(element); + } + } + } + } + + var match = true, name, matches; + for (var i = 0, token; token = this.tokens[i]; i++) { + name = token[0], matches = token[1]; + if (!Selector.assertions[name](element, matches)) { + match = false; break; + } + } + + return match; + }, + + toString: function() { + return this.expression; + }, + + inspect: function() { + return "#"; + } +}); + +Object.extend(Selector, { + _cache: { }, + + xpath: { + descendant: "//*", + child: "/*", + adjacent: "/following-sibling::*[1]", + laterSibling: '/following-sibling::*', + tagName: function(m) { + if (m[1] == '*') return ''; + return "[local-name()='" + m[1].toLowerCase() + + "' or local-name()='" + m[1].toUpperCase() + "']"; + }, + className: "[contains(concat(' ', @class, ' '), ' #{1} ')]", + id: "[@id='#{1}']", + attrPresence: "[@#{1}]", + attr: function(m) { + m[3] = m[5] || m[6]; + return new Template(Selector.xpath.operators[m[2]]).evaluate(m); + }, + pseudo: function(m) { + var h = Selector.xpath.pseudos[m[1]]; + if (!h) return ''; + if (Object.isFunction(h)) return h(m); + return new Template(Selector.xpath.pseudos[m[1]]).evaluate(m); + }, + operators: { + '=': "[@#{1}='#{3}']", + '!=': "[@#{1}!='#{3}']", + '^=': "[starts-with(@#{1}, '#{3}')]", + '$=': "[substring(@#{1}, (string-length(@#{1}) - string-length('#{3}') + 1))='#{3}']", + '*=': "[contains(@#{1}, '#{3}')]", + '~=': "[contains(concat(' ', @#{1}, ' '), ' #{3} ')]", + '|=': "[contains(concat('-', @#{1}, '-'), '-#{3}-')]" + }, + pseudos: { + 'first-child': '[not(preceding-sibling::*)]', + 'last-child': '[not(following-sibling::*)]', + 'only-child': '[not(preceding-sibling::* or following-sibling::*)]', + 'empty': "[count(*) = 0 and (count(text()) = 0 or translate(text(), ' \t\r\n', '') = '')]", + 'checked': "[@checked]", + 'disabled': "[@disabled]", + 'enabled': "[not(@disabled)]", + 'not': function(m) { + var e = m[6], p = Selector.patterns, + x = Selector.xpath, le, m, v; + + var exclusion = []; + while (e && le != e && (/\S/).test(e)) { + le = e; + for (var i in p) { + if (m = e.match(p[i])) { + v = Object.isFunction(x[i]) ? x[i](m) : new Template(x[i]).evaluate(m); + exclusion.push("(" + v.substring(1, v.length - 1) + ")"); + e = e.replace(m[0], ''); + break; + } + } + } + return "[not(" + exclusion.join(" and ") + ")]"; + }, + 'nth-child': function(m) { + return Selector.xpath.pseudos.nth("(count(./preceding-sibling::*) + 1) ", m); + }, + 'nth-last-child': function(m) { + return Selector.xpath.pseudos.nth("(count(./following-sibling::*) + 1) ", m); + }, + 'nth-of-type': function(m) { + return Selector.xpath.pseudos.nth("position() ", m); + }, + 'nth-last-of-type': function(m) { + return Selector.xpath.pseudos.nth("(last() + 1 - position()) ", m); + }, + 'first-of-type': function(m) { + m[6] = "1"; return Selector.xpath.pseudos['nth-of-type'](m); + }, + 'last-of-type': function(m) { + m[6] = "1"; return Selector.xpath.pseudos['nth-last-of-type'](m); + }, + 'only-of-type': function(m) { + var p = Selector.xpath.pseudos; return p['first-of-type'](m) + p['last-of-type'](m); + }, + nth: function(fragment, m) { + var mm, formula = m[6], predicate; + if (formula == 'even') formula = '2n+0'; + if (formula == 'odd') formula = '2n+1'; + if (mm = formula.match(/^(\d+)$/)) // digit only + return '[' + fragment + "= " + mm[1] + ']'; + if (mm = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b + if (mm[1] == "-") mm[1] = -1; + var a = mm[1] ? Number(mm[1]) : 1; + var b = mm[2] ? Number(mm[2]) : 0; + predicate = "[((#{fragment} - #{b}) mod #{a} = 0) and " + + "((#{fragment} - #{b}) div #{a} >= 0)]"; + return new Template(predicate).evaluate({ + fragment: fragment, a: a, b: b }); + } + } + } + }, + + criteria: { + tagName: 'n = h.tagName(n, r, "#{1}", c); c = false;', + className: 'n = h.className(n, r, "#{1}", c); c = false;', + id: 'n = h.id(n, r, "#{1}", c); c = false;', + attrPresence: 'n = h.attrPresence(n, r, "#{1}"); c = false;', + attr: function(m) { + m[3] = (m[5] || m[6]); + return new Template('n = h.attr(n, r, "#{1}", "#{3}", "#{2}"); c = false;').evaluate(m); + }, + pseudo: function(m) { + if (m[6]) m[6] = m[6].replace(/"/g, '\\"'); + return new Template('n = h.pseudo(n, "#{1}", "#{6}", r, c); c = false;').evaluate(m); + }, + descendant: 'c = "descendant";', + child: 'c = "child";', + adjacent: 'c = "adjacent";', + laterSibling: 'c = "laterSibling";' + }, + + patterns: { + // combinators must be listed first + // (and descendant needs to be last combinator) + laterSibling: /^\s*~\s*/, + child: /^\s*>\s*/, + adjacent: /^\s*\+\s*/, + descendant: /^\s/, + + // selectors follow + tagName: /^\s*(\*|[\w\-]+)(\b|$)?/, + id: /^#([\w\-\*]+)(\b|$)/, + className: /^\.([\w\-\*]+)(\b|$)/, + pseudo: /^:((first|last|nth|nth-last|only)(-child|-of-type)|empty|checked|(en|dis)abled|not)(\((.*?)\))?(\b|$|(?=\s)|(?=:))/, + attrPresence: /^\[([\w]+)\]/, + attr: /\[((?:[\w-]*:)?[\w-]+)\s*(?:([!^$*~|]?=)\s*((['"])([^\4]*?)\4|([^'"][^\]]*?)))?\]/ + }, + + // for Selector.match and Element#match + assertions: { + tagName: function(element, matches) { + return matches[1].toUpperCase() == element.tagName.toUpperCase(); + }, + + className: function(element, matches) { + return Element.hasClassName(element, matches[1]); + }, + + id: function(element, matches) { + return element.id === matches[1]; + }, + + attrPresence: function(element, matches) { + return Element.hasAttribute(element, matches[1]); + }, + + attr: function(element, matches) { + var nodeValue = Element.readAttribute(element, matches[1]); + return Selector.operators[matches[2]](nodeValue, matches[3]); + } + }, + + handlers: { + // UTILITY FUNCTIONS + // joins two collections + concat: function(a, b) { + for (var i = 0, node; node = b[i]; i++) + a.push(node); + return a; + }, + + // marks an array of nodes for counting + mark: function(nodes) { + for (var i = 0, node; node = nodes[i]; i++) + node._counted = true; + return nodes; + }, + + unmark: function(nodes) { + for (var i = 0, node; node = nodes[i]; i++) + node._counted = undefined; + return nodes; + }, + + // mark each child node with its position (for nth calls) + // "ofType" flag indicates whether we're indexing for nth-of-type + // rather than nth-child + index: function(parentNode, reverse, ofType) { + parentNode._counted = true; + if (reverse) { + for (var nodes = parentNode.childNodes, i = nodes.length - 1, j = 1; i >= 0; i--) { + var node = nodes[i]; + if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++; + } + } else { + for (var i = 0, j = 1, nodes = parentNode.childNodes; node = nodes[i]; i++) + if (node.nodeType == 1 && (!ofType || node._counted)) node.nodeIndex = j++; + } + }, + + // filters out duplicates and extends all nodes + unique: function(nodes) { + if (nodes.length == 0) return nodes; + var results = [], n; + for (var i = 0, l = nodes.length; i < l; i++) + if (!(n = nodes[i])._counted) { + n._counted = true; + results.push(Element.extend(n)); + } + return Selector.handlers.unmark(results); + }, + + // COMBINATOR FUNCTIONS + descendant: function(nodes) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) + h.concat(results, node.getElementsByTagName('*')); + return results; + }, + + child: function(nodes) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) { + for (var j = 0, children = [], child; child = node.childNodes[j]; j++) + if (child.nodeType == 1 && child.tagName != '!') results.push(child); + } + return results; + }, + + adjacent: function(nodes) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + var next = this.nextElementSibling(node); + if (next) results.push(next); + } + return results; + }, + + laterSibling: function(nodes) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) + h.concat(results, Element.nextSiblings(node)); + return results; + }, + + nextElementSibling: function(node) { + while (node = node.nextSibling) + if (node.nodeType == 1) return node; + return null; + }, + + previousElementSibling: function(node) { + while (node = node.previousSibling) + if (node.nodeType == 1) return node; + return null; + }, + + // TOKEN FUNCTIONS + tagName: function(nodes, root, tagName, combinator) { + tagName = tagName.toUpperCase(); + var results = [], h = Selector.handlers; + if (nodes) { + if (combinator) { + // fastlane for ordinary descendant combinators + if (combinator == "descendant") { + for (var i = 0, node; node = nodes[i]; i++) + h.concat(results, node.getElementsByTagName(tagName)); + return results; + } else nodes = this[combinator](nodes); + if (tagName == "*") return nodes; + } + for (var i = 0, node; node = nodes[i]; i++) + if (node.tagName.toUpperCase() == tagName) results.push(node); + return results; + } else return root.getElementsByTagName(tagName); + }, + + id: function(nodes, root, id, combinator) { + var targetNode = $(id), h = Selector.handlers; + if (!targetNode) return []; + if (!nodes && root == document) return [targetNode]; + if (nodes) { + if (combinator) { + if (combinator == 'child') { + for (var i = 0, node; node = nodes[i]; i++) + if (targetNode.parentNode == node) return [targetNode]; + } else if (combinator == 'descendant') { + for (var i = 0, node; node = nodes[i]; i++) + if (Element.descendantOf(targetNode, node)) return [targetNode]; + } else if (combinator == 'adjacent') { + for (var i = 0, node; node = nodes[i]; i++) + if (Selector.handlers.previousElementSibling(targetNode) == node) + return [targetNode]; + } else nodes = h[combinator](nodes); + } + for (var i = 0, node; node = nodes[i]; i++) + if (node == targetNode) return [targetNode]; + return []; + } + return (targetNode && Element.descendantOf(targetNode, root)) ? [targetNode] : []; + }, + + className: function(nodes, root, className, combinator) { + if (nodes && combinator) nodes = this[combinator](nodes); + return Selector.handlers.byClassName(nodes, root, className); + }, + + byClassName: function(nodes, root, className) { + if (!nodes) nodes = Selector.handlers.descendant([root]); + var needle = ' ' + className + ' '; + for (var i = 0, results = [], node, nodeClassName; node = nodes[i]; i++) { + nodeClassName = node.className; + if (nodeClassName.length == 0) continue; + if (nodeClassName == className || (' ' + nodeClassName + ' ').include(needle)) + results.push(node); + } + return results; + }, + + attrPresence: function(nodes, root, attr) { + if (!nodes) nodes = root.getElementsByTagName("*"); + var results = []; + for (var i = 0, node; node = nodes[i]; i++) + if (Element.hasAttribute(node, attr)) results.push(node); + return results; + }, + + attr: function(nodes, root, attr, value, operator) { + if (!nodes) nodes = root.getElementsByTagName("*"); + var handler = Selector.operators[operator], results = []; + for (var i = 0, node; node = nodes[i]; i++) { + var nodeValue = Element.readAttribute(node, attr); + if (nodeValue === null) continue; + if (handler(nodeValue, value)) results.push(node); + } + return results; + }, + + pseudo: function(nodes, name, value, root, combinator) { + if (nodes && combinator) nodes = this[combinator](nodes); + if (!nodes) nodes = root.getElementsByTagName("*"); + return Selector.pseudos[name](nodes, value, root); + } + }, + + pseudos: { + 'first-child': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + if (Selector.handlers.previousElementSibling(node)) continue; + results.push(node); + } + return results; + }, + 'last-child': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + if (Selector.handlers.nextElementSibling(node)) continue; + results.push(node); + } + return results; + }, + 'only-child': function(nodes, value, root) { + var h = Selector.handlers; + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (!h.previousElementSibling(node) && !h.nextElementSibling(node)) + results.push(node); + return results; + }, + 'nth-child': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root); + }, + 'nth-last-child': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root, true); + }, + 'nth-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root, false, true); + }, + 'nth-last-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, formula, root, true, true); + }, + 'first-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, "1", root, false, true); + }, + 'last-of-type': function(nodes, formula, root) { + return Selector.pseudos.nth(nodes, "1", root, true, true); + }, + 'only-of-type': function(nodes, formula, root) { + var p = Selector.pseudos; + return p['last-of-type'](p['first-of-type'](nodes, formula, root), formula, root); + }, + + // handles the an+b logic + getIndices: function(a, b, total) { + if (a == 0) return b > 0 ? [b] : []; + return $R(1, total).inject([], function(memo, i) { + if (0 == (i - b) % a && (i - b) / a >= 0) memo.push(i); + return memo; + }); + }, + + // handles nth(-last)-child, nth(-last)-of-type, and (first|last)-of-type + nth: function(nodes, formula, root, reverse, ofType) { + if (nodes.length == 0) return []; + if (formula == 'even') formula = '2n+0'; + if (formula == 'odd') formula = '2n+1'; + var h = Selector.handlers, results = [], indexed = [], m; + h.mark(nodes); + for (var i = 0, node; node = nodes[i]; i++) { + if (!node.parentNode._counted) { + h.index(node.parentNode, reverse, ofType); + indexed.push(node.parentNode); + } + } + if (formula.match(/^\d+$/)) { // just a number + formula = Number(formula); + for (var i = 0, node; node = nodes[i]; i++) + if (node.nodeIndex == formula) results.push(node); + } else if (m = formula.match(/^(-?\d*)?n(([+-])(\d+))?/)) { // an+b + if (m[1] == "-") m[1] = -1; + var a = m[1] ? Number(m[1]) : 1; + var b = m[2] ? Number(m[2]) : 0; + var indices = Selector.pseudos.getIndices(a, b, nodes.length); + for (var i = 0, node, l = indices.length; node = nodes[i]; i++) { + for (var j = 0; j < l; j++) + if (node.nodeIndex == indices[j]) results.push(node); + } + } + h.unmark(nodes); + h.unmark(indexed); + return results; + }, + + 'empty': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) { + // IE treats comments as element nodes + if (node.tagName == '!' || (node.firstChild && !node.innerHTML.match(/^\s*$/))) continue; + results.push(node); + } + return results; + }, + + 'not': function(nodes, selector, root) { + var h = Selector.handlers, selectorType, m; + var exclusions = new Selector(selector).findElements(root); + h.mark(exclusions); + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (!node._counted) results.push(node); + h.unmark(exclusions); + return results; + }, + + 'enabled': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (!node.disabled) results.push(node); + return results; + }, + + 'disabled': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (node.disabled) results.push(node); + return results; + }, + + 'checked': function(nodes, value, root) { + for (var i = 0, results = [], node; node = nodes[i]; i++) + if (node.checked) results.push(node); + return results; + } + }, + + operators: { + '=': function(nv, v) { return nv == v; }, + '!=': function(nv, v) { return nv != v; }, + '^=': function(nv, v) { return nv.startsWith(v); }, + '$=': function(nv, v) { return nv.endsWith(v); }, + '*=': function(nv, v) { return nv.include(v); }, + '~=': function(nv, v) { return (' ' + nv + ' ').include(' ' + v + ' '); }, + '|=': function(nv, v) { return ('-' + nv.toUpperCase() + '-').include('-' + v.toUpperCase() + '-'); } + }, + + matchElements: function(elements, expression) { + var matches = new Selector(expression).findElements(), h = Selector.handlers; + h.mark(matches); + for (var i = 0, results = [], element; element = elements[i]; i++) + if (element._counted) results.push(element); + h.unmark(matches); + return results; + }, + + findElement: function(elements, expression, index) { + if (Object.isNumber(expression)) { + index = expression; expression = false; + } + return Selector.matchElements(elements, expression || '*')[index || 0]; + }, + + findChildElements: function(element, expressions) { + var exprs = expressions.join(','), expressions = []; + exprs.scan(/(([\w#:.~>+()\s-]+|\*|\[.*?\])+)\s*(,|$)/, function(m) { + expressions.push(m[1].strip()); + }); + var results = [], h = Selector.handlers; + for (var i = 0, l = expressions.length, selector; i < l; i++) { + selector = new Selector(expressions[i].strip()); + h.concat(results, selector.findElements(element)); + } + return (l > 1) ? h.unique(results) : results; + } +}); + +function $$() { + return Selector.findChildElements(document, $A(arguments)); +} +var Form = { + reset: function(form) { + $(form).reset(); + return form; + }, + + serializeElements: function(elements, options) { + if (typeof options != 'object') options = { hash: !!options }; + else if (options.hash === undefined) options.hash = true; + var key, value, submitted = false, submit = options.submit; + + var data = elements.inject({ }, function(result, element) { + if (!element.disabled && element.name) { + key = element.name; value = $(element).getValue(); + if (value != null && (element.type != 'submit' || (!submitted && + submit !== false && (!submit || key == submit) && (submitted = true)))) { + if (key in result) { + // a key is already present; construct an array of values + if (!Object.isArray(result[key])) result[key] = [result[key]]; + result[key].push(value); + } + else result[key] = value; + } + } + return result; + }); + + return options.hash ? data : Object.toQueryString(data); + } +}; + +Form.Methods = { + serialize: function(form, options) { + return Form.serializeElements(Form.getElements(form), options); + }, + + getElements: function(form) { + return $A($(form).getElementsByTagName('*')).inject([], + function(elements, child) { + if (Form.Element.Serializers[child.tagName.toLowerCase()]) + elements.push(Element.extend(child)); + return elements; + } + ); + }, + + getInputs: function(form, typeName, name) { + form = $(form); + var inputs = form.getElementsByTagName('input'); + + if (!typeName && !name) return $A(inputs).map(Element.extend); + + for (var i = 0, matchingInputs = [], length = inputs.length; i < length; i++) { + var input = inputs[i]; + if ((typeName && input.type != typeName) || (name && input.name != name)) + continue; + matchingInputs.push(Element.extend(input)); + } + + return matchingInputs; + }, + + disable: function(form) { + form = $(form); + Form.getElements(form).invoke('disable'); + return form; + }, + + enable: function(form) { + form = $(form); + Form.getElements(form).invoke('enable'); + return form; + }, + + findFirstElement: function(form) { + var elements = $(form).getElements().findAll(function(element) { + return 'hidden' != element.type && !element.disabled; + }); + var firstByIndex = elements.findAll(function(element) { + return element.hasAttribute('tabIndex') && element.tabIndex >= 0; + }).sortBy(function(element) { return element.tabIndex }).first(); + + return firstByIndex ? firstByIndex : elements.find(function(element) { + return ['input', 'select', 'textarea'].include(element.tagName.toLowerCase()); + }); + }, + + focusFirstElement: function(form) { + form = $(form); + form.findFirstElement().activate(); + return form; + }, + + request: function(form, options) { + form = $(form), options = Object.clone(options || { }); + + var params = options.parameters, action = form.readAttribute('action') || ''; + if (action.blank()) action = window.location.href; + options.parameters = form.serialize(true); + + if (params) { + if (Object.isString(params)) params = params.toQueryParams(); + Object.extend(options.parameters, params); + } + + if (form.hasAttribute('method') && !options.method) + options.method = form.method; + + return new Ajax.Request(action, options); + } +}; + +/*--------------------------------------------------------------------------*/ + +Form.Element = { + focus: function(element) { + $(element).focus(); + return element; + }, + + select: function(element) { + $(element).select(); + return element; + } +}; + +Form.Element.Methods = { + serialize: function(element) { + element = $(element); + if (!element.disabled && element.name) { + var value = element.getValue(); + if (value != undefined) { + var pair = { }; + pair[element.name] = value; + return Object.toQueryString(pair); + } + } + return ''; + }, + + getValue: function(element) { + element = $(element); + var method = element.tagName.toLowerCase(); + return Form.Element.Serializers[method](element); + }, + + setValue: function(element, value) { + element = $(element); + var method = element.tagName.toLowerCase(); + Form.Element.Serializers[method](element, value); + return element; + }, + + clear: function(element) { + $(element).value = ''; + return element; + }, + + present: function(element) { + return $(element).value != ''; + }, + + activate: function(element) { + element = $(element); + try { + element.focus(); + if (element.select && (element.tagName.toLowerCase() != 'input' || + !['button', 'reset', 'submit'].include(element.type))) + element.select(); + } catch (e) { } + return element; + }, + + disable: function(element) { + element = $(element); + element.blur(); + element.disabled = true; + return element; + }, + + enable: function(element) { + element = $(element); + element.disabled = false; + return element; + } +}; + +/*--------------------------------------------------------------------------*/ + +var Field = Form.Element; +var $F = Form.Element.Methods.getValue; + +/*--------------------------------------------------------------------------*/ + +Form.Element.Serializers = { + input: function(element, value) { + switch (element.type.toLowerCase()) { + case 'checkbox': + case 'radio': + return Form.Element.Serializers.inputSelector(element, value); + default: + return Form.Element.Serializers.textarea(element, value); + } + }, + + inputSelector: function(element, value) { + if (value === undefined) return element.checked ? element.value : null; + else element.checked = !!value; + }, + + textarea: function(element, value) { + if (value === undefined) return element.value; + else element.value = value; + }, + + select: function(element, index) { + if (index === undefined) + return this[element.type == 'select-one' ? + 'selectOne' : 'selectMany'](element); + else { + var opt, value, single = !Object.isArray(index); + for (var i = 0, length = element.length; i < length; i++) { + opt = element.options[i]; + value = this.optionValue(opt); + if (single) { + if (value == index) { + opt.selected = true; + return; + } + } + else opt.selected = index.include(value); + } + } + }, + + selectOne: function(element) { + var index = element.selectedIndex; + return index >= 0 ? this.optionValue(element.options[index]) : null; + }, + + selectMany: function(element) { + var values, length = element.length; + if (!length) return null; + + for (var i = 0, values = []; i < length; i++) { + var opt = element.options[i]; + if (opt.selected) values.push(this.optionValue(opt)); + } + return values; + }, + + optionValue: function(opt) { + // extend element because hasAttribute may not be native + return Element.extend(opt).hasAttribute('value') ? opt.value : opt.text; + } +}; + +/*--------------------------------------------------------------------------*/ + +Abstract.TimedObserver = Class.create(PeriodicalExecuter, { + initialize: function($super, element, frequency, callback) { + $super(callback, frequency); + this.element = $(element); + this.lastValue = this.getValue(); + }, + + execute: function() { + var value = this.getValue(); + if (Object.isString(this.lastValue) && Object.isString(value) ? + this.lastValue != value : String(this.lastValue) != String(value)) { + this.callback(this.element, value); + this.lastValue = value; + } + } +}); + +Form.Element.Observer = Class.create(Abstract.TimedObserver, { + getValue: function() { + return Form.Element.getValue(this.element); + } +}); + +Form.Observer = Class.create(Abstract.TimedObserver, { + getValue: function() { + return Form.serialize(this.element); + } +}); + +/*--------------------------------------------------------------------------*/ + +Abstract.EventObserver = Class.create({ + initialize: function(element, callback) { + this.element = $(element); + this.callback = callback; + + this.lastValue = this.getValue(); + if (this.element.tagName.toLowerCase() == 'form') + this.registerFormCallbacks(); + else + this.registerCallback(this.element); + }, + + onElementEvent: function() { + var value = this.getValue(); + if (this.lastValue != value) { + this.callback(this.element, value); + this.lastValue = value; + } + }, + + registerFormCallbacks: function() { + Form.getElements(this.element).each(this.registerCallback, this); + }, + + registerCallback: function(element) { + if (element.type) { + switch (element.type.toLowerCase()) { + case 'checkbox': + case 'radio': + Event.observe(element, 'click', this.onElementEvent.bind(this)); + break; + default: + Event.observe(element, 'change', this.onElementEvent.bind(this)); + break; + } + } + } +}); + +Form.Element.EventObserver = Class.create(Abstract.EventObserver, { + getValue: function() { + return Form.Element.getValue(this.element); + } +}); + +Form.EventObserver = Class.create(Abstract.EventObserver, { + getValue: function() { + return Form.serialize(this.element); + } +}); +if (!window.Event) var Event = { }; + +Object.extend(Event, { + KEY_BACKSPACE: 8, + KEY_TAB: 9, + KEY_RETURN: 13, + KEY_ESC: 27, + KEY_LEFT: 37, + KEY_UP: 38, + KEY_RIGHT: 39, + KEY_DOWN: 40, + KEY_DELETE: 46, + KEY_HOME: 36, + KEY_END: 35, + KEY_PAGEUP: 33, + KEY_PAGEDOWN: 34, + KEY_INSERT: 45, + + cache: { }, + + relatedTarget: function(event) { + var element; + switch(event.type) { + case 'mouseover': element = event.fromElement; break; + case 'mouseout': element = event.toElement; break; + default: return null; + } + return Element.extend(element); + } +}); + +Event.Methods = (function() { + var isButton; + + if (Prototype.Browser.IE) { + var buttonMap = { 0: 1, 1: 4, 2: 2 }; + isButton = function(event, code) { + return event.button == buttonMap[code]; + }; + + } else if (Prototype.Browser.WebKit) { + isButton = function(event, code) { + switch (code) { + case 0: return event.which == 1 && !event.metaKey; + case 1: return event.which == 1 && event.metaKey; + default: return false; + } + }; + + } else { + isButton = function(event, code) { + return event.which ? (event.which === code + 1) : (event.button === code); + }; + } + + return { + isLeftClick: function(event) { return isButton(event, 0) }, + isMiddleClick: function(event) { return isButton(event, 1) }, + isRightClick: function(event) { return isButton(event, 2) }, + + element: function(event) { + var node = Event.extend(event).target; + return Element.extend(node.nodeType == Node.TEXT_NODE ? node.parentNode : node); + }, + + findElement: function(event, expression) { + var element = Event.element(event); + return element.match(expression) ? element : element.up(expression); + }, + + pointer: function(event) { + return { + x: event.pageX || (event.clientX + + (document.documentElement.scrollLeft || document.body.scrollLeft)), + y: event.pageY || (event.clientY + + (document.documentElement.scrollTop || document.body.scrollTop)) + }; + }, + + pointerX: function(event) { return Event.pointer(event).x }, + pointerY: function(event) { return Event.pointer(event).y }, + + stop: function(event) { + Event.extend(event); + event.preventDefault(); + event.stopPropagation(); + event.stopped = true; + } + }; +})(); + +Event.extend = (function() { + var methods = Object.keys(Event.Methods).inject({ }, function(m, name) { + m[name] = Event.Methods[name].methodize(); + return m; + }); + + if (Prototype.Browser.IE) { + Object.extend(methods, { + stopPropagation: function() { this.cancelBubble = true }, + preventDefault: function() { this.returnValue = false }, + inspect: function() { return "[object Event]" } + }); + + return function(event) { + if (!event) return false; + if (event._extendedByPrototype) return event; + + event._extendedByPrototype = Prototype.emptyFunction; + var pointer = Event.pointer(event); + Object.extend(event, { + target: event.srcElement, + relatedTarget: Event.relatedTarget(event), + pageX: pointer.x, + pageY: pointer.y + }); + return Object.extend(event, methods); + }; + + } else { + Event.prototype = Event.prototype || document.createEvent("HTMLEvents").__proto__; + Object.extend(Event.prototype, methods); + return Prototype.K; + } +})(); + +Object.extend(Event, (function() { + var cache = Event.cache; + + function getEventID(element) { + if (element._eventID) return element._eventID; + arguments.callee.id = arguments.callee.id || 1; + return element._eventID = ++arguments.callee.id; + } + + function getDOMEventName(eventName) { + if (eventName && eventName.include(':')) return "dataavailable"; + return eventName; + } + + function getCacheForID(id) { + return cache[id] = cache[id] || { }; + } + + function getWrappersForEventName(id, eventName) { + var c = getCacheForID(id); + return c[eventName] = c[eventName] || []; + } + + function createWrapper(element, eventName, handler) { + var id = getEventID(element); + var c = getWrappersForEventName(id, eventName); + if (c.pluck("handler").include(handler)) return false; + + var wrapper = function(event) { + if (!Event || !Event.extend || + (event.eventName && event.eventName != eventName)) + return false; + + Event.extend(event); + handler.call(element, event) + }; + + wrapper.handler = handler; + c.push(wrapper); + return wrapper; + } + + function findWrapper(id, eventName, handler) { + var c = getWrappersForEventName(id, eventName); + return c.find(function(wrapper) { return wrapper.handler == handler }); + } + + function destroyWrapper(id, eventName, handler) { + var c = getCacheForID(id); + if (!c[eventName]) return false; + c[eventName] = c[eventName].without(findWrapper(id, eventName, handler)); + } + + function destroyCache() { + for (var id in cache) + for (var eventName in cache[id]) + cache[id][eventName] = null; + } + + if (window.attachEvent) { + window.attachEvent("onunload", destroyCache); + } + + return { + observe: function(element, eventName, handler) { + element = $(element); + var name = getDOMEventName(eventName); + + var wrapper = createWrapper(element, eventName, handler); + if (!wrapper) return element; + + if (element.addEventListener) { + element.addEventListener(name, wrapper, false); + } else { + element.attachEvent("on" + name, wrapper); + } + + return element; + }, + + stopObserving: function(element, eventName, handler) { + element = $(element); + var id = getEventID(element), name = getDOMEventName(eventName); + + if (!handler && eventName) { + getWrappersForEventName(id, eventName).each(function(wrapper) { + element.stopObserving(eventName, wrapper.handler); + }); + return element; + + } else if (!eventName) { + Object.keys(getCacheForID(id)).each(function(eventName) { + element.stopObserving(eventName); + }); + return element; + } + + var wrapper = findWrapper(id, eventName, handler); + if (!wrapper) return element; + + if (element.removeEventListener) { + element.removeEventListener(name, wrapper, false); + } else { + element.detachEvent("on" + name, wrapper); + } + + destroyWrapper(id, eventName, handler); + + return element; + }, + + fire: function(element, eventName, memo) { + element = $(element); + if (element == document && document.createEvent && !element.dispatchEvent) + element = document.documentElement; + + if (document.createEvent) { + var event = document.createEvent("HTMLEvents"); + event.initEvent("dataavailable", true, true); + } else { + var event = document.createEventObject(); + event.eventType = "ondataavailable"; + } + + event.eventName = eventName; + event.memo = memo || { }; + + if (document.createEvent) { + element.dispatchEvent(event); + } else { + element.fireEvent(event.eventType, event); + } + + return event; + } + }; +})()); + +Object.extend(Event, Event.Methods); + +Element.addMethods({ + fire: Event.fire, + observe: Event.observe, + stopObserving: Event.stopObserving +}); + +Object.extend(document, { + fire: Element.Methods.fire.methodize(), + observe: Element.Methods.observe.methodize(), + stopObserving: Element.Methods.stopObserving.methodize() +}); + +(function() { + /* Support for the DOMContentLoaded event is based on work by Dan Webb, + Matthias Miller, Dean Edwards and John Resig. */ + + var timer, fired = false; + + function fireContentLoadedEvent() { + if (fired) return; + if (timer) window.clearInterval(timer); + document.fire("dom:loaded"); + fired = true; + } + + if (document.addEventListener) { + if (Prototype.Browser.WebKit) { + timer = window.setInterval(function() { + if (/loaded|complete/.test(document.readyState)) + fireContentLoadedEvent(); + }, 0); + + Event.observe(window, "load", fireContentLoadedEvent); + + } else { + document.addEventListener("DOMContentLoaded", + fireContentLoadedEvent, false); + } + + } else { + document.write(" + {title:} | kramdown + + +
    +
    +

    kramdown

    +

    fast, pure-Ruby Markdown-superset converter

    +
    + + +
    + +
    + <% if context.content_node.blocks.has_key?('intro') %> + + <% end %> + + + +
    + +
    +
    +
    + +
    +
    Copyright © 2009-2013 Thomas Leitner
    +
    Generated by webgen
    +
    + + + + + + + + + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/documentation.page b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/documentation.page new file mode 100644 index 000000000..ebafaaf8b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/documentation.page @@ -0,0 +1,84 @@ +--- +title: Documentation +in_menu: true +sort_info: 7 +--- +# kramdown Documentation + +## Overview + +kramdown is first and foremost a library for converting text written in a superset of Markdown to +HTML. However, due to its modular architecture it is able to support additional input and output +formats. The following input and output formats are currently supported: + +* Input: [kramdown](parser/kramdown.html) (a superset of Markdown), + [Markdown](parser/markdown.html), [Github Flavored Markdown](parser/gfm.html), [HTML](parser/html.html) + +* Output: [HTML](converter/html.html), [LaTeX](converter/latex.html), + [kramdown](converter/kramdown.html), [RemoveHtmlTags](converter/remove_html_tags.html) (a special + converter which removes HTML tags, normally used in conjunction with the LaTeX or kramdown + converters) + +The [kramdown syntax page](syntax.html) describes in detail what is supported and how it differs +from standard Markdown. + +For all available options have a look at the [options documentation](options.html) or have a look at +a parser/converter page to see which options they support! + + +## Usage + +{:ruby: .language-ruby} + +The kramdown package provides two ways for using it: + +* **As a library** + + kramdown uses basically the same API as [RedCloth], [BlueCloth] and [Maruku]: + + require 'kramdown' + + puts Kramdown::Document.new(text).to_html + {:ruby} + + The second parameter to the `new` call is an options hash for (de)activating certain features. For + example, to disable automatic header ID generation, you can do the following: + + puts Kramdown::Document.new(text, :auto_ids => false).to_html + {:ruby} + + The default parser used is `kramdown`, however, you can select a different one with the `:input` + option: + + puts Kramdown::Document.new(text, :input => 'html').to_latex + {:ruby} + + You can also reuse the created document object to produce multiple outputs: + + doc = Kramdown::Document.new(text, :input => 'html') + puts doc.to_html + puts doc.to_latex + {:ruby} + + More information on how to use or extend kramdown can be found in the [API + documentation](rdoc/index.html)! + +* **As an application** + + Together with the library files a binary called `kramdown` is shipped which can be used to convert + text in any supported input format to any supported output format. It either reads from the files + specified as the command line arguments or from the standard input. For example: + + kramdown path/to/kramdown/doc/syntax.page + + The input and output formats as well as all available kramdown options are supported through + command line switches. + + +## Tests + +kramdown uses various test suites to verify the correct working of the parsers and converters. For +more information, have a look at the [tests document](tests.html). + + +{include_file: doc/links.markdown} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/documentation.template b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/documentation.template new file mode 100644 index 000000000..ea573b241 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/documentation.template @@ -0,0 +1,20 @@ +--- name:sidebar pipeline:erb,tags,kramdown +

    Documentation

    + +* Parsers + * [kramdown](parser/kramdown.html) + * [Markdown](parser/markdown.html) + * [HTML](parser/html.html) +* Converters + * [HTML](converter/html.html) + * [LaTeX](converter/latex.html) + * [kramdown](converter/kramdown.html) + * [RemoveHtmlTags](converter/remove_html_tags.html) +* [Configuration Options](options.html) +* [Tests](tests.html) + +<% if context.node.children.first && context.node.children.first.children.length > 1 %> +

    Contents

    +<% end %> + +{menu: {options: {descendants: true, levels: [3,6]}}} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/index.page b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/index.page new file mode 100644 index 000000000..400835390 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/index.page @@ -0,0 +1,93 @@ +--- +title: Home +in_menu: true +sort_info: 1 +--- +## Overview + +If you want to get started with kramdown, have a look at the [installation page](installation.html) +to see how you can install it on your system. Then look through the +[documentation](documentation.html) for finding information about how to actually use kramdown and +its parsers/converters. The [quick reference](quickref.html) provides a overview of the syntax -- if +you need a more detailed description of the superset of Markdown which kramdown supports the [syntax +page](syntax.html) is the place to go! + +{tikz:: +path: overview.png +img_attr: {style: 'background:transparent'} +content_processor.tikz.libraries: [mindmap, trees, arrows] +content_processor.tikz.transparent: true +content_processor.tikz.resolution: 300 100 +content_processor.tikz.opts: | + mindmap, concept color=black, text=white, + root concept/.append style={font=\Large}, + level 1 concept/.append style={font=\Large, minimum size=2.6cm}, + level 2 concept/.append style={font=\Large}, +} +\node[concept, font=\Large] (lib) {kramdown's internal representation} + child[concept color=orange, grow=140, ->] {node[concept] (i-kramdown) {kramdown}} + child[concept color=orange, grow=180] {node[concept] (i-html) {HTML}} + child[concept color=orange, grow=220] {node[concept] (i-markdown) {Markdown}} + child[concept color=green!50!black, grow=40] {node[concept] (o-html) {HTML}} + child[concept color=green!50!black, grow=0] {node[concept] (o-kramdown) {kramdown}} + child[concept color=green!50!black, grow=-40] { + node[concept] (o-latex) {\LaTeX} + child[grow=0] { + node[concept] (o-latex-pdf) {PDF} + } + } + child[concept color=green!50!black, grow=-40] {node[concept] {\LaTeX}} +; +\draw [dash pattern=on 0pt off 2pt,line width=5pt,arrows=-angle 60,shorten >=15pt,shorten <=10pt,color=orange] + (i-kramdown) edge(lib) + (i-markdown) edge(lib) + (i-html) edge (lib); +\draw [dash pattern=on 0pt off 2pt,line width=5pt,arrows=-angle 60,shorten >=10pt,shorten <=15pt,color=green!50!black] + (lib) edge(o-html) + (lib) edge (o-kramdown) + (lib) edge (o-latex); +{tikz} +{: style="text-align: center"} + + +## Bugs, Forums, Mailing Lists + +If you have found a bug, you should [report it here][bug_report]. Also, there are [forums][forum] +and [mailing lists][ml] available if you have any questions! + +[bug_report]: http://rubyforge.org/tracker/?atid=28673&group_id=7403&func=browse +[forum]: http://rubyforge.org/forum/?group_id=7403 +[ml]: http://rubyforge.org/mail/?group_id=7403 + + +## Thanks + +kramdown would not be possible without the prior work of many other people. I want to thank everyone +involved with making Markdown such a nice markup language and especially the developers of other +Markdown implementations because kramdown borrowed many ideas from existing packages. + + +## Author + +* Thomas Leitner +* e-Mail: + + +[PHP Markdown Extra]: http://michelf.com/projects/php-markdown/extra/ +[Maruku]: http://maruku.rubyforge.org +[BlueCloth]: http://www.deveiate.org/projects/BlueCloth + + +--- name:intro + +**kramdown** (sic, not Kramdown or KramDown, just kramdown) is a *free* MIT-licensed +[Ruby](http://www.ruby-lang.org) library for parsing and converting a superset of Markdown. It is +completely written in Ruby, supports standard Markdown (with some minor modifications) and various +extensions that have been made popular by the [PHP Markdown Extra] package and [Maruku]. + +It is probably the fastest pure-Ruby Markdown converter available (March 2013), being about 4x +faster than [Maruku] and about 5x faster than [BlueFeather]. + +[PHP Markdown Extra]: http://michelf.com/projects/php-markdown/extra/ +[Maruku]: http://maruku.rubyforge.org +[BlueFeather]: http://ruby.morphball.net/bluefeather/index_en.html diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/installation.page b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/installation.page new file mode 100644 index 000000000..63c1b1241 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/installation.page @@ -0,0 +1,88 @@ +--- +title: Installation +in_menu: true +sort_info: 5 +--- +# Download & Installation + +## Dependencies + +Since kramdown is written in Ruby, you just need the [Ruby interpreter](http://www.ruby-lang.org), +version 1.8.5, 1.8.6, 1.8.7, 1.9.2, 1.9.3 or 2.0.0. There are no other dependencies. + + +## Compatibility Notes + +kramdown should work on any platform which supports Ruby. It has been successfully tested on the +following platforms: + +* Linux with Ruby 1.8.5, 1.8.6, 1.8.7, 1.9.2, 1.9.3, 2.0.0 and jruby 1.7.3. + +See the platform specific installation notes for more information! + + +## Platform Specific Installation Instructions + +### Linux + +There are a variety of Linux distributions out there with different package management systems. So +we will focus on instructions for Ubuntu 9.04 here (which should probably also work for any newer +Ubuntu version or any recent Debian based distribution). + +After running the following commands, kramdown is installed and ready to use: + + sudo aptitude install ruby rubygems + sudo gem1.8 install kramdown + +> You will also need to add `export PATH=$PATH:/var/lib/gems/1.8/bin` to your `~/.bashrc` because +> this is the binary path the executable files get installed to. + + +### Mac OS X + +Mac OS X Snow Leopard comes with Ruby and Rubygems preinstalled. So installing kramdown is as easy +as running: + + sudo gem install kramdown + + +### Windows + +You need to install Ruby first. This can easily be done by using the [RubyInstaller] - just download +the installation binary and run it. After that open a command shell (select `Start -> Run...`, then +enter `cmd` and click on `Ok`) and type in the following: + + gem install kramdown + +[RubyInstaller]: http://rubyinstaller.org + + +## Generic Installation Instructions + + +### Using Rubygems + +If you are using Rubygems, installing the latest version of kramdown is as simple as executing + + gem install kramdown + + +### Manual Installation + +The latest version of kramdown can always be downloaded as `.tar.gz` or `.zip` from [its files +section on Rubyforge](http://rubyforge.org/frs/?group_id=7403). After the download the package needs +to be decompressed and then you can install kramdown using the included `setup.rb` installation +method: + + $ ruby setup.rb config + $ ruby setup.rb setup + $ ruby setup.rb install + + +### Using the repository version + +kramdown uses git as its versioning system and kramdown's repository is hosted on GitHub. The +repository always contains a clean state of the current development version of kramdown. To check +out kramdown use the following command: + + git clone git://github.com/gettalong/kramdown.git diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/links.markdown b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/links.markdown new file mode 100644 index 000000000..6baa05acd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/links.markdown @@ -0,0 +1,6 @@ +[Maruku]: http://maruku.rubyforge.org +[PHP Markdown Extra]: http://michelf.com/projects/php-markdown/extra/ +[Pandoc]: http://johnmacfarlane.net/pandoc/ +[MathJax]: http://www.mathjax.org +[BlueCloth]: http://deveiate.org/projects/BlueCloth +[RedCloth]: http://redcloth.org/ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/metainfo b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/metainfo new file mode 100644 index 000000000..efce601d1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/metainfo @@ -0,0 +1,3 @@ +--- alcn +[converter/*.html, parser/*.html, documentation.en.html, options.en.html, tests.en.html]: + template: ../documentation.template diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/news.feed b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/news.feed new file mode 100644 index 000000000..1308a133a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/news.feed @@ -0,0 +1,9 @@ +--- +title: kramdown News +description: kramdown - a fast, pure Ruby Markdown-superset converter +author: Thomas Leitner +author_url: http://kramdown.rubyforge.org +entries: {alcn: news/*.html, sort: sort_info, reverse: true, limit: 10} +versions: + atom: + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/news.page b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/news.page new file mode 100644 index 000000000..b0f7f4230 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/news.page @@ -0,0 +1,29 @@ +--- +title: News +in_menu: false +sort_info: 30 +--- pipeline:tags,blocks,fragments + +

    News

    + +Atom-Feed + + + +--- name:newsdata pipeline:erb +<% +opts = {:alcn => '/news/*.html', :sort => 'sort_info', :reverse => true, :flatten => true} +context.website.ext.item_tracker.add(context.dest_node, :nodes, :node_finder_option_set, + {:opts => opts, :ref_alcn => context.node.alcn}, :content) +context.website.ext.node_finder.find(opts, context.node).each do |node| + # context.options['contentprocessor.kramdown.options'] = {:auto_id_prefix => node.lcn.tr('.', '-')} +%> + +
    +
    + Published on <%= node['created_at'].strftime("%A, %d %B %Y") %> +
    +<%= context.render_block(:name => 'content', :chain => [node]) %> +
    + +<% end %> diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/options.page b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/options.page new file mode 100644 index 000000000..60cb27197 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/options.page @@ -0,0 +1,10 @@ +--- +title: Options +--- +## Available Options + +The behaviour of kramdown can be adjusted via the available options. Below is a list of all +currently available options. Have a look at the documentation of a converter or parser to see +directly which options they support! + +{options: {items: all}} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/quickref.page b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/quickref.page new file mode 100644 index 000000000..382af6d47 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/quickref.page @@ -0,0 +1,599 @@ +--- +title: Quick Reference +in_menu: true +sort_info: 9 +--- name:sidebar +

    Contents

    + +{menu: {options: {descendants: true, levels: [2,6]}}} +--- name:content +# Quick Reference + +Below are examples of all available structural elements that can be used in a kramdown text. Since +the kramdown syntax is a superset of the Markdown syntax, only a small part of the available syntax +is not available in standard Markdown syntax. Note, that only the most basic syntax information is +given. However, a link to the detailed syntax for each element is provided (which also details the +differences to the standard Markdown syntax). The quick reference is for version **<%= +::Kramdown::VERSION %>** of the syntax documentation. + +kramdown has two main classes of elements: block and span-level elements. Block-level elements are +used to create paragraphs, headers, lists and so on whereas span-level elements are used to markup +text phrases as emphasized, as a link and so on. + +All examples below feature the kramdown source, the converted HTML source (shown when hovering over +the kramdown source) and the output as it appears in the browser. This looks like this: + + + + + + +
    kramdown example code
    Example code converted to HTML
    +
    +Live browser view of example code +
    +
    + + +# Block-level Elements - Main Structural Elements + +## Paragraphs + +{kdlink: {oid: paragraphs, part: "paragraphs"}} + +Consecutive lines of text are considered to be one paragraph. As with other block level elements you +have to add a blank line to separate it from the following block-level element: + +{kdexample::} +The first paragraph. + +Another paragraph +{kdexample} + +Explicit line breaks in a paragraph can be made by using two spaces or two backslashes at the end of a line: + +{kdexample::} +This is a paragraph +which contains a hard line break. +{kdexample} + + +## Headers + +{kdlink: {oid: headers, part: "headers"}} + +kramdown supports Setext style headers and atx style headers. A header must always be preceded by a +blank line except at the beginning of the document: + + +{kdexample::} +First level header +================== + +Second level header +------------------- +{kdexample} + +{kdexample::} +# H1 header + +## H2 header + +### H3 header + +#### H4 header + +##### H5 header + +###### H6 header +{kdexample} + +If you set the option `auto_ids` to `false` (for example, by using the `options` extension, see +[Extensions](#extensions)), then the automatic header ID generation is turned off: + +{kdexample::} +{::options auto_ids="false" /} + +# A header without an ID +{kdexample} + + +## Blockquotes + +{kdlink: {oid: blockquotes, part: "blockquotes"}} + +A blockquote is started using the `>` marker followed by an optional space; all following lines that +are also started with the blockquote marker belong to the blockquote. You can use any block-level +elements inside a blockquote: + +{kdexample::} +> A sample blockquote. +> +> >Nested blockquotes are +> >also possible. +> +> ## Headers work too +> This is the outer quote again. +{kdexample} + +You may also be lazy with the `>` markers as long as there is no blank line: + +{kdexample::} +> This is a blockquote +continued on this +and this line. + +But this is a separate paragraph. +{kdexample} + +## Code Blocks + +{kdlink: {oid: code-blocks, part: "code blocks"}} + +kramdown supports two different code block styles. One uses lines indented with either four spaces +or one tab whereas the other uses lines with tilde characters as delimiters -- therefore the content +does not need to be indented: + +{kdexample::} + This is a sample code block. + + Continued here. +{kdexample} + +{kdexample::} +~~~~~~ +This is also a code block. +~~~ +Ending lines must have at least as +many tildes as the starting line. +~~~~~~~~~~~~ +{kdexample} + +The following is a code block with a language specified: + +{kdexample::} +~~~ ruby +def what? + 42 +end +~~~ +{kdexample} + + +## Horizontal Rules + +{kdlink: {oid: horizontal-rules, part: "horizontal rules"}} + +It is easy to insert a horizontal rule in kramdown: just use three or more asterisks, dashes or +underscores, optionally separated by spaces or tabs, on an otherwise blank line: + +{kdexample::} +* * * + +\--- + + _ _ _ _ + +--------------- +{kdexample} + + +## Lists + +{kdlink: {oid: lists, part: "lists"}} + +kramdown supports ordered and unordered lists. Ordered lists are started by using a number followed +by a period, a space and then the list item text. The content of a list item consists of block-level +elements. All lines which have the same indent as the text of the line with the list marker belong +to the list item: + +{kdexample::} +1. This is a list item +2. And another item +2. And the third one + with additional text +{kdexample} + +As with block quotes, you may be lazy when using the list item marker: + +{kdexample::} +* A list item +with additional text +{kdexample} + +As the content consists of block-level elements you can do things like the following: + +{kdexample::} +1. This is a list item + + > with a blockquote + + # And a header + +2. Followed by another item +{kdexample} + +Nested lists are also easy to create: + +{kdexample::} +1. Item one + 1. sub item one + 2. sub item two + 3. sub item three +2. Item two +{kdexample} + +Lists can occur directly after other block-level elements, however, there has to be at least one +blank line if you want to follow a paragraph with a list: + +{kdexample::} +This is a paragraph. +1. This is NOT a list. + +1. This is a list! +{kdexample} + +Unordered lists are started by using an asterisk, a dash or a plus sign (they can be mixed) and a +space. Apart from that unordered lists follow the same rules as ordered lists: + +{kdexample::} +* Item one ++ Item two +- Item three +{kdexample} + +## Definition Lists + +{kdlink: {oid: definition-lists, part: "definition lists"}} + +A definition list works similar to a normal list and is used to associate definitions with terms. +Definition lists are started when a normal paragraph is followed by a line starting with a colon and +then the definition text. One term can have many definitions and multiple terms can have the same +definition. Each line of the preceding paragraph is assumed to contain one term, for example: + +{kdexample::} +term +: definition +: another definition + +another term +and another term +: and a definition for the term +{kdexample} + +If you insert a blank line before a definition (note: there must only be one blank line between the +terms and the first definition), the definition will be wrapped in a paragraph: + +{kdexample::} +term + +: definition +: definition +{kdexample} + +Each term can be styled using span-level elements and each definition is parsed as block-level +elements, i.e. you can use any block-level in a definition. Just use the same indent for the lines +following the definition line: + +{kdexample::} +This *is* a term + +: This will be a para + + > a blockquote + + # A header +{kdexample} + + +## Tables + +{kdlink: {oid: tables, part: "tables"}} + +kramdown supports a syntax for creating simple tables. A line starting with a pipe character (`|`) +starts a table row. However, if the pipe characters is immediately followed by a dash (`-`), a +separator line is created. Separator lines are used to split the table header from the table body +(and optionally align the table columns) and to split the table body into multiple parts. If the +pipe character is followed by an equal sign (`=`), the tables rows below it are part of the table +footer. + +{kdexample::} +| A simple | table | +| with multiple | lines| +{kdexample} + +{kdexample::} +| Header1 | Header2 | Header3 | +|:--------|:-------:|--------:| +| cell1 | cell2 | cell3 | +| cell4 | cell5 | cell6 | +|---- +| cell1 | cell2 | cell3 | +| cell4 | cell5 | cell6 | +|===== +| Foot1 | Foot2 | Foot3 +{: rules="groups"} +{kdexample} + + +## HTML elements + +{kdlink: {oid: html-blocks, part: "HTML blocks"}} + +kramdown allows you to use block-level HTML tags (`div`, `p`, `pre`, ...) to markup whole blocks of +text -- just start a line with a block-level HTML tag. kramdown syntax is normally not processed +inside an HTML tag but this can be changed with the `parse_block_html` option. If this options is +set to `true`, then the content of a block-level HTML tag is parsed by kramdown either as block +level or span-level text, depending on the tag: + +{kdexample::} +
    +Something that stays right and is not wrapped in a para. +
    + +{::options parse_block_html="true" /} + +
    +This is wrapped in a para. +
    +

    +This can contain only *span* level elements. +

    +{kdexample} + + +## Block Attributes + +{kdlink: {oid: block-ials, part: "block IALs"}} +{kdlink: {oid: attribute-list-definitions, part: "ALDs"}} + +You can assign any attribute to a block-level element. Just directly follow the block with a *block +inline attribute list* (or short: block IAL). A block IAL consists of a left curly brace, followed +by a colon, the attribute definitions and a right curly brace. Here is a simple example which sets the +`title` attribute of a block quote: + +{kdexample::} +> A nice blockquote +{: title="Blockquote title"} +{kdexample} + +As one often wants to set one or more CSS classes on an element, there is an easy shortcut: + +{kdexample::} +> A nice blockquote +{: .class1 .class2} +{kdexample} + +A shortcut for setting the ID is also provided. Just prefix the ID with a hash symbol: + +{kdexample::} +> A nice blockquote +{: #with-an-id} +{kdexample} + +Sometimes one wants to use the same attributes for many elements. kramdown allows you to define the +attributes in one place with an *attribute list definition* (or short: ALD) and just reference this +definition in a block IAL. An ALD has the same structure as a block IAL but the colon has to be +replace with a colon, the reference name and another colon. By just using the reference name as-is +in a block IAL, one can include the attributes of the referenced ALD: + +{kdexample::} +{:refdef: .c1 #id .c2 title="title"} +paragraph +{: refdef} +{kdexample} + +The order in a block IAL or ALD is important because later defined attributes overwrite (with the +exception of the shortcut for CSS classes) prior defined attributes: + +{kdexample::} +{:refdef: .c1 #id .c2 title="title"} +paragraph +{: refdef .c3 title="t" #para} +{kdexample} + + +## Extensions + +{kdlink: {oid: extensions, part: "extensions"}} + +kramdown provides some less used functionality through a common syntax. This will allow the easy +addition of other extensions if need arises. Currently, there are extensions for ignoring text (i.e. +treating text as comment), for inserting arbitrary text as-is into the output and for setting +kramdown options. + +Here is an example that shows how to insert comments into text: + +{kdexample::} +This is a paragraph +{::comment} +This is a comment which is +completely ignored. +{:/comment} +... paragraph continues here. + +Extensions can also be used +inline {::nomarkdown}**see**{:/}! +{kdexample} + +As one can see from the above example, the syntax for extensions is nearly identical to that of +ALDs. However, there is no trailing colon after the extension name and the extension end tag needs a +slash between the colon and the extension name. One can also use the short form of the end tag, i.e. +`{:/}`. Attribute definitions can be specified on the start tag by separating them with a space from +the extension name. Also, if the extension does not have a body, there needs to be a slash right +before the closing brace: + +{kdexample::} +{::options auto_ids="false" /} + +# Header without id +{kdexample} + + + + +# Span-Level Elements - Text Modifiers + +## Emphasis + +{kdlink: {oid: emphasis, part: "emphasis"}} + +Emphasis can be added to text by surrounding the text with either asterisks or underscores: + +{kdexample::} +This is *emphasized*, +_this_ too! +{kdexample} + +Strong emphasis can be done by doubling the delimiters: + +{kdexample::} +This is **strong**, +__this__ too! +{kdexample} + +The form with the asterisks can also be used to markup parts of words: + +{kdexample::} +This w**ork**s as expected! +{kdexample} + + +## Links and Images + +{kdlink: {oid: links-and-images, part: "links and images"}} + +A simple link can be created by surrounding the text with square brackets and the link URL with +parentheses: + +{kdexample::} +A [link](http://kramdown.rubyforge.org) +to the kramdown homepage. +{kdexample} + +You can also add title information to the link: + +{kdexample::} +A [link](http://kramdown.rubyforge.org "hp") +to the homepage. +{kdexample} + +There is another way to create links which does not interrupt the text flow. The URL and title are +defined using a reference name and this reference name is then used in square brackets instead of +the link URL: + +{kdexample::} +A [link][kramdown hp] +to the homepage. + +[kramdown hp]: http://kramdown.rubyforge.org "hp" +{kdexample} + +If the link text itself is the reference name, the second set of square brackets can be omitted: + +{kdexample::} +A link to the [kramdown hp]. + +[kramdown hp]: http://kramdown.rubyforge.org "hp" +{kdexample} + +Images can be created in a similar way: just use an exclamation mark before the square brackets. The +link text will become the alternative text of the image and the link URL specifies the image source: + +{kdexample::} +An image: ![gras](img/image.jpg) +{kdexample} + + +## Inline Code + +{kdlink: {oid: code-spans, part: "code spans"}} + +Text phrases can be easily marked up as code by surrounding them with backticks: + +{kdexample::} +Use `Kramdown::Document.new(text).to_html` +to convert the `text` in kramdown +syntax to HTML. +{kdexample} + +If you want to use literal backticks in your code, just use two or more backticks as delimiters. The +space right after the beginning delimiter and the one right before the closing delimiter are ignore: + +{kdexample::} +Use backticks to markup code, +e.g. `` `code` ``. +{kdexample} + + +## Footnotes + +{kdlink: {oid: footnotes, part: "footnotes"}} + +Footnotes can easily be used in kramdown. Just set a footnote marker (consists of square brackets +with a caret and the footnote name inside) in the text and somewhere else the footnote definition (which +basically looks like a reference link definition): + +{kdexample::} +This is a text with a +footnote[^1]. + +[^1]: And here is the definition. +{kdexample} + +The footnote definition can contain any block-level element, all lines following a footnote +definition indented with four spaces or one tab belong to the definition: + +{kdexample::} +This is a text with a +footnote[^2]. + +[^2]: + And here is the definition. + + > With a quote! +{kdexample} + +As can be seen above the footnote name is only used for the anchors and the numbering is done +automatically in document order. Repeated footnote markers will link to the same footnote +definition. + + +## Abbreviations + +{kdlink: {oid: abbreviations, part: "abbreviations"}} + +Abbreviations will work out of the box once you add an abbreviation definition. So you can just +write the text and add the definitions later on. + +{kdexample::} +This is an HTML +example. + +*[HTML]: Hyper Text Markup Language +{kdexample} + + +## HTML Elements + +{kdlink: {oid: html-spans, part: "HTML spans"}} + +HTML is not only supported on the block-level but also on the span-level: + +{kdexample::} +This is written in +red. +{kdexample} + + +## Inline Attributes + +{kdlink: {oid: span-ials, part: "span IALs"}} + +As with a block-level element you can assign any attribute to a span-level elements using a *span +inline attribute list* (or short: span IAL). A span IAL has the same syntax as a block IAL and must +immediately follow the span-level element: + +{kdexample::} +This is *red*{: style="color: red"}. +{kdexample} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/sidebar.template b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/sidebar.template new file mode 100644 index 000000000..6d7f1315b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/sidebar.template @@ -0,0 +1,27 @@ +

    News

    + +

    The latest version of kramdown is 1.2.0 and it was released +on 2013-08-31

    + +

    More news…

    + +

    Support kramdown

    + +

    If you like kramdown and would like to support it, you are welcome to make a small +donation (PayPal or Pledgie) -- it will surely be appreciated! Thanks!

    + +
    + + + + +
    + +Click here to lend your support to: kramdown and make a donation at www.pledgie.com ! + +

    Sponsors

    + +

    GROSSWEBER provides software +development consulting and training services. We like to work on open source. We use it heavily. +We love kramdown!

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/syntax.page b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/syntax.page new file mode 100644 index 000000000..aa47d4f1a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/doc/syntax.page @@ -0,0 +1,1698 @@ +--- +title: Syntax +in_menu: true +sort_info: 10 +--- name:sidebar +

    Contents

    + +{menu: {options: {descendants: true, levels: [2,6]}}} +--- name:content + +# kramdown Syntax + +This is version **<%= ::Kramdown::VERSION %>** of the syntax documentation. + +The kramdown syntax is based on the Markdown syntax and has been enhanced with features that are +found in other Markdown implementations like [Maruku], [PHP Markdown Extra] and [Pandoc]. However, +it strives to provide a strict syntax with definite rules and therefore isn't completely compatible +with Markdown. Nonetheless, most Markdown documents should work fine when parsed with kramdown. All +places where the kramdown syntax differs from the Markdown syntax are highlighted. + +Following is the complete syntax definition for all elements kramdown supports. Together with the +documentation on the available converters, it is clearly specified what you will get when a kramdown +document is converted. + + +## Source Text Formatting + +A kramdown document may be in any encoding, for example ASCII, UTF-8 or ISO-8859-1, and the output +will have the same encoding as the source. + +The document consists of two types of elements, block-level elements and span-level elements: + +* Block-level elements define the main structure of the content, for example, what part of the text + should be a paragraph, a list, a blockquote and so on. + +* Span-level elements mark up small text parts as, for example, emphasized text or a link. + +Thus span-level elements can only occur inside block-level elements or other span-level elements. + +You will often find references to the "first column" or "first character" of a line in a block-level +element descriptions. Such a reference is always to be taken relative to the current indentation +level because some block-level elements open up a new indentation level (e.g. blockquotes). The +beginning of a kramdown document opens up the default indentation level which begins at the first +column of the text. + + +### Line Wrapping + +Some lightweight markup syntax don't work well in environments where lines are hard-wrapped. For +example, this is the case with many email programs. Therefore kramdown allows content like +paragraphs or blockquotes to be hard-wrapped, i.e. broken across lines. This is sometimes referred +to as "lazy syntax" since the indentation or line prefix required for the first line of content is +not required for the consecutive lines. + +Block-level elements that support line wrapping always end when one of the following conditions is +met: + +* a [blank line](#blank-lines), an [EOB marker line](#eob-marker), a [block IAL](#block-ials) or the + end of the document (i.e. a [block boundary](#block-boundaries)), + +* or an [HTML block](#html-blocks). + +Line wrapping is allowed throughout a kramdown document but there are some block-level elements that +do *not* support being hard-wrapped: + +[headers](#headers) + +: This is not an issue in most situations since headers normally fit on one line. If a header text + gets too long for one line, you need to use HTML syntax instead. + +[fenced code blocks](#fenced-code-blocks) + +: The delimiting lines of a fenced code block do not support hard-wrapping. Since everything between + the delimiting lines is taken as is, the content of a fenced code block does also not support + hard-wrapping. + +[definition list terms](#definition-lists) + +: Each definition term has to appear on a separate line. Hard-wrapping would therefore introduce + additional definition terms. The definitions themselves, however, do support hard-wrapping. + +[tables](#tables) + +: Since each line of a kramdown table describes one table row or a separator, it is not possible to + hard-wrap tables. + +**Note** that it is **NOT** recommended to use lazy syntax to write a kramdown document. The +flexibility that the kramdown syntax offers due to the issue of line wrapping hinders readability +and should therefore not be used. + + +### Usage of Tabs + +kramdown assumes that tab stops are set at multiples of four. This is especially important when +using tabs for indentation in lists. Also, tabs may only be used at the beginning of a line when +indenting text and must not be preceded by spaces. Otherwise the results may be unexpected. + + +### Automatic and Manual Escaping + +Depending on the output format, there are often characters that need special treatment. For example, +when converting a kramdown document to HTML one needs to take care of the characters `<`, `>` and +`&`. To ease working with these special characters, they are automatically and correctly escaped +depending on the output format. + +This means, for example, that you can just use `<`, `>` and `&` in a kramdown document and need not +think about when to use their HTML entity counterparts. However, if you *do use* HTML entities or +HTML tags which use one of the characters, the result will be correct nonetheless! + +Since kramdown also uses some characters to mark-up the text, there needs to be a way to escape +these special characters so that they can have their normal meaning. This can be done by using +backslash escapes. For example, you can use a literal back tick like this: + + This \`is not a code\` span! + +Following is a list of all the characters (character sequences) that can be escaped: + + \ backslash + . period + * asterisk + _ underscore + + plus + - minus + = equal sign + ` back tick + ()[]{}<> left and right parens/brackets/braces/angle brackets + # hash + ! bang + << left guillemet + >> right guillemet + : colon + | pipe + " double quote + ' single quote + $ dollar sign + + +## Block Boundaries + +Some block-level elements have to start and/or end on so called block boundaries, as stated in their +documentation. There are two cases where block boundaries come into play: + +* If a block-level element has to start on a block boundary, it has to be preceded by either a + [blank line](#blank-lines), an [EOB marker](#eob-marker), a [block IAL](#block-ials) or it has to + be the first element. + +* If a block-level element has to end on a block boundary, it has to be followed by either a [blank + line](#blank-lines), an [EOB marker](#eob-marker), a [block IAL](#block-ials) or it has to be the + last element. + + + +# Structural Elements + +All structural elements are block-level elements and they are used to structure the content. They +can mark up some text as, for example, a simple paragraph, a quote or as a list item. + + +## Blank lines + +Any line that just contains white space characters such as spaces and tabs is considered a blank +line by kramdown. One or more consecutive blank lines are handled as one empty blank line. Blank +lines are used to separate block-level elements from each other and in this case they don't have +semantic meaning. However, there are some cases where blank lines do have a semantic meaning: + +* When used in headers -- see the [headers section](#headers) +* When used in code blocks -- see the [code blocks section](#code-blocks) +* When used in lists -- see the [lists section](#lists) +* When used in math blocks -- see the [math blocks section](#math-blocks) +* When used for elements that have to start/end on [block boundaries](#block-boundaries) + + +## Paragraphs + +Paragraphs are the most used block-level elements. One or more consecutive lines of text are +interpreted as one paragraph. The first line of a paragraph may be indented up to three spaces, the +other lines can have any amount of indentation because paragraphs support [line +wrapping](#line-wrapping). In addition to the rules outlined in the section about line wrapping, a +paragraph ends when a [definition list line](#definition-lists) is encountered. + +You can separate two consecutive paragraphs from each other by using one or more blank lines. Notice +that a line break in the source does not mean a line break in the output (due to the [lazy +syntax](#line-wrapping))!. If you want to have an explicit line break (i.e. a `
    ` tag) you need +to end a line with two or more spaces or two backslashes! Note, however, that a line break on the +last text line of a paragraph is not possible and will be ignored. Leading and trailing spaces will +be stripped from the paragraph text. + +The following gives you an example of how paragraphs look like: + + This para line starts at the first column. However, + the following lines can be indented any number of spaces/tabs. + The para continues here. + + This is another paragraph, not connected to the above one. But + with a hard line break. \\ + And another one. +{: .show-whitespaces .ws-lr} + + +## Headers + +kramdown supports so called Setext style and atx style headers. Both forms can be used inside a +single document. + +### Setext Style + +Setext style headers have to start on a [block boundary](#block-boundaries) with a line of text (the +header text) and a line with only equal signs (for a first level header) or dashes (for a second +level header). The header text may be indented up to three spaces but any leading or trailing spaces +are stripped from the header text. The amount of equal signs or dashes is not significant, just one +is enough but more may look better. The equal signs or dashes have to begin at the first column. For +example: + + First level header + ================== + + Second level header + ------ + + Other first level header + = + +Since Setext headers start on block boundaries, this means in most situations that they have to be +preceded by a blank line. However, blank lines are not necessary after a Setext header: + + This is a normal + paragraph. + + And A Header + ------------ + And a paragraph + + > This is a blockquote. + + And A Header + ------------ + +However, it is generally a good idea to also use a blank line after a Setext header because it looks +more appropriate and eases reading of the document. + +> The original Markdown syntax allows one to omit the blank line before a Setext header. However, +> this leads to ambiguities and makes reading the document harder than necessary. Therefore it is +> not allowed in a kramdown document. +{: .markdown-difference} + +An edge case worth mentioning is the following: + + header + --- + para + +One might ask if this represents two paragraphs separated by a [horizontal rule](#horizontal-rules) +or a second level header and a paragraph. As suggested by the wording in the example, the latter is +the case. The general rule is that Setext headers are processed before horizontal rules. + +### atx Style + +atx style headers have to start on a [block boundary](#block-boundaries) with a line that contains +one or more hash characters and then the header text. No spaces are allowed before the hash +characters. The number of hash characters specifies the heading level: one hash character gives you +a first level heading, two a second level heading and so on until the maximum of six hash characters +for a sixth level heading. You may optionally use any number of hashes at the end of the line to +close the header. Any leading or trailing spaces are stripped from the header text. For example: + + # First level header + + ### Third level header ### + + ## Second level header ###### + +> Again, the original Markdown syntax allows one to omit the blank line before an atx style header. +{: .markdown-difference} + + +### Specifying a Header ID + +kramdown supports a nice way for explicitly setting the header ID which is taken from [PHP Markdown +Extra] and [Maruku]: If you follow the header text with an opening curly bracket (separated from the +text with a least one space), a hash, the ID and a closing curly bracket, the ID is set on the +header. If you use the trailing hash feature of atx style headers, the header ID has to go after the +trailing hashes. For example: + + Hello {#id} + ----- + + # Hello {#id} + + # Hello # {#id} + +> This additional syntax is not part of standard Markdown. +{: .markdown-difference} + + +## Blockquotes + +A blockquote is started using the `>` marker followed by an optional space and the content of the +blockquote. The marker itself may be indented up to three spaces. All following lines, whether they +are started with the blockquote marker or just contain text, belong to the blockquote because +blockquotes support [line wrapping](#line-wrapping). + +The contents of a blockquote are block-level elements. This means that if you are just using text as +content that it will be wrapped in a paragraph. For example, the following gives you one blockquote +with two paragraphs in it: + + > This is a blockquote. + > on multiple lines + that may be lazy. + > + > This is the second paragraph. + +Since the contents of a blockquote are block-level elements, you can nest blockquotes and use other +block-level elements (this is also the reason why blockquotes need to support line wrapping): + + > This is a paragraph. + > + > > A nested blockquote. + > + > ## Headers work + > + > * lists too + > + > and all other block-level elements + +Note that the first space character after the `>` marker does *not* count when counting spaces for +the indentation of the block-level elements inside the blockquote! So [code blocks](#code-blocks) +will have to be indented with five spaces or one space and one tab, like this: + + > A code block: + > + > ruby -e 'puts :works' + +[Line wrapping](#line-wrapping) allows one to be lazy but hinders readability and should therefore +be avoided, especially with blockquotes. Here is an example of using blockquotes with line wrapping: + + > This is a paragraph inside + a blockquote. + > + > > This is a nested paragraph + that continues here + > and here + > > and here + + +## Code Blocks + +Code blocks can be used to represent verbatim text like markup, HTML or a program fragment because +no syntax is parsed within a code block. + +### Standard Code Blocks + +A code block can be started by using four spaces or one tab and then the text of the code block. All +following lines containing text, whether they adhere to this syntax or not, belong to the code block +because code blocks support [line wrapping](#line-wrapping)). A wrapped code line is automatically +appended to the preceding code line by substituting the line break with a space character. The +indentation (four spaces or one tab) is stripped from each line of the code block. + +> The original Markdown syntax does not allow line wrapping in code blocks. +{: .markdown-difference} + +Note that consecutive code blocks that are only separate by [blank lines](#blank-lines) are merged +together into one code block: + + Here comes some code + + This text belongs to the same code block. + +If you want to have one code block directly after another one, you need to use an [EOB +marker](#eob-marker) to separate the two: + + Here comes some code + ^ + This one is separate. + +### Fenced Code Blocks + +> This alternative syntax is not part of the original Markdown syntax. The idea and syntax comes +> from the [PHP Markdown Extra] package. +{: .markdown-difference} + +kramdown also supports an alternative syntax for code blocks which does not use indented blocks but +delimiting lines. The starting line needs to begin with three or more tilde characters (`~`) and the +closing line needs to have at least the number of tildes the starting line has. Everything between +is taken literally as with the other syntax but there is no need for indenting the text. For +example: + + ~~~~~~~~ + Here comes some code. + ~~~~~~~~ + +If you need lines of tildes in such a code block, just start the code block with more tildes. For +example: + + ~~~~~~~~~~~~ + ~~~~~~~ + code with tildes + ~~~~~~~~ + ~~~~~~~~~~~~~~~~~~ + +This type of code block is especially useful for copy-pasted code since you don't need to indent the +code. + +### Language of Code Blocks + +You can tell kramdown the language of a code block by using an [IAL](#inline-attribute-lists): + + ~~~ + def what? + 42 + end + ~~~ + {: .language-ruby} + +The specially named class `language-ruby` tells kramdown that this code block is written in the Ruby +language. Such information can be used, for example, by converters to do syntax highlighting on the +code block. + +Fenced code blocks provide an easier way to specify the language, namely by appending the language +of the code block to the end of the starting line: + + ~~~ ruby + def what? + 42 + end + ~~~ + + +## Lists + +kramdown provides syntax elements for creating ordered and unordered lists as well as definition +lists. + +### Ordered and Unordered lists + +Both ordered and unordered lists follow the same rules. + +A list is started with a list marker (in case of unordered lists one of `+`, `-` or `*` -- you can +mix them -- and in case of ordered lists a number followed by a period) followed by one tab or at +least one space, optionally followed by an [IAL](#inline-attribute-lists) that should be applied to +the list item and then the first part of the content of the list item. The leading tabs or spaces +are stripped away from this first line of content to allow for a nice alignment with the following +content of a list item (see below). All following list items with the same marker type (unordered or +ordered) are put into the same list. The numbers used for ordered lists are irrelevant, an ordered +list always starts at 1. + +The following gives you an unordered list and an ordered list: + + * kram + + down + - now + + 1. kram + 2. down + 3. now + +> The original Markdown syntax allows the markers of ordered and unordered lists to be mixed, the +> first marker specifying the list type (ordered or unordered). This is not allowed in kramdown. As +> stated, the above example will give you two lists (an unordered and an ordered) in kramdown and +> only one unordered list in Markdown. +{: .markdown-difference} + +The first list marker in a list may be indented up to three spaces. The column number of the first +non-space character which appears after the list item marker on the same line specifies the +indentation that has to be used for the following lines of content of the list item. If there is no +such character, the indentation that needs to be used is four spaces or one tab. Indented lines may +be followed by lines containing text with any amount of indentation due to [line +wrapping](#line-wrapping). Note, however, that in addition to the rules outlined in the section +about line wrapping, a list item also ends when a line with another list item marker is encountered +-- see the next paragraph. + +The indentation is stripped from the content and the content (note that the content naturally also +contains the content of the line with the item marker) is processed as text containing block-level +elements. All other list markers in the list may be indented up to three spaces or the number of +spaces used for the indentation of the last list item minus one, whichever number is smaller. For +example: + + * This is the first line. Since the first non-space characters appears in + column 3, all other indented lines have to be indented 2 spaces. + However, one could be lazy and not indent a line but this is not + recommended. + * This is the another item of the list. It uses a different number + of spaces for indentation which is okay but should generally be avoided. + * The list item marker is indented 3 spaces which is allowed but should + also be avoided and starts the third list item. Note that the lazy + line in the second list item may make you believe that this is a + sub-list which it isn't! So avoid being lazy! + +So, while the above is possible and creates one list with three items, it is not advised to use +different (marker and list content) indents for same level list items as well as lazy indentation! +It is much better to write such a list in the following way: + + * This is the first list item bla blabla blabla blabla blabla blabla + blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla + blabla blabla blabla bla + * This is the another item of the list. bla blabla blabla blabla blabla + blabla blabla blabla blabla blabla blabla blabla blabla blabla blabla + +> The original Markdown syntax also allows you to indent the marker, however, the behaviour of what +> happens with the list items is not clearly specified and may surprise you. +> +> Also, Markdown uses a fixed number of spaces/tabs to indent the lines that belong to a list item! +{: .markdown-difference} + +When using tabs for indenting the content of a list item, remember that tab stops occur at multiples +of four for kramdown. Tabs are correctly converted to spaces for calculating the indentation. For +example: + + * Using a tab to indent this line, the tab only counts as three spaces + and therefore the overall indentation is four spaces. + + 1. The tab after the marker counts here as three spaces. Since the + indentation of the marker is three spaces and the marker itself + takes two characters, the overall indentation needed for the + following lines is eight spaces or two tabs. + +It is clear that you might get unexpected results if you mix tabs and spaces or if you don't have +the tab stops set to multiples of four in your editor! Therefore this should be avoided! + +The content of a list item is made up of either text or block-level elements. Simple list items only +contain text like in the above examples. They are not even wrapped in a paragraph tag. If the first +list text is followed by one or more blank lines, it will be wrapped in a paragraph tag: + + * kram + + * down + * now + +In the above example, the first list item text will be wrapped in a paragraph tag since it is +followed by a blank line whereas the second list item contains just text. There is obviously a +problem for doing this with the last list item when it contains only text. You can circumvent this +by leaving a blank line after the last list item and using an EOB marker: + + * Not wrapped in a paragraph + * Wrapped in a paragraph due to the following blank line. + + * Also wrapped in a paragraph due to the + following blank line and the EOB marker. + + ^ + +The text of the last list item is also wrapped in a paragraph tag if *all* other list items contain +a proper paragraph as first element. This makes the following use case work like expected, i.e. +*all* the list items are wrapped in paragraphs: + + * First list item + + * Second list item + + * Last list item + +> The original Markdown syntax page specifies that list items which are separated by one or more +> blank lines are wrapped in paragraph tags. This means that the first text will also be wrapped in +> a paragraph if you have block-level elements in a list which are separated by blank lines. The +> above rule is easy to remember and lets you exactly specify when the first list text should be +> wrapped in a paragraph. The idea for the above rule comes from the [Pandoc] package. +{: .markdown-difference} + +As seen in the examples above, blank lines between list items are allowed. + +Since the content of a list item can contain block-level elements, you can do the following: + + * First item + + A second paragraph + + * nested list + + > blockquote + + * Second item + +However, there is a problem when you want to have a code block immediately after a list item. You +can use an EOB marker to circumvent this problem: + + * This is a list item. + + The second para of the list item. + ^ + A code block following the list item. + +You can have any block-level element as first element in a list item. However, as described above, +the leading tabs or spaces of the line with the list item marker are stripped away. This leads to a +problem when you want to have a code block as first element. The solution to this problem is the +following construct: + + * + This is a code block (indentation needs to be 4(1)+4(1) + spaces (tabs)). +{: .show-whitespaces .ws-lr} + +Note that the list marker needs to be followed with at least one space or tab! Otherwise the line is +not recognized as the start of a list item but interpreted as a paragraph containing the list +marker. + +If you want to have one list directly after another one (both with the same list type, i.e. ordered +or unordered), you need to use an EOB marker to separate the two: + + * List one + ^ + * List two + +Since paragraphs support [line wrapping](#line-wrapping), it would usually not be possible to create +compact nested list, i.e. a list where the text is not wrapped in paragraphs because there is no +blank line but a sub list after it: + + * This is just text. + * this is a sub list item + * this is a sub sub list item + * This is just text, + spanning two lines + * this is a nested list item. + +However, this is an often used syntax and is therefore support by kramdown. + +If you want to start a paragraph with something that looks like a list item marker, you need to +escape it. This is done by escaping the period in an ordered list or the list item marker in an +unordered list: + + 1984\. It was great + \- others say that, too! + +As mentioned at the beginning, an optional IAL for applying attributes to a list item can be used +after the list item marker: + + * {:.cls} This item has the class "cls". + Here continues the above paragraph. + + * This is a normal list item. + + +### Definition Lists + +> This syntax feature is not part of the original Markdown syntax. The idea and syntax comes from +> the [PHP Markdown Extra] package. +{: .markdown-difference} + +Definition lists allow you to assign one or more definitions to one or more terms. + +A definition list is started when a normal paragraph is followed by a line with a definition marker +(a colon which may be optionally indented up to three spaces), then at least one tab or one space, +optionally followed by an [IAL](#inline-attribute-lists) that should be applied to the list item and +then the first part of the definition. The line with the definition marker may optionally be +separated from the preceding paragraph by a blank line. The leading tabs or spaces are stripped away +from this first line of the definition to allow for a nice alignment with the following definition +content. Each line of the preceding paragraph is taken to be a term and the lines separately parsed +as span-level elements. + +The following is a simple definition list: + + kramdown + : A Markdown-superset converter + + Maruku + : Another Markdown-superset converter + +The column number of the first non-space character which appears after a definition marker on the +same line specifies the indentation that has to be used for the following lines of the definition. +If there is no such character, the indentation that needs to be used is four spaces or one tab. +Indented lines may be followed by lines containing text with any amount of indentation due to [line +wrapping](#line-wrapping). Note, however, that in addition to the rules outlined in the section +about line wrapping, a list item also ends when a line with another definition marker is encountered. + +The indentation is stripped from the definition and it (note that the definition naturally also +contains the content of the line with the definition marker) is processed as text containing block +level elements. If there is more than one definition, all other definition markers for the term may +be indented up to three spaces or the number of spaces used for the indentation of the last +definition minus one, whichever number is smaller. For example: + + definition term 1 + definition term 2 + : This is the first line. Since the first non-space characters appears in + column 3, all other lines have to be indented 2 spaces (or lazy syntax may + be used after an indented line). This tells kramdown that the lines + belong to the definition. + : This is the another definition for the same term. It uses a + different number of spaces for indentation which is okay but + should generally be avoided. + : The definition marker is indented 3 spaces which is allowed but + should also be avoided. + +So, while the above is possible and creates a definition list with two terms and three definitions +for them, it is not advised to use different (definition marker and definition) indents in the same +definition list as well as lazy indentation! + +The definition for a term is made up of text and/or block-level elements. If a definition is *not* +preceded by a blank line, the first part of the definition will just be text if it would be a +paragraph otherwise: + + definition term + : This definition will just be text because it would normally be a + paragraph and the there is no preceding blank line. + + > although the definition contains other block-level elements + + : This definition *will* be a paragraph since it is preceded by a + blank line. + +The rules about having any block-level element as first element in a list item also apply to a +definition. + + +## Tables + +> This syntax feature is not part of the original Markdown syntax. The syntax is based on the one +> from the [PHP Markdown Extra] package. +{: .markdown-difference} + +Sometimes one wants to include simple tabular data in a kramdown document for which using a +full-blown HTML table is just too much. kramdown supports this with a simple syntax for ASCII +tables. + +Tables can be created with or without a leading pipe character: If the first line of a table +contains a pipe character at the start of the line (optionally indented up to three spaces), then +all leading pipe characters (i.e. pipe characters that are only preceded by whitespace) are ignored +on all table lines. Otherwise they are not ignored and count when dividing a table line into table +cells. + +There are four different line types that can be used in a table: + +* *Table rows* define the content of a table. + + A table row is any line that contains at least one pipe character and is not identified as any + other type of table line! The table row is divided into individual table cells by pipe characters. + An optional trailing pipe character is ignored. Note that literal pipe characters need to be + escaped *except* if they occur in code spans or HTML `` elements! + + Header rows, footer rows and normal rows are all done using these table rows. Table cells can only + contain a single line of text, no multi-line text is supported. The text of a table cell is parsed + as span-level elements. + + Here are some example table rows: + + | First cell|Second cell|Third cell + | First | Second | Third | + + First | Second | | Fourth | + +* *Separator lines* are used to split the table body into multiple body parts. + + A separator line is any line that contains only pipes, dashes, pluses, colons and spaces and which + contains at least one dash and one pipe character. The pipe and plus characters can be used to + visually separate columns although this is not needed. Multiple separator lines after another are + treated as one separator line. + + Here are some example separator lines: + + |----+----| + +----|----+ + |---------| + |- + | :-----: | + -|- + +* The first separator line after at least one table row is treated specially, namely as *header + separator line*. It is used to demarcate header rows from normal table rows and/or to set column + alignments. All table rows above the header separator line are considered to be header rows. + + The header separator line can be specially formatted to contain column alignment definitions: An + alignment definition consists of an optional space followed by an optional colon, one or more + dashes, an optional colon and another optional space. The colons of an alignment definition are + used to set the alignment of a column: if there are no colons, the column uses the default + alignment, if there is a colon only before the dashes, the column is left aligned, if there are + colons before and after the dashes, the column is center aligned and if there is only a colon + after the dashes, the column is right aligned. Each alignment definition sets the alignment for + one column, the first alignment definition for the first column, the second alignment definition + for the second column and so on. + + Here are some example header separator lines with alignment definitions: + + |---+---+---| + + :-: |:------| ---:| + | :-: :- -: - + :-: | :- + +* A *footer separator line* is used to demarcate footer rows from normal table rows. All table rows + below the footer separator line are considered to be footer rows. + + A footer separator line is like a normal separator line except that dashes are replaced by equal + signs. A footer separator line may only appear once in a table. If multiple footer separator lines + are used in one table, only the last is treated as footer separator line, all others are treated + as normal separator lines. Normal separator lines that are used after the footer separator line + are ignored. + + Here are some example footer separator lines: + + |====+====| + +====|====+ + |=========| + |= + +Trailing spaces or tabs are ignored in all cases. To simplify table creation and maintenance, +header, footer and normal separator lines need not specify the same number of columns as table rows; +even `|-` and `|=` are a valid separators. + +Given the above components, a table is specified by + +* an optional separator line, +* optionally followed by zero, one or more table rows followed by a header separator line, +* one or more table rows, optionally interspersed with separator lines, +* optionally followed by a footer separator line and zero, one or more table rows and +* an optional trailing separator line. + +Also note + +* that the first line of a table must not have more than three spaces of indentation before the + first non-space character, +* that each line of a table needs to have at least one not escaped pipe character so that kramdown + recognizes it as a line belonging to the table and +* that tables have to start and end on [block boundaries](#block-boundaries)! + +> The table syntax differs from the one used in [PHP Markdown Extra] as follows: +> +> * kramdown tables do not need to have a table header. +> * kramdown tables can be structured using separator lines. +> * kramdown tables can contain a table footer. +> * kramdown tables need to be separated from other block-level elements. +{: .markdown-difference} + +Here is an example for a kramdown table with a table header row, two table bodies and a table footer +row: + + |-----------------+------------+-----------------+----------------| + | Default aligned |Left aligned| Center aligned | Right aligned | + |-----------------|:-----------|:---------------:|---------------:| + | First body part |Second cell | Third cell | fourth cell | + | Second line |foo | **strong** | baz | + | Third line |quux | baz | bar | + |-----------------+------------+-----------------+----------------| + | Second body | | | | + | 2 line | | | | + |=================+============+=================+================| + | Footer row | | | | + |-----------------+------------+-----------------+----------------| + +The above example table is rather time-consuming to create without the help of an ASCII table +editor. However, the table syntax is flexible and the above table could also be written like this: + + |--- + | Default aligned | Left aligned | Center aligned | Right aligned + |-|:-|:-:|-: + | First body part | Second cell | Third cell | fourth cell + | Second line |foo | **strong** | baz + | Third line |quux | baz | bar + |--- + | Second body + | 2 line + |=== + | Footer row + + +## Horizontal Rules + +A horizontal rule for visually separating content is created by using three or more asterisks, +dashes or underscores (these may not be mixed on a line), optionally separated by spaces or tabs, on +an otherwise blank line. The first asterisk, dash or underscore may optionally be indented up to +three spaces. The following examples show different possibilities to create a horizontal rule: + + * * * + + --- + + _ _ _ _ + + --------------- + + +## Math Blocks + +> This syntax feature is not part of the original Markdown syntax. The idea comes from the [Maruku] +> and [Pandoc] packages. +{: .markdown-difference} + +kramdown has built-in support for block and span-level mathematics written in LaTeX. + +A math block needs to start and end on [block boundaries](#block-boundaries). It is started using +two dollar signs, optionally indented up to three spaces. The math block continues until the next +two dollar signs (which may be on the same line or on one of the next lines) that appear at the end +of a line, i.e. they may only be followed by whitespace characters. The content of a math block has +to be valid LaTeX math. It is always wrapped inside a `\begin{displaymath}...\end{displaymath}` +enviroment except if it begins with a `\begin` statement. + +The following kramdown fragment + + $$ + \begin{align*} + & \phi(x,y) = \phi \left(\sum_{i=1}^n x_ie_i, \sum_{j=1}^n y_je_j \right) + = \sum_{i=1}^n \sum_{j=1}^n x_i y_j \phi(e_i, e_j) = \\ + & (x_1, \ldots, x_n) \left( \begin{array}{ccc} + \phi(e_1, e_1) & \cdots & \phi(e_1, e_n) \\ + \vdots & \ddots & \vdots \\ + \phi(e_n, e_1) & \cdots & \phi(e_n, e_n) + \end{array} \right) + \left( \begin{array}{c} + y_1 \\ + \vdots \\ + y_n + \end{array} \right) + \end{align*} + $$ + +renders as + +$$ +\begin{align*} + & \phi(x,y) = \phi \left(\sum_{i=1}^n x_ie_i, \sum_{j=1}^n y_je_j \right) + = \sum_{i=1}^n \sum_{j=1}^n x_i y_j \phi(e_i, e_j) = \\ + & (x_1, \ldots, x_n) \left( \begin{array}{ccc} + \phi(e_1, e_1) & \cdots & \phi(e_1, e_n) \\ + \vdots & \ddots & \vdots \\ + \phi(e_n, e_1) & \cdots & \phi(e_n, e_n) + \end{array} \right) + \left( \begin{array}{c} + y_1 \\ + \vdots \\ + y_n + \end{array} \right) +\end{align*} +$$ + +Using inline math is also easy: just surround your math content with two dollar signs, like with a +math block. If you don't want to start an inline math statement, just escape the dollar signs and +they will be treated as simple dollar signs. + +If you have a paragraph that looks like a math block but should actually be a paragraph with just an +inline math statement, you need to escape the first dollar sign: + + The following is a math block: + + $$ 5 + 5 $$ + + But next comes a paragraph with an inline math statement: + + \$$ 5 + 5 $$ + +If you don't even won't the inline math statement, escape the first two dollar signs: + + \$\$ 5 + 5 $$ + +## HTML Blocks + +> The original Markdown syntax specifies that an HTML block must start at the left margin, i.e. no +> indentation is allowed. Also, the HTML block has to be surrounded by blank lines. Both +> restrictions are lifted for kramdown documents. Additionally, the original syntax does not allow +> you to use Markdown syntax in HTML blocks which is allowed with kramdown. +{: .markdown-difference} + +An HTML block is potentially started if a line is encountered that begins with a non-span-level HTML +tag or a general XML tag (opening or closing) which may be indented up to three spaces. + +The following HTML tags count as span-level HTML tags and *won't* start an HTML block if found at +the beginning of an HTML block line: + + a abbr acronym b big bdo br button cite code del dfn em i img input + ins kbd label option q rb rbc rp rt rtc ruby samp select small span + strong sub sup textarea tt var + +Further parsing of a found start tag depends on the tag and in which of three possible ways its +content is parsed: + +* Parse as raw HTML block: If the HTML/XML tag content should be handled as raw HTML, then only + HTML/XML tags are parsed from this point onwards and text is handled as raw, unparsed text until + the matching end tag is found or until the end of the document. Each found tag will be parsed as + raw HTML again. However, if a tag has a `markdown` attribute, this attribute controls parsing of + this one tag (see below). + + Note that the parser basically supports only correct XHTML! However, there are some exceptions. + For example, attributes without values (i.e. boolean attributes) are also supported and elements + without content like `
    ` can be written as `
    `. If an invalid closing tag is found, it is + ignored. + +* Parse as block-level elements: If the HTML/XML tag content should be parsed as text containing + block-level elements, the remaining text on the line will be parsed by the block-level parser as + if it appears on a separate line (**Caution**: This also means that if the line consists of the + start tag, text and the end tag, the end tag will not be found!). All following lines are parsed + as block-level elements until an HTML block line with the matching end tag is found or until the + end of the document. + +* Parse as span-level elements: If the HTML/XML tag content should be parsed as text containing span + level elements, then all text until the *next* matching end tag or until the end of the document + will be the content of the tag and will later be parsed by the span-level parser. This also means + that if the matching end tag is inside what appears to be a code span, it is still used! + +If there is text after an end tag, it will be parsed as if it appears on a separate line except when +inside a raw HTML block. + +Also, if an invalid closing tag is found, it is ignored. + +Note that all HTML tag and attribute names are converted to lowercase! + +By default, kramdown parses all block HTML tags and all XML tags as raw HTML blocks. However, this +can be configured with the `parse_block_html`. If this is set to `true`, then syntax parsing in HTML +blocks is globally enabled. It is also possible to enable/disable syntax parsing on a tag per tag +basis using the `markdown` attribute: + +* If an HTML tag has an attribute `markdown="0"`, then the tag is parsed as raw HTML block. + +* If an HTML tag has an attribute `markdown="1"`, then the default mechanism for parsing syntax in + this tag is used. + +* If an HTML tag has an attribute `markdown="block"`, then the content of the tag is parsed as block + level elements. + +* If an HTML tag has an attribute `markdown="span"`, then the content of the tag is parsed as span + level elements. + +The following list shows which HTML tags are parsed in which mode by default when `markdown="1"` is +applied or `parse_block_html` is `true`: + +Parse as raw HTML block +: + script math option textarea + + Also, all general XML tags are parsed as raw HTML blocks. + +Parse as block-level elements +: + applet button blockquote body colgroup dd div dl fieldset form iframe li + map noscript object ol table tbody thead tfoot tr td ul + +Parse as span-level elements +: + a abbr acronym address b bdo big cite caption code del dfn dt em + h1 h2 h3 h4 h5 h6 i ins kbd label legend optgroup p pre q rb rbc + rp rt rtc ruby samp select small span strong sub sup th tt var + +> Remember that all span-level HTML tags like `a` or `b` do not start a HTML block! However, the +> above lists also include span-level HTML tags in the case the `markdown` attribute is used on a +> tag inside a raw HTML block. + +Here is a simple example input and its HTML output with `parse_block_html` set to `false`: + + This is a para. +
    + Something in here. +
    + Other para. +^ +

    This is a para.

    +
    + Something in here. +
    +

    Other para.

    + +As one can see the content of the `div` tag will be parsed as raw HTML block and left alone. +However, if the `markdown="1"` attribute was used on the `div` tag, the content would be parsed as +block-level elements and therefore converted to a paragraph. + +You can also use several HTML tags at once: + +
    + This is some text in the `layer1` div. +
    + This is some text in the `layers` div. +
    + This is a para outside the HTML block. + +However, remember that if the content of a tag is parsed as block-level elements, the content that +appears after a start/end tag but on the same line, is processed as if it appears on a new line: + +
    This is the first part of a para, + which is continued here. +
    + +

    This works without problems because it is parsed as + span-level elements

    + +
    The end tag is not found because + this line is parsed as a paragraph
    + +Since setting `parse_block_html` to `true` can lead to some not wanted behaviour, it is generally +better to selectively enable or disable block/span-level elements parsing by using the `markdown` +attribute! + +Unclosed block-level HTML tags are correctly closed at the end of the document to ensure correct +nesting and invalidly used end tags are removed from the output: + + This is a para. +
    + Another para. +

    +^ +

    This is a para.

    +
    +

    Another para.

    +
    + +The parsing of processing instructions and XML comments is also supported. The content of both, PIs +and XML comments, may span multiple lines. The start of a PI/XML comment may only appear at the +beginning of a line, optionally indented up to three spaces. If there is text after the end of a PI +or XML comment, it will be parsed as if it appears on a separate line. kramdown syntax in PIs/XML +comments is not processed: + + This is a para. + + First part of para, + continues here. + + + +# Text Markup + +These elements are all span-level elements and used inside block-level elements to markup text +fragments. For example, one can easily create links or apply emphasis to certain text parts. + +Note that empty span-level elements are not converted to empty HTML tags but are copied as-is to the +output. + + + +## Links and Images + +Three types of links are supported: automatic links, inline links and reference links. + +### Automatic Links + +This is the easiest one to create: Just surround a web address or an email address with angle +brackets and the address will be turned into a proper link. The address will be used as link target +and as link text. For example: + + Information can be found on the homepage. + You can also mail me: + +It is not possible to specify a different link text using automatic links -- use the other link +types for this! + + +### Inline Links + +As the wording suggests, inline links provide all information inline in the text flow. Reference +style links only provide the link text in the text flow and everything else is defined +elsewhere. This also allows you to reuse link definitions. + +An inline style link can be created by surrounding the link text which must contain at least one +character with square brackets, followed immediately by the link URL (and an optional title in +single or double quotes preceded by at least one space) in normal parentheses. For example: + + This is [a link](http://rubyforge.org) to a page. + A [link](../test "local URI") can also have a title. + And [spaces](link with spaces.html)! + +Notes: + +* The link text is treated like normal span-level text and therefore is parsed and converted. + However, if you use square brackets within the link text, you have to either properly nest them or + to escape them. It is not possible to create nested links! + +* The link URL must not contain single or double quotes and it has to contain properly nested + parentheses if no title is specified, or the link URL must be contained in angle brackets + (incorrectly nested parentheses are allowed). + +* The link title may not contain its delimiters and may not be empty. + +### Reference Links + +To create a reference style link, you need to surround the link text with square brackets (as with +inline links), followed by optional spaces/tabs/line breaks and then optionally followed with +another set of square brackets with the link identifier in them. A link identifier may not contain a +closing bracket and, when specified in a link definition, newline characters; it is also not case +sensitive, line breaks and tabs are converted to spaces and multiple spaces are compressed into one. +For example: + + This is a [reference style link][linkid] to a page. And [this] + [linkid] is also a link. As is [this][] and [THIS]. + +If you don't specify a link identifier (i.e. only use empty square brackets) or completely omit the +second pair of square brackets, the link text is converted to a valid link identifier by removing +all invalid characters and inserting spaces for line breaks. If there is a link definition found for +the link identifier, a link will be created. Otherwise the text is not converted to a link. + +### Link Definitions + +The link definition can be put anywhere in the document. It does not appear in the output. A link +definition looks like this: + + [linkid]: http://www.example.com/ "Optional Title" + +> Link definitions are, despite being described here, non-content block-level elements. +{: .information} + +The link definition has the following structure: + +* The link identifier in square brackets, optionally indented up to three spaces, +* then a colon and one or more spaces/tabs, +* then the link URL which must not contain any single or double quotes and which must contain at + least one non-space character, or a left angle bracket, the link URL and a right angle bracket, +* then optionally the title in single or double quotes, separated from the link URL by one or more + spaces or on the next line by itself indented any number of spaces/tabs. + +> The original Markdown syntax also allowed the title to be specified in parenthesis. This is not +> allowed for consistency with the inline title. +{: .markdown-difference} + +If you have some text that looks like a link definition but should really be a link and some text, +you can escape the colon after the link identifier: + + The next paragraph contains a link and some text. + + [Room 100]\: There you should find everything you need! + + [Room 100]: link_to_room_100.html + + +### Images + +Images can be specified via a syntax that is similar to the one used by links. The difference is +that you have to use an exclamation mark before the first square bracket and that the link text of a +normal link, which may also be the empty string in case of image links, becomes the alternative text +of the image link. As with normal links, image links can be written inline or reference style. For +example: + + Here comes a ![smiley](../images/smiley.png)! And here + ![too](../images/other.png 'Title text'). Or ![here]. + With empty alt text ![](see.jpg) + +The link definition for images is exactly the same as the link definition for normal links. + + +## Emphasis + +kramdown supports two types of emphasis: light and strong emphasis. Text parts that are surrounded +with single asterisks `*` or underscores `_` are treated as text with light emphasis, text parts +surrounded with two asterisks or underscores are treated as text with strong emphasis. Surrounded +means that the starting delimiter must not be followed by a space and that the stopping delimiter +must not be preceded by a space. + +Here is an example for text with light and strong emphasis: + + *some text* + _some text_ + **some text** + __some text__ + +The asterisk form is also allowed within a single word: + + This is un*believe*able! This d_oe_s not work! + +Text can be marked up with both light and strong emphasis, possibly using different delimiters. +However, it is not possible to nest strong within strong or light within light emphasized text: + + This is a ***text with light and strong emphasis***. + This **is _emphasized_ as well**. + This *does _not_ work*. + This **does __not__ work either**. + +If one or two asterisks or underscores are surrounded by spaces, they are treated literally. If you +want to force the literal meaning of an asterisk or an underscore you can backslash-escape it: + + This is a * literal asterisk. + These are ** two literal asterisk. + As \*are\* these! + + +## Code Spans + +This is the span-level equivalent of the [code block](#code-blocks) element. You can markup a text +part as code span by surrounding it with backticks `` ` ``. For example: + + Use `` tags for this. + +Note that all special characters in a code span are treated correctly. For example, when a code span +is converted to HTML, the characters `<`, `>` and `&` are substituted by their respective HTML +counterparts. + +To include a literal backtick in a code span, you need to use two or more backticks as delimiters. +You can insert one optional space after the starting and before the ending delimiter (these spaces +are not used in the output). For example: + + Here is a literal `` ` `` backtick. + And here is `` `some` `` text (note the two spaces so that one is left + in the output!). + +A single backtick surrounded by spaces is treated as literal backtick. If you want to force the +literal meaning of a backtick you can backslash-escape it: + + This is a ` literal backtick. + As \`are\` these! + +As with [code blocks](#language-of-code-blocks) you can set the language of a code span by using an +[IAL](#inline-attribute-lists): + + This is a Ruby code fragment `x = Class.new`{:.language-ruby} + + +## HTML Spans + +HTML tags cannot only be used on the block-level but also on the span-level. Span-level HTML tags +can only be used inside one block-level element, it is not possible to use a start tag in one block +level element and the end tag in another. Note that only correct XHTML is supported! This means that +you have to use, for example, `
    ` instead of `
    ` (although kramdown tries to fix such errors +if possible). + +By default, kramdown parses kramdown syntax inside span HTML tags. However, this behaviour can be +configured with the `parse_span_html` option. If this is set to `true`, then syntax parsing in HTML +spans is enabled, if it is set to `false`, parsing is disabled. It is also possible to +enable/disable syntax parsing on a tag per tag basis using the `markdown` attribute: + +* If an HTML tag has an attribute `markdown="0"`, then no parsing (except parsing of HTML span tags) + is done inside that HTML tag. + +* If an HTML tag has an attribute `markdown="1"`, then the content of the tag is parsed as span + level elements. + +* If an HTML tag has an attribute `markdown="block"`, then a warning is issued because HTML spans + cannot contain block-level elements and the attribute is ignored. + +* If an HTML tag has an attribute `markdown="span"`, then the content of the tag is parsed as span + level elements. + +The content of a span-level HTML tag is normally parsed as span-level elements. Note, however, that +some tags like `

    + + + + +

    parsed +This too +

    + + + + + + + + + +

    http://example.com

    + + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_raw.htmlinput b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_raw.htmlinput new file mode 100644 index 000000000..22b9ea5c1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_raw.htmlinput @@ -0,0 +1,34 @@ +

    baz { |qux| quux }

    + +

    This is some para. +

    + + + + +

    parsed +This too +

    + + + + + + + + + +

    http://example.com

    + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_raw.options b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_raw.options new file mode 100644 index 000000000..a660da25c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_raw.options @@ -0,0 +1 @@ +:parse_block_html: true diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_raw.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_raw.text new file mode 100644 index 000000000..e0617c416 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_raw.text @@ -0,0 +1,33 @@ +

    baz { |qux| quux }

    + +This is some para. + + + + +

    *parsed* +This too +

    + + + + + + + + + + + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_span.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_span.html new file mode 100644 index 000000000..2a6191fb4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_span.html @@ -0,0 +1,12 @@ +

    This text +should be parsed +as span +

    + +

    This produces `

    +

    ` an unwanted result.</p>

    + +

    This text too

    +

    +some text +

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_span.htmlinput b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_span.htmlinput new file mode 100644 index 000000000..4199b8b2f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_span.htmlinput @@ -0,0 +1,12 @@ +

    This text +should be parsed +as span +

    + +

    This produces `

    +

    ` an unwanted result.</p>

    + +

    This text too

    +

    +some text +

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_span.options b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_span.options new file mode 100644 index 000000000..a660da25c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_span.options @@ -0,0 +1 @@ +:parse_block_html: true diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_span.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_span.text new file mode 100644 index 000000000..d07cf6d88 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_as_span.text @@ -0,0 +1,9 @@ +

    This *text +should* be parsed +as span +

    + +

    This produces `

    ` an unwanted result.

    + +

    This *text* too

    +some text diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_block_html.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_block_html.html new file mode 100644 index 000000000..8de78c049 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_block_html.html @@ -0,0 +1,21 @@ +

    +

    test

    +
    + +
    +
    test
    +
    +
    +
    test
    +
    +
    +
    + +
    +
    code block with </div>
    +
    +
    + +
    +

    No matching end tag

    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_block_html.options b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_block_html.options new file mode 100644 index 000000000..a660da25c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_block_html.options @@ -0,0 +1 @@ +:parse_block_html: true diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_block_html.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_block_html.text new file mode 100644 index 000000000..b8b18453e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/parse_block_html.text @@ -0,0 +1,17 @@ +
    + test +
    + +
    + test +
    + test +
    +
    + +
    + code block with
    +
    + +
    +No matching end tag diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/processing_instruction.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/processing_instruction.html new file mode 100644 index 000000000..b292a058e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/processing_instruction.html @@ -0,0 +1,13 @@ + + +

    para

    + + +

    para

    + +

    other

    + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/processing_instruction.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/processing_instruction.text new file mode 100644 index 000000000..fcb866ffa --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/processing_instruction.text @@ -0,0 +1,12 @@ + + +para + + para + +other + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/simple.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/simple.html new file mode 100644 index 000000000..edf416137 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/simple.html @@ -0,0 +1,64 @@ +
    +

    test

    +
    + +

    +para2 +

    + +
    +

    tes

    + +

    test +weiter +

    +
    + +

    para4

    + +
    +
    +
    +

    foo

    +
    +
    +
    +
    +

    bar 

    +
    +
    + +

    para5

    + +
    +

    id

    +
    +

    test

    + +
    +

    hallo

    +
    +
    +

    hallo

    +
    + +

    para6

    + +
    +
    +

    Another para.

    +
    + + + +doit + +

    Test

    + +

    Test

    + +

    Test + +

    + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/simple.html.19 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/simple.html.19 new file mode 100644 index 000000000..ac026e555 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/simple.html.19 @@ -0,0 +1,64 @@ +
    +

    test

    +
    + +

    +para2 +

    + +
    +

    tes

    + +

    test +weiter +

    +
    + +

    para4

    + +
    +
    +
    +

    foo

    +
    +
    +
    +
    +

    bar 

    +
    +
    + +

    para5

    + +
    +

    id

    +
    +

    test

    + +
    +

    hallo

    +
    +
    +

    hallo

    +
    + +

    para6

    + +
    +
    +

    Another para.

    +
    + + + +doit + +

    Test

    + +

    Test

    + +

    Test + +

    + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/simple.options b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/simple.options new file mode 100644 index 000000000..a660da25c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/simple.options @@ -0,0 +1 @@ +:parse_block_html: true diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/simple.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/simple.text new file mode 100644 index 000000000..17cc6897f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/09_html/simple.text @@ -0,0 +1,59 @@ +
    +test +
    + +

    +para2 +

    + +
    +

    tes

    + +

    test +weiter +

    +
    + +para4 + +
    +
    +
    +foo +
    +
    +
    +
    bar  +
    +
    + +para5 + +
    id +
    test + +
    +hallo +
    +hallo +
    + +para6 + +
    +Another para. +
    + + + +doit + +Test + +

    Test

    + +

    Test + +

    + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/10_ald/simple.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/10_ald/simple.html new file mode 100644 index 000000000..74b03d58f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/10_ald/simple.html @@ -0,0 +1,2 @@ +

    Some paragraph

    + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/10_ald/simple.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/10_ald/simple.text new file mode 100644 index 000000000..f58768a37 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/10_ald/simple.text @@ -0,0 +1,8 @@ +Some paragraph + +{:id: ref1} +{:id: .class1} + {:id: #id} + {:id: key="value"} + {:id: .class2 .class3 ref2 #id-with key="value" key='value' key='dfsd\}' } +{:test: k ey=value} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/auto_id_and_ial.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/auto_id_and_ial.html new file mode 100644 index 000000000..9857a0380 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/auto_id_and_ial.html @@ -0,0 +1 @@ +

    A header

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/auto_id_and_ial.options b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/auto_id_and_ial.options new file mode 100644 index 000000000..8776b5524 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/auto_id_and_ial.options @@ -0,0 +1 @@ +:auto_ids: true diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/auto_id_and_ial.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/auto_id_and_ial.text new file mode 100644 index 000000000..f521fb0fc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/auto_id_and_ial.text @@ -0,0 +1,2 @@ +## A header +{:#myid .cls} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/nested.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/nested.html new file mode 100644 index 000000000..84cc368d3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/nested.html @@ -0,0 +1,11 @@ +
    +test +
    + +
    +

    test

    +
    + +
    +

    para

    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/nested.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/nested.text new file mode 100644 index 000000000..827645cc9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/nested.text @@ -0,0 +1,15 @@ +{:.cls} +
    +test +
    +{:#id} + +{:.cls} +
    +test +
    +{:#id} + +{:.cls} +> para +{:#id} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/simple.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/simple.html new file mode 100644 index 000000000..c7d19b052 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/simple.html @@ -0,0 +1,27 @@ +

    Some paragraph.

    + +

    Some paragraph.

    + +
    +

    quote

    +
    + +
      +
    • list
    • +
    + +
    code block
    +
    + +
    other code block
    +
    + +

    A header

    + +

    Some paragraph here

    + +

    Paragraph

    +

    Paragraph

    + +

    Another header

    + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/simple.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/simple.text new file mode 100644 index 000000000..a310e9143 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/11_ial/simple.text @@ -0,0 +1,37 @@ +Some paragraph. +{:.class id key="val"} + +Some paragraph. +{:.cls1#id.cls2} + +> quote +{: #id} + {: .class} + +* list +{: key="val"} + + code block +{: #other} + + other code block + +## A header +{:#myid} + +{:.cls} +Some paragraph here + +Paragraph +{:.cls} +Paragraph + +Another header +============== +{: .class #other} + +{:id: #id key="valo"} +{:id: #other .myclass other} +{:other: key1="val\"" - ig.nored as_is#this key2='val\'' .other-class} + +{:.invalid} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/comment.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/comment.html new file mode 100644 index 000000000..20b4c662c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/comment.html @@ -0,0 +1,8 @@ +

    This is a simple paragraph.

    + + + +

    And another paragraph

    + +

    {::comment} +Another paragraph

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/comment.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/comment.text new file mode 100644 index 000000000..2dfc91971 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/comment.text @@ -0,0 +1,12 @@ +This is a simple paragraph. + +{::comment} +This is a comment {:/}which is {:/comment} ignored. +{:/comment} + +And another paragraph + +{::comment this='is' .ignore /} + +{::comment} +Another paragraph diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/ignored.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/ignored.html new file mode 100644 index 000000000..17aae5cd5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/ignored.html @@ -0,0 +1,8 @@ +

    paragraph

    + +

    {::something} +anotherthing +{:/something}

    + +

    {::something/} +paragraph

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/ignored.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/ignored.text new file mode 100644 index 000000000..ae94a8fe3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/ignored.text @@ -0,0 +1,8 @@ +paragraph + +{::something} +anotherthing +{:/something} + +{::something/} +paragraph diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/nomarkdown.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/nomarkdown.html new file mode 100644 index 000000000..7fe58d504 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/nomarkdown.html @@ -0,0 +1,10 @@ +

    This is a simple paragraph.

    + +This *is* not processed + +

    And another paragraph

    + +bold + +

    {::nomarkdown} +Another paragraph

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/nomarkdown.kramdown b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/nomarkdown.kramdown new file mode 100644 index 000000000..2cee51226 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/nomarkdown.kramdown @@ -0,0 +1,20 @@ +This is a simple paragraph. + +{::nomarkdown} +This *is* not processed +{:/} + +And another paragraph + +{::nomarkdown type="html"} +bold +{:/} + +{::nomarkdown type="latex"} +\begin{itemize} +\item[Yes] YESSSS! +\end{itemize} +{:/} + +\{::nomarkdown} Another paragraph + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/nomarkdown.latex b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/nomarkdown.latex new file mode 100644 index 000000000..5af0263cd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/nomarkdown.latex @@ -0,0 +1,13 @@ +This is a simple paragraph. + +This *is* not processed + +And another paragraph + +\begin{itemize} +\item[Yes] YESSSS! +\end{itemize} + +\{::nomarkdown\} +Another paragraph + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/nomarkdown.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/nomarkdown.text new file mode 100644 index 000000000..43d441dfc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/nomarkdown.text @@ -0,0 +1,21 @@ +This is a simple paragraph. + +{::nomarkdown} +This *is* not processed + {:/nomarkdown} + +And another paragraph + +{::nomarkdown this='is' .ignore /} + +{::nomarkdown type='html'} +bold +{:/} +{::nomarkdown type="latex"} +\begin{itemize} +\item[Yes] YESSSS! +\end{itemize} +{:/} + +{::nomarkdown} +Another paragraph diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/options.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/options.html new file mode 100644 index 000000000..8a3a47e5f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/options.html @@ -0,0 +1,21 @@ +

    No header id

    + +

    without header id

    + +
    +some *para* +
    + +
    +

    some para

    +
    + +

    Some text10.

    + +
    +
      +
    1. +

      Some text.

      +
    2. +
    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/options.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/options.text new file mode 100644 index 000000000..5991ab7b9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/options.text @@ -0,0 +1,21 @@ +# No header id + +{::options unusedvar="val" /} + +# without header id + +
    +some *para* +
    + +{::options parse_block_html="true" parse_span_html="true" /} + +
    +some *para* +
    + +{::options footnote_nr="10" /} + +Some text[^ab]. + +[^ab]: Some text. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/options2.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/options2.html new file mode 100644 index 000000000..f2ad2ef90 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/options2.html @@ -0,0 +1,10 @@ + +

    Some text1.

    + +
    +
      +
    1. +

      Some text.

      +
    2. +
    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/options2.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/options2.text new file mode 100644 index 000000000..78abfbeea --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/options2.text @@ -0,0 +1,5 @@ +{::options footnote_nr="da10" /} + +Some text[^ab]. + +[^ab]: Some text. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/options3.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/options3.html new file mode 100644 index 000000000..7b646b6e2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/options3.html @@ -0,0 +1,7 @@ +
    x = Class.new + +
    + +
    x = Class.new + +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/options3.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/options3.text new file mode 100644 index 000000000..e0ee87c5f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/12_extension/options3.text @@ -0,0 +1,7 @@ + x = Class.new +{: .language-ruby} + +{::options coderay_wrap="span" coderay_line_numbers="" coderay_css="class" coderay_tab_width="4" /} + + x = Class.new +{: .language-ruby} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/definition_at_beginning.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/definition_at_beginning.html new file mode 100644 index 000000000..7c5cc0483 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/definition_at_beginning.html @@ -0,0 +1 @@ +

    : no definition

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/definition_at_beginning.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/definition_at_beginning.text new file mode 100644 index 000000000..cd3671b9e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/definition_at_beginning.text @@ -0,0 +1 @@ +: no definition diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/deflist_ial.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/deflist_ial.html new file mode 100644 index 000000000..3090b1ef1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/deflist_ial.html @@ -0,0 +1,4 @@ +
    +
    item
    +
    definition
    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/deflist_ial.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/deflist_ial.text new file mode 100644 index 000000000..587c3b07b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/deflist_ial.text @@ -0,0 +1,4 @@ +{:.dl-horizontal} +item +: definition +{:.dl-other} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/item_ial.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/item_ial.html new file mode 100644 index 000000000..2bbf1b00c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/item_ial.html @@ -0,0 +1,12 @@ +
    +
    item
    +
    definition +continued
    +
    another {:.cls}
    +
    +
    code
    +
    +
    +
    IAL at last + no code bc of text
    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/item_ial.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/item_ial.text new file mode 100644 index 000000000..f75da185a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/item_ial.text @@ -0,0 +1,8 @@ +item +: {:.cls} definition + continued +: another {:.cls} +: {:.class} + code +: {:.cls} IAL at last + no code bc of text diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/multiple_terms.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/multiple_terms.html new file mode 100644 index 000000000..e2e089b37 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/multiple_terms.html @@ -0,0 +1,13 @@ +
    +
    kram
    +
    down
    +
    now
    +
    definition 1
    +
    definition 2
    +
    +

    definition 3

    +
    +
    +

    definition 4

    +
    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/multiple_terms.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/multiple_terms.text new file mode 100644 index 000000000..b834258b7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/multiple_terms.text @@ -0,0 +1,10 @@ +kram +*down* +now +: definition 1 +: definition 2 + +: definition 3 + + +: definition 4 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/no_def_list.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/no_def_list.html new file mode 100644 index 000000000..c16f96238 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/no_def_list.html @@ -0,0 +1,2 @@ +

    This is a para +: and not a definition list

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/no_def_list.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/no_def_list.text new file mode 100644 index 000000000..98b52b374 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/no_def_list.text @@ -0,0 +1,2 @@ +This is a para +\: and not a definition list diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/para_wrapping.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/para_wrapping.html new file mode 100644 index 000000000..5f28fdf8a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/para_wrapping.html @@ -0,0 +1,10 @@ +
    +
    term
    +
    +

    definition

    +
    +
    definition
    +
    +

    definition

    +
    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/para_wrapping.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/para_wrapping.text new file mode 100644 index 000000000..280fa4746 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/para_wrapping.text @@ -0,0 +1,6 @@ +term + +: definition +: definition + +: definition diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/separated_by_eob.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/separated_by_eob.html new file mode 100644 index 000000000..0a1c4dc2b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/separated_by_eob.html @@ -0,0 +1,8 @@ +
    +
    kram
    +
    down
    +
    +
    +
    kram
    +
    down
    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/separated_by_eob.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/separated_by_eob.text new file mode 100644 index 000000000..56fedf16a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/separated_by_eob.text @@ -0,0 +1,5 @@ +kram +: down +^ +kram +: down diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/simple.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/simple.html new file mode 100644 index 000000000..791f14515 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/simple.html @@ -0,0 +1,10 @@ +
    +
    kram
    +
    down
    +
    novalue
    +
    +
    kram
    +
    down +kram
    +
    down
    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/simple.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/simple.text new file mode 100644 index 000000000..e3bf730eb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/simple.text @@ -0,0 +1,10 @@ +kram +: down + +novalue +: + +kram +: down +kram +: down diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/styled_terms.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/styled_terms.html new file mode 100644 index 000000000..cf7d7859a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/styled_terms.html @@ -0,0 +1,4 @@ +
    +
    kram
    +
    down
    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/styled_terms.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/styled_terms.text new file mode 100644 index 000000000..76eb3553f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/styled_terms.text @@ -0,0 +1,2 @@ +*kram* +: down diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/too_much_space.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/too_much_space.html new file mode 100644 index 000000000..b4df87807 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/too_much_space.html @@ -0,0 +1,3 @@ +

    para

    + +

    : no definition

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/too_much_space.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/too_much_space.text new file mode 100644 index 000000000..30ab445c8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/too_much_space.text @@ -0,0 +1,4 @@ +para + + +: no definition diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/with_blocks.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/with_blocks.html new file mode 100644 index 000000000..45b58656e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/with_blocks.html @@ -0,0 +1,38 @@ +
    +
    kram
    +
    this is some +text
    +
    +

    this is some +more text

    +
    +
    kram
    +
    +
    +

    blockquote

    +
    +
    +
    kram
    +
    +
    code
    +
    +
    +
    kram
    +
    +
    +
    kram
    +
    down
    +
    +
    +
    kram
    +
    +

    header

    +
    +
    kram
    +
    +
      +
    • list
    • +
    • items
    • +
    +
    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/with_blocks.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/with_blocks.text new file mode 100644 index 000000000..15195ce3f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/13_definition_list/with_blocks.text @@ -0,0 +1,24 @@ +kram +: this is some + text + + : this is some + more text + +kram +: > blockquote + +kram +: + code + +kram +: kram + : down + +kram +: # header + +kram +: * list + * items diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/errors.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/errors.html new file mode 100644 index 000000000..70e1fa7e1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/errors.html @@ -0,0 +1,8 @@ +

    No table body

    + +

    |-|-|-

    + +

    |no|table|here|

    + +

    |no|table|here| +paragraph

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/errors.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/errors.text new file mode 100644 index 000000000..a13107b08 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/errors.text @@ -0,0 +1,9 @@ +No table body + +|-|-|- + +[5]: test +|no|table|here| + +|no|table|here| +paragraph diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/escaping.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/escaping.html new file mode 100644 index 000000000..b4528a17d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/escaping.html @@ -0,0 +1,52 @@ +

    cell 1 | cell 2

    + +

    cell 1 | cell 2

    + + + + + + + + +
    cell 1cell 2 | continued
    + + + + + + + + +
    cell 1cell 2
    + + + + + + + + +
    cell 1code | span
    + +

    cell 1 code | span

    + +

    cell 1 | code | span

    + + + + + + + + + + + + + + +
    cell 1cell `2cell 3
    cell 1`cell 2cell 3
    + +

    cell 1 | cell 2 | cell 3 +cell 1 | cell 2 | cell 3

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/escaping.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/escaping.text new file mode 100644 index 000000000..a8a24d6a3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/escaping.text @@ -0,0 +1,19 @@ +`cell 1 | cell 2` + +cell 1 \| cell 2 + +cell 1 | cell 2 \| continued + +cell 1 | cell `2` + +cell 1 | `code | span` + +cell 1 `code | span` + +cell 1 \| `code | span` + +cell 1 | cell `2 | cell 3 +cell 1` | cell 2 | cell 3 + +cell 1 \| cell `2 | cell 3 +cell 1` | cell 2 | cell 3 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/footer.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/footer.html new file mode 100644 index 000000000..e6596ed5e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/footer.html @@ -0,0 +1,65 @@ +

    Simple footer

    + + + + + + + + + + + + + + +
    cell1cell2
    cell3cell4
    + +

    Full footer

    + + + + + + + + + + + + + + +
    cell1cell2
    cell3cell4
    + +

    Footer with separator lines

    + + + + + + + + + + + + + + + + + + +
    cell1cell2
    cell3cell4
    cell5cell6
    + +

    Empty footer

    + + + + + + + + +
    cell1cell2
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/footer.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/footer.text new file mode 100644 index 000000000..faaed8d9f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/footer.text @@ -0,0 +1,25 @@ +Simple footer + +| cell1 | cell2 +|= +| cell3 | cell4 + +Full footer + +| cell1 | cell2 +|=======|=======| +| cell3 | cell4 + +Footer with separator lines + +| cell1 | cell2 +|=======|=======| +| cell3 | cell4 +|--- +| cell5 | cell6 +|--- + +Empty footer + +| cell1 | cell2 +|= diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/header.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/header.html new file mode 100644 index 000000000..cc7c6e625 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/header.html @@ -0,0 +1,96 @@ +

    Simple header

    + + + + + + + + + + + + + + +
    cell1cell2
    cell3cell4
    + +

    Full header

    + + + + + + + + + + + + + + +
    cell1cell2
    cell3cell4
    + +

    With alignment and superfluous alignment defs

    + + + + + + + + + + + + + + + + + + + + +
    defaultleftcenterrightdefault
    cell1cell2cell3cell4cell5
    + +

    With leading sep line

    + + + + + + + + + + + + + + +
    cell1cell2
    cell3cell4
    + +

    Multiple bodies

    + + + + + + + + + + + + + + + + + + + + +
    cell1cell2
    cell3cell4
    cell5cell6
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/header.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/header.text new file mode 100644 index 000000000..a42827b94 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/header.text @@ -0,0 +1,32 @@ +Simple header + +| cell1 | cell2 +|----- +| cell3 | cell4 + +Full header + +| cell1 | cell2 +|-------|-------| +| cell3 | cell4 + +With alignment and superfluous alignment defs + +| default | left | center | right | default +|-| :- |:-: | -: | - | :-: | :- +| cell1 | cell2 | cell3 | cell4 | cell5 + +With leading sep line + +|:-:|-:| +| cell1 | cell2 +|-------|-------| +| cell3 | cell4 + +Multiple bodies + +| cell1 | cell2 ++ :-: | +| cell3 | cell4 +|----||| +| cell5 | cell6 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/no_table.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/no_table.html new file mode 100644 index 000000000..dce46b1d3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/no_table.html @@ -0,0 +1,3 @@ +

    No table

    + +

    | Some | thing | here

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/no_table.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/no_table.text new file mode 100644 index 000000000..90f90b3d9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/no_table.text @@ -0,0 +1,3 @@ +No table + +\| Some \| thing \| here diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/simple.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/simple.html new file mode 100644 index 000000000..186b1a1ac --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/simple.html @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + +
    cell1cell2
    cell3cell4
    cell5cell6 |
    cell7cell8
    + +

    Missing cells at end

    + + + + + + + + + + + + + + + + + + + +
    cell1cell2cell3
    cell1  
     cell2cell3
    + +

    Escaped pipe characters

    + + + + + + + + + + + + + + + + +
    cell1 | cell1cell2
    cell1cell2 |
    cell1 | concell2
    + +

    Table with code elements

    + + + + + + + + + + + + + + + + +
    This is a span | with a pipe.   
    Some span</em> herea span | with apipe.
    + +

    Special cases regarding codespan syntax

    + + + + + + + + +
    ab
    + + + + + + + +
    a
    + + + + + + + + + +
    tablewithial
    + + + + + + + + + +
    tablewithial
    + +

    not starting with a bar

    + + + + + + + + +
    simpletable
    + + + + + + + + + + + + + + +
    head1head2
    cell1cell2
    + + + + + + + + + + + + + + +
    head1head2
     cell2
    + + + + + + + + + + + + + + + + +
    ab
    cd
    ef
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/simple.html.19 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/simple.html.19 new file mode 100644 index 000000000..db7c8929c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/simple.html.19 @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + +
    cell1cell2
    cell3cell4
    cell5cell6 |
    cell7cell8
    + +

    Missing cells at end

    + + + + + + + + + + + + + + + + + + + +
    cell1cell2cell3
    cell1  
     cell2cell3
    + +

    Escaped pipe characters

    + + + + + + + + + + + + + + + + +
    cell1 | cell1cell2
    cell1cell2 |
    cell1 | concell2
    + +

    Table with code elements

    + + + + + + + + + + + + + + + + +
    This is a span | with a pipe.   
    Some span</em> herea span | with apipe.
    + +

    Special cases regarding codespan syntax

    + + + + + + + + +
    ab
    + + + + + + + +
    a
    + + + + + + + + + +
    tablewithial
    + + + + + + + + + +
    tablewithial
    + +

    not starting with a bar

    + + + + + + + + +
    simpletable
    + + + + + + + + + + + + + + +
    head1head2
    cell1cell2
    + + + + + + + + + + + + + + +
    head1head2
     cell2
    + + + + + + + + + + + + + + + + +
    ab
    cd
    ef
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/simple.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/simple.text new file mode 100644 index 000000000..2c176e8fe --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/simple.text @@ -0,0 +1,49 @@ +| cell1 | cell2 | +|cell3 | cell4| +|cell5|cell6 \| +| cell7|cell8 + +Missing cells at end + +| cell1 | cell2 | cell3 | +| cell1 || +|| cell2 | cell3 + +Escaped pipe characters + +| cell1 \| cell1 | cell2 | +| cell1 | cell2 \| +| cell1 `|` con | cell2 + +Table with code elements + +| This is a span | with a pipe. +| Some span | here | a span | with a | pipe. + +Special cases regarding codespan syntax + +|a|`b` + +|`a` + +{:.cls} +| table | with | ial + +| table | with | ial +{:.cls} + +not starting with a bar + +simple | table + +head1 | head2 +------|------ +cell1 | cell2 + + head1 | head2 +-------|------ + | cell2 + +| a | b | + c | d +| e | f | diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/table_with_footnote.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/table_with_footnote.html new file mode 100644 index 000000000..0bf678176 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/table_with_footnote.html @@ -0,0 +1,25 @@ + + + + + + + + + + + +
    this is 1a table
    with afootnote
    + +
    +
      +
    1. +

      Something

      + +
      +

      special here

      +
      +

      +
    2. +
    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/table_with_footnote.latex b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/table_with_footnote.latex new file mode 100644 index 000000000..99b5312f3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/table_with_footnote.latex @@ -0,0 +1,11 @@ +\begin{longtable}{|l|l|} +\hline +this is \footnote{Something + +\begin{quote} +special here +\end{quote}} & a table\\ +with a & footnote\\ +\hline +\end{longtable} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/table_with_footnote.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/table_with_footnote.text new file mode 100644 index 000000000..345fc5d30 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/14_table/table_with_footnote.text @@ -0,0 +1,6 @@ +| this is [^1] | a table +| with a | footnote + +[^1]: Something + + > special here diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/15_math/normal.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/15_math/normal.html new file mode 100644 index 000000000..f5779c4e4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/15_math/normal.html @@ -0,0 +1,27 @@ +

    This is a para. +

    + + + +

    +This is a para.

    + + + + + + + + + + + +
    $$5+5$$
    +
    + + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/15_math/normal.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/15_math/normal.text new file mode 100644 index 000000000..a1aba722d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/15_math/normal.text @@ -0,0 +1,28 @@ +This is a para. +$$ \text{LaTeX} \lambda_5 $$ + +$$\lambda_5 = \alpha + 4$$ + +$$\lambda_\alpha > 5$$ +This is a para. + +$$\begin{align*} +&=5 \\ +&=6 \\ +\end{align*}$$ + +$$5+5$$ + + $$5+5$$ + + $$5+5$$ + + $$5+5$$ + + $$5+5$$ + +{:.cls} +$$5+5$$ +^ +$$5+5$$ +{:.cls} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/no_toc.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/no_toc.html new file mode 100644 index 000000000..bbb831e93 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/no_toc.html @@ -0,0 +1,14 @@ + +

    Header level 1

    + +

    Header level 2

    + +

    Header level 3

    + +

    Header level 4

    + +

    Other header level 1

    + +

    Other header level 2

    + +

    Other header level 3

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/no_toc.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/no_toc.text new file mode 100644 index 000000000..11ad82916 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/no_toc.text @@ -0,0 +1,16 @@ +* Here comes the table of content +{:toc} + +# Header level 1 + +## Header level 2 + +### Header level 3 + +#### Header level 4 + +# Other header level 1 + +## Other header level 2 + +### Other header level 3 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_exclude.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_exclude.html new file mode 100644 index 000000000..b8b61ced0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_exclude.html @@ -0,0 +1,35 @@ +

    Contents

    + + + +

    Header level 1

    + +

    Header level 2

    + +

    Header level 3

    + +

    Header level 4

    + +

    Other header level 1

    + +

    Other header level 2

    + +

    Other header level 3

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_exclude.options b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_exclude.options new file mode 100644 index 000000000..8776b5524 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_exclude.options @@ -0,0 +1 @@ +:auto_ids: true diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_exclude.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_exclude.text new file mode 100644 index 000000000..d8f0b863f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_exclude.text @@ -0,0 +1,19 @@ +# Contents +{:.no_toc} + +* Here comes the table of content +{:toc} + +# Header level 1 + +## Header level 2 + +### Header level 3 + +#### Header level 4 + +# Other header level 1 + +## Other header level 2 + +### Other header level 3 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_levels.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_levels.html new file mode 100644 index 000000000..7891e1d18 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_levels.html @@ -0,0 +1,24 @@ + + +

    Header level 1

    + +

    Header level 2

    + +

    Header level 3

    + +

    Header level 4

    + +

    Other header level 1

    + +

    Other header level 2

    + +

    Other header level 3

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_levels.options b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_levels.options new file mode 100644 index 000000000..bdfbeba1a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_levels.options @@ -0,0 +1,2 @@ +:toc_levels: 2..3 +:auto_ids: true diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_levels.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_levels.text new file mode 100644 index 000000000..11ad82916 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_levels.text @@ -0,0 +1,16 @@ +* Here comes the table of content +{:toc} + +# Header level 1 + +## Header level 2 + +### Header level 3 + +#### Header level 4 + +# Other header level 1 + +## Other header level 2 + +### Other header level 3 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_with_footnotes.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_with_footnotes.html new file mode 100644 index 000000000..542482f95 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_with_footnotes.html @@ -0,0 +1,13 @@ + + +

    Header1 level 1

    + +
    +
      +
    1. +

      Some footnote content here

      +
    2. +
    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_with_footnotes.options b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_with_footnotes.options new file mode 100644 index 000000000..8776b5524 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_with_footnotes.options @@ -0,0 +1 @@ +:auto_ids: true diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_with_footnotes.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_with_footnotes.text new file mode 100644 index 000000000..5879ed576 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/block/16_toc/toc_with_footnotes.text @@ -0,0 +1,6 @@ +* Here comes the table of content +{:toc} + +# Header[^1] level 1 + +[^1]: Some footnote content here diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/encoding.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/encoding.html new file mode 100644 index 000000000..0339347f2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/encoding.html @@ -0,0 +1,46 @@ +

    Das ist gewöhnlich ein Über-Problem mit manchen
    +Sälen http://example.org und anderen Dinge. Siehe +Über mich!

    + +
    +

    Vielleicht höre ich nicht richtig?

    +
    + +
      +
    • Sollten wir uns das überlegen? Verhöhne mich nicht!
    • +
    • Ho ho höher! Sind *wir* da?
    • +
    + +

    Titel sind urschön

    + +

    Manche mögens ärmer

    + +
    öha
    +was nun?
    +
    + +
    +
    Töne
    +
    Laute Geräusche
    +
    vielleicht noch was ähnliches
    +
    + + + + + + + + + + + + + + + + +
    hochhöheram höchsten
    überdrübermüde
    + +

    Das ist schön +gemacht

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/encoding.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/encoding.text new file mode 100644 index 000000000..65edf4b02 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/encoding.text @@ -0,0 +1,28 @@ +Das ist gewöhnlich *ein* [Über-Problem](http://example.org) mit manchen +Sälen und anderen Dinge. Siehe +![Über mich](http://example.org)! + +> Vielleicht *höre*{:.red} ich nicht richtig? +{:.test} + +* Sollten wir uns das überl*egen*? *Verhöhne* mich nicht! +* Ho ho höher! Sind \*wir\* da? + +Titel sind urschön +================== + +## Manche mögens *ärmer* {#hot} + + öha + was nun? + +Töne +: Laute Geräusche +: vielleicht noch was ä*hnliches* + +| hoch | höher | am höchsten | +|----------------------------| +| über | drüber | müde | + +

    Das ist schön +gemacht

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/empty.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/empty.html new file mode 100644 index 000000000..56bac5384 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/empty.html @@ -0,0 +1,5 @@ +

    This is [] empty.

    + +

    This is [][] empty.

    + +

    This is [](test.html) empty.

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/empty.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/empty.text new file mode 100644 index 000000000..cca5de5f6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/empty.text @@ -0,0 +1,5 @@ +This is [] empty. + +This is [][] empty. + +This is [](test.html) empty. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/image_in_a.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/image_in_a.html new file mode 100644 index 000000000..e1f4ade52 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/image_in_a.html @@ -0,0 +1,5 @@ +

    Simple: Some alt text

    + +

    Nested: Some alt ![img](text.png) text

    + +

    Simple: Some text alt text text

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/image_in_a.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/image_in_a.text new file mode 100644 index 000000000..bdbfb65ee --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/image_in_a.text @@ -0,0 +1,5 @@ +Simple: [Some ![alt text](/images/other.png)](local.html) + +Nested: [Some ![alt ![img](text.png) text](/images/other.png)](local.html) + +Simple: [Some *text ![alt text](/images/other.png) text*](local.html) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/imagelinks.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/imagelinks.html new file mode 100644 index 000000000..ccf2f2796 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/imagelinks.html @@ -0,0 +1,14 @@ +

    Simple: alt text

    + +

    Simple with title: alt text

    + +

    Empty img link: alt text

    + +

    Reference style: alt text

    + +

    Reference style with title: alt text

    + +

    No alt text:

    + +

    No id: imgo

    + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/imagelinks.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/imagelinks.text new file mode 100644 index 000000000..0f4b29b71 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/imagelinks.text @@ -0,0 +1,16 @@ +Simple: ![alt text](/images/other.png) + +Simple with title: ![alt text](/images/other.png "title") + +Empty img link: ![alt text]() + +Reference style: ![alt text][img] + +Reference style with title: ![alt text][imgo] + +No alt text: ![](other.png) + +No id: ![imgo] + +[img]: other.png +[imgo]: other.png "Title" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/inline.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/inline.html new file mode 100644 index 000000000..0810bc76f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/inline.html @@ -0,0 +1,46 @@ +

    simple URL

    + +

    simple URL

    + +

    simple URL with formatting

    + +

    simple URL with single quoted title

    + +

    simple URL with double quoted title

    + +

    simple URL [with ] escaped

    + +

    simple URL with ] escaped

    + +

    simple URL [with] nested

    + +

    simple URL with [no](link.html) inside

    + +

    simple URL with parens

    + +

    simple URL with parens

    + +

    simple URL broken +on line

    + +

    simple URL with spaces

    + +

    simple URL with spaces

    + +

    simple URL with spaces

    + +

    simple leading/trailing spaces

    + +

    simple leading/trailing spaces

    + +

    simple leading/trailing spaces

    + +

    bad [URL not

    + +

    bad [URL with parens](something(new.html)

    + +

    bad [URL with empty title](something.html ‘’)

    + +

    bad [URL](

    + +

    bad [URL](no

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/inline.html.19 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/inline.html.19 new file mode 100644 index 000000000..8d00efa9e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/inline.html.19 @@ -0,0 +1,46 @@ +

    simple URL

    + +

    simple URL

    + +

    simple URL with formatting

    + +

    simple URL with single quoted title

    + +

    simple URL with double quoted title

    + +

    simple URL [with ] escaped

    + +

    simple URL with ] escaped

    + +

    simple URL [with] nested

    + +

    simple URL with [no](link.html) inside

    + +

    simple URL with parens

    + +

    simple URL with parens

    + +

    simple URL broken +on line

    + +

    simple URL with spaces

    + +

    simple URL with spaces

    + +

    simple URL with spaces

    + +

    simple leading/trailing spaces

    + +

    simple leading/trailing spaces

    + +

    simple leading/trailing spaces

    + +

    bad [URL not

    + +

    bad [URL with parens](something(new.html)

    + +

    bad [URL with empty title](something.html ‘’)

    + +

    bad [URL](

    + +

    bad [URL](no

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/inline.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/inline.text new file mode 100644 index 000000000..c70576466 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/inline.text @@ -0,0 +1,48 @@ +simple [URL]() + +simple [URL](something.html) + +simple [URL *with* formatting](something.html) + +simple [URL with single quoted title](something.html 'a t"itle') + +simple [URL with double quoted title](something.html "a t'itle") + +simple [URL \[with \] escaped](something.html) + +simple [URL with \] escaped](something.html) + +simple [URL [with] nested](something.html) + +simple [URL with [no](link.html) inside](something.html) + +simple [URL with parens](/something/to(do)) + +simple [URL with parens](/something/to(do "doit") + +simple [URL broken +on line](something.html +"title") + +simple [URL with spaces](with spaces.html) + +simple [URL with spaces](with spaces.html 'title') + +simple [URL with spaces](with (spaces).html) + +simple [leading/trailing spaces]( spaces.html) + +simple [leading/trailing spaces](spaces.html ) + +simple [leading/trailing spaces]( spaces.html ) + + +bad [URL [not](something.html) + +bad [URL with parens](something(new.html) + +bad [URL with empty title](something.html '') + +bad [URL]( + +bad [URL](no diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/link_defs.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/link_defs.html new file mode 100644 index 000000000..065ed530d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/link_defs.html @@ -0,0 +1,9 @@ +

    This is a para. +[id]: http://www.example.com/

    + +
    [4]: nourl
    +
    + +

    Points to 1 and 2 and 3 but not [4]

    + +

    Points to _.:,;!?-

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/link_defs.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/link_defs.text new file mode 100644 index 000000000..ef6789cad --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/link_defs.text @@ -0,0 +1,26 @@ +This is a para. +[id]: http://www.example.com/ + +[otherid1]: http://wwww.example.com/ "title 1" +[otherid2]: http://wwww.example.com/ 'title 2' +[otherid3]: +[otherid4]: 'title' +[otherid5]: some spaces.html +[otherid6]: some spaces.html 'title' +[otherid7]: some spaces + "title" + +[break]: http://www.example.com/test/asdf.html + 'Another title' + +[1]: ignored.url + [1]: one.url + [2]: two.url + [3]: three.url + [4]: nourl + +Points to [1] and [2] and [3] but not [4] + +[_.:,;!?-]: http://example.com + +Points to [_.:,;!?-] diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/links_with_angle_brackets.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/links_with_angle_brackets.html new file mode 100644 index 000000000..ecaa31e56 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/links_with_angle_brackets.html @@ -0,0 +1,3 @@ +

    This is a link.

    + +

    This is a link.

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/links_with_angle_brackets.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/links_with_angle_brackets.text new file mode 100644 index 000000000..2cf0ecece --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/links_with_angle_brackets.text @@ -0,0 +1,3 @@ +This is a [link](). + +This is a [link]( 'and title'). diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/reference.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/reference.html new file mode 100644 index 000000000..49afd2eec --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/reference.html @@ -0,0 +1,37 @@ + +

    simple URL and URL

    + +

    simple URL and URL

    + +

    simple 1 and isurl

    + +

    simple 1 and isurl

    + +

    this is [a holy isurl]

    + +

    no [resolution][] here and [here]

    + +

    with a break in +the text

    + +

    this not [isurl] and not [isurl]

    + +

    a Link with_BIG letters

    + +

    bad [no URL] d isurl

    + +

    [no url] invalid.html +[no url]:

    + +

    “title”

    + +

    test url but no title +test [urldef]

    + +

    [urldef]: some.url ‘title”

    + +

    some with spaces

    + +

    this is a ‘special’ occasion for /all/ of us

    + +

    this is predefined for URI

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/reference.html.19 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/reference.html.19 new file mode 100644 index 000000000..f6fed181e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/reference.html.19 @@ -0,0 +1,37 @@ + +

    simple URL and URL

    + +

    simple URL and URL

    + +

    simple 1 and isurl

    + +

    simple 1 and isurl

    + +

    this is [a holy isurl]

    + +

    no [resolution][] here and [here]

    + +

    with a break in +the text

    + +

    this not [isurl] and not [isurl]

    + +

    a Link with_BIG letters

    + +

    bad [no URL] d isurl

    + +

    [no url] invalid.html +[no url]:

    + +

    “title”

    + +

    test url but no title +test [urldef]

    + +

    [urldef]: some.url ‘title”

    + +

    some with spaces

    + +

    this is a ‘special’ occasion for /all/ of us

    + +

    this is predefined for URI

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/reference.options b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/reference.options new file mode 100644 index 000000000..efb4b0184 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/reference.options @@ -0,0 +1,3 @@ +:link_defs: + predefined: [predefined.html] + URI: [uri.html, My URI] diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/reference.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/reference.text new file mode 100644 index 000000000..9f39fa70e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/01_link/reference.text @@ -0,0 +1,53 @@ +[isurl]: someurl.html + [1]: otherurl.html + +simple [URL][1] and [URL][isurl] + +simple [URL] [1] and [URL] +[isurl] + +simple [1][] and [isurl][] + +simple [1] and [isurl] + +this is [a holy [isurl]] + +no [resolution][] here and [here] + +with a [break in +the text] + + [break in the text]: url.html + +this not \[isurl] and not [isurl\] + +a [Link with_BIG] letters + + [link WITH_big]: letters.html + 'This is the title' + +bad [no URL] d [isurl] + +[no url] invalid.html +[no url]: + +[URL but no title]: invalid.html + + "title" + +test [url but no title] +test [urldef] + +[urldef]: some.url 'title" + + +some [with spaces] + +[with spaces]: with spaces.html "title" + +this [is a 'special' occasion for /all/ of us] + +[is a 'special' occasion for /all/ of us]: occasion.html + + +this is [predefined] for [URI] diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/empty.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/empty.html new file mode 100644 index 000000000..127e69437 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/empty.html @@ -0,0 +1,3 @@ +

    This __is **empty.

    + +

    This **is empty.

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/empty.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/empty.text new file mode 100644 index 000000000..c99d053f4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/empty.text @@ -0,0 +1,3 @@ +This __is **empty. + +This ****is empty. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/errors.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/errors.html new file mode 100644 index 000000000..e62f03fd1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/errors.html @@ -0,0 +1,9 @@ +

    This is a *star.

    + +

    This is a **star.

    + +

    This is *a *star.

    + +

    This is *a star*.

    + +

    This** is** a star.

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/errors.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/errors.text new file mode 100644 index 000000000..e80e5eb47 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/errors.text @@ -0,0 +1,9 @@ +This is a *star. + +This is a **star. + +This is **a *star*. + +This is *a star\*. + +This** is** a star. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/nesting.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/nesting.html new file mode 100644 index 000000000..3d34cee16 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/nesting.html @@ -0,0 +1,41 @@ +
      +
    • test test
    • +
    • test test
    • +
    • test test
    • +
    • test test
    • +
    • test test
    • +
    • test test
    • +
    • test test
    • +
    • test test
    • +
    • test test
    • +
    • test test
    • +
    • test test
    • +
    • test test
    • +
    • test test
    • +
    • test test
    • +
    • test test
    • +
    • test test
    • +
    +
      +
    • ab
    • +
    • ab
    • +
    • abc
    • +
    • ab
    • +
    • ab
    • +
    • abc
    • +
    +
      +
    • _a_b
    • +
    • a_b_
    • +
    • a_b_c
    • +
    • __a__b
    • +
    • a__b__
    • +
    • a__b__c
    • +
    • a__2__c
    • +
    • a__2__3
    • +
    • 1__2__3
    • +
    +
      +
    • a _b_ c
    • +
    • a __b__ c
    • +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/nesting.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/nesting.text new file mode 100644 index 000000000..ba67e84b7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/nesting.text @@ -0,0 +1,36 @@ +- ***test test*** +- ___test test___ +- *test **test*** +- **test *test*** +- ***test* test** +- ***test** test* +- ***test* test** +- **test *test*** +- *test **test*** +- _test __test___ +- __test _test___ +- ___test_ test__ +- ___test__ test_ +- ___test_ test__ +- __test _test___ +- _test __test___ +^ +- *a*b +- a*b* +- a*b*c +- **a**b +- a**b** +- a**b**c +^ +- _a_b +- a_b_ +- a_b_c +- __a__b +- a__b__ +- a__b__c +- a__2__c +- a__2__3 +- 1__2__3 +^ +- *a _b_ c* +- **a __b__ c** diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/normal.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/normal.html new file mode 100644 index 000000000..f369d56ed --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/normal.html @@ -0,0 +1,46 @@ +

    This is so hard.

    + +

    This is so hard too.

    + +

    At start +At start

    + +

    At end +At end

    + +

    At start +At start

    + +

    At end +At end

    + +

    And nested.

    + +

    And nest**ed.

    + +

    And *nested* like this.

    + +

    And not_nest_ed.

    + +

    And nested.

    + +

    And nested.

    + +

    And neste.

    + +

    And lonely * here*.

    + +

    And lonely ** here**.

    + +

    And lonely ** here.

    + +

    ** and here**.

    + +

    And compli*cated * here

    + +

    Some**what more * **here

    + +

    Do it *this* way +Or this *this* way +Or that *that* way +Or that *that* way

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/normal.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/normal.text new file mode 100644 index 000000000..d5885df4a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/02_emphasis/normal.text @@ -0,0 +1,46 @@ +This *is* so **hard**. + +This _is_ so __hard__ too. + +*At* start +*At* start + +At *end* +At *end* + +_At_ start +_At_ start + +At _end_ +At _end_ + +And *nest**ed***. + +And *nest**ed*. + +And *nest**ed* like** this. + +And *not_nest_ed*. + +And ***nested***. + +And ___nested___. + +And **nest*e***. + +And lonely * here*. + +And lonely ** here**. + +And **lonely ** here**. + +** and here**. + +And **compli*cated \*** here + +Some***what* more * ***he*re + +Do it *\*this\** way +Or this \**this*\* way +Or that *\*that*\* way +Or that \**that\** way diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/empty.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/empty.html new file mode 100644 index 000000000..20c505195 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/empty.html @@ -0,0 +1,5 @@ +

    This is `` empty.

    + +

    This is ``empty.

    + +

    This is ````empty.

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/empty.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/empty.text new file mode 100644 index 000000000..cbb91529d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/empty.text @@ -0,0 +1,5 @@ +This is `` empty. + +This is ``empty. + +This is ````empty. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/errors.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/errors.html new file mode 100644 index 000000000..1d341a8f4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/errors.html @@ -0,0 +1 @@ +

    Not ended `span.

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/errors.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/errors.text new file mode 100644 index 000000000..7a948b41e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/errors.text @@ -0,0 +1 @@ +Not ended `span. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/highlighting.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/highlighting.html new file mode 100644 index 000000000..98c0b4aa4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/highlighting.html @@ -0,0 +1 @@ +

    You can say x = Class.new, for example.

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/highlighting.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/highlighting.text new file mode 100644 index 000000000..737329093 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/highlighting.text @@ -0,0 +1 @@ +You can say `x = Class.new`{:.language-ruby}, for example. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/normal.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/normal.html new file mode 100644 index 000000000..68eddbe8d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/normal.html @@ -0,0 +1,16 @@ +

    This is a simple span.

    + +

    With some<ht>&ml in it.

    + +

    And ` backticks.

    + +

    And ``some`` more.

    + +

    With backslash in\ it.

    + +

    This is a ` literal backtick. +As `are` these!

    + +

    No literal backtick.

    + +

    something

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/normal.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/normal.text new file mode 100644 index 000000000..10d06e2ff --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/03_codespan/normal.text @@ -0,0 +1,16 @@ +This is `a` simple span. + +With `some&ml` in it. + +And `` ` `` backticks. + +And ``` ``some`` ``` more. + +With backslash `in\` it. + +This is a ` literal backtick. +As \`are\` these! + +No `` literal backtick``. + +`something` diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/definitions.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/definitions.html new file mode 100644 index 000000000..9012cc069 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/definitions.html @@ -0,0 +1,17 @@ +

    Some para.

    + +
    +

    blockquote

    +
    + +
      +
    • a list +with some text
    • +
    + +
      +
    • other list
    • +
    +
    code
    +
    + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/definitions.latex b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/definitions.latex new file mode 100644 index 000000000..f6669766d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/definitions.latex @@ -0,0 +1,17 @@ +Some para. + +\begin{quote} +blockquote +\end{quote} + +\begin{itemize} +\item a list +with some text +\end{itemize} + +\begin{itemize} +\item other list +\end{itemize} +\begin{verbatim}code +\end{verbatim} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/definitions.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/definitions.text new file mode 100644 index 000000000..44b52e00b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/definitions.text @@ -0,0 +1,24 @@ +Some para. + +[^footnote]: ignored definition +[^footnote]: Some footnote text + +> blockquote + +[^other]: some + foot + + note text + +* a list + with some text + +[^tnote]: foot note + +* other list +^ + code + +[^1]: + > a blockquote + and some para diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/footnote_nr.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/footnote_nr.html new file mode 100644 index 000000000..513352126 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/footnote_nr.html @@ -0,0 +1,12 @@ +

    This is a footnote35. And another36.

    + +
    +
      +
    1. +

      Some text.

      +
    2. +
    3. +

      Some other text.

      +
    4. +
    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/footnote_nr.latex b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/footnote_nr.latex new file mode 100644 index 000000000..8f07dde0a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/footnote_nr.latex @@ -0,0 +1,2 @@ +This is a footnote\footnote{Some text.}. And another\footnote{Some other text.}. + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/footnote_nr.options b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/footnote_nr.options new file mode 100644 index 000000000..f606ecfa7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/footnote_nr.options @@ -0,0 +1 @@ +:footnote_nr: 35 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/footnote_nr.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/footnote_nr.text new file mode 100644 index 000000000..cad29357b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/footnote_nr.text @@ -0,0 +1,4 @@ +This is a footnote[^ab]. And another[^bc]. + +[^ab]: Some text. +[^bc]: Some other text. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/markers.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/markers.html new file mode 100644 index 000000000..3a5bc28b3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/markers.html @@ -0,0 +1,46 @@ +

    This is some *ref.1

    + +
    +

    a blockquote 2

    +
    + +
      +
    • and a list item 3
    • +
    + +

    And a header4

    + +

    A marker without a definition [^without].

    + +

    A marker 5 used twice1 and thrice1.

    + +
    +
      +
    1. +

      Some foot note text 2 3

      +
    2. +
    3. +

      other text +with more lines

      + +
      +

      and a quote

      +
      +

      +
    4. +
    5. +

      some text

      +
    6. +
    7. + +
      code block
      +continued here
      +
      +

      +
    8. +
    9. + +

      +
    10. +
    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/markers.latex b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/markers.latex new file mode 100644 index 000000000..fb5237ebb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/markers.latex @@ -0,0 +1,23 @@ +This is some *ref.\footnote{Some foot note text} + +\begin{quote} +a blockquote \footnote{other text +with more lines + +\begin{quote} +and a quote +\end{quote}} +\end{quote} + +\begin{itemize} +\item and a list item \footnote{some \emph{text}} +\end{itemize} + +\section*{And a header\footnote{\begin{verbatim}code block +continued here +\end{verbatim}}} + +A marker without a definition [\^{}without]. + +A marker \footnote{} used twice\footnote{Some foot note text} and thrice\footnote{Some foot note text}. + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/markers.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/markers.text new file mode 100644 index 000000000..cc2b19966 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/04_footnote/markers.text @@ -0,0 +1,26 @@ +This is some *ref.[^fn] + +[^fn]: Some foot note text + +> a blockquote [^3] + +* and a list item [^1] + +# And a header[^now] + +[^1]:some *text* +[^3]: other text + with more lines + + > and a quote + +A marker without a definition [^without]. + +A marker [^empty] used twice[^fn] and thrice[^fn]. + +[^now]: + + code block + continued here + +[^empty]: diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/across_lines.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/across_lines.html new file mode 100644 index 000000000..e7cec40f8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/across_lines.html @@ -0,0 +1 @@ +

    Link: test

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/across_lines.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/across_lines.text new file mode 100644 index 000000000..8f39d9599 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/across_lines.text @@ -0,0 +1,2 @@ +Link: test diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/invalid.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/invalid.html new file mode 100644 index 000000000..030552fc8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/invalid.html @@ -0,0 +1 @@ +

    This is some text

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/invalid.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/invalid.text new file mode 100644 index 000000000..383f0a83f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/invalid.text @@ -0,0 +1 @@ +This is some text diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/link_with_mailto.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/link_with_mailto.html new file mode 100644 index 000000000..7d0d6ad6a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/link_with_mailto.html @@ -0,0 +1 @@ +

    Link: text

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/link_with_mailto.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/link_with_mailto.text new file mode 100644 index 000000000..fb0161962 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/link_with_mailto.text @@ -0,0 +1 @@ +Link: text diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/markdown_attr.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/markdown_attr.html new file mode 100644 index 000000000..44158c3b9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/markdown_attr.html @@ -0,0 +1,6 @@ +

    This is text +This is *text* +This is text +This is text +This is *nothing* to fear about. +This is <http://example.com>.

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/markdown_attr.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/markdown_attr.text new file mode 100644 index 000000000..dcc10ff83 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/markdown_attr.text @@ -0,0 +1,6 @@ +This is *text* +This is *text* +This is *text* +This is *text* +This is *nothing* to *fear* about. +This is . diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/normal.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/normal.html new file mode 100644 index 000000000..dbafd46f8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/normal.html @@ -0,0 +1,34 @@ +

    Empty !

    + +

    title is a title.

    + +

    This is .

    + +

    This is comment.

    + +

    This is multiline comment.

    + +

    This is tag +now .

    + +

    This is tag + now.

    + +

    This is an empty tag.

    + +

    This is something strange.

    + +

    Auto-closing:

    + +

    Expanding:

    + +

    An invalid tag: <hR>

    + +

    A <p>block tag</p>.

    + +

    An invalid </closing> tag.

    + +

    A tag.

    + +

    An unclosed tag.

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/normal.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/normal.text new file mode 100644 index 000000000..d135a43c3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/05_html/normal.text @@ -0,0 +1,34 @@ +Empty ! + +title is a title. + +This is . + +This is comment. + +This is multiline comment. + +This is tag +now . + +This is tag + now. + +This is an empty tag. + +This is _something strange_. + +Auto-closing:
    + +Expanding: + +An invalid tag:
    + +A

    block tag

    . + +An invalid tag. + +A tag. + +An unclosed *tag.* diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/abbreviations/abbrev.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/abbreviations/abbrev.html new file mode 100644 index 000000000..0a3329e6f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/abbreviations/abbrev.html @@ -0,0 +1,19 @@ +

    This is some text.

    + +

    There is some real concern about OtHeR!

    + +

    is some Think empty about Oesterreich. CSS und CSS3

    + +

    no abbrev here because there is someone and kulis some

    + +
      +
    • (X)HTML test
    • +
    • line two
    • +
    + +

    (X)HTML

    + +
      +
    • test (X)HTML
    • +
    + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/abbreviations/abbrev.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/abbreviations/abbrev.text new file mode 100644 index 000000000..23c347e1b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/abbreviations/abbrev.text @@ -0,0 +1,27 @@ +This is some text. + +*[is some]: Yes it is +*[OtHeR!]: This & that + +*[is some]: It is, yes +*[empty]: + +There *is some real* concern about OtHeR! + +is some Think empty about Oesterreich. CSS und CSS3 + +no abbrev here because there is someone and kulis some + +*[Oesterreich]: Very nice country + +*[CSS]: Cascading +*[CSS3]: Cascading 3 + +* (X)HTML test +* line two + +[(X)HTML](http://en.wikipedia.org/wiki/Xhtml) + +* test (X)HTML + +*[(X)HTML]: (eXtensible) HyperText Markup Language diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/abbreviations/abbrev_defs.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/abbreviations/abbrev_defs.html new file mode 100644 index 000000000..108fcfcea --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/abbreviations/abbrev_defs.html @@ -0,0 +1,2 @@ +
    *[4]: noabbrev
    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/abbreviations/abbrev_defs.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/abbreviations/abbrev_defs.text new file mode 100644 index 000000000..3f3a0e5b6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/abbreviations/abbrev_defs.text @@ -0,0 +1,5 @@ +*[ABBR]: Some abbreviations + *[one abbr]: one abbrev + *[2 and other]: another + *[3]: yet another + *[4]: noabbrev diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/autolinks/url_links.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/autolinks/url_links.html new file mode 100644 index 000000000..d170eefaf --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/autolinks/url_links.html @@ -0,0 +1,14 @@ +

    This should be a http://www.example.com/ link. +This should be a john.doe@example.com link. +As should john.doe@example.com this. +As should CSS@example.com this. +Another ampersand http://www.example.com/?doit&x=y link. +More entities http://www.example.com/?doit&x="y&z=y.

    + +

    Email international übung@macht.den.meister.de, ü.äß@hülse.de +Email invalid: <me@example.com>

    + +

    Autolink with underscore: http://www.example.com/with_under_score

    + +

    http://www.example.com/

    + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/autolinks/url_links.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/autolinks/url_links.text new file mode 100644 index 000000000..f63e599b6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/autolinks/url_links.text @@ -0,0 +1,15 @@ +This should be a link. +This should be a link. +As should this. +As should this. +Another ampersand link. +More entities . + +Email international <übung@macht.den.meister.de>, <ü.äß@hülse.de> +Email invalid: <[me@example.com](mailtos:me@example.com)> + +Autolink with underscore: + + + +*[CSS]: Cascading diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/escaped_chars/normal.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/escaped_chars/normal.html new file mode 100644 index 000000000..015d59482 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/escaped_chars/normal.html @@ -0,0 +1,47 @@ +

    \

    + +

    .

    + +

    *

    + +

    _

    + +

    +

    + +

    -

    + +

    `

    + +

    (

    + +

    )

    + +

    [

    + +

    ]

    + +

    {

    + +

    }

    + +

    #

    + +

    !

    + +

    <<

    + +

    >>

    + +

    :

    + +

    |

    + +

    "

    + +

    '

    + +

    =

    + +

    >

    + +

    <

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/escaped_chars/normal.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/escaped_chars/normal.text new file mode 100644 index 000000000..1c47104ac --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/escaped_chars/normal.text @@ -0,0 +1,47 @@ +\\ + +\. + +\* + +\_ + +\+ + +\- + +\` + +\( + +\) + +\[ + +\] + +\{ + +\} + +\# + +\! + +\<< + +\>> + +\: + +\| + +\" + +\' + +\= + +\> + +\< diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/comment.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/comment.html new file mode 100644 index 000000000..3544d49fb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/comment.html @@ -0,0 +1,6 @@ +

    This is a paragraph. +This is a paragraph. +This is a . +This is a paragraph. +This is a {:/comment} simple {:/} paragraph. +This is a {::comment} paragraph.

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/comment.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/comment.text new file mode 100644 index 000000000..8b9e8d362 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/comment.text @@ -0,0 +1,6 @@ +This is a {::comment}simple{:/} paragraph. +This is a {::comment}simple{:/comment} paragraph. +This is a {::comment}simple {:/other} paragraph{:/comment}. +This is a {::comment/} paragraph. +This is a {:/comment} simple {:/} paragraph. +This is a {::comment} paragraph. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/ignored.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/ignored.html new file mode 100644 index 000000000..63c2c404c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/ignored.html @@ -0,0 +1 @@ +

    This is {::something}paragraph{:/}

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/ignored.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/ignored.text new file mode 100644 index 000000000..a7e77375f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/ignored.text @@ -0,0 +1 @@ +This is {::something}paragraph{:/} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/nomarkdown.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/nomarkdown.html new file mode 100644 index 000000000..83de93125 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/nomarkdown.html @@ -0,0 +1 @@ +

    This is *some* text.

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/nomarkdown.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/nomarkdown.text new file mode 100644 index 000000000..57c4b38fd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/nomarkdown.text @@ -0,0 +1 @@ +This is {::nomarkdown}*some*{:/} text. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/options.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/options.html new file mode 100644 index 000000000..48e3076a9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/options.html @@ -0,0 +1 @@ +

    This is an option *true*!

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/options.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/options.text new file mode 100644 index 000000000..e289491ef --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/extension/options.text @@ -0,0 +1 @@ +This is an {::options parse_span_html="false" /} option *true*! diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/ial/simple.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/ial/simple.html new file mode 100644 index 000000000..c0f3a4757 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/ial/simple.html @@ -0,0 +1,6 @@ +

    This is a span.

    + +

    This is a span.

    + +

    This is an{: .ignored} span ial. +This is an{: .escaped} span ial.

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/ial/simple.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/ial/simple.text new file mode 100644 index 000000000..8945602b2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/ial/simple.text @@ -0,0 +1,6 @@ +This is a `span`{: .hund #dog}. + +This is a `span`{: .hund #dog}{: .katz key='val'}. + +This is an{: .ignored} span ial. +This is an\{: .escaped} span ial. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/line_breaks/normal.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/line_breaks/normal.html new file mode 100644 index 000000000..da53e7e10 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/line_breaks/normal.html @@ -0,0 +1,11 @@ +

    This is a line
    +with a line break.

    + +

    This is a line +without a line break.

    + +

    This is a line
    +with a line\
    +break.

    + +

    Line break on last line.

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/line_breaks/normal.latex b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/line_breaks/normal.latex new file mode 100644 index 000000000..25782fa33 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/line_breaks/normal.latex @@ -0,0 +1,12 @@ +This is a line\newline +with a line break. + +This is a line +without a line break. + +This is a line \newline +with a line\textbackslash{} \newline +break. + +Line break on last line. + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/line_breaks/normal.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/line_breaks/normal.text new file mode 100644 index 000000000..92f866f2e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/line_breaks/normal.text @@ -0,0 +1,11 @@ +This is a line +with a line break. + +This is a line +without a line break. + +This is a line \\ +with a line\\ +break. + +Line break on last line. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/math/normal.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/math/normal.html new file mode 100644 index 000000000..8bf82b5d5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/math/normal.html @@ -0,0 +1,9 @@ +

    This is some math.

    + +

    inline math, $5.00 $$no math$$

    + +

    $$5+5$$ inline math

    + +

    + +

    $$5+5$$

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/math/normal.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/math/normal.text new file mode 100644 index 000000000..68dda6769 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/math/normal.text @@ -0,0 +1,9 @@ +This is $$\lambda_\alpha > 5$$ some math. + +$$5+5$$ inline math, $5.00 \$$no math$$ + +\$\$5+5$$ inline math + +\$$5+5$$ + +\$\$5+5$$ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities.html new file mode 100644 index 000000000..96b3b5ce2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities.html @@ -0,0 +1,6 @@ +

    This is the A&O. © 2008 by me +As well \& as this. Some ŗ other +values may ¯ may also show but +not st. like &#xYZ;.

    + +

    This is BS&T; done!

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities.options b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities.options new file mode 100644 index 000000000..036c56198 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities.options @@ -0,0 +1 @@ +:entity_output: :as_input diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities.text new file mode 100644 index 000000000..0446f4c51 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities.text @@ -0,0 +1,6 @@ +This is the A&O. © 2008 by me +As well \& as this. Some ŗ other +values may ¯ may also show but +not st. like &#xYZ;. + +This is BS&T; done! diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_char.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_char.html new file mode 100644 index 000000000..7507f751b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_char.html @@ -0,0 +1 @@ +

    This "is" 'the' A&O. © 2008 by me ŗ and λ

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_char.html.19 b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_char.html.19 new file mode 100644 index 000000000..ed2817bbe --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_char.html.19 @@ -0,0 +1 @@ +

    This "is" 'the' A&O. © 2008 by me ŗ and λ

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_char.options b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_char.options new file mode 100644 index 000000000..32a751e36 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_char.options @@ -0,0 +1,2 @@ +:entity_output: :as_char +:smart_quotes: apos,apos,quot,quot diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_char.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_char.text new file mode 100644 index 000000000..279b51152 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_char.text @@ -0,0 +1 @@ +This "is" 'the' A&O. © 2008 by me ŗ and λ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_input.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_input.html new file mode 100644 index 000000000..d2eec9dd6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_input.html @@ -0,0 +1 @@ +

    This is the A&O. © 2008 by me ŗ and λ

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_input.options b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_input.options new file mode 100644 index 000000000..036c56198 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_input.options @@ -0,0 +1 @@ +:entity_output: :as_input diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_input.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_input.text new file mode 100644 index 000000000..1ddf7cdd9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_as_input.text @@ -0,0 +1 @@ +This is the A&O. © 2008 by me ŗ and λ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_numeric.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_numeric.html new file mode 100644 index 000000000..d04613ee9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_numeric.html @@ -0,0 +1 @@ +

    This is the A&O. © 2008 by me ŗ and λ

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_numeric.options b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_numeric.options new file mode 100644 index 000000000..2e6e0a120 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_numeric.options @@ -0,0 +1 @@ +:entity_output: :numeric diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_numeric.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_numeric.text new file mode 100644 index 000000000..1ddf7cdd9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_numeric.text @@ -0,0 +1 @@ +This is the A&O. © 2008 by me ŗ and λ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_symbolic.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_symbolic.html new file mode 100644 index 000000000..258ba147a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_symbolic.html @@ -0,0 +1 @@ +

    This is the A&O. © 2008 by me ŗ and λ

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_symbolic.options b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_symbolic.options new file mode 100644 index 000000000..c195785fb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_symbolic.options @@ -0,0 +1 @@ +:entity_output: :symbolic diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_symbolic.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_symbolic.text new file mode 100644 index 000000000..1ddf7cdd9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/entities_symbolic.text @@ -0,0 +1 @@ +This is the A&O. © 2008 by me ŗ and λ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/greaterthan.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/greaterthan.html new file mode 100644 index 000000000..dcce4cc38 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/greaterthan.html @@ -0,0 +1 @@ +

    2 > 1 > 0

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/greaterthan.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/greaterthan.text new file mode 100644 index 000000000..7dfb7f123 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/greaterthan.text @@ -0,0 +1 @@ +2 > 1 > 0 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/lowerthan.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/lowerthan.html new file mode 100644 index 000000000..8ebac2370 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/lowerthan.html @@ -0,0 +1 @@ +

    0 < 1 < 2

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/lowerthan.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/lowerthan.text new file mode 100644 index 000000000..038df8bb4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/lowerthan.text @@ -0,0 +1 @@ +0 < 1 < 2 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/typography.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/typography.html new file mode 100644 index 000000000..0effd5b8d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/typography.html @@ -0,0 +1,30 @@ +

    This is… something—this too–!

    + +

    This «is» some text, « this » too!

    + +

    “Fancy quotes” are ‘cool’, even in the ’80s! +Je t’ aime. You’re a funny one! Thomas’ name +Mark’s name. “…you” +“‘Nested’ quotes are ‘possible’”, too! +‘“Otherway” is “round”’!

    + +

    ‘Opening now!’

    + +

    ’80s are really cool.

    + +

    Cluster’s Last Stand.

    + +

    Nam liber tempor +“…At vero eos et accusam”

    + +

    Single underscores should work.”

    + +

    Single asterisks should work.”

    + +

    Double underscores should work.’

    + +

    Double asterisks should work.’

    + +

    Hurrah!

    + +

    Absolutely.’

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/typography.options b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/typography.options new file mode 100644 index 000000000..4f1c17c63 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/typography.options @@ -0,0 +1 @@ +:entity_output: symbolic diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/typography.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/typography.text new file mode 100644 index 000000000..e4cdb411d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases/span/text_substitutions/typography.text @@ -0,0 +1,30 @@ +This is... something---this too--! + +This <> some text, << this >> too! + +"Fancy quotes" are 'cool', even in the '80s! +Je t' aime. You're a funny one! Thomas' name +Mark's name. "...you" +"'Nested' quotes are 'possible'", too! +'"Otherway" is "round"'! + +'Opening now!' + +'80s are really cool. + +Cluster's Last Stand. + +Nam liber tempor +"...At vero eos et accusam" + +"_Single underscores_ should work." + +"*Single asterisks* should work." + +'__Double underscores__ should work.' + +'**Double asterisks** should work.' + +"_Hurrah!_" + +'__Absolutely__.' diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/backticks_disable_highlighting.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/backticks_disable_highlighting.html new file mode 100644 index 000000000..8390d097a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/backticks_disable_highlighting.html @@ -0,0 +1,2 @@ +
    Kramdown::Document.new(text, :input => 'GFM')
    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/backticks_disable_highlighting.options b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/backticks_disable_highlighting.options new file mode 100644 index 000000000..72e9bc1ee --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/backticks_disable_highlighting.options @@ -0,0 +1 @@ +:enable_coderay: false diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/backticks_disable_highlighting.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/backticks_disable_highlighting.text new file mode 100644 index 000000000..98cf3a858 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/backticks_disable_highlighting.text @@ -0,0 +1,3 @@ +```ruby +Kramdown::Document.new(text, :input => 'GFM') +``` diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/backticks_syntax.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/backticks_syntax.html new file mode 100644 index 000000000..3cac9f5c7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/backticks_syntax.html @@ -0,0 +1,20 @@ +
    Three backticks
    +
    + +
    Four backticks
    +
    + +
    Unbalanced bottom heavy
    +
    + +
    +
    1language no space
    +
    +
    +
    + +
    +
    1language with space
    +
    +
    +
    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/backticks_syntax.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/backticks_syntax.text new file mode 100644 index 000000000..fb5c6111f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/backticks_syntax.text @@ -0,0 +1,19 @@ +``` +Three backticks +``` + +```` +Four backticks +```` + +``` +Unbalanced bottom heavy +`````` + +````ruby +language no space +```` + +```` ruby +language with space +```` diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/two_para_hard_line_breaks.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/two_para_hard_line_breaks.html new file mode 100644 index 000000000..a7470bcc5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/two_para_hard_line_breaks.html @@ -0,0 +1,4 @@ +

    This is just a normal paragraph.
    +Containing a line break.

    + +

    Another paragraph.

    diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/two_para_hard_line_breaks.text b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/two_para_hard_line_breaks.text new file mode 100644 index 000000000..e152d5d6d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/kramdown-1.2.0/test/testcases_gfm/two_para_hard_line_breaks.text @@ -0,0 +1,4 @@ +This is just a normal paragraph. +Containing a line break. + +Another paragraph. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/.gitignore b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/.gitignore new file mode 100644 index 000000000..8d28949da --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/.gitignore @@ -0,0 +1,32 @@ +*.gem +*.rbc +.bundle +.config +coverage +coverage.data +InstalledFiles +lib/bundler/man +pkg +rdoc +spec/reports +test/tmp +test/version_tmp +tmp + +# bundler +vendor/ + +# YARD artifacts +.yardoc +_yardoc +doc/ + +# tmp-old +.old + +# editor +*~ +.redcar + +# other +*.lock diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/.travis.yml b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/.travis.yml new file mode 100644 index 000000000..25e3162b2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/.travis.yml @@ -0,0 +1,14 @@ +language: ruby +rvm: + - ruby-head + - 1.9.3 + - 1.9.2 + - rbx-19mode + - jruby-head + - jruby-19mode + +matrix: + allow_failures: + - rvm: rbx-19mode + - rvm: jruby-head + - rvm: jruby-19mode diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/.yardopts b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/.yardopts new file mode 100644 index 000000000..29fa7c836 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/.yardopts @@ -0,0 +1 @@ +--readme README.md lib/**/*.rb - LICENSE \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/Gemfile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/Gemfile new file mode 100644 index 000000000..8325fe04e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/Gemfile @@ -0,0 +1,12 @@ +source 'https://rubygems.org' + +gemspec + +group :development do + gem 'rake' + gem 'yard', '~>0.8.2.1' +end + +group :test do + gem 'rake' +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/History.rdoc b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/History.rdoc new file mode 100644 index 000000000..49d65bedd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/History.rdoc @@ -0,0 +1,16 @@ +=== 0.0.3 2012-09-14 + +* modify: + * file-tree lettercase/ext -> lettercase/core_ext + * development dependency + +=== 0.0.2 2012-04-18 + +* modify: + * devide /ext.rb for handle name space(String, Symbol) + +=== 0.0.1 2012-04-04 + +* 1 major enhancement: + * Initial release + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/LICENSE b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/LICENSE new file mode 100644 index 000000000..695e49900 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/LICENSE @@ -0,0 +1,22 @@ +(The MIT X11 License) + +Copyright (C) 2012 Kenichi Kamiya + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/Manifest.txt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/Manifest.txt new file mode 100644 index 000000000..5cfe08c8a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/Manifest.txt @@ -0,0 +1,21 @@ +README.md +LICENSE +History.rdoc +Manifest.txt +Rakefile +Gemfile +lettercase.gemspec + +lib/lettercase.rb +lib/lettercase/version.rb +lib/lettercase/constants.rb +lib/lettercase/stringextension.rb +lib/lettercase/symbolextension.rb +lib/lettercase/stringableextension.rb +lib/lettercase/singleton_class.rb +lib/lettercase/core_ext.rb + +test/helper.rb +test/test_lettercase.rb + +example/README.rb diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/README.md b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/README.md new file mode 100644 index 000000000..1d18c609f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/README.md @@ -0,0 +1,69 @@ +lettercase +========== + +[![Build Status](https://secure.travis-ci.org/kachick/lettercase.png)](http://travis-ci.org/kachick/lettercase) + +Description +----------- + +Convert some letter cases around programming. + +Features +-------- + +* snake_case +* camelCase +* PascalCase + +* PureRuby :) + +Usage +----- + +### Introduction + +```ruby +require 'lettercase' + +LetterCase.pascalize 'letter_case' #=> "LetterCase" + +require 'lettercase/core_ext' + +'LetterCase'.snakecase #=> "letter_case" +'letter_case'.camelcase #=> "letterCase" +'letter_case'.pascalcase #=> "LetterCase" + +# Aliases: Method name describes to self role +'lettercase'.UPCASE #=> "LETTERCASE" +'LetterCase'.snake_case #=> "letter_case" +'letter_case'.camelCase #=> "letterCase" +'letter_case'.PascalCase #=> "LetterCase" +``` + +Requirements +------------- + +* Ruby - [1.9.2 or later](http://travis-ci.org/#!/kachick/lettercase) + +Install +------- + +```bash +$ gem install lettercase +``` + +Link +---- + +* [code](https://github.com/kachick/lettercase) +* [API](http://kachick.github.com/lettercase/yard/frames.html) +* [issues](https://github.com/kachick/lettercase/issues) +* [CI](http://travis-ci.org/#!/kachick/lettercase) +* [gem](https://rubygems.org/gems/lettercase) + +License +-------- + +The MIT X11 License +Copyright (C) 2012 Kenichi Kamiya +See the file LICENSE for further details. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/Rakefile new file mode 100644 index 000000000..f2ad2e125 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/Rakefile @@ -0,0 +1,11 @@ +#!/usr/bin/env rake +require 'bundler/gem_tasks' + +require 'rake/testtask' + +task default: [:test] + +Rake::TestTask.new do |tt| + tt.verbose = true +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/example/README.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/example/README.rb new file mode 100644 index 000000000..4424b70b2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/example/README.rb @@ -0,0 +1,32 @@ +$VERBOSE = true + +require_relative '../lib/lettercase' + +p LetterCase.pascalize('letter_case') #=> "LetterCase" + +require_relative '../lib/lettercase/ext' + +# * basic +p 'LetterCase'.snakecase #=> "letter_case" +p 'letter_case'.camelcase #=> "letterCase" +p 'letter_case'.pascalcase #=> "LetterCase" + +# * aliases (method name describes your self) +p 'lettercase'.UPCASE #=> "LETTERCASE" +p 'LetterCase'.snake_case #=> "letter_case" +p 'letter_case'.camelCase #=> "letterCase" +p 'letter_case'.PascalCase #=> "LetterCase" + +# * Symbol too +p :'letter_case'.PascalCase #=> :LetterCase + +# * can use your stringable classes (must have #to_str method) +class LikeString + include LetterCase::StringableExtension + + def to_str + 'aBc' + end +end + +p LikeString.new.snake_case #=> "a_bc" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lettercase.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lettercase.gemspec new file mode 100644 index 000000000..b81584c2a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lettercase.gemspec @@ -0,0 +1,21 @@ +require File.expand_path('../lib/lettercase/version', __FILE__) + +Gem::Specification.new do |gem| + gem.authors = ['Kenichi Kamiya'] + gem.email = ['kachick1+ruby@gmail.com'] + gem.description = %q{Convert some letter cases around programming.} + gem.summary = %q{Convert some letter cases around programming.} + gem.homepage = 'https://github.com/kachick/lettercase' + + gem.files = `git ls-files`.split($\) + gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } + gem.test_files = gem.files.grep(%r{^(test|spec|features|declare)/}) + gem.name = 'lettercase' + gem.require_paths = ['lib'] + gem.version = LetterCase::VERSION.dup # dup for https://github.com/rubygems/rubygems/commit/48f1d869510dcd325d6566df7d0147a086905380#-P0 + + gem.required_ruby_version = '>= 1.9.2' + + gem.add_development_dependency 'yard', '~> 0.8.2.1' +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase.rb new file mode 100644 index 000000000..50cfa56c6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase.rb @@ -0,0 +1,8 @@ +# Copyright (C) 2012 Kenichi Kamiya + +require_relative 'lettercase/version' +require_relative 'lettercase/constants' +require_relative 'lettercase/stringextension' +require_relative 'lettercase/symbolextension' +require_relative 'lettercase/stringableextension' +require_relative 'lettercase/singleton_class' diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/constants.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/constants.rb new file mode 100644 index 000000000..f200450a2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/constants.rb @@ -0,0 +1,7 @@ +module LetterCase + + # @return [String] + DELIMITER = '_'.freeze + private_constant :DELIMITER if respond_to? :private_constant + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/core_ext.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/core_ext.rb new file mode 100644 index 000000000..1b2e738c9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/core_ext.rb @@ -0,0 +1,13 @@ +require_relative '../lettercase' + +class String + + include LetterCase::StringExtension + +end + +class Symbol + + include LetterCase::SymbolExtension + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/singleton_class.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/singleton_class.rb new file mode 100644 index 000000000..ef3b94930 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/singleton_class.rb @@ -0,0 +1,19 @@ +module LetterCase + + class << self + + { + :snakelize => :snakecase, + :force_pascalize => :force_pascalcase, + :pascalize => :pascalcase, + :camelize => :camelcase + }.each_pair do |via, after| + define_method via do |stringlike| + ret = stringlike.to_s.dup.extend(StringExtension).__send__ after + stringlike.kind_of?(Symbol) ? ret.to_sym : ret + end + end + + end + +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/stringableextension.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/stringableextension.rb new file mode 100644 index 000000000..76878f4a2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/stringableextension.rb @@ -0,0 +1,15 @@ +require_relative 'stringextension' + +module LetterCase + + module StringableExtension + + StringExtension.instance_methods.each do |method| + define_method method do + to_str.__send__ method + end + end + + end + +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/stringextension.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/stringextension.rb new file mode 100644 index 000000000..702df69d5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/stringextension.rb @@ -0,0 +1,49 @@ +module LetterCase + + module StringExtension + + # @return [String] + def UPCASE + upcase + end + + # @return [String] + def snakecase + gsub(/([a-z])([A-Z])/) {[$1, $2].join DELIMITER}.downcase + end + + alias_method :snake_case, :snakecase + + # @return [String] + def force_pascalcase + split(DELIMITER).map(&:capitalize).join + end + + # @return [String] + def pascalcase + gsub(/\w+/) {|s|s.extend(StringExtension).force_pascalcase} + end + + alias_method :PascalCase, :pascalcase + + # @return [String] + def camelcase + gsub(/\w+/) {|chunk| + ''.tap {|s| + chunk.split(DELIMITER).each_with_index do |word, index| + s << case index + when 0 + word.downcase + else + word.extend(StringExtension).force_pascalcase + end + end + } + } + end + + alias_method :camelCase, :camelcase + + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/symbolextension.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/symbolextension.rb new file mode 100644 index 000000000..020465514 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/symbolextension.rb @@ -0,0 +1,15 @@ +require_relative 'stringextension' + +module LetterCase + + module SymbolExtension + + StringExtension.instance_methods.each do |method| + define_method method do + to_s.__send__(method).to_sym + end + end + + end + +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/version.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/version.rb new file mode 100644 index 000000000..237b8449c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/lib/lettercase/version.rb @@ -0,0 +1,5 @@ +module LetterCase + + VERSION = '0.0.3'.freeze + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/test/helper.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/test/helper.rb new file mode 100644 index 000000000..f7ade2533 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/test/helper.rb @@ -0,0 +1,6 @@ +require 'test/unit' + +$VERBOSE = true + +require_relative '../lib/lettercase' +require_relative '../lib/lettercase/core_ext' diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/test/test_lettercase.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/test/test_lettercase.rb new file mode 100644 index 000000000..58f6592c5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/lettercase-0.0.3/test/test_lettercase.rb @@ -0,0 +1,21 @@ +require_relative 'helper' + +class TestLetterCase < Test::Unit::TestCase + + def test_symbol_included_line + sample = ' a tiny library :) ... reAly? ' + + assert_equal ' a tiny library :) ... re_aly? ', sample.snake_case + assert_equal ' A Tiny Library :) ... Realy? ', sample.PascalCase + assert_equal ' a tiny library :) ... realy? ', sample.camelCase + end + + def test_method_name_like + sample = 'method_name_like' + + assert_equal 'method_name_like', sample.snake_case + assert_equal 'MethodNameLike', sample.PascalCase + assert_equal 'methodNameLike', sample.camelCase + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/.gitignore b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/.gitignore new file mode 100644 index 000000000..7705e3514 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/.gitignore @@ -0,0 +1,18 @@ +*.gem +*.rbc +.bundle +.config +.yardoc +Gemfile.lock +InstalledFiles +_yardoc +coverage +doc/ +lib/bundler/man +pkg +rdoc +spec/reports +test/tmp +test/version_tmp +tmp +html/ \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/.simplecov b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/.simplecov new file mode 100644 index 000000000..666f1c2d0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/.simplecov @@ -0,0 +1,8 @@ +require 'coveralls' +Coveralls.wear! +SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ + SimpleCov::Formatter::HTMLFormatter, + Coveralls::SimpleCov::Formatter +] +SimpleCov.command_name 'bacon' +SimpleCov.start {add_filter 'test'} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/.travis.yml b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/.travis.yml new file mode 100644 index 000000000..23e1a15f3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/.travis.yml @@ -0,0 +1,8 @@ +language: ruby +rvm: + - "1.9.2" + - "1.9.3" + - "2.0.0" + - jruby-19mode # JRuby in 1.9 mode + - rbx-19mode +script: rake test diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/Gemfile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/Gemfile new file mode 100644 index 000000000..ffe243345 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/Gemfile @@ -0,0 +1,7 @@ +source 'https://rubygems.org' + +# Specify your gem's dependencies in forwardablex.gemspec +gemspec + +gem 'simplecov', :require => false, :group => :test +gem 'coveralls', :require => false, :group => :test diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/LICENSE.txt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/LICENSE.txt new file mode 100644 index 000000000..4c2d27c09 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2013 Keita Yamaguchi + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/README.md b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/README.md new file mode 100644 index 000000000..74ca5c8a3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/README.md @@ -0,0 +1,99 @@ +# naming + +naming is a Ruby library for generating classes that consist from name and +value. You can name objects and collect values by it. + +[![Gem Version](https://badge.fury.io/rb/naming.png)](http://badge.fury.io/rb/naming) [![Build Status](https://travis-ci.org/keita/naming.png?branch=master)](https://travis-ci.org/keita/naming) [![Coverage Status](https://coveralls.io/repos/keita/naming/badge.png?branch=master)](https://coveralls.io/r/keita/naming) [![Code Climate](https://codeclimate.com/github/keita/naming.png)](https://codeclimate.com/github/keita/naming) + +## Installation + + $ gem install naming + +## Usage + +### Basic + +```ruby +# +# naming object of A with the value 123 +# +a = Naming.A(123) +a.value #=> 123 +a.name #=> :A +a.class #=> Naming::A +```` + +### Collect values by name from array + +```ruby +# +# collect objects by name +# +list = [ + Naming.A(1), + Naming.B(2), + "abc", + Naming.A(3), + 123, + nil +] +# collect values of A objects +Naming::A.values(list) #=> [1, 3] +# collect values of B objects +Naming::B.values(list) #=> [2] +# collect objects excluding naming objects +Naming.others(list) #=> ["abc", 123, nil] +``` + +### Case Selecting + +```ruby +# +# case control flow with name +# +def message(obj) + case obj + when Naming::A + "This is case A: %s" % obj.value + when Naming::B + "This is case B: %s" % obj.value + else + "This is case others: %s" % obj + end +end +message(Naming.A(1)) #=> "This is case A: 1" +message(Naming.B(2)) #=> "This is case B: 2" +message(true) #=> "This is case others: true" +``` + +### Name Set + +```ruby +# +# collect objects by name set +# +list = [ + Naming.A(1), + Naming.B(2), + "abc", + Naming.C(3), + 123, + nil +] +# collect values of A and B +Naming[:A, :B].values(list) #=> [1, 2] +# collect others +Naming[:A, :B].others(list) #=> ["abc", Naming.C(3), 123, nil] +``` + +## License + +naming is free software distributed under MIT license. + +## Contributing + +1. Fork it +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin my-new-feature`) +5. Create new Pull Request diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/Rakefile new file mode 100644 index 000000000..fc493f4a6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/Rakefile @@ -0,0 +1,18 @@ +require "bundler/gem_tasks" + +desc 'Test specs' +task 'test' do + sh "bundle exec bacon -r simplecov -a" +end + +desc 'Generate API document' +task 'html' do + sh "bundle exec yard doc -o html --hide-void-return --no-api" +end + +desc 'Show undocumented function list' +task 'html:undoc' do + sh "bundle exec yard stats --list-undoc --no-api --compact" +end + +task :default => :test diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/lib/naming.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/lib/naming.rb new file mode 100644 index 000000000..2bd070620 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/lib/naming.rb @@ -0,0 +1,106 @@ +require 'set' + +require 'forwardablex' +require 'structx' + +require 'naming/version' +require 'naming/meta' +require 'naming/name-set' + +# Naming is a module for generating naming classes that consist by name and +# value. Naming classes are generated dynamically when you refer it. +# +# @example +# # +# # naming object of A with the value 123 +# # +# a = Naming.A(123) +# a.value #=> 123 +# a.name #=> :A +# a.class #=> Naming::A +# @example +# # +# # collect objects by name +# # +# list = [ +# Naming.A(1), +# Naming.B(2), +# "abc", +# Naming.A(3), +# 123, +# nil +# ] +# # collect values of A objects +# Naming::A.values(list) #=> [1, 3] +# # collect values of B objects +# Naming::B.values(list) #=> [2] +# # collect objects excluding naming objects +# Naming.others(list) #=> ["abc", 123, nil] +# @example +# # +# # case control flow with name +# # +# def message(obj) +# case obj +# when Naming::A +# "This is case A: %s" % obj.value +# when Naming::B +# "This is case B: %s" % obj.value +# else +# "This is case others: %s" % obj +# end +# end +# message(Naming.A(1)) #=> "This is case A: 1" +# message(Naming.B(2)) #=> "This is case B: 2" +# message(true) #=> "This is case others: true" +module Naming + class << self + # Generate a new naming class and call the constructor with value. + # + # @api private + def method_missing(name, *args) + const_get(name) + send(name, *args) + end + + # Generate a new naming class. + # + # @api private + def const_missing(name) + cls = Class.new(Meta) + self.singleton_class.class_exec do + define_method(name) do |value| + cls.new(value) + end + end + const_set(name, cls) + end + + # Collect objects from the array excluding naming objects. + # + # @param array [Array] + # collection target array + # + # @example + # Naming.others([ + # Naming.A(1), + # Naming.B(2), + # "abc", + # Naming.A(3), + # 123, + # nil + # ]) #=> ["abc", 123, nil] + def others(array) + array.select{|elt| not(elt.kind_of?(Meta))} + end + + # Return the name set object. + # + # @param names [Array] + # names + # @return [NameSet] + def [](*names) + NameSet.new(*names) + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/lib/naming/meta.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/lib/naming/meta.rb new file mode 100644 index 000000000..7c9091bee --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/lib/naming/meta.rb @@ -0,0 +1,58 @@ +module Naming + # Meta is a container of name and value. This is super class of all naming + # classes. + class Meta < StructX + class << self + # Extract values which have the same name from the array. + # + # @param array [Array] + # target of value extraction + # + # @example + # Naming::A.values([ + # Naming.A(1), + # Naming.B(2), + # "abc", + # Naming.A(3), + # 123, + # nil + # ]) #=> [1, 3] + def values(array) + array.select{|elt| elt.kind_of?(self)}.map{|elt| elt.value} + end + + # Collect objects from the array excluding named objects which have the + # same name. + # + # @param array [Array] + # target of value extraction + # + # @example + # Naming::A.values([ + # Naming.A(1), + # Naming.B(2), + # "abc", + # Naming.A(3), + # 123, + # nil + # ]) #=> [Naming.B(2), "abc", 123, nil] + def others(array) + array.select{|elt| not(elt.kind_of?(self))} + end + + # Return the name as symbol. It is just name, doesn't include module path. + # + # @return [Symbol] + # the name + # + # @example + # Naming::A.name #=> :A + def name + self.to_s.split("::").last.to_sym + end + end + + forward :class, :name + member :value + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/lib/naming/name-set.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/lib/naming/name-set.rb new file mode 100644 index 000000000..22a4282ed --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/lib/naming/name-set.rb @@ -0,0 +1,48 @@ +module Naming + # NameSet is a set for names. This class is used for getting values of multipule names. + class NameSet < Set + # @param names [Array] + # element names of the set + def initialize(*names, &b) + elts = names.map {|name| name.kind_of?(Symbol) ? Naming.const_get(name) : name} + super(elts, &b) + end + + # Extract values which have the same name from the array. + # + # @param array [Array] + # target of value extraction + # + # @example + # Naming::NameSet.new(:A, :B).values([ + # Naming.A(1), + # Naming.B(2), + # "abc", + # Naming.A(3), + # 123, + # nil + # ]) #=> [1, 2, 3] + def values(array) + array.select{|elt| any?{|name| elt.kind_of?(name)}}.map{|elt| elt.value} + end + + # Collect objects from the array excluding named objects which have the + # name in the set. + # + # @param array [Array] + # target of value extraction + # + # @example + # Naming::NameSet(:A, :B).values([ + # Naming.A(1), + # Naming.B(2), + # "abc", + # Naming.A(3), + # 123, + # nil + # ]) #=> ["abc", 123, nil] + def others(array) + array.select{|elt| not(any?{|name| elt.kind_of?(name)})} + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/lib/naming/version.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/lib/naming/version.rb new file mode 100644 index 000000000..17fd5ad12 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/lib/naming/version.rb @@ -0,0 +1,4 @@ +module Naming + # version of this library + VERSION = "0.1.0" +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/naming.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/naming.gemspec new file mode 100644 index 000000000..be6fe82ac --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/naming.gemspec @@ -0,0 +1,27 @@ +# -*- ruby -*- +# -*- encoding: utf-8 -*- +lib = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'naming/version' + +Gem::Specification.new do |gem| + gem.name = "naming" + gem.version = Naming::VERSION + gem.authors = ["Keita Yamaguchi"] + gem.email = ["keita.yamaguchi@gmail.com"] + gem.description = "naming provides name and value container with useful functions" + gem.summary = "naming provides name and value container with useful functions" + gem.homepage = "https://github.com/keita/naming" + + gem.files = `git ls-files`.split($/) + gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } + gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) + gem.require_paths = ["lib"] + + gem.add_dependency "forwardablex", "~> 0.1.4" + gem.add_dependency "structx", "~> 0.1.0" + + gem.add_development_dependency "bacon" + gem.add_development_dependency "yard" + gem.add_development_dependency "redcarpet" unless RUBY_ENGINE == 'jruby' +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/test/spec_naming.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/test/spec_naming.rb new file mode 100644 index 000000000..c46ea2fd8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/naming-0.1.0/test/spec_naming.rb @@ -0,0 +1,92 @@ +require 'naming' + +$list = [ + Naming.A(1), + Naming.B(2), + "abc", + Naming.A(3), + 123, + nil +] + +describe 'Naming' do + it 'should generate a class dynamically' do + Naming::A.should.be.kind_of Class + end + + it 'should have name' do + Naming::A.name.should == :A + Naming.A(1).name.should == :A + end + + it 'should have value' do + Naming.A(1).value.should == 1 + Naming.A(true).value.should == true + Naming.A("str").value.should == "str" + end + + it 'should filter by name' do + Naming::A.values($list).should == [1, 3] + Naming::B.values($list).should == [2] + Naming.others($list).should == ["abc", 123, nil] + end + + it 'should equal when the names and values are same' do + Naming.A(1).should == Naming.A(1) + end + + it 'should not equal when names are different' do + Naming.A(1).should.not == Naming.B(1) + end + + it 'should not equal when values are different' do + Naming.A(1).should.not == Naming.A(2) + end + + it 'should get the name set' do + Naming[:A, :B].should.kind_of(Naming::NameSet) + Naming[:A, :B].should.include(Naming::A) + Naming[:A, :B].should.include(Naming::B) + end +end + +describe "Naming::Meta" do + it "should get values" do + Naming::A.values($list).should == [1, 3] + end + + it "should get others" do + Naming::A.others($list).should == [Naming.B(2), "abc", 123, nil] + end + + it "should get the name" do + Naming::A.name.should == :A + end +end + +describe "Naming::NameSet" do + before do + @set = Naming::NameSet.new(:A, :B) + end + + it 'should be a set' do + @set.should.kind_of(Set) + end + + it 'should include element names' do + @set.should.include Naming::A + @set.should.include Naming::B + end + + it "should not include other names" do + @set.should.not.include Naming::C + end + + it 'should get the values' do + @set.values($list).should == [1, 2, 3] + end + + it 'should get other values' do + @set.others($list).should == ["abc", 123, nil] + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/.autotest b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/.autotest new file mode 100644 index 000000000..c18396198 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/.autotest @@ -0,0 +1,14 @@ +# autotest config for rspec +# see: https://github.com/rspec/rspec/wiki/autotest +Autotest.add_hook(:initialize) {|at| + at.add_exception %r{^\.git} # ignore Version Control System + at.add_exception %r{^pkg} # ignore gem pkg dir + # at.add_exception %r{^./tmp} # ignore temp files, lest autotest will run again, and again... + # at.clear_mappings # take out the default (test/test*rb) + ## include specs + at.add_mapping(%r{^lib/.*\.rb$}) {|f, _| + Dir['spec/**/*_spec.rb'] + } + nil +} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/.document b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/.document new file mode 100644 index 000000000..ecf367319 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/.document @@ -0,0 +1,5 @@ +README.rdoc +lib/**/*.rb +bin/* +features/**/*.feature +LICENSE diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/ChangeLog b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/ChangeLog new file mode 100644 index 000000000..763bec4c7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/ChangeLog @@ -0,0 +1,3 @@ +0.9.6 add changelog, license + +0.9.5 don't count hyper thread by default windows [TODO check linux ] \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/Gemfile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/Gemfile new file mode 100644 index 000000000..f12eca2f5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/Gemfile @@ -0,0 +1,3 @@ +source "http://rubygems.org" + +#gem 'rspec', ">= 2" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/Gemfile.lock b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/Gemfile.lock new file mode 100644 index 000000000..c94012ced --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/Gemfile.lock @@ -0,0 +1,29 @@ +PATH + remote: . + +GEM + remote: http://rubygems.org/ + specs: + diff-lcs (1.1.2) + git (1.2.5) + jeweler (1.6.0) + bundler (~> 1.0.0) + git (>= 1.2.5) + rake + rake (0.8.7) + rspec (2.5.0) + rspec-core (~> 2.5.0) + rspec-expectations (~> 2.5.0) + rspec-mocks (~> 2.5.0) + rspec-core (2.5.1) + rspec-expectations (2.5.0) + diff-lcs (~> 1.1.2) + rspec-mocks (2.5.0) + +PLATFORMS + ruby + x86-mingw32 + +DEPENDENCIES + jeweler + rspec (>= 2.0) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/LICENSE b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/LICENSE new file mode 100644 index 000000000..1eb47bcec --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/LICENSE @@ -0,0 +1,8 @@ +The MIT License (MIT) +Copyright (c) 2012 Roger Pack + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/README.rdoc b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/README.rdoc new file mode 100644 index 000000000..2ca3044c1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/README.rdoc @@ -0,0 +1,73 @@ +The OS gem allows for some easy telling if you're on windows or not. + + require 'os' + + >> OS.windows? + => true # or OS.doze? + + >> OS.bits + => 32 + + >> OS.java? + => true # if you're running in jruby. Also OS.jruby? + + >> OS.ruby_bin + => "c:\ruby18\bin\ruby.exe" # or "/usr/local/bin/ruby" or what not + + >> OS.posix? + => false # true for linux, os x, cygwin + + >> OS.mac? # or OS.osx? or OS.x? + => false + + >> OS.dev_null + => "NUL" # or "/dev/null" depending on which platform + + >> OS.rss_bytes + => 12300033 # number of rss bytes this process is using currently. Basically "total in memory footprint" (doesn't include RAM used by the process that's in swap/page file) + + >> puts OS.report + ==> # a yaml report of helpful values + --- + arch: x86_64-darwin10.6.0 + target_os: darwin10.6.0 + target_vendor: apple + target_cpu: x86_64 + target: x86_64-apple-darwin10.6.0 + host_os: darwin10.6.0 + host_vendor: apple + host_cpu: i386 + host: i386-apple-darwin10.6.0 + RUBY_PLATFORM: x86_64-darwin10.6.0 + + >> OS.cpu_count + => 2 # number of cores, doesn't include hyper-threaded cores. + + >> OS.open_file_command + => "start" # or open on mac, or xdg-open on linux (all designed to open a file) + + >> OS::Underlying.windows? + => true # true for cygwin or MRI, whereas OS.windows? is false for cygwin + + >> OS::Underlying.bsd? + => true # true for OS X + +If there are any other features you'd like, let me know, I'll do what I can to add them :) + +http://github.com/rdp/os for feedback et al + +Related projects: + +rubygems: + Gem::Platform.local + Gem.ruby + +the facets gem (has a class similar to rubygems, above) + require 'facets/platform' + Platform.local + +the "platform" gem, itself (a different gem) + +The reason Gem::Platform.local felt wrong to me is that it treated cygwin as windows--which for most build environments, is wrong. Hence the creation of this. + +License: MIT (see LICENSE file) \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/Rakefile new file mode 100644 index 000000000..a39a2e80f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/Rakefile @@ -0,0 +1,26 @@ +require 'rubygems' if RUBY_VERSION < '1.9.0' +require 'rake' + +# Don't forget to run rake gemspec with each release! ... I think... + +begin + require 'jeweler' + Jeweler::Tasks.new do |gem| + gem.name = "os" + gem.summary = %Q{Simple and easy way to know if you're on windows or not (reliably), as well as how many bits the OS is, etc.} + gem.description = %Q{The OS gem allows for some useful and easy functions, like OS.windows? (=> true or false) OS.bits ( => 32 or 64) etc"} + gem.email = "rogerpack2005@gmail.com" + gem.homepage = "http://github.com/rdp/os" + gem.authors = ["rdp", "David McCullars"] + # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings + # gem.add_development_dependency "fast_require" + gem.add_development_dependency "rspec", ">= 2.0" + end +rescue LoadError + puts "Jeweler (or a dependency) not available. Install it with: gem install jeweler" +end + +require 'rspec/core/rake_task' +RSpec::Core::RakeTask.new(:spec) +task :default => :spec + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/VERSION b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/VERSION new file mode 100644 index 000000000..9cf038687 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/VERSION @@ -0,0 +1 @@ +0.9.6 \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/autotest/discover.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/autotest/discover.rb new file mode 100644 index 000000000..cd6892ccb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/autotest/discover.rb @@ -0,0 +1 @@ +Autotest.add_discovery { "rspec2" } diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/lib/os.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/lib/os.rb new file mode 100644 index 000000000..40ba9e75b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/lib/os.rb @@ -0,0 +1,272 @@ +require 'rbconfig' +require 'yaml' + +# a set of friendly files for determining your Ruby runtime +# treats cygwin as linux +# also treats IronRuby on mono as...linux +class OS + attr_reader :config + + def self.config + @config ||= RbConfig::CONFIG + end + + # true if on windows [and/or jruby] + # false if on linux or cygwin on windows + + def self.windows? + @windows ||= begin + if RUBY_PLATFORM =~ /cygwin/ # i386-cygwin + false + elsif ENV['OS'] == 'Windows_NT' + true + else + false + end + end + + end + + # true for linux, os x, cygwin + def self.posix? + @posix ||= + begin + if OS.windows? + begin + begin + # what if we're on interix... + # untested, of course + Process.wait fork{} + true + rescue NotImplementedError, NoMethodError + false + end + end + else + # assume non windows is posix + true + end + end + + end + + # true for linux, false for windows, os x, cygwin + def self.linux? + if (host_os =~ /linux/) + true + else + false + end + end + + def self.iron_ruby? + @iron_ruby ||= begin + if defined?(RUBY_ENGINE) && (RUBY_ENGINE == 'ironruby') + true + else + false + end + end + end + + def self.bits + @bits ||= begin + if host_cpu =~ /_64$/ || RUBY_PLATFORM =~ /x86_64/ + 64 + elsif RUBY_PLATFORM == 'java' && ENV_JAVA['sun.arch.data.model'] # "32" or "64":http://www.ruby-forum.com/topic/202173#880613 + ENV_JAVA['sun.arch.data.model'].to_i + elsif host_cpu == 'i386' + 32 + elsif host_os =~ /32$/ # mingw32, mswin32 + 32 + else # cygwin only...I think + if 1.size == 8 + 64 + else + 32 + end + end + end + end + + + def self.java? + @java ||= begin + if RUBY_PLATFORM =~ /java/ + true + else + false + end + end + end + + def self.ruby_bin + @ruby_exe ||= begin + File::join(config['bindir'], config['ruby_install_name']) + config['EXEEXT'] + end + end + + def self.mac? + @mac = begin + if host_os =~ /darwin/ + true + else + false + end + end + end + + def self.osx? + mac? + end + + def self.x? + mac? + end + + + # amount of memory the current process "is using", in RAM + # (doesn't include any swap memory that it may be using, just that in actual RAM) + # raises 'unknown' on jruby currently + def self.rss_bytes + # attempt to do this in a jruby friendly way + if OS::Underlying.windows? + # MRI, Java, IronRuby, Cygwin + if OS.java? + # no win32ole on 1.5.x, so leave here for compatibility...maybe for awhile :P + require 'java' + mem_bean = java.lang.management.ManagementFactory.getMemoryMXBean + mem_bean.heap_memory_usage.used + mem_bean.non_heap_memory_usage.used + else + wmi = nil + begin + require 'win32ole' + wmi = WIN32OLE.connect("winmgmts://") + rescue LoadError, NoMethodError => e # NoMethod for IronRuby currently [sigh] + raise 'rss unknown for this platform ' + e.to_s + end + processes = wmi.ExecQuery("select * from win32_process where ProcessId = #{Process.pid}") + memory_used = nil + # only allow for one... + for process in processes + raise if memory_used + memory_used = process.WorkingSetSize.to_i + end + memory_used + end + elsif OS.posix? # linux [though I've heard it works in OS X] + kb = `ps -o rss= -p #{Process.pid}`.to_i # in kilobytes + else + raise 'unknown rss for this platform' + end + end + + class Underlying + + def self.bsd? + OS.osx? + end + + def self.windows? + ENV['OS'] == 'Windows_NT' + end + + def self.linux? + OS.host_os =~ /linux/ ? true : false + end + + end + + def self.cygwin? + @cygwin = begin + if RUBY_PLATFORM =~ /-cygwin/ + true + else + false + end + end + end + + def self.dev_null + @dev_null ||= begin + if OS.windows? + "NUL" + else + "/dev/null" + end + end + end + + # provides easy way to see the relevant config entries + def self.report + relevant_keys = [ + 'arch', + 'host', + 'host_cpu', + 'host_os', + 'host_vendor', + 'target', + 'target_cpu', + 'target_os', + 'target_vendor', + ] + RbConfig::CONFIG.reject {|key, val| !relevant_keys.include? key }.merge({'RUBY_PLATFORM' => RUBY_PLATFORM}).to_yaml + end + + def self.cpu_count + @cpu_count ||= + case RUBY_PLATFORM + when /darwin9/ + `hwprefs cpu_count`.to_i + when /darwin10/ + (hwprefs_available? ? `hwprefs thread_count` : `sysctl -n hw.ncpu`).to_i + when /linux/ + `cat /proc/cpuinfo | grep processor | wc -l`.to_i + when /freebsd/ + `sysctl -n hw.ncpu`.to_i + else + if RbConfig::CONFIG['host_os'] =~ /darwin/ + (hwprefs_available? ? `hwprefs thread_count` : `sysctl -n hw.ncpu`).to_i + elsif self.windows? + # ENV counts hyper threaded...not good. + # out = ENV['NUMBER_OF_PROCESSORS'].to_i + require 'win32ole' + wmi = WIN32OLE.connect("winmgmts://") + cpu = wmi.ExecQuery("select NumberOfCores from Win32_Processor") # don't count hyper-threaded in this + cpu.to_enum.first.NumberOfCores + else + raise 'unknown platform processor_count' + end + end + end + + def self.open_file_command + if OS.doze? || OS.cygwin? + "start" + elsif OS.mac? + "open" + else + # linux...what about cygwin? + "xdg-open" + end + + end + + class << self + alias :doze? :windows? # a joke name but I use it and like it :P + alias :jruby? :java? + + # delegators for relevant config values + %w(host host_cpu host_os).each do |method_name| + define_method(method_name) { config[method_name] } + end + + end + + private + + def self.hwprefs_available? + `which hwprefs` != '' + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/os.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/os.gemspec new file mode 100644 index 000000000..5588d13fa --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/os.gemspec @@ -0,0 +1,51 @@ +# Generated by jeweler +# DO NOT EDIT THIS FILE DIRECTLY +# Instead, edit Jeweler::Tasks in rakefile, and run 'rake gemspec' +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{os} + s.version = "0.9.4" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["rdp", "David McCullars"] + s.date = %q{2011-08-11} + s.description = %q{The OS gem allows for some useful and easy functions, like OS.windows? (=> true or false) OS.bits ( => 32 or 64) etc"} + s.email = %q{rogerpack2005@gmail.com} + s.extra_rdoc_files = [ + "README.rdoc" + ] + s.files = [ + ".autotest", + ".document", + "Gemfile", + "Gemfile.lock", + "README.rdoc", + "Rakefile", + "VERSION", + "autotest/discover.rb", + "lib/os.rb", + "os.gemspec", + "spec/linux_spec.rb", + "spec/os_spec.rb", + "spec/osx_spec.rb", + "spec/spec_helper.rb" + ] + s.homepage = %q{http://github.com/rdp/os} + s.require_paths = ["lib"] + s.rubygems_version = %q{1.7.2} + s.summary = %q{Simple and easy way to know if you're on windows or not (reliably), as well as how many bits the OS is, etc.} + + if s.respond_to? :specification_version then + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_development_dependency(%q, [">= 2.0"]) + else + s.add_dependency(%q, [">= 2.0"]) + end + else + s.add_dependency(%q, [">= 2.0"]) + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/spec/linux_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/spec/linux_spec.rb new file mode 100644 index 000000000..938fe04e9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/spec/linux_spec.rb @@ -0,0 +1,38 @@ +require 'rubygems' if RUBY_VERSION < '1.9.0' + +require File.dirname(__FILE__) + '/../lib/os.rb' # load before sane to avoid sane being able to requir the gemified version... +require 'rspec' # rspec2 + +describe 'For Linux, (Ubuntu, Ubuntu 10.04 LTS) ' do + before(:each) do + ENV.should_receive(:[]).with('OS').any_number_of_times.and_return() + ## Having difficulties finding a stub for RUBY_PLATFORM + # Looking into something like: http://stackoverflow.com/questions/1698335/can-i-use-rspec-mocks-to-stub-out-version-constants + # For now, simply using RbConfig::CONFIG + # Kernel.stub!(:const_get).with('RUBY_PLATFORM').and_return("i686-linux") + RbConfig::CONFIG.stub!(:[]).with('host_os').and_return('linux_gnu') + RbConfig::CONFIG.stub!(:[]).with('host_cpu').and_return('i686') + end + + describe OS do + subject { OS } # class, not instance + + it { should be_linux } + it { should be_posix } + + it { should_not be_mac } + it { should_not be_osx } + it { should_not be_windows } + + end + + describe OS::Underlying do + subject { OS::Underlying } # class, not instance + + it { should be_linux } + + it { should_not be_bsd } + it { should_not be_windows } + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/spec/os_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/spec/os_spec.rb new file mode 100644 index 000000000..4d34e7691 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/spec/os_spec.rb @@ -0,0 +1,174 @@ +require File.expand_path('spec_helper.rb', File.dirname(__FILE__)) + +describe "OS" do + + it "identifies whether windows? or posix?" do + if ENV['OS'] == 'Windows_NT' + unless RUBY_PLATFORM =~ /cygwin/ + assert OS.windows? == true + assert OS.doze? == true + assert OS.posix? == false # can fail in error at times...I guess because some other spec has reset ENV on us... + else + assert OS::Underlying.windows? + assert OS.windows? == false + assert OS.posix? == true + end + assert OS::Underlying.windows? + elsif [/linux/, /darwin/].any? {|posix_pattern| (RbConfig::CONFIG["host_os"] =~ posix_pattern) || RUBY_PLATFORM =~ posix_pattern } + assert OS.windows? == false + assert OS.posix? == true + assert !OS::Underlying.windows? + else + pending "create test" + end + end + + it "has a bits method" do + if RUBY_PLATFORM =~ /mingw32/ + assert OS.bits == 32 + elsif RUBY_PLATFORM =~ /64/ # linux... + assert OS.bits == 64 + elsif RUBY_PLATFORM =~ /i686/ + assert OS.bits == 32 + elsif RUBY_PLATFORM =~ /java/ && RbConfig::CONFIG['host_os'] =~ /32$/ + assert OS.bits == 32 + elsif RUBY_PLATFORM =~ /java/ && RbConfig::CONFIG['host_cpu'] =~ /i386/ + assert OS.bits == 32 + elsif RUBY_PLATFORM =~ /i386/ + assert OS.bits == 32 + else + pending "os bits not tested!" + RUBY_PLATFORM + ' ' + RbConfig::CONFIG['host_os'] + end + + end + + it "should have an iron_ruby method" do + if defined?(RUBY_ENGINE) && RUBY_ENGINE == 'ironruby' + assert OS.iron_ruby? == true + else + assert OS.iron_ruby? == false + end + end + + it "should know if you're on java" do + if RUBY_PLATFORM == 'java' + assert OS.java? == true # must be [true | false] + else + assert OS.java? == false + end + end + + it "should have a ruby_bin method" do + if OS.windows? + assert OS.ruby_bin.include?('.exe') + if OS.iron_ruby? + assert OS.ruby_bin.include?('ir.exe') + else + assert OS.ruby_bin.include?('ruby.exe') + end + else + assert OS.ruby_bin.include?('ruby') && OS.ruby_bin.include?('/') + end + + if OS.java? + assert OS.ruby_bin.include?('jruby') # I think + end + + end + + it "should have a cygwin? method" do + if RUBY_PLATFORM =~ /cygwin/ + assert OS.cygwin? == true + else + assert OS.cygwin? == false + end + end + + it "should have a functional mac? method" do + if RUBY_PLATFORM =~ /darwin/ + assert OS.mac? == true + else + if OS.host_os == 'darwin' + assert OS.mac? == true + else + assert OS.mac? == false + end + end + end + + it "should have a way to get rss_bytes on each platform" do + bytes = OS.rss_bytes + assert bytes > 0 # should always be true + assert bytes.is_a?(Numeric) # don't want strings from any platform... + end + + it "should tell you what the right /dev/null is" do + if OS.windows? + OS.dev_null.should == "NUL" + else + OS.dev_null.should == "/dev/null" + end + end + + it "should have a jruby method" do + if defined?(RUBY_DESCRIPTION) && RUBY_DESCRIPTION =~ /^(jruby|java)/ + assert OS.jruby? + else + assert !OS.jruby? + end + end + + it "has working cpu count method" do + assert OS.cpu_count >= 1 + if OS.mac? + assert OS.cpu_count == 2 # my own developer box :P + end + end + + it "has working cpu count method with no env. variable" do + OS.instance_variable_set(:@cpu_count, nil) # reset it + if OS.windows? + ENV.delete('NUMBER_OF_PROCESSORS') + assert OS.cpu_count >= 1 + end + end + + it "should have a start/open command helper" do + if OS.doze? + assert OS.open_file_command == "start" + elsif OS.mac? + assert OS.open_file_command == "open" + else + assert OS.open_file_command == "xdg-open" + end + end + +end + +describe OS, "provides access to to underlying config values" do + + describe "#config, supplys the CONFIG hash" do + subject { OS.config } + + specify { subject.should be_a(Hash) } + + it "should supply 'host_cpu'" do + subject['host_cpu'].should eq(RbConfig::CONFIG['host_cpu']) + end + + it "should supply 'host_os'" do + subject['host_os'].should eq(RbConfig::CONFIG['host_os']) + end + end + + describe "by providing a delegate method for relevant keys in RbConfig::CONFIG" do + %w(host host_cpu host_os).sort.each do |config_key| + it "should delegate '#{config_key}'" do + expected = "TEST #{config_key}" + RbConfig::CONFIG.should_receive(:[]).with(config_key).and_return(expected) + + OS.send(config_key).should == expected + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/spec/osx_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/spec/osx_spec.rb new file mode 100644 index 000000000..20f75320a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/spec/osx_spec.rb @@ -0,0 +1,30 @@ +require File.expand_path('spec_helper.rb', File.dirname(__FILE__)) + +describe 'For OSX (Snow Leopard, 10.6),' do + before(:each) do + ENV.stub!(:[]).with('OS').and_return(nil) + # Issues stubbing RUBY_PLATFORM, using RbConfig instead. + # Kernel.stub!(:RUBY_PLATFORM => "x86_64-darwin10.6") + RbConfig::CONFIG.stub!(:[]).with('host_os').and_return("darwin10.6.0") + RbConfig::CONFIG.stub!(:[]).with('host_cpu').and_return('i386') + end + + describe OS do + subject { OS } # class, not instance + + it { should be_mac } + it { should be_x } # OS.x? + it { should be_osx } + it { should be_posix } + + it { should_not be_windows } + + end + + describe OS::Underlying do + subject { OS::Underlying } # class, not instance + + it { should be_bsd } + it { should_not be_windows } + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/spec/spec_helper.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/spec/spec_helper.rb new file mode 100644 index 000000000..2fbe9ddf8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/os-0.9.6/spec/spec_helper.rb @@ -0,0 +1,10 @@ +require 'rubygems' if RUBY_VERSION < '1.9.0' +require File.expand_path('../lib/os.rb', File.dirname(__FILE__)) + +require 'rspec' # rspec2 +require 'rspec/autorun' + +RSpec.configure do |config| + config.expect_with :rspec, :stdlib # enable `should` OR `assert` +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/HISTORY.txt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/HISTORY.txt new file mode 100644 index 000000000..a4491e2e6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/HISTORY.txt @@ -0,0 +1,211 @@ += 2.0 / ?? (future release changes, like a reminder to self) + + - prsnt? and absnt? are now finally banned into oblivion. Wasting vocals for + the win. + += 1.5 / ?? + + + Handles unconsumed input at end of parse completely differently. Instead + of generating a toplevel error, it now raises an error in every branch + of the parse. More information in the resulting exception ensues! Thanks + again to John Mettraux for inspiration & acceptance specs. + + NOTE that this means that the UnconsumedInput exception is gone, since the + unconsumed input case is nothing special anymore. + + * This history now finally reads like the Changelog of the linux kernel. + Meaning that probably no one ever reads this. + + + Captures and parsing subsequent input based on captured values. This has + been long overdue - finally you can parse HEREdocs with parslet! + += 1.4.0 / 25May2012 + + + Revised documentation. A few new API features have finally made it into + the documentation. Examples in the documentation are now curated and + run against the current code so that they really really work. + Also, the website generation tools have been replaced with 2012-style + tools. Much less pain to update now. + + + Parslet::Source now doesn't hold a StringIO, it directly holds the + buffer to be parsed. The api of Source has changed a tiny bit. This change + has been made for speed optimisation reasons. + + + :reporter argument to parse, allowing to customize error reporting within + wide boundaries. See issue #64 for a discussion. + Included are two error reporters, one (default) with the existing error + tree functionality, one reporting deepest errors as defined by the above + ticket. + + + Optimistic parse: Parsing is two phase, with the first phase assuming + there will be no errors. This yields ~ 20% speed improvement in the + case where the parse succeeds. + Also, internal error handling is now using tuples. This and other + optimizations have yielded ~ 30% overall improvement. + + ! #error_tree and #cause removed from all of parslet. The + Parslet::ParseFailed exception now contains a #cause field that can + be asked for an #ascii_tree as before. + Cleaner internal error handling, not stateful in atoms anymore. Some + parsers will see correct error reporting for the first time. (issue #65) + + + Made it possible to pass a custom Parslet::Source implementor to #parse. + (see #63) + + + #parse has now a second argument that is an options hash. See + Parslet::Atoms::Base#parse for documentation. + + - VM engine on the way out. No benefit except for the intellectual + challenge. + += 1.3.0 / 5Mar2012 + + ! Parslet::Transform::Context is now much more well-behaved. It has + #respond_to? and #method_missing; it now looks like a plain old Ruby + object with instance variables and attribute readers. + + - Grammar transforms turned out to be a dead end and have been removed. + + ! A few problems in error message generation have been fixed. This will + improve diagnostics further. + + + A VM driven parser engine: Removes the limitation that parsing needs a + lot of stack space, something dearly missing from Ruby 1.9.3 fibers. + This engine is experimental and might be removed in the future. + + ! Interaction with mathn fixed - Line number generation will terminate. + + . Internal reorganisation, removing cruft and bit rot. + += 1.2.3 / 22Sep2011 + + + Transform#apply can now be called with a hash as second argument. This + provides bindings and a way to inject context. + + ! Fixes a bug thar modified parslet atoms in place, defeating oop chaining. + (#50) + += 1.2.1 / 6Jun2011 + + ! FIX: Input at the end of a parse raises Parslet::UnconsumedInput. (see + issue 18) + + ! FIX: Unicode parsing should now work as expected. (see issue 38) + + ! FIX: Slice#slice returned wrong bits at times (see issue 36). + += 1.2.0 / 4Feb2011 + + + Parslet::Parser is now also a grammar atom, it can be composed freely with + other atoms. (str('f') >> MiniLispParser.new >> str('b')) + + + No strings, only slices are returned as part of the parser result. + Parslet::Slice is almost a string class, but one that remembers the + source offset. This has also bought us a slight speedup. + + + require 'parslet/convenience' now brings #parse_with_debug to all parslets. + This is a consequence of the above change. + + + Deprecates prsnt? and absnt? in favor of the more readable absent? and + prsnt?. Uses 3 bytes more RAM. The old variants will exist until we release + 2.0. + + INTERNALLY + + + Visitors now should have methods that all begin with 'visit_*'. #str + becomes #visit_str. + + + Parslet::Atoms::Entity now takes only a block argument instead of context + and block. + += 1.1.1 / 4Feb2011 + + ! FIX: Line counting was broken by performance optimisations. + + + Squeezed out another few drops of performance. + += 1.1.0 / 2Feb2011 + + + Uses return (fail/success), cached line counts, memoizing of parse results + and other tricks internally for at least an order of magnitude increase + in execution speed. + + + str('foo').maybe will now return an empty string again. Use .as(...) to + name things and get back [] from #repeat and nil from #maybe. + + + If you require 'parslet/atoms/visitor', you'll get an accept method on + all known Parslet::Atoms. + + + If you require 'parslet/export', you can call #to_citrus and #to_treetop + to produce string versions of your grammar in those dialects. + + + Requiring 'parslet/convenience' will given you a parse_with_debug on + your Parslet::Parser class. This prints some diagnostics on parse failure. + (Thanks to Florian Hanke) + += 1.0.1 / 17Jan2011 + + A happy new year! + + ! FIX: Parslet::Transform was wrongly fixed earlier - it now wont mangle + hashes anymore. (Blake Sweeney) + + + parslet/rig/rspec.rb contains useful rspec matchers. (R. Konstantin Haase) + += 1.0.0 / 29Dez2010 + + - #each_match was removed. There was some duplication of code that even + confused me - and we should not have 2 methods of achieving the same + goal. + + + Full documentation. Fixed sdoc. + += 0.11.0 / 25Nov2010 + + ! Bugfixes to tree handling. Let's hope that was the last such significant + change to the core. + += 0.10.1 / 22Nov2010 + + + Allow match['a-z'], shortcut for match('[a-z]') + + ! Fixed output inconsistencies (behaviour in connection to 'maybe') + += 0.10.0 / 22Nov2010 + + + Parslet::Transform now takes a block on initialisation, wherein you can + define all the rules directly. + + + Parslet::Transform now only passes a hash to the block during transform + when its arity is 1. Otherwise all hash contents as bound as local + variables. + + + Both inline and other documentation have been improved. + + + You can now use 'subtree(:x)' to bind any subtree to x during tree pattern + matching. + + + Transform classes can now include rules into class definition. This makes + Parser and Transformer behave the same. + += 0.9.0 / 28Oct2010 + * More of everything: Examples, documentation, etc... + + * Breaking change: Ruby's binary or ('|') is now used for alternatives, + instead of the division sign ('/') - this reduces the amount of + parenthesis needed for a grammar overall. + + * parslet.maybe now yields the result or nil in case of parse failure. This + is probably better than the array it did before; the jury is still out on + that. + + * parslet.repeat(min, max) is now valid syntax + += 0.1.0 / not released. + + * Initial version. Classes for parsing, matching in the resulting trees + and transforming the trees into something more useful. + + * Parses and outputs intermediary trees + + * Matching of single elements and sequences \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/LICENSE b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/LICENSE new file mode 100644 index 000000000..e57eec22c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/LICENSE @@ -0,0 +1,23 @@ + + Copyright (c) 2010 Kaspar Schiess + + Permission is hereby granted, free of charge, to any person + obtaining a copy of this software and associated documentation + files (the "Software"), to deal in the Software without + restriction, including without limitation the rights to use, + copy, modify, merge, publish, distribute, sublicense, and/or sell + copies of the Software, and to permit persons to whom the + Software is furnished to do so, subject to the following + conditions: + + The above copyright notice and this permission notice shall be + included in all copies or substantial portions of the Software. + + THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + OTHER DEALINGS IN THE SOFTWARE. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/README b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/README new file mode 100644 index 000000000..5eb3f0f79 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/README @@ -0,0 +1,70 @@ +INTRODUCTION + +Parslet makes developing complex parsers easy. It does so by + +* providing the best error reporting possible +* not generating reams of code for you to debug + +Parslet takes the long way around to make your job easier. It allows for +incremental language construction. Often, you start out small, implementing +the atoms of your language first; _parslet_ takes pride in making this +possible. + +Eager to try this out? Please see the associated web site: +http://kschiess.github.com/parslet + +SYNOPSIS + + require 'parslet' + include Parslet + + # parslet parses strings + str('foo'). + parse('foo') # => "foo"@0 + + # it matches character sets + match['abc'].parse('a') # => "a"@0 + match['abc'].parse('b') # => "b"@0 + match['abc'].parse('c') # => "c"@0 + + # and it annotates its output + str('foo').as(:important_bit). + parse('foo') # => {:important_bit=>"foo"@0} + + # you can construct parsers with just a few lines + quote = str('"') + simple_string = quote >> (quote.absent? >> any).repeat >> quote + + simple_string. + parse('"Simple Simple Simple"') # => "\"Simple Simple Simple\""@0 + + # or by making a fuss about it + class Smalltalk < Parslet::Parser + root :smalltalk + + rule(:smalltalk) { statements } + rule(:statements) { + # insert smalltalk parser here (outside of the scope of this readme) + } + end + + # and then + Smalltalk.new.parse('smalltalk') + +COMPATIBILITY + +This library should work with most rubies. I've tested it with MRI 1.8 +(except 1.8.6), 1.9, rbx-head, jruby. Please report as a bug if you encounter +issues. + +Note that due to Ruby 1.8 internals, Unicode parsing is not supported on that +version. + +On Mac OS X Lion, ruby-1.8.7-p352 has been known to segfault. Use +ruby-1.8.7-p334 for better results. + +STATUS + +Production worthy. + +(c) 2010, 2011, 2012 Kaspar Schiess \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/Rakefile new file mode 100644 index 000000000..cf39b825b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/Rakefile @@ -0,0 +1,30 @@ +require 'rdoc/task' +require 'sdoc' + +require 'rspec/core/rake_task' +require "rubygems/package_task" + +desc "Run all tests: Exhaustive." +RSpec::Core::RakeTask.new + +namespace :spec do + desc "Only run unit tests: Fast. " + RSpec::Core::RakeTask.new(:unit) do |task| + task.pattern = "spec/parslet/**/*_spec.rb" + end +end + +task :default => :spec + +# This task actually builds the gem. +task :gem => :spec +spec = eval(File.read('parslet.gemspec')) + +desc "Prints LOC stats" +task :stat do + %w(lib spec example).each do |dir| + loc = %x(find #{dir} -name "*.rb" | xargs wc -l | grep 'total').split.first.to_i + printf("%20s %d\n", dir, loc) + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/boolean_algebra.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/boolean_algebra.rb new file mode 100644 index 000000000..bea8634ec --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/boolean_algebra.rb @@ -0,0 +1,70 @@ +$:.unshift File.dirname(__FILE__) + "/../lib" + +require "parslet" +require "pp" + +# Parses strings like "var1 and (var2 or var3)" respecting operator precedence +# and parentheses. After that transforms the parse tree into an array of +# arrays like this: +# +# [["1", "2"], ["1", "3"]] +# +# The array represents a DNF (disjunctive normal form). Elements of outer +# array are connected with "or" operator, while elements of inner arrays are +# joined with "and". +# +class Parser < Parslet::Parser + rule(:space) { match[" "].repeat(1) } + rule(:space?) { space.maybe } + + rule(:lparen) { str("(") >> space? } + rule(:rparen) { str(")") >> space? } + + rule(:and_operator) { str("and") >> space? } + rule(:or_operator) { str("or") >> space? } + + rule(:var) { str("var") >> match["0-9"].repeat(1).as(:var) >> space? } + + # The primary rule deals with parentheses. + rule(:primary) { lparen >> or_operation >> rparen | var } + + # Note that following rules are both right-recursive. + rule(:and_operation) { + (primary.as(:left) >> and_operator >> + and_operation.as(:right)).as(:and) | + primary } + + rule(:or_operation) { + (and_operation.as(:left) >> or_operator >> + or_operation.as(:right)).as(:or) | + and_operation } + + # We start at the lowest precedence rule. + root(:or_operation) +end + +class Transformer < Parslet::Transform + rule(:var => simple(:var)) { [[String(var)]] } + + rule(:or => { :left => subtree(:left), :right => subtree(:right) }) do + (left + right) + end + + rule(:and => { :left => subtree(:left), :right => subtree(:right) }) do + res = [] + left.each do |l| + right.each do |r| + res << (l + r) + end + end + res + end +end + +pp tree = Parser.new.parse("var1 and (var2 or var3)") +# {:and=> +# {:left=>{:var=>"1"@3}, +# :right=>{:or=>{:left=>{:var=>"2"@13}, :right=>{:var=>"3"@21}}}}} +pp Transformer.new.apply(tree) +# [["1", "2"], ["1", "3"]] + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/calc.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/calc.rb new file mode 100644 index 000000000..541d7a566 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/calc.rb @@ -0,0 +1,153 @@ +# A simple integer calculator to answer the question about how to do +# left and right associativity in parslet (PEG) once and for all. + +$:.unshift File.dirname(__FILE__) + "/../lib" + +require 'rspec' +require 'parslet' +require 'parslet/rig/rspec' + +# This is the parsing stage. It expresses left associativity by compiling +# list of things that have the same associativity. +class CalcParser < Parslet::Parser + root :addition + + rule(:addition) { + multiplication.as(:l) >> (add_op >> multiplication.as(:r)).repeat(1) | + multiplication + } + + rule(:multiplication) { + integer.as(:l) >> (mult_op >> integer.as(:r)).repeat(1) | + integer } + + rule(:integer) { digit.repeat(1).as(:i) >> space? } + + rule(:mult_op) { match['*/'].as(:o) >> space? } + rule(:add_op) { match['+-'].as(:o) >> space? } + + rule(:digit) { match['0-9'] } + rule(:space?) { match['\s'].repeat } +end + +# Classes for the abstract syntax tree. +Int = Struct.new(:int) { + def eval; self end + def op(operation, other) + left = int + right = other.int + + Int.new( + case operation + when '+' + left + right + when '-' + left - right + when '*' + left * right + when '/' + left / right + end) + end + def to_i + int + end +} +Seq = Struct.new(:sequence) { + def eval + sequence.reduce { |accum, operation| + operation.call(accum) } + end +} +LeftOp = Struct.new(:operation, :right) { + def call(left) + left = left.eval + right = self.right.eval + + left.op(operation, right) + end +} + +# Transforming intermediary syntax tree into a real AST. +class CalcTransform < Parslet::Transform + rule(i: simple(:i)) { Int.new(Integer(i)) } + rule(o: simple(:o), r: simple(:i)) { LeftOp.new(o, i) } + rule(l: simple(:i)) { i } + rule(sequence(:seq)) { Seq.new(seq) } +end + +# And this calls everything in the right order. +def calculate(str) + intermediary_tree = CalcParser.new.parse(str) + abstract_tree = CalcTransform.new.apply(intermediary_tree) + result = abstract_tree.eval + + result.to_i +end + +# A test suite for the above parser +describe CalcParser do + let(:p) { described_class.new } + describe '#integer' do + let(:i) { p.integer } + it "parses integers" do + i.should parse('1') + i.should parse('123') + end + it "consumes trailing white space" do + i.should parse('123 ') + end + it "doesn't parse floats" do + i.should_not parse('1.3') + end + end + describe '#multiplication' do + let(:m) { p.multiplication } + it "parses simple multiplication" do + m.should parse('1*2') + end + it "parses division" do + m.should parse('1/2') + end + end + describe '#addition' do + let(:a) { p.addition } + + it "parses simple addition" do + a.should parse('1+2') + a.should parse('1+2+3-4') + end + end +end +describe CalcTransform do + def t(obj) + described_class.new.apply(obj) + end + + it "transforms integers" do + t(i: '1').should == Int.new(1) + end + it "unwraps left operand" do + t(l: :obj).should == :obj + end +end +describe 'whole computation specs' do + def self.result_of(str, int) + it(str) { calculate(str).should == int } + end + + result_of '1+1', 2 + result_of '1-1-1', -1 + result_of '1+1+3*5/2', 9 + result_of '123*2', 246 +end + + +# Enable these if you want to change the code. +# RSpec::Core::Runner.run([], $stderr, $stdout) + +str = ARGV.join +str = '123*2' if str.match(/^\s*$/) + +print "#{str} (command line): -> " +puts calculate(str) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/capture.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/capture.rb new file mode 100644 index 000000000..4e4b8d174 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/capture.rb @@ -0,0 +1,49 @@ + +# This example demonstrates how pieces of input can be captured and matched +# against later on. Without this, you cannot match here-documents and other +# self-dependent grammars. + +$:.unshift File.dirname(__FILE__) + "/../lib" +require 'parslet' +require 'parslet/convenience' +require 'pp' + +class CapturingParser < Parslet::Parser + root :document + + # Introduce a scope for each document. This ensures that documents can be + # nested. + rule(:document) { scope { doc_start >> text >> doc_end } } + + # Start of a document is a heredoc marker. This is captured in :marker + rule(:doc_start) { str('<') >> marker >> newline } + rule(:marker) { match['A-Z'].repeat(1).capture(:marker) } + + # The content of a document can be either lines of text or another + # document, introduced by > any >> + (newline.absent? >> any).repeat >> newline } + + # The end of the document is marked by the marker that was at the beginning + # of the document, by itself on a line. + rule(:doc_end) { captured_marker } + rule(:captured_marker) { + dynamic { |source, context| + str(context.captures[:marker]) + } + } + + rule(:newline) { match["\n"] } +end + +parser = CapturingParser.new +pp parser.parse_with_debug %Q(> expression.repeat >> newline } + rule(:newline) { str("\n") >> str("\r").maybe } + + rule(:expression) { (str('a').as(:a) >> spaces).as(:exp) } + + rule(:spaces) { space.repeat } + rule(:space) { multiline_comment | line_comment | str(' ') } + + rule(:line_comment) { (str('//') >> (newline.absent? >> any).repeat).as(:line) } + rule(:multiline_comment) { (str('/*') >> (str('*/').absent? >> any).repeat >> str('*/')).as(:multi) } +end + +code = %q( + a + // line comment + a a a // line comment + a /* inline comment */ a + /* multiline + comment */ +) + +pp ALanguage.new.parse_with_debug(code) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/deepest_errors.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/deepest_errors.rb new file mode 100644 index 000000000..3573907f3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/deepest_errors.rb @@ -0,0 +1,131 @@ +$:.unshift File.dirname(__FILE__) + "/../lib" + +# This example demonstrates how to do deepest error reporting, as invented +# by John Mettraux (issue #64). + +require 'parslet' +require 'parslet/convenience' + +def prettify(str) + puts " "*3 + " "*4 + "." + " "*4 + "10" + " "*3 + "." + " "*4 + "20" + str.lines.each_with_index do |line, index| + printf "%02d %s\n", + index+1, + line.chomp + end +end + +class Parser < Parslet::Parser + # commons + + rule(:space) { match('[ \t]').repeat(1) } + rule(:space?) { space.maybe } + + rule(:newline) { match('[\r\n]') } + + rule(:comment) { str('#') >> match('[^\r\n]').repeat } + + rule(:line_separator) { + (space? >> ((comment.maybe >> newline) | str(';')) >> space?).repeat(1) + } + + rule(:blank) { line_separator | space } + rule(:blank?) { blank.maybe } + + rule(:identifier) { match('[a-zA-Z0-9_]').repeat(1) } + + # res_statement + + rule(:reference) { + (str('@').repeat(1,2) >> identifier).as(:reference) + } + + rule(:res_action_or_link) { + str('.').as(:dot) >> (identifier >> str('?').maybe ).as(:name) >> str('()') + } + + rule(:res_actions) { + ( + reference + ).as(:resources) >> + ( + res_action_or_link.as(:res_action) + ).repeat(0).as(:res_actions) + } + + rule(:res_statement) { + res_actions >> + (str(':') >> identifier.as(:name)).maybe.as(:res_field) + } + + # expression + + rule(:expression) { + res_statement + } + + # body + + rule(:body) { + (line_separator >> (block | expression)).repeat(1).as(:body) >> + line_separator + } + + # blocks + + rule(:begin_block) { + (str('concurrent').as(:type) >> space).maybe.as(:pre) >> + str('begin').as(:begin) >> + body >> + str('end') + } + + rule(:define_block) { + str('define').as(:define) >> space >> + identifier.as(:name) >> str('()') >> + body >> + str('end') + } + + rule(:block) { + define_block | begin_block + } + + # root + + rule(:radix) { + line_separator.maybe >> block >> line_separator.maybe + } + + root(:radix) +end + +ds = [ + %{ + define f() + @res.name + end + }, + %{ + define f() + begin + @res.name + end + end + } +] + +ds.each do |d| + + puts '-' * 80 + prettify(d) + + parser = Parser.new + + begin + parser.parse_with_debug(d, + :reporter => Parslet::ErrorReporter::Deepest.new) + end +end + +puts '-' * 80 \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/documentation.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/documentation.rb new file mode 100644 index 000000000..4ce66e4c6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/documentation.rb @@ -0,0 +1,18 @@ +# A small example that shows a really small parser and what happens on parser +# errors. + +$:.unshift File.dirname(__FILE__) + "/../lib" + +require 'pp' +require 'parslet' + +class MyParser < Parslet::Parser + rule(:a) { str('a').repeat } + + def parse(str) + a.parse(str) + end +end + +pp MyParser.new.parse('aaaa') +pp MyParser.new.parse('bbbb') diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/email_parser.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/email_parser.rb new file mode 100644 index 000000000..e1a858e77 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/email_parser.rb @@ -0,0 +1,52 @@ +#!/usr/bin/env ruby + +# Example contributed by Hal Brodigan (postmodern). Thanks! + +$:.unshift File.dirname(__FILE__) + "/../lib" +require 'parslet' +require 'parslet/convenience' + +class EmailParser < Parslet::Parser + rule(:space) { match('\s').repeat(1) } + rule(:space?) { space.maybe } + rule(:dash?) { match['_-'].maybe } + + rule(:at) { + str('@') | + (dash? >> (str('at') | str('AT')) >> dash?) + } + rule(:dot) { + str('.') | + (dash? >> (str('dot') | str('DOT')) >> dash?) + } + + rule(:word) { match('[a-z0-9]').repeat(1).as(:word) >> space? } + rule(:separator) { dot.as(:dot) >> space? | space } + rule(:words) { word >> (separator >> word).repeat } + + rule(:email) { + (words.as(:username) >> space? >> at >> space? >> words).as(:email) + } + + root(:email) +end + +class EmailSanitizer < Parslet::Transform + rule(:dot => simple(:dot), :word => simple(:word)) { ".#{word}" } + rule(:word => simple(:word)) { word } + + rule(:username => sequence(:username)) { username.join + "@" } + rule(:username => simple(:username)) { username.to_s + "@" } + + rule(:email => sequence(:email)) { email.join } +end + +parser = EmailParser.new +sanitizer = EmailSanitizer.new + +unless ARGV[0] + STDERR.puts "usage: #{$0} \"EMAIL_ADDR\"" + STDOUT.puts "since you haven't specified any EMAIL_ADDR, for testing purposes we're using a.b.c.d@gmail.com" +end + +p sanitizer.apply(parser.parse_with_debug(ARGV[0] || 'a.b.c.d@gmail.com')) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/empty.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/empty.rb new file mode 100644 index 000000000..2b60a7ec4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/empty.rb @@ -0,0 +1,13 @@ +# Basically just demonstrates that you can leave rules empty and get a nice +# NotImplementedError. A way to quickly spec out your parser rules? + +$:.unshift File.dirname(__FILE__) + "/../lib" + +require 'parslet' + +class Parser < Parslet::Parser + rule(:empty) { } +end + + +Parser.new.empty.parslet diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/erb.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/erb.rb new file mode 100644 index 000000000..c013a8c72 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/erb.rb @@ -0,0 +1,47 @@ +# Example that demonstrates how a simple erb-like parser could be constructed. + +$:.unshift File.dirname(__FILE__) + "/../lib" + +require 'parslet' + +class ErbParser < Parslet::Parser + rule(:ruby) { (str('%>').absent? >> any).repeat.as(:ruby) } + + rule(:expression) { (str('=') >> ruby).as(:expression) } + rule(:comment) { (str('#') >> ruby).as(:comment) } + rule(:code) { ruby.as(:code) } + rule(:erb) { expression | comment | code } + + rule(:erb_with_tags) { str('<%') >> erb >> str('%>') } + rule(:text) { (str('<%').absent? >> any).repeat(1) } + + rule(:text_with_ruby) { (text.as(:text) | erb_with_tags).repeat.as(:text) } + root(:text_with_ruby) +end + +parser = ErbParser.new +p parser.parse "The value of x is <%= x %>." +p parser.parse "<% 1 + 2 %>" +p parser.parse "<%# commented %>" + + +evaluator = Parslet::Transform.new do + + erb_binding = binding + + rule(:code => { :ruby => simple(:ruby) }) { eval(ruby, erb_binding); '' } + rule(:expression => { :ruby => simple(:ruby) }) { eval(ruby, erb_binding) } + rule(:comment => { :ruby => simple(:ruby) }) { '' } + + rule(:text => simple(:text)) { text } + rule(:text => sequence(:texts)) { texts.join } + +end + +puts evaluator.apply(parser.parse(<<-ERB +The <% a = 2 %>not printed result of "a = 2". +The <%# a = 1 %>not printed non-evaluated comment "a = 1", see the value of a below. +The <%= 'nicely' %> printed result. +The <% b = 3 %>value of a is <%= a %>, and b is <%= b %>. +ERB +)) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/ignore.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/ignore.rb new file mode 100644 index 000000000..4b14acb91 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/ignore.rb @@ -0,0 +1,33 @@ +# A small example on how to make parslet ignore parts of the parse tree. + +$:.unshift File.dirname(__FILE__) + "/../lib" +require 'parslet' + +class IgnoreParslet < Parslet::Atoms::Base + def initialize(parslet) + @parslet = parslet + end + def to_s_inner(prec) + @parslet.to_s(prec) + end + def try(source, context, consume_all) + success, value = result = @parslet.try(source, context, consume_all) + + return succ(nil) if success + return result + end + +end +module IgnoreDSL + def ignore + IgnoreParslet.new(self) + end +end + +class Parslet::Atoms::Base + include IgnoreDSL +end + +include Parslet +p (str('a') >> str('b').ignore >> str('c')). + parse('abc') \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/ip_address.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/ip_address.rb new file mode 100644 index 000000000..387350076 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/ip_address.rb @@ -0,0 +1,125 @@ +# This example is heavily inspired by citrus' ip.citrus. Have a look at both +# of these to get some choice! + +# The grammars in this file conform to the ABNF given in Appendix A of RFC 3986 +# Uniform Resource Identifier (URI): Generic Syntax. +# +# See http://tools.ietf.org/html/rfc3986#appendix-A for more information. + +$:.unshift File.dirname(__FILE__) + "/../lib" + +require 'pp' +require 'parslet' + +module IPv4 + include Parslet + + # A host identified by an IPv4 literal address is represented in + # dotted-decimal notation (a sequence of four decimal numbers in the range 0 + # to 255, separated by "."), as described in [RFC1123] by reference to + # [RFC0952]. Note that other forms of dotted notation may be interpreted on + # some platforms, as described in Section 7.4, but only the dotted-decimal + # form of four octets is allowed by this grammar. + rule(:ipv4) { + (dec_octet >> str('.') >> dec_octet >> str('.') >> + dec_octet >> str('.') >> dec_octet).as(:ipv4) + } + + rule(:dec_octet) { + str('25') >> match("[0-5]") | + str('2') >> match("[0-4]") >> digit | + str('1') >> digit >> digit | + match('[1-9]') >> digit | + digit + } + + rule(:digit) { + match('[0-9]') + } +end + +# Must be used in concert with IPv4 +module IPv6 + include Parslet + + rule(:colon) { str(':') } + rule(:dcolon) { colon >> colon } + + # h16 : + def h16r(times) + (h16 >> colon).repeat(times, times) + end + + # : h16 + def h16l(times) + (colon >> h16).repeat(0,times) + end + + # A 128-bit IPv6 address is divided into eight 16-bit pieces. Each piece is + # represented numerically in case-insensitive hexadecimal, using one to four + # hexadecimal digits (leading zeroes are permitted). The eight encoded + # pieces are given most-significant first, separated by colon characters. + # Optionally, the least-significant two pieces may instead be represented in + # IPv4 address textual format. A sequence of one or more consecutive + # zero-valued 16-bit pieces within the address may be elided, omitting all + # their digits and leaving exactly two consecutive colons in their place to + # mark the elision. + rule(:ipv6) { + ( + ( + h16r(6) | + dcolon >> h16r(5) | + h16.maybe >> dcolon >> h16r(4) | + (h16 >> h16l(1)).maybe >> dcolon >> h16r(3) | + (h16 >> h16l(2)).maybe >> dcolon >> h16r(2) | + (h16 >> h16l(3)).maybe >> dcolon >> h16r(1) | + (h16 >> h16l(4)).maybe >> dcolon + ) >> ls32 | + (h16 >> h16l(5)).maybe >> dcolon >> h16 | + (h16 >> h16l(6)).maybe >> dcolon + ).as(:ipv6) + } + + rule(:h16) { + hexdigit.repeat(1,4) + } + + rule(:ls32) { + (h16 >> colon >> h16) | + ipv4 + } + + rule(:hexdigit) { + digit | match("[a-fA-F]") + } +end + +class Parser + include IPv4 + include IPv6 + + def parse(str) + (ipv4 | ipv6).parse(str) + end +end + +%W( + 0.0.0.0 + 255.255.255.255 + 255.255.255 + 1:2:3:4:5:6:7:8 + 12AD:34FC:A453:1922:: + 12AD::34FC + 12AD:: + :: + 1:2 +).each do |address| + parser = Parser.new + printf "%30s -> ", address + begin + result = parser.parse(address) + puts result.inspect + rescue Parslet::ParseFailed => m + puts "Failed: #{m}" + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/json.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/json.rb new file mode 100644 index 000000000..1ea137049 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/json.rb @@ -0,0 +1,128 @@ +$:.unshift File.dirname(__FILE__) + "/../lib" + +# +# MIT License - (c) 2011 John Mettraux +# + +require 'rubygems' +require 'parslet' # gem install parslet + + +module MyJson + + class Parser < Parslet::Parser + + rule(:spaces) { match('\s').repeat(1) } + rule(:spaces?) { spaces.maybe } + + rule(:comma) { spaces? >> str(',') >> spaces? } + rule(:digit) { match('[0-9]') } + + rule(:number) { + ( + str('-').maybe >> ( + str('0') | (match('[1-9]') >> digit.repeat) + ) >> ( + str('.') >> digit.repeat(1) + ).maybe >> ( + match('[eE]') >> (str('+') | str('-')).maybe >> digit.repeat(1) + ).maybe + ).as(:number) + } + + rule(:string) { + str('"') >> ( + str('\\') >> any | str('"').absent? >> any + ).repeat.as(:string) >> str('"') + } + + rule(:array) { + str('[') >> spaces? >> + (value >> (comma >> value).repeat).maybe.as(:array) >> + spaces? >> str(']') + } + + rule(:object) { + str('{') >> spaces? >> + (entry >> (comma >> entry).repeat).maybe.as(:object) >> + spaces? >> str('}') + } + + rule(:value) { + string | number | + object | array | + str('true').as(:true) | str('false').as(:false) | + str('null').as(:null) + } + + rule(:entry) { + ( + string.as(:key) >> spaces? >> + str(':') >> spaces? >> + value.as(:val) + ).as(:entry) + } + + rule(:attribute) { (entry | value).as(:attribute) } + + rule(:top) { spaces? >> value >> spaces? } + + root(:top) + end + + class Transformer < Parslet::Transform + + class Entry < Struct.new(:key, :val); end + + rule(:array => subtree(:ar)) { + ar.is_a?(Array) ? ar : [ ar ] + } + rule(:object => subtree(:ob)) { + (ob.is_a?(Array) ? ob : [ ob ]).inject({}) { |h, e| h[e.key] = e.val; h } + } + + rule(:entry => { :key => simple(:ke), :val => simple(:va) }) { + Entry.new(ke, va) + } + + rule(:string => simple(:st)) { + st.to_s + } + rule(:number => simple(:nb)) { + nb.match(/[eE\.]/) ? Float(nb) : Integer(nb) + } + + rule(:null => simple(:nu)) { nil } + rule(:true => simple(:tr)) { true } + rule(:false => simple(:fa)) { false } + end + + def self.parse(s) + + parser = Parser.new + transformer = Transformer.new + + tree = parser.parse(s) + puts; p tree; puts + out = transformer.apply(tree) + + out + end +end + + +s = %{ + [ 1, 2, 3, null, + "asdfasdf asdfds", { "a": -1.2 }, { "b": true, "c": false }, + 0.1e24, true, false, [ 1 ] ] +} + +out = MyJson.parse(s) + +p out; puts + +out == [ + 1, 2, 3, nil, + "asdfasdf asdfds", { "a" => -1.2 }, { "b" => true, "c" => false }, + 0.1e24, true, false, [ 1 ] +] || raise("MyJson is a failure") diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/local.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/local.rb new file mode 100644 index 000000000..a944082d3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/local.rb @@ -0,0 +1,34 @@ + +# An exploration of two ideas: +# a) Constructing a whole parser inline, without the artificial class around +# it. +# and: +# b) Constructing non-greedy or non-blind parsers by transforming the +# grammar. + +$:.unshift File.dirname(__FILE__) + "/../lib" + +require 'parslet' +include Parslet + +a = str('a').repeat >> str('aa') + +# E1% E2 +# +# S = E2 | E1 S + +def this(name, &block); return Parslet::Atoms::Entity.new(name, &block) end +def epsilon; any.absent? end + +# Traditional repetition will try as long as the pattern can be matched and +# then give up. This is greedy and blind. +a = str('a').as(:e) >> this('a') { a }.as(:rec) | epsilon + +# Here's a pattern match that is greedy and non-blind. The first pattern +# 'a'* will be tried as many times as possible, while still matching the +# end pattern 'aa'. +b = str('aa').as(:e2) >> epsilon | str('a').as(:e1) >> this('b') { b }.as(:rec) + +p a.parse('aaaa') +p b +p b.parse('aaaa') diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/mathn.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/mathn.rb new file mode 100644 index 000000000..44c0e5c17 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/mathn.rb @@ -0,0 +1,44 @@ +# Demonstrates that we have a compatibility fix to mathn's weird idea of +# integer mathematics. +# This was contributed by Jonathan Hinkle (https://github.com/hynkle). Thanks! + +$:.unshift File.dirname(__FILE__) + "/../lib" + +require 'parslet' +require 'parslet/convenience' +include Parslet + +def attempt_parse + possible_whitespace = match['\s'].repeat + + cephalopod = + str('octopus') | + str('squid') + + parenthesized_cephalopod = + str('(') >> + possible_whitespace >> + cephalopod >> + possible_whitespace >> + str(')') + + parser = + possible_whitespace >> + parenthesized_cephalopod >> + possible_whitespace + + # This parse fails, but that is not the point. When mathn is in the current + # ruby environment, it modifies integer division in a way that makes + # parslet loop indefinitely. + parser.parse %{(\nsqeed)\n} +rescue Parslet::ParseFailed +end + +attempt_parse +puts 'it terminates before we require mathn' + +puts "requiring mathn now" +require 'mathn' +puts "and trying again (will hang without the fix)" +attempt_parse # but it doesn't terminate after requiring mathn +puts "okay!" \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/minilisp.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/minilisp.rb new file mode 100644 index 000000000..fe7ac4e4f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/minilisp.rb @@ -0,0 +1,94 @@ +# Reproduces [1] using parslet. +# [1] http://thingsaaronmade.com/blog/a-quick-intro-to-writing-a-parser-using-treetop.html + +$:.unshift File.dirname(__FILE__) + "/../lib" + +require 'pp' +require 'parslet' +require 'parslet/convenience' + +module MiniLisp + class Parser < Parslet::Parser + root :expression + rule(:expression) { + space? >> str('(') >> space? >> body >> str(')') >> space? + } + + rule(:body) { + (expression | identifier | float | integer | string).repeat.as(:exp) + } + + rule(:space) { + match('\s').repeat(1) + } + rule(:space?) { + space.maybe + } + + rule(:identifier) { + (match('[a-zA-Z=*]') >> match('[a-zA-Z=*_]').repeat).as(:identifier) >> space? + } + + rule(:float) { + ( + integer >> ( + str('.') >> match('[0-9]').repeat(1) | + str('e') >> match('[0-9]').repeat(1) + ).as(:e) + ).as(:float) >> space? + } + + rule(:integer) { + ((str('+') | str('-')).maybe >> match("[0-9]").repeat(1)).as(:integer) >> space? + } + + rule(:string) { + str('"') >> ( + str('\\') >> any | + str('"').absent? >> any + ).repeat.as(:string) >> str('"') >> space? + } + end + + class Transform + include Parslet + + attr_reader :t + def initialize + @t = Parslet::Transform.new + + # To understand these, take a look at what comes out of the parser. + t.rule(:identifier => simple(:ident)) { ident.to_sym } + + t.rule(:string => simple(:str)) { str } + + t.rule(:integer => simple(:int)) { Integer(int) } + + t.rule(:float=>{:integer=> simple(:a), :e=> simple(:b)}) { Float(a + b) } + + t.rule(:exp => subtree(:exp)) { exp } + end + + def do(tree) + t.apply(tree) + end + end +end + +parser = MiniLisp::Parser.new +transform = MiniLisp::Transform.new + +result = parser.parse_with_debug %Q{ + (define test (lambda () + (begin + (display "something") + (display 1) + (display 3.08)))) +} + +# Transform the result +pp transform.do(result) if result + +# Thereby reducing it to the earlier problem: +# http://github.com/kschiess/toylisp + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/modularity.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/modularity.rb new file mode 100644 index 000000000..0e655face --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/modularity.rb @@ -0,0 +1,47 @@ +$:.unshift File.dirname(__FILE__) + "/../lib" + +require 'pp' +require "parslet" + +# Demonstrates modular parsers, split out over many classes. Please look at +# ip_address.rb as well. + +module ALanguage + include Parslet + + # Parslet rules are really a special kind of method. Mix them into your + # classes! + rule(:a_language) { str('aaa') } +end + +# Parslet parsers are parslet atoms as well. Create an instance and chain them +# to your other rules. +# +class BLanguage < Parslet::Parser + root :blang + + rule(:blang) { str('bbb') } +end + +# Parslet atoms are really Ruby values, pass them around. +c_language = Parslet.str('ccc') + +class Language < Parslet::Parser + def initialize(c_language) + @c_language = c_language + super() + end + + root :root + + include ALanguage + + rule(:root) { str('a(') >> a_language >> str(')') >> space | + str('b(') >> BLanguage.new >> str(')') >> space | + str('c(') >> @c_language >> str(')') >> space } + rule(:space) { str(' ').maybe } +end + +Language.new(c_language).parse('a(aaa)') +Language.new(c_language).parse('b(bbb)') +Language.new(c_language).parse('c(ccc)') \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/nested_errors.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/nested_errors.rb new file mode 100644 index 000000000..3feafcd81 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/nested_errors.rb @@ -0,0 +1,132 @@ +$:.unshift File.dirname(__FILE__) + "/../lib" + +require 'parslet' +require 'parslet/convenience' + +# This example demonstrates tree error reporting in a real life example. +# The parser code has been contributed by John Mettraux. + +def prettify(str) + puts " "*3 + " "*4 + "." + " "*4 + "10" + " "*3 + "." + " "*4 + "20" + str.lines.each_with_index do |line, index| + printf "%02d %s\n", + index+1, + line.chomp + end +end + +class Parser < Parslet::Parser + + # commons + + rule(:space) { match('[ \t]').repeat(1) } + rule(:space?) { space.maybe } + + rule(:newline) { match('[\r\n]') } + + rule(:comment) { str('#') >> match('[^\r\n]').repeat } + + rule(:line_separator) { + (space? >> ((comment.maybe >> newline) | str(';')) >> space?).repeat(1) + } + + rule(:blank) { line_separator | space } + rule(:blank?) { blank.maybe } + + rule(:identifier) { match('[a-zA-Z0-9_]').repeat(1) } + + # res_statement + + rule(:reference) { + (str('@').repeat(1,2) >> identifier).as(:reference) + } + + rule(:res_action_or_link) { + str('.').as(:dot) >> (identifier >> str('?').maybe ).as(:name) >> str('()') + } + + rule(:res_actions) { + ( + reference + ).as(:resources) >> + ( + res_action_or_link.as(:res_action) + ).repeat(0).as(:res_actions) + } + + rule(:res_statement) { + res_actions >> + (str(':') >> identifier.as(:name)).maybe.as(:res_field) + } + + # expression + + rule(:expression) { + res_statement + } + + # body + + rule(:body) { + (line_separator >> (block | expression)).repeat(1).as(:body) >> + line_separator + } + + # blocks + + rule(:begin_block) { + (str('concurrent').as(:type) >> space).maybe.as(:pre) >> + str('begin').as(:begin) >> + body >> + str('end') + } + + rule(:define_block) { + str('define').as(:define) >> space >> + identifier.as(:name) >> str('()') >> + body >> + str('end') + } + + rule(:block) { + define_block | begin_block + } + + # root + + rule(:radix) { + line_separator.maybe >> block >> line_separator.maybe + } + + root(:radix) +end + + +ds = [ + %{ + define f() + @res.name + end + }, + %{ + define f() + begin + @res.name + end + end + } +] + +ds.each do |d| + + puts '-' * 80 + prettify(d) + + parser = Parser.new + + begin + parser.parse_with_debug(d) + end +end + +puts '-' * 80 \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/boolean_algebra.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/boolean_algebra.out new file mode 100644 index 000000000..430ed54f9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/boolean_algebra.out @@ -0,0 +1,4 @@ +{:and=> + {:left=>{:var=>"1"@3}, + :right=>{:or=>{:left=>{:var=>"2"@13}, :right=>{:var=>"3"@21}}}}} +[["1", "2"], ["1", "3"]] diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/calc.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/calc.out new file mode 100644 index 000000000..d780a0499 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/calc.out @@ -0,0 +1 @@ +123*2 (command line): -> 246 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/capture.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/capture.out new file mode 100644 index 000000000..87519e2c8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/capture.out @@ -0,0 +1,3 @@ +[{:line=>"Text1\n"@9}, + {:doc=>[{:line=>"Text3\n"@23}, {:line=>"Text4\n"@29}]}, + {:line=>"\nText2\n"@41}] diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/comments.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/comments.out new file mode 100644 index 000000000..4026a3039 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/comments.out @@ -0,0 +1,8 @@ +[{:exp=>{:a=>"a"@3}}, + {:line=>"// line comment"@7}, + {:exp=>{:a=>"a"@25}}, + {:exp=>{:a=>"a"@27}}, + {:exp=>[{:a=>"a"@29}, {:line=>"// line comment"@31}]}, + {:exp=>[{:a=>"a"@49}, {:multi=>"/* inline comment */"@51}]}, + {:exp=>{:a=>"a"@72}}, + {:multi=>"/* multiline\n comment */"@77}] diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/deepest_errors.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/deepest_errors.out new file mode 100644 index 000000000..6b81f9b01 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/deepest_errors.out @@ -0,0 +1,54 @@ +-------------------------------------------------------------------------------- + . 10 . 20 +01 +02 define f() +03 @res.name +04 end +05 +Failed to match sequence (LINE_SEPARATOR? BLOCK LINE_SEPARATOR?) at line 2 char 5. +`- Expected one of [DEFINE_BLOCK, BEGIN_BLOCK] at line 2 char 5. + |- Failed to match sequence (define:'define' SPACE name:IDENTIFIER '()' BODY 'end') at line 2 char 15. + | `- Failed to match sequence (body:((LINE_SEPARATOR (BLOCK / EXPRESSION)){1, }) LINE_SEPARATOR) at line 3 char 11. + | `- Expected at least 1 of SPACE? (COMMENT? NEWLINE / ';') SPACE? at line 3 char 11. + | `- Failed to match sequence (SPACE? (COMMENT? NEWLINE / ';') SPACE?) at line 3 char 11. + | `- Expected one of [COMMENT? NEWLINE, ';'] at line 3 char 11. + | |- Failed to match sequence (COMMENT? NEWLINE) at line 3 char 11. + | | `- Expected "()", but got "\n " at line 3 char 16. + | `- Expected "()", but got "\n " at line 3 char 16. + `- Failed to match sequence (pre:((type:'concurrent' SPACE)?) begin:'begin' BODY 'end') at line 2 char 5. + `- Expected "()", but got "\n " at line 3 char 16. +-------------------------------------------------------------------------------- + . 10 . 20 +01 +02 define f() +03 begin +04 @res.name +05 end +06 end +07 +Failed to match sequence (LINE_SEPARATOR? BLOCK LINE_SEPARATOR?) at line 2 char 5. +`- Expected one of [DEFINE_BLOCK, BEGIN_BLOCK] at line 2 char 5. + |- Failed to match sequence (define:'define' SPACE name:IDENTIFIER '()' BODY 'end') at line 2 char 15. + | `- Failed to match sequence (body:((LINE_SEPARATOR (BLOCK / EXPRESSION)){1, }) LINE_SEPARATOR) at line 2 char 15. + | `- Expected at least 1 of LINE_SEPARATOR (BLOCK / EXPRESSION) at line 2 char 15. + | `- Failed to match sequence (LINE_SEPARATOR (BLOCK / EXPRESSION)) at line 3 char 7. + | `- Expected one of [BLOCK, EXPRESSION] at line 3 char 7. + | |- Expected one of [DEFINE_BLOCK, BEGIN_BLOCK] at line 3 char 7. + | | |- Failed to match sequence (define:'define' SPACE name:IDENTIFIER '()' BODY 'end') at line 3 char 7. + | | | `- Expected "define", but got "begin\n" at line 3 char 7. + | | `- Failed to match sequence (pre:((type:'concurrent' SPACE)?) begin:'begin' BODY 'end') at line 3 char 12. + | | `- Failed to match sequence (body:((LINE_SEPARATOR (BLOCK / EXPRESSION)){1, }) LINE_SEPARATOR) at line 4 char 13. + | | `- Expected at least 1 of SPACE? (COMMENT? NEWLINE / ';') SPACE? at line 4 char 13. + | | `- Failed to match sequence (SPACE? (COMMENT? NEWLINE / ';') SPACE?) at line 4 char 13. + | | `- Expected one of [COMMENT? NEWLINE, ';'] at line 4 char 13. + | | |- Failed to match sequence (COMMENT? NEWLINE) at line 4 char 13. + | | | `- Expected "()", but got "\n " at line 4 char 18. + | | `- Expected "()", but got "\n " at line 4 char 18. + | `- Failed to match sequence (RES_ACTIONS res_field:((':' name:IDENTIFIER)?)) at line 3 char 7. + | `- Failed to match sequence (resources:REFERENCE res_actions:(res_action:RES_ACTION_OR_LINK{0, })) at line 3 char 7. + | `- Failed to match sequence ('@'{1, 2} IDENTIFIER) at line 3 char 7. + | `- Expected at least 1 of '@' at line 3 char 7. + | `- Expected "()", but got "\n " at line 4 char 18. + `- Failed to match sequence (pre:((type:'concurrent' SPACE)?) begin:'begin' BODY 'end') at line 2 char 5. + `- Expected "()", but got "\n " at line 4 char 18. +-------------------------------------------------------------------------------- diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/documentation.err b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/documentation.err new file mode 100644 index 000000000..16b382fc8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/documentation.err @@ -0,0 +1,4 @@ +/Users/kaspar/git_work/own/parslet/lib/parslet/atoms/base.rb:326:in `parse_failed': Don't know what to do with bbbb at line 1 char 1. (Parslet::ParseFailed) + from /Users/kaspar/git_work/own/parslet/lib/parslet/atoms/base.rb:55:in `parse' + from example/documentation.rb:13:in `parse' + from example/documentation.rb:18:in `
    ' diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/documentation.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/documentation.out new file mode 100644 index 000000000..55aa425c9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/documentation.out @@ -0,0 +1 @@ +"aaaa"@0 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/email_parser.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/email_parser.out new file mode 100644 index 000000000..da385c6b6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/email_parser.out @@ -0,0 +1,2 @@ +since you haven't specified any EMAIL_ADDR, for testing purposes we're using a.b.c.d@gmail.com +"a.b.c.d@gmail.com" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/empty.err b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/empty.err new file mode 100644 index 000000000..61658ec9e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/empty.err @@ -0,0 +1 @@ +example/empty.rb:13:in `
    ': rule(:empty) { ... } returns nil. Still not implemented, but already used? (NotImplementedError) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/erb.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/erb.out new file mode 100644 index 000000000..b86db3aac --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/erb.out @@ -0,0 +1,7 @@ +{:text=>[{:text=>"The value of x is "@0}, {:expression=>{:ruby=>" x "@21}}, {:text=>"."@26}]} +{:text=>[{:code=>{:ruby=>" 1 + 2 "@2}}]} +{:text=>[{:comment=>{:ruby=>" commented "@3}}]} +The not printed result of "a = 2". +The not printed non-evaluated comment "a = 1", see the value of a below. +The nicely printed result. +The value of a is 2, and b is 3. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/ignore.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/ignore.out new file mode 100644 index 000000000..450fdfd10 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/ignore.out @@ -0,0 +1 @@ +"ac"@0 diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/ignore_whitespace.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/ignore_whitespace.out new file mode 100644 index 000000000..f778f0974 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/ignore_whitespace.out @@ -0,0 +1 @@ +[{:a=>"a"@0}, {:a=>"a"@1}, {:a=>"a"@5}, {:a=>"a"@7}] diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/ip_address.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/ip_address.out new file mode 100644 index 000000000..a15d77785 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/ip_address.out @@ -0,0 +1,9 @@ + 0.0.0.0 -> {:ipv4=>"0.0.0.0"@0} + 255.255.255.255 -> {:ipv4=>"255.255.255.255"@0} + 255.255.255 -> Failed: Expected one of [IPV4, IPV6] at line 1 char 1. + 1:2:3:4:5:6:7:8 -> {:ipv6=>"1:2:3:4:5:6:7:8"@0} + 12AD:34FC:A453:1922:: -> {:ipv6=>"12AD:34FC:A453:1922::"@0} + 12AD::34FC -> {:ipv6=>"12AD::34FC"@0} + 12AD:: -> {:ipv6=>"12AD::"@0} + :: -> {:ipv6=>"::"@0} + 1:2 -> Failed: Expected one of [IPV4, IPV6] at line 1 char 1. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/json.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/json.out new file mode 100644 index 000000000..c3190ad44 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/json.out @@ -0,0 +1,5 @@ + +{:array=>[{:number=>"1"@5}, {:number=>"2"@8}, {:number=>"3"@11}, {:null=>"null"@14}, {:string=>"asdfasdf asdfds"@25}, {:object=>{:entry=>{:key=>{:string=>"a"@46}, :val=>{:number=>"-1.2"@50}}}}, {:object=>[{:entry=>{:key=>{:string=>"b"@61}, :val=>{:true=>"true"@65}}}, {:entry=>{:key=>{:string=>"c"@72}, :val=>{:false=>"false"@76}}}]}, {:number=>"0.1e24"@89}, {:true=>"true"@97}, {:false=>"false"@103}, {:array=>{:number=>"1"@112}}]} + +[1, 2, 3, nil, "asdfasdf asdfds", {"a"=>-1.2}, {"b"=>true, "c"=>false}, 1.0e+23, true, false, [1]] + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/local.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/local.out new file mode 100644 index 000000000..f6f44ca3a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/local.out @@ -0,0 +1,3 @@ +{:e=>"a"@0, :rec=>{:e=>"a"@1, :rec=>{:e=>"a"@2, :rec=>{:e=>"a"@3, :rec=>nil}}}} +e2:'aa' !. / e1:'a' rec:B +{:e1=>"a"@0, :rec=>{:e1=>"a"@1, :rec=>{:e2=>"aa"@2}}} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/mathn.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/mathn.out new file mode 100644 index 000000000..e1187d073 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/mathn.out @@ -0,0 +1,4 @@ +it terminates before we require mathn +requiring mathn now +and trying again (will hang without the fix) +okay! diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/minilisp.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/minilisp.out new file mode 100644 index 000000000..423431f5e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/minilisp.out @@ -0,0 +1,5 @@ +[:define, + :test, + [:lambda, + [], + [:begin, [:display, "something"@54], [:display, 1], [:display, 3.08]]]] diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/modularity.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/modularity.out new file mode 100644 index 000000000..e69de29bb diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/nested_errors.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/nested_errors.out new file mode 100644 index 000000000..b6bd833b0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/nested_errors.out @@ -0,0 +1,54 @@ +-------------------------------------------------------------------------------- + . 10 . 20 +01 +02 define f() +03 @res.name +04 end +05 +Failed to match sequence (LINE_SEPARATOR? BLOCK LINE_SEPARATOR?) at line 2 char 5. +`- Expected one of [DEFINE_BLOCK, BEGIN_BLOCK] at line 2 char 5. + |- Failed to match sequence (define:'define' SPACE name:IDENTIFIER '()' BODY 'end') at line 2 char 15. + | `- Failed to match sequence (body:((LINE_SEPARATOR (BLOCK / EXPRESSION)){1, }) LINE_SEPARATOR) at line 3 char 11. + | `- Expected at least 1 of SPACE? (COMMENT? NEWLINE / ';') SPACE? at line 3 char 11. + | `- Failed to match sequence (SPACE? (COMMENT? NEWLINE / ';') SPACE?) at line 3 char 11. + | `- Expected one of [COMMENT? NEWLINE, ';'] at line 3 char 11. + | |- Failed to match sequence (COMMENT? NEWLINE) at line 3 char 11. + | | `- Failed to match [\\r\\n] at line 3 char 11. + | `- Expected ";", but got "." at line 3 char 11. + `- Failed to match sequence (pre:((type:'concurrent' SPACE)?) begin:'begin' BODY 'end') at line 2 char 5. + `- Expected "begin", but got "defin" at line 2 char 5. +-------------------------------------------------------------------------------- + . 10 . 20 +01 +02 define f() +03 begin +04 @res.name +05 end +06 end +07 +Failed to match sequence (LINE_SEPARATOR? BLOCK LINE_SEPARATOR?) at line 2 char 5. +`- Expected one of [DEFINE_BLOCK, BEGIN_BLOCK] at line 2 char 5. + |- Failed to match sequence (define:'define' SPACE name:IDENTIFIER '()' BODY 'end') at line 2 char 15. + | `- Failed to match sequence (body:((LINE_SEPARATOR (BLOCK / EXPRESSION)){1, }) LINE_SEPARATOR) at line 2 char 15. + | `- Expected at least 1 of LINE_SEPARATOR (BLOCK / EXPRESSION) at line 2 char 15. + | `- Failed to match sequence (LINE_SEPARATOR (BLOCK / EXPRESSION)) at line 3 char 7. + | `- Expected one of [BLOCK, EXPRESSION] at line 3 char 7. + | |- Expected one of [DEFINE_BLOCK, BEGIN_BLOCK] at line 3 char 7. + | | |- Failed to match sequence (define:'define' SPACE name:IDENTIFIER '()' BODY 'end') at line 3 char 7. + | | | `- Expected "define", but got "begin\n" at line 3 char 7. + | | `- Failed to match sequence (pre:((type:'concurrent' SPACE)?) begin:'begin' BODY 'end') at line 3 char 12. + | | `- Failed to match sequence (body:((LINE_SEPARATOR (BLOCK / EXPRESSION)){1, }) LINE_SEPARATOR) at line 4 char 13. + | | `- Expected at least 1 of SPACE? (COMMENT? NEWLINE / ';') SPACE? at line 4 char 13. + | | `- Failed to match sequence (SPACE? (COMMENT? NEWLINE / ';') SPACE?) at line 4 char 13. + | | `- Expected one of [COMMENT? NEWLINE, ';'] at line 4 char 13. + | | |- Failed to match sequence (COMMENT? NEWLINE) at line 4 char 13. + | | | `- Failed to match [\\r\\n] at line 4 char 13. + | | `- Expected ";", but got "." at line 4 char 13. + | `- Failed to match sequence (RES_ACTIONS res_field:((':' name:IDENTIFIER)?)) at line 3 char 7. + | `- Failed to match sequence (resources:REFERENCE res_actions:(res_action:RES_ACTION_OR_LINK{0, })) at line 3 char 7. + | `- Failed to match sequence ('@'{1, 2} IDENTIFIER) at line 3 char 7. + | `- Expected at least 1 of '@' at line 3 char 7. + | `- Expected "@", but got "b" at line 3 char 7. + `- Failed to match sequence (pre:((type:'concurrent' SPACE)?) begin:'begin' BODY 'end') at line 2 char 5. + `- Expected "begin", but got "defin" at line 2 char 5. +-------------------------------------------------------------------------------- diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/parens.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/parens.out new file mode 100644 index 000000000..d63510110 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/parens.out @@ -0,0 +1,8 @@ + (): {:l=>"("@0, :m=>nil, :r=>")"@1} (1 parens) + + (()): {:l=>"("@0, :m=>{:l=>"("@1, :m=>nil, :r=>")"@2}, :r=>")"@3} (2 parens) + + ((((())))): {:l=>"("@0, :m=>{:l=>"("@1, :m=>{:l=>"("@2, :m=>{:l=>"("@3, :m=>{:l=>"("@4, :m=>nil, :r=>")"@5}, :r=>")"@6}, :r=>")"@7}, :r=>")"@8}, :r=>")"@9} (5 parens) + + ((()): Failed to match sequence (l:'(' m:(BALANCED?) r:')') at line 1 char 6. + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/readme.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/readme.out new file mode 100644 index 000000000..b04aa33da --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/readme.out @@ -0,0 +1 @@ +String contents: This is a \"String\" in which you can escape stuff diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/scopes.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/scopes.out new file mode 100644 index 000000000..8d9b2df7a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/scopes.out @@ -0,0 +1 @@ +parses 'aba' diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/seasons.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/seasons.out new file mode 100644 index 000000000..e018f824d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/seasons.out @@ -0,0 +1,28 @@ +"And when Spring comes" +{:bud=>{:stem=>[{:branch=>:leaf}]}} + +"And when Summer comes" +{:bud=>{:stem=>[{:branch=>[:leaf, :flower]}]}} + +"And when Fall comes" +Fruit! +Falling Leaves! +{:bud=>{:stem=>[{:branch=>[]}]}} + +"And when Winter comes" +{:bud=>{:stem=>[]}} + +"And when Spring comes" +{:bud=>{:stem=>[{:branch=>:leaf}]}} + +"And when Summer comes" +{:bud=>{:stem=>[{:branch=>[:leaf, :flower]}]}} + +"And when Fall comes" +Fruit! +Falling Leaves! +{:bud=>{:stem=>[{:branch=>[]}]}} + +"And when Winter comes" +{:bud=>{:stem=>[]}} + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/sentence.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/sentence.out new file mode 100644 index 000000000..f183a2490 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/sentence.out @@ -0,0 +1 @@ +["RubyKaigi2009のテーマは、「変わる/変える」です。", " 前回のRubyKaigi2008のテーマであった「多様性」の言葉の通り、 2008年はRubyそのものに関しても、またRubyの活躍する舞台に関しても、 ますます多様化が進みつつあります。", "RubyKaigi2008は、そのような Rubyの生態系をあらためて認識する場となりました。", " しかし、こうした多様化が進む中、異なる者同士が単純に距離を 置いたままでは、その違いを認識したところであまり意味がありません。", " 異なる実装、異なる思想、異なる背景といった、様々な多様性を理解しつつ、 すり合わせるべきものをすり合わせ、変えていくべきところを 変えていくことが、豊かな未来へとつながる道に違いありません。"] diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/simple_xml.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/simple_xml.out new file mode 100644 index 000000000..015941fa1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/simple_xml.out @@ -0,0 +1,2 @@ +"verified" +{:o=>{:name=>"b"@1}, :i=>"verified", :c=>{:name=>"a"@33}} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/string_parser.out b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/string_parser.out new file mode 100644 index 000000000..b7e497f1c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/output/string_parser.out @@ -0,0 +1,3 @@ +[#, + #, + #] diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/parens.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/parens.rb new file mode 100644 index 000000000..bcc20f48d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/parens.rb @@ -0,0 +1,42 @@ +# A small example that demonstrates the power of tree pattern matching. Also +# uses '.as(:name)' to construct a tree that can reliably be matched +# afterwards. + +$:.unshift File.dirname(__FILE__) + "/../lib" + +require 'pp' +require 'parslet' + +module LISP # as in 'lots of insipid and stupid parenthesis' + class Parser < Parslet::Parser + rule(:balanced) { + str('(').as(:l) >> balanced.maybe.as(:m) >> str(')').as(:r) + } + + root(:balanced) + end + + class Transform < Parslet::Transform + rule(:l => '(', :m => simple(:x), :r => ')') { + # innermost :m will contain nil + x.nil? ? 1 : x+1 + } + end +end + +parser = LISP::Parser.new +transform = LISP::Transform.new +%w! + () + (()) + ((((())))) + ((()) +!.each do |pexp| + begin + result = parser.parse(pexp) + puts "#{"%20s"%pexp}: #{result.inspect} (#{transform.apply(result)} parens)" + rescue Parslet::ParseFailed => m + puts "#{"%20s"%pexp}: #{m}" + end + puts +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/readme.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/readme.rb new file mode 100644 index 000000000..36f38d0f8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/readme.rb @@ -0,0 +1,30 @@ +# The example from the readme. With this, I am making sure that the readme +# 'works'. Is this too messy? + +$:.unshift File.dirname(__FILE__) + "/../lib" + +# cut here ------------------------------------------------------------------- +require 'parslet' +include Parslet + +# Constructs a parser using a Parser Expression Grammar like DSL: +parser = str('"') >> + ( + str('\\') >> any | + str('"').absent? >> any + ).repeat.as(:string) >> + str('"') + +# Parse the string and capture parts of the interpretation (:string above) +tree = parser.parse('"This is a \\"String\\" in which you can escape stuff"') + +tree # => {:string=>"This is a \\\"String\\\" in which you can escape stuff"} + +# Here's how you can grab results from that tree: + +transform = Parslet::Transform.new do + rule(:string => simple(:x)) { + puts "String contents: #{x}" } +end +transform.apply(tree) + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/scopes.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/scopes.rb new file mode 100644 index 000000000..8de07d922 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/scopes.rb @@ -0,0 +1,15 @@ + +$:.unshift File.dirname(__FILE__) + "/../lib" +require 'parslet' + +include Parslet + +parser = str('a').capture(:a) >> scope { str('b').capture(:a) } >> + dynamic { |s,c| str(c.captures[:a]) } + +begin + parser.parse('aba') + puts "parses 'aba'" +rescue + puts "exception!" +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/seasons.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/seasons.rb new file mode 100644 index 000000000..41c525b9f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/seasons.rb @@ -0,0 +1,46 @@ +$:.unshift File.dirname(__FILE__) + "/../lib" + +require 'parslet' +require 'pp' + +tree = {:bud => {:stem => []}} + +class Spring < Parslet::Transform + rule(:stem => sequence(:branches)) { + {:stem => (branches + [{:branch => :leaf}])} + } +end +class Summer < Parslet::Transform + rule(:stem => subtree(:branches)) { + new_branches = branches.map { |b| {:branch => [:leaf, :flower]} } + {:stem => new_branches} + } +end +class Fall < Parslet::Transform + rule(:branch => sequence(:x)) { + x.each { |e| puts "Fruit!" if e==:flower } + x.each { |e| puts "Falling Leaves!" if e==:leaf } + {:branch => []} + } +end +class Winter < Parslet::Transform + rule(:stem => subtree(:x)) { + {:stem => []} + } +end + +def do_seasons(tree) + [Spring, Summer, Fall, Winter].each do |season| + p "And when #{season} comes" + tree = season.new.apply(tree) + pp tree + puts + end + tree +end + +# What marvel of life! +tree = do_seasons(tree) +tree = do_seasons(tree) + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/sentence.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/sentence.rb new file mode 100644 index 000000000..b73d140dc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/sentence.rb @@ -0,0 +1,36 @@ +# encoding: UTF-8 + +# A small example contributed by John Mettraux (jmettraux) that demonstrates +# working with Unicode. This only works on Ruby 1.9. + +$:.unshift File.dirname(__FILE__) + "/../lib" + +require 'parslet' + +class Parser < Parslet::Parser + rule(:sentence) { (match('[^。]').repeat(1) >> str("。")).as(:sentence) } + rule(:sentences) { sentence.repeat } + root(:sentences) +end + +class Transformer < Parslet::Transform + rule(:sentence => simple(:sen)) { sen.to_s } +end + +string = + "RubyKaigi2009のテーマは、「変わる/変える」です。 前回の" + + "RubyKaigi2008のテーマであった「多様性」の言葉の通り、 " + + "2008年はRubyそのものに関しても、またRubyの活躍する舞台に関しても、 " + + "ますます多様化が進みつつあります。RubyKaigi2008は、そのような " + + "Rubyの生態系をあらためて認識する場となりました。 しかし、" + + "こうした多様化が進む中、異なる者同士が単純に距離を 置いたままでは、" + + "その違いを認識したところであまり意味がありません。 異なる実装、" + + "異なる思想、異なる背景といった、様々な多様性を理解しつつ、 " + + "すり合わせるべきものをすり合わせ、変えていくべきところを " + + "変えていくことが、豊かな未来へとつながる道に違いありません。" + +parser = Parser.new +transformer = Transformer.new + +tree = parser.parse(string) +p transformer.apply(tree) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/simple.lit b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/simple.lit new file mode 100644 index 000000000..fa5a49bc0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/simple.lit @@ -0,0 +1,3 @@ +123 +12345 +" Some String with \"escapes\"" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/simple_xml.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/simple_xml.rb new file mode 100644 index 000000000..d6462e0b9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/simple_xml.rb @@ -0,0 +1,54 @@ +# A simple xml parser. It is simple in the respect as that it doesn't address +# any of the complexities of XML. This is ruby 1.9. + +$:.unshift File.dirname(__FILE__) + "/../lib" + +require 'pp' +require 'parslet' + +class XML < Parslet::Parser + root :document + + rule(:document) { + tag(close: false).as(:o) >> document.as(:i) >> tag(close: true).as(:c) | + text + } + + # Perhaps we could have some syntax sugar to make this more easy? + # + def tag(opts={}) + close = opts[:close] || false + + parslet = str('<') + parslet = parslet >> str('/') if close + parslet = parslet >> (str('>').absent? >> match("[a-zA-Z]")).repeat(1).as(:name) + parslet = parslet >> str('>') + + parslet + end + + rule(:text) { + match('[^<>]').repeat(0) + } +end + +def check(xml) + r = XML.new.parse(xml) + + # We'll validate the tree by reducing valid pairs of tags into simply the + # string "verified". If the transformation ends on a string, then the + # document was 'valid'. + # + t = Parslet::Transform.new do + rule( + o: {name: simple(:tag)}, + c: {name: simple(:tag)}, + i: simple(:t) + ) { 'verified' } + end + + t.apply(r) +end + +pp check("some text in the tags") +pp check("some text in the tags") diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/string_parser.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/string_parser.rb new file mode 100644 index 000000000..b38bbe000 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/string_parser.rb @@ -0,0 +1,77 @@ +# A more complex parser that illustrates how a compiler might be constructed. +# The parser recognizes strings and integer literals and constructs almost a +# useful AST from the file contents. + +require 'pp' + +$:.unshift File.dirname(__FILE__) + "/../lib" +require 'parslet' + +include Parslet + +class LiteralsParser < Parslet::Parser + rule :space do + (match '[ ]').repeat(1) + end + + rule :literals do + (literal >> eol).repeat + end + + rule :literal do + (integer | string).as(:literal) >> space.maybe + end + + rule :string do + str('"') >> + ( + (str('\\') >> any) | + (str('"').absent? >> any) + ).repeat.as(:string) >> + str('"') + end + + rule :integer do + match('[0-9]').repeat(1).as(:integer) + end + + rule :eol do + line_end.repeat(1) + end + + rule :line_end do + crlf >> space.maybe + end + + rule :crlf do + match('[\r\n]').repeat(1) + end + + root :literals +end + +input_name = File.join(File.dirname(__FILE__), 'simple.lit') +file = File.read(input_name) + +parsetree = LiteralsParser.new.parse(file) + +class Lit < Struct.new(:text) + def to_s + text.inspect + end +end +class StringLit < Lit +end +class IntLit < Lit + def to_s + text + end +end + +transform = Parslet::Transform.new do + rule(:literal => {:integer => simple(:x)}) { IntLit.new(x) } + rule(:literal => {:string => simple(:s)}) { StringLit.new(s) } +end + +ast = transform.apply(parsetree) +pp ast diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/test.lit b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/test.lit new file mode 100644 index 000000000..b1edd0d44 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/example/test.lit @@ -0,0 +1,4 @@ +"THis is a string" +"This is another string" +"This string is escaped \"embedded quoted stuff \" " +12 // an integer literal and a comment diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet.rb new file mode 100644 index 000000000..cebd3c5d7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet.rb @@ -0,0 +1,270 @@ +# A simple parser generator library. Typical usage would look like this: +# +# require 'parslet' +# +# class MyParser < Parslet::Parser +# rule(:a) { str('a').repeat } +# root(:a) +# end +# +# pp MyParser.new.parse('aaaa') # => 'aaaa'@0 +# pp MyParser.new.parse('bbbb') # => Parslet::Atoms::ParseFailed: +# # Don't know what to do with bbbb at line 1 char 1. +# +# The simple DSL allows you to define grammars in PEG-style. This kind of +# grammar construction does away with the ambiguities that usually comes with +# parsers; instead, it allows you to construct grammars that are easier to +# debug, since less magic is involved. +# +# Parslet is typically used in stages: +# +# +# * Parsing the input string; this yields an intermediary tree, see +# Parslet.any, Parslet.match, Parslet.str, Parslet::ClassMethods#rule and +# Parslet::ClassMethods#root. +# * Transformation of the tree into something useful to you, see +# Parslet::Transform, Parslet.simple, Parslet.sequence and Parslet.subtree. +# +# The first stage is traditionally intermingled with the second stage; output +# from the second stage is usually called the 'Abstract Syntax Tree' or AST. +# +# The stages are completely decoupled; You can change your grammar around and +# use the second stage to isolate the rest of your code from the changes +# you've effected. +# +# == Further reading +# +# All parslet atoms are subclasses of {Parslet::Atoms::Base}. You might want to +# look at all of those: {Parslet::Atoms::Re}, {Parslet::Atoms::Str}, +# {Parslet::Atoms::Repetition}, {Parslet::Atoms::Sequence}, +# {Parslet::Atoms::Alternative}. +# +# == When things go wrong +# +# A parse that fails will raise {Parslet::ParseFailed}. This exception contains +# all the details of what went wrong, including a detailed error trace that +# can be printed out as an ascii tree. ({Parslet::Cause}) +# +module Parslet + # Extends classes that include Parslet with the module + # {Parslet::ClassMethods}. + # + def self.included(base) + base.extend(ClassMethods) + end + + # Raised when the parse failed to match. It contains the message that should + # be presented to the user. More details can be extracted from the + # exceptions #cause member: It contains an instance of {Parslet::Cause} that + # stores all the details of your failed parse in a tree structure. + # + # begin + # parslet.parse(str) + # rescue Parslet::ParseFailed => failure + # puts failure.cause.ascii_tree + # end + # + # Alternatively, you can just require 'parslet/convenience' and call the + # method #parse_with_debug instead of #parse. This method will never raise + # and print error trees to stdout. + # + # require 'parslet/convenience' + # parslet.parse_with_debug(str) + # + class ParseFailed < StandardError + def initialize(message, cause=nil) + super(message) + @cause = cause + end + + # Why the parse failed. + # + # @return [Parslet::Cause] + attr_reader :cause + end + + module ClassMethods + # Define an entity for the parser. This generates a method of the same + # name that can be used as part of other patterns. Those methods can be + # freely mixed in your parser class with real ruby methods. + # + # class MyParser + # include Parslet + # + # rule(:bar) { str('bar') } + # rule(:twobar) do + # bar >> bar + # end + # + # root :twobar + # end + # + def rule(name, &definition) + define_method(name) do + @rules ||= {} # memoization + return @rules[name] if @rules.has_key?(name) + + # Capture the self of the parser class along with the definition. + definition_closure = proc { + self.instance_eval(&definition) + } + + @rules[name] = Atoms::Entity.new(name, &definition_closure) + end + end + end + + # Allows for delayed construction of #match. See also Parslet.match. + # + # @api private + class DelayedMatchConstructor + def [](str) + Atoms::Re.new("[" + str + "]") + end + end + + # Returns an atom matching a character class. All regular expressions can be + # used, as long as they match only a single character at a time. + # + # match('[ab]') # will match either 'a' or 'b' + # match('[\n\s]') # will match newlines and spaces + # + # There is also another (convenience) form of this method: + # + # match['a-z'] # synonymous to match('[a-z]') + # match['\n'] # synonymous to match('[\n]') + # + # @overload match(str) + # @param str [String] character class to match (regexp syntax) + # @return [Parslet::Atoms::Re] a parslet atom + # + def match(str=nil) + return DelayedMatchConstructor.new unless str + + return Atoms::Re.new(str) + end + module_function :match + + # Returns an atom matching the +str+ given: + # + # str('class') # will match 'class' + # + # @param str [String] string to match verbatim + # @return [Parslet::Atoms::Str] a parslet atom + # + def str(str) + Atoms::Str.new(str) + end + module_function :str + + # Returns an atom matching any character. It acts like the '.' (dot) + # character in regular expressions. + # + # any.parse('a') # => 'a' + # + # @return [Parslet::Atoms::Re] a parslet atom + # + def any + Atoms::Re.new('.') + end + module_function :any + + # Introduces a new capture scope. This means that all old captures stay + # accessible, but new values stored will only be available during the block + # given and the old values will be restored after the block. + # + # Example: + # # :a will be available until the end of the block. Afterwards, + # # :a from the outer scope will be available again, if such a thing + # # exists. + # scope { str('a').capture(:a) } + # + def scope(&block) + Parslet::Atoms::Scope.new(block) + end + module_function :scope + + # Designates a piece of the parser as being dynamic. Dynamic parsers can + # either return a parser at runtime, which will be applied on the input, or + # return a result from a parse. + # + # Dynamic parse pieces are never cached and can introduce performance + # abnormalitites - use sparingly where other constructs fail. + # + # Example: + # # Parses either 'a' or 'b', depending on the weather + # dynamic { rand() < 0.5 ? str('a') : str('b') } + # + def dynamic(&block) + Parslet::Atoms::Dynamic.new(block) + end + module_function :dynamic + + # A special kind of atom that allows embedding whole treetop expressions + # into parslet construction. + # + # # the same as str('a') >> str('b').maybe + # exp(%Q("a" "b"?)) + # + # @param str [String] a treetop expression + # @return [Parslet::Atoms::Base] the corresponding parslet parser + # + def exp(str) + Parslet::Expression.new(str).to_parslet + end + module_function :exp + + # Returns a placeholder for a tree transformation that will only match a + # sequence of elements. The +symbol+ you specify will be the key for the + # matched sequence in the returned dictionary. + # + # # This would match a body element that contains several declarations. + # { :body => sequence(:declarations) } + # + # The above example would match :body => ['a', 'b'], but not + # :body => 'a'. + # + # see {Parslet::Transform} + # + def sequence(symbol) + Pattern::SequenceBind.new(symbol) + end + module_function :sequence + + # Returns a placeholder for a tree transformation that will only match + # simple elements. This matches everything that #sequence + # doesn't match. + # + # # Matches a single header. + # { :header => simple(:header) } + # + # see {Parslet::Transform} + # + def simple(symbol) + Pattern::SimpleBind.new(symbol) + end + module_function :simple + + # Returns a placeholder for tree transformation patterns that will match + # any kind of subtree. + # + # { :expression => subtree(:exp) } + # + def subtree(symbol) + Pattern::SubtreeBind.new(symbol) + end + module_function :subtree + + autoload :Expression, 'parslet/expression' +end + +require 'parslet/slice' +require 'parslet/cause' +require 'parslet/source' +require 'parslet/atoms' +require 'parslet/pattern' +require 'parslet/pattern/binding' +require 'parslet/transform' +require 'parslet/parser' +require 'parslet/error_reporter' +require 'parslet/scope' \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms.rb new file mode 100644 index 000000000..91e52e39b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms.rb @@ -0,0 +1,34 @@ + +# This is where parslets name comes from: Small parser atoms. +# +module Parslet::Atoms + # The precedence module controls parenthesis during the #inspect printing + # of parslets. It is not relevant to other aspects of the parsing. + # + module Precedence + prec = 0 + BASE = (prec+=1) # everything else + LOOKAHEAD = (prec+=1) # &SOMETHING + REPETITION = (prec+=1) # 'a'+, 'a'? + SEQUENCE = (prec+=1) # 'a' 'b' + ALTERNATE = (prec+=1) # 'a' | 'b' + OUTER = (prec+=1) # printing is done here. + end + + require 'parslet/atoms/can_flatten' + require 'parslet/atoms/context' + require 'parslet/atoms/dsl' + require 'parslet/atoms/base' + require 'parslet/atoms/named' + require 'parslet/atoms/lookahead' + require 'parslet/atoms/alternative' + require 'parslet/atoms/sequence' + require 'parslet/atoms/repetition' + require 'parslet/atoms/re' + require 'parslet/atoms/str' + require 'parslet/atoms/entity' + require 'parslet/atoms/capture' + require 'parslet/atoms/dynamic' + require 'parslet/atoms/scope' +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/alternative.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/alternative.rb new file mode 100644 index 000000000..c5f2e39fa --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/alternative.rb @@ -0,0 +1,50 @@ + +# Alternative during matching. Contains a list of parslets that is tried each +# one in turn. Only fails if all alternatives fail. +# +# Example: +# +# str('a') | str('b') # matches either 'a' or 'b' +# +class Parslet::Atoms::Alternative < Parslet::Atoms::Base + attr_reader :alternatives + + # Constructs an Alternative instance using all given parslets in the order + # given. This is what happens if you call '|' on existing parslets, like + # this: + # + # str('a') | str('b') + # + def initialize(*alternatives) + super() + + @alternatives = alternatives + @error_msg = "Expected one of #{alternatives.inspect}" + end + + #--- + # Don't construct a hanging tree of Alternative parslets, instead store them + # all here. This reduces the number of objects created. + #+++ + def |(parslet) + self.class.new(*@alternatives + [parslet]) + end + + def try(source, context, consume_all) + errors = alternatives.map { |a| + success, value = result = a.apply(source, context, consume_all) + return result if success + + # Aggregate all errors + value + } + + # If we reach this point, all alternatives have failed. + context.err(self, source, @error_msg, errors) + end + + precedence ALTERNATE + def to_s_inner(prec) + alternatives.map { |a| a.to_s(prec) }.join(' / ') + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/base.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/base.rb new file mode 100644 index 000000000..468790541 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/base.rb @@ -0,0 +1,151 @@ +# Base class for all parslets, handles orchestration of calls and implements +# a lot of the operator and chaining methods. +# +# Also see Parslet::Atoms::DSL chaining parslet atoms together. +# +class Parslet::Atoms::Base + include Parslet::Atoms::Precedence + include Parslet::Atoms::DSL + include Parslet::Atoms::CanFlatten + + # Given a string or an IO object, this will attempt a parse of its contents + # and return a result. If the parse fails, a Parslet::ParseFailed exception + # will be thrown. + # + # @param io [String, Source] input for the parse process + # @option options [Parslet::ErrorReporter] :reporter error reporter to use, + # defaults to Parslet::ErrorReporter::Tree + # @option options [Boolean] :prefix Should a prefix match be accepted? + # (default: false) + # @return [Hash, Array, Parslet::Slice] PORO (Plain old Ruby object) result + # tree + # + def parse(io, options={}) + source = io.respond_to?(:line_and_column) ? + io : + Parslet::Source.new(io) + + # Try to cheat. Assuming that we'll be able to parse the input, don't + # run error reporting code. + success, value = setup_and_apply(source, nil, !options[:prefix]) + + # If we didn't succeed the parse, raise an exception for the user. + # Stack trace will be off, but the error tree should explain the reason + # it failed. + unless success + # Cheating has not paid off. Now pay the cost: Rerun the parse, + # gathering error information in the process. + reporter = options[:reporter] || Parslet::ErrorReporter::Tree.new + source.pos = 0 + success, value = setup_and_apply(source, reporter, !options[:prefix]) + + fail "Assertion failed: success was true when parsing with reporter" \ + if success + + # Value is a Parslet::Cause, which can be turned into an exception: + value.raise + + fail "NEVER REACHED" + end + + # assert: success is true + + # Extra input is now handled inline with the rest of the parsing. If + # really we have success == true, prefix: false and still some input + # is left dangling, that is a BUG. + if !options[:prefix] && source.chars_left > 0 + fail "BUG: New error strategy should not reach this point." + end + + return flatten(value) + end + + # Creates a context for parsing and applies the current atom to the input. + # Returns the parse result. + # + # @return [] Result of the parse. If the first member is + # true, the parse has succeeded. + def setup_and_apply(source, error_reporter, consume_all) + context = Parslet::Atoms::Context.new(error_reporter) + apply(source, context, consume_all) + end + + # Calls the #try method of this parslet. Success consumes input, error will + # rewind the input. + # + # @param source [Parslet::Source] source to read input from + # @param context [Parslet::Atoms::Context] context to use for the parsing + # @param consume_all [Boolean] true if the current parse must consume + # all input by itself. + def apply(source, context, consume_all=false) + old_pos = source.pos + + success, value = result = context.try_with_cache(self, source, consume_all) + + if success + # If a consume_all parse was made and doesn't result in the consumption + # of all the input, that is considered an error. + if consume_all && source.chars_left>0 + # Read 10 characters ahead. Why ten? I don't know. + offending_pos = source.pos + offending_input = source.consume(10) + + # Rewind input (as happens always in error case) + source.pos = old_pos + + return context.err_at( + self, + source, + "Don't know what to do with #{offending_input.to_s.inspect}", + offending_pos + ) + end + + # Looks like the parse was successful after all. Don't rewind the input. + return result + end + + # We only reach this point if the parse has failed. Rewind the input. + source.pos = old_pos + return result + end + + # Override this in your Atoms::Base subclasses to implement parsing + # behaviour. + # + def try(source, context, consume_all) + raise NotImplementedError, \ + "Atoms::Base doesn't have behaviour, please implement #try(source, context)." + end + + # Returns true if this atom can be cached in the packrat cache. Most parslet + # atoms are cached, so this always returns true, unless overridden. + # + def cached? + true + end + + # Debug printing - in Treetop syntax. + # + def self.precedence(prec) + define_method(:precedence) { prec } + end + precedence BASE + def to_s(outer_prec=OUTER) + if outer_prec < precedence + "("+to_s_inner(precedence)+")" + else + to_s_inner(precedence) + end + end + def inspect + to_s(OUTER) + end +private + + # Produces an instance of Success and returns it. + # + def succ(result) + [true, result] + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/can_flatten.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/can_flatten.rb new file mode 100644 index 000000000..8f5badc9a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/can_flatten.rb @@ -0,0 +1,137 @@ + +module Parslet::Atoms + # A series of helper functions that have the common topic of flattening + # result values into the intermediary tree that consists of Ruby Hashes and + # Arrays. + # + # This module has one main function, #flatten, that takes an annotated + # structure as input and returns the reduced form that users expect from + # Atom#parse. + # + # NOTE: Since all of these functions are just that, functions without + # side effects, they are in a module and not in a class. Its hard to draw + # the line sometimes, but this is beyond. + # + module CanFlatten + # Takes a mixed value coming out of a parslet and converts it to a return + # value for the user by dropping things and merging hashes. + # + # Named is set to true if this result will be embedded in a Hash result from + # naming something using .as(...). It changes the folding + # semantics of repetition. + # + def flatten(value, named=false) + # Passes through everything that isn't an array of things + return value unless value.instance_of? Array + + # Extracts the s-expression tag + tag, *tail = value + + # Merges arrays: + result = tail. + map { |e| flatten(e) } # first flatten each element + + case tag + when :sequence + return flatten_sequence(result) + when :maybe + return named ? result.first : result.first || '' + when :repetition + return flatten_repetition(result, named) + end + + fail "BUG: Unknown tag #{tag.inspect}." + end + + # Lisp style fold left where the first element builds the basis for + # an inject. + # + def foldl(list, &block) + return '' if list.empty? + list[1..-1].inject(list.first, &block) + end + + # Flatten results from a sequence of parslets. + # + # @api private + # + def flatten_sequence(list) + foldl(list.compact) { |r, e| # and then merge flat elements + merge_fold(r, e) + } + end + # @api private + def merge_fold(l, r) + # equal pairs: merge. ---------------------------------------------------- + if l.class == r.class + if l.is_a?(Hash) + warn_about_duplicate_keys(l, r) + return l.merge(r) + else + return l + r + end + end + + # unequal pairs: hoist to same level. ------------------------------------ + + # Maybe classes are not equal, but both are stringlike? + if l.respond_to?(:to_str) && r.respond_to?(:to_str) + # if we're merging a String with a Slice, the slice wins. + return r if r.respond_to? :to_slice + return l if l.respond_to? :to_slice + + fail "NOTREACHED: What other stringlike classes are there?" + end + + # special case: If one of them is a string/slice, the other is more important + return l if r.respond_to? :to_str + return r if l.respond_to? :to_str + + # otherwise just create an array for one of them to live in + return l + [r] if r.class == Hash + return [l] + r if l.class == Hash + + fail "Unhandled case when foldr'ing sequence." + end + + # Flatten results from a repetition of a single parslet. named indicates + # whether the user has named the result or not. If the user has named + # the results, we want to leave an empty list alone - otherwise it is + # turned into an empty string. + # + # @api private + # + def flatten_repetition(list, named) + if list.any? { |e| e.instance_of?(Hash) } + # If keyed subtrees are in the array, we'll want to discard all + # strings inbetween. To keep them, name them. + return list.select { |e| e.instance_of?(Hash) } + end + + if list.any? { |e| e.instance_of?(Array) } + # If any arrays are nested in this array, flatten all arrays to this + # level. + return list. + select { |e| e.instance_of?(Array) }. + flatten(1) + end + + # Consistent handling of empty lists, when we act on a named result + return [] if named && list.empty? + + # If there are only strings, concatenate them and return that. + foldl(list) { |s,e| s+e } + end + + # That annoying warning 'Duplicate subtrees while merging result' comes + # from here. You should add more '.as(...)' names to your intermediary tree. + # + def warn_about_duplicate_keys(h1, h2) + d = h1.keys & h2.keys + unless d.empty? + warn "Duplicate subtrees while merging result of \n #{self.inspect}\nonly the values"+ + " of the latter will be kept. (keys: #{d.inspect})" + end + end + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/capture.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/capture.rb new file mode 100644 index 000000000..58acd83d7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/capture.rb @@ -0,0 +1,38 @@ + +# Stores the result of matching an atom against input in the #captures in +# parse context. Doing so will allow you to pull parts of the ongoing parse +# out later and use them to match other pieces of input. +# +# Example: +# # After this, context.captures[:an_a] returns 'a' +# str('a').capture(:an_a) +# +# # Capture and use of the capture: (matches either 'aa' or 'bb') +# match['ab'].capture(:first) >> +# dynamic { |src, ctx| str(ctx.captures[:first]) } +# +class Parslet::Atoms::Capture < Parslet::Atoms::Base + attr_reader :parslet, :name + + def initialize(parslet, name) + super() + + @parslet, @name = parslet, name + end + + def apply(source, context, consume_all) + success, value = result = parslet.apply(source, context, consume_all) + + if success + context.captures[name.to_sym] = + flatten(value) + end + + return result + end + + def to_s_inner(prec) + "(#{name.inspect} = #{parslet.to_s(prec)})" + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/context.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/context.rb new file mode 100644 index 000000000..231f5e01e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/context.rb @@ -0,0 +1,91 @@ +module Parslet::Atoms + # Helper class that implements a transient cache that maps position and + # parslet object to results. This is used for memoization in the packrat + # style. + # + # Also, error reporter is stored here and error reporting happens through + # this class. This makes the reporting pluggable. + # + class Context + # @param reporter [#err, #err_at] Error reporter (leave empty for default + # reporter) + def initialize(reporter=Parslet::ErrorReporter::Tree.new) + @cache = Hash.new { |h, k| h[k] = {} } + @reporter = reporter + @captures = Parslet::Scope.new + end + + # Caches a parse answer for obj at source.pos. Applying the same parslet + # at one position of input always yields the same result, unless the input + # has changed. + # + # We need the entire source here so we can ask for how many characters + # were consumed by a successful parse. Imitation of such a parse must + # advance the input pos by the same amount of bytes. + # + def try_with_cache(obj, source, consume_all) + beg = source.pos + + # Not in cache yet? Return early. + unless entry = lookup(obj, beg) + result = obj.try(source, self, consume_all) + + if obj.cached? + set obj, beg, [result, source.pos-beg] + end + + return result + end + + # the condition in unless has returned true, so entry is not nil. + result, advance = entry + + # The data we're skipping here has been read before. (since it is in + # the cache) PLUS the actual contents are not interesting anymore since + # we know obj matches at beg. So skip reading. + source.pos = beg + advance + return result + end + + # Report an error at a given position. + # @see ErrorReporter + # + def err_at(*args) + return [false, @reporter.err_at(*args)] if @reporter + return [false, nil] + end + + # Report an error. + # @see ErrorReporter + # + def err(*args) + return [false, @reporter.err(*args)] if @reporter + return [false, nil] + end + + # Returns the current captures made on the input (see + # Parslet::Atoms::Base#capture). Use as follows: + # + # context.captures[:foobar] # => returns capture :foobar + # + attr_reader :captures + + # Starts a new scope. Use the #scope method of Parslet::Atoms::DSL + # to call this. + # + def scope + captures.push + yield + ensure + captures.pop + end + + private + def lookup(obj, pos) + @cache[pos][obj] + end + def set(obj, pos, val) + @cache[pos][obj] = val + end + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/dsl.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/dsl.rb new file mode 100644 index 000000000..5e403aef2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/dsl.rb @@ -0,0 +1,109 @@ + +# A mixin module that defines operations that can be called on any subclass +# of Parslet::Atoms::Base. These operations make parslets atoms chainable and +# allow combination of parslet atoms to form bigger parsers. +# +# Example: +# +# str('foo') >> str('bar') +# str('f').repeat +# any.absent? # also called The Epsilon +# +module Parslet::Atoms::DSL + # Construct a new atom that repeats the current atom min times at least and + # at most max times. max can be nil to indicate that no maximum is present. + # + # Example: + # # match any number of 'a's + # str('a').repeat + # + # # match between 1 and 3 'a's + # str('a').repeat(1,3) + # + def repeat(min=0, max=nil) + Parslet::Atoms::Repetition.new(self, min, max) + end + + # Returns a new parslet atom that is only maybe present in the input. This + # is synonymous to calling #repeat(0,1). Generated tree value will be + # either nil (if atom is not present in the input) or the matched subtree. + # + # Example: + # str('foo').maybe + # + def maybe + Parslet::Atoms::Repetition.new(self, 0, 1, :maybe) + end + + # Chains two parslet atoms together as a sequence. + # + # Example: + # str('a') >> str('b') + # + def >>(parslet) + Parslet::Atoms::Sequence.new(self, parslet) + end + + # Chains two parslet atoms together to express alternation. A match will + # always be attempted with the parslet on the left side first. If it doesn't + # match, the right side will be tried. + # + # Example: + # # matches either 'a' OR 'b' + # str('a') | str('b') + # + def |(parslet) + Parslet::Atoms::Alternative.new(self, parslet) + end + + # Tests for absence of a parslet atom in the input stream without consuming + # it. + # + # Example: + # # Only proceed the parse if 'a' is absent. + # str('a').absent? + # + def absent? + Parslet::Atoms::Lookahead.new(self, false) + end + + # Tests for presence of a parslet atom in the input stream without consuming + # it. + # + # Example: + # # Only proceed the parse if 'a' is present. + # str('a').present? + # + def present? + Parslet::Atoms::Lookahead.new(self, true) + end + + # Alias for present? that will disappear in 2.0 (deprecated) + # + alias prsnt? present? + + # Alias for absent? that will disappear in 2.0 (deprecated) + # + alias absnt? absent? + + # Marks a parslet atom as important for the tree output. This must be used + # to achieve meaningful output from the #parse method. + # + # Example: + # str('a').as(:b) # will produce {:b => 'a'} + # + def as(name) + Parslet::Atoms::Named.new(self, name) + end + + # Captures a part of the input and stores it under the name given. This + # is very useful to create self-referential parses. A capture stores + # the result of its parse (may be complex) on a successful parse action. + # + # Example: + # str('a').capture(:b) # will store captures[:b] == 'a' + # + def capture(name) + Parslet::Atoms::Capture.new(self, name) + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/dynamic.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/dynamic.rb new file mode 100644 index 000000000..2dc4a8443 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/dynamic.rb @@ -0,0 +1,32 @@ +# Evaluates a block at parse time. The result from the block must be a parser +# (something which implements #apply). In the first case, the parser will then +# be applied to the input, creating the result. +# +# Dynamic parses are never cached. +# +# Example: +# dynamic { rand < 0.5 ? str('a') : str('b') } +# +class Parslet::Atoms::Dynamic < Parslet::Atoms::Base + attr_reader :block + + def initialize(block) + @block = block + end + + def cached? + false + end + + def try(source, context, consume_all) + result = block.call(source, context) + + # Result is a parslet atom. + return result.apply(source, context, consume_all) + end + + def to_s_inner(prec) + "dynamic { ... }" + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/entity.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/entity.rb new file mode 100644 index 000000000..4df605072 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/entity.rb @@ -0,0 +1,41 @@ +# This wraps pieces of parslet definition and gives them a name. The wrapped +# piece is lazily evaluated and cached. This has two purposes: +# +# * Avoid infinite recursion during evaluation of the definition +# * Be able to print things by their name, not by their sometimes +# complicated content. +# +# You don't normally use this directly, instead you should generated it by +# using the structuring method Parslet.rule. +# +class Parslet::Atoms::Entity < Parslet::Atoms::Base + attr_reader :name, :block + def initialize(name, &block) + super() + + @name = name + @block = block + end + + def try(source, context, consume_all) + parslet.apply(source, context, consume_all) + end + + def parslet + @parslet ||= @block.call.tap { |p| + raise_not_implemented unless p + } + end + + def to_s_inner(prec) + name.to_s.upcase + end +private + def raise_not_implemented + trace = caller.reject {|l| l =~ %r{#{Regexp.escape(__FILE__)}}} # blatantly stolen from dependencies.rb in activesupport + exception = NotImplementedError.new("rule(#{name.inspect}) { ... } returns nil. Still not implemented, but already used?") + exception.set_backtrace(trace) + + raise exception + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/lookahead.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/lookahead.rb new file mode 100644 index 000000000..d50a1b941 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/lookahead.rb @@ -0,0 +1,49 @@ +# Either positive or negative lookahead, doesn't consume its input. +# +# Example: +# +# str('foo').present? # matches when the input contains 'foo', but leaves it +# +class Parslet::Atoms::Lookahead < Parslet::Atoms::Base + attr_reader :positive + attr_reader :bound_parslet + + def initialize(bound_parslet, positive=true) + super() + + # Model positive and negative lookahead by testing this flag. + @positive = positive + @bound_parslet = bound_parslet + + @error_msgs = { + :positive => ["Input should start with ", bound_parslet], + :negative => ["Input should not start with ", bound_parslet] + } + end + + def try(source, context, consume_all) + pos = source.pos + + success, value = bound_parslet.apply(source, context, consume_all) + + if positive + return succ(nil) if success + return context.err_at(self, source, @error_msgs[:positive], pos) + else + return succ(nil) unless success + return context.err_at(self, source, @error_msgs[:negative], pos) + end + + # This is probably the only parslet that rewinds its input in #try. + # Lookaheads NEVER consume their input, even on success, that's why. + ensure + source.pos = pos + end + + precedence LOOKAHEAD + def to_s_inner(prec) + char = positive ? '&' : '!' + + "#{char}#{bound_parslet.to_s(prec)}" + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/named.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/named.rb new file mode 100644 index 000000000..b5412ba40 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/named.rb @@ -0,0 +1,32 @@ +# Names a match to influence tree construction. +# +# Example: +# +# str('foo') # will return 'foo', +# str('foo').as(:foo) # will return :foo => 'foo' +# +class Parslet::Atoms::Named < Parslet::Atoms::Base + attr_reader :parslet, :name + def initialize(parslet, name) + super() + + @parslet, @name = parslet, name + end + + def apply(source, context, consume_all) + success, value = result = parslet.apply(source, context, consume_all) + + return result unless success + succ( + produce_return_value( + value)) + end + + def to_s_inner(prec) + "#{name}:#{parslet.to_s(prec)}" + end +private + def produce_return_value(val) + { name => flatten(val, true) } + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/re.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/re.rb new file mode 100644 index 000000000..b6c2ea94b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/re.rb @@ -0,0 +1,38 @@ +# Matches a special kind of regular expression that only ever matches one +# character at a time. Useful members of this family are: character +# ranges, \\w, \\d, \\r, \\n, ... +# +# Example: +# +# match('[a-z]') # matches a-z +# match('\s') # like regexps: matches space characters +# +class Parslet::Atoms::Re < Parslet::Atoms::Base + attr_reader :match, :re + def initialize(match) + super() + + @match = match.to_s + @re = Regexp.new(self.match, Regexp::MULTILINE) + @error_msgs = { + :premature => "Premature end of input", + :failed => "Failed to match #{match.inspect[1..-2]}" + } + end + + def try(source, context, consume_all) + return succ(source.consume(1)) if source.matches?(re) + + # No string could be read + return context.err(self, source, @error_msgs[:premature]) \ + if source.chars_left < 1 + + # No match + return context.err(self, source, @error_msgs[:failed]) + end + + def to_s_inner(prec) + match.inspect[1..-2] + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/repetition.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/repetition.rb new file mode 100644 index 000000000..b45822f39 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/repetition.rb @@ -0,0 +1,78 @@ + +# Matches a parslet repeatedly. +# +# Example: +# +# str('a').repeat(1,3) # matches 'a' at least once, but at most three times +# str('a').maybe # matches 'a' if it is present in the input (repeat(0,1)) +# +class Parslet::Atoms::Repetition < Parslet::Atoms::Base + attr_reader :min, :max, :parslet + def initialize(parslet, min, max, tag=:repetition) + super() + + @parslet = parslet + @min, @max = min, max + @tag = tag + @error_msgs = { + :minrep => "Expected at least #{min} of #{parslet.inspect}", + :unconsumed => "Extra input after last repetition" + } + end + + def try(source, context, consume_all) + occ = 0 + accum = [@tag] # initialize the result array with the tag (for flattening) + start_pos = source.pos + + break_on = nil + loop do + success, value = parslet.apply(source, context, false) + + break_on = value + break unless success + + occ += 1 + accum << value + + # If we're not greedy (max is defined), check if that has been reached. + return succ(accum) if max && occ>=max + end + + # Last attempt to match parslet was a failure, failure reason in break_on. + + # Greedy matcher has produced a failure. Check if occ (which will + # contain the number of sucesses) is >= min. + return context.err_at( + self, + source, + @error_msgs[:minrep], + start_pos, + [break_on]) if occ < min + + # consume_all is true, that means that we're inside the part of the parser + # that should consume the input completely. Repetition failing here means + # probably that we didn't. + # + # We have a special clause to create an error here because otherwise + # break_on would get thrown away. It turns out, that contains very + # interesting information in a lot of cases. + # + return context.err( + self, + source, + @error_msgs[:unconsumed], + [break_on]) if consume_all && source.chars_left>0 + + return succ(accum) + end + + precedence REPETITION + def to_s_inner(prec) + minmax = "{#{min}, #{max}}" + minmax = '?' if min == 0 && max == 1 + + parslet.to_s(prec) + minmax + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/scope.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/scope.rb new file mode 100644 index 000000000..0642601ea --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/scope.rb @@ -0,0 +1,26 @@ +# Starts a new scope in the parsing process. Please also see the #captures +# method. +# +class Parslet::Atoms::Scope < Parslet::Atoms::Base + attr_reader :block + def initialize(block) + super() + + @block = block + end + + def cached? + false + end + + def apply(source, context, consume_all) + context.scope do + parslet = block.call + return parslet.apply(source, context, consume_all) + end + end + + def to_s_inner(prec) + "scope { #{block.call.to_s(prec)} }" + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/sequence.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/sequence.rb new file mode 100644 index 000000000..b556cc9d0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/sequence.rb @@ -0,0 +1,45 @@ +# A sequence of parslets, matched from left to right. Denoted by '>>' +# +# Example: +# +# str('a') >> str('b') # matches 'a', then 'b' +# +class Parslet::Atoms::Sequence < Parslet::Atoms::Base + attr_reader :parslets + def initialize(*parslets) + super() + + @parslets = parslets + @error_msgs = { + :failed => "Failed to match sequence (#{self.inspect})" + } + end + + def >>(parslet) + self.class.new(* @parslets+[parslet]) + end + + def try(source, context, consume_all) + # Presize an array + result = Array.new(parslets.size + 1) + result[0] = :sequence + + parslets.each_with_index do |p, idx| + child_consume_all = consume_all && (idx == parslets.size-1) + success, value = p.apply(source, context, child_consume_all) + + unless success + return context.err(self, source, @error_msgs[:failed], [value]) + end + + result[idx+1] = value + end + + return succ(result) + end + + precedence SEQUENCE + def to_s_inner(prec) + parslets.map { |p| p.to_s(prec) }.join(' ') + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/str.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/str.rb new file mode 100644 index 000000000..ade63dcae --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/str.rb @@ -0,0 +1,38 @@ +# Matches a string of characters. +# +# Example: +# +# str('foo') # matches 'foo' +# +class Parslet::Atoms::Str < Parslet::Atoms::Base + attr_reader :str + def initialize(str) + super() + + @str = str.to_s + @len = str.size + @error_msgs = { + :premature => "Premature end of input", + :failed => "Expected #{str.inspect}, but got " + } + end + + def try(source, context, consume_all) + return succ(source.consume(@len)) if source.matches?(str) + + # Input ending early: + return context.err(self, source, @error_msgs[:premature]) \ + if source.chars_left<@len + + # Expected something, but got something else instead: + error_pos = source.pos + return context.err_at( + self, source, + [@error_msgs[:failed], source.consume(@len)], error_pos) + end + + def to_s_inner(prec) + "'#{str}'" + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/visitor.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/visitor.rb new file mode 100644 index 000000000..8cb7375ae --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/atoms/visitor.rb @@ -0,0 +1,89 @@ +# Augments all parslet atoms with an accept method that will call back +# to the visitor given. + +# +module Parslet::Atoms + class Base + def accept(visitor) + raise NotImplementedError, "No #accept method on #{self.class.name}." + end + end + + class Str + # Call back visitors #visit_str method. See parslet/export for an example. + # + def accept(visitor) + visitor.visit_str(str) + end + end + + class Entity + # Call back visitors #visit_entity method. See parslet/export for an + # example. + # + def accept(visitor) + visitor.visit_entity(name, block) + end + end + + class Named + # Call back visitors #visit_named method. See parslet/export for an + # example. + # + def accept(visitor) + visitor.visit_named(name, parslet) + end + end + + class Sequence + # Call back visitors #visit_sequence method. See parslet/export for an + # example. + # + def accept(visitor) + visitor.visit_sequence(parslets) + end + end + + class Repetition + # Call back visitors #visit_repetition method. See parslet/export for an + # example. + # + def accept(visitor) + visitor.visit_repetition(@tag, min, max, parslet) + end + end + + class Alternative + # Call back visitors #visit_alternative method. See parslet/export for an + # example. + # + def accept(visitor) + visitor.visit_alternative(alternatives) + end + end + + class Lookahead + # Call back visitors #visit_lookahead method. See parslet/export for an + # example. + # + def accept(visitor) + visitor.visit_lookahead(positive, bound_parslet) + end + end + + class Re + # Call back visitors #visit_re method. See parslet/export for an example. + # + def accept(visitor) + visitor.visit_re(match) + end + end +end + +class Parslet::Parser + # Call back visitors #visit_parser method. + # + def accept(visitor) + visitor.visit_parser(root) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/cause.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/cause.rb new file mode 100644 index 000000000..ce5672c1e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/cause.rb @@ -0,0 +1,94 @@ +module Parslet + # Represents a cause why a parse did fail. A lot of these objects are + # constructed - not all of the causes turn out to be failures for the whole + # parse. + # + class Cause + def initialize(message, source, pos, children) + @message, @source, @pos, @children = + message, source, pos, children + end + + # @return [String, Array] A string or an array of message pieces that + # provide failure information. Use #to_s to get a formatted string. + attr_reader :message + + # @return [Parslet::Source] Source that was parsed when this error + # happend. Mainly used for line number information. + attr_reader :source + + # Location of the error. + # + # @return [Fixnum] Position where the error happened. (character offset) + attr_reader :pos + + # When this cause is part of a tree of error causes: child nodes for this + # node. Very often carries the reasons for this cause. + # + # @return [Array] A list of reasons for this cause. + def children + @children ||= [] + end + + # Appends 'at line LINE char CHAR' to the string given. Use +pos+ to + # override the position of the +source+. This method returns an object + # that can be turned into a string using #to_s. + # + # @param source [Parslet::Source] source that was parsed when this error + # happened + # @param pos [Fixnum] position of error + # @param str [String, Array] message parts + # @param children [Array] child nodes for this error tree + # @return [Parslet::Cause] a new instance of {Parslet::Cause} + # + def self.format(source, pos, str, children=[]) + self.new(str, source, pos, children) + end + + def to_s + line, column = source.line_and_column(pos) + # Allow message to be a list of objects. Join them here, since we now + # really need it. + Array(message).map { |o| + o.respond_to?(:to_slice) ? + o.str.inspect : + o.to_s }.join + " at line #{line} char #{column}." + end + + # Signals to the outside that the parse has failed. Use this in + # conjunction with .format for nice error messages. + # + def raise(exception_klass=Parslet::ParseFailed) + exception = exception_klass.new(self.to_s, self) + Kernel.raise exception + end + + # Returns an ascii tree representation of the causes of this node and its + # children. + # + def ascii_tree + StringIO.new.tap { |io| + recursive_ascii_tree(self, io, [true]) }. + string + end + + private + def recursive_ascii_tree(node, stream, curved) + append_prefix(stream, curved) + stream.puts node.to_s + + node.children.each do |child| + last_child = (node.children.last == child) + + recursive_ascii_tree(child, stream, curved + [last_child]) + end + end + def append_prefix(stream, curved) + return if curved.size < 2 + curved[1..-2].each do |c| + stream.print c ? " " : "| " + end + stream.print curved.last ? "`- " : "|- " + end + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/convenience.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/convenience.rb new file mode 100644 index 000000000..3220bc0a6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/convenience.rb @@ -0,0 +1,33 @@ +class Parslet::Atoms::Base + + # Packages the common idiom + # + # begin + # tree = parser.parse('something') + # rescue Parslet::ParseFailed => error + # puts parser.cause.ascii_tree + # end + # + # into a convenient method. + # + # Usage: + # + # require 'parslet' + # require 'parslet/convenience' + # + # class FooParser < Parslet::Parser + # rule(:foo) { str('foo') } + # root(:foo) + # end + # + # FooParser.new.parse_with_debug('bar') + # + # @see Parslet::Atoms::Base#parse + # + def parse_with_debug str, opts={} + parse str, opts + rescue Parslet::ParseFailed => error + puts error.cause.ascii_tree + end + +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/error_reporter.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/error_reporter.rb new file mode 100644 index 000000000..567c63a2f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/error_reporter.rb @@ -0,0 +1,7 @@ +# A namespace for all error reporters. +# +module Parslet::ErrorReporter +end + +require 'parslet/error_reporter/tree' +require 'parslet/error_reporter/deepest' \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/error_reporter/deepest.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/error_reporter/deepest.rb new file mode 100644 index 000000000..102b4f873 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/error_reporter/deepest.rb @@ -0,0 +1,95 @@ +module Parslet + module ErrorReporter + # Instead of reporting the latest error that happens like {Tree} does, + # this class reports the deepest error. Depth is defined here as how + # advanced into the input an error happens. The errors close to the + # greatest depth tend to be more relevant to the end user, since they + # specify what could be done to make them go away. + # + # More specifically, errors produced by this reporter won't be related to + # the structure of the grammar at all. The positions of the errors will + # be advanced and convey at every grammar level what the deepest rule + # was to fail. + # + class Deepest + def initialize + @deepest_cause = nil + end + + # Produces an error cause that combines the message at the current level + # with the errors that happened at a level below (children). + # + # @param atom [Parslet::Atoms::Base] parslet that failed + # @param source [Source] Source that we're using for this parse. (line + # number information...) + # @param message [String, Array] Error message at this level. + # @param children [Array] A list of errors from a deeper level (or nil). + # @return [Cause] An error tree combining children with message. + # + def err(atom, source, message, children=nil) + position = source.pos + cause = Cause.format(source, position, message, children) + return deepest(cause) + end + + # Produces an error cause that combines the message at the current level + # with the errors that happened at a level below (children). + # + # @param atom [Parslet::Atoms::Base] parslet that failed + # @param source [Source] Source that we're using for this parse. (line + # number information...) + # @param message [String, Array] Error message at this level. + # @param pos [Fixnum] The real position of the error. + # @param children [Array] A list of errors from a deeper level (or nil). + # @return [Cause] An error tree combining children with message. + # + def err_at(atom, source, message, pos, children=nil) + position = pos + cause = Cause.format(source, position, message, children) + return deepest(cause) + end + + # Returns the cause that is currently deepest. Mainly for specs. + # + attr_reader :deepest_cause + + # Checks to see if the lineage of the cause given includes a cause with + # an error position deeper than the current deepest cause stored. If + # yes, it passes the cause through to the caller. If no, it returns the + # current deepest error that was saved as a reference. + # + def deepest(cause) + rank, leaf = deepest_child(cause) + + if !deepest_cause || leaf.pos >= deepest_cause.pos + # This error reaches deeper into the input, save it as reference. + @deepest_cause = leaf + return cause + end + + return deepest_cause + end + + private + # Returns the leaf from a given error tree with the biggest rank. + # + def deepest_child(cause, rank=0) + max_child = cause + max_rank = rank + + if cause.children && !cause.children.empty? + cause.children.each do |child| + c_rank, c_cause = deepest_child(child, rank+1) + + if c_rank > max_rank + max_rank = c_rank + max_child = c_cause + end + end + end + + return max_rank, max_child + end + end + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/error_reporter/tree.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/error_reporter/tree.rb new file mode 100644 index 000000000..2fb275041 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/error_reporter/tree.rb @@ -0,0 +1,57 @@ +module Parslet + module ErrorReporter + # An error reporter has two central methods, one for reporting errors at + # the current parse position (#err) and one for reporting errors at a + # given parse position (#err_at). The reporter can return an object (a + # 'cause') that will be returned to the caller along with the information + # that the parse failed. + # + # When reporting errors on the outer levels of your parser, these methods + # get passed a list of error objects ('causes') from the inner levels. In + # this default implementation, the inner levels are considered error + # subtrees and are appended to the generated tree node at each level, + # thereby constructing an error tree. + # + # This error tree will report in parallel with the grammar structure that + # failed. A one-to-one correspondence exists between each error in the + # tree and the parslet atom that produced that error. + # + # The implementor is really free to use these return values as he sees + # fit. One example would be to return an error state object from these + # methods that is then updated as errors cascade up the parse derivation + # tree. + # + class Tree + # Produces an error cause that combines the message at the current level + # with the errors that happened at a level below (children). + # + # @param atom [Parslet::Atoms::Base] parslet that failed + # @param source [Source] Source that we're using for this parse. (line + # number information...) + # @param message [String, Array] Error message at this level. + # @param children [Array] A list of errors from a deeper level (or nil). + # @return [Cause] An error tree combining children with message. + # + def err(atom, source, message, children=nil) + position = source.pos + Cause.format(source, position, message, children) + end + + # Produces an error cause that combines the message at the current level + # with the errors that happened at a level below (children). + # + # @param atom [Parslet::Atoms::Base] parslet that failed + # @param source [Source] Source that we're using for this parse. (line + # number information...) + # @param message [String, Array] Error message at this level. + # @param pos [Fixnum] The real position of the error. + # @param children [Array] A list of errors from a deeper level (or nil). + # @return [Cause] An error tree combining children with message. + # + def err_at(atom, source, message, pos, children=nil) + position = pos + Cause.format(source, position, message, children) + end + end + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/export.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/export.rb new file mode 100644 index 000000000..37ab20d01 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/export.rb @@ -0,0 +1,162 @@ +# Allows exporting parslet grammars to other lingos. + +require 'set' +require 'parslet/atoms/visitor' + +class Parslet::Parser + module Visitors + class Citrus + attr_reader :context, :output + def initialize(context) + @context = context + end + + def visit_str(str) + "\"#{str.inspect[1..-2]}\"" + end + def visit_re(match) + match.to_s + end + + def visit_entity(name, block) + context.deferred(name, block) + + "(#{context.mangle_name(name)})" + end + def visit_named(name, parslet) + parslet.accept(self) + end + + def visit_sequence(parslets) + '(' << + parslets. + map { |el| el.accept(self) }. + join(' ') << + ')' + end + def visit_repetition(tag, min, max, parslet) + parslet.accept(self) << "#{min}*#{max}" + end + def visit_alternative(alternatives) + '(' << + alternatives. + map { |el| el.accept(self) }. + join(' | ') << + ')' + end + + def visit_lookahead(positive, bound_parslet) + (positive ? '&' : '!') << + bound_parslet.accept(self) + end + end + + class Treetop < Citrus + def visit_repetition(tag, min, max, parslet) + parslet.accept(self) << "#{min}..#{max}" + end + + def visit_alternative(alternatives) + '(' << + alternatives. + map { |el| el.accept(self) }. + join(' / ') << + ')' + end + end + end + + # A helper class that formats Citrus and Treetop grammars as a string. + # + class PrettyPrinter + attr_reader :visitor + def initialize(visitor_klass) + @visitor = visitor_klass.new(self) + end + + # Pretty prints the given parslet using the visitor that has been + # configured in initialize. Returns the string representation of the + # Citrus or Treetop grammar. + # + def pretty_print(name, parslet) + output = "grammar #{name}\n" + + output << rule('root', parslet) + + seen = Set.new + loop do + # @todo is constantly filled by the visitor (see #deferred). We + # keep going until it is empty. + break if @todo.empty? + name, block = @todo.shift + + # Track what rules we've already seen. This breaks loops. + next if seen.include?(name) + seen << name + + output << rule(name, block.call) + end + + output << "end\n" + end + + # Formats a rule in either dialect. + # + def rule(name, parslet) + " rule #{mangle_name name}\n" << + " " << parslet.accept(visitor) << "\n" << + " end\n" + end + + # Whenever the visitor encounters an rule in a parslet, it defers the + # pretty printing of the rule by calling this method. + # + def deferred(name, content) + @todo ||= [] + @todo << [name, content] + end + + # Mangles names so that Citrus and Treetop can live with it. This mostly + # transforms some of the things that Ruby allows into other patterns. If + # there is collision, we will not detect it for now. + # + def mangle_name(str) + str.to_s.sub(/\?$/, '_p') + end + end + + # Exports the current parser instance as a string in the Citrus dialect. + # + # Example: + # + # require 'parslet/export' + # class MyParser < Parslet::Parser + # root(:expression) + # rule(:expression) { str('foo') } + # end + # + # MyParser.new.to_citrus # => a citrus grammar as a string + # + def to_citrus + PrettyPrinter.new(Visitors::Citrus). + pretty_print(self.class.name, root) + end + + # Exports the current parser instance as a string in the Treetop dialect. + # + # Example: + # + # require 'parslet/export' + # class MyParser < Parslet::Parser + # root(:expression) + # rule(:expression) { str('foo') } + # end + # + # MyParser.new.to_treetop # => a treetop grammar as a string + # + def to_treetop + PrettyPrinter.new(Visitors::Treetop). + pretty_print(self.class.name, root) + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/expression.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/expression.rb new file mode 100644 index 000000000..1cd13e4c5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/expression.rb @@ -0,0 +1,51 @@ + +# Allows specifying rules as strings using the exact same grammar that treetop +# does, minus the actions. This is on one hand a good example of a fully +# fledged parser and on the other hand might even turn out really useful. +# +# This can be viewed as an extension to parslet and might even be hosted in +# its own gem one fine day. +# +class Parslet::Expression + include Parslet + + autoload :Treetop, 'parslet/expression/treetop' + + # Creates a parslet from a foreign language expression. + # + # Example: + # + # Parslet::Expression.new("'a' 'b'") + # + def initialize(str, opts={}, context=self) + @type = opts[:type] || :treetop + @exp = str + @parslet = transform( + parse(str)) + end + + # Transforms the parse tree into a parslet expression. + # + def transform(tree) + transform = Treetop::Transform.new + + # pp tree + transform.apply(tree) + rescue + warn "Could not transform: " + tree.inspect + raise + end + + # Parses the string and returns a parse tree. + # + def parse(str) + parser = Treetop::Parser.new + parser.parse(str) + end + + # Turns this expression into a parslet. + # + def to_parslet + @parslet + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/expression/treetop.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/expression/treetop.rb new file mode 100644 index 000000000..35da40b5e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/expression/treetop.rb @@ -0,0 +1,92 @@ +class Parslet::Expression::Treetop + class Parser < Parslet::Parser + root(:expression) + + rule(:expression) { alternatives } + + # alternative 'a' / 'b' + rule(:alternatives) { + (simple >> (spaced('/') >> simple).repeat).as(:alt) + } + + # sequence by simple concatenation 'a' 'b' + rule(:simple) { occurrence.repeat(1).as(:seq) } + + # occurrence modifiers + rule(:occurrence) { + atom.as(:repetition) >> spaced('*').as(:sign) | + atom.as(:repetition) >> spaced('+').as(:sign) | + atom.as(:repetition) >> repetition_spec | + + atom.as(:maybe) >> spaced('?') | + atom + } + + rule(:atom) { + spaced('(') >> expression.as(:unwrap) >> spaced(')') | + dot | + string | + char_class + } + + # a character class + rule(:char_class) { + (str('[') >> + (str('\\') >> any | + str(']').absent? >> any).repeat(1) >> + str(']')).as(:match) >> space? + } + + # anything at all + rule(:dot) { spaced('.').as(:any) } + + # recognizing strings + rule(:string) { + str('\'') >> + ( + (str('\\') >> any) | + (str("'").absent? >> any) + ).repeat.as(:string) >> + str('\'') >> space? + } + + # repetition specification like {1, 2} + rule(:repetition_spec) { + spaced('{') >> + integer.maybe.as(:min) >> spaced(',') >> + integer.maybe.as(:max) >> spaced('}') + } + rule(:integer) { + match['0-9'].repeat(1) + } + + # whitespace handling + rule(:space) { match("\s").repeat(1) } + rule(:space?) { space.maybe } + + def spaced(str) + str(str) >> space? + end + end + + class Transform < Parslet::Transform + + rule(:repetition => simple(:rep), :sign => simple(:sign)) { + min = sign=='+' ? 1 : 0 + Parslet::Atoms::Repetition.new(rep, min, nil) } + rule(:repetition => simple(:rep), :min => simple(:min), :max => simple(:max)) { + Parslet::Atoms::Repetition.new(rep, + Integer(min || 0), + max && Integer(max) || nil) } + + rule(:alt => subtree(:alt)) { Parslet::Atoms::Alternative.new(*alt) } + rule(:seq => sequence(:s)) { Parslet::Atoms::Sequence.new(*s) } + rule(:unwrap => simple(:u)) { u } + rule(:maybe => simple(:m)) { |d| d[:m].maybe } + rule(:string => simple(:s)) { Parslet::Atoms::Str.new(s) } + rule(:match => simple(:m)) { Parslet::Atoms::Re.new(m) } + rule(:any => simple(:a)) { Parslet::Atoms::Re.new('.') } + end + +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/parser.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/parser.rb new file mode 100644 index 000000000..a78e443c0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/parser.rb @@ -0,0 +1,67 @@ + +# The base class for all your parsers. Use as follows: +# +# require 'parslet' +# +# class MyParser < Parslet::Parser +# rule(:a) { str('a').repeat } +# root(:a) +# end +# +# pp MyParser.new.parse('aaaa') # => 'aaaa' +# pp MyParser.new.parse('bbbb') # => Parslet::Atoms::ParseFailed: +# # Don't know what to do with bbbb at line 1 char 1. +# +# Parslet::Parser is also a grammar atom. This means that you can mix full +# fledged parsers freely with small parts of a different parser. +# +# Example: +# class ParserA < Parslet::Parser +# root :aaa +# rule(:aaa) { str('a').repeat(3,3) } +# end +# class ParserB < Parslet::Parser +# root :expression +# rule(:expression) { str('b') >> ParserA.new >> str('b') } +# end +# +# In the above example, ParserB would parse something like 'baaab'. +# +class Parslet::Parser < Parslet::Atoms::Base + include Parslet + + class < { +# :name => 'foobar', +# :args => [1, 2, 3] +# } +# } +# +# A pattern that would match against this tree would be: +# +# { :function_call => { :name => simple(:name), :args => sequence(:args) }} +# +# Note that Parslet::Pattern only matches at a given subtree; it wont try +# to match recursively. To do that, please use Parslet::Transform. +# +class Parslet::Pattern + def initialize(pattern) + @pattern = pattern + end + + # Decides if the given subtree matches this pattern. Returns the bindings + # made on a successful match or nil if the match fails. If you specify + # bindings to be a hash, the mappings in it will be treated like bindings + # made during an attempted match. + # + # Pattern.new('a').match('a', :foo => 'bar') # => { :foo => 'bar' } + # + # @param subtree [String, Hash, Array] poro subtree returned by a parse + # @param bindings [Hash] variable bindings to be verified + # @return [Hash, nil] On success: variable bindings that allow a match. On + # failure: nil + # + def match(subtree, bindings=nil) + bindings = bindings && bindings.dup || Hash.new + return bindings if element_match(subtree, @pattern, bindings) + end + + # Returns true if the tree element given by +tree+ matches the expression + # given by +exp+. This match must respect bindings already made in + # +bindings+. Note that bindings is carried along and modified. + # + # @api private + # + def element_match(tree, exp, bindings) + # p [:elm, tree, exp] + case [tree, exp].map { |e| e.class } + when [Hash,Hash] + return element_match_hash(tree, exp, bindings) + when [Array,Array] + return element_match_ary_single(tree, exp, bindings) + else + # If elements match exactly, then that is good enough in all cases + return true if tree == exp + + # If exp is a bind variable: Check if the binding matches + if exp.respond_to?(:can_bind?) && exp.can_bind?(tree) + return element_match_binding(tree, exp, bindings) + end + + # Otherwise: No match (we don't know anything about the element + # combination) + return false + end + end + + # @api private + # + def element_match_binding(tree, exp, bindings) + var_name = exp.variable_name + + # TODO test for the hidden :_ feature. + if var_name && bound_value = bindings[var_name] + return bound_value == tree + end + + # New binding: + bindings.store var_name, tree + + return true + end + + # @api private + # + def element_match_ary_single(sequence, exp, bindings) + return false if sequence.size != exp.size + + return sequence.zip(exp).all? { |elt, subexp| + element_match(elt, subexp, bindings) } + end + + # @api private + # + def element_match_hash(tree, exp, bindings) + # Early failure when one hash is bigger than the other + return false unless exp.size == tree.size + + # We iterate over expected pattern, since we demand that the keys that + # are there should be in tree as well. + exp.each do |expected_key, expected_value| + return false unless tree.has_key? expected_key + + # Recurse into the value and stop early on failure + value = tree[expected_key] + return false unless element_match(value, expected_value, bindings) + end + + return true + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/pattern/binding.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/pattern/binding.rb new file mode 100644 index 000000000..2197db7f5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/pattern/binding.rb @@ -0,0 +1,49 @@ + +# Used internally for representing a bind placeholder in a Parslet::Transform +# pattern. This is the superclass for all bindings. +# +# It defines the most permissive kind of bind, the one that matches any subtree +# whatever it looks like. +# +class Parslet::Pattern::SubtreeBind < Struct.new(:symbol) + def variable_name + symbol + end + + def inspect + "#{bind_type_name}(#{symbol.inspect})" + end + + def can_bind?(subtree) + true + end + +private + def bind_type_name + if md=self.class.name.match(/(\w+)Bind/) + md.captures.first.downcase + else + # This path should never be used, but since this is for inspection only, + # let's not raise. + 'unknown_bind' + end + end +end + +# Binds a symbol to a simple subtree, one that is not either a sequence of +# elements or a collection of attributes. +# +class Parslet::Pattern::SimpleBind < Parslet::Pattern::SubtreeBind + def can_bind?(subtree) + not [Hash, Array].include?(subtree.class) + end +end + +# Binds a symbol to a sequence of simple leafs ([element1, element2, ...]) +# +class Parslet::Pattern::SequenceBind < Parslet::Pattern::SubtreeBind + def can_bind?(subtree) + subtree.kind_of?(Array) && + (not subtree.any? { |el| [Hash, Array].include?(el.class) }) + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/rig/rspec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/rig/rspec.rb new file mode 100644 index 000000000..0ce217556 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/rig/rspec.rb @@ -0,0 +1,51 @@ +RSpec::Matchers.define(:parse) do |input, opts| + as = block = nil + result = trace = nil + match do |parser| + begin + result = parser.parse(input) + block ? + block.call(result) : + (as == result || as.nil?) + rescue Parslet::ParseFailed => ex + trace = ex.cause.ascii_tree if opts && opts[:trace] + false + end + end + + failure_message_for_should do |is| + if block + "expected output of parsing #{input.inspect}" << + " with #{is.inspect} to meet block conditions, but it didn't" + else + "expected " << + (as ? + "output of parsing #{input.inspect}"<< + " with #{is.inspect} to equal #{as.inspect}, but was #{result.inspect}" : + "#{is.inspect} to be able to parse #{input.inspect}") << + (trace ? + "\n"+trace : + '') + end + end + + failure_message_for_should_not do |is| + if block + "expected output of parsing #{input.inspect} with #{is.inspect} not to meet block conditions, but it did" + else + "expected " << + (as ? + "output of parsing #{input.inspect}"<< + " with #{is.inspect} not to equal #{as.inspect}" : + + "#{is.inspect} to not parse #{input.inspect}, but it did") + end + end + + # NOTE: This has a nodoc tag since the rdoc parser puts this into + # Object, a thing I would never allow. + chain :as do |expected_output, &block| + as = expected_output + block = block + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/scope.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/scope.rb new file mode 100644 index 000000000..3c41e22a3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/scope.rb @@ -0,0 +1,42 @@ +class Parslet::Scope + # Raised when the accessed slot has never been assigned a value. + # + class NotFound < StandardError + end + + class Binding + attr_reader :parent + + def initialize(parent=nil) + @parent = parent + @hash = Hash.new + end + + def [](k) + @hash.has_key?(k) && @hash[k] || + parent && parent[k] or + raise NotFound + end + def []=(k,v) + @hash.store(k,v) + end + end + + def [](k) + @current[k] + end + def []=(k,v) + @current[k] = v + end + + def initialize + @current = Binding.new + end + + def push + @current = Binding.new(@current) + end + def pop + @current = @current.parent + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/slice.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/slice.rb new file mode 100644 index 000000000..3e2dd4657 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/slice.rb @@ -0,0 +1,101 @@ + +# A slice is a small part from the parse input. A slice mainly behaves like +# any other string, except that it remembers where it came from (offset in +# original input). +# +# == Extracting line and column +# +# Using the #line_and_column method, you can extract the line and column in +# the original input where this slice starts. +# +# Example: +# slice.line_and_column # => [1, 13] +# slice.offset # => 12 +# +# == Likeness to strings +# +# Parslet::Slice behaves in many ways like a Ruby String. This likeness +# however is not complete - many of the myriad of operations String supports +# are not yet in Slice. You can always extract the internal string instance by +# calling #to_s. +# +# These omissions are somewhat intentional. Rather than maintaining a full +# delegation, we opt for a partial emulation that gets the job done. +# +class Parslet::Slice + attr_reader :str, :offset + attr_reader :line_cache + + # Construct a slice using a string, an offset and an optional line cache. + # The line cache should be able to answer to the #line_and_column message. + # + def initialize(string, offset, line_cache=nil) + @str, @offset = string, offset + @line_cache = line_cache + end + + # Compares slices to other slices or strings. + # + def == other + str == other + end + + # Match regular expressions. + # + def match(regexp) + str.match(regexp) + end + + # Returns the slices size in characters. + # + def size + str.size + end + + # Concatenate two slices; it is assumed that the second slice begins + # where the first one ends. The offset of the resulting slice is the same + # as the one of this slice. + # + def +(other) + self.class.new(str + other.to_s, offset, line_cache) + end + + # Returns a tuple referring to the original input. + # + def line_and_column + raise ArgumentError, "No line cache was given, cannot infer line and column." \ + unless line_cache + + line_cache.line_and_column(self.offset) + end + + + # Conversion operators ----------------------------------------------------- + def to_str + str + end + alias to_s to_str + + def to_slice + self + end + def to_sym + str.to_sym + end + def to_int + Integer(str) + end + def to_i + str.to_i + end + def to_f + str.to_f + end + + # Inspection & Debugging --------------------------------------------------- + + # Prints the slice as "string"@offset. + def inspect + str.inspect << "@#{offset}" + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/source.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/source.rb new file mode 100644 index 000000000..3ec14a9fa --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/source.rb @@ -0,0 +1,62 @@ + +require 'stringio' + +require 'parslet/source/line_cache' + +module Parslet + # Wraps the input string for parslet. + # + class Source + def initialize(str) + raise ArgumentError unless str.respond_to?(:to_str) + + @pos = 0 + @str = str + + @line_cache = LineCache.new + @line_cache.scan_for_line_endings(0, @str) + end + + # Checks if the given pattern matches at the current input position. + # + # @param pattern [Regexp, String] pattern to check for + # @return [Boolean] true if the pattern matches at #pos + # + def matches?(pattern) + @str.index(pattern, @pos) == @pos + end + alias match matches? + + # Consumes n characters from the input, returning them as a slice of the + # input. + # + def consume(n) + slice_str = @str.slice(@pos, n) + slice = Parslet::Slice.new( + slice_str, + pos, + @line_cache) + + @pos += slice_str.size + return slice + end + + # Returns how many chars remain in the input. + # + def chars_left + @str.size - @pos + end + + # Position of the parse as a character offset into the original string. + # @note: Encodings... + attr_accessor :pos + + # Returns a tuple for the given position. If no position is + # given, line/column information is returned for the current position + # given by #pos. + # + def line_and_column(position=nil) + @line_cache.line_and_column(position || self.pos) + end + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/source/line_cache.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/source/line_cache.rb new file mode 100644 index 000000000..4699162ae --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/source/line_cache.rb @@ -0,0 +1,95 @@ + + +class Parslet::Source + # A cache for line start positions. + # + class LineCache + def initialize + # Stores line endings as a simple position number. The first line always + # starts at 0; numbers beyond the biggest entry are on any line > size, + # but probably make a scan to that position neccessary. + @line_ends = [] + @line_ends.extend RangeSearch + end + + # Returns a tuple for the given input position. + # + def line_and_column(pos) + eol_idx = @line_ends.lbound(pos) + + if eol_idx + # eol_idx points to the offset that ends the current line. + # Let's try to find the offset that starts it: + offset = eol_idx>0 && @line_ends[eol_idx-1] || 0 + return [eol_idx+1, pos-offset+1] + else + # eol_idx is nil, that means that we're beyond the last line end that + # we know about. Pretend for now that we're just on the last line. + offset = @line_ends.last || 0 + return [@line_ends.size+1, pos-offset+1] + end + end + + def scan_for_line_endings(start_pos, buf) + return unless buf + return unless buf.index("\n") + cur = -1 + + # If we have already read part or all of buf, we already know about + # line ends in that portion. remove it and correct cur (search index) + if @last_line_end && start_pos < @last_line_end + # Let's not search the range from start_pos to last_line_end again. + cur = @last_line_end - start_pos -1 + end + + # Scan the string for line endings; store the positions of all endings + # in @line_ends. + while buf && cur = buf.index("\n", cur+1) + @last_line_end = (start_pos + cur+1) + @line_ends << @last_line_end + end + end + end + + # Mixin for arrays that implicitly give a number of ranges, where one range + # begins where the other one ends. + # + # Example: + # + # [10, 20, 30] + # # would describe [0, 10], (10, 20], (20, 30] + # + module RangeSearch + def find_mid(left, right) + # NOTE: Jonathan Hinkle reported that when mathn is required, just + # dividing and relying on the integer truncation is not enough. + left + ((right - left) / 2).floor + end + + # Scans the array for the first number that is > than bound. Returns the + # index of that number. + # + def lbound(bound) + return nil if empty? + return nil unless last > bound + + left = 0 + right = size - 1 + + loop do + mid = find_mid(left, right) + + if self[mid] > bound + right = mid + else + # assert: self[mid] <= bound + left = mid+1 + end + + if right <= left + return right + end + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/transform.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/transform.rb new file mode 100644 index 000000000..e3ee4acf8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/transform.rb @@ -0,0 +1,236 @@ + +require 'parslet/pattern' + +# Transforms an expression tree into something else. The transformation +# performs a depth-first, post-order traversal of the expression tree. During +# that traversal, each time a rule matches a node, the node is replaced by the +# result of the block associated to the rule. Otherwise the node is accepted +# as is into the result tree. +# +# This is almost what you would generally do with a tree visitor, except that +# you can match several levels of the tree at once. +# +# As a consequence of this, the resulting tree will contain pieces of the +# original tree and new pieces. Most likely, you will want to transform the +# original tree wholly, so this isn't a problem. +# +# You will not be able to create a loop, given that each node will be replaced +# only once and then left alone. This means that the results of a replacement +# will not be acted upon. +# +# Example: +# +# class Example < Parslet::Transform +# rule(:string => simple(:x)) { # (1) +# StringLiteral.new(x) +# } +# end +# +# A tree transform (Parslet::Transform) is defined by a set of rules. Each +# rule can be defined by calling #rule with the pattern as argument. The block +# given will be called every time the rule matches somewhere in the tree given +# to #apply. It is passed a Hash containing all the variable bindings of this +# pattern match. +# +# In the above example, (1) illustrates a simple matching rule. +# +# Let's say you want to parse matching parentheses and distill a maximum nest +# depth. You would probably write a parser like the one in example/parens.rb; +# here's the relevant part: +# +# rule(:balanced) { +# str('(').as(:l) >> balanced.maybe.as(:m) >> str(')').as(:r) +# } +# +# If you now apply this to a string like '(())', you get a intermediate parse +# tree that looks like this: +# +# { +# l: '(', +# m: { +# l: '(', +# m: nil, +# r: ')' +# }, +# r: ')' +# } +# +# This parse tree is good for debugging, but what we would really like to have +# is just the nesting depth. This transformation rule will produce that: +# +# rule(:l => '(', :m => simple(:x), :r => ')') { +# # innermost :m will contain nil +# x.nil? ? 1 : x+1 +# } +# +# = Usage patterns +# +# There are four ways of using this class. The first one is very much +# recommended, followed by the second one for generality. The other ones are +# omitted here. +# +# Recommended usage is as follows: +# +# class MyTransformator < Parslet::Transform +# rule(...) { ... } +# rule(...) { ... } +# # ... +# end +# MyTransformator.new.apply(tree) +# +# Alternatively, you can use the Transform class as follows: +# +# transform = Parslet::Transform.new do +# rule(...) { ... } +# end +# transform.apply(tree) +# +# = Execution context +# +# The execution context of action blocks differs depending on the arity of +# said blocks. This can be confusing. It is however somewhat intentional. You +# should not create fat Transform descendants containing a lot of helper methods, +# instead keep your AST class construction in global scope or make it available +# through a factory. The following piece of code illustrates usage of global +# scope: +# +# transform = Parslet::Transform.new do +# rule(...) { AstNode.new(a_variable) } +# rule(...) { Ast.node(a_variable) } # modules are nice +# end +# transform.apply(tree) +# +# And here's how you would use a class builder (a factory): +# +# transform = Parslet::Transform.new do +# rule(...) { builder.add_node(a_variable) } +# rule(...) { |d| d[:builder].add_node(d[:a_variable]) } +# end +# transform.apply(tree, :builder => Builder.new) +# +# As you can see, Transform allows you to inject local context for your rule +# action blocks to use. +# +class Parslet::Transform + # FIXME: Maybe only part of it? Or maybe only include into constructor + # context? + include Parslet + + autoload :Context, 'parslet/transform/context' + + class << self + # FIXME: Only do this for subclasses? + include Parslet + + # Define a rule for the transform subclass. + # + def rule(expression, &block) + @__transform_rules ||= [] + @__transform_rules << [Parslet::Pattern.new(expression), block] + end + + # Allows accessing the class' rules + # + def rules + @__transform_rules || [] + end + end + + def initialize(&block) + @rules = [] + + if block + instance_eval(&block) + end + end + + # Defines a rule to be applied whenever apply is called on a tree. A rule + # is composed of two parts: + # + # * an *expression pattern* + # * a *transformation block* + # + def rule(expression, &block) + @rules << [ + Parslet::Pattern.new(expression), + block + ] + end + + # Applies the transformation to a tree that is generated by Parslet::Parser + # or a simple parslet. Transformation will proceed down the tree, replacing + # parts/all of it with new objects. The resulting object will be returned. + # + def apply(obj, context=nil) + transform_elt( + case obj + when Hash + recurse_hash(obj, context) + when Array + recurse_array(obj, context) + else + obj + end, + context + ) + end + + # Executes the block on the bindings obtained by Pattern#match, if such a match + # can be made. Depending on the arity of the given block, it is called in + # one of two environments: the current one or a clean toplevel environment. + # + # If you would like the current environment preserved, please use the + # arity 1 variant of the block. Alternatively, you can inject a context object + # and call methods on it (think :ctx => self). + # + # # the local variable a is simulated + # t.call_on_match(:a => :b) { a } + # # no change of environment here + # t.call_on_match(:a => :b) { |d| d[:a] } + # + def call_on_match(bindings, block) + if block + if block.arity == 1 + return block.call(bindings) + else + context = Context.new(bindings) + return context.instance_eval(&block) + end + end + end + + # Allow easy access to all rules, the ones defined in the instance and the + # ones predefined in a subclass definition. + # + def rules + self.class.rules + @rules + end + + # @api private + # + def transform_elt(elt, context) + rules.each do |pattern, block| + if bindings=pattern.match(elt, context) + # Produces transformed value + return call_on_match(bindings, block) + end + end + + # No rule matched - element is not transformed + return elt + end + + # @api private + # + def recurse_hash(hsh, ctx) + hsh.inject({}) do |new_hsh, (k,v)| + new_hsh[k] = apply(v, ctx) + new_hsh + end + end + # @api private + # + def recurse_array(ary, ctx) + ary.map { |elt| apply(elt, ctx) } + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/transform/context.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/transform/context.rb new file mode 100644 index 000000000..3a974b67c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/parslet-1.5.0/lib/parslet/transform/context.rb @@ -0,0 +1,32 @@ +require 'blankslate' + +# Provides a context for tree transformations to run in. The context allows +# accessing each of the bindings in the bindings hash as local method. +# +# Example: +# +# ctx = Context.new(:a => :b) +# ctx.instance_eval do +# a # => :b +# end +# +class Parslet::Transform::Context < BlankSlate + reveal :methods + reveal :respond_to? + reveal :inspect + reveal :to_s + reveal :instance_variable_set + + def meta_def(name, &body) + metaclass = class < 38, :background => 48 }[ground] + @red, @green, @blue = rgb[0], rgb[1], rgb[2] + end + + # Get the ANSI color code for this RGB color. + def code + index = 16 + + RGB.to_ansi_domain(@red) * 36 + + RGB.to_ansi_domain(@green) * 6 + + RGB.to_ansi_domain(@blue) + + "#{@ground_code};5;#{index}" + end + + end + + # Helper class for RGB color format. + class RGB + def self.outside_range?(rgb) + rgb.min < 0 or rgb.max > 255 + end + + # Change domain of color value from 0-255 to 0-5 + def self.to_ansi_domain(value) + (6 * (value / 256.0)).to_i + end + end + + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rainbow-1.1.4/lib/rainbow.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rainbow-1.1.4/lib/rainbow.rb new file mode 100644 index 000000000..ccc265771 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rainbow-1.1.4/lib/rainbow.rb @@ -0,0 +1,108 @@ +require 'rbconfig' +require File.join(File.dirname(__FILE__), 'ansi_color') + +module Sickill + module Rainbow + class << self; attr_accessor :enabled; end + @enabled = STDOUT.tty? && ENV['TERM'] != 'dumb' || ENV['CLICOLOR_FORCE'] == '1' + + TERM_COLORS = { + :black => 0, + :red => 1, + :green => 2, + :yellow => 3, + :blue => 4, + :magenta => 5, + :cyan => 6, + :white => 7, + :default => 9, + } + + TERM_EFFECTS = { + :reset => 0, + :bright => 1, + :italic => 3, + :underline => 4, + :blink => 5, + :inverse => 7, + :hide => 8, + } + + # Sets foreground color of this text. + def foreground(*color) + wrap_with_code(AnsiColor.new(:foreground, *color).code) + end + alias_method :color, :foreground + alias_method :colour, :foreground + + + # Sets background color of this text. + def background(*color) + wrap_with_code(AnsiColor.new(:background, *color).code) + end + + # Resets terminal to default colors/backgrounds. + # + # It shouldn't be needed to use this method because all methods + # append terminal reset code to end of string. + def reset + wrap_with_code(TERM_EFFECTS[:reset]) + end + + # Turns on bright/bold for this text. + def bright + wrap_with_code(TERM_EFFECTS[:bright]) + end + + # Turns on italic style for this text (not well supported by terminal + # emulators). + def italic + wrap_with_code(TERM_EFFECTS[:italic]) + end + + # Turns on underline decoration for this text. + def underline + wrap_with_code(TERM_EFFECTS[:underline]) + end + + # Turns on blinking attribute for this text (not well supported by terminal + # emulators). + def blink + wrap_with_code(TERM_EFFECTS[:blink]) + end + + # Inverses current foreground/background colors. + def inverse + wrap_with_code(TERM_EFFECTS[:inverse]) + end + + # Hides this text (set its color to the same as background). + def hide + wrap_with_code(TERM_EFFECTS[:hide]) + end + + private + + def wrap_with_code(code) #:nodoc: + return self unless Sickill::Rainbow.enabled + + var = self.dup + matched = var.match(/^(\e\[([\d;]+)m)*/) + var.insert(matched.end(0), "\e[#{code}m") + var.concat("\e[0m") unless var =~ /\e\[0m$/ + var + end + + end +end + +String.send(:include, Sickill::Rainbow) + +# On Windows systems, try to load the local ANSI support library +if RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ + begin + require 'Win32/Console/ANSI' + rescue LoadError + Sickill::Rainbow.enabled = false + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rainbow-1.1.4/test/rainbow_test.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rainbow-1.1.4/test/rainbow_test.rb new file mode 100644 index 000000000..1aa9f78bc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rainbow-1.1.4/test/rainbow_test.rb @@ -0,0 +1,277 @@ +require 'test/unit' +require File.expand_path(File.dirname(__FILE__) + '/../lib/rainbow') + +class RainbowTest < Test::Unit::TestCase #:nodoc: + def test_color_by_name + assert_equal "\e[31mhello\e[0m", "hello".color(:red) + end + + def test_color_by_rgb + assert_equal "\e[38;5;196mhello\e[0m", "hello".color(255, 0, 0) + end + + def test_foreground_alias + assert_equal "hello".color(:red), "hello".foreground(:red) + end + + def test_colour_alias + assert_equal "hello".color(:red), "hello".colour(:red) + end + + def test_background_by_name + assert_equal "\e[42mhello\e[0m", "hello".background(:green) + end + + def test_background_by_rgb + assert_equal "\e[48;5;46mhello\e[0m", "hello".background(0, 255, 0) + end + + def test_color_and_background + assert_equal "\e[31m\e[42mhello\e[0m", "hello".color(:red).background(:green) + end + + def test_hex_color + assert_equal "\e[48;5;46mhello\e[0m", "hello".background("#00FF00") + assert_equal "\e[48;5;46mhello\e[0m", "hello".background("00FF00") + assert_equal "\e[48;5;46mhello\e[0m", "hello".background("00ff00") + end + + def test_bad_color_name + assert_raises ArgumentError do + "hello".background(:baaaad) + end + end + + def test_rgb_color_with_2_args + assert_raises ArgumentError do + "hello".background(1, 2) + end + end + + def test_rgb_color_with_4_args + assert_raises ArgumentError do + "hello".background(1, 2, 3, 4) + end + end + + def test_rgb_color_with_values_below_zero + assert_raises ArgumentError do + "hello".background(-3, 2, 3) + end + end + + def test_rgb_color_with_values_above_255 + assert_raises ArgumentError do + "hello".background(256, 2, 3) + end + end + + def test_bright + assert_equal "\e[1mhello\e[0m", "hello".bright + end + + def test_bright_and_color + assert_equal "\e[1m\e[31mhello\e[0m", "hello".bright.color(:red) + end + + def test_bright_and_background + assert_equal "\e[1m\e[44mhello\e[0m", "hello".bright.background(:blue) + end + + def test_color_override + assert_equal "\e[31m\e[34m\e[33mhello\e[0m", "hello".color(:red).color(:blue).color(:yellow) + end + + def test_reset + assert_equal "\e[0mhello\e[0m", "hello".reset + end + + def test_italic + assert_equal "\e[3mhello\e[0m", "hello".italic + end + + def test_underline + assert_equal "\e[4mhello\e[0m", "hello".underline + end + + def test_blink + assert_equal "\e[5mhello\e[0m", "hello".blink + end + + def test_inverse + assert_equal "\e[7mhello\e[0m", "hello".inverse + end + + def test_hide + assert_equal "\e[8mhello\e[0m", "hello".hide + end + + def test_immutability + string = "hello" + string.color(:red) + assert_equal string, "hello" + end + + def test_frozen + string = "frozen" + string.freeze + string.color(:red) + end + + class MyString < String + end + + def test_inheritance + my_string = MyString.new "hello" + assert_equal "\e[31mhello\e[0m", my_string.color(:red) + end + + def test_disabled + Sickill::Rainbow.enabled = false + assert_equal "hello", "hello".color(:red) + Sickill::Rainbow.enabled = true + end + +end + +class AnsiColorTest < Test::Unit::TestCase + include Sickill::Rainbow + + ### Foreground + + def test_bad_foreground_name + assert_raises ArgumentError do + AnsiColor.new(:foreground, :azerty).code + end + end + + def test_by_name_black_foreground + assert_equal 30, AnsiColor.new(:foreground, :black).code + end + + def test_by_name_red_foreground + assert_equal 31, AnsiColor.new(:foreground, :red).code + end + + def test_by_name_green_foreground + assert_equal 32, AnsiColor.new(:foreground, :green).code + end + + def test_by_name_yellow_foreground + assert_equal 33, AnsiColor.new(:foreground, :yellow).code + end + + def test_by_name_blue_foreground + assert_equal 34, AnsiColor.new(:foreground, :blue).code + end + + def test_by_name_magenta_foreground + assert_equal 35, AnsiColor.new(:foreground, :magenta).code + end + + def test_by_name_cyan_foreground + assert_equal 36, AnsiColor.new(:foreground, :cyan).code + end + + def test_by_name_white_foreground + assert_equal 37, AnsiColor.new(:foreground, :white).code + end + + ### Background + + def test_bad_background_name + assert_raises ArgumentError do + AnsiColor.new(:background, :azerty).code + end + end + + def test_by_name_black_background + assert_equal 40, AnsiColor.new(:background, :black).code + end + + def test_by_name_red_background + assert_equal 41, AnsiColor.new(:background, :red).code + end + + def test_by_name_green_background + assert_equal 42, AnsiColor.new(:background, :green).code + end + + def test_by_name_yellow_background + assert_equal 43, AnsiColor.new(:background, :yellow).code + end + + def test_by_name_blue_background + assert_equal 44, AnsiColor.new(:background, :blue).code + end + + def test_by_name_magenta_background + assert_equal 45, AnsiColor.new(:background, :magenta).code + end + + def test_by_name_cyan_background + assert_equal 46, AnsiColor.new(:background, :cyan).code + end + + def test_by_name_white_background + assert_equal 47, AnsiColor.new(:background, :white).code + end + + ### Hex color + + def test_by_hex_maj + assert_equal "38;5;46", AnsiColor.new(:foreground, "00FF00").code + end + + def test_by_hex_min + assert_equal "38;5;46", AnsiColor.new(:foreground, "00ff00").code + end + + def test_by_hex_maj_with_sharp + assert_equal "38;5;46", AnsiColor.new(:foreground, "#00FF00").code + end + + def test_by_hex_min_with_sharp + assert_equal "38;5;46", AnsiColor.new(:foreground, "#00ff00").code + end + + ### RGB color + + def test_too_few_colors + assert_raises ArgumentError do + AnsiColor.new(:foreground, 255, 0).code + end + end + + def test_too_much_colors + assert_raises ArgumentError do + AnsiColor.new(:foreground, 255, 0, 0, 0).code + end + end + + def test_by_rgb_red_foreground + assert_equal "38;5;196", AnsiColor.new(:foreground, 255, 0, 0).code + end + +end + +class AnsiRgbTest < Test::Unit::TestCase + include Sickill::Rainbow + + def test_red + assert_equal "38;5;196", AnsiRgb.new(:foreground, [255, 0, 0]).code + end + + def test_rgb_color_with_values_below_zero + assert_raises ArgumentError do + AnsiRgb.new(:foreground, [-1, 0, 0]) + end + end + + def test_rgb_color_with_values_above_255 + assert_raises ArgumentError do + AnsiRgb.new(:foreground, [256, 0, 0]) + end + end + +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/.gitignore b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/.gitignore new file mode 100644 index 000000000..49966b9f0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/.gitignore @@ -0,0 +1,7 @@ +.DS_Store +.rvmrc +*.gem +.bundle +Gemfile.lock +pkg/* +.idea diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/.travis.yml b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/.travis.yml new file mode 100644 index 000000000..aa32bab74 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/.travis.yml @@ -0,0 +1,11 @@ +language: ruby +rvm: + - 1.8.7 + - 1.9.2 + - 1.9.3 + - 2.0.0 + - jruby-18mode # JRuby in 1.8 mode + - jruby-19mode # JRuby in 1.9 mode + - rbx-18mode + - rbx-19mode + - ree \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/CHANGELOG.md b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/CHANGELOG.md new file mode 100644 index 000000000..4b02c1989 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/CHANGELOG.md @@ -0,0 +1,31 @@ +## 1.3.3.1 +* Allow sleep parameter to be a proc/lambda to allow for exponential backoff. + +## 1.3.3 +* sleep after executing the retry block, so there's no wait on the first call (molfar) + +## 1.3.2 +* Clean up option defaults. +* By default, rescue StandardError and Timeout::Error instead of [Exception](http://www.mikeperham.com/2012/03/03/the-perils-of-rescue-exception). + +## 1.3.1 +* Add `rake` dependency for travis-ci. +* Update gemspec summary and description. + +## 1.3.0 + +* Rewrote a lot of the code with inspiration from [attempt](https://rubygems.org/gems/attempt). +* Add timeout option to the code block. +* Include in Kernel by default, but allow require 'retriable/no_kernel' to load a non kernel version. +* Renamed `:times` option to `:tries`. +* Renamed `:sleep` option to `:interval`. +* Renamed `:then` option to `:on_retry`. +* Removed other callbacks, you can wrap retriable in a begin/rescue/else/ensure block if you need that functionality. It avoids the need to define multiple Procs and makes the code more readable. +* Rewrote most of the README + +## 1.2.0 + +* Forked the retryable-rb repo. +* Extend the Kernel module with the retriable method so you can use it anywhere without having to include it in every class. +* Update gemspec, Gemfile, and Raketask. +* Remove echoe dependency. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/Gemfile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/Gemfile new file mode 100644 index 000000000..32d084939 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/Gemfile @@ -0,0 +1,4 @@ +source "https://rubygems.org" + +# Specify your gem's dependencies in retriable.gemspec +gemspec diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/LICENSE b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/LICENSE new file mode 100644 index 000000000..8bb65e28f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2012 Jack Chu (http://www.jackchu.com) + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without +restriction, including without limitation the rights to use, +copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the +Software is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT +HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/README.md b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/README.md new file mode 100644 index 000000000..004e442d2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/README.md @@ -0,0 +1,153 @@ +Retriable +============ + +[![Build Status](https://secure.travis-ci.org/kamui/retriable.png)](http://travis-ci.org/kamui/retriable) + +Retriable is an simple DSL to retry a code block if an exception should be raised. This is especially useful when interacting external api/services or file system calls. + +Installation +------------ +Via command line: + +```ruby +gem install retriable +``` + +In your ruby script: + +```ruby +require 'retriable' +``` + +In your Gemfile: + +```ruby +gem 'retriable' +``` + +Usage +--------------- + +Code in a retriable block will be retried if an exception is raised. By default, Retriable will rescue any exception inherited from `StandardError` (and `Timeout::Error`, which does not inherit from `StandardError` in ruby 1.8) and make 3 retry attempts before raising the last exception. + +```ruby +require 'retriable' + +class Api + # Use it in methods that interact with unreliable services + def get + retriable do + # code here... + end + end +end +``` + +Here are the available options: + +`tries` (default: 3) - Number of attempts to make at running your code block + +`interval` (default: 0) - Number of seconds to sleep between attempts + +`timeout` (default: 0) - Number of seconds to allow the code block to run before raising a Timeout::Error + +`on` (default: [StandardError, Timeout::Error]) - `StandardError` and `Timeout::Error` or array of exceptions to rescue for each attempt + +`on_retry` - (default: nil) - Proc to call after each attempt is rescued + +You can pass options via an options `Hash`. This example will only retry on a `Timeout::Error`, retry 3 times and sleep for a full second before each attempt. + +```ruby +retriable :on => Timeout::Error, :tries => 3, :interval => 1 do + # code here... +end +``` + +You can also specify multiple errors to retry on by passing an array of exceptions. + +```ruby +retriable :on => [Timeout::Error, Errno::ECONNRESET] do + # code here... +end +``` + +You can also specify a timeout if you want the code block to only make an attempt for X amount of seconds. This timeout is per attempt. + +```ruby +retriable :timeout => 1 do + # code here... +end +``` + +If you need millisecond units of time for the sleep or the timeout: + +```ruby +retriable :interval => (200/1000.0), :timeout => (500/1000.0) do + # code here... +end +``` + +If you'd like exponential backoff, interval can take a Proc + +```ruby +# with exponential back-off - sleep 4, 16, 64, 256, give up +retryable :times => 4, :interval => lambda {|attempts| 4 ** attempts} do + # code here... +end +``` + +Retriable also provides a callback called `:on_retry` that will run after an exception is rescued. This callback provides the number of `tries`, and the `exception` that was raised in the current attempt. As these are specified in a `Proc`, unnecessary variables can be left out of the parameter list. + +```ruby +do_this_on_each_retry = Proc.new do |exception, tries| + log "#{exception.class}: '#{exception.message}' - #{tries} attempts."} +end + +retriable :on_retry => do_this_on_each_retry do + # code here... +end +``` + +What if I want to execute a code block at the end, whether or not an exception was rescued ([ensure](http://ruby-doc.org/docs/keywords/1.9/Object.html#method-i-ensure))? Or, what if I want to execute a code block if no exception is raised ([else](http://ruby-doc.org/docs/keywords/1.9/Object.html#method-i-else))? Instead of providing more callbacks, I recommend you just wrap retriable in a begin/retry/else/ensure block: + +```ruby +begin + retriable do + # some code + end +rescue => e + # run this if retriable ends up re-rasing the exception +else + # run this if retriable doesn't raise any exceptions +ensure + # run this no matter what, exception or no exception +end +``` + +Non Kernel version +------------------ +By default, `require 'retriable'` will include the `#retriable` method into the `Kernel` so that you can use it everywhere. If you don't want this behaviour, you can load a non-kernel version: + +```ruby +gem 'retriable', require => 'retriable/no_kernel' +``` + +Or in your ruby script: + +```ruby +require 'retriable/no_kernel' +``` + +In this case, you'll just execute a retriable block from the `Retriable` module: + +```ruby +Retriable.retriable do + # code here... +end +``` + + +Credits +------- + +Retriable was originally forked from the retryable-rb gem by [Robert Sosinski](https://github.com/robertsosinski), which in turn originally inspired by code written by [Michael Celona](http://github.com/mcelona) and later assisted by [David Malin](http://github.com/dmalin). The [attempt](https://rubygems.org/gems/attempt) gem by Daniel J. Berger was also an inspiration. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/Rakefile new file mode 100644 index 000000000..6ce2dcfa7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/Rakefile @@ -0,0 +1,16 @@ +# encoding: utf-8 + +require 'bundler' +Bundler::GemHelper.install_tasks + +require 'rake/testtask' +task :default => :test + +desc "Run tests" +task :test do + Rake::TestTask.new do |t| + t.libs << 'lib' << 'test' + t.pattern = 'test/**/*_test.rb' + t.verbose = true + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/lib/retriable.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/lib/retriable.rb new file mode 100644 index 000000000..56ad9c412 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/lib/retriable.rb @@ -0,0 +1,4 @@ +# encoding: utf-8 + +require 'retriable/no_kernel' +require 'retriable/core_ext/kernel' \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/lib/retriable/core_ext/kernel.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/lib/retriable/core_ext/kernel.rb new file mode 100644 index 000000000..d6fb7575e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/lib/retriable/core_ext/kernel.rb @@ -0,0 +1,9 @@ +# encoding: utf-8 + +module Kernel + include Retriable +end + +class Object + include Kernel +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/lib/retriable/no_kernel.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/lib/retriable/no_kernel.rb new file mode 100644 index 000000000..f8084a650 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/lib/retriable/no_kernel.rb @@ -0,0 +1,4 @@ +# encoding: utf-8 + +require 'retriable/retriable' +require 'retriable/version' \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/lib/retriable/retriable.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/lib/retriable/retriable.rb new file mode 100644 index 000000000..e28b964b9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/lib/retriable/retriable.rb @@ -0,0 +1,61 @@ + # encoding: utf-8 + +require 'timeout' + +module Retriable + extend self + + class Retry + attr_accessor :tries + attr_accessor :interval + attr_accessor :timeout + attr_accessor :on + attr_accessor :on_retry + + def initialize + @tries = 3 + @interval = 0 + @timeout = nil + @on = [StandardError, Timeout::Error] + @on_retry = nil + + yield self if block_given? + end + + def perform + count = 0 + begin + if @timeout + Timeout::timeout(@timeout) { yield } + else + yield + end + rescue *[*on] => exception + @tries -= 1 + if @tries > 0 + count += 1 + @on_retry.call(exception, count) if @on_retry + + sleep_for = @interval.respond_to?(:call) ? @interval.call(count) : @interval + sleep sleep_for if sleep_for > 0 + + retry + else + raise + end + end + end + end + + def retriable(opts = {}, &block) + raise 'no block given' unless block_given? + + Retry.new do |r| + r.tries = opts[:tries] if opts[:tries] + r.on = opts[:on] if opts[:on] + r.interval = opts[:interval] if opts[:interval] + r.timeout = opts[:timeout] if opts[:timeout] + r.on_retry = opts[:on_retry] if opts[:on_retry] + end.perform(&block) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/lib/retriable/version.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/lib/retriable/version.rb new file mode 100644 index 000000000..8a7f048be --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/lib/retriable/version.rb @@ -0,0 +1,5 @@ +# encoding: utf-8 + +module Retriable + VERSION = '1.3.3.1' +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/retriable.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/retriable.gemspec new file mode 100644 index 000000000..85e09feb5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/retriable.gemspec @@ -0,0 +1,25 @@ +# encoding: utf-8 + +$:.push File.expand_path("../lib", __FILE__) +require "retriable/version" + +Gem::Specification.new do |s| + s.name = "retriable" + s.version = Retriable::VERSION + s.platform = Gem::Platform::RUBY + s.authors = ["Jack Chu"] + s.email = ["jack@jackchu.com"] + s.homepage = %q{http://github.com/kamui/retriable} + s.summary = %q{Retriable is an simple DSL to retry a code block if an exception should be raised.} + s.description = %q{Retriable is an simple DSL to retry a code block if an exception should be raised. This is especially useful when interacting external api/services or file system calls.} + + s.rubyforge_project = "retriable" + + s.files = `git ls-files`.split("\n") + s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n") + s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) } + s.require_paths = ["lib"] + + s.add_development_dependency 'rake' + s.add_development_dependency 'minitest' +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/test/retriable_test.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/test/retriable_test.rb new file mode 100644 index 000000000..9b962bad7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/retriable-1.3.3.1/test/retriable_test.rb @@ -0,0 +1,61 @@ +# encoding: utf-8 + +require 'retriable' +require 'minitest/autorun' + +class RetriableTest < MiniTest::Unit::TestCase + def test_without_arguments + i = 0 + + retriable do + i += 1 + raise StandardError.new + end + rescue StandardError + assert_equal 3, i + end + + def test_with_one_exception_and_two_tries + i = 0 + + retriable :on => EOFError, :tries => 2 do + i += 1 + raise EOFError.new + end + + rescue EOFError + assert_equal i, 2 + end + + def test_with_arguments + i = 0 + + on_retry = Proc.new do |exception, tries| + assert_equal exception.class, ArgumentError + assert_equal i, tries + end + + retriable :on => [EOFError, ArgumentError], :on_retry => on_retry, :tries => 5, :sleep => 0.2 do |h| + i += 1 + raise ArgumentError.new + end + + rescue ArgumentError + assert_equal 5, i + end + + def test_with_interval_proc + was_called = false + + sleeper = Proc.new do |attempts| + was_called = true + attempts + end + + retriable :on => EOFError, :interval => sleeper do |h| + raise EOFError.new + end + rescue + assert_equal was_called, true + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/.gitignore b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/.gitignore new file mode 100644 index 000000000..f7bebc43f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/.gitignore @@ -0,0 +1,18 @@ +*.gem +*.rbc +.bundle +.config +.yardoc +Gemfile.lock +InstalledFiles +_yardoc +coverage +doc/ +lib/bundler/man +pkg +rdoc +spec/reports +test/tmp +test/version_tmp +tmp +html diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/Gemfile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/Gemfile new file mode 100644 index 000000000..82808f03b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/Gemfile @@ -0,0 +1,4 @@ +source 'https://rubygems.org' + +# Specify your gem's dependencies in ruby-xes.gemspec +gemspec diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/LICENSE.txt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/LICENSE.txt new file mode 100644 index 000000000..444de90f9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2013 NaU Data Institute Inc. and contributors. + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/README.md b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/README.md new file mode 100644 index 000000000..0c5667103 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/README.md @@ -0,0 +1,41 @@ +# ruby-xes + +ruby-xes is a Ruby library for generating XES event log. + +## Installation + + $ gem install ruby-xes + +## Usage + +```ruby +require 'xes' + +XES::Document.new.tap do |doc| + doc.log = XES::Log.new.tap do |log| + log.traces << XES::Trace.new.tap do |trace| + trace.events << XES::Event.new.tap do |event| + event.attributes << XES.string("concept:name", "test") + end + end + end +end.format +``` + +## Contributing + +1. Fork it +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin my-new-feature`) +5. Create new Pull Request + +## Licence + +ruby-xes is free software distributed under MIT licence. + +## Links + +* [PIONE project homepage](http://pione.github.io/) + * [repository on github](https://github.com/pione/pione) +* [XES](http://www.xes-standard.org/start) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/Rakefile new file mode 100644 index 000000000..d86a3e424 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/Rakefile @@ -0,0 +1,16 @@ +require "bundler/gem_tasks" + +desc 'Test specs' +task 'test' do + sh "bundle exec bacon -a" +end + +desc 'Generate API document' +task 'html' do + sh "bundle exec yard doc -o html --hide-void-return --no-api" +end + +desc 'Show undocumented function list' +task 'html:undoc' do + sh "bundle exec yard stats --list-undoc --no-api --compact" +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes.rb new file mode 100644 index 000000000..305b4d733 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes.rb @@ -0,0 +1,18 @@ +require "rexml/document" +require "time" + +require "xes/version" +require "xes/format-error" +require "xes/attribute-accessor" +require "xes/extension" +require "xes/classifier" +require "xes/attribute" +require "xes/global" +require "xes/event" +require "xes/trace" +require "xes/log" +require "xes/document" + +# XES is a module for genereting XES event log. +module XES +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/attribute-accessor.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/attribute-accessor.rb new file mode 100644 index 000000000..5625fdb75 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/attribute-accessor.rb @@ -0,0 +1,121 @@ +module XES + # AttributeAccessor provides attribute accessors of standard extensions. + module AttributeAccessor + # Define an attribute accessor. + # + # @param name [String] + # attribute name + # @param type [String] + # attribute type + # @return [void] + def define_attribute(name, type) + _name = name.gsub(":", "_") + + define_method(_name) do + var = instance_variables.include?(:@meta) ? :@meta : :@attributes + instance_variable_get(var).find do |attribute| + attribute.key == name + end.tap{|x| return x.value if x} + end + + define_method("%s=" % _name) do |value| + var = instance_variables.include?(:@meta) ? :@meta : :@attributes + instance_variable_get(var).tap do |attributes| + if elt = __send__(_name) + attributes.delete(elt) + end + attributes << XES.send(type, name, value) + end + end + end + end + + # EventAttributeAccessor provides attribute accessors for event or event global element. + module EventAttributeAccessor + extend AttributeAccessor + + # @!attribute [rw] concept_name + # @return [String] + # the value of attribute "concept:name" + define_attribute "concept:name", "string" + + # @!attribute [rw] concept_instance + # @return [String] + # the value of attribute "concept:instance" + define_attribute "concept:instance", "string" + + # @!attribute [rw] lifecycle_transition + # @return [String] + # the value of attribute "lifecycle:transition" + define_attribute "lifecycle:transition", "string" + + # @!attribute [rw] org_resource + # @return [String] + # the value of attribute "org:resource" + define_attribute "org:resource", "string" + + # @!attribute [rw] org_role + # @return [String] + # the value of attribute "org:role" + define_attribute "org:role", "string" + + # @!attribute [rw] org_group + # @return [String] + # the value of attribute "org:group" + define_attribute "org:group", "string" + + # @!attribute [rw] time_timestamp + # @return [Time,String] + # the value of attribute "time:timestamp" + define_attribute "time:timestamp", "date" + + # @!attribute [rw] semantic_modelReference + # @return [String] + # the value of attribute "semantic:modelReference" + define_attribute "semantic:modelReference", "string" + + # @!attribute [rw] identity_id + # @return [String] + # the value of attribute "identity:id" + define_attribute "identity:id", "id" + + # @!attribute [rw] cost_total + # @return [Float] + # the value of attribute "cost:total" + define_attribute "cost:total", "float" + + # @!attribute [rw] cost_currency + # @return [String] + # the value of attribute "cost:currency" + define_attribute "cost:currency", "string" + end + + # TraceAttributeAccessor provides attribute accessors for trace or trace global element. + module TraceAttributeAccessor + extend AttributeAccessor + # @!attribute [rw] concept_name + # @return [String] + # the value of attribute "concept:name" + define_attribute "concept:name", "string" + + # @!attribute [rw] semantic_modelReference + # @return [String] + # the value of attribute "semantic:modelReference" + define_attribute "semantic:modelReference", "string" + + # @!attribute [rw] identity_id + # @return [String] + # the value of attribute "identity:id" + define_attribute "identity:id", "id" + + # @!attribute [rw] cost:total + # @return [Float] + # the value of attribute "cost:total" + define_attribute "cost:total", "float" + + # @!attribute [rw] cost_currency + # @return [String] + # the value of attribute "cost:currency" + define_attribute "cost:currency", "string" + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/attribute.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/attribute.rb new file mode 100644 index 000000000..c522cf553 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/attribute.rb @@ -0,0 +1,201 @@ +module XES + # Attribute represents attribute of XES. + class Attribute + extend AttributeAccessor + + # @!attribute [rw] semantic_modelReference + # @return [String] + # the value of meta attribute "semantic:modelReference" + define_attribute "semantic:modelReference", "string" + + # @!attribute [rw] identity_id + # @return [String] + # the value of meta attribute "identity:id" + define_attribute "identity:id", "id" + + # @!attribute [rw] cost_amount + # @return [Float] + # the value of meta attribute "cost:amount" + define_attribute "cost:amount", "float" + + # @!attribute [rw] cost_driver + # @return [String] + # the value of meta attribute "cost:driver" + define_attribute "cost:driver", "string" + + # @!attribute [rw] cost_type + # @return [String] + # the value of meta attribute "cost:type" + define_attribute "cost:type", "string" + + # @return [String] + # attribute type + attr_reader :type + + # @return [String] + # attribute name + attr_accessor :key + + # @return [String] + # attribute value + attr_accessor :value + + # @return [Meta] + # attribute meta attributes + attr_accessor :meta + + # @param type [String] + # attribute type + # @param key [String] + # attribute name + # @param value [String] + # attribute value + # @param meta [Array] + # meta attributes + def initialize(type, key, value, meta=[]) + @type = type + @key = key + @value = value + @meta = meta + end + + # Return true if the element is formattable. + # + # @return [Boolean] + # true if the element is formattable + def formattable? + not(@type.nil? or @key.nil? or @value.nil? or @meta.nil?) + end + + # Format as a XML element. + def format + raise FormatError.new(self) unless formattable? + + REXML::Element.new(type).tap do |attribute| + attribute.attributes["key"] = @key + attribute.attributes["value"] = format_value + meta.each {|m| attribute.elements << m.format if m.formattable?} + end + end + + # @api private + def ==(other) + return false unless other.kind_of?(self.class) + @type == other.type and @key == other.key and @value == other.value and @meta == other.meta + end + alias :eql? :"==" + + # @api private + def hash + @type.hash + @key.hash + @value.hash + end + + private + + # Format the value. + # + # @return [String] + def format_value + case @type + when "string" + @value + when "date" + @value.kind_of?(Time) ? @value.iso8601(3) : @value + when "int" + @value.kind_of?(Integer) ? @value : @value.to_i + when "float" + @value.kind_of?(Float) ? @value : @value.to_f + when "boolean" + @value + when "id" + @value + end.to_s + end + end + + class << self + # Return string attribute object. + # + # @param key [String] + # attribute name + # @param value [Object] + # attribute value + # @param meta [Array] + # meta attributes + # @return [Attribute] + # string attribute + def string(key, value, meta=[]) + Attribute.new("string", key, value, meta) + end + + # Return date attribute object. + # + # @param key [String] + # attribute name + # @param value [Object] + # attribute value + # @param meta [Array] + # meta attributes + # @return [Attribute] + # date attribute + def date(key, value, meta=[]) + Attribute.new("date", key, value, meta) + end + + # Return int attribute object. + # + # @param key [String] + # attribute name + # @param value [Object] + # attribute value + # @param meta [Array] + # meta attributes + # @return [Attribute] + # int attribute + def int(key, value, meta=[]) + Attribute.new("int", key, value, meta) + end + + # Return float attribute object. + # + # @param key [String] + # attribute name + # @param value [Object] + # attribute value + # @param meta [Array] + # meta attributes + # @return [Attribute] + # float attribute + def float(key, value, meta=[]) + Attribute.new("float", key, value, meta) + end + + # Return boolean attribute object. + # + # @param key [String] + # attribute name + # @param value [Object] + # attribute value + # @param meta [Array] + # meta attributes + # @return [Attribute] + # boolean attribute + def boolean(key, value, meta=[]) + Attribute.new("boolean", key, value, meta) + end + + # Return id attribute object. + # + # @param key [String] + # attribute name + # @param value [Object] + # attribute value + # @param meta [Array] + # meta attributes + # @return [Attribute] + # id attribute + def id(key, value, meta=[]) + Attribute.new("id", key, value, meta) + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/classifier.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/classifier.rb new file mode 100644 index 000000000..90a3ec1c3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/classifier.rb @@ -0,0 +1,63 @@ +module XES + # Classifier represents "classifier" element of XES. + class Classifier + # @return [String] + # classifier name + attr_reader :name + + # @return [String] + # classifier keys + attr_reader :keys + + # Create a XES classifier element. + # + # @param name [String] + # classifier name + # @param keys [String] + # classifier keys + def initialize(name, keys) + @name = name + @keys = keys + end + + # Return true if the element is formattable. + # + # @return [Boolean] + # true if the element is formattable + def formattable? + not(@name.nil? or @keys.nil?) + end + + # Format as a XML element. + # + # @return [REXML::Element] + # XML element + def format + raise FormatError.new(self) unless formattable? + + REXML::Element.new("classifier").tap do |ext| + ext.attributes["name"] = @name + ext.attributes["keys"] = @keys + end + end + + # @api private + def ==(other) + return false unless other.kind_of?(self.class) + @name == other.name and @keys == other.keys + end + alias :eql? :"==" + + # @api private + def hash + @name.hash + @keys.hash + end + end + + # known XES classifier elements + CLASSIFIER = { + :mxml_legacy_classifier => Classifier.new("MXML Legacy Classifier", "concept:name lifecycle:transition"), + :event_name => Classifier.new("Event Name", "concept:name"), + :resource => Classifier.new("Resource", "org:resource") + } +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/document.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/document.rb new file mode 100644 index 000000000..b988c12af --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/document.rb @@ -0,0 +1,48 @@ +module XES + # Document is a class for XES event log doucment. + class Document + # @return [Log] + # log element + attr_accessor :log + + # @param log [Log] + def initialize(log=nil) + @log = log + end + + # Return true if the document is formattable. + # + # @return [Boolean] + # true if the element is formattable + def formattable? + not(@log.nil?) and @log.formattable? + end + + # Format as a XML document. + # + # @return [REXML::Document] + # XML document + # @raise FormatError + # format error when the document is not formattable + def format + raise FormatError.new(self) unless formattable? + + REXML::Document.new.tap do |doc| + doc << REXML::XMLDecl.new + doc.elements << @log.format + end + end + + # @api private + def ==(other) + return false unless other.kind_of?(self.class) + @log == other.log + end + alias :eql? :"==" + + # @api private + def hash + @attributes.hash + @events.hash + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/event.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/event.rb new file mode 100644 index 000000000..931b18b01 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/event.rb @@ -0,0 +1,50 @@ +module XES + # XESEvent represents "event" element of XES. + class Event + include EventAttributeAccessor + + # @return [Array] + # event attributes + attr_accessor :attributes + + # Create a XES event. + # + # @param attributes [Array] + # attributes of the event + def initialize(attributes=[]) + @attributes = attributes + end + + # Return true if the element is formattable. + # + # @return [Boolean] + # true if the element is formattable + def formattable? + not(@attributes.empty?) + end + + # Format as a XML element. + # + # @return [REXML::Element] + # XML element + def format + REXML::Element.new("event").tap do |event| + @attributes.each do |attribute| + event.elements << attribute.format if attribute.formattable? + end + end + end + + # @api private + def ==(other) + return false unless other.kind_of?(self.class) + @attributes == other.attributes + end + alias :eql? :"==" + + # @api private + def hash + @attributes.hash + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/extension.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/extension.rb new file mode 100644 index 000000000..1de3c4ebf --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/extension.rb @@ -0,0 +1,73 @@ +module XES + # Extension represents "extension" element of XES. + class Extension + # @return [String] + # extension name + attr_reader :name + + # @return [String] + # extension prefix + attr_reader :prefix + + # @return [String] + # extension URI + attr_reader :uri + + # Create a XES extension element. + # + # @param name [String] + # extension name + # @param prefix [String] + # extension prefix + # @param uri [String] + # extension definition URI + def initialize(name, prefix, uri) + @name = name + @prefix = prefix + @uri = uri + end + + # Return true if the element is formattable. + # + # @return [Boolean] + # true if the element is formattable + def formattable? + not(@name.nil? or @prefix.nil? or @uri.nil?) + end + + # Format as a XML element. + # + # @return [REXML::Element] + # XML element + def format + raise FormatError.new(self) unless formattable? + + REXML::Element.new("extension").tap do |ext| + ext.attributes["name"] = @name + ext.attributes["prefix"] = @prefix + ext.attributes["uri"] = @uri + end + end + + # @api private + def ==(other) + return false unless other.kind_of?(self.class) + @name == other.name and @prefix == other.prefix and @uri == other.uri + end + alias :eql? :"==" + + # @api private + def hash + @name.hash + @prefix.hash + @uri.hash + end + end + + # known XES extension elements + EXTENSION = { + :concept => Extension.new("Concept", "concept", "http://www.xes-standard.org/concept.xesext"), + :identity => Extension.new("Identity", "identity", "http://www.xes-standard.org/identity.xesext"), + :time => Extension.new("Time", "time", "http://www.xes-standard.org/time.xesext"), + :lifecycle => Extension.new("Lifecycle", "lifecycle", "http://www.xes-standard.org/lifecycle.xesext"), + :organizational => Extension.new("Organizational", "org", "http://www.xes-standard.org/org.xesext") + } +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/format-error.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/format-error.rb new file mode 100644 index 000000000..ab9d7edbd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/format-error.rb @@ -0,0 +1,15 @@ +module XES + # FormatError is raised when you failed to format XES element. + class FormatError < StandardError + # @param element [Object] + # object that caused to raise this exception + def initialize(element) + @element = element + end + + # @api private + def message + "Error happened on formatting %s" % @element.inspect + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/global.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/global.rb new file mode 100644 index 000000000..96d7aa104 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/global.rb @@ -0,0 +1,75 @@ +module XES + # Global represents "global" element of XES. + class Global + class << self + # Create an event global. The object extended by EventAttributeAccessor. + # + # @param attributes [Array] + # event global attributes + def event(attributes=[]) + new("event", attributes).tap do |global| + global.extend EventAttributeAccessor + end + end + + # Create a trace global. The object extended by TraceAttributeAccessor. + # + # @param attributes [Array] + # trace global attributes + def trace(attributes=[]) + new("trace", attributes).tap do |global| + global.extend TraceAttributeAccessor + end + end + end + + # @return [String] + # scope name + attr_reader :scope + + # @return [Array] + # global attributes + attr_accessor :attributes + + # @param scope [String] + # scope of global attributes + # @param attributes [Arrray] + # global attributes + def initialize(scope, attributes=[]) + @scope = scope + @attributes = attributes + end + + # Return true if the element is formattable. + # + # @return [Boolean] + # true if the element is formattable + def formattable? + not(@attributes.empty?) + end + + # Format as a XML element. + # + # @return [REXML::Element] + # XML element + def format + raise FormatError.new(self) unless formattable? + + REXML::Element.new("global").tap do |global| + global.attributes["scope"] = @scope.to_s + @attributes.each {|attribute| global.elements << attribute.format} + end + end + + # @api private + def ==(other) + @scope == other.scope and @attributes == other.attributes + end + alias :eql? :"==" + + # @api private + def hash + @scope.hash + @attributes.hash + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/log.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/log.rb new file mode 100644 index 000000000..fd3c4ec30 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/log.rb @@ -0,0 +1,158 @@ +module XES + # Log represents log element of XES. + class Log + extend AttributeAccessor + + # @!attribute [rw] concept_name + # @return [String] + # the value of attribute "concept:name" + define_attribute "concept:name", "string" + + # @!attribute [rw] lifecycle_model + # @return [String] + # the value of attribute "lifecycle:model" + define_attribute "lifecycle:model", "string" + + # @!attribute [rw] semantic_modelReference + # @return [String] + # the value of attribute "semantic:modelReference" + define_attribute "semantic:modelReference", "string" + + # @!attribute [rw] identity_id + # @return [String] + # the value of attribute "identity:id" + define_attribute "identity:id", "id" + + class << self + # Create new instance with default values. + # + # @return [Log] + # new log instance + def default + new.tap do |log| + log.xes_version = "1.4" + log.xes_features = "nested-attributes" + log.openxes_version = "1.0RC7" + log.extensions = [ + EXTENSION[:concept], + EXTENSION[:identity], + EXTENSION[:time], + EXTENSION[:lifecycle], + EXTENSION[:organizational], + ] + log.classifiers = [ + CLASSIFIER[:mxml_legacy_classifier], + CLASSIFIER[:event_name], + CLASSIFIER[:resource] + ] + end + end + end + + # @return [String] + # XES version + attr_accessor :xes_version + + # @return [String] + # XES features + attr_accessor :xes_features + + # @return [String] + # openxes version for faking ProM + attr_accessor :openxes_version + + # @return [String] + # xmlns value + attr_accessor :xmlns + + # @return [Array] + # XES extensions + attr_accessor :extensions + + # @return [Array] + # XES classifiers + attr_accessor :classifiers + + # @return [Array] + # XES global elements for event attributes + attr_accessor :event_global + + # @return [Array] + # XES global elements for trace attributes + attr_accessor :trace_global + + # @return [Array] + # XES attribute elements + attr_accessor :attributes + + # @return [Array] + # XES trace elements + attr_accessor :traces + + def initialize + @xes_version = "1.4" + @xes_features = "" + @openxes_version = nil + @xmlns = "http://www.xes-standard.org/" + @extensions = [] + @event_global = Global.event + @trace_global = Global.trace + @classifiers = [] + @attributes = [] + @traces = [] + end + + # Return true if the element is formattable. + # + # @return [Boolean] + # true if the element is formattable + def formattable? + @traces.any? {|trace| trace.formattable?} + end + + # Format as a XML element. + # + # @return [REXML::Element] + # XML element + # @raise FormatError + # format error when the log is formattable + def format + raise FormatError.new(self) unless formattable? + + REXML::Element.new("log").tap do |log| + log.attributes["xes.version"] = @xes_version.to_s if @xes_version + log.attributes["xes.features"] = @xes_features.to_s if @xes_features + log.attributes["openxes.version"] = @openxes_version.to_s if @openxes_version + log.attributes["xmlns"] = @xmlns.to_s if @xmlns + @extensions.each {|ext| log.elements << ext.format if ext.formattable?} + @classifiers.each {|classifier| log.elements << classifier.format if classifier.formattable?} + log.elements << @event_global.format if @event_global.formattable? + log.elements << @trace_global.format if @trace_global.formattable? + @attributes.each {|attribute| log.elements << attribute.format if attribute.formattable?} + @traces.each {|trace| log.elements << trace.format if trace.formattable?} + end + end + + # @api private + def ==(other) + return false unless other.kind_of?(self.class) + return false unless @xes_version == other.xes_version + return false unless @xes_features == other.xes_features + return false unless @openxes_version == other.openxes_version + return false unless @xmlns == other.xmlns + return false unless @extensions == other.extensions + return false unless @event_global == other.event_global + return false unless @trace_global == other.trace_global + return false unless @classifiers == other.classifiers + return false unless @attributes == other.attributes + return false unless @traces == other.traces + return true + end + alias :eql? :"==" + + # @api private + def hash + @attributes.hash + @events.hash + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/trace.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/trace.rb new file mode 100644 index 000000000..d903216df --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/trace.rb @@ -0,0 +1,57 @@ +module XES + # Trace represents "trace" element of XES. + class Trace + include TraceAttributeAccessor + + # @return [Array] + # attributes of the trace element + attr_accessor :attributes + + # @return [Array] + # events included in the trace element + attr_accessor :events + + # Create a XES trace. + # + # @param events [Array] + # events included in the trace element + def initialize(attributes=[], events=[]) + @attributes = attributes + @events = events + end + + # Return true if the element is formattable. + # + # @return [Boolean] + # true if the element is formattable + def formattable? + @events.any? {|event| event.formattable?} + end + + # Format as a XML element. + # + # @return [REXML::Element] + # XML element + # @raise FormatError + def format + raise FormatError.new(self) unless formattable? + + REXML::Element.new("trace").tap do |trace| + @attributes.each {|attribute| trace.elements << attribute.format if attribute.formattable?} + @events.each {|event| trace.elements << event.format if event.formattable?} + end + end + + # @api private + def ==(other) + return false unless other.kind_of?(self.class) + @attributes == other.attributes and @events == other.events + end + alias :eql? :"==" + + # @api private + def hash + @attributes.hash + @events.hash + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/version.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/version.rb new file mode 100644 index 000000000..42a62c9be --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/lib/xes/version.rb @@ -0,0 +1,4 @@ +module XES + # version of ruby-xes + VERSION = "0.1.0" +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/ruby-xes.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/ruby-xes.gemspec new file mode 100644 index 000000000..be9873188 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/ruby-xes.gemspec @@ -0,0 +1,24 @@ +# -*- ruby -*- +# -*- encoding: utf-8 -*- +lib = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'xes/version' + +Gem::Specification.new do |gem| + gem.name = "ruby-xes" + gem.version = XES::VERSION + gem.authors = ["Keita Yamaguchi"] + gem.email = ["keita.yamaguchi@gmail.com"] + gem.description = "ruby-xes is a library for generating XES event log." + gem.summary = "ruby-xes is a library for generating XES event log." + gem.homepage = "https://github.com/pione/ruby-xes" + + gem.files = `git ls-files`.split($/) + gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } + gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) + gem.require_paths = ["lib"] + + gem.add_development_dependency "bacon" + gem.add_development_dependency "yard", "~> 0.8.5" + gem.add_development_dependency "redcarpet" +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_attribute.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_attribute.rb new file mode 100644 index 000000000..efc305853 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_attribute.rb @@ -0,0 +1,150 @@ +require 'xes' + +describe "XES::Attribute" do + it "should equal" do + XES::Attribute.new("string", "concept:name", "A").should == + XES::Attribute.new("string", "concept:name", "A") + end + + it 'should not equal' do + XES::Attribute.new("string", "concept:name", "A").should != + XES::Attribute.new("string", "concept:name", "B") + end + + it 'should make string attribute' do + XES.string("concept:name", "A").should == + XES::Attribute.new("string", "concept:name", "A") + end + + it 'should make date attribute' do + Time.now.tap do |time| + XES.date("time:timestamp", time).should == + XES::Attribute.new("date", "time:timestamp", time) + end + end + + it 'should make int attribute' do + XES.int("counter", 123).should == + XES::Attribute.new("int", "counter", 123) + end + + it 'should make float attribute' do + XES.float("counter", 0.123).should == + XES::Attribute.new("float", "counter", 0.123) + end + + it 'should make boolean attribute' do + XES.boolean("truth", true).should == + XES::Attribute.new("boolean", "truth", true) + end + + it 'should make id attribute' do + XES.id("identity:id", "123").should == + XES::Attribute.new("id", "identity:id", "123") + end + + it 'should get the type' do + XES::Attribute.new("string", "concept:name", "A").type.should == "string" + end + + it 'should get the key' do + XES::Attribute.new("string", "concept:name", "A").key.should == "concept:name" + end + + it 'should get the value' do + XES::Attribute.new("string", "concept:name", "A").value.should == "A" + end + + it 'should get meta attributes' do + XES::Attribute.new("string", "concept:name", "A").tap do |x| + x.meta << XES::Attribute.new("string", "meta", "1") + end.meta.should == [XES::Attribute.new("string", "meta", "1")] + end + + it 'should get identity:id' do + XES::Attribute.new("string", "concept:name", "A").tap do |x| + x.meta << XES::Attribute.new("id", "identity:id", "123456") + end.identity_id.should == "123456" + end + + it 'should set identity:id' do + XES::Attribute.new("string", "concept:name", "A").tap do |x| + x.identity_id = "test" + end.identity_id.should == "test" + end + + it "should get cost:amount" do + XES.string("concept:name", "A").tap do |x| + x.meta << XES.float("cost:amount", 0.123) + end.cost_amount.should == 0.123 + end + + it "should set cost:amount" do + XES.string("concept:name", "A").tap do |x| + x.cost_amount = 0.123 + end.cost_amount.should == 0.123 + end + + it "should get cost:driver" do + XES.string("concept:name", "A").tap do |x| + x.meta << XES.string("cost:driver", "xyz123") + end.cost_driver.should == "xyz123" + end + + it "should set cost:driver" do + XES.string("concept:name", "A").tap do |x| + x.cost_driver = "xyz123" + end.cost_driver.should == "xyz123" + end + + it "should get cost:type" do + XES.string("concept:name", "A").tap do |x| + x.meta << XES.string("cost:type", "Fixed Overhead") + end.cost_type.should == "Fixed Overhead" + end + + it "should set cost:driver" do + XES.string("concept:name", "A").tap do |x| + x.cost_type = "Fixed Overhead" + end.cost_type.should == "Fixed Overhead" + end + + it 'should format string attribute as XML' do + XES.string("concept:name", "A").format.to_s.should == + "" + end + + it 'should format date attribute as XML' do + Time.now.tap do |time| + XES.date("time:timestamp", time).format.to_s.should == + "" % time.iso8601 + end + end + + it 'should format int attribute as XML' do + XES.int("counter", 123).format.to_s.should == + "" + end + + it 'should format float attribute as XML' do + XES.float("counter", 0.123).format.to_s.should == + "" + end + + it 'should format boolean attribute as XML' do + XES.boolean("truth", true).format.to_s.should == + "" + end + + it 'should format id attribute as XML' do + XES.id("identity:id", "123456").format.to_s.should == + "" + end + + it 'should format attribute with meta attribute as XML' do + XES.string("concept:name", "A").tap do |x| + x.identity_id = "123456" + end.format.to_s.should == + "" + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_classifier.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_classifier.rb new file mode 100644 index 000000000..756f2488e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_classifier.rb @@ -0,0 +1,26 @@ +require 'xes' + +describe "XES::Classifier" do + it "should equal" do + XES::Classifier.new("Event Name", "concept:name").should == + XES::Classifier.new("Event Name", "concept:name") + end + + it "should not equal" do + XES::Classifier.new("Event Name", "concept:name").should != + XES::Classifier.new("Resource", "org:resource") + end + + it "should get the name" do + XES::Classifier.new("Event Name", "concept:name").name.should == "Event Name" + end + + it "should get the keys" do + XES::Classifier.new("Event Name", "concept:name").keys.should == "concept:name" + end + + it "should format as XML element" do + XES::Classifier.new("Event Name", "concept:name").format.to_s.should == + "" + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_document.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_document.rb new file mode 100644 index 000000000..f62ea6da6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_document.rb @@ -0,0 +1,19 @@ +require 'xes' + +describe "XES::Document" do + it "should equal" do + XES::Document.new.should == XES::Document.new + end + + it "should formattable" do + XES::Document.new.tap do |doc| + doc.log = XES::Log.new.tap do |log| + log.traces << XES::Trace.new.tap do |trace| + trace.events << XES::Event.new.tap do |event| + event.attributes << XES.string("concept:name", "test") + end + end + end + end.should.formattable + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_event.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_event.rb new file mode 100644 index 000000000..b60fc2b2c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_event.rb @@ -0,0 +1,102 @@ +require 'xes' + +describe "XES::Event" do + it "should equal" do + XES::Event.new([XES.string("concept:name", "A")]).should == + XES::Event.new([XES.string("concept:name", "A")]) + end + + it "should get concept:name" do + XES::Event.new([XES.string("concept:name", "A")]).concept_name.should == "A" + end + + it "should set concept:name" do + XES::Event.new.tap{|x| x.concept_name = "A"}.concept_name.should == "A" + end + + it "should get lifecycle:transition" do + XES::Event.new([XES.string("lifecycle:transition", "start")]).lifecycle_transition.should == "start" + end + + it "should set lifecycle:transition" do + XES::Event.new.tap{|x| x.lifecycle_transition = "start"}.lifecycle_transition.should == "start" + end + + it "should get org:resource" do + XES::Event.new([XES.string("org:resource", "A")]).org_resource.should == "A" + end + + it "should set org:resource" do + XES::Event.new.tap{|x| x.org_resource = "A"}.org_resource.should == "A" + end + + it "should get org:role" do + XES::Event.new([XES.string("org:role", "A")]).org_role.should == "A" + end + + it "should set org:role" do + XES::Event.new.tap{|x| x.org_role = "A"}.org_role.should == "A" + end + + it "should get org:group" do + XES::Event.new([XES.string("org:group", "A")]).org_group.should == "A" + end + + it "should set org:group" do + XES::Event.new.tap{|x| x.org_group = "A"}.org_group.should == "A" + end + + it "should get time:timestamp" do + Time.now.tap do |time| + XES::Event.new([XES.date("time:timestamp", time)]).time_timestamp.should == time + end + end + + it "should set time:timestamp" do + Time.now.tap do |time| + XES::Event.new.tap{|x| x.time_timestamp = time}.time_timestamp.should == time + end + end + + it "should get semantic:modelReference" do + XES::Event.new([XES.string("semantic:modelReference", "A")]).semantic_modelReference.should == "A" + end + + it "should set semantic:modelReference" do + XES::Event.new.tap{|x| x.semantic_modelReference = "A"}.semantic_modelReference.should == "A" + end + + it "should get identity:id" do + XES::Event.new([XES.id("identity:id", "A")]).identity_id.should == "A" + end + + it "should set identity:id" do + XES::Event.new.tap{|x| x.identity_id = "123456"}.identity_id.should == "123456" + end + + it "should get cost:total" do + XES::Event.new([XES.float("cost:total", 0.123)]).cost_total.should == 0.123 + end + + it "should set cost:total" do + XES::Event.new.tap{|x| x.cost_total = 0.123}.cost_total.should == 0.123 + end + + it "should get cost:currency" do + XES::Event.new([XES.string("cost:currency", "AUD")]).cost_currency.should == "AUD" + end + + it "should set cost:total" do + XES::Event.new.tap{|x| x.cost_currency = "AUD"}.cost_currency.should == "AUD" + end + + it "should get attributes" do + XES::Event.new([XES.string("concept:name", "A")]).attributes.should == + [XES.string("concept:name", "A")] + end + + it "should format as XML" do + XES::Event.new([XES.string("concept:name", "A")]).format.to_s.should == + "" + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_extension.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_extension.rb new file mode 100644 index 000000000..3b3bc2ecb --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_extension.rb @@ -0,0 +1,34 @@ +require 'xes' + +describe "XES::Extension" do + it "should equal" do + XES::Extension.new("Concept", "concept", "http://www.xes-standard.org/concept.xesext").should == + XES::Extension.new("Concept", "concept", "http://www.xes-standard.org/concept.xesext") + end + + it "shoud not equal" do + XES::Extension.new("Concept", "concept", "http://www.xes-standard.org/concept.xesext").should != + XES::Extension.new("Identity", "identity", "http://www.xes-standard.org/identity.xesext") + end + + it "should get the name" do + XES::Extension.new("Concept", "concept", "http://www.xes-standard.org/concept.xesext").name.should == "Concept" + end + + it "should get the prefix" do + XES::Extension.new("Concept", "concept", "http://www.xes-standard.org/concept.xesext").prefix.should == "concept" + end + + it "should be formattable" do + XES::Extension.new("Concept", "concept", "http://www.xes-standard.org/concept.xesext").should.formattable + end + + it "should be not formattable" do + XES::Extension.new("Concept", "concept", nil).should.not.formattable + end + + it "should get the uri" do + XES::Extension.new("Concept", "concept", "http://www.xes-standard.org/concept.xesext").uri.should == + "http://www.xes-standard.org/concept.xesext" + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_global.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_global.rb new file mode 100644 index 000000000..3cb5795ed --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_global.rb @@ -0,0 +1,131 @@ +require 'xes' + +describe "XES::Global" do + it "should equal" do + XES::Global.event.should == XES::Global.event + end + + it "should not equal" do + XES::Global.event.should != XES::Global.trace + end + + it "should get the scope" do + XES::Global.event.scope.should == "event" + end + + it "should get the attributes" do + XES::Global.event.tap do |global| + global.attributes << XES.string("concept:name", "__INVALID__") + end.attributes.should == [XES.string("concept:name", "__INVALID__")] + end + + it "should set and get concept:name of event global" do + XES::Global.event.tap do |global| + global.concept_name = "A" + end.concept_name.should == "A" + end + + it "should set and get concept:instance of event global" do + XES::Global.event.tap do |global| + global.concept_instance = "A" + end.concept_instance.should == "A" + end + + it "should set and get lifecycle:transition of event global" do + XES::Global.event.tap do |global| + global.lifecycle_transition = "complete" + end.lifecycle_transition.should == "complete" + end + + it "should set and get org:resource of event global" do + XES::Global.event.tap do |global| + global.org_resource = "A" + end.org_resource.should == "A" + end + + it "should set and get org:role of event global" do + XES::Global.event.tap do |global| + global.org_role = "A" + end.org_role.should == "A" + end + + it "should set and get org:group of event global" do + XES::Global.event.tap do |global| + global.org_group = "A" + end.org_group.should == "A" + end + + it "should set and get time:timestamp of event global" do + Time.now.tap do |time| + XES::Global.event.tap do |global| + global.time_timestamp = time + end.time_timestamp.should == time + end + end + + it "should set and get semantic:modelReference of event global" do + XES::Global.event.tap do |global| + global.semantic_modelReference = "A" + end.semantic_modelReference.should == "A" + end + + it "should set and get identity:id of event global" do + XES::Global.event.tap do |global| + global.identity_id = "A" + end.identity_id.should == "A" + end + + it "should set and get cost:total of event global" do + XES::Global.event.tap do |global| + global.cost_total = 0.123 + end.cost_total.should == 0.123 + end + + it "should set and get cost:currency of event global" do + XES::Global.event.tap do |global| + global.cost_currency = "A" + end.cost_currency.should == "A" + end + + it "should set and get concept:name of trace global" do + XES::Global.trace.tap do |global| + global.concept_name = "A" + end.concept_name.should == "A" + end + + it "should set and get semantic:modelReference of trace global" do + XES::Global.trace.tap do |global| + global.semantic_modelReference = "A" + end.semantic_modelReference.should == "A" + end + + it "should set and get identity:id of trace global" do + XES::Global.trace.tap do |global| + global.identity_id = "A" + end.identity_id.should == "A" + end + + it "should set and get cost:total of trace global" do + XES::Global.trace.tap do |global| + global.cost_total = 0.123 + end.cost_total.should == 0.123 + end + + it "should set and get cost:currency of trace global" do + XES::Global.trace.tap do |global| + global.cost_currency = "A" + end.cost_currency.should == "A" + end + + it "should format event global as XML element" do + XES::Global.event.tap do |global| + global.concept_name = "A" + end.format.to_s.should == "" + end + + it "should format trace global as XML element" do + XES::Global.trace.tap do |global| + global.concept_name = "A" + end.format.to_s.should == "" + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_log.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_log.rb new file mode 100644 index 000000000..24c0d836a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_log.rb @@ -0,0 +1,90 @@ +require 'xes' + +describe "XES::Log" do + it "should equal" do + XES::Log.new.should == XES::Log.new + end + + it "should not equal" do + XES::Log.new.tap{|log| log.traces << XES::Trace.new}.should != XES::Log.new + end + + it "should set and get xes_version" do + XES::Log.new.tap{|log| log.xes_version = "1.1"}.xes_version.should == "1.1" + end + + it "should set and get xes_featuers" do + XES::Log.new.tap{|log| log.xes_features = ""}.xes_features.should == "" + end + + it "should set and get openxes_version" do + XES::Log.new.tap{|log| log.openxes_version = "1.9"}.openxes_version.should == "1.9" + end + + it "should set and get xmlns" do + XES::Log.new.tap{|log| log.xmlns = "test"}.xmlns.should == "test" + end + + it "should set and get extensions" do + XES::Log.new.tap do |log| + log.extensions << XES::EXTENSION[:semantic] + end.extensions.should.include(XES::EXTENSION[:semantic]) + end + + it "should set and get classifiers" do + XES::Log.new.tap do |log| + log.classifiers << XES::Classifier.new("test", "time:timestamp") + end.classifiers.should.include(XES::Classifier.new("test", "time:timestamp")) + end + + it "should set and get event_global" do + XES::Log.new.tap do |log| + log.event_global.concept_name = "__INVALID__" + end.event_global.attributes.should.include(XES.string("concept:name", "__INVALID__")) + end + + it "should set and get trace_global" do + XES::Log.new.tap do |log| + log.trace_global.concept_name = "__INVALID__" + end.trace_global.attributes.should.include(XES.string("concept:name", "__INVALID__")) + end + + it "should set and get attributes" do + XES::Log.new.tap do |log| + log.attributes << XES.string("concept:name", "test") + end.attributes.should.include(XES.string("concept:name", "test")) + end + + it "should set and get traces" do + XES::Log.new.tap do |log| + log.traces << XES::Trace.new + end.traces.should.include(XES::Trace.new) + end + + it "should be formattable" do + XES::Log.new.tap do |log| + log.traces << XES::Trace.new.tap do |trace| + trace.events << XES::Event.new.tap do |event| + event.attributes << XES.string("concept:name", "test") + end + end + end.should.formattable + end + + it "should be not formattable" do + XES::Log.new.tap do |log| + log.traces << XES::Trace.new + end.should.not.formattable + end + + it "should format as XML element" do + XES::Log.new.tap do |log| + log.traces << XES::Trace.new.tap do |trace| + trace.events << XES::Event.new.tap do |event| + event.attributes << XES.string("concept:name", "test") + end + end + end.format.to_s.should == + "" + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_trace.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_trace.rb new file mode 100644 index 000000000..d437340b4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/ruby-xes-0.1.0/test/spec_trace.rb @@ -0,0 +1,113 @@ +require 'xes' + +describe "XES::Trace" do + it "should equal" do + XES::Trace.new.tap do |x| + x.attributes << XES.string("concept:name", "A") + x.events << XES::Event.new([XES.string("concept:name", "B")]) + end.should == + XES::Trace.new.tap do |x| + x.attributes << XES.string("concept:name", "A") + x.events << XES::Event.new([XES.string("concept:name", "B")]) + end + end + + it "should not equal" do + XES::Trace.new.tap do |x| + x.attributes << XES.string("concept:name", "A") + x.events << XES::Event.new([XES.string("concept:name", "B")]) + end.should != + XES::Trace.new.tap do |x| + x.attributes << XES.string("concept:name", "A") + x.events << XES::Event.new([XES.string("concept:name", "C")]) + end + end + + it "should get attributes" do + XES::Trace.new.tap do |x| + x.attributes << XES.string("concept:name", "A") + x.events << XES::Event.new([XES.string("concept:name", "B")]) + end.attributes.should == [XES.string("concept:name", "A")] + end + + it "should get events" do + XES::Trace.new.tap do |x| + x.attributes << XES.string("concept:name", "A") + x.events << XES::Event.new([XES.string("concept:name", "B")]) + end.events.should == [XES::Event.new([XES.string("concept:name", "B")])] + end + + it "should get concept:name" do + XES::Trace.new.tap do |x| + x.attributes << XES.string("concept:name", "A") + end.concept_name.should == "A" + end + + it "should set concept:name" do + XES::Trace.new.tap{|x| x.concept_name = "A"}.concept_name.should == "A" + end + + it "should get semantic:modelReference" do + XES::Trace.new.tap do |x| + x.attributes << XES.string("semantic:modelReference", "A") + end.semantic_modelReference.should == "A" + end + + it "should set semantic:modelReference" do + XES::Trace.new.tap{|x| x.semantic_modelReference = "A"}.semantic_modelReference.should == "A" + end + + it "should get identity:id" do + XES::Trace.new.tap do |x| + x.attributes << XES.id("identity:id", "A") + end.identity_id.should == "A" + end + + it "should set identity:id" do + XES::Trace.new.tap{|x| x.identity_id = "A"}.identity_id.should == "A" + end + + it "should get cost:total" do + XES::Trace.new.tap do |x| + x.attributes << XES.float("cost:total", "A") + end.cost_total.should == "A" + end + + it "should set cost:total" do + XES::Trace.new.tap{|x| x.cost_total = "A"}.cost_total.should == "A" + end + + it "should get cost:currency" do + XES::Trace.new.tap do |x| + x.attributes << XES.string("cost:currency", "AUD") + end.cost_currency.should == "AUD" + end + + it "should set cost:currency" do + XES::Trace.new.tap{|x| x.cost_currency = "AUD"}.cost_currency.should == "AUD" + end + + it "should be formattable" do + XES::Trace.new.tap{|x| x.events << XES::Event.new([XES.string("concept:name", "B")])}.should.formattable + end + + it "should be not formattable when the trace have no events" do + XES::Trace.new.should.not.formattable + end + + it "should be not formattable when the trace have only invalid event" do + XES::Trace.new.tap{|x| x.events << XES::Event.new}.should.not.formattable + end + + it "should raise FormatError because the trace has no events" do + should.raise(XES::FormatError) do + XES::Trace.new.format + end + end + + it "should raise FormatError because events of the trace are invalid" do + should.raise(XES::FormatError) do + XES::Trace.new.tap{|x| x.events << XES::Event.new}.format + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/NEWS b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/NEWS new file mode 100644 index 000000000..b14fa9409 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/NEWS @@ -0,0 +1,182 @@ += Version 1.0.0 + +Changed the API for gem. Now it can be used without require param in Gemfile. +Added read-only support for Zip64 files. +Added support for setting Unicode file names. + += Version 0.9.9 + +Added support for backslashes in zip files (generated by the default Windows +zip packer for example) and comment sections with the comment length set to zero +even though there is actually a comment. + += Version 0.9.8 + +Fixed: "Unitialized constant NullInputStream" error + += Version 0.9.5 + +Removed support for loading ruby in zip files (ziprequire.rb). + += Version 0.9.4 + +Changed ZipOutputStream.put_next_entry signature (API CHANGE!). Now +allows comment, extra field and compression method to be specified. + += Version 0.9.3 + +Fixed: Added ZipEntry::name_encoding which retrieves the character +encoding of the name and comment of the entry. Also added convenience +methods ZipEntry::name_in(enc) and ZipEntry::comment_in(enc) for +getting zip entry names and comments in a specified character +encoding. + += Version 0.9.2 + +Fixed: Renaming an entry failed if the entry's new name was a +different length than its old name. (Diego Barros) + += Version 0.9.1 + +Added symlink support and support for unix file permissions. Reduced +memory usage during decompression. + +New methods ZipFile::[follow_symlinks, restore_times, restore_permissions, restore_ownership]. +New methods ZipEntry::unix_perms, ZipInputStream::eof?. +Added documentation and test for new ZipFile::extract. +Added some of the API suggestions from sf.net #1281314. +Applied patch for sf.net bug #1446926. +Applied patch for sf.net bug #1459902. +Rework ZipEntry and delegate classes. + += Version 0.5.12 + +Fixed problem with writing binary content to a ZipFile in MS Windows. + += Version 0.5.11 + +Fixed name clash file method copy_stream from fileutils.rb. Fixed +problem with references to constant CHUNK_SIZE. +ZipInputStream/AbstractInputStream read is now buffered like ruby IO's +read method, which means that read and gets etc can be mixed. The +unbuffered read method has been renamed to sysread. + += Version 0.5.10 + +Fixed method name resolution problem with FileUtils::copy_stream and +IOExtras::copy_stream. + += Version 0.5.9 + +Fixed serious memory consumption issue + += Version 0.5.8 + +Fixed install script. + += Version 0.5.7 + +install.rb no longer assumes it is being run from the toplevel source +dir. Directory structure changed to reflect common ruby library +project structure. Migrated from RubyUnit to Test::Unit format. Now +uses Rake to build source packages and gems and run unit tests. + += Version 0.5.6 + +Fix for FreeBSD 4.9 which returns Errno::EFBIG instead of +Errno::EINVAL for some invalid seeks. Fixed 'version needed to +extract'-field incorrect in local headers. + += Version 0.5.5 + +Fix for a problem with writing zip files that concerns only ruby 1.8.1. + += Version 0.5.4 + +Significantly reduced memory footprint when modifying zip files. + += Version 0.5.3 + +Added optimization to avoid decompressing and recompressing individual +entries when modifying a zip archive. + += Version 0.5.2 + +Fixed ZipFile corruption bug in ZipFile class. Added basic unix +extra-field support. + += Version 0.5.1 + +Fixed ZipFile.get_output_stream bug. + += Version 0.5.0 + +List of changes: +* Ruby 1.8.0 and ruby-zlib 0.6.0 compatibility +* Changed method names from camelCase to rubys underscore style. +* Installs to zip/ subdir instead of directly to site_ruby +* Added ZipFile.directory and ZipFile.file - each method return an +object that can be used like Dir and File only for the contents of the +zip file. +* Added sample application zipfind which works like Find.find, only +Zip::ZipFind.find traverses into zip archives too. + +Bug fixes: +* AbstractInputStream.each_line with non-default separator + + += Version 0.5.0a + +Source reorganized. Added ziprequire, which can be used to load ruby +modules from a zip file, in a fashion similar to jar files in +Java. Added gtkRubyzip, another sample application. Implemented +ZipInputStream.lineno and ZipInputStream.rewind + +Bug fixes: + +* Read and write date and time information correctly for zip entries. +* Fixed read() using separate buffer, causing mix of gets/readline/read to +cause problems. + += Version 0.4.2 + +Performance optimizations. Test suite runs in half the time. + += Version 0.4.1 + +Windows compatibility fixes. + += Version 0.4.0 + +Zip::ZipFile is now mutable and provides a more convenient way of +modifying zip archives than Zip::ZipOutputStream. Operations for +adding, extracting, renaming, replacing and removing entries to zip +archives are now available. + +Runs without warnings with -w switch. + +Install script install.rb added. + + += Version 0.3.1 + +Rudimentary support for writing zip archives. + + += Version 0.2.2 + +Fixed and extended unit test suite. Updated to work with ruby/zlib +0.5. It doesn't work with earlier versions of ruby/zlib. + + += Version 0.2.0 + +Class ZipFile added. Where ZipInputStream is used to read the +individual entries in a zip file, ZipFile reads the central directory +in the zip archive, so you can get to any entry in the zip archive +without having to skipping through all the preceeding entries. + + += Version 0.1.0 + +First working version of ZipInputStream. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/README.md b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/README.md new file mode 100644 index 000000000..9b0225b88 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/README.md @@ -0,0 +1,177 @@ +# rubyzip +[![Build Status](https://secure.travis-ci.org/rubyzip/rubyzip.png)](http://travis-ci.org/rubyzip/rubyzip) +[![Code Climate](https://codeclimate.com/github/rubyzip/rubyzip.png)](https://codeclimate.com/github/rubyzip/rubyzip) +[![Coverage Status](https://coveralls.io/repos/rubyzip/rubyzip/badge.png?branch=master)](https://coveralls.io/r/rubyzip/rubyzip?branch=master) + +rubyzip is a ruby library for reading and writing zip files. + +## Important note + +Rubyzip interface changed!!! No need to do `require "zip/zip"` and `Zip` prefix in class names removed. + +## Installation +rubyzip is available on RubyGems, so: + +``` +gem install rubyzip +``` + +Or in your Gemfile: + +```ruby +gem 'rubyzip' +``` + +## Usage + +### Basic zip archive creation + +```ruby +require 'rubygems' +require 'zip' + +folder = "Users/me/Desktop/stuff_to_zip" +input_filenames = ['image.jpg', 'description.txt', 'stats.csv'] + +zipfile_name = "/Users/me/Desktop/archive.zip" + +Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile| + input_filenames.each do |filename| + # Two arguments: + # - The name of the file as it will appear in the archive + # - The original file, including the path to find it + zipfile.add(filename, folder + '/' + filename) + end +end +``` + +### Zipping a directory recursively + +```ruby +require 'rubygems' +require 'zip' + +directory = '/Users/me/Desktop/directory_to_zip/' +zipfile_name = '/Users/me/Desktop/recursive_directory.zip' + +Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile| + Dir[File.join(directory, '**', '**')].each do |file| + zipfile.add(file.sub(directory, ''), file) + end +end +``` + +## Known issues + +### Modify docx file with rubyzip + +Use `write_buffer` instead `open`. Thanks to @jondruse + +```ruby +buffer = Zip::OutputStream.write_buffer do |out| + @zip_file.entries.each do |e| + unless [DOCUMENT_FILE_PATH, RELS_FILE_PATH].include?(e.name) + out.put_next_entry(e.name) + out.write e.get_input_stream.read + end + end + + out.put_next_entry(DOCUMENT_FILE_PATH) + out.write xml_doc.to_xml(:indent => 0).gsub("\n","") + + out.put_next_entry(RELS_FILE_PATH) + out.write rels.to_xml(:indent => 0).gsub("\n","") +end + +File.open(new_path, "w") {|f| f.write(buffer.string) } +``` + +## Further Documentation + +There is more than one way to access or create a zip archive with +rubyzip. The basic API is modeled after the classes in +java.util.zip from the Java SDK. This means there are classes such +as Zip::InputStream, Zip::OutputStream and +Zip::File. Zip::InputStream provides a basic interface for +iterating through the entries in a zip archive and reading from the +entries in the same way as from a regular File or IO +object. OutputStream is the corresponding basic output +facility. Zip::File provides a mean for accessing the archives +central directory and provides means for accessing any entry without +having to iterate through the archive. Unlike Java's +java.util.zip.ZipFile rubyzip's Zip::File is mutable, which means +it can be used to change zip files as well. + +Another way to access a zip archive with rubyzip is to use rubyzip's +Zip::FileSystem API. Using this API files can be read from and +written to the archive in much the same manner as ruby's builtin +classes allows files to be read from and written to the file system. + +For details about the specific behaviour of classes and methods refer +to the test suite. Finally you can generate the rdoc documentation or +visit http://rubyzip.sourceforge.net. + + +## Configuration + +By default, rubyzip will not overwrite files if they already exist inside of the extracted path. To change this behavior, you may specify a configuration option like so: + +```ruby +Zip.on_exists_proc = true +``` + +If you're using rubyzip with rails, consider placing this snippet of code in an initializer file such as `config/initializers/rubyzip.rb` + +Additionally, if you want to configure rubyzip to overwrite existing files while creating a .zip file, you can do so with the following: + +```ruby +Zip.continue_on_exists_proc = true +``` + +If you want to store non english names and want to open properly file on Windows(pre 7) you need to set next option: + +```ruby +Zip.unicode_names = true +``` + +All settings in same time + +```ruby + Zip.setup do |c| + c.on_exists_proc = true + c.continue_on_exists_proc = true + c.unicode_names = true + end +``` + +## Developing + +To run tests you need run next commands: + +``` +bundle install +rake +``` + +## Website and Project Home + +http://github.com/rubyzip/rubyzip + +http://rdoc.info/github/rubyzip/rubyzip/master/frames + +## Authors + +Alexander Simonov ( alex at simonov.me) + +Alan Harper ( alan at aussiegeek.net) + +Thomas Sondergaard (thomas at sondergaard.cc) + +Technorama Ltd. (oss-ruby-zip at technorama.net) + +extra-field support contributed by Tatsuki Sugiura (sugi at nemui.org) + +## License + +rubyzip is distributed under the same license as ruby. See +http://www.ruby-lang.org/en/LICENSE.txt diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/Rakefile new file mode 100644 index 000000000..ea3a4f603 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/Rakefile @@ -0,0 +1,13 @@ +require 'bundler/gem_tasks' +require 'rake/testtask' + +task :default => :test + +Rake::TestTask.new(:test) do |test| + test.libs << File.join(File.dirname(__FILE__), 'lib') + test.libs << File.join(File.dirname(__FILE__), 'test') + test.pattern = File.join(File.dirname(__FILE__), 'test/alltests.rb') + test.verbose = true + +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/TODO b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/TODO new file mode 100644 index 000000000..0e89e394f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/TODO @@ -0,0 +1,16 @@ + +* ZipInputStream: Support zip-files with trailing data descriptors +* Adjust rdoc stylesheet to advertise inherited methods if possible +* Suggestion: Add ZipFile/ZipInputStream example that demonstrates extracting all entries. +* Suggestion: ZipFile#extract destination should default to "." +* Suggestion: ZipEntry should have extract(), get_input_stream() methods etc +* Suggestion: ZipInputStream/ZipOutputStream should accept an IO object in addition to a filename. +* (is buffering used anywhere with write?) +* Inflater.sysread should pass the buffer to produce_input. +* Implement ZipFsDir.glob +* ZipFile.checkIntegrity method +* non-MSDOS permission attributes +** See mail from Ned Konz to ruby-talk subj. "Re: SV: [ANN] Archive 0.2" +* Packager version, required unpacker version in zip headers +** See mail from Ned Konz to ruby-talk subj. "Re: SV: [ANN] Archive 0.2" +* implement storing attributes and ownership information diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip.rb new file mode 100644 index 000000000..c9d3358a9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip.rb @@ -0,0 +1,52 @@ +require 'delegate' +require 'singleton' +require 'tempfile' +require 'fileutils' +require 'stringio' +require 'zlib' +require 'zip/dos_time' +require 'zip/ioextras' +require 'rbconfig' +require 'zip/entry' +require 'zip/extra_field' +require 'zip/entry_set' +require 'zip/central_directory' +require 'zip/file' +require 'zip/input_stream' +require 'zip/output_stream' +require 'zip/decompressor' +require 'zip/compressor' +require 'zip/null_decompressor' +require 'zip/null_compressor' +require 'zip/null_input_stream' +require 'zip/pass_thru_compressor' +require 'zip/pass_thru_decompressor' +require 'zip/inflater' +require 'zip/deflater' +require 'zip/streamable_stream' +require 'zip/streamable_directory' +require 'zip/constants' +require 'zip/errors' + +module Zip + extend self + attr_accessor :unicode_names, :on_exists_proc, :continue_on_exists_proc + + def reset! + @_ran_once = false + @unicode_names = false + @on_exists_proc = false + @continue_on_exists_proc = false + end + + def setup + yield self unless @_ran_once + @_ran_once = true + end + + reset! +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/central_directory.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/central_directory.rb new file mode 100755 index 000000000..9ce0d04f0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/central_directory.rb @@ -0,0 +1,177 @@ +module Zip + class CentralDirectory + include Enumerable + + END_OF_CDS = 0x06054b50 + ZIP64_END_OF_CDS = 0x06064b50 + ZIP64_EOCD_LOCATOR = 0x07064b50 + MAX_END_OF_CDS_SIZE = 65536 + 18 + STATIC_EOCD_SIZE = 22 + + attr_reader :comment + + # Returns an Enumerable containing the entries. + def entries + @entry_set.entries + end + + def initialize(entries = EntrySet.new, comment = '') #:nodoc: + super() + @entry_set = entries.kind_of?(EntrySet) ? entries : EntrySet.new(entries) + @comment = comment + end + + def write_to_stream(io) #:nodoc: + offset = io.tell + @entry_set.each { |entry| entry.write_c_dir_entry(io) } + write_e_o_c_d(io, offset) + end + + def write_e_o_c_d(io, offset) #:nodoc: + tmp = [ + END_OF_CDS, + 0, # @numberOfThisDisk + 0, # @numberOfDiskWithStartOfCDir + @entry_set ? @entry_set.size : 0, + @entry_set ? @entry_set.size : 0, + cdir_size, + offset, + @comment ? @comment.length : 0 + ] + io << tmp.pack('VvvvvVVv') + io << @comment + end + + private :write_e_o_c_d + + def cdir_size #:nodoc: + # does not include eocd + @entry_set.inject(0) do |value, entry| + entry.cdir_header_size + value + end + end + + private :cdir_size + + def read_64_e_o_c_d(buf) #:nodoc: + buf = get_64_e_o_c_d(buf) + @size_of_zip64_e_o_c_d = Entry.read_zip_64_long(buf) + @version_made_by = Entry.read_zip_short(buf) + @version_needed_for_extract = Entry.read_zip_short(buf) + @number_of_this_disk = Entry.read_zip_long(buf) + @number_of_disk_with_start_of_cdir = Entry.read_zip_long(buf) + @total_number_of_entries_in_cdir_on_this_disk = Entry.read_zip_64_long(buf) + @size = Entry.read_zip_64_long(buf) + @size_in_bytes = Entry.read_zip_64_long(buf) + @cdir_offset = Entry.read_zip_64_long(buf) + @zip_64_extensible = buf.slice!(0, buf.bytesize) + raise ZipError, "Zip consistency problem while reading eocd structure" unless buf.size == 0 + end + + def read_e_o_c_d(buf) #:nodoc: + buf = get_e_o_c_d(buf) + @number_of_this_disk = Entry.read_zip_short(buf) + @number_of_disk_with_start_of_cdir = Entry.read_zip_short(buf) + @total_number_of_entries_in_cdir_on_this_disk = Entry.read_zip_short(buf) + @size = Entry.read_zip_short(buf) + @size_in_bytes = Entry.read_zip_long(buf) + @cdir_offset = Entry.read_zip_long(buf) + comment_length = Entry.read_zip_short(buf) + @comment = if comment_length <= 0 + buf.slice!(0, buf.size) + else + buf.read(comment_length) + end + raise ZipError, "Zip consistency problem while reading eocd structure" unless buf.size == 0 + end + + def read_central_directory_entries(io) #:nodoc: + begin + io.seek(@cdir_offset, IO::SEEK_SET) + rescue Errno::EINVAL + raise ZipError, "Zip consistency problem while reading central directory entry" + end + @entry_set = EntrySet.new + @size.times do + @entry_set << Entry.read_c_dir_entry(io) + end + end + + def read_from_stream(io) #:nodoc: + buf = start_buf(io) + if self.zip64_file?(buf) + read_64_e_o_c_d(buf) + else + read_e_o_c_d(buf) + end + read_central_directory_entries(io) + end + + def get_e_o_c_d(buf) #:nodoc: + sig_index = buf.rindex([END_OF_CDS].pack('V')) + raise ZipError, "Zip end of central directory signature not found" unless sig_index + buf = buf.slice!((sig_index + 4)..(buf.bytesize)) + + def buf.read(count) + slice!(0, count) + end + + buf + end + + def zip64_file?(buf) + buf.rindex([ZIP64_END_OF_CDS].pack('V')) && buf.rindex([ZIP64_EOCD_LOCATOR].pack('V')) + end + + def start_buf(io) + begin + io.seek(-MAX_END_OF_CDS_SIZE, IO::SEEK_END) + rescue Errno::EINVAL + io.seek(0, IO::SEEK_SET) + end + io.read + end + + def get_64_e_o_c_d(buf) #:nodoc: + zip_64_start = buf.rindex([ZIP64_END_OF_CDS].pack('V')) + raise ZipError, "Zip64 end of central directory signature not found" unless zip_64_start + zip_64_locator = buf.rindex([ZIP64_EOCD_LOCATOR].pack('V')) + raise ZipError, "Zip64 end of central directory signature locator not found" unless zip_64_locator + buf = buf.slice!((zip_64_start + 4)..zip_64_locator) + + def buf.read(count) + slice!(0, count) + end + + buf + end + + # For iterating over the entries. + def each(&proc) + @entry_set.each(&proc) + end + + # Returns the number of entries in the central directory (and + # consequently in the zip archive). + def size + @entry_set.size + end + + def self.read_from_stream(io) #:nodoc: + cdir = new + cdir.read_from_stream(io) + return cdir + rescue ZipError + return nil + end + + def ==(other) #:nodoc: + return false unless other.kind_of?(CentralDirectory) + @entry_set.entries.sort == other.entries.sort && comment == other.comment + end + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/compressor.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/compressor.rb new file mode 100755 index 000000000..ce2b847fc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/compressor.rb @@ -0,0 +1,10 @@ +module Zip + class Compressor #:nodoc:all + def finish + end + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/constants.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/constants.rb new file mode 100644 index 000000000..721e19d86 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/constants.rb @@ -0,0 +1,61 @@ +module Zip + RUNNING_ON_WINDOWS = RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/i + + CENTRAL_DIRECTORY_ENTRY_SIGNATURE = 0x02014b50 + CDIR_ENTRY_STATIC_HEADER_LENGTH = 46 + + LOCAL_ENTRY_SIGNATURE = 0x04034b50 + LOCAL_ENTRY_STATIC_HEADER_LENGTH = 30 + LOCAL_ENTRY_TRAILING_DESCRIPTOR_LENGTH = 4+4+4 + VERSION_NEEDED_TO_EXTRACT = 20 + + FILE_TYPE_FILE = 010 + FILE_TYPE_DIR = 004 + FILE_TYPE_SYMLINK = 012 + + FSTYPE_FAT = 0 + FSTYPE_AMIGA = 1 + FSTYPE_VMS = 2 + FSTYPE_UNIX = 3 + FSTYPE_VM_CMS = 4 + FSTYPE_ATARI = 5 + FSTYPE_HPFS = 6 + FSTYPE_MAC = 7 + FSTYPE_Z_SYSTEM = 8 + FSTYPE_CPM = 9 + FSTYPE_TOPS20 = 10 + FSTYPE_NTFS = 11 + FSTYPE_QDOS = 12 + FSTYPE_ACORN = 13 + FSTYPE_VFAT = 14 + FSTYPE_MVS = 15 + FSTYPE_BEOS = 16 + FSTYPE_TANDEM = 17 + FSTYPE_THEOS = 18 + FSTYPE_MAC_OSX = 19 + FSTYPE_ATHEOS = 30 + + FSTYPES = { + FSTYPE_FAT => 'FAT'.freeze, + FSTYPE_AMIGA => 'Amiga'.freeze, + FSTYPE_VMS => 'VMS (Vax or Alpha AXP)'.freeze, + FSTYPE_UNIX => 'Unix'.freeze, + FSTYPE_VM_CMS => 'VM/CMS'.freeze, + FSTYPE_ATARI => 'Atari ST'.freeze, + FSTYPE_HPFS => 'OS/2 or NT HPFS'.freeze, + FSTYPE_MAC => 'Macintosh'.freeze, + FSTYPE_Z_SYSTEM => 'Z-System'.freeze, + FSTYPE_CPM => 'CP/M'.freeze, + FSTYPE_TOPS20 => 'TOPS-20'.freeze, + FSTYPE_NTFS => 'NTFS'.freeze, + FSTYPE_QDOS => 'SMS/QDOS'.freeze, + FSTYPE_ACORN => 'Acorn RISC OS'.freeze, + FSTYPE_VFAT => 'Win32 VFAT'.freeze, + FSTYPE_MVS => 'MVS'.freeze, + FSTYPE_BEOS => 'BeOS'.freeze, + FSTYPE_TANDEM => 'Tandem NSK'.freeze, + FSTYPE_THEOS => 'Theos'.freeze, + FSTYPE_MAC_OSX => 'Mac OS/X (Darwin)'.freeze, + FSTYPE_ATHEOS => 'AtheOS'.freeze, + }.freeze +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/decompressor.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/decompressor.rb new file mode 100755 index 000000000..4851436b5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/decompressor.rb @@ -0,0 +1,13 @@ +module Zip + class Decompressor #:nodoc:all + CHUNK_SIZE = 32768 + def initialize(input_stream) + super() + @input_stream=input_stream + end + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/deflater.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/deflater.rb new file mode 100755 index 000000000..01e923bbc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/deflater.rb @@ -0,0 +1,29 @@ +module Zip + class Deflater < Compressor #:nodoc:all + + def initialize(output_stream, level = ::Zlib::DEFAULT_COMPRESSION) + super() + @output_stream = output_stream + @zlib_deflater = ::Zlib::Deflate.new(level, -::Zlib::MAX_WBITS) + @size = 0 + @crc = ::Zlib.crc32 + end + + def << (data) + val = data.to_s + @crc = Zlib::crc32(val, @crc) + @size += val.bytesize + @output_stream << @zlib_deflater.deflate(data) + end + + def finish + @output_stream << @zlib_deflater.finish until @zlib_deflater.finished? + end + + attr_reader :size, :crc + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/dos_time.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/dos_time.rb new file mode 100755 index 000000000..fb36cb824 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/dos_time.rb @@ -0,0 +1,49 @@ +module Zip + class DOSTime < Time #:nodoc:all + + #MS-DOS File Date and Time format as used in Interrupt 21H Function 57H: + + # Register CX, the Time: + # Bits 0-4 2 second increments (0-29) + # Bits 5-10 minutes (0-59) + # bits 11-15 hours (0-24) + + # Register DX, the Date: + # Bits 0-4 day (1-31) + # bits 5-8 month (1-12) + # bits 9-15 year (four digit year minus 1980) + + def to_binary_dos_time + (sec/2) + + (min << 5) + + (hour << 11) + end + + def to_binary_dos_date + (day) + + (month << 5) + + ((year - 1980) << 9) + end + + # Dos time is only stored with two seconds accuracy + def dos_equals(other) + to_i/2 == other.to_i/2 + end + + def self.parse_binary_dos_format(binaryDosDate, binaryDosTime) + second = 2 * (0b11111 & binaryDosTime) + minute = (0b11111100000 & binaryDosTime) >> 5 + hour = (0b1111100000000000 & binaryDosTime) >> 11 + day = (0b11111 & binaryDosDate) + month = (0b111100000 & binaryDosDate) >> 5 + year = ((0b1111111000000000 & binaryDosDate) >> 9) + 1980 + begin + self.local(year, month, day, hour, minute, second) + end + end + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/entry.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/entry.rb new file mode 100755 index 000000000..d6d42ffc3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/entry.rb @@ -0,0 +1,622 @@ +module Zip + class Entry + STORED = 0 + DEFLATED = 8 + # Language encoding flag (EFS) bit + EFS = 0b100000000000 + + attr_accessor :comment, :compressed_size, :crc, :extra, :compression_method, + :name, :size, :local_header_offset, :zipfile, :fstype, :external_file_attributes, + :gp_flags, :header_signature, :follow_symlinks, + :restore_times, :restore_permissions, :restore_ownership, + :unix_uid, :unix_gid, :unix_perms, + :dirty + attr_reader :ftype, :filepath # :nodoc: + + def set_default_vars_values + @local_header_offset = 0 + @local_header_size = 0 + @internal_file_attributes = 1 + @external_file_attributes = 0 + @header_signature = ::Zip::CENTRAL_DIRECTORY_ENTRY_SIGNATURE + + @version_needed_to_extract = VERSION_NEEDED_TO_EXTRACT + @version = 52 # this library's version + + @ftype = nil # unspecified or unknown + @filepath = nil + @gp_flags = 0 + if ::Zip.unicode_names + @gp_flags |= EFS + @version = 63 + end + @follow_symlinks = false + + @restore_times = true + @restore_permissions = false + @restore_ownership = false + # BUG: need an extra field to support uid/gid's + @unix_uid = nil + @unix_gid = nil + @unix_perms = nil + #@posix_acl = nil + #@ntfs_acl = nil + @dirty = false + end + + def check_name(name) + if name.start_with?('/') + raise ::Zip::ZipEntryNameError, "Illegal ZipEntry name '#{name}', name must not start with /" + end + end + + def initialize(*args) + name = args[1] || '' + check_name(name) + + set_default_vars_values + @fstype = ::Zip::RUNNING_ON_WINDOWS ? ::Zip::FSTYPE_FAT : ::Zip::FSTYPE_UNIX + + @zipfile = args[0] || '' + @name = name + @comment = args[2] || '' + @extra = args[3] || '' + @compressed_size = args[4] || 0 + @crc = args[5] || 0 + @compression_method = args[6] || ::Zip::Entry::DEFLATED + @size = args[7] || 0 + @time = args[8] || ::Zip::DOSTime.now + + @ftype = name_is_directory? ? :directory : :file + @extra = ::Zip::ExtraField.new(@extra.to_s) unless ::Zip::ExtraField === @extra + end + + def time + if @extra['UniversalTime'] + @extra['UniversalTime'].mtime + else + # Standard time field in central directory has local time + # under archive creator. Then, we can't get timezone. + @time + end + end + + alias :mtime :time + + def time=(value) + unless @extra.member?('UniversalTime') + @extra.create('UniversalTime') + end + @extra['UniversalTime'].mtime = value + @time = value + end + + def file_type_is?(type) + raise ZipInternalError, "current filetype is unknown: #{self.inspect}" unless @ftype + @ftype == type + end + + # Dynamic checkers + %w(directory file symlink).each do |k| + define_method "#{k}?" do + file_type_is?(k.to_sym) + end + end + + def name_is_directory? #:nodoc:all + @name.end_with?('/') + end + + def local_entry_offset #:nodoc:all + local_header_offset + @local_header_size + end + + def name_size + @name ? @name.bytesize : 0 + end + + def extra_size + @extra ? @extra.local_size : 0 + end + + def comment_size + @comment ? @comment.bytesize : 0 + end + + def calculate_local_header_size #:nodoc:all + fix_zip64_sizes! + LOCAL_ENTRY_STATIC_HEADER_LENGTH + name_size + extra_size + end + + def cdir_header_size #:nodoc:all + CDIR_ENTRY_STATIC_HEADER_LENGTH + name_size + + (@extra ? @extra.c_dir_size : 0) + comment_size + end + + def next_header_offset #:nodoc:all + local_entry_offset + self.compressed_size + end + + # Extracts entry to file dest_path (defaults to @name). + def extract(dest_path = @name, &block) + block ||= proc { ::Zip.on_exists_proc } + + if directory? || file? || symlink? + self.__send__("create_#{@ftype}", dest_path, &block) + else + raise RuntimeError, "unknown file type #{self.inspect}" + end + + self + end + + def to_s + @name + end + + protected + + class << self + def read_zip_short(io) # :nodoc: + io.read(2).unpack('v')[0] + end + + def read_zip_long(io) # :nodoc: + io.read(4).unpack('V')[0] + end + + def read_zip_64_long(io) # :nodoc: + io.read(8).unpack('V')[0] + end + + def read_c_dir_entry(io) #:nodoc:all + entry = new(io.path) + entry.read_c_dir_entry(io) + entry + rescue ZipError + nil + end + + def read_local_entry(io) + entry = new(io.path) + entry.read_local_entry(io) + entry + rescue ZipError + nil + end + + end + + public + + def unpack_local_entry(buf) + @header_signature, + @version, + @fstype, + @gp_flags, + @compression_method, + @last_mod_time, + @last_mod_date, + @crc, + @compressed_size, + @size, + @name_length, + @extra_length = buf.unpack('VCCvvvvVVVvv') + end + + def read_local_entry(io) #:nodoc:all + @local_header_offset = io.tell + + static_sized_fields_buf = io.read(::Zip::LOCAL_ENTRY_STATIC_HEADER_LENGTH) + + unless static_sized_fields_buf.bytesize == ::Zip::LOCAL_ENTRY_STATIC_HEADER_LENGTH + raise ZipError, "Premature end of file. Not enough data for zip entry local header" + end + + unpack_local_entry(static_sized_fields_buf) + + unless @header_signature == ::Zip::LOCAL_ENTRY_SIGNATURE + raise ::Zip::ZipError, "Zip local header magic not found at location '#{local_header_offset}'" + end + set_time(@last_mod_date, @last_mod_time) + + @name = io.read(@name_length) + extra = io.read(@extra_length) + + @name.gsub!('\\', '/') + + if extra && extra.bytesize != @extra_length + raise ::Zip::ZipError, "Truncated local zip entry header" + else + if ::Zip::ExtraField === @extra + @extra.merge(extra) + else + @extra = ::Zip::ExtraField.new(extra) + end + end + @local_header_size = calculate_local_header_size + end + + def pack_local_entry + [::Zip::LOCAL_ENTRY_SIGNATURE, + @version_needed_to_extract, # version needed to extract + @gp_flags, # @gp_flags , + @compression_method, + @time.to_binary_dos_time, # @last_mod_time , + @time.to_binary_dos_date, # @last_mod_date , + @crc, + @compressed_size, + @size, + name_size, + @extra ? @extra.local_size : 0].pack('VvvvvvVVVvv') + end + + def write_local_entry(io) #:nodoc:all + @local_header_offset = io.tell + + io << pack_local_entry + + io << @name + io << (@extra ? @extra.to_local_bin : '') + end + + def unpack_c_dir_entry(buf) + @header_signature, + @version, # version of encoding software + @fstype, # filesystem type + @version_needed_to_extract, + @gp_flags, + @compression_method, + @last_mod_time, + @last_mod_date, + @crc, + @compressed_size, + @size, + @name_length, + @extra_length, + @comment_length, + _, # diskNumberStart + @internal_file_attributes, + @external_file_attributes, + @local_header_offset, + @name, + @extra, + @comment = buf.unpack('VCCvvvvvVVVvvvvvVV') + end + + def set_ftype_from_c_dir_entry + @ftype = case @fstype + when ::Zip::FSTYPE_UNIX + @unix_perms = (@external_file_attributes >> 16) & 07777 + case (@external_file_attributes >> 28) + when ::Zip::FILE_TYPE_DIR + :directory + when ::Zip::FILE_TYPE_FILE + :file + when ::Zip::FILE_TYPE_SYMLINK + :symlink + else + #best case guess for whether it is a file or not + #Otherwise this would be set to unknown and that entry would never be able to extracted + if name_is_directory? + :directory + else + :file + end + end + else + if name_is_directory? + :directory + else + :file + end + end + end + + def check_c_dir_entry_static_header_length(buf) + unless buf.bytesize == ::Zip::CDIR_ENTRY_STATIC_HEADER_LENGTH + raise ZipError, 'Premature end of file. Not enough data for zip cdir entry header' + end + end + + def check_c_dir_entry_signature + unless header_signature == ::Zip::CENTRAL_DIRECTORY_ENTRY_SIGNATURE + raise ZipError, "Zip local header magic not found at location '#{local_header_offset}'" + end + end + + def check_c_dir_entry_comment_size + unless @comment && @comment.bytesize == @comment_length + raise ::Zip::ZipError, "Truncated cdir zip entry header" + end + end + + def read_c_dir_extra_field(io) + if @extra.is_a?(::Zip::ExtraField) + @extra.merge(io.read(@extra_length)) + else + @extra = ::Zip::ExtraField.new(io.read(@extra_length)) + end + end + + def read_c_dir_entry(io) #:nodoc:all + static_sized_fields_buf = io.read(::Zip::CDIR_ENTRY_STATIC_HEADER_LENGTH) + check_c_dir_entry_static_header_length(static_sized_fields_buf) + unpack_c_dir_entry(static_sized_fields_buf) + check_c_dir_entry_signature + set_time(@last_mod_date, @last_mod_time) + @name = io.read(@name_length).gsub('\\', '/') + read_c_dir_extra_field(io) + @comment = io.read(@comment_length) + check_c_dir_entry_comment_size + set_ftype_from_c_dir_entry + @local_header_size = calculate_local_header_size + end + + def file_stat(path) # :nodoc: + if @follow_symlinks + ::File::stat(path) + else + ::File::lstat(path) + end + end + + def get_extra_attributes_from_path(path) # :nodoc: + unless Zip::RUNNING_ON_WINDOWS + stat = file_stat(path) + @unix_uid = stat.uid + @unix_gid = stat.gid + @unix_perms = stat.mode & 07777 + end + end + + def set_unix_permissions_on_path(dest_path) + # BUG: does not update timestamps into account + # ignore setuid/setgid bits by default. honor if @restore_ownership + unix_perms_mask = 01777 + unix_perms_mask = 07777 if @restore_ownership + ::FileUtils.chmod(@unix_perms & unix_perms_mask, dest_path) if @restore_permissions && @unix_perms + ::FileUtils.chown(@unix_uid, @unix_gid, dest_path) if @restore_ownership && @unix_uid && @unix_gid && ::Process.egid == 0 + # File::utimes() + end + + def set_extra_attributes_on_path(dest_path) # :nodoc: + return unless (file? || directory?) + + case @fstype + when ::Zip::FSTYPE_UNIX + set_unix_permissions_on_path(dest_path) + end + end + + def pack_c_dir_entry + [ + @header_signature, + @version, # version of encoding software + @fstype, # filesystem type + @version_needed_to_extract, # @versionNeededToExtract , + @gp_flags, # @gp_flags , + @compression_method, + @time.to_binary_dos_time, # @last_mod_time , + @time.to_binary_dos_date, # @last_mod_date , + @crc, + @compressed_size, + @size, + name_size, + @extra ? @extra.c_dir_size : 0, + comment_size, + 0, # disk number start + @internal_file_attributes, # file type (binary=0, text=1) + @external_file_attributes, # native filesystem attributes + @local_header_offset, + @name, + @extra, + @comment + ].pack('VCCvvvvvVVVvvvvvVV') + end + + def write_c_dir_entry(io) #:nodoc:all + case @fstype + when ::Zip::FSTYPE_UNIX + ft = case @ftype + when :file + @unix_perms ||= 0644 + ::Zip::FILE_TYPE_FILE + when :directory + @unix_perms ||= 0755 + ::Zip::FILE_TYPE_DIR + when :symlink + @unix_perms ||= 0755 + ::Zip::FILE_TYPE_SYMLINK + end + + unless ft.nil? + @external_file_attributes = (ft << 12 | (@unix_perms & 07777)) << 16 + end + end + + io << pack_c_dir_entry + + io << @name + io << (@extra ? @extra.to_c_dir_bin : '') + io << @comment + end + + def ==(other) + return false unless other.class == self.class + # Compares contents of local entry and exposed fields + keys_equal = %w(compression_method crc compressed_size size name extra filepath).all? do |k| + other.__send__(k.to_sym) == self.__send__(k.to_sym) + end + keys_equal && self.time.dos_equals(other.time) + end + + def <=> (other) + self.to_s <=> other.to_s + end + + # Returns an IO like object for the given ZipEntry. + # Warning: may behave weird with symlinks. + def get_input_stream(&block) + if @ftype == :directory + yield(::Zip::NullInputStream.instance) if block_given? + ::Zip::NullInputStream.instance + elsif @filepath + case @ftype + when :file + ::File.open(@filepath, 'rb', &block) + when :symlink + linkpath = ::File.readlink(@filepath) + stringio = ::StringIO.new(linkpath) + yield(stringio) if block_given? + stringio + else + raise "unknown @file_type #{@ftype}" + end + else + zis = ::Zip::InputStream.new(@zipfile, local_header_offset) + zis.get_next_entry + if block_given? + begin + yield(zis) + ensure + zis.close + end + else + zis + end + end + end + + def gather_fileinfo_from_srcpath(src_path) # :nodoc: + stat = file_stat(src_path) + @ftype = case stat.ftype + when 'file' + if name_is_directory? + raise ArgumentError, + "entry name '#{newEntry}' indicates directory entry, but "+ + "'#{src_path}' is not a directory" + end + :file + when 'directory' + @name += "/" unless name_is_directory? + :directory + when 'link' + if name_is_directory? + raise ArgumentError, + "entry name '#{newEntry}' indicates directory entry, but "+ + "'#{src_path}' is not a directory" + end + :symlink + else + raise RuntimeError, "unknown file type: #{src_path.inspect} #{stat.inspect}" + end + + @filepath = src_path + get_extra_attributes_from_path(@filepath) + end + + def write_to_zip_output_stream(zip_output_stream) #:nodoc:all + if @ftype == :directory + zip_output_stream.put_next_entry(self) + elsif @filepath + zip_output_stream.put_next_entry(self, nil, nil, nil) + get_input_stream { |is| ::Zip::IOExtras.copy_stream(zip_output_stream, is) } + else + zip_output_stream.copy_raw_entry(self) + end + end + + def parent_as_string + entry_name = name.chomp('/') + slash_index = entry_name.rindex('/') + slash_index ? entry_name.slice(0, slash_index+1) : nil + end + + def get_raw_input_stream(&block) + ::File.open(@zipfile, "rb", &block) + end + + private + + def set_time(binary_dos_date, binary_dos_time) + @time = ::Zip::DOSTime.parse_binary_dos_format(binary_dos_date, binary_dos_time) + rescue ArgumentError + puts "Invalid date/time in zip entry" + end + + def create_file(dest_path, continue_on_exists_proc = proc { Zip.continue_on_exists_proc }) + if ::File.exists?(dest_path) && !yield(self, dest_path) + raise ::Zip::ZipDestinationFileExistsError, + "Destination '#{dest_path}' already exists" + end + ::File.open(dest_path, "wb") do |os| + get_input_stream do |is| + set_extra_attributes_on_path(dest_path) + + buf = '' + while buf = is.sysread(::Zip::Decompressor::CHUNK_SIZE, buf) + os << buf + end + end + end + end + + def create_directory(dest_path) + return if ::File.directory?(dest_path) + if ::File.exists?(dest_path) + if block_given? && yield(self, dest_path) + ::FileUtils::rm_f dest_path + else + raise ::Zip::ZipDestinationFileExistsError, + "Cannot create directory '#{dest_path}'. "+ + "A file already exists with that name" + end + end + ::FileUtils.mkdir_p(dest_path) + set_extra_attributes_on_path(dest_path) + end + + # BUG: create_symlink() does not use &block + def create_symlink(dest_path) + stat = nil + begin + stat = ::File.lstat(dest_path) + rescue Errno::ENOENT + end + + io = get_input_stream + linkto = io.read + + if stat + if stat.symlink? + if ::File.readlink(dest_path) == linkto + return + else + raise ZipDestinationFileExistsError, + "Cannot create symlink '#{dest_path}'. "+ + "A symlink already exists with that name" + end + else + raise ZipDestinationFileExistsError, + "Cannot create symlink '#{dest_path}'. "+ + "A file already exists with that name" + end + end + + ::File.symlink(linkto, dest_path) + end + + def fix_zip64_sizes! #:nodoc:all + if zip64 = @extra["Zip64"] + @size = zip64.original_size + @compressed_size = zip64.compressed_size + end + end + + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/entry_set.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/entry_set.rb new file mode 100755 index 000000000..c0520443b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/entry_set.rb @@ -0,0 +1,86 @@ +module Zip + class EntrySet #:nodoc:all + include Enumerable + attr_accessor :entry_set, :entry_order + + def initialize(an_enumerable = []) + super() + @entry_set = {} + @entry_order = [] + an_enumerable.each { |o| push(o) } + end + + def include?(entry) + @entry_set.include?(to_key(entry)) + end + + def find_entry(entry) + @entry_set[to_key(entry)] + end + + def <<(entry) + @entry_order.delete(to_key(entry)) + @entry_order << to_key(entry) + @entry_set[to_key(entry)] = entry + end + + alias :push :<< + + def size + @entry_set.size + end + + alias :length :size + + def delete(entry) + if @entry_order.delete(to_key(entry)) && @entry_set.delete(to_key(entry)) + entry + else + nil + end + end + + def each(&block) + @entry_order.each do |key| + block.call @entry_set[key] + end + end + + def entries + @entry_order.map { |key| @entry_set[key] } + end + + # deep clone + def dup + EntrySet.new(@entry_order.map { |key| @entry_set[key].dup }) + end + + def ==(other) + return false unless other.kind_of?(EntrySet) + @entry_set == other.entry_set && @entry_order == other.entry_order + end + + def parent(entry) + @entry_set[to_key(entry.parent_as_string)] + end + + def glob(pattern, flags = ::File::FNM_PATHNAME|::File::FNM_DOTMATCH) + entries.map do |entry| + next nil unless ::File.fnmatch(pattern, entry.name.chomp('/'), flags) + yield(entry) if block_given? + entry + end.compact + end + + protected + + private + def to_key(entry) + entry.to_s.sub(/\/$/, '') + end + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/errors.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/errors.rb new file mode 100644 index 000000000..7043ee95d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/errors.rb @@ -0,0 +1,8 @@ +module Zip + class ZipError < StandardError; end + class ZipEntryExistsError < ZipError; end + class ZipDestinationFileExistsError < ZipError; end + class ZipCompressionMethodError < ZipError; end + class ZipEntryNameError < ZipError; end + class ZipInternalError < ZipError; end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/extra_field.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/extra_field.rb new file mode 100755 index 000000000..4cb26b0f4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/extra_field.rb @@ -0,0 +1,89 @@ +module Zip + class ExtraField < Hash + ID_MAP = {} + + def initialize(binstr = nil) + binstr and merge(binstr) + end + + def extra_field_type_exist(binstr, id, len, i) + field_name = ID_MAP[id].name + if self.member?(field_name) + self[field_name].merge(binstr[i, len + 4]) + else + field_obj = ID_MAP[id].new(binstr[i, len + 4]) + self[field_name] = field_obj + end + end + + def extra_field_type_unknown(binstr, len, i) + create_unknown_item unless self['Unknown'] + if !len || len + 4 > binstr[i..-1].bytesize + self['Unknown'] << binstr[i..-1] + return + end + self['Unknown'] << binstr[i, len + 4] + end + + def create_unknown_item + s = '' + class << s + alias_method :to_c_dir_bin, :to_s + alias_method :to_local_bin, :to_s + end + self['Unknown'] = s + end + + def merge(binstr) + return if binstr.empty? + i = 0 + while i < binstr.bytesize + id = binstr[i, 2] + len = binstr[i + 2, 2].to_s.unpack('v').first + if id && ID_MAP.member?(id) + extra_field_type_exist(binstr, id, len, i) + elsif id + create_unknown_item unless self['Unknown'] + break unless extra_field_type_unknown(binstr, len, i) + end + i += len + 4 + end + end + + def create(name) + unless field_class = ID_MAP.values.find { |k| k.name == name } + raise ZipError, "Unknown extra field '#{name}'" + end + self[name] = field_class.new + end + + def to_local_bin + self.map { |_, v| v.to_local_bin }.join + end + + alias :to_s :to_local_bin + + def to_c_dir_bin + self.map { |_, v| v.to_c_dir_bin }.join + end + + def c_dir_size + to_c_dir_bin.bytesize + end + + def local_size + to_local_bin.bytesize + end + + alias :length :local_size + alias :size :local_size + end +end + +require 'zip/extra_field/generic' +require 'zip/extra_field/universal_time' +require 'zip/extra_field/unix' + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/extra_field/generic.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/extra_field/generic.rb new file mode 100644 index 000000000..be5354488 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/extra_field/generic.rb @@ -0,0 +1,43 @@ +module Zip + class ExtraField::Generic + def self.register_map + if self.const_defined?(:HEADER_ID) + ::Zip::ExtraField::ID_MAP[self.const_get(:HEADER_ID)] = self + end + end + + def self.name + self.to_s.split("::")[-1] + end + + # return field [size, content] or false + def initial_parse(binstr) + if !binstr + # If nil, start with empty. + return false + elsif binstr[0, 2] != self.class.const_get(:HEADER_ID) + $stderr.puts "Warning: weired extra feild header ID. skip parsing" + return false + end + [binstr[2, 2].unpack("v")[0], binstr[4..-1]] + end + + def ==(other) + return false if self.class != other.class + each do |k, v| + v != other[k] and return false + end + true + end + + def to_local_bin + s = pack_for_local + self.class.const_get(:HEADER_ID) + [s.bytesize].pack("v") + s + end + + def to_c_dir_bin + s = pack_for_c_dir + self.class.const_get(:HEADER_ID) + [s.bytesize].pack("v") + s + end + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/extra_field/universal_time.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/extra_field/universal_time.rb new file mode 100644 index 000000000..9bf4f6c54 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/extra_field/universal_time.rb @@ -0,0 +1,47 @@ +module Zip + # Info-ZIP Additional timestamp field + class ExtraField::UniversalTime < ExtraField::Generic + HEADER_ID = "UT" + register_map + + def initialize(binstr = nil) + @ctime = nil + @mtime = nil + @atime = nil + @flag = nil + binstr and merge(binstr) + end + + attr_accessor :atime, :ctime, :mtime, :flag + + def merge(binstr) + return if binstr.empty? + size, content = initial_parse(binstr) + size or return + @flag, mtime, atime, ctime = content.unpack("CVVV") + mtime and @mtime ||= ::Zip::DOSTime.at(mtime) + atime and @atime ||= ::Zip::DOSTime.at(atime) + ctime and @ctime ||= ::Zip::DOSTime.at(ctime) + end + + def ==(other) + @mtime == other.mtime && + @atime == other.atime && + @ctime == other.ctime + end + + def pack_for_local + s = [@flag].pack("C") + @flag & 1 != 0 and s << [@mtime.to_i].pack("V") + @flag & 2 != 0 and s << [@atime.to_i].pack("V") + @flag & 4 != 0 and s << [@ctime.to_i].pack("V") + s + end + + def pack_for_c_dir + s = [@flag].pack("C") + @flag & 1 == 1 and s << [@mtime.to_i].pack("V") + s + end + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/extra_field/unix.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/extra_field/unix.rb new file mode 100644 index 000000000..7d1112184 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/extra_field/unix.rb @@ -0,0 +1,38 @@ +module Zip + # Info-ZIP Extra for UNIX uid/gid + class ExtraField::IUnix < ExtraField::Generic + HEADER_ID = "Ux" + register_map + + def initialize(binstr = nil) + @uid = 0 + @gid = 0 + binstr and merge(binstr) + end + + attr_accessor :uid, :gid + + def merge(binstr) + return if binstr.empty? + size, content = initial_parse(binstr) + # size: 0 for central directory. 4 for local header + return if (!size || size == 0) + uid, gid = content.unpack("vv") + @uid ||= uid + @gid ||= gid + end + + def ==(other) + @uid == other.uid && @gid == other.gid + end + + def pack_for_local + [@uid, @gid].pack("vv") + end + + def pack_for_c_dir + '' + end + end + +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/extra_field/zip64.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/extra_field/zip64.rb new file mode 100644 index 000000000..b8a762e2e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/extra_field/zip64.rb @@ -0,0 +1,30 @@ +module Zip + # Info-ZIP Extra for Zip64 size + class ExtraField::Zip64 < ExtraField::Generic + attr_accessor :original_size, :compressed_size, :relative_header_offset, :disk_start_number + HEADER_ID = "\001\000" + register_map + + def initialize(binstr = nil) + @original_size = nil + @compressed_size = nil + @relative_header_offset = nil + @disk_start_number = nil + binstr and merge(binstr) + end + + def merge(binstr) + return if binstr.empty? + id, size, @original_size, @compressed_size, @relative_header_offset, @disk_start_number = binstr.to_s.unpack("vvQQQV") + end + + def pack_for_local + return '' unless @original_size && @compressed_sie && @relative_header_offset && @disk_start_number + [1, 16, @original_size, @compressed_size, @relative_header_offset, @disk_start_number].pack("vvQQQV") + end + + def pack_for_c_dir + pack_for_local + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/file.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/file.rb new file mode 100755 index 000000000..2c415c235 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/file.rb @@ -0,0 +1,420 @@ +module Zip + # ZipFile is modeled after java.util.zip.ZipFile from the Java SDK. + # The most important methods are those inherited from + # ZipCentralDirectory for accessing information about the entries in + # the archive and methods such as get_input_stream and + # get_output_stream for reading from and writing entries to the + # archive. The class includes a few convenience methods such as + # #extract for extracting entries to the filesystem, and #remove, + # #replace, #rename and #mkdir for making simple modifications to + # the archive. + # + # Modifications to a zip archive are not committed until #commit or + # #close is called. The method #open accepts a block following + # the pattern from File.open offering a simple way to + # automatically close the archive when the block returns. + # + # The following example opens zip archive my.zip + # (creating it if it doesn't exist) and adds an entry + # first.txt and a directory entry a_dir + # to it. + # + # require 'zip' + # + # Zip::File.open("my.zip", Zip::File::CREATE) { + # |zipfile| + # zipfile.get_output_stream("first.txt") { |f| f.puts "Hello from ZipFile" } + # zipfile.mkdir("a_dir") + # } + # + # The next example reopens my.zip writes the contents of + # first.txt to standard out and deletes the entry from + # the archive. + # + # require 'zip' + # + # Zip::File.open("my.zip", Zip::File::CREATE) { + # |zipfile| + # puts zipfile.read("first.txt") + # zipfile.remove("first.txt") + # } + # + # ZipFileSystem offers an alternative API that emulates ruby's + # interface for accessing the filesystem, ie. the File and Dir classes. + + class File < CentralDirectory + + CREATE = 1 + SPLIT_SIGNATURE = 0x08074b50 + ZIP64_EOCD_SIGNATURE = 0x06064b50 + MAX_SEGMENT_SIZE = 3221225472 + MIN_SEGMENT_SIZE = 65536 + DATA_BUFFER_SIZE = 8192 + + attr_reader :name + + # default -> false + attr_accessor :restore_ownership + # default -> false + attr_accessor :restore_permissions + # default -> true + attr_accessor :restore_times + # Returns the zip files comment, if it has one + attr_accessor :comment + + # Opens a zip archive. Pass true as the second parameter to create + # a new archive if it doesn't exist already. + def initialize(fileName, create = nil, buffer = false) + super() + @name = fileName + @comment = '' + @create = create + case + when ::File.exists?(fileName) && !buffer + @create = nil + ::File.open(name, 'rb') do |f| + read_from_stream(f) + end + when create + @entry_set = EntrySet.new + else + raise ZipError, "File #{fileName} not found" + end + @storedEntries = @entry_set.dup + @storedComment = @comment + @restore_ownership = false + @restore_permissions = false + @restore_times = true + end + + class << self + # Same as #new. If a block is passed the ZipFile object is passed + # to the block and is automatically closed afterwards just as with + # ruby's builtin File.open method. + def open(fileName, create = nil) + zf = ::Zip::File.new(fileName, create) + if block_given? + begin + yield zf + ensure + zf.close + end + else + zf + end + end + + # Same as #open. But outputs data to a buffer instead of a file + def add_buffer + zf = ::Zip::File.new('', true, true) + yield zf + zf.write_buffer + end + + # Like #open, but reads zip archive contents from a String or open IO + # stream, and outputs data to a buffer. + # (This can be used to extract data from a + # downloaded zip archive without first saving it to disk.) + def open_buffer(io) + unless io.is_a?(IO) && io.is_a?(String) + raise "Zip::ZipFile.open_buffer expects an argument of class String or IO. Found: #{io.class}" + end + zf = ::Zip::File.new('', true, true) + if io.is_a(::String) + require 'stringio' + io = ::StringIO.new(io) + end + zf.read_from_stream(io) + yield zf + zf.write_buffer + end + + # Iterates over the contents of the ZipFile. This is more efficient + # than using a ZipInputStream since this methods simply iterates + # through the entries in the central directory structure in the archive + # whereas ZipInputStream jumps through the entire archive accessing the + # local entry headers (which contain the same information as the + # central directory). + def foreach(aZipFileName, &block) + open(aZipFileName) do |zipFile| + zipFile.each(&block) + end + end + + def get_segment_size_for_split(segment_size) + case + when MIN_SEGMENT_SIZE > segment_size + MIN_SEGMENT_SIZE + when MAX_SEGMENT_SIZE < segment_size + MAX_SEGMENT_SIZE + else + segment_size + end + end + + def get_partial_zip_file_name(zip_file_name, partial_zip_file_name) + partial_zip_file_name = zip_file_name.sub(/#{::File.basename(zip_file_name)}\z/, + partial_zip_file_name + ::File.extname(zip_file_name)) unless partial_zip_file_name.nil? + partial_zip_file_name ||= zip_file_name + partial_zip_file_name + end + + def get_segment_count_for_split(zip_file_size, segment_size) + (zip_file_size / segment_size).to_i + (zip_file_size % segment_size == 0 ? 0 : 1) + end + + def put_split_signature(szip_file, segment_size) + signature_packed = [SPLIT_SIGNATURE].pack('V') + szip_file << signature_packed + segment_size - signature_packed.size + end + + # + # TODO: Make the code more understandable + # + def save_splited_part(zip_file, partial_zip_file_name, zip_file_size, szip_file_index, segment_size, segment_count) + ssegment_size = zip_file_size - zip_file.pos + ssegment_size = segment_size if ssegment_size > segment_size + szip_file_name = "#{partial_zip_file_name}.#{'%03d'%(szip_file_index)}" + ::File.open(szip_file_name, 'wb') do |szip_file| + if szip_file_index == 1 + ssegment_size = put_split_signature(szip_file, segment_size) + end + chunk_bytes = 0 + until ssegment_size == chunk_bytes || zip_file.eof? + segment_bytes_left = ssegment_size - chunk_bytes + buffer_size = segment_bytes_left < DATA_BUFFER_SIZE ? segment_bytes_left : DATA_BUFFER_SIZE + chunk = zip_file.read(buffer_size) + chunk_bytes += buffer_size + szip_file << chunk + # Info for track splitting + yield segment_count, szip_file_index, chunk_bytes, ssegment_size if block_given? + end + end + end + + # Splits an archive into parts with segment size + def split(zip_file_name, segment_size = MAX_SEGMENT_SIZE, delete_zip_file = true, partial_zip_file_name = nil) + raise ZipError, "File #{zip_file_name} not found" unless ::File.exists?(zip_file_name) + raise Errno::ENOENT, zip_file_name unless ::File.readable?(zip_file_name) + zip_file_size = ::File.size(zip_file_name) + segment_size = get_segment_size_for_split(segment_size) + return if zip_file_size <= segment_size + segment_count = get_segment_count_for_split(zip_file_size, segment_size) + # Checking for correct zip structure + self.open(zip_file_name) {} + partial_zip_file_name = get_partial_zip_file_name(zip_file_name, partial_zip_file_name) + szip_file_index = 0 + ::File.open(zip_file_name, 'rb') do |zip_file| + until zip_file.eof? + szip_file_index += 1 + save_splited_part(zip_file, partial_zip_file_name, zip_file_size, szip_file_index, segment_size, segment_count) + end + end + ::File.delete(zip_file_name) if delete_zip_file + szip_file_index + end + end + + + # Returns an input stream to the specified entry. If a block is passed + # the stream object is passed to the block and the stream is automatically + # closed afterwards just as with ruby's builtin File.open method. + def get_input_stream(entry, &aProc) + get_entry(entry).get_input_stream(&aProc) + end + + # Returns an output stream to the specified entry. If a block is passed + # the stream object is passed to the block and the stream is automatically + # closed afterwards just as with ruby's builtin File.open method. + def get_output_stream(entry, permissionInt = nil, &aProc) + newEntry = entry.kind_of?(Entry) ? entry : Entry.new(@name, entry.to_s) + if newEntry.directory? + raise ArgumentError, + "cannot open stream to directory entry - '#{newEntry}'" + end + newEntry.unix_perms = permissionInt + zipStreamableEntry = StreamableStream.new(newEntry) + @entry_set << zipStreamableEntry + zipStreamableEntry.get_output_stream(&aProc) + end + + # Returns the name of the zip archive + def to_s + @name + end + + # Returns a string containing the contents of the specified entry + def read(entry) + get_input_stream(entry) { |is| is.read } + end + + # Convenience method for adding the contents of a file to the archive + def add(entry, srcPath, &continue_on_exists_proc) + continue_on_exists_proc ||= proc { Zip.continue_on_exists_proc } + check_entry_exists(entry, continue_on_exists_proc, "add") + newEntry = entry.kind_of?(Entry) ? entry : Entry.new(@name, entry.to_s) + newEntry.gather_fileinfo_from_srcpath(srcPath) + @entry_set << newEntry + end + + # Removes the specified entry. + def remove(entry) + @entry_set.delete(get_entry(entry)) + end + + # Renames the specified entry. + def rename(entry, new_name, &continue_on_exists_proc) + foundEntry = get_entry(entry) + check_entry_exists(new_name, continue_on_exists_proc, 'rename') + @entry_set.delete(foundEntry) + foundEntry.name = new_name + @entry_set << foundEntry + end + + # Replaces the specified entry with the contents of srcPath (from + # the file system). + def replace(entry, srcPath) + check_file(srcPath) + remove(entry) + add(entry, srcPath) + end + + # Extracts entry to file dest_path. + def extract(entry, dest_path, &block) + block ||= proc { ::Zip.on_exists_proc } + found_entry = get_entry(entry) + found_entry.extract(dest_path, &block) + end + + # Commits changes that has been made since the previous commit to + # the zip archive. + def commit + return if !commit_required? + on_success_replace(name) { + |tmpFile| + OutputStream.open(tmpFile) { + |zos| + + @entry_set.each { + |e| + e.write_to_zip_output_stream(zos) + e.dirty = false + } + zos.comment = comment + } + true + } + initialize(name) + end + + # Write buffer write changes to buffer and return + def write_buffer + buffer = OutputStream.write_buffer do |zos| + @entry_set.each { |e| e.write_to_zip_output_stream(zos) } + zos.comment = comment + end + return buffer + end + + # Closes the zip file committing any changes that has been made. + def close + commit + end + + # Returns true if any changes has been made to this archive since + # the previous commit + def commit_required? + @entry_set.each do |e| + return true if e.dirty + end + @comment != @storedComment || @entry_set != @storedEntries || @create == File::CREATE + end + + # Searches for entry with the specified name. Returns nil if + # no entry is found. See also get_entry + def find_entry(entry_name) + @entry_set.find_entry(entry_name) + end + + # Searches for entries given a glob + def glob(*args, &block) + @entry_set.glob(*args, &block) + end + + # Searches for an entry just as find_entry, but throws Errno::ENOENT + # if no entry is found. + def get_entry(entry) + selectedEntry = find_entry(entry) + unless selectedEntry + raise Errno::ENOENT, entry + end + selectedEntry.restore_ownership = @restore_ownership + selectedEntry.restore_permissions = @restore_permissions + selectedEntry.restore_times = @restore_times + selectedEntry + end + + # Creates a directory + def mkdir(entryName, permissionInt = 0755) + if find_entry(entryName) + raise Errno::EEXIST, "File exists - #{entryName}" + end + entryName = entryName.dup.to_s + entryName << '/' unless entryName.end_with?('/') + @entry_set << StreamableDirectory.new(@name, entryName, nil, permissionInt) + end + + private + + def is_directory(newEntry, srcPath) + srcPathIsDirectory = ::File.directory?(srcPath) + if newEntry.is_directory && !srcPathIsDirectory + raise ArgumentError, + "entry name '#{newEntry}' indicates directory entry, but "+ + "'#{srcPath}' is not a directory" + elsif !newEntry.is_directory && srcPathIsDirectory + newEntry.name += "/" + end + newEntry.is_directory && srcPathIsDirectory + end + + def check_entry_exists(entryName, continue_on_exists_proc, procedureName) + continue_on_exists_proc ||= proc { Zip.continue_on_exists_proc } + if @entry_set.include?(entryName) + if continue_on_exists_proc.call + remove get_entry(entryName) + else + raise ZipEntryExistsError, + procedureName + " failed. Entry #{entryName} already exists" + end + end + end + + def check_file(path) + unless ::File.readable?(path) + raise Errno::ENOENT, path + end + end + + def on_success_replace(aFilename) + tmpfile = get_tempfile + tmpFilename = tmpfile.path + tmpfile.close + if yield tmpFilename + ::File.rename(tmpFilename, name) + end + end + + def get_tempfile + tempFile = Tempfile.new(::File.basename(name), ::File.dirname(name)) + tempFile.binmode + tempFile + end + + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/filesystem.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/filesystem.rb new file mode 100755 index 000000000..5df224b14 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/filesystem.rb @@ -0,0 +1,622 @@ +require 'zip' + +module Zip + + # The ZipFileSystem API provides an API for accessing entries in + # a zip archive that is similar to ruby's builtin File and Dir + # classes. + # + # Requiring 'zip/zipfilesystem' includes this module in ZipFile + # making the methods in this module available on ZipFile objects. + # + # Using this API the following example creates a new zip file + # my.zip containing a normal entry with the name + # first.txt, a directory entry named mydir + # and finally another normal entry named second.txt + # + # require 'zip/filesystem' + # + # Zip::File.open("my.zip", Zip::ZipFile::CREATE) { + # |zipfile| + # zipfile.file.open("first.txt", "w") { |f| f.puts "Hello world" } + # zipfile.dir.mkdir("mydir") + # zipfile.file.open("mydir/second.txt", "w") { |f| f.puts "Hello again" } + # } + # + # Reading is as easy as writing, as the following example shows. The + # example writes the contents of first.txt from zip archive + # my.zip to standard out. + # + # require 'zip/filesystem' + # + # Zip::File.open("my.zip") { + # |zipfile| + # puts zipfile.file.read("first.txt") + # } + + module FileSystem + + def initialize # :nodoc: + mappedZip = ZipFileNameMapper.new(self) + @zipFsDir = ZipFsDir.new(mappedZip) + @zipFsFile = ZipFsFile.new(mappedZip) + @zipFsDir.file = @zipFsFile + @zipFsFile.dir = @zipFsDir + end + + # Returns a ZipFsDir which is much like ruby's builtin Dir (class) + # object, except it works on the ZipFile on which this method is + # invoked + def dir + @zipFsDir + end + + # Returns a ZipFsFile which is much like ruby's builtin File (class) + # object, except it works on the ZipFile on which this method is + # invoked + def file + @zipFsFile + end + + # Instances of this class are normally accessed via the accessor + # ZipFile::file. An instance of ZipFsFile behaves like ruby's + # builtin File (class) object, except it works on ZipFile entries. + # + # The individual methods are not documented due to their + # similarity with the methods in File + class ZipFsFile + + attr_writer :dir +# protected :dir + + class ZipFsStat + + class << self + + def delegate_to_fs_file(*methods) + methods.each do |method| + self.class_eval <<-end_eval, __FILE__, __LINE__ + 1 + def #{method} # def file? + @zipFsFile.#{method}(@entryName) # @zipFsFile.file?(@entryName) + end # end + end_eval + end + end + + end + + def initialize(zipFsFile, entryName) + @zipFsFile = zipFsFile + @entryName = entryName + end + + def kind_of?(t) + super || t == ::File::Stat + end + + delegate_to_fs_file :file?, :directory?, :pipe?, :chardev?, :symlink?, + :socket?, :blockdev?, :readable?, :readable_real?, :writable?, :ctime, + :writable_real?, :executable?, :executable_real?, :sticky?, :owned?, + :grpowned?, :setuid?, :setgid?, :zero?, :size, :size?, :mtime, :atime + + def blocks; nil; end + + def get_entry + @zipFsFile.__send__(:get_entry, @entryName) + end + private :get_entry + + def gid + e = get_entry + if e.extra.member? "IUnix" + e.extra["IUnix"].gid || 0 + else + 0 + end + end + + def uid + e = get_entry + if e.extra.member? "IUnix" + e.extra["IUnix"].uid || 0 + else + 0 + end + end + + def ino; 0; end + + def dev; 0; end + + def rdev; 0; end + + def rdev_major; 0; end + + def rdev_minor; 0; end + + def ftype + if file? + return "file" + elsif directory? + return "directory" + else + raise StandardError, "Unknown file type" + end + end + + def nlink; 1; end + + def blksize; nil; end + + def mode + e = get_entry + if e.fstype == 3 + e.external_file_attributes >> 16 + else + 33206 # 33206 is equivalent to -rw-rw-rw- + end + end + end + + def initialize(mappedZip) + @mappedZip = mappedZip + end + + def get_entry(fileName) + if ! exists?(fileName) + raise Errno::ENOENT, "No such file or directory - #{fileName}" + end + @mappedZip.find_entry(fileName) + end + private :get_entry + + def unix_mode_cmp(fileName, mode) + begin + e = get_entry(fileName) + e.fstype == 3 && ((e.external_file_attributes >> 16) & mode ) != 0 + rescue Errno::ENOENT + false + end + end + private :unix_mode_cmp + + def exists?(fileName) + expand_path(fileName) == "/" || @mappedZip.find_entry(fileName) != nil + end + alias :exist? :exists? + + # Permissions not implemented, so if the file exists it is accessible + alias owned? exists? + alias grpowned? exists? + + def readable?(fileName) + unix_mode_cmp(fileName, 0444) + end + alias readable_real? readable? + + def writable?(fileName) + unix_mode_cmp(fileName, 0222) + end + alias writable_real? writable? + + def executable?(fileName) + unix_mode_cmp(fileName, 0111) + end + alias executable_real? executable? + + def setuid?(fileName) + unix_mode_cmp(fileName, 04000) + end + + def setgid?(fileName) + unix_mode_cmp(fileName, 02000) + end + + def sticky?(fileName) + unix_mode_cmp(fileName, 01000) + end + + def umask(*args) + ::File.umask(*args) + end + + def truncate(fileName, len) + raise StandardError, "truncate not supported" + end + + def directory?(fileName) + entry = @mappedZip.find_entry(fileName) + expand_path(fileName) == "/" || (entry != nil && entry.directory?) + end + + def open(fileName, openMode = "r", permissionInt = 0644, &block) + openMode.gsub!("b", "") # ignore b option + case openMode + when "r" + @mappedZip.get_input_stream(fileName, &block) + when "w" + @mappedZip.get_output_stream(fileName, permissionInt, &block) + else + raise StandardError, "openmode '#{openMode} not supported" unless openMode == "r" + end + end + + def new(fileName, openMode = "r") + open(fileName, openMode) + end + + def size(fileName) + @mappedZip.get_entry(fileName).size + end + + # Returns nil for not found and nil for directories + def size?(fileName) + entry = @mappedZip.find_entry(fileName) + return (entry == nil || entry.directory?) ? nil : entry.size + end + + def chown(ownerInt, groupInt, *filenames) + filenames.each { |fileName| + e = get_entry(fileName) + unless e.extra.member?("IUnix") + e.extra.create("IUnix") + end + e.extra["IUnix"].uid = ownerInt + e.extra["IUnix"].gid = groupInt + } + filenames.size + end + + def chmod (modeInt, *filenames) + filenames.each { |fileName| + e = get_entry(fileName) + e.fstype = 3 # force convertion filesystem type to unix + e.unix_perms = modeInt + e.external_file_attributes = modeInt << 16 + e.dirty = true + } + filenames.size + end + + def zero?(fileName) + sz = size(fileName) + sz == nil || sz == 0 + rescue Errno::ENOENT + false + end + + def file?(fileName) + entry = @mappedZip.find_entry(fileName) + entry != nil && entry.file? + end + + def dirname(fileName) + ::File.dirname(fileName) + end + + def basename(fileName) + ::File.basename(fileName) + end + + def split(fileName) + ::File.split(fileName) + end + + def join(*fragments) + ::File.join(*fragments) + end + + def utime(modifiedTime, *fileNames) + fileNames.each { |fileName| + get_entry(fileName).time = modifiedTime + } + end + + def mtime(fileName) + @mappedZip.get_entry(fileName).mtime + end + + def atime(fileName) + e = get_entry(fileName) + if e.extra.member? "UniversalTime" + e.extra["UniversalTime"].atime + else + nil + end + end + + def ctime(fileName) + e = get_entry(fileName) + if e.extra.member? "UniversalTime" + e.extra["UniversalTime"].ctime + else + nil + end + end + + def pipe?(filename) + false + end + + def blockdev?(filename) + false + end + + def chardev?(filename) + false + end + + def symlink?(fileName) + false + end + + def socket?(fileName) + false + end + + def ftype(fileName) + @mappedZip.get_entry(fileName).directory? ? "directory" : "file" + end + + def readlink(fileName) + raise NotImplementedError, "The readlink() function is not implemented" + end + + def symlink(fileName, symlinkName) + raise NotImplementedError, "The symlink() function is not implemented" + end + + def link(fileName, symlinkName) + raise NotImplementedError, "The link() function is not implemented" + end + + def pipe + raise NotImplementedError, "The pipe() function is not implemented" + end + + def stat(fileName) + if ! exists?(fileName) + raise Errno::ENOENT, fileName + end + ZipFsStat.new(self, fileName) + end + + alias lstat stat + + def readlines(fileName) + open(fileName) { |is| is.readlines } + end + + def read(fileName) + @mappedZip.read(fileName) + end + + def popen(*args, &aProc) + ::File.popen(*args, &aProc) + end + + def foreach(fileName, aSep = $/, &aProc) + open(fileName) { |is| is.each_line(aSep, &aProc) } + end + + def delete(*args) + args.each { + |fileName| + if directory?(fileName) + raise Errno::EISDIR, "Is a directory - \"#{fileName}\"" + end + @mappedZip.remove(fileName) + } + end + + def rename(fileToRename, newName) + @mappedZip.rename(fileToRename, newName) { true } + end + + alias :unlink :delete + + def expand_path(aPath) + @mappedZip.expand_path(aPath) + end + end + + # Instances of this class are normally accessed via the accessor + # ZipFile::dir. An instance of ZipFsDir behaves like ruby's + # builtin Dir (class) object, except it works on ZipFile entries. + # + # The individual methods are not documented due to their + # similarity with the methods in Dir + class ZipFsDir + + def initialize(mappedZip) + @mappedZip = mappedZip + end + + attr_writer :file + + def new(aDirectoryName) + ZipFsDirIterator.new(entries(aDirectoryName)) + end + + def open(aDirectoryName) + dirIt = new(aDirectoryName) + if block_given? + begin + yield(dirIt) + return nil + ensure + dirIt.close + end + end + dirIt + end + + def pwd; @mappedZip.pwd; end + alias getwd pwd + + def chdir(aDirectoryName) + unless @file.stat(aDirectoryName).directory? + raise Errno::EINVAL, "Invalid argument - #{aDirectoryName}" + end + @mappedZip.pwd = @file.expand_path(aDirectoryName) + end + + def entries(aDirectoryName) + entries = [] + foreach(aDirectoryName) { |e| entries << e } + entries + end + + def glob(*args,&block) + @mappedZip.glob(*args,&block) + end + + def foreach(aDirectoryName) + unless @file.stat(aDirectoryName).directory? + raise Errno::ENOTDIR, aDirectoryName + end + path = @file.expand_path(aDirectoryName) + path << '/' unless path.end_with?('/') + path = Regexp.escape(path) + subDirEntriesRegex = Regexp.new("^#{path}([^/]+)$") + @mappedZip.each { + |fileName| + match = subDirEntriesRegex.match(fileName) + yield(match[1]) unless match == nil + } + end + + def delete(entryName) + unless @file.stat(entryName).directory? + raise Errno::EINVAL, "Invalid argument - #{entryName}" + end + @mappedZip.remove(entryName) + end + alias rmdir delete + alias unlink delete + + def mkdir(entryName, permissionInt = 0755) + @mappedZip.mkdir(entryName, permissionInt) + end + + def chroot(*args) + raise NotImplementedError, "The chroot() function is not implemented" + end + + end + + class ZipFsDirIterator # :nodoc:all + include Enumerable + + def initialize(arrayOfFileNames) + @fileNames = arrayOfFileNames + @index = 0 + end + + def close + @fileNames = nil + end + + def each(&aProc) + raise IOError, "closed directory" if @fileNames == nil + @fileNames.each(&aProc) + end + + def read + raise IOError, "closed directory" if @fileNames == nil + @fileNames[(@index+=1)-1] + end + + def rewind + raise IOError, "closed directory" if @fileNames == nil + @index = 0 + end + + def seek(anIntegerPosition) + raise IOError, "closed directory" if @fileNames == nil + @index = anIntegerPosition + end + + def tell + raise IOError, "closed directory" if @fileNames == nil + @index + end + end + + # All access to ZipFile from ZipFsFile and ZipFsDir goes through a + # ZipFileNameMapper, which has one responsibility: ensure + class ZipFileNameMapper # :nodoc:all + include Enumerable + + def initialize(zipFile) + @zipFile = zipFile + @pwd = "/" + end + + attr_accessor :pwd + + def find_entry(fileName) + @zipFile.find_entry(expand_to_entry(fileName)) + end + + def get_entry(fileName) + @zipFile.get_entry(expand_to_entry(fileName)) + end + + def get_input_stream(fileName, &aProc) + @zipFile.get_input_stream(expand_to_entry(fileName), &aProc) + end + + def get_output_stream(fileName, permissionInt = nil, &aProc) + @zipFile.get_output_stream(expand_to_entry(fileName), permissionInt, &aProc) + end + + def read(fileName) + @zipFile.read(expand_to_entry(fileName)) + end + + def remove(fileName) + @zipFile.remove(expand_to_entry(fileName)) + end + + def rename(fileName, newName, &continueOnExistsProc) + @zipFile.rename(expand_to_entry(fileName), expand_to_entry(newName), + &continueOnExistsProc) + end + + def mkdir(fileName, permissionInt = 0755) + @zipFile.mkdir(expand_to_entry(fileName), permissionInt) + end + + # Turns entries into strings and adds leading / + # and removes trailing slash on directories + def each + @zipFile.each { + |e| + yield("/"+e.to_s.chomp("/")) + } + end + + def expand_path(aPath) + expanded = aPath.start_with?("/") ? aPath : ::File.join(@pwd, aPath) + expanded.gsub!(/\/\.(\/|$)/, "") + expanded.gsub!(/[^\/]+\/\.\.(\/|$)/, "") + expanded.empty? ? "/" : expanded + end + + private + + def expand_to_entry(aPath) + expand_path(aPath)[1..-1] + end + end + end + + class File + include FileSystem + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/inflater.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/inflater.rb new file mode 100755 index 000000000..9f0542c6a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/inflater.rb @@ -0,0 +1,65 @@ +module Zip + class Inflater < Decompressor #:nodoc:all + def initialize(input_stream) + super + @zlib_inflater = ::Zlib::Inflate.new(-Zlib::MAX_WBITS) + @output_buffer = '' + @has_returned_empty_string = false + end + + def sysread(number_of_bytes = nil, buf = nil) + readEverything = number_of_bytes.nil? + while (readEverything || @output_buffer.bytesize < number_of_bytes) + break if internal_input_finished? + @output_buffer << internal_produce_input(buf) + end + return value_when_finished if @output_buffer.bytesize == 0 && input_finished? + end_index = number_of_bytes.nil? ? @output_buffer.bytesize : number_of_bytes + @output_buffer.slice!(0...end_index) + end + + def produce_input + if (@output_buffer.empty?) + internal_produce_input + else + @output_buffer.slice!(0...(@output_buffer.length)) + end + end + + # to be used with produce_input, not read (as read may still have more data cached) + # is data cached anywhere other than @outputBuffer? the comment above may be wrong + def input_finished? + @output_buffer.empty? && internal_input_finished? + end + + alias :eof :input_finished? + alias :eof? :input_finished? + + private + + def internal_produce_input(buf = nil) + retried = 0 + begin + @zlib_inflater.inflate(@input_stream.read(Decompressor::CHUNK_SIZE, buf)) + rescue Zlib::BufError + raise if retried >= 5 # how many times should we retry? + retried += 1 + retry + end + end + + def internal_input_finished? + @zlib_inflater.finished? + end + + def value_when_finished # mimic behaviour of ruby File object. + return if @has_returned_empty_string + @has_returned_empty_string = true + '' + end + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/input_stream.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/input_stream.rb new file mode 100755 index 000000000..7b3d89a83 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/input_stream.rb @@ -0,0 +1,145 @@ +module Zip + # ZipInputStream is the basic class for reading zip entries in a + # zip file. It is possible to create a ZipInputStream object directly, + # passing the zip file name to the constructor, but more often than not + # the ZipInputStream will be obtained from a ZipFile (perhaps using the + # ZipFileSystem interface) object for a particular entry in the zip + # archive. + # + # A ZipInputStream inherits IOExtras::AbstractInputStream in order + # to provide an IO-like interface for reading from a single zip + # entry. Beyond methods for mimicking an IO-object it contains + # the method get_next_entry for iterating through the entries of + # an archive. get_next_entry returns a ZipEntry object that describes + # the zip entry the ZipInputStream is currently reading from. + # + # Example that creates a zip archive with ZipOutputStream and reads it + # back again with a ZipInputStream. + # + # require 'zip/zip' + # + # Zip::ZipOutputStream::open("my.zip") { + # |io| + # + # io.put_next_entry("first_entry.txt") + # io.write "Hello world!" + # + # io.put_next_entry("adir/first_entry.txt") + # io.write "Hello again!" + # } + # + # + # Zip::ZipInputStream::open("my.zip") { + # |io| + # + # while (entry = io.get_next_entry) + # puts "Contents of #{entry.name}: '#{io.read}'" + # end + # } + # + # java.util.zip.ZipInputStream is the original inspiration for this + # class. + + class InputStream + include ::Zip::IOExtras::AbstractInputStream + + # Opens the indicated zip file. An exception is thrown + # if the specified offset in the specified filename is + # not a local zip entry header. + def initialize(filename, offset = 0, io = nil) + super() + if (io.nil?) + @archiveIO = ::File.open(filename, "rb") + @archiveIO.seek(offset, IO::SEEK_SET) + else + @archiveIO = io + end + @decompressor = NullDecompressor.instance + @currentEntry = nil + end + + def close + @archiveIO.close + end + + # Same as #initialize but if a block is passed the opened + # stream is passed to the block and closed when the block + # returns. + def InputStream.open(filename) + return new(filename) unless block_given? + + zio = new(filename) + yield zio + ensure + zio.close if zio + end + + def InputStream.open_buffer(io) + return new('',0,io) unless block_given? + zio = new('',0,io) + yield zio + ensure + zio.close if zio + end + + # Returns a ZipEntry object. It is necessary to call this + # method on a newly created ZipInputStream before reading from + # the first entry in the archive. Returns nil when there are + # no more entries. + + def get_next_entry + @archiveIO.seek(@currentEntry.next_header_offset, IO::SEEK_SET) if @currentEntry + open_entry + end + + # Rewinds the stream to the beginning of the current entry + def rewind + return if @currentEntry.nil? + @lineno = 0 + @pos = 0 + @archiveIO.seek(@currentEntry.local_header_offset, + IO::SEEK_SET) + open_entry + end + + # Modeled after IO.sysread + def sysread(numberOfBytes = nil, buf = nil) + @decompressor.sysread(numberOfBytes, buf) + end + + def eof + @output_buffer.empty? && @decompressor.eof + end + alias :eof? :eof + + protected + + def open_entry + @currentEntry = Entry.read_local_entry(@archiveIO) + if @currentEntry.nil? + @decompressor = NullDecompressor.instance + elsif @currentEntry.compression_method == Entry::STORED + @decompressor = PassThruDecompressor.new(@archiveIO, @currentEntry.size) + elsif @currentEntry.compression_method == Entry::DEFLATED + @decompressor = Inflater.new(@archiveIO) + else + raise ZipCompressionMethodError, + "Unsupported compression method #{@currentEntry.compression_method}" + end + flush + return @currentEntry + end + + def produce_input + @decompressor.produce_input + end + + def input_finished? + @decompressor.input_finished? + end + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/ioextras.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/ioextras.rb new file mode 100755 index 000000000..1427c6208 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/ioextras.rb @@ -0,0 +1,38 @@ +module Zip + module IOExtras #:nodoc: + + CHUNK_SIZE = 131072 + + RANGE_ALL = 0..-1 + + class << self + def copy_stream(ostream, istream) + ostream.write(istream.read(CHUNK_SIZE, '')) until istream.eof? + end + + def copy_stream_n(ostream, istream, nbytes) + toread = nbytes + while toread > 0 && !istream.eof? + tr = toread > CHUNK_SIZE ? CHUNK_SIZE : toread + ostream.write(istream.read(tr, '')) + toread -= tr + end + end + end + + # Implements kind_of? in order to pretend to be an IO object + module FakeIO + def kind_of?(object) + object == IO || super + end + end + + end # IOExtras namespace module +end + +require 'zip/ioextras/abstract_input_stream' +require 'zip/ioextras/abstract_output_stream' + +# Copyright (C) 2002-2004 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/ioextras/abstract_input_stream.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/ioextras/abstract_input_stream.rb new file mode 100644 index 000000000..cc716e14c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/ioextras/abstract_input_stream.rb @@ -0,0 +1,108 @@ +module Zip + module IOExtras + # Implements many of the convenience methods of IO + # such as gets, getc, readline and readlines + # depends on: input_finished?, produce_input and read + module AbstractInputStream + include Enumerable + include FakeIO + + def initialize + super + @lineno = 0 + @pos = 0 + @output_buffer = '' + end + + attr_accessor :lineno + attr_reader :pos + + def read(number_of_bytes = nil, buf = nil) + tbuf = if @output_buffer.bytesize > 0 + if number_of_bytes <= @output_buffer.bytesize + @output_buffer.slice!(0, number_of_bytes) + else + number_of_bytes -= @output_buffer.bytesize if number_of_bytes + rbuf = sysread(number_of_bytes, buf) + out = @output_buffer + out << rbuf if rbuf + @output_buffer = '' + out + end + else + sysread(number_of_bytes, buf) + end + + @pos += tbuf.length + + return nil unless tbuf + + if buf + buf.replace(tbuf) + else + buf = tbuf + end + buf + end + + def readlines(a_sep_string = $/) + ret_val = [] + each_line(a_sep_string) { |line| ret_val << line } + ret_val + end + + def gets(a_sep_string = $/, number_of_bytes = nil) + @lineno = @lineno.next + + if number_of_bytes.respond_to?(:to_int) + number_of_bytes = number_of_bytes.to_int + a_sep_string = a_sep_string.to_str if a_sep_string + elsif a_sep_string.respond_to?(:to_int) + number_of_bytes = a_sep_string.to_int + a_sep_string = $/ + else + number_of_bytes = nil + a_sep_string = a_sep_string.to_str if a_sep_string + end + + return read(number_of_bytes) if a_sep_string.nil? + a_sep_string = "#{$/}#{$/}" if a_sep_string.empty? + + buffer_index = 0 + over_limit = (number_of_bytes && @output_buffer.bytesize >= number_of_bytes) + while (match_index = @output_buffer.index(a_sep_string, buffer_index)).nil? && !over_limit + buffer_index = [buffer_index, @output_buffer.bytesize - a_sep_string.bytesize].max + if input_finished? + return @output_buffer.empty? ? nil : flush + end + @output_buffer << produce_input + over_limit = (number_of_bytes && @output_buffer.bytesize >= number_of_bytes) + end + sep_index = [match_index + a_sep_string.bytesize, number_of_bytes || @output_buffer.bytesize].min + @pos += sep_index + return @output_buffer.slice!(0...sep_index) + end + + def flush + ret_val = @output_buffer + @output_buffer = '' + ret_val + end + + def readline(a_sep_string = $/) + ret_val = gets(a_sep_string) + raise EOFError unless ret_val + ret_val + end + + def each_line(a_sep_string = $/) + while true + yield readline(a_sep_string) + end + rescue EOFError + end + + alias_method :each, :each_line + end + end +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/ioextras/abstract_output_stream.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/ioextras/abstract_output_stream.rb new file mode 100644 index 000000000..6c7ef2fb3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/ioextras/abstract_output_stream.rb @@ -0,0 +1,45 @@ +module Zip + module IOExtras + # Implements many of the output convenience methods of IO. + # relies on << + module AbstractOutputStream + include FakeIO + + def write(data) + self << data + data.to_s.bytesize + end + + + def print(*params) + self << params.join($,) << $\.to_s + end + + def printf(a_format_string, *params) + self << sprintf(a_format_string, *params) + end + + def putc(an_object) + self << case an_object + when Fixnum + an_object.chr + when String + an_object + else + raise TypeError, 'putc: Only Fixnum and String supported' + end + an_object + end + + def puts(*params) + params << "\n" if params.empty? + params.flatten.each do |element| + val = element.to_s + self << val + self << "\n" unless val[-1, 1] == "\n" + end + end + + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/null_compressor.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/null_compressor.rb new file mode 100755 index 000000000..905a7bd7e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/null_compressor.rb @@ -0,0 +1,15 @@ +module Zip + class NullCompressor < Compressor #:nodoc:all + include Singleton + + def <<(data) + raise IOError, "closed stream" + end + + attr_reader :size, :compressed_size + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/null_decompressor.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/null_decompressor.rb new file mode 100755 index 000000000..ada5e012f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/null_decompressor.rb @@ -0,0 +1,27 @@ +module Zip + class NullDecompressor #:nodoc:all + include Singleton + + def sysread(numberOfBytes = nil, buf = nil) + nil + end + + def produce_input + nil + end + + def input_finished? + true + end + + def eof + true + end + + alias :eof? :eof + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/null_input_stream.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/null_input_stream.rb new file mode 100755 index 000000000..34e272489 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/null_input_stream.rb @@ -0,0 +1,9 @@ +module Zip + class NullInputStream < NullDecompressor #:nodoc:all + include ::Zip::IOExtras::AbstractInputStream + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/output_stream.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/output_stream.rb new file mode 100755 index 000000000..ac73d16f2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/output_stream.rb @@ -0,0 +1,175 @@ +module Zip + # ZipOutputStream is the basic class for writing zip files. It is + # possible to create a ZipOutputStream object directly, passing + # the zip file name to the constructor, but more often than not + # the ZipOutputStream will be obtained from a ZipFile (perhaps using the + # ZipFileSystem interface) object for a particular entry in the zip + # archive. + # + # A ZipOutputStream inherits IOExtras::AbstractOutputStream in order + # to provide an IO-like interface for writing to a single zip + # entry. Beyond methods for mimicking an IO-object it contains + # the method put_next_entry that closes the current entry + # and creates a new. + # + # Please refer to ZipInputStream for example code. + # + # java.util.zip.ZipOutputStream is the original inspiration for this + # class. + + class OutputStream + include ::Zip::IOExtras::AbstractOutputStream + + attr_accessor :comment + + # Opens the indicated zip file. If a file with that name already + # exists it will be overwritten. + def initialize(fileName, stream=false) + super() + @fileName = fileName + if stream + @output_stream = ::StringIO.new + else + @output_stream = ::File.new(@fileName, "wb") + end + @entry_set = ::Zip::EntrySet.new + @compressor = ::Zip::NullCompressor.instance + @closed = false + @currentEntry = nil + @comment = nil + end + + # Same as #initialize but if a block is passed the opened + # stream is passed to the block and closed when the block + # returns. + class << self + def open(fileName) + return new(fileName) unless block_given? + zos = new(fileName) + yield zos + ensure + zos.close if zos + end + + # Same as #open but writes to a filestream instead + def write_buffer + zos = new('', true) + yield zos + return zos.close_buffer + end + end + + # Closes the stream and writes the central directory to the zip file + def close + return if @closed + finalize_current_entry + update_local_headers + write_central_directory + @output_stream.close + @closed = true + end + + # Closes the stream and writes the central directory to the zip file + def close_buffer + return @output_stream if @closed + finalize_current_entry + update_local_headers + write_central_directory + @closed = true + @output_stream + end + + # Closes the current entry and opens a new for writing. + # +entry+ can be a ZipEntry object or a string. + def put_next_entry(entryname, comment = nil, extra = nil, compression_method = Entry::DEFLATED, level = Zlib::DEFAULT_COMPRESSION) + raise ZipError, "zip stream is closed" if @closed + if entryname.kind_of?(Entry) + new_entry = entryname + else + new_entry = Entry.new(@fileName, entryname.to_s) + end + new_entry.comment = comment if !comment.nil? + if (!extra.nil?) + new_entry.extra = ExtraField === extra ? extra : ExtraField.new(extra.to_s) + end + new_entry.compression_method = compression_method if !compression_method.nil? + init_next_entry(new_entry, level) + @currentEntry = new_entry + end + + def copy_raw_entry(entry) + entry = entry.dup + raise ZipError, "zip stream is closed" if @closed + raise ZipError, "entry is not a ZipEntry" if !entry.kind_of?(Entry) + finalize_current_entry + @entry_set << entry + src_pos = entry.local_entry_offset + entry.write_local_entry(@output_stream) + @compressor = NullCompressor.instance + entry.get_raw_input_stream do |is| + is.seek(src_pos, IO::SEEK_SET) + IOExtras.copy_stream_n(@output_stream, is, entry.compressed_size) + end + @compressor = NullCompressor.instance + @currentEntry = nil + end + + private + + def finalize_current_entry + return unless @currentEntry + finish + @currentEntry.compressed_size = @output_stream.tell - @currentEntry.local_header_offset - @currentEntry.calculate_local_header_size + @currentEntry.size = @compressor.size + @currentEntry.crc = @compressor.crc + @currentEntry = nil + @compressor = NullCompressor.instance + end + + def init_next_entry(entry, level = Zlib::DEFAULT_COMPRESSION) + finalize_current_entry + @entry_set << entry + entry.write_local_entry(@output_stream) + @compressor = get_compressor(entry, level) + end + + def get_compressor(entry, level) + case entry.compression_method + when Entry::DEFLATED then Deflater.new(@output_stream, level) + when Entry::STORED then PassThruCompressor.new(@output_stream) + else raise ZipCompressionMethodError, + "Invalid compression method: '#{entry.compression_method}'" + end + end + + def update_local_headers + pos = @output_stream.pos + @entry_set.each do |entry| + @output_stream.pos = entry.local_header_offset + entry.write_local_entry(@output_stream) + end + @output_stream.pos = pos + end + + def write_central_directory + cdir = CentralDirectory.new(@entry_set, @comment) + cdir.write_to_stream(@output_stream) + end + + protected + + def finish + @compressor.finish + end + + public + # Modeled after IO.<< + def << (data) + @compressor << data + end + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/pass_thru_compressor.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/pass_thru_compressor.rb new file mode 100755 index 000000000..2f62f064b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/pass_thru_compressor.rb @@ -0,0 +1,23 @@ +module Zip + class PassThruCompressor < Compressor #:nodoc:all + def initialize(outputStream) + super() + @output_stream = outputStream + @crc = Zlib::crc32 + @size = 0 + end + + def << (data) + val = data.to_s + @crc = Zlib::crc32(val, @crc) + @size += val.bytesize + @output_stream << val + end + + attr_reader :size, :crc + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/pass_thru_decompressor.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/pass_thru_decompressor.rb new file mode 100755 index 000000000..806948d97 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/pass_thru_decompressor.rb @@ -0,0 +1,41 @@ +module Zip + class PassThruDecompressor < Decompressor #:nodoc:all + + def initialize(input_stream, chars_to_read) + super(input_stream) + @chars_to_read = chars_to_read + @read_so_far = 0 + @has_returned_empty_string = false + end + + def sysread(number_of_bytes = nil, buf = nil) + if input_finished? + has_returned_empty_string_val = @has_returned_empty_string + @has_returned_empty_string = true + return '' unless has_returned_empty_string_val + return + end + + if (number_of_bytes == nil || @read_so_far + number_of_bytes > @chars_to_read) + number_of_bytes = @chars_to_read - @read_so_far + end + @read_so_far += number_of_bytes + @input_stream.read(number_of_bytes, buf) + end + + def produce_input + sysread(::Zip::Decompressor::CHUNK_SIZE) + end + + def input_finished? + @read_so_far >= @chars_to_read + end + + alias :eof :input_finished? + alias :eof? :input_finished? + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/streamable_directory.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/streamable_directory.rb new file mode 100755 index 000000000..1b8e34560 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/streamable_directory.rb @@ -0,0 +1,15 @@ +module Zip + class StreamableDirectory < Entry + def initialize(zipfile, entry, srcPath = nil, permissionInt = nil) + super(zipfile, entry) + + @ftype = :directory + entry.get_extra_attributes_from_path(srcPath) if (srcPath) + @unix_perms = permissionInt if (permissionInt) + end + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/streamable_stream.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/streamable_stream.rb new file mode 100755 index 000000000..7f2bbe9d9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/streamable_stream.rb @@ -0,0 +1,47 @@ +module Zip + class StreamableStream < DelegateClass(Entry) #nodoc:all + def initialize(entry) + super(entry) + @tempFile = Tempfile.new(::File.basename(name), ::File.dirname(zipfile)) + @tempFile.binmode + end + + def get_output_stream + if block_given? + begin + yield(@tempFile) + ensure + @tempFile.close + end + else + @tempFile + end + end + + def get_input_stream + if ! @tempFile.closed? + raise StandardError, "cannot open entry for reading while its open for writing - #{name}" + end + @tempFile.open # reopens tempfile from top + @tempFile.binmode + if block_given? + begin + yield(@tempFile) + ensure + @tempFile.close + end + else + @tempFile + end + end + + def write_to_zip_output_stream(aZipOutputStream) + aZipOutputStream.put_next_entry(self) + get_input_stream { |is| ::Zip::IOExtras.copy_stream(aZipOutputStream, is) } + end + end +end + +# Copyright (C) 2002, 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/version.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/version.rb new file mode 100644 index 000000000..c4e99cf9b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/lib/zip/version.rb @@ -0,0 +1,3 @@ +module Zip + VERSION = '1.0.0' +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/example.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/example.rb new file mode 100755 index 000000000..bcb5fc5bf --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/example.rb @@ -0,0 +1,91 @@ +#!/usr/bin/env ruby + +$: << "../lib" +system("zip example.zip example.rb gtkRubyzip.rb") + +require 'zip/zip' + +####### Using ZipInputStream alone: ####### + +Zip::InputStream.open("example.zip") { + |zis| + entry = zis.get_next_entry + print "First line of '#{entry.name} (#{entry.size} bytes): " + puts "'#{zis.gets.chomp}'" + entry = zis.get_next_entry + print "First line of '#{entry.name} (#{entry.size} bytes): " + puts "'#{zis.gets.chomp}'" +} + + +####### Using ZipFile to read the directory of a zip file: ####### + +zf = Zip::File.new("example.zip") +zf.each_with_index { + |entry, index| + + puts "entry #{index} is #{entry.name}, size = #{entry.size}, compressed size = #{entry.compressed_size}" + # use zf.get_input_stream(entry) to get a ZipInputStream for the entry + # entry can be the ZipEntry object or any object which has a to_s method that + # returns the name of the entry. +} + + +####### Using ZipOutputStream to write a zip file: ####### + +Zip::OutputStream.open("exampleout.zip") { + |zos| + zos.put_next_entry("the first little entry") + zos.puts "Hello hello hello hello hello hello hello hello hello" + + zos.put_next_entry("the second little entry") + zos.puts "Hello again" + + # Use rubyzip or your zip client of choice to verify + # the contents of exampleout.zip +} + +####### Using ZipFile to change a zip file: ####### + +Zip::File.open("exampleout.zip") { + |zf| + zf.add("thisFile.rb", "example.rb") + zf.rename("thisFile.rb", "ILikeThisName.rb") + zf.add("Again", "example.rb") +} + +# Lets check +Zip::File.open("exampleout.zip") { + |zf| + puts "Changed zip file contains: #{zf.entries.join(', ')}" + zf.remove("Again") + puts "Without 'Again': #{zf.entries.join(', ')}" +} + +####### Using ZipFile to split a zip file: ####### + +# Creating large zip file for splitting +Zip::OutputStream.open("large_zip_file.zip") do |zos| + puts "Creating zip file..." + 10.times do |i| + zos.put_next_entry("large_entry_#{i}.txt") + zos.puts "Hello" * 104857600 + end +end + +# Splitting created large zip file +part_zips_count = Zip::File.split("large_zip_file.zip", 2097152, false) +puts "Zip file splitted in #{part_zips_count} parts" + +# Track splitting an archive +Zip::File.split("large_zip_file.zip", 1048576, true, 'part_zip_file') do + |part_count, part_index, chunk_bytes, segment_bytes| + puts "#{part_index} of #{part_count} part splitting: #{(chunk_bytes.to_f/segment_bytes.to_f * 100).to_i}%" +end + + +# For other examples, look at zip.rb and ziptest.rb + +# Copyright (C) 2002 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/example_filesystem.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/example_filesystem.rb new file mode 100755 index 000000000..dbc6b1201 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/example_filesystem.rb @@ -0,0 +1,33 @@ +#!/usr/bin/env ruby + +$: << "../lib" + +require 'zip/zipfilesystem' + +EXAMPLE_ZIP = "filesystem.zip" + +File.delete(EXAMPLE_ZIP) if File.exists?(EXAMPLE_ZIP) + +Zip::File.open(EXAMPLE_ZIP, Zip::File::CREATE) { + |zf| + zf.file.open("file1.txt", "w") { |os| os.write "first file1.txt" } + zf.dir.mkdir("dir1") + zf.dir.chdir("dir1") + zf.file.open("file1.txt", "w") { |os| os.write "second file1.txt" } + puts zf.file.read("file1.txt") + puts zf.file.read("../file1.txt") + zf.dir.chdir("..") + zf.file.open("file2.txt", "w") { |os| os.write "first file2.txt" } + puts "Entries: #{zf.entries.join(', ')}" +} + +Zip::File.open(EXAMPLE_ZIP) { + |zf| + puts "Entries from reloaded zip: #{zf.entries.join(', ')}" +} + +# For other examples, look at zip.rb and ziptest.rb + +# Copyright (C) 2003 Thomas Sondergaard +# rubyzip is free software; you can redistribute it and/or +# modify it under the terms of the ruby license. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/example_recursive.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/example_recursive.rb new file mode 100644 index 000000000..f7bb7bddc --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/example_recursive.rb @@ -0,0 +1,49 @@ +require 'zip/zip' + +# This is a simple example which uses rubyzip to +# recursively generate a zip file from the contents of +# a specified directory. The directory itself is not +# included in the archive, rather just its contents. +# +# Usage: +# directoryToZip = "/tmp/input" +# outputFile = "/tmp/out.zip" +# zf = ZipFileGenerator.new(directoryToZip, outputFile) +# zf.write() +class ZipFileGenerator + + # Initialize with the directory to zip and the location of the output archive. + def initialize(inputDir, outputFile) + @inputDir = inputDir + @outputFile = outputFile + end + + # Zip the input directory. + def write() + entries = Dir.entries(@inputDir); entries.delete("."); entries.delete("..") + io = Zip::File.open(@outputFile, Zip::File::CREATE); + + writeEntries(entries, "", io) + io.close(); + end + + # A helper method to make the recursion work. + private + def writeEntries(entries, path, io) + + entries.each { |e| + zipFilePath = path == "" ? e : File.join(path, e) + diskFilePath = File.join(@inputDir, zipFilePath) + puts "Deflating " + diskFilePath + if File.directory?(diskFilePath) + io.mkdir(zipFilePath) + subdir =Dir.entries(diskFilePath); subdir.delete("."); subdir.delete("..") + writeEntries(subdir, zipFilePath, io) + else + io.get_output_stream(zipFilePath) { |f| f.puts(File.open(diskFilePath, "rb").read())} + end + } + end + +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/gtkRubyzip.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/gtkRubyzip.rb new file mode 100755 index 000000000..38126aaba --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/gtkRubyzip.rb @@ -0,0 +1,86 @@ +#!/usr/bin/env ruby + +$: << "../lib" + +$VERBOSE = true + +require 'gtk' +require 'zip/zip' + +class MainApp < Gtk::Window + def initialize + super() + set_usize(400, 256) + set_title("rubyzip") + signal_connect(Gtk::Window::SIGNAL_DESTROY) { Gtk.main_quit } + + box = Gtk::VBox.new(false, 0) + add(box) + + @zipfile = nil + @buttonPanel = ButtonPanel.new + @buttonPanel.openButton.signal_connect(Gtk::Button::SIGNAL_CLICKED) { + show_file_selector + } + @buttonPanel.extractButton.signal_connect(Gtk::Button::SIGNAL_CLICKED) { + puts "Not implemented!" + } + box.pack_start(@buttonPanel, false, false, 0) + + sw = Gtk::ScrolledWindow.new + sw.set_policy(Gtk::POLICY_AUTOMATIC, Gtk::POLICY_AUTOMATIC) + box.pack_start(sw, true, true, 0) + + @clist = Gtk::CList.new(["Name", "Size", "Compression"]) + @clist.set_selection_mode(Gtk::SELECTION_BROWSE) + @clist.set_column_width(0, 120) + @clist.set_column_width(1, 120) + @clist.signal_connect(Gtk::CList::SIGNAL_SELECT_ROW) { + |w, row, column, event| + @selected_row = row + } + sw.add(@clist) + end + + class ButtonPanel < Gtk::HButtonBox + attr_reader :openButton, :extractButton + def initialize + super + set_layout(Gtk::BUTTONBOX_START) + set_spacing(0) + @openButton = Gtk::Button.new("Open archive") + @extractButton = Gtk::Button.new("Extract entry") + pack_start(@openButton) + pack_start(@extractButton) + end + end + + def show_file_selector + @fileSelector = Gtk::FileSelection.new("Open zip file") + @fileSelector.show + @fileSelector.ok_button.signal_connect(Gtk::Button::SIGNAL_CLICKED) { + open_zip(@fileSelector.filename) + @fileSelector.destroy + } + @fileSelector.cancel_button.signal_connect(Gtk::Button::SIGNAL_CLICKED) { + @fileSelector.destroy + } + end + + def open_zip(filename) + @zipfile = Zip::File.open(filename) + @clist.clear + @zipfile.each { + |entry| + @clist.append([ entry.name, + entry.size.to_s, + (100.0*entry.compressedSize/entry.size).to_s+"%" ]) + } + end +end + +mainApp = MainApp.new() + +mainApp.show_all + +Gtk.main diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/qtzip.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/qtzip.rb new file mode 100755 index 000000000..78aa93e58 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/qtzip.rb @@ -0,0 +1,101 @@ +#!/usr/bin/env ruby + +$VERBOSE=true + +$: << "../lib" + +require 'Qt' +system('rbuic -o zipdialogui.rb zipdialogui.ui') +require 'zipdialogui.rb' +require 'zip/zip' + + + +a = Qt::Application.new(ARGV) + +class ZipDialog < ZipDialogUI + + + def initialize() + super() + connect(child('add_button'), SIGNAL('clicked()'), + self, SLOT('add_files()')) + connect(child('extract_button'), SIGNAL('clicked()'), + self, SLOT('extract_files()')) + end + + def zipfile(&proc) + Zip::File.open(@zip_filename, &proc) + end + + def each(&proc) + Zip::File.foreach(@zip_filename, &proc) + end + + def refresh() + lv = child("entry_list_view") + lv.clear + each { + |e| + lv.insert_item(Qt::ListViewItem.new(lv, e.name, e.size.to_s)) + } + end + + + def load(zipfile) + @zip_filename = zipfile + refresh + end + + def add_files + l = Qt::FileDialog.getOpenFileNames(nil, nil, self) + zipfile { + |zf| + l.each { + |path| + zf.add(File.basename(path), path) + } + } + refresh + end + + def extract_files + selected_items = [] + unselected_items = [] + lv_item = entry_list_view.first_child + while (lv_item) + if entry_list_view.is_selected(lv_item) + selected_items << lv_item.text(0) + else + unselected_items << lv_item.text(0) + end + lv_item = lv_item.next_sibling + end + puts "selected_items.size = #{selected_items.size}" + puts "unselected_items.size = #{unselected_items.size}" + items = selected_items.size > 0 ? selected_items : unselected_items + puts "items.size = #{items.size}" + + d = Qt::FileDialog.get_existing_directory(nil, self) + if (!d) + puts "No directory chosen" + else + zipfile { |zf| items.each { |e| zf.extract(e, File.join(d, e)) } } + end + + end + + slots 'add_files()', 'extract_files()' +end + +if !ARGV[0] + puts "usage: #{$0} zipname" + exit +end + +zd = ZipDialog.new +zd.load(ARGV[0]) + +a.mainWidget = zd +zd.show() +a.exec() diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/write_simple.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/write_simple.rb new file mode 100755 index 000000000..02c062c08 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/write_simple.rb @@ -0,0 +1,13 @@ +#!/usr/bin/env ruby + +$: << "../lib" + +require 'zip/zip' + +include Zip + +OutputStream.open('simple.zip') { + |zos| + ze = zos.put_next_entry 'entry.txt' + zos.puts "Hello world" +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/zipfind.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/zipfind.rb new file mode 100755 index 000000000..00293e81a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/rubyzip-1.0.0/samples/zipfind.rb @@ -0,0 +1,74 @@ +#!/usr/bin/env ruby + +$VERBOSE = true + +$: << "../lib" + +require 'zip/zip' +require 'find' + +module Zip + module ZipFind + def self.find(path, zipFilePattern = /\.zip$/i) + Find.find(path) { + |fileName| + yield(fileName) + if zipFilePattern.match(fileName) && File.file?(fileName) + begin + Zip::File.foreach(fileName) { + |zipEntry| + yield(fileName + File::SEPARATOR + zipEntry.to_s) + } + rescue Errno::EACCES => ex + puts ex + end + end + } + end + + def self.find_file(path, fileNamePattern, zipFilePattern = /\.zip$/i) + self.find(path, zipFilePattern) { + |fileName| + yield(fileName) if fileNamePattern.match(fileName) + } + end + + end +end + +if __FILE__ == $0 + module ZipFindConsoleRunner + + PATH_ARG_INDEX = 0; + FILENAME_PATTERN_ARG_INDEX = 1; + ZIPFILE_PATTERN_ARG_INDEX = 2; + + def self.run(args) + check_args(args) + Zip::ZipFind.find_file(args[PATH_ARG_INDEX], + args[FILENAME_PATTERN_ARG_INDEX], + args[ZIPFILE_PATTERN_ARG_INDEX]) { + |fileName| + report_entry_found fileName + } + end + + def self.check_args(args) + if (args.size != 3) + usage + exit + end + end + + def self.usage + puts "Usage: #{$0} PATH ZIPFILENAME_PATTERN FILNAME_PATTERN" + end + + def self.report_entry_found(fileName) + puts fileName + end + + end + + ZipFindConsoleRunner.run(ARGV) +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/.gitignore b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/.gitignore new file mode 100644 index 000000000..1ca9e234e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/.gitignore @@ -0,0 +1,18 @@ +*.gem +*.rbc +.bundle +.config +.yardoc +Gemfile.lock +InstalledFiles +_yardoc +coverage +doc/ +lib/bundler/man +pkg +rdoc +spec/reports +test/tmp +test/version_tmp +tmp +vendor diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/.simplecov b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/.simplecov new file mode 100644 index 000000000..666f1c2d0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/.simplecov @@ -0,0 +1,8 @@ +require 'coveralls' +Coveralls.wear! +SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ + SimpleCov::Formatter::HTMLFormatter, + Coveralls::SimpleCov::Formatter +] +SimpleCov.command_name 'bacon' +SimpleCov.start {add_filter 'test'} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/.travis.yml b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/.travis.yml new file mode 100644 index 000000000..23e1a15f3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/.travis.yml @@ -0,0 +1,8 @@ +language: ruby +rvm: + - "1.9.2" + - "1.9.3" + - "2.0.0" + - jruby-19mode # JRuby in 1.9 mode + - rbx-19mode +script: rake test diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/Gemfile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/Gemfile new file mode 100644 index 000000000..cc6e39d09 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/Gemfile @@ -0,0 +1,8 @@ +source 'https://rubygems.org' + +# Specify your gem's dependencies in forwardablex.gemspec +gemspec + +gem 'simplecov', :require => false, :group => :test +gem 'coveralls', :require => false, :group => :test +gem 'json', '~> 1.7.7' \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/LICENSE.txt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/LICENSE.txt new file mode 100644 index 000000000..74bf5ff05 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2013 Keita Yamaguchi + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/README.md b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/README.md new file mode 100644 index 000000000..959106749 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/README.md @@ -0,0 +1,38 @@ +# simple-identity + +simple-identity is a Ruby library for providing simple identity methods of #eql?, #==, and #hash. + +[![Gem Version](https://badge.fury.io/rb/simple-identity.png)](http://badge.fury.io/rb/simple-identity) [![Build Status](https://travis-ci.org/keita/simple-identity.png?branch=master)](https://travis-ci.org/keita/simple-identity) [![Coverage Status](https://coveralls.io/repos/keita/simple-identity/badge.png?branch=master)](https://coveralls.io/r/keita/simple-identity) [![Code Climate](https://codeclimate.com/github/keita/simple-identity.png)](https://codeclimate.com/github/keita/simple-identity) + +## Installation + + $ gem install simple-identity + +## Usage + +```ruby +class A + include SimpleIdentity + attr_accessor :a, :b, :c + def initialize(a, b, c) + @a = a + @b = b + @c = c + end +end + +A.new(1,2,3) == A.new(1,2,3) # true +A.new(1,2,3) != A.new(3,2,1) # true +```` + +## License + +simple-identity is free software distributed under MIT license. + +## Contributing + +1. Fork it +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin my-new-feature`) +5. Create new Pull Request diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/Rakefile new file mode 100644 index 000000000..b45f9fc73 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/Rakefile @@ -0,0 +1,18 @@ +require "bundler/gem_tasks" + +desc 'Test specs' +task 'test' do + sh "bundle exec bacon -a" +end + +desc 'Generate API document' +task 'html' do + sh "bundle exec yard doc -o html --hide-void-return --no-api" +end + +desc 'Show undocumented function list' +task 'html:undoc' do + sh "bundle exec yard stats --list-undoc --no-api --compact" +end + +task :default => :test diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/lib/simple-identity.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/lib/simple-identity.rb new file mode 100644 index 000000000..9acc49c95 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/lib/simple-identity.rb @@ -0,0 +1,36 @@ +require "forwardablex" +require "simple-identity/version" + +module SimpleIdentity + extend ForwardableX + + def self.included(klass) + def klass.ignore_identity(symbol) + (@__ignore_identities__ ||= []) << symbol + end + + def klass.__ignore_identities__ + @__ignore_identities__ || [] + end + end + + forward :class, :__ignore_identities__ + + def eql?(other) + return false unless other.kind_of?(self.class) + __identities__.all? do |symbol| + instance_variable_get(symbol) == other.__send__(symbol.to_s[1..-1]) + end + end + alias :"==" :eql? + + def hash + __identities__.map{|symbol| instance_variable_get(symbol)}.hash + end + + def __identities__ + instance_variables.select do |id| + not(id.to_s.start_with?("@__") or __ignore_identities__.include?(id.to_s[1..-1].to_sym)) + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/lib/simple-identity/version.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/lib/simple-identity/version.rb new file mode 100644 index 000000000..2c16b35d4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/lib/simple-identity/version.rb @@ -0,0 +1,3 @@ +module SimpleIdentity + VERSION = "0.1.2" +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/simple-identity.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/simple-identity.gemspec new file mode 100644 index 000000000..82e89c62b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/simple-identity.gemspec @@ -0,0 +1,27 @@ +# -*- ruby -*- +# coding: utf-8 +lib = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'simple-identity/version' + +Gem::Specification.new do |spec| + spec.name = "simple-identity" + spec.version = SimpleIdentity::VERSION + spec.authors = ["Keita Yamaguchi"] + spec.email = ["keita.yamaguchi@gmail.com"] + spec.description = "simple-identity provides simple identity methods of #eql?, #==, and #hash" + spec.summary = spec.description + spec.homepage = "https://github.com/keita/simple-identity" + spec.license = "MIT" + + spec.files = `git ls-files`.split($/) + spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } + spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) + spec.require_paths = ["lib"] + + spec.add_dependency "forwardablex" + + spec.add_development_dependency "bundler", "~> 1.3" + spec.add_development_dependency "rake" + spec.add_development_dependency "bacon" +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/test/spec_simple-identity.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/test/spec_simple-identity.rb new file mode 100644 index 000000000..f230e125d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/simple-identity-0.1.2/test/spec_simple-identity.rb @@ -0,0 +1,48 @@ +require 'simplecov' +require 'simple-identity' + +class A + include SimpleIdentity + attr_accessor :a, :b, :c + def initialize(a, b, c, d=nil) + @a = a + @b = b + @c = c + @__d__ = d + end +end + +class B + include SimpleIdentity + ignore_identity :b + attr_accessor :a, :b + def initialize(a, b) + @a = a + @b = b + end +end + +describe "SimpleIdentity" do + it 'should equal' do + A.new(1,2,3).should == A.new(1,2,3) + A.new(1,2,3,4).should == A.new(1,2,3) + A.new(1,2,3,4).should == A.new(1,2,3,5) + B.new(1,2).should == B.new(1,3) + end + + it 'should not equal' do + A.new(1,2,3).should != A.new(3,2,1) + A.new(1,2,3).should != 1 + B.new(1,2).should != B.new(2,3) + end + + it 'should have same hash values' do + A.new(1,2,3).hash.should == A.new(1,2,3).hash + A.new(1,2,3,4).hash.should == A.new(1,2,3).hash + A.new(1,2,3,4).hash.should == A.new(1,2,3,5).hash + end + + it 'should have different hash values' do + A.new(1,2,3).hash.should != A.new(3,2,1).hash + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/.gitignore b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/.gitignore new file mode 100644 index 000000000..06f401f15 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/.gitignore @@ -0,0 +1,19 @@ +*.gem +*.rbc +.bundle +.config +.yardoc +Gemfile.lock +InstalledFiles +_yardoc +coverage +doc/ +lib/bundler/man +pkg +rdoc +spec/reports +test/tmp +test/version_tmp +tmp +vendor +html diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/.simplecov b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/.simplecov new file mode 100644 index 000000000..666f1c2d0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/.simplecov @@ -0,0 +1,8 @@ +require 'coveralls' +Coveralls.wear! +SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ + SimpleCov::Formatter::HTMLFormatter, + Coveralls::SimpleCov::Formatter +] +SimpleCov.command_name 'bacon' +SimpleCov.start {add_filter 'test'} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/.travis.yml b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/.travis.yml new file mode 100644 index 000000000..23e1a15f3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/.travis.yml @@ -0,0 +1,8 @@ +language: ruby +rvm: + - "1.9.2" + - "1.9.3" + - "2.0.0" + - jruby-19mode # JRuby in 1.9 mode + - rbx-19mode +script: rake test diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/Gemfile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/Gemfile new file mode 100644 index 000000000..cc6e39d09 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/Gemfile @@ -0,0 +1,8 @@ +source 'https://rubygems.org' + +# Specify your gem's dependencies in forwardablex.gemspec +gemspec + +gem 'simplecov', :require => false, :group => :test +gem 'coveralls', :require => false, :group => :test +gem 'json', '~> 1.7.7' \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/LICENSE.txt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/LICENSE.txt new file mode 100644 index 000000000..74bf5ff05 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2013 Keita Yamaguchi + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/README.md b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/README.md new file mode 100644 index 000000000..d931d8c7a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/README.md @@ -0,0 +1,90 @@ +# StructX + +StructX is an extension of Ruby standard Struct. The diffences are that 1) the constructor handles hash table as key-value pairs, 2) you can specify members as statements, and 3) you can set default values of member. StructX's API is compatible with Struct. + +[![Gem Version](https://badge.fury.io/rb/structx.png)](http://badge.fury.io/rb/structx) [![Build Status](https://travis-ci.org/keita/structx.png?branch=master)](https://travis-ci.org/keita/structx) [![Coverage Status](https://coveralls.io/repos/keita/structx/badge.png?branch=master)](https://coveralls.io/r/keita/structx) [![Code Climate](https://codeclimate.com/github/keita/structx.png)](https://codeclimate.com/github/keita/structx) + +## Installation + + $ gem install structx + +## Usage + +### Constructor with hash table + +```ruby +StructX.new(:x, :y, :z).new(x: 1, y: 2, z: 3) #=> # +``` + +### Member declarations + +```ruby +class A < StructX + member :x + member :y + member :z +end +A.new(1, 2, 3) #=> # +``` + +### Default values + +```ruby +class B < StructX + member :x + member :y, default: 10 + member :z, default: 100 +end +B.new(1) # => # +``` + +You can set dynamic default values with proc object. + +```ruby +class B < StructX + member :x, default: lambda {$N} + member :y, default: lambda {|obj| $N+1} + member :z, default: lambda {|obj, data| $N+2} +end +$N = 1 +B.new # => # +$N = 10 +B.new # => # +``` + +### Immutable mode + +```ruby +class C < StructX + immutable true + member :x + member :y + member :z +end +orig = C.new(1, 2, 3) #=> # +updated = orig.set(x: 4, y: 5, z: 6) #=> # +orig.values #=> [1, 2, 3] +updated.values #=> [4, 5, 6] +``` + +## Documentation + +- [API Documentation](http://rubydoc.info/gems/structx) + +## License + +StructX is free software distributed under MIT license. +The following files are copied from ruby's test case, so you should keep its lisense. + +- test/ruby/1.9/test_struct.rb +- test/ruby/1.9/envutil.rb +- test/ruby/2.0/test_struct.rb +- test/ruby/2.0/envutil.rb + +## Contributing + +1. Fork it +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin my-new-feature`) +5. Create new Pull Request diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/Rakefile new file mode 100644 index 000000000..79d7fdae6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/Rakefile @@ -0,0 +1,18 @@ +require "bundler/gem_tasks" + +desc 'Test specs' +task 'test' do + sh "test/run.sh" +end + +desc 'Generate API document' +task 'html' do + sh "bundle exec yard doc -o html --hide-void-return --no-api" +end + +desc 'Show undocumented function list' +task 'html:undoc' do + sh "bundle exec yard stats --list-undoc --no-api --compact" +end + +task :default => :test diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/lib/structx.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/lib/structx.rb new file mode 100644 index 000000000..5fcf66811 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/lib/structx.rb @@ -0,0 +1,224 @@ +require "forwardablex" +require "structx/version" + +# StructX is an extension of Ruby standard Struct. The diffences are that 1) the +# constructor handles hash table as key-value pairs, 2) you can specify members +# as statements, and 3) you can set default values of member. StructX's API is +# compatible with Struct. +# +# @example Constructor with hash table +# StructX.new(:x, :y, :z).new(x: 1, y: 2, z: 3) #=> # +# @example Member sentences +# class A < StructX +# member :x +# member :y +# member :z +# end +# A.new(1, 2, 3) #=> # +# @example Default values +# class B < StructX +# member :x +# member :y, default: 10 +# member :z, default: 100 +# end +# B.new(1) # => # +class StructX + include Enumerable + + class << self + alias :orig_new :new + private :orig_new + + # Same as Struct[]. + alias :[] :new + + # Create a instance or sublcass. If this class has members, create an + # instance. The case handles hash table as key-value pairs. If this class + # has no members, create a subclass. + # + # @param args [Array or Hash] + # Same as Struct if args is Array. Consider args as key-value pairs if it is Hash. + def new(*args) + # create an instance + return orig_new(*args) if @__member__ and @__member__.keys.size > 0 + + # create subclass + Class.new(StructX).tap do |subclass| + # class name + if args.first.kind_of?(String) + const_set(args.first, subclass) + args = args.drop(1) + end + + # set members + args.each {|m| subclass.member(*m)} + + # this is according to MRI, why yield? + yield if block_given? + end + end + + # Same as Struct#members. + def members + (@__member__ ||= {}).keys + end + + # Add member into structure. + # + # @param name [Symbol] + # member name + # @param data [Hash] + # member options + def member(name, data={}) + (@__member__ ||= {})[name] = Hash.new.merge(data) # clone the data + + # define member's value reader + define_method(name) do + @value[name] + end + + # define member's value writer + define_method("%s=" % name) do |val| + @value[name] = val + end + end + + # Return default values. + # + # @return [Hash{Symbol=>Object}] + # default values + def default_values + @__member__.inject({}) do |tbl, (key, val)| + tbl.tap {|x| x[key] = val[:default] if val.has_key?(:default)} + end + end + + def immutable(b=true) + @immutable = b + end + + def immutable? + @immutable + end + + private + + def inherited(subclass) + @__member__.each {|key, data| subclass.member(key, data)} if @__member__ + subclass.instance_variable_set(:@immutable, true) if @immutable + end + end + + # almost methods are forwarded to value table + forward! :class, :members, :immutable? + forward :@value, :each, :each_pair + forward! :@value, :values, :length, :size, :hash + forward! lambda{|x| @value.values}, :each, :values_at + + alias :to_a :values + + # See Struct.new. + def initialize(*values) + if values.first.kind_of?(Hash) and values.size == 1 + @value = __build__(values.first) + else + raise ArgumentError.new("struct size differs #{values} #{members} ") if values.size > members.size + @value = __build__(members.zip(values)) + end + end + + # Same as Struct#[]. + def [](idx) + case idx + when Integer + size > idx && -size <= idx ? values[idx] : (raise IndexError.new(idx)) + when Symbol, String + members.include?(idx.to_sym) ? @value[idx.to_sym] : (raise NameError.new(idx.to_s)) + end + end + + # Same as Struct#[]. + alias :get :"[]" + + # Same as Struct#[]=. + def []=(idx, val) + case idx + when Integer + if size > idx && -size <= idx + if not(immutable?) + @value[members[idx]] = val + else + self.class.new(@value.merge(members[idx] => val)) + end + else + raise IndexError.new(idx) + end + when Symbol, String + if members.include?(idx.to_sym) + if not(immutable?) + @value[idx.to_sym] = val + else + self.class.new(@value.merge(idx.to_sym => val)) + end + else + raise NameError.new(idx.to_s) + end + end + end + + # Same as #[]=, but you can set values by hash. + def set(pairs={}) + if not(immutable?) + pairs.each {|idx, val| self[idx] = val} + return self + else + pairs.inject(self) {|obj, (idx, val)| obj.send("[]=", idx, val)} + end + end + + # Same as Struct#inspect. + def inspect + name = self.class.inspect[0] == "#" ? "" : " " + self.class.inspect + values = (@value || []).map do |key, val| + k = (key.to_s[0] == "@" ? ":" : "") + key.to_s + v = (self == val ? "#" % val : val.inspect) + "%s=%s" % [k, v] + end + "#" % [name, values.join(", ")] + end + + # Same as Struct#eql?. + def eql?(other) + self.class == other.class and @value == other.to_h + end + alias :"==" :eql? + + # Same as Struct#to_h. This method is available in Ruby 1.9 too. + def to_h + @value + end + + private + + def __build__(data) + tbl = data.inject({}) {|tbl, (m, val)| tbl.tap {|x| x[m] = val unless val.nil?}} + default_values = self.class.default_values.inject({}) do |_tbl, (key, val)| + _tbl.tap {|x| x[key] = __build_default_value__(val, data)} + end + default_values.merge(tbl) + end + + def __build_default_value__(val, data) + return val unless val.kind_of?(Proc) + + if val.arity == 1 + val.call(self) + elsif val.arity > 1 + val.call(self, data) + elsif val.arity < 0 + val.call(self, data) + else + val.call + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/lib/structx/version.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/lib/structx/version.rb new file mode 100644 index 000000000..da49e0434 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/lib/structx/version.rb @@ -0,0 +1,4 @@ +class StructX + # version of StructX + VERSION = "0.1.3" +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/structx.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/structx.gemspec new file mode 100644 index 000000000..1ee507cb4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/structx.gemspec @@ -0,0 +1,29 @@ +# -*- ruby -*- +# coding: utf-8 +lib = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'structx/version' + +Gem::Specification.new do |spec| + spec.name = "structx" + spec.version = StructX::VERSION + spec.authors = ["Keita Yamaguchi"] + spec.email = ["keita.yamaguchi@gmail.com"] + spec.description = "sturctx is a Ruby library that extends standard Struct" + spec.summary = "sturctx is a Ruby library that extends standard Struct" + spec.homepage = "https://github.com/keita/structx" + spec.license = "MIT" + + spec.files = `git ls-files`.split($/) + spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) } + spec.test_files = spec.files.grep(%r{^(test|spec|features)/}) + spec.require_paths = ["lib"] + + spec.add_dependency "forwardablex" + + spec.add_development_dependency "bundler", "~> 1.3" + spec.add_development_dependency "rake" + spec.add_development_dependency "bacon" + spec.add_development_dependency "yard" + spec.add_development_dependency "ruby-version" +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/test/compatibility-test.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/test/compatibility-test.rb new file mode 100644 index 000000000..478ba0752 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/test/compatibility-test.rb @@ -0,0 +1,32 @@ +require "structx" +require "ruby-version" + +def patch(code) + ## Struct -> StructX + code = code.gsub("Struct", "StructX") + ## clear require_relative + code = code.gsub(/^require_relative.*$/, "") + ## modify error message for test_struct_subclass + # StructX can handle security error but the message is different + code = code.gsub("Insecure: can't modify \#\{st}::S", "Insecure: can't modify hash") +end + +def load_test(target) + require_relative "../test/ruby/#{target}/envutil" + path = File.join(File.dirname(__FILE__), "ruby", target, "test_struct.rb") + eval patch(File.read(path)) +end + +if Ruby::Engine::NAME == "ruby" + if Ruby::Version >= "1.9" and Ruby::Version < "2.0" + load_test("1.9") + end + + if Ruby::Version >= "2.0" + load_test("2.0") + end +else + puts "We cannot run compatibility test with jruby and rbx." + puts "Related to Struct, these VMs are not compatible with MRI." +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/test/ruby/1.9/envutil.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/test/ruby/1.9/envutil.rb new file mode 100644 index 000000000..73f0101ac --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/test/ruby/1.9/envutil.rb @@ -0,0 +1,212 @@ +require "open3" +require "timeout" + +module EnvUtil + def rubybin + unless ENV["RUBYOPT"] + + end + if ruby = ENV["RUBY"] + return ruby + end + ruby = "ruby" + rubyexe = ruby+".exe" + 3.times do + if File.exist? ruby and File.executable? ruby and !File.directory? ruby + return File.expand_path(ruby) + end + if File.exist? rubyexe and File.executable? rubyexe + return File.expand_path(rubyexe) + end + ruby = File.join("..", ruby) + end + if defined?(RbConfig.ruby) + RbConfig.ruby + else + "ruby" + end + end + module_function :rubybin + + LANG_ENVS = %w"LANG LC_ALL LC_CTYPE" + + def invoke_ruby(args, stdin_data="", capture_stdout=false, capture_stderr=false, opt={}) + in_c, in_p = IO.pipe + out_p, out_c = IO.pipe if capture_stdout + err_p, err_c = IO.pipe if capture_stderr && capture_stderr != :merge_to_stdout + opt = opt.dup + opt[:in] = in_c + opt[:out] = out_c if capture_stdout + opt[:err] = capture_stderr == :merge_to_stdout ? out_c : err_c if capture_stderr + if enc = opt.delete(:encoding) + out_p.set_encoding(enc) if out_p + err_p.set_encoding(enc) if err_p + end + timeout = opt.delete(:timeout) || 10 + c = "C" + child_env = {} + LANG_ENVS.each {|lc| child_env[lc] = c} + if Array === args and Hash === args.first + child_env.update(args.shift) + end + args = [args] if args.kind_of?(String) + pid = spawn(child_env, EnvUtil.rubybin, *args, opt) + in_c.close + out_c.close if capture_stdout + err_c.close if capture_stderr && capture_stderr != :merge_to_stdout + if block_given? + return yield in_p, out_p, err_p, pid + else + th_stdout = Thread.new { out_p.read } if capture_stdout + th_stderr = Thread.new { err_p.read } if capture_stderr && capture_stderr != :merge_to_stdout + in_p.write stdin_data.to_str + in_p.close + if (!th_stdout || th_stdout.join(timeout)) && (!th_stderr || th_stderr.join(timeout)) + stdout = th_stdout.value if capture_stdout + stderr = th_stderr.value if capture_stderr && capture_stderr != :merge_to_stdout + else + raise Timeout::Error + end + out_p.close if capture_stdout + err_p.close if capture_stderr && capture_stderr != :merge_to_stdout + Process.wait pid + status = $? + return stdout, stderr, status + end + ensure + [in_c, in_p, out_c, out_p, err_c, err_p].each do |io| + io.close if io && !io.closed? + end + [th_stdout, th_stderr].each do |th| + (th.kill; th.join) if th + end + end + module_function :invoke_ruby + + alias rubyexec invoke_ruby + class << self + alias rubyexec invoke_ruby + end + + def verbose_warning + class << (stderr = "") + alias write << + end + stderr, $stderr, verbose, $VERBOSE = $stderr, stderr, $VERBOSE, true + yield stderr + ensure + stderr, $stderr, $VERBOSE = $stderr, stderr, verbose + return stderr + end + module_function :verbose_warning + + def suppress_warning + verbose, $VERBOSE = $VERBOSE, nil + yield + ensure + $VERBOSE = verbose + end + module_function :suppress_warning + + def under_gc_stress + stress, GC.stress = GC.stress, true + yield + ensure + GC.stress = stress + end + module_function :under_gc_stress +end + +module Test + module Unit + module Assertions + public + def assert_normal_exit(testsrc, message = '', opt = {}) + if opt.include?(:child_env) + opt = opt.dup + child_env = [opt.delete(:child_env)] || [] + else + child_env = [] + end + out, _, status = EnvUtil.invoke_ruby(child_env + %W'-W0', testsrc, true, :merge_to_stdout, opt) + pid = status.pid + faildesc = proc do + signo = status.termsig + signame = Signal.list.invert[signo] + sigdesc = "signal #{signo}" + if signame + sigdesc = "SIG#{signame} (#{sigdesc})" + end + if status.coredump? + sigdesc << " (core dumped)" + end + full_message = '' + if !message.empty? + full_message << message << "\n" + end + full_message << "pid #{pid} killed by #{sigdesc}" + if !out.empty? + out << "\n" if /\n\z/ !~ out + full_message << "\n#{out.gsub(/^/, '| ')}" + end + full_message + end + assert !status.signaled?, faildesc + end + + def assert_in_out_err(args, test_stdin = "", test_stdout = [], test_stderr = [], message = nil, opt={}) + stdout, stderr, status = EnvUtil.invoke_ruby(args, test_stdin, true, true, opt) + if block_given? + yield(stdout.lines.map {|l| l.chomp }, stderr.lines.map {|l| l.chomp }) + else + if test_stdout.is_a?(Regexp) + assert_match(test_stdout, stdout, message) + else + assert_equal(test_stdout, stdout.lines.map {|l| l.chomp }, message) + end + if test_stderr.is_a?(Regexp) + assert_match(test_stderr, stderr, message) + else + assert_equal(test_stderr, stderr.lines.map {|l| l.chomp }, message) + end + status + end + end + + def assert_ruby_status(args, test_stdin="", message=nil, opt={}) + _, _, status = EnvUtil.invoke_ruby(args, test_stdin, false, false, opt) + m = message ? "#{message} (#{status.inspect})" : "ruby exit status is not success: #{status.inspect}" + assert(status.success?, m) + end + + def assert_warn(msg) + stderr = EnvUtil.verbose_warning { yield } + assert(msg === stderr, "warning message #{stderr.inspect} is expected to match #{msg.inspect}") + end + + + def assert_is_minus_zero(f) + assert(1.0/f == -Float::INFINITY, "#{f} is not -0.0") + end + end + end +end + +begin + require 'rbconfig' +rescue LoadError +else + module RbConfig + @ruby = EnvUtil.rubybin + class << self + undef ruby if method_defined?(:ruby) + attr_reader :ruby + end + dir = File.dirname(ruby) + name = File.basename(ruby, CONFIG['EXEEXT']) + CONFIG['bindir'] = dir + CONFIG['ruby_install_name'] = name + CONFIG['RUBY_INSTALL_NAME'] = name + Gem::ConfigMap[:bindir] = dir if defined?(Gem::ConfigMap) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/test/ruby/1.9/test_struct.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/test/ruby/1.9/test_struct.rb new file mode 100644 index 000000000..49dcdb45b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/test/ruby/1.9/test_struct.rb @@ -0,0 +1,252 @@ +require 'test/unit' +require 'timeout' + +class TestStruct < Test::Unit::TestCase + def test_struct + struct_test = Struct.new("Test", :foo, :bar) + assert_equal(Struct::Test, struct_test) + + test = struct_test.new(1, 2) + assert_equal(1, test.foo) + assert_equal(2, test.bar) + assert_equal(1, test[0]) + assert_equal(2, test[1]) + + a, b = test.to_a + assert_equal(1, a) + assert_equal(2, b) + + test[0] = 22 + assert_equal(22, test.foo) + + test.bar = 47 + assert_equal(47, test.bar) + end + + # [ruby-dev:26247] more than 10 struct members causes segmentation fault + def test_morethan10members + list = %w( a b c d e f g h i j k l m n o p ) + until list.empty? + c = Struct.new(* list.map {|ch| ch.intern }).new + list.each do |ch| + c.__send__(ch) + end + list.pop + end + end + + def test_small_structs + names = [:a, :b, :c, :d] + 1.upto(4) {|n| + fields = names[0, n] + klass = Struct.new(*fields) + o = klass.new(*(0...n).to_a) + fields.each_with_index {|name, i| + assert_equal(i, o[name]) + } + o = klass.new(*(0...n).to_a.reverse) + fields.each_with_index {|name, i| + assert_equal(n-i-1, o[name]) + } + } + end + + def test_inherit + klass = Struct.new(:a) + klass2 = Class.new(klass) + o = klass2.new(1) + assert_equal(1, o.a) + end + + def test_members + klass = Struct.new(:a) + o = klass.new(1) + assert_equal([:a], klass.members) + assert_equal([:a], o.members) + end + + def test_ref + klass = Struct.new(:a) + o = klass.new(1) + assert_equal(1, o[:a]) + assert_raise(NameError) { o[:b] } + end + + def test_modify + klass = Struct.new(:a) + o = klass.new(1) + assert_raise(SecurityError) do + Thread.new do + $SAFE = 4 + o.a = 2 + end.value + end + end + + def test_set + klass = Struct.new(:a) + o = klass.new(1) + o[:a] = 2 + assert_equal(2, o[:a]) + assert_raise(NameError) { o[:b] = 3 } + end + + def test_struct_new + assert_raise(NameError) { Struct.new("foo") } + assert_nothing_raised { Struct.new("Foo") } + Struct.instance_eval { remove_const(:Foo) } + assert_nothing_raised { Struct.new(:a) { } } + assert_raise(RuntimeError) { Struct.new(:a) { raise } } + + assert_equal([:utime, :stime, :cutime, :cstime], Process.times.members) + end + + def test_initialize + klass = Struct.new(:a) + assert_raise(ArgumentError) { klass.new(1, 2) } + end + + def test_each + klass = Struct.new(:a, :b) + o = klass.new(1, 2) + assert_equal([1, 2], o.each.to_a) + end + + def test_each_pair + klass = Struct.new(:a, :b) + o = klass.new(1, 2) + assert_equal([[:a, 1], [:b, 2]], o.each_pair.to_a) + end + + def test_inspect + klass = Struct.new(:a) + o = klass.new(1) + assert_equal("#", o.inspect) + o.a = o + assert_match(/^#:...>>$/, o.inspect) + + Struct.new("Foo", :a) + o = Struct::Foo.new(1) + assert_equal("#", o.inspect) + Struct.instance_eval { remove_const(:Foo) } + + klass = Struct.new(:a, :b) + o = klass.new(1, 2) + assert_equal("#", o.inspect) + + klass = Struct.new(:@a) + o = klass.new(1) + assert_equal("#", o.inspect) + end + + def test_init_copy + klass = Struct.new(:a) + o = klass.new(1) + assert_equal(o, o.dup) + end + + def test_aref + klass = Struct.new(:a) + o = klass.new(1) + assert_equal(1, o[0]) + assert_raise(IndexError) { o[-2] } + assert_raise(IndexError) { o[1] } + end + + def test_aset + klass = Struct.new(:a) + o = klass.new(1) + o[0] = 2 + assert_equal(2, o[:a]) + assert_raise(IndexError) { o[-2] = 3 } + assert_raise(IndexError) { o[1] = 3 } + end + + def test_values_at + klass = Struct.new(:a, :b, :c, :d, :e, :f) + o = klass.new(1, 2, 3, 4, 5, 6) + assert_equal([2, 4, 6], o.values_at(1, 3, 5)) + assert_equal([2, 3, 4, 3, 4, 5], o.values_at(1..3, 2...5)) + end + + def test_select + klass = Struct.new(:a, :b, :c, :d, :e, :f) + o = klass.new(1, 2, 3, 4, 5, 6) + assert_equal([1, 3, 5], o.select {|v| v % 2 != 0 }) + assert_raise(ArgumentError) { o.select(1) } + end + + def test_equal + klass1 = Struct.new(:a) + klass2 = Struct.new(:a, :b) + o1 = klass1.new(1) + o2 = klass1.new(1) + o3 = klass2.new(1) + assert(o1.==(o2)) + assert(o1 != o3) + end + + def test_hash + klass = Struct.new(:a) + o = klass.new(1) + assert(o.hash.is_a?(Fixnum)) + end + + def test_eql + klass1 = Struct.new(:a) + klass2 = Struct.new(:a, :b) + o1 = klass1.new(1) + o2 = klass1.new(1) + o3 = klass2.new(1) + assert(o1.eql?(o2)) + assert(!(o1.eql?(o3))) + end + + def test_size + klass = Struct.new(:a) + o = klass.new(1) + assert_equal(1, o.size) + end + + def test_error + assert_raise(TypeError){ + Struct.new(0) + } + end + + def test_nonascii + struct_test = Struct.new("R\u{e9}sum\u{e9}", :"r\u{e9}sum\u{e9}") + assert_equal(Struct.const_get("R\u{e9}sum\u{e9}"), struct_test, '[ruby-core:24849]') + a = struct_test.new(42) + assert_equal("#", a.inspect, '[ruby-core:24849]') + end + + def test_comparison_when_recursive + klass1 = Struct.new(:a, :b, :c) + + x = klass1.new(1, 2, nil); x.c = x + y = klass1.new(1, 2, nil); y.c = y + Timeout.timeout(1) { + assert x == y + assert x.eql? y + } + + z = klass1.new(:something, :other, nil); z.c = z + Timeout.timeout(1) { + assert x != z + assert !x.eql?(z) + } + + x.c = y; y.c = x + Timeout.timeout(1) { + assert x == y + assert x.eql?(y) + } + + x.c = z; z.c = x + Timeout.timeout(1) { + assert x != z + assert !x.eql?(z) + } + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/test/ruby/2.0/envutil.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/test/ruby/2.0/envutil.rb new file mode 100644 index 000000000..77ecd522f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/test/ruby/2.0/envutil.rb @@ -0,0 +1,362 @@ +# -*- coding: us-ascii -*- +require "open3" +require "timeout" + +module EnvUtil + def rubybin + unless ENV["RUBYOPT"] + + end + if ruby = ENV["RUBY"] + return ruby + end + ruby = "ruby" + rubyexe = ruby+".exe" + 3.times do + if File.exist? ruby and File.executable? ruby and !File.directory? ruby + return File.expand_path(ruby) + end + if File.exist? rubyexe and File.executable? rubyexe + return File.expand_path(rubyexe) + end + ruby = File.join("..", ruby) + end + if defined?(RbConfig.ruby) + RbConfig.ruby + else + "ruby" + end + end + module_function :rubybin + + LANG_ENVS = %w"LANG LC_ALL LC_CTYPE" + + def invoke_ruby(args, stdin_data="", capture_stdout=false, capture_stderr=false, opt={}) + in_c, in_p = IO.pipe + out_p, out_c = IO.pipe if capture_stdout + err_p, err_c = IO.pipe if capture_stderr && capture_stderr != :merge_to_stdout + opt = opt.dup + opt[:in] = in_c + opt[:out] = out_c if capture_stdout + opt[:err] = capture_stderr == :merge_to_stdout ? out_c : err_c if capture_stderr + if enc = opt.delete(:encoding) + out_p.set_encoding(enc) if out_p + err_p.set_encoding(enc) if err_p + end + timeout = opt.delete(:timeout) || 10 + reprieve = opt.delete(:reprieve) || 1 + c = "C" + child_env = {} + LANG_ENVS.each {|lc| child_env[lc] = c} + if Array === args and Hash === args.first + child_env.update(args.shift) + end + args = [args] if args.kind_of?(String) + pid = spawn(child_env, EnvUtil.rubybin, *args, opt) + in_c.close + out_c.close if capture_stdout + err_c.close if capture_stderr && capture_stderr != :merge_to_stdout + if block_given? + return yield in_p, out_p, err_p, pid + else + th_stdout = Thread.new { out_p.read } if capture_stdout + th_stderr = Thread.new { err_p.read } if capture_stderr && capture_stderr != :merge_to_stdout + in_p.write stdin_data.to_str + in_p.close + if (!th_stdout || th_stdout.join(timeout)) && (!th_stderr || th_stderr.join(timeout)) + stdout = th_stdout.value if capture_stdout + stderr = th_stderr.value if capture_stderr && capture_stderr != :merge_to_stdout + else + signal = /mswin|mingw/ =~ RUBY_PLATFORM ? :KILL : :TERM + begin + Process.kill signal, pid + rescue Errno::ESRCH + break + else + end until signal == :KILL or (sleep reprieve; signal = :KILL; false) + raise Timeout::Error + end + out_p.close if capture_stdout + err_p.close if capture_stderr && capture_stderr != :merge_to_stdout + Process.wait pid + status = $? + return stdout, stderr, status + end + ensure + [th_stdout, th_stderr].each do |th| + th.kill if th + end + [in_c, in_p, out_c, out_p, err_c, err_p].each do |io| + io.close if io && !io.closed? + end + [th_stdout, th_stderr].each do |th| + th.join if th + end + end + module_function :invoke_ruby + + alias rubyexec invoke_ruby + class << self + alias rubyexec invoke_ruby + end + + def verbose_warning + class << (stderr = "") + alias write << + end + stderr, $stderr, verbose, $VERBOSE = $stderr, stderr, $VERBOSE, true + yield stderr + return $stderr + ensure + stderr, $stderr, $VERBOSE = $stderr, stderr, verbose + end + module_function :verbose_warning + + def suppress_warning + verbose, $VERBOSE = $VERBOSE, nil + yield + ensure + $VERBOSE = verbose + end + module_function :suppress_warning + + def under_gc_stress + stress, GC.stress = GC.stress, true + yield + ensure + GC.stress = stress + end + module_function :under_gc_stress +end + +module Test + module Unit + module Assertions + public + def assert_valid_syntax(code, fname = caller_locations(1, 1)[0], mesg = fname.to_s) + code = code.dup.force_encoding("ascii-8bit") + code.sub!(/\A(?:\xef\xbb\xbf)?(\s*\#.*$)*(\n)?/n) { + "#$&#{"\n" if $1 && !$2}BEGIN{throw tag, :ok}\n" + } + code.force_encoding("us-ascii") + verbose, $VERBOSE = $VERBOSE, nil + yield if defined?(yield) + case + when Array === fname + fname, line = *fname + when defined?(fname.path) && defined?(fname.lineno) + fname, line = fname.path, fname.lineno + else + line = 0 + end + assert_nothing_raised(SyntaxError, mesg) do + assert_equal(:ok, catch {|tag| eval(code, binding, fname, line)}, mesg) + end + ensure + $VERBOSE = verbose + end + + def assert_syntax_error(code, error, fname = caller_locations(1, 1)[0], mesg = fname.to_s) + code = code.dup.force_encoding("ascii-8bit") + code.sub!(/\A(?:\xef\xbb\xbf)?(\s*\#.*$)*(\n)?/n) { + "#$&#{"\n" if $1 && !$2}BEGIN{throw tag, :ng}\n" + } + code.force_encoding("us-ascii") + verbose, $VERBOSE = $VERBOSE, nil + yield if defined?(yield) + case + when Array === fname + fname, line = *fname + when defined?(fname.path) && defined?(fname.lineno) + fname, line = fname.path, fname.lineno + else + line = 0 + end + e = assert_raise(SyntaxError, mesg) do + catch {|tag| eval(code, binding, fname, line)} + end + assert_match(error, e.message, mesg) + ensure + $VERBOSE = verbose + end + + def assert_normal_exit(testsrc, message = '', opt = {}) + assert_valid_syntax(testsrc, caller_locations(1, 1)[0]) + if opt.include?(:child_env) + opt = opt.dup + child_env = [opt.delete(:child_env)] || [] + else + child_env = [] + end + out, _, status = EnvUtil.invoke_ruby(child_env + %W'-W0', testsrc, true, :merge_to_stdout, opt) + assert !status.signaled?, FailDesc[status, message, out] + end + + FailDesc = proc do |status, message = "", out = ""| + pid = status.pid + faildesc = proc do + signo = status.termsig + signame = Signal.list.invert[signo] + sigdesc = "signal #{signo}" + if signame + sigdesc = "SIG#{signame} (#{sigdesc})" + end + if status.coredump? + sigdesc << " (core dumped)" + end + full_message = '' + if message and !message.empty? + full_message << message << "\n" + end + full_message << "pid #{pid} killed by #{sigdesc}" + if out and !out.empty? + full_message << "\n#{out.gsub(/^/, '| ')}" + full_message << "\n" if /\n\z/ !~ full_message + end + full_message + end + faildesc + end + + def assert_in_out_err(args, test_stdin = "", test_stdout = [], test_stderr = [], message = nil, opt={}) + stdout, stderr, status = EnvUtil.invoke_ruby(args, test_stdin, true, true, opt) + if block_given? + raise "test_stdout ignored, use block only or without block" if test_stdout != [] + raise "test_stderr ignored, use block only or without block" if test_stderr != [] + yield(stdout.lines.map {|l| l.chomp }, stderr.lines.map {|l| l.chomp }, status) + else + errs = [] + [[test_stdout, stdout], [test_stderr, stderr]].each do |exp, act| + begin + if exp.is_a?(Regexp) + assert_match(exp, act, message) + else + assert_equal(exp, act.lines.map {|l| l.chomp }, message) + end + rescue MiniTest::Assertion => e + errs << e.message + message = nil + end + end + raise MiniTest::Assertion, errs.join("\n---\n") unless errs.empty? + status + end + end + + def assert_ruby_status(args, test_stdin="", message=nil, opt={}) + out, _, status = EnvUtil.invoke_ruby(args, test_stdin, true, :merge_to_stdout, opt) + message ||= "ruby exit status is not success:" + assert(status.success?, FailDesc[status, message, out]) + end + + ABORT_SIGNALS = Signal.list.values_at(*%w"ILL ABRT BUS SEGV") + + def assert_separately(args, file = nil, line = nil, src, **opt) + unless file and line + loc, = caller_locations(1,1) + file ||= loc.path + line ||= loc.lineno + end + src = <", o.inspect) + o.a = o + assert_match(/^#:...>>$/, o.inspect) + + Struct.new("Foo", :a) + o = Struct::Foo.new(1) + assert_equal("#", o.inspect) + Struct.instance_eval { remove_const(:Foo) } + + klass = Struct.new(:a, :b) + o = klass.new(1, 2) + assert_equal("#", o.inspect) + + klass = Struct.new(:@a) + o = klass.new(1) + assert_equal("#", o.inspect) + end + + def test_init_copy + klass = Struct.new(:a) + o = klass.new(1) + assert_equal(o, o.dup) + end + + def test_aref + klass = Struct.new(:a) + o = klass.new(1) + assert_equal(1, o[0]) + assert_raise(IndexError) { o[-2] } + assert_raise(IndexError) { o[1] } + end + + def test_aset + klass = Struct.new(:a) + o = klass.new(1) + o[0] = 2 + assert_equal(2, o[:a]) + assert_raise(IndexError) { o[-2] = 3 } + assert_raise(IndexError) { o[1] = 3 } + end + + def test_values_at + klass = Struct.new(:a, :b, :c, :d, :e, :f) + o = klass.new(1, 2, 3, 4, 5, 6) + assert_equal([2, 4, 6], o.values_at(1, 3, 5)) + assert_equal([2, 3, 4, 3, 4, 5], o.values_at(1..3, 2...5)) + end + + def test_select + klass = Struct.new(:a, :b, :c, :d, :e, :f) + o = klass.new(1, 2, 3, 4, 5, 6) + assert_equal([1, 3, 5], o.select {|v| v % 2 != 0 }) + assert_raise(ArgumentError) { o.select(1) } + end + + def test_equal + klass1 = Struct.new(:a) + klass2 = Struct.new(:a, :b) + o1 = klass1.new(1) + o2 = klass1.new(1) + o3 = klass2.new(1) + assert(o1.==(o2)) + assert(o1 != o3) + end + + def test_hash + klass = Struct.new(:a) + o = klass.new(1) + assert(o.hash.is_a?(Fixnum)) + end + + def test_eql + klass1 = Struct.new(:a) + klass2 = Struct.new(:a, :b) + o1 = klass1.new(1) + o2 = klass1.new(1) + o3 = klass2.new(1) + assert(o1.eql?(o2)) + assert(!(o1.eql?(o3))) + end + + def test_size + klass = Struct.new(:a) + o = klass.new(1) + assert_equal(1, o.size) + end + + def test_error + assert_raise(TypeError){ + Struct.new(0) + } + end + + def test_nonascii + struct_test = Struct.new("R\u{e9}sum\u{e9}", :"r\u{e9}sum\u{e9}") + assert_equal(Struct.const_get("R\u{e9}sum\u{e9}"), struct_test, '[ruby-core:24849]') + a = struct_test.new(42) + assert_equal("#", a.inspect, '[ruby-core:24849]') + end + + def test_junk + struct_test = Struct.new("Foo", "a\000") + o = struct_test.new(1) + assert_equal(1, o.send("a\000")) + Struct.instance_eval { remove_const(:Foo) } + end + + def test_comparison_when_recursive + klass1 = Struct.new(:a, :b, :c) + + x = klass1.new(1, 2, nil); x.c = x + y = klass1.new(1, 2, nil); y.c = y + Timeout.timeout(1) { + assert x == y + assert x.eql? y + } + + z = klass1.new(:something, :other, nil); z.c = z + Timeout.timeout(1) { + assert x != z + assert !x.eql?(z) + } + + x.c = y; y.c = x + Timeout.timeout(1) { + assert x == y + assert x.eql?(y) + } + + x.c = z; z.c = x + Timeout.timeout(1) { + assert x != z + assert !x.eql?(z) + } + end + + def test_struct_subclass + bug5036 = '[ruby-dev:44122]' + st = Class.new(Struct) + s = st.new("S", :m).new + error = assert_raise(SecurityError) do + proc do + $SAFE = 4 + s.m = 1 + end.call + end + assert_equal("Insecure: can't modify #{st}::S", error.message, bug5036) + end + + def test_to_h + klass = Struct.new(:a, :b, :c, :d, :e, :f) + o = klass.new(1, 2, 3, 4, 5, 6) + assert_equal({a:1, b:2, c:3, d:4, e:5, f:6}, o.to_h) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/test/run.sh b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/test/run.sh new file mode 100755 index 000000000..1b13f6e8e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/test/run.sh @@ -0,0 +1,12 @@ +#!/bin/bash + +bundle exec bacon -rsimplecov -I lib test/spec_*.rb +BACON=$? + +bundle exec ruby -I lib test/compatibility-test.rb +COMPAT=$? + +if [ ${BACON} -ne 0 ] || [ ${COMPAT} -ne 0 ] +then + exit 1 +fi diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/test/spec_structx.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/test/spec_structx.rb new file mode 100644 index 000000000..30f907b2a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/structx-0.1.3/test/spec_structx.rb @@ -0,0 +1,232 @@ +require "structx" + +class A < StructX + member :x + member :y, default: 10 + member :z, type: Integer, default: 100 +end + +class B < StructX + member :p0, default: lambda { $N } + member :p1, default: lambda {|obj| $N + 1} + member :p2, default: lambda {|obj, data| $N +2} +end + +describe "StructX" do + describe "StructX.new(:x, :y, :z)" do + before do + @class = StructX.new(:x, :y, :z) + @immutable = Class.new(@class).tap {|subclass| subclass.immutable} + end + + it "should have 3 members" do + @class.members.size.should == 3 + end + + it "should create from StructX subclass" do + should.not.raise do + Class.new(StructX).new(:x).new(1) + end + end + + it "should inherit members" do + Class.new(@class).members.should == [:x, :y, :z] + end + + it "should create an instance" do + @class.new(1, 2, 3).tap do |obj| + obj.x.should == 1 + obj.y.should == 2 + obj.z.should == 3 + end + @class.new(true, false, nil).tap do |obj| + obj.values.should == [true, false] + end + end + + it "should create an instance with key" do + @class.new(x: 1, y: 2, z: 3).tap do |obj| + obj.x.should == 1 + obj.y.should == 2 + obj.z.should == 3 + end + end + + it "should get members" do + @class.members.tap do |m| + m.should.include(:x) + m.should.include(:y) + m.should.include(:z) + end + end + + it "should raise ArgumentError when number of values are greater than number of members" do + should.raise(ArgumentError) do + @class.new(1, 2, 3, 4) + end + end + + it "should create an instance with #[]" do + @class[1, 2, 3].tap do |obj| + obj.x.should == 1 + obj.y.should == 2 + obj.z.should == 3 + end + end + + it "should equal" do + @class.new(1, 2, 3).should == @class.new(1, 2, 3) + end + + it "should write and get member's value" do + @class.new(1, 2, 3).tap do |obj| + obj.x = 2 + obj.y = 3 + obj.z = 4 + obj.x.should == 2 + obj.y.should == 3 + obj.z.should == 4 + end + end + + it "should get member's value with index" do + @class.new(1, 2, 3).tap do |x| + x[0].should == 1 + x[1].should == 2 + x[2].should == 3 + should.raise(IndexError) { x[-4] } + should.raise(IndexError) { x[3] } + x[:x].should == 1 + x[:y].should == 2 + x[:z].should == 3 + should.raise(NameError) { x[:a] } + # by #get + x.get(:x).should == 1 + x.get(:y).should == 2 + x.get(:z).should == 3 + end + end + + it "should set member's value with index" do + @class.new(1, 2, 3).tap do |x| + x[0] = 2 + x[1] = 3 + x[2] = 4 + x[0].should == 2 + x[1].should == 3 + x[2].should == 4 + should.raise(IndexError) { x[-4] = 1 } + should.raise(IndexError) { x[3] = 1 } + x[:x] = 3 + x[:y] = 4 + x[:z] = 5 + x[:x].should == 3 + x[:y].should == 4 + x[:z].should == 5 + should.raise(NameError) { x[:a] = 1} + end + # test for #set + @class.new(1, 2, 3).tap do |x| + x.set(x: 4, y: 5, z: 6) + x.values.should == [4, 5, 6] + end + + # immutable tests + orig = @immutable.new(1, 2, 3) + orig.should.kind_of StructX + orig.values.should == [1, 2, 3] + updated = orig.set(x: 4, y: 5, z: 6) + updated.should.kind_of StructX + updated.values.should == [4, 5, 6] + orig.values.should == [1, 2, 3] + end + + it "should iterate values" do + vals = [] + @class.new(1, 2, 3).tap{|x| x.each {|val| vals << val}; vals.should == x.values} + end + + it "should iterate pairs of key and value" do + vals = [] + @class.new(1, 2, 3).tap{|x| x.each_pair {|k, v| vals << [k, v]}; vals.should == x.to_h.to_a} + end + + it "should get size" do + @class.new(1, 2, 3).size.should == 3 + end + + it "should get members as strings" do + @class.new.members.should == [:x, :y, :z] + end + + it "should select" do + @class.new(1, 2, 3).select{|i| i.odd?}.should == [1, 3] + end + + it "should get values" do + @class.new(1, 2, 3).values.should == [1, 2, 3] + end + + it "should get values at" do + @class.new(1, 2, 3).values_at(0..1).should == [1, 2] + end + end + + StructX.new("TestName", :x, :y) + + describe 'StructX.new("TestName", :x, :y)' do + it "should have 2 members" do + StructX::TestName.members.size.should == 2 + end + + it "should create class" do + should.not.raise {StructX::TestName} + end + + it "should get values" do + StructX::TestName.new(1, 2).tap do |obj| + obj.x.should == 1 + obj.y.should == 2 + end + end + end + + describe "A < StructX" do + it "should have 3 members" do + A.members.size.should == 3 + end + + it "should get members" do + A.new(x: 1, y: 2, z: 3).tap do |obj| + obj.x.should == 1 + obj.y.should == 2 + obj.z.should == 3 + end + end + + it "should get default value" do + A.new(1).tap do |obj| + obj.x.should == 1 + obj.y.should == 10 + obj.z.should == 100 + end + A.new.tap do |obj| + obj.x.should == nil + obj.y.should == 10 + obj.z.should == 100 + end + end + end + + describe "B < StructX" do + it "should get default value" do + $N = 1 + obj1 = B.new + $N = 10 + obj2 = B.new + obj1.values.should == [1, 2, 3] + obj2.values.should == [10, 11, 12] + end + end +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/CHANGES b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/CHANGES new file mode 100644 index 000000000..6acbcc16a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/CHANGES @@ -0,0 +1,182 @@ +== 0.7.2 - 5-Sep-2015 +* Replaced a global array with a constant in the Linux version. Thanks go + to Yorick Peterse for the patch. +* Added method comments back to the Unix version. +* Added a sys-cpu.rb stub file for your convenience. +* This gem is now signed. + +== 0.7.1 - 2-May-2013 +* Added a workaround for a win32ole bug in the Windows version. +* Reorganized code so that there is now a single gem rather than three + separate platform gems. +* Updated test-unit dependency which let me simplify the test files a bit. + +== 0.7.0 - 14-Dec-2011 +* Code base now uses FFI. However, HP-UX is not currently supported. + HP-UX users should continue to use the 0.6.x version. Note that + the code base remains unchanged on Linux and Windows. +* The cpu_type method has been replaced with the architecture method + on Solaris to keep the interface more in line with other platforms. +* The type method has been changed to cpu_type on Windows. +* Some Rakefile and test suite updates. + +== 0.6.4 - 27-Sep-2011 +* The CPU.freq method now works on OSX. +* The CPU.model method on OSX has been altered. Previously it + returned the machine model. However, the information is limited. +* Fixed a couple unused variable warnings for the BSD/OSX code. +* The Linux and Windows gems now have a 'universal' architecture. +* Refactored the clean task in the Rakefile. + +== 0.6.3 - 9-Oct-2010 +* Fixed a bug in the install.rb file and refactored it a bit. Thanks go + to Di-an Jan for the spot. Note, however, that this file will eventually + be removed and/or integrated into the Linux source file. +* Fixed the example Rake task, and refactored some of the other tasks. +* Fixed and updated the CPU.architecture method on MS Windows to handle IA64 + and x64 architectures. + +== 0.6.2 - 1-Jan-2010 +* Fixed a bug in the cpu_freq function (which would only be noticed on + certain platforms in cases where the CPU.freq method failed). Thanks + go to Edho P Arief for the spot. +* Explicitly add sys/param.h on OpenBSD, and default to the HW_MODEL mib + because HW_MACHINE does not exist. Thanks go to Edho P Arief for the patch. +* Updated my support notes. In short I will support 1.8.6 and 1.9.x. I will + not support any 1.8.x branch later than 1.8.6. +* Removed redundant information in the various .txt files that is already + covered in the README file. +* Test files renamed. +* Added test-unit 2.x as a development dependency. + +== 0.6.1 - 4-Jan-2009 +* Fix for OS X 10.5.x. Thanks go to Victor Costan for the spot and the patch. +* Updated the gemspec and some other minor changes. +* On MS Windows the impersonation level is now explicitly set to 'impersonate' + to avoid issues where systems might be using an older version of WMI. + +== 0.6.0 - 26-Apr-2007 +* Added support for most BSD flavors, including OS X. The freebsd.c file is + now just bsd.c. +* The CPU.type method for Solaris has been changed to CPU.cpu_type to avoid + conflicting with the Object.type method. +* Added a Rakefile. There are now tasks for building, testing and installing, + among other things. Run 'rake -T' to check your options. +* Many internal directory layout changes - C source files are now under the + 'ext' directory. +* Improved RDoc comments in the C source files. +* Changed CPUError to CPU::Error. + +== 0.5.5 - 17-Nov-2006 +* Fixed a bug in the Linux version where there could be a key but no + associated value, causing a String#strip! call to fail. Now the value is + simply left at nil. +* Refactored the CPU.processors method on Linux, including the removal of '?' + from the CPUStruct members for the boolean methods (Ruby doesn't like them). +* Minor tweaks and updates to the documentation, including the README. +* Modified the gemspec so that it sets the platform properly for Linux + and Windows. + +== 0.5.4 - 12-Jul-2006 +* Added a gemspec (and a gem on RubyForge). +* The CPU.architecture method on HP-UX now returns nil if it cannot be + determined instead of "Unknown" for consistency with the other + platforms. +* Inlined the RDoc and made some minor cosmetic source code changes. + +== 0.5.3 - 4-May-2006 +* Fixed in a bug in the Solaris version where CPU.load_avg returned bad values + when compiled in 64 bit mode. Thanks go to James Hranicky for the spot and + both James Hranicky and Peter Tribble (via comp.unix.solaris) for patches. +* Made some modifications to the test suite. You know longer need to know + which test suite to run. All platforms now use 'ts_all.rb', which will run + the appropriate test case behind the scenes. + +== 0.5.2 - 24-Jun-2005 +* Bug fixed on Linux where empty lines could cause problems. This affected + both the install.rb and linux.rb files, though it only seems to have been + an issue on the 2.6+ kernel. +* Altered the behavior of the CPU.cpu_stats method on Linux. Now, only the + numbered cpu entries return associated data, unless the numberless entry + is the only entry. +* Added a sample program for Linux under the 'examples' directory. + +== 0.5.1 - 5-May-2005 +* Fixed a potential bug in the FreeBSD version of CPU.model. +* Eliminated some warnings in the FreeBSD version. +* Moved examples directory to the toplevel package directory. +* Renamed and updated the sample scripts. +* Added a sample script for FreeBSD. +* Removed the INSTALL file. That information is now included in the README. +* Made the CHANGES, README, and .txt files rdoc friendly. +* The dynamic documentation generation for Linux has been altered. Anything + relating to rd2 has been removed. The doc file generated is now + doc/linux.txt. +* Some $LOAD_PATH setup changes in the unit tests. + +== 0.5.0 - 26-Jun-2004 +* Now requires Ruby 1.8.0 or later. +* FreeBSD support added. +* Replaced 'CPUException' with 'CPUError' +* The MS Windows version has been completely revamped to use WMI instead of + the C API. Some method names have changed and some methods have been + dropped entirely. Please see the documentation for details. +* Corresponding documentation updates and test suite changes. +* Sample programs have been moved to doc/examples. +* Installation procedure somewhat revamped. +* No longer autogenerates test file. +* The .html files have been removed. You can generate the html on your own + if you like. + +== 0.4.0 - 18-Sep-2003 +* Added MS Windows support +* Changed some method names. The "cpu" has been dropped from most method + names. See documentation for details. +* The state() and freq() methods (where supported) now assume a default + value of zero. +* More unit tests added. +* Fixed minor issue with test.rb for those without TestUnit installed. +* Fixed issue with linux.rb file being auto-installed on non-Linux platforms. +* Minor API change for the load_avg() method on HP-UX. It now accepts a + CPU number as an argument. + +== 0.3.1 - 16-Jul-2003 +* Fixed a bug in the Solaris version that was using up and not + freeing file descriptors. +* Added html doc for Solaris under doc directory. +* Minor changes to test_hpux.rb and test_sunos.rb +* Minor README changes. + +== 0.3.0 - 30-Jun-2003 +* Added HP-UX support +* Removed the VERSION class method. Use the constant instead +* Changed license to "Artistic" +* Moved version info into its own file for convenience +* Some minor mods to the test suites +* Modified extconf.rb, moving some of the dynamic test generation + into separate files + +== 0.2.2 - 25-Mar-2003 +* fpu_type and cpu_type now return nil if not found (Solaris) +* CPUException is now a direct subclass of StandardError +* Modified extconf.rb script +* Minor doc updates +* Added another test to the solaris test suite +* Important note added to INSTALL file + +== 0.2.1 - 12-Mar-2003 +* Added the cpu_stats() class method for Linux, which contains the + data from the 'cpu' lines of /proc/stat +* Minor fix for extconf.rb (thanks Michael Granger) +* Some tests added to Linux test suite +* MANIFEST correction + +== 0.2.0 - 13-Feb-2003 +* Linux support added (pure Ruby only) +* Many changes to extconf.rb to support Linux version +* sys-uname prerequisite dropped +* rd2 documentation now kept separate from source + +== 0.1.0 - 3-Feb-2003 +* Initial release +* Currently supports Solaris (only) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/MANIFEST b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/MANIFEST new file mode 100644 index 000000000..6efdff9e4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/MANIFEST @@ -0,0 +1,27 @@ +* install.rb +* MANIFEST +* CHANGES +* Rakefile +* README +* sys-cpu.gemspec +* certs/djberg96_pub.pem +* doc/bsd.txt +* doc/hpux.txt +* doc/linux.txt +* doc/sunos.txt +* doc/windows.txt +* examples/example_sys_cpu_freebsd.rb +* examples/example_sys_cpu_hpux.rb +* examples/example_sys_cpu_linux.rb +* examples/example_sys_cpu_sunos.rb +* examples/example_sys_cpu_windows.rb +* lib/sys/cpu.rb +* lib/sys/linux/sys/cpu.rb +* lib/sys/unix/sys/cpu.rb +* lib/sys/windows/sys/cpu.rb +* test/test_sys_cpu.rb +* test/test_sys_cpu_bsd.rb +* test/test_sys_cpu_hpux.rb +* test/test_sys_cpu_sunos.rb +* test/test_sys_cpu_linux.rb +* test/test_sys_cpu_windows.rb diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/README b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/README new file mode 100644 index 000000000..192a44b47 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/README @@ -0,0 +1,72 @@ += Description + A Ruby interface for getting cpu information. + += Installation + gem install sys-cpu + += Notes +== Solaris + Currently there is no 'processors()' iterative method for multi-cpu systems. + I plan to add it this in a future release. + +== OS X + The CPU.model method returns very limited information. I do not yet know + how to get more detailed information. + +== Linux + This is pure Ruby. This version reads information out of /proc/cpuinfo and + /proc/loadavg, so if /proc isn't mounted it won't work. + + The key-value information in /proc/cpuinfo is stored internally (i.e. in + memory) as an array of hashes when you first 'require' this package. This + overhead is exceptionally minimal, given that your average cpuinfo file + contains less than 1k of text (and I don't store whitespace or newlines). + + The text documentation for Linux is dynamically generated during the + build process because the fields vary depending on your setup. So, don't + look at it until *after* you've installed it. You will see a doc/linux.txt + file after you run 'rake install' (via install.rb). + +== HP-UX + Unlike other platforms, you can get load averages for an individual cpu in + multi-cpu systems. See documentation for more details. + + Note that version 0.7.x and later will not work on HP-UX because of the + switch to FFI and the lack of a testing platform. However, version 0.6.x + will work just fine. + +== MS Windows + This is a pure Ruby implementation using the win32ole package + WMI. The C + version has been scrapped. + + As of version 0.5.0, the CPU.usage method has been removed in favor of the + CPU.load_avg method. This does not (currently) use a perf counter, so there + is no longer any delay. Also, the 'processors' method has been + added and the 'supported' method has been dropped. See the documentation + for other changes. + += Acknowledgements + Thanks go to the MPlayer team for some source code that helped me on + certain versions of FreeBSD in the original C version. + += Known Bugs + None that I'm aware of. Please report bugs on the project page at + https://github.com/djberg96/sys-cpu + += Future Plans + Add iterative CPU.processors method. + Add more information in general, such as what 'prtdiag' shows. + += License + Artistic 2.0 + += Copyright + (C) 2003-2015 Daniel J. Berger, All Rights Reserved + += Warranty + This package is provided "as is" and without any express or + implied warranties, including, without limitation, the implied + warranties of merchantability and fitness for a particular purpose. + += Author + Daniel J. Berger diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/Rakefile new file mode 100644 index 000000000..011f8ca96 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/Rakefile @@ -0,0 +1,52 @@ +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require 'rbconfig' +include RbConfig + +CLEAN.include('**/*.gem', '**/*.rbc', '**/*.rbx') + +namespace 'gem' do + desc "Create the sys-cpu gem" + task :create => [:clean] do + require 'rubygems/package' + spec = eval(IO.read('sys-cpu.gemspec')) + spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem') + Gem::Package.build(spec) + end + + desc "Install the sys-cpu gem" + task :install => [:create] do + file = Dir["*.gem"].first + sh "gem install -l #{file}" + end +end + +desc "Run the example program" +task :example => [:clean] do + case CONFIG['host_os'] + when /bsd|darwin|osx/i + file = "examples/example_sys_cpu_bsd.rb" + sh "ruby -Ilib/unix #{file}" + when /hpux/i + file = "examples/example_sys_cpu_hpux.rb" + sh "ruby -Ilib/unix #{file}" + when /linux/i + file = "examples/example_sys_cpu_linux.rb" + sh "ruby -Ilib/linux #{file}" + when /windows|win32|cygwin|mingw|dos/i + file = "examples/example_sys_cpu_windows.rb" + sh "ruby -Ilib/windows #{file}" + when /sunos|solaris/i + file = "examples/example_sys_cpu_sunos.rb" + sh "ruby -Ilib/unix #{file}" + end + +end + +Rake::TestTask.new do |t| + t.libs << 'test' + t.test_files = FileList['test/test_sys_cpu.rb'] +end + +task :default => :test diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/certs/djberg96_pub.pem b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/certs/djberg96_pub.pem new file mode 100644 index 000000000..6bea5d3ba --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/certs/djberg96_pub.pem @@ -0,0 +1,21 @@ +-----BEGIN CERTIFICATE----- +MIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl +cmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t +MB4XDTE1MDkwMjIwNDkxOFoXDTE2MDkwMTIwNDkxOFowPzERMA8GA1UEAwwIZGpi +ZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv +bTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMyTkvXqRp6hLs9eoJOS +Hmi8kRYbq9Vkf15/hMxJpotYMgJVHHWrmDcC5Dye2PbnXjTkKf266Zw0PtT9h+lI +S3ts9HO+vaCFSMwFFZmnWJSpQ3CNw2RcHxjWkk9yF7imEM8Kz9ojhiDXzBetdV6M +gr0lV/alUr7TNVBDngbXEfTWscyXh1qd7xZ4EcOdsDktCe5G45N/o3662tPQvJsi +FOF0CM/KuBsa/HL1/eoEmF4B3EKIRfTHrQ3hu20Kv3RJ88QM4ec2+0dd97uX693O +zv6981fyEg+aXLkxrkViM/tz2qR2ZE0jPhHTREPYeMEgptRkTmWSKAuLVWrJEfgl +DtkCAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFEwe +nn6bfJADmuIDiMSOzedOrL+xMB0GA1UdEQQWMBSBEmRqYmVyZzk2QGdtYWlsLmNv +bTAdBgNVHRIEFjAUgRJkamJlcmc5NkBnbWFpbC5jb20wDQYJKoZIhvcNAQEFBQAD +ggEBAHmNOCWoDVD75zHFueY0viwGDVP1BNGFC+yXcb7u2GlK+nEMCORqzURbYPf7 +tL+/hzmePIRz7i30UM//64GI1NLv9jl7nIwjhPpXpf7/lu2I9hOTsvwSumb5UiKC +/sqBxI3sfj9pr79Wpv4MuikX1XPik7Ncb7NPsJPw06Lvyc3Hkg5X2XpPtLtS+Gr2 +wKJnmzb5rIPS1cmsqv0M9LPWflzfwoZ/SpnmhagP+g05p8bRNKjZSA2iImM/GyYZ +EJYzxdPOrx2n6NYR3Hk+vHP0U7UBSveI6+qx+ndQYaeyCn+GRX2PKS9h66YF/Q1V +tGSHgAmcLlkdGgan182qsE/4kKM= +-----END CERTIFICATE----- diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/doc/bsd.txt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/doc/bsd.txt new file mode 100644 index 000000000..45dde013c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/doc/bsd.txt @@ -0,0 +1,49 @@ +== Description + Sys::CPU - An interface for various cpu statistics + +== Synopsis + require "sys/cpu" + include Sys + + # BSD and OS X + puts "Architecture: " + CPU.architecture + puts "Machine: " + CPU.machine + puts "Mhz: " + CPU.cpu_freq.to_s + puts "Number of cpu's on this system: " + CPU.num_cpu.to_s + puts "CPU model: " + CPU.model + puts "Load averages: " + CPU.load_avg.join(", ") + +== Constants +VERSION + Returns the current version number for this package. + +== Class Methods +CPU.architecture + Returns the cpu's architecture. + +CPU.freq + Returns an integer indicating the speed (i.e. frequency in Mhz) of + the cpu. + + Not supported on OS X. + +CPU.load_avg + Returns an array of three floats indicating the 1, 5 and 15 minute load + average. + +CPU.machine + Returns the class of cpu (probably identical to the architecture). + +CPU.model + Returns a string indicating the cpu model. + +CPU.num_cpu + Returns an integer indicating the number of cpu's on the system. + +== Error Classes +CPU::Error < StandardError + Raised is response to internal function errors, usually relating to an + invalid cpu number. + +== More Information +See the README file for more information. \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/doc/hpux.txt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/doc/hpux.txt new file mode 100644 index 000000000..bedf84355 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/doc/hpux.txt @@ -0,0 +1,54 @@ +== Description + Sys::CPU - An interface for various cpu statistics + +== Synopsis + require "sys/cpu" + include Sys + + puts "Mhz: " + CPU.cpu_freq.to_s + puts "State: " + CPU.state(0) + puts "Number of cpu's on this system: " + CPU.num_cpu.to_s + puts "Number of active cpu's: " + CPU.num_active_cpu.to_s + puts "Load averages: " + CPU.load_avg.join(", ") + +== Constants +VERSION + Returns the current version number for this package. + +== Class Methods +CPU.architecture + Returns the cpu architecture, e.g. PA RISC 1.2, etc. + +CPU.freq(cpu_num=0) + Returns an integer indicating the speed (i.e. frequency in Mhz) of + the cpu. + +CPU.load_avg +CPU.load_avg(cpu_num) +CPU.load_avg{ |cpu| ... } + + In non-block form returns an array of three floats indicating the 1, 5 + and 15 minute overall load average. + + In block form, it returns an array of three floats indicating the 1, 5 + and 15 minute load average for each cpu. Only useful on multi-cpu + systems. + + If 'cpu_num' is provided, returns the load average (as a 3-element + array) for that cpu only. + + You cannot provide a cpu number and use block form at the same time. + +CPU.num_cpu + Returns an integer indicating the number of cpu's on the system. + +CPU.num_active_cpu + Returns an integer indicating the number of active cpu's on the system. + +== Error Classes +CPU::Error < StandardError + Raised is response to internal function errors, usually relating to an + invalid cpu number. + +== More Information +See the README file for more information. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/doc/linux.txt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/doc/linux.txt new file mode 100644 index 000000000..8c2f8763a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/doc/linux.txt @@ -0,0 +1,41 @@ +== Description + Sys::CPU - An interface for various cpu statistics + +== Synopsis + require "sys/cpu" + include Sys + + CPU.processors{ |cs| + cs.members.each{ |m| + puts "#{m}: " + cs[m].to_s + } + } + + CPU.bogomips(1) # -> returns bogomips for cpu #2 + +== Notes + Portions of this documentation built dynamically + +== Constants +VERSION + Returns the current version number for this package as a String. + +== Class Methods +CPU.load_avg + Returns an array of three floats indicating the 1, 5 and 15 minute load + average. + +CPU.cpu_stats + Returns a hash, with the cpu number as the key and an array as the value. + The array contains the number of seconds that the system spent in + user mode, user mode with low priority (nice), system mode, and the + idle task, respectively, for that cpu. + +CPU.processors{ |cpu struct| block } + Calls the block for each processor on your system, passing a CPUStruct as the + parameter. + + The exact members of the CPUStruct are the same as the class method names, except + for CPU.processors (although you may optionally omit the "?" when referring to a + struct member). These were determined when you installed this package because they + vary from one chip architecture to another. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/doc/sunos.txt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/doc/sunos.txt new file mode 100644 index 000000000..156ae980e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/doc/sunos.txt @@ -0,0 +1,56 @@ +== Description + Sys::CPU - An interface for various cpu statistics + +== Synopsis + require "sys/cpu" + include Sys + + # Solaris + puts "Mhz: " + CPU.cpu_freq(0).to_s + puts "State: " + CPU.state(0) + puts "Number of cpu's on this system: " + CPU.num_cpu.to_s + puts "CPU type: " + CPU.architecture + puts "FPU type: " + CPU.fpu_type + puts "CPU model: " + CPU.model + puts "Load averages: " + CPU.load_avg.join(", ") + +== Constants +VERSION + Returns the current version number for this package. + +== Class Methods +CPU.freq(cpu_num=0) + Returns an integer indicating the speed (i.e. frequency in Mhz) of + 'cpu_num', or CPU 0 if no number is provided. + +CPU.architecture + Returns a string indicating the type of processor. This is the + architecture (e.g. sparcv9), not the exact model (e.g. Ultra-IIe). + Returns nil if not found. + +CPU.fpu_type + Returns a string indicating the type of floating point unit, or nil if + not found. + +CPU.load_avg + Returns an array of three floats indicating the 1, 5 and 15 minute load + average. + +CPU.model + Returns a string indicating the cpu model. For now, this is the + architecture type, rather than the exact model. However, see the + 'Future Plans' section below. + +CPU.num_cpu + Returns an integer indicating the number of cpu's on the system. + +CPU.state(cpu_num) + Returns a string indicating the cpu state of 'cpu_num'. + +== Error Classes +CPU::Error < StandardError + Raised is response to internal function errors, usually relating to an + invalid cpu number. + +== More Information +See the README file for more information. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/doc/windows.txt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/doc/windows.txt new file mode 100644 index 000000000..e4821b90c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/doc/windows.txt @@ -0,0 +1,130 @@ +== Description + Sys::CPU - An interface for various cpu statistics + +== Synopsis + require "sys/cpu" + include Sys + + CPU.processors{ |cs| + cs.members.each{ |m| + puts "#{m}: " + cs[m].to_s + } + } + + puts "CPU Speed (Frequency): " + CPU.freq(0).to_s + puts "Load avg: " + CPU.load_avg.to_s + puts "Num CPU: " + CPU.num_cpu.to_s + puts "Type: " + CPU.cpu_type + puts "Model: " + CPU.model + puts "Architecture: " + CPU.architecture + +== Constants +VERSION + Returns the current version number for this package. + +== Class Methods +CPU.architecture(host=localhost) + Returns the architecture of the cpu, e.g. x86 Family 15 Model 2 + +CPU.freq(cpu_num=0, host=localhost) + Returns an integer indicating the speed (i.e. frequency in Mhz) of + 'cpu_num'. If cpu_num+1 is greater than the number of cpu's on + your system, or this call fails for any other reason, a CPUError + is raised. + +CPU.load_avg(host=localhost) + Returns the load capacity of each processor, averaged to the last second. + Processor loading refers to the total computing burden for each + processor at one time. + + Note that this attribute is actually the LoadPercentage. I may use + one of the Win32_Perf* classes in the future. + +CPU.model(host=localhost) + Returns a string indicating the cpu model, e.g. Intel Pentium 4 + +CPU.num_cpu(host=localhost) + Returns an integer indicating the number of cpu's on the system. + +CPU.processors(host=localhost){ |cpu| ... } + Returns a CPUStruct for each CPU on the system containing the following + members: + + * address_width + * architecture + * availability + * caption + * config_manager_error_code + * config_manager_user_config + * cpu_status + * creation_class_name + * freq + * voltage + * data_width + * description + * device_id + * error_cleared? + * error_description + * ext_clock + * family + * install_date + * l2_cache_size + * l2_cache_speed + * last_error_code + * level + * load_avg + * manufacturer + * max_clock_speed + * name + * other_family_description + * pnp_device_id + * power_management_supported? + * power_management_capabilities + * processor_id + * processor_type + * revision + * role + * socket_designation + * status + * status_info + * stepping + * system_creation_class_name + * system_name + * unique_id + * upgrade_method + * version + * voltage_caps + + Note that not all of these members will necessarily be defined. See the + NOTES section below. + +CPU.cpu_type(host=localhost) + Returns a string indicating the type of processor, e.g. GenuineIntel. + +== Exception Classes +CPU::Error < StandardError + Raised is response to internal function errors, most likely to be raised + in the event that in invalid cpu number is provided for the 'freq' + method. + +== Notes + Some of the CPUStruct members may be nil. As far as I can tell, this + means that Windows is unable to determine the value for the attribute due + to your BIOS and/or BIOS settings. There is nothing clear in the + documentation I could find for this, however. + + The 'family' attribute may contain the trademark symbol. + + The 'status_info' attribute was not converted to a string because the + 'status' attribute already is a string. I'm not even sure why MS has both + versions. + + The 'system_name' attribute appears to be the hostname. I have no idea + why this is included as part of the CPU information, but there you go. + + See http://tinyurl.com/2mros (and click on 'Win32_Processor' in the left + frame) for a list of attributes and their meaning. Link courtesy of + tinyurl.com. + +== More Information +See the README file for more information. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/examples/example_sys_cpu_bsd.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/examples/example_sys_cpu_bsd.rb new file mode 100644 index 000000000..3d491c2af --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/examples/example_sys_cpu_bsd.rb @@ -0,0 +1,19 @@ +####################################################################### +# example_sys_cpu_bsd.rb +# +# Sample cript for general futzing. You can run this code via the +# 'rake example' task. +# +# Modify as you see fit. +####################################################################### +require "sys/cpu" +include Sys + +puts "VERSION: " + CPU::VERSION + +puts "Load Average: " + CPU.load_avg.join(", ") +puts "CPU Freq (speed): " + CPU.freq.to_s unless RUBY_PLATFORM.match('darwin') +puts "Num CPU: " + CPU.num_cpu.to_s +puts "Architecture: " + CPU.architecture +puts "Machine: " + CPU.machine +puts "Model: " + CPU.model diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/examples/example_sys_cpu_hpux.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/examples/example_sys_cpu_hpux.rb new file mode 100644 index 000000000..dbfbea248 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/examples/example_sys_cpu_hpux.rb @@ -0,0 +1,27 @@ +####################################################################### +# example_sys_cpu_hpux.rb +# +# Sample cript for general futzing. You can run this code via the +# 'rake example' task. +# +# Modify as you see fit. +####################################################################### +require "sys/cpu" +include Sys + +puts "VERSION: " + CPU::VERSION +puts "========" + +puts "Num CPU: " + CPU.num_cpu.to_s +puts "Active CPU: " + CPU.num_active_cpu.to_s +puts "Architecture: " + CPU.architecture +puts "Speed/Freq: " + CPU.freq.to_s + +puts "Load average for CPU 0: " + CPU.load_avg(0).join(", ") +puts "Overall Load Average: " + CPU.load_avg.join(", ") + +puts "Individual Loads Averages:" +puts "==========================" +CPU.load_avg{ |e| + p e +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/examples/example_sys_cpu_linux.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/examples/example_sys_cpu_linux.rb new file mode 100644 index 000000000..954202524 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/examples/example_sys_cpu_linux.rb @@ -0,0 +1,24 @@ +####################################################################### +# example_sys_cpu_linux.rb +# +# Sample cript for general futzing. You should run this code via the +# 'rake example' task. +# +# Modify as you see fit. +####################################################################### +require "sys/cpu" +require "pp" + +puts "VERSION: " + Sys::CPU::VERSION +puts "========" + +puts "Load Average: " + Sys::CPU.load_avg.join(", ") + +puts "Processor Info:" +puts "===============" +pp Sys::CPU.processors + +puts "CPU STATS:" +puts "=========:" + +pp Sys::CPU.cpu_stats diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/examples/example_sys_cpu_sunos.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/examples/example_sys_cpu_sunos.rb new file mode 100644 index 000000000..40f09ef2d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/examples/example_sys_cpu_sunos.rb @@ -0,0 +1,21 @@ +####################################################################### +# example_sys_cpu_sunos.rb +# +# Sample cript for general futzing. You can run this code via the +# 'rake example' task. +# +# Modify as you see fit. +####################################################################### +require "sys/cpu" +include Sys + +puts "VERSION: " + CPU::VERSION +puts "========" + +puts "Load Average: " + CPU.load_avg.join(", ") +puts "CPU Freq (speed): " + CPU.freq.to_s +puts "CPU State: " + CPU.state(0) +puts "Num CPU: " + CPU.num_cpu.to_s +puts "Type: " + CPU.cpu_type +puts "FPU Type: " + CPU.fpu_type +puts "Model: " + CPU.model diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/examples/example_sys_cpu_windows.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/examples/example_sys_cpu_windows.rb new file mode 100644 index 000000000..7eab1cc76 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/examples/example_sys_cpu_windows.rb @@ -0,0 +1,25 @@ +####################################################################### +# example_sys_cpu_windows.rb +# +# Sample cript for general futzing. You can run this code via the +# 'rake example' task. +# +# Modify as you see fit. +####################################################################### +require 'sys/cpu' +require 'pp' +include Sys + +puts "VERSION: " + CPU::VERSION +puts "========" + +puts "Architecture: " + CPU.architecture.to_s +puts "CPU Speed (Frequency): " + CPU.freq.to_s +puts "Load Average: " + CPU.load_avg.to_s +puts "Model: " + CPU.model.to_s +puts "Type: " + CPU.cpu_type.to_s +puts "Num CPU: " + CPU.num_cpu.to_s + +CPU.processors{ |cpu| + pp cpu +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/install.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/install.rb new file mode 100644 index 000000000..367b409bf --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/install.rb @@ -0,0 +1,85 @@ +####################################################################### +# install.rb +# +# For pure Ruby versions only. Generally speaking this script should +# not be run directly. Use the 'rake install' task instead. +####################################################################### +require 'rbconfig' +require 'fileutils' +include Config +install_dir = File.join(CONFIG['sitelibdir'], 'sys') + +file = "" + +case CONFIG['host_os'] + when /windows|win32|mingw|cygwin|dos/i + file = "lib/windows/sys/cpu.rb" + when /linux/i + file = "lib/linux/sys/cpu.rb" + when /sunos|solaris|hpux|freebsd/i + STDERR.puts "Use 'extconf.rb/make/make site-install' for this platform" + exit + else + STDERR.puts "This platform is not currently supported. Exiting..." + exit +end + +####################################################################### +# Dynamically generate some of the documentation for linux. If the +# doc size is already greater than 1.4k, assume that the documentation +# has already been written at some point previously and skip it. +####################################################################### +if CONFIG['host_os'] =~ /linux/ + cpu_file = "/proc/cpuinfo" + text_file = "doc/linux.txt" + rb_file = "lib/linux/sys/cpu.rb" + + if File.size(text_file) > 1400 + puts "You appear to have already created the documentation." + puts "Skipping..." + else + puts "Dynamically generating documentation..." + fh = File.open(text_file, 'a') + + IO.foreach(cpu_file){ |line| + next if line =~ /^$/ + k,v = line.split(":") + + v = v.strip.chomp + k = k.strip.gsub(/\s+/, '_').downcase + + k += "?" if v =~ /yes|no/i + + fh.puts("CPU.#{k}") + + if v =~ /yes|no/i + k.chop! + msg = " Returns true if a " + k.gsub(/_/," ") + "exists on" + msg << " this system" + fh.puts(msg) + else + fh.puts(" Returns the " + k.gsub(/_/," ")) + end + + fh.puts # Add a blank line + } + + fh.close + puts "Documentation creation complete" + end +end + +# Create the 'sys' toplevel directory if it doesn't already exist +begin + unless File.exist?(install_dir) + Dir.mkdir(install_dir) + end +rescue Errno::EACCES => e + puts "Unable to create #{install_dir}: #{e}" + exit +end + +# Finally, copy the file to the appropriate directory +FileUtils.cp(file, "#{install_dir}/cpu.rb", :verbose => true) + +puts "Installation successful" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/lib/sys-cpu.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/lib/sys-cpu.rb new file mode 100644 index 000000000..8db8e5011 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/lib/sys-cpu.rb @@ -0,0 +1 @@ +require_relative 'sys/cpu' diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/lib/sys/cpu.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/lib/sys/cpu.rb new file mode 100644 index 000000000..abe96eef7 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/lib/sys/cpu.rb @@ -0,0 +1,19 @@ +# This is just a stub file that requires the appropriate version +# depending on which platform you're on. +require 'rbconfig' + +module Sys + class CPU + # The version of the sys-cpu gem. + VERSION = '0.7.2' + end +end + +case RbConfig::CONFIG['host_os'] + when /linux/i + require File.join(File.dirname(__FILE__), 'linux', 'sys', 'cpu') + when /windows|mswin|mingw|cygwin|dos/i + require File.join(File.dirname(__FILE__), 'windows', 'sys', 'cpu') + else + require File.join(File.dirname(__FILE__), 'unix', 'sys', 'cpu') +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/lib/sys/linux/sys/cpu.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/lib/sys/linux/sys/cpu.rb new file mode 100644 index 000000000..ae602cda0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/lib/sys/linux/sys/cpu.rb @@ -0,0 +1,119 @@ +########################################################## +# linux.rb (sys-cpu) - pure Ruby version for Linux +########################################################## +module Sys + + # :stopdoc: + + cpu_file = "/proc/cpuinfo" + cpu_hash = {} + CPU_ARRAY = [] + + # Parse the info out of the /proc/cpuinfo file + IO.foreach(cpu_file){ |line| + line.strip! + next if line.empty? + + key, val = line.split(":") + key.strip! + key.gsub!(/\s+/,"_") + key.downcase! + val.strip! if val + + if cpu_hash.has_key?(key) + CPU_ARRAY.push(cpu_hash.dup) + cpu_hash.clear + end + + # Turn yes/no attributes into booleans + if val == 'yes' + val = true + elsif val == 'no' + val = false + end + + cpu_hash[key] = val + } + + CPU_ARRAY.push(cpu_hash) + + # :startdoc: + + class CPU + + # :stopdoc: + + CPUStruct = Struct.new("CPUStruct", *CPU_ARRAY.first.keys) + + # :startdoc: + + # In block form, yields a CPUStruct for each CPU on the system. In + # non-block form, returns an Array of CPUStruct's. + # + # The exact members of the struct vary on Linux systems. + # + def self.processors + array = [] + CPU_ARRAY.each{ |hash| + struct = CPUStruct.new + struct.members.each{ |m| struct.send("#{m}=", hash["#{m}"]) } + if block_given? + yield struct + else + array << struct + end + } + array unless block_given? + end + + private + + # Create singleton methods for each of the attributes. + # + def self.method_missing(id, arg=0) + rv = CPU_ARRAY[arg][id.to_s] + if rv.nil? + id = id.to_s + "?" + rv = CPU_ARRAY[arg][id] + end + rv + end + + public + + # Returns a 3 element Array corresponding to the 1, 5 and 15 minute + # load average for the system. + # + def self.load_avg + load_avg_file = "/proc/loadavg" + IO.readlines(load_avg_file).first.split[0..2].map{ |e| e.to_f } + end + + # Returns a hash of arrays that contain the number of seconds that the + # system spent in user mode, user mode with low priority (nice), system + # mode, and the idle task, respectively. + # + def self.cpu_stats + cpu_stat_file = "/proc/stat" + hash = {} # Hash needed for multi-cpu systems + + lines = IO.readlines(cpu_stat_file) + + lines.each_with_index{ |line, i| + array = line.split + break unless array[0] =~ /cpu/ # 'cpu' entries always on top + + # Some machines list a 'cpu' and a 'cpu0'. In this case only + # return values for the numbered cpu entry. + if lines[i].split[0] == "cpu" && lines[i+1].split[0] =~ /cpu\d/ + next + end + + vals = array[1..-1].map{ |e| e = e.to_i / 100 } # 100 jiffies/sec. + hash[array[0]] = vals + } + + hash + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/lib/sys/unix/sys/cpu.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/lib/sys/unix/sys/cpu.rb new file mode 100644 index 000000000..46bb47766 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/lib/sys/unix/sys/cpu.rb @@ -0,0 +1,372 @@ +require 'ffi' +require 'rbconfig' + +module Sys + class CPU + extend FFI::Library + ffi_lib FFI::Library::LIBC + + # Error raised if any of the CPU methods fail. + class Error < StandardError; end + + CTL_HW = 6 # Generic hardware/cpu + + HW_MACHINE = 1 # Machine class + HW_MODEL = 2 # Specific machine model + HW_NCPU = 3 # Number of CPU's + HW_CPU_FREQ = 15 # CPU frequency + + if RbConfig::CONFIG['host_os'] =~ /bsd/ + HW_MACHINE_ARCH = 11 # Machine architecture + else + HW_MACHINE_ARCH = 12 # Machine architecture + end + + SI_MACHINE = 5 + SI_ARCHITECTURE = 6 + SC_NPROCESSORS_ONLN = 15 + + P_OFFLINE = 1 + P_ONLINE = 2 + P_FAULTED = 4 + P_POWEROFF = 5 + P_NOINTR = 6 + P_SPARE = 7 + + CPU_ARCH_ABI64 = 0x01000000 + CPU_TYPE_X86 = 7 + CPU_TYPE_X86_64 = (CPU_TYPE_X86 | CPU_ARCH_ABI64) + CPU_TYPE_SPARC = 14 + CPU_TYPE_POWERPC = 18 + CPU_TYPE_POWERPC64 = CPU_TYPE_POWERPC | CPU_ARCH_ABI64 + + begin + attach_function( + :sysctl, + [:pointer, :uint, :pointer, :pointer, :pointer, :size_t], + :int + ) + private_class_method :sysctl + rescue FFI::NotFoundError + # Do nothing, not supported on this platform. + end + + begin + attach_function( + :sysctlbyname, + [:string, :pointer, :pointer, :pointer, :size_t], + :int + ) + private_class_method :sysctlbyname + rescue FFI::NotFoundError + # Do nothing, not supported on this platform. + end + + # Solaris + begin + attach_function :getloadavg, [:pointer, :int], :int + attach_function :processor_info, [:int, :pointer], :int + attach_function :sysconf, [:int], :long + attach_function :sysinfo, [:int, :pointer, :long], :int + + private_class_method :getloadavg + private_class_method :processor_info + private_class_method :sysconf + private_class_method :sysinfo + rescue FFI::NotFoundError + # Do nothing, not supported on this platform. + end + + class ProcInfo < FFI::Struct + layout( + :pi_state, :int, + :pi_processor_type, [:char, 16], + :pi_fputypes, [:char, 32], + :pi_clock, :int + ) + end + + # Returns the cpu's architecture. On most systems this will be identical + # to the CPU.machine method. On OpenBSD it will be identical to the CPU.model + # method. + # + def self.architecture + if respond_to?(:sysinfo, true) + buf = 0.chr * 257 + + if sysinfo(SI_ARCHITECTURE, buf, buf.size) < 0 + raise Error, "sysinfo function failed" + end + + buf.strip + elsif respond_to?(:sysctlbyname, true) + optr = FFI::MemoryPointer.new(:char, 256) + size = FFI::MemoryPointer.new(:size_t) + + size.write_int(optr.size) + + if RbConfig::CONFIG['host_os'] =~ /darwin/i + name = 'hw.machine' + else + name = 'hw.machine_arch' + end + + if sysctlbyname(name, optr, size, nil, 0) < 0 + raise Error, "sysctlbyname function failed" + end + + optr.read_string + else + buf = 0.chr * 64 + mib = FFI::MemoryPointer.new(:int, 2) + size = FFI::MemoryPointer.new(:long, 1) + + mib.write_array_of_int([CTL_HW, HW_MACHINE_ARCH]) + size.write_int(buf.size) + + if sysctl(mib, 2, buf, size, nil, 0) < 0 + raise Error, "sysctl function failed" + end + + buf.strip + end + end + + # Returns the number of cpu's on your system. Note that each core on + # multi-core systems are counted as a cpu, e.g. one dual core cpu would + # return 2, not 1. + # + def self.num_cpu + if respond_to?(:sysctlbyname, true) + optr = FFI::MemoryPointer.new(:long) + size = FFI::MemoryPointer.new(:size_t) + + size.write_long(optr.size) + + if sysctlbyname('hw.ncpu', optr, size, nil, 0) < 0 + raise Error, "sysctlbyname failed" + end + + optr.read_long + elsif respond_to?(:sysconf, true) + num = sysconf(SC_NPROCESSORS_ONLN) + + if num < 0 + raise Error, "sysconf function failed" + end + + num + else + buf = 0.chr * 4 + mib = FFI::MemoryPointer.new(:int, 2) + size = FFI::MemoryPointer.new(:long, 1) + + mib.write_array_of_int([CTL_HW, HW_NCPU]) + size.write_int(buf.size) + + if sysctl(mib, 2, buf, size, nil, 0) < 0 + raise Error, "sysctl function failed" + end + + buf.strip.unpack("C").first + end + end + + # Returns the cpu's class type. On most systems this will be identical + # to the CPU.architecture method. On OpenBSD it will be identical to the + # CPU.model method. + # + def self.machine + if respond_to?(:sysctl, true) + buf = 0.chr * 32 + mib = FFI::MemoryPointer.new(:int, 2) + size = FFI::MemoryPointer.new(:long, 1) + + mib.write_array_of_int([CTL_HW, HW_MACHINE]) + size.write_int(buf.size) + + if sysctl(mib, 2, buf, size, nil, 0) < 0 + raise Error, "sysctl function failed" + end + + buf.strip + else + buf = 0.chr * 257 + + if sysinfo(SI_MACHINE, buf, buf.size) < 0 + raise Error, "sysinfo function failed" + end + + buf.strip + end + end + + # Returns a string indicating the cpu model. + # + def self.model + if RbConfig::CONFIG['host_os'] =~ /darwin/i + ptr = FFI::MemoryPointer.new(:long) + size = FFI::MemoryPointer.new(:size_t) + + size.write_long(ptr.size) + + if sysctlbyname("hw.cputype", ptr, size, nil, 0) < 0 + raise "sysctlbyname function failed" + end + + case ptr.read_long + when CPU_TYPE_X86, CPU_TYPE_X86_64 + "Intel" + when CPU_TYPE_SPARC + "Sparc" + when CPU_TYPE_POWERPC, CPU_TYPE_POWERPC64 + "PowerPC" + else + "Unknown" + end + else + if respond_to?(:sysctl, true) + buf = 0.chr * 64 + mib = FFI::MemoryPointer.new(:int, 2) + size = FFI::MemoryPointer.new(:long, 1) + + mib.write_array_of_int([CTL_HW, HW_MODEL]) + size.write_int(buf.size) + + if sysctl(mib, 2, buf, size, nil, 0) < 0 + raise Error, "sysctl function failed" + end + + buf.strip + else + pinfo = ProcInfo.new + + # Some systems start at 0, some at 1 + if processor_info(0, pinfo) < 0 + if processor_info(1, pinfo) < 0 + raise Error, "process_info function failed" + end + end + + pinfo[:pi_processor_type].to_s + end + end + end + + # Returns an integer indicating the speed of the CPU. + # + def self.freq + if respond_to?(:sysctlbyname, true) + optr = FFI::MemoryPointer.new(:long) + size = FFI::MemoryPointer.new(:size_t) + + size.write_long(optr.size) + + if RbConfig::CONFIG['host_os'] =~ /bsd/i + name = 'hw.clockrate' + else + name = 'hw.cpufrequency' + end + + if sysctlbyname(name, optr, size, nil, 0) < 0 + raise Error, "sysctlbyname failed" + end + + if RbConfig::CONFIG['host_os'] =~ /darwin/i + optr.read_long / 1000000 + else + optr.read_long + end + elsif respond_to?(:sysctl, true) + buf = 0.chr * 16 + mib = FFI::MemoryPointer.new(:int, 2) + size = FFI::MemoryPointer.new(:long, 1) + + mib.write_array_of_int([CTL_HW, HW_CPU_FREQ]) + size.write_int(buf.size) + + if sysctl(mib, 2, buf, size, nil, 0) < 0 + raise Error, "sysctl function failed" + end + + buf.unpack("I*").first / 1000000 + else + pinfo = ProcInfo.new + + # Some systems start at 0, some at 1 + if processor_info(0, pinfo) < 0 + if processor_info(1, pinfo) < 0 + raise Error, "process_info function failed" + end + end + + pinfo[:pi_clock].to_i + end + end + + # Returns an array of three floats indicating the 1, 5 and 15 minute load + # average. + # + def self.load_avg + if respond_to?(:getloadavg, true) + loadavg = FFI::MemoryPointer.new(:double, 3) + + if getloadavg(loadavg, loadavg.size) < 0 + raise Error, "getloadavg function failed" + end + + loadavg.get_array_of_double(0, 3) + end + end + + # Returns the floating point processor type. + # + # Not supported on all platforms. + # + def self.fpu_type + raise NoMethodError unless respond_to?(:processor_info, true) + + pinfo = ProcInfo.new + + if processor_info(0, pinfo) < 0 + if processor_info(1, pinfo) < 0 + raise Error, "process_info function failed" + end + end + + pinfo[:pi_fputypes].to_s + end + + # Returns the current state of processor +num+, or 0 if no number is + # specified. + # + # Not supported on all platforms. + # + def self.state(num = 0) + raise NoMethodError unless respond_to?(:processor_info, true) + + pinfo = ProcInfo.new + + if processor_info(num, pinfo) < 0 + raise Error, "process_info function failed" + end + + case pinfo[:pi_state].to_i + when P_ONLINE + "online" + when P_OFFLINE + "offline" + when P_POWEROFF + "poweroff" + when P_FAULTED + "faulted" + when P_NOINTR + "nointr" + when P_SPARE + "spare" + else + "unknown" + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/lib/sys/windows/sys/cpu.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/lib/sys/windows/sys/cpu.rb new file mode 100644 index 000000000..534e19aad --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/lib/sys/windows/sys/cpu.rb @@ -0,0 +1,796 @@ +require 'win32ole' +require 'socket' + +# See Ruby bugs #2618 and #7681. This is a workaround. +BEGIN{ + require 'win32ole' + if RUBY_VERSION.to_f < 2.0 + WIN32OLE.ole_initialize + at_exit { WIN32OLE.ole_uninitialize } + end +} + +# The Sys module serves only as a namespace +module Sys + # Encapsulates system CPU information + class CPU + # Error raised if any of the Sys::CPU methods fail. + class Error < StandardError; end + + private + + # Base connect string + BASE_CS = "winmgmts:{impersonationLevel=impersonate}" # :nodoc: + + # Fields used in the CPUStruct + fields = %w[ + address_width + architecture + availability + caption + config_manager_error_code + config_manager_user_config + cpu_status + creation_class_name + freq + voltage + data_width + description + device_id + error_cleared? + error_description + ext_clock + family + install_date + l2_cache_size + l2_cache_speed + last_error_code + level + load_avg + manufacturer + max_clock_speed + name + other_family_description + pnp_device_id + power_management_supported? + power_management_capabilities + processor_id + processor_type + revision + role + socket_designation + status + status_info + stepping + system_creation_class_name + system_name + unique_id + upgrade_method + version + voltage_caps + ] + + # The struct returned by the CPU.processors method + CPUStruct = Struct.new("CPUStruct", *fields) # :nodoc: + + public + + # Returns the +host+ CPU's architecture, or nil if it cannot be + # determined. + # + def self.architecture(host=Socket.gethostname) + cs = BASE_CS + "//#{host}/root/cimv2:Win32_Processor='cpu0'" + begin + wmi = WIN32OLE.connect(cs) + rescue WIN32OLERuntimeError => e + raise Error, e + else + self.get_cpu_arch(wmi.Architecture) + end + end + + # Returns an integer indicating the speed (i.e. frequency in Mhz) of + # +cpu_num+ on +host+, or the localhost if no +host+ is specified. + # If +cpu_num+ +1 is greater than the number of cpu's on your system + # or this call fails for any other reason, a Error is raised. + # + def self.freq(cpu_num = 0, host = Socket.gethostname) + cs = BASE_CS + "//#{host}/root/cimv2:Win32_Processor='cpu#{cpu_num}'" + begin + wmi = WIN32OLE.connect(cs) + rescue WIN32OLERuntimeError => e + raise Error, e + else + return wmi.CurrentClockSpeed + end + end + + # Returns the load capacity for +cpu_num+ on +host+, or the localhost + # if no host is specified, averaged to the last second. Processor + # loading refers to the total computing burden for each processor at + # one time. + # + # Note that this attribute is actually the LoadPercentage. I may use + # one of the Win32_Perf* classes in the future. + # + def self.load_avg(cpu_num = 0, host = Socket.gethostname) + cs = BASE_CS + "//#{host}/root/cimv2:Win32_Processor='cpu#{cpu_num}'" + begin + wmi = WIN32OLE.connect(cs) + rescue WIN32OLERuntimeError => e + raise Error, e + else + return wmi.LoadPercentage + end + end + + # Returns a string indicating the cpu model, e.g. Intel Pentium 4. + # + def self.model(host = Socket.gethostname) + cs = BASE_CS + "//#{host}/root/cimv2:Win32_Processor='cpu0'" + begin + wmi = WIN32OLE.connect(cs) + rescue WIN32OLERuntimeError => e + raise Error, e + else + return wmi.Name + end + end + + # Returns an integer indicating the number of cpu's on the system. + #-- + # This (oddly) requires a different class. + # + def self.num_cpu(host = Socket.gethostname) + cs = BASE_CS + "//#{host}/root/cimv2:Win32_ComputerSystem='#{host}'" + begin + wmi = WIN32OLE.connect(cs) + rescue WIN32OLERuntimeError => e + raise Error, e + else + return wmi.NumberOfProcessors + end + end + + # Returns a CPUStruct for each CPU on +host+, or the localhost if no + # +host+ is specified. A CPUStruct contains the following members: + # + # * address_width + # * architecture + # * availability + # * caption + # * config_manager_error_code + # * config_manager_user_config + # * cpu_status + # * creation_class_name + # * freq + # * voltage + # * data_width + # * description + # * device_id + # * error_cleared? + # * error_description + # * ext_clock + # * family + # * install_date + # * l2_cache_size + # * l2_cache_speed + # * last_error_code + # * level + # * load_avg + # * manufacturer + # * max_clock_speed + # * name + # * other_family_description + # * pnp_device_id + # * power_management_supported? + # * power_management_capabilities + # * processor_id + # * processor_type + # * revision + # * role + # * socket_designation + # * status + # * status_info + # * stepping + # * system_creation_class_name + # * system_name + # * unique_id + # * upgrade_method + # * version + # * voltage_caps + # + # Note that not all of these members will necessarily be defined. + # + def self.processors(host = Socket.gethostname) # :yields: CPUStruct + begin + wmi = WIN32OLE.connect(BASE_CS + "//#{host}/root/cimv2") + rescue WIN32OLERuntimeError => e + raise Error, e + else + wmi.InstancesOf("Win32_Processor").each{ |cpu| + yield CPUStruct.new( + cpu.AddressWidth, + self.get_cpu_arch(cpu.Architecture), + self.get_availability(cpu.Availability), + cpu.Caption, + self.get_cmec(cpu.ConfigManagerErrorCode), + cpu.ConfigManagerUserConfig, + get_status(cpu.CpuStatus), + cpu.CreationClassName, + cpu.CurrentClockSpeed, + cpu.CurrentVoltage, + cpu.DataWidth, + cpu.Description, + cpu.DeviceId, + cpu.ErrorCleared, + cpu.ErrorDescription, + cpu.ExtClock, + self.get_family(cpu.Family), + cpu.InstallDate, + cpu.L2CacheSize, + cpu.L2CacheSpeed, + cpu.LastErrorCode, + cpu.Level, + cpu.LoadPercentage, + cpu.Manufacturer, + cpu.MaxClockSpeed, + cpu.Name, + cpu.OtherFamilyDescription, + cpu.PNPDeviceID, + cpu.PowerManagementSupported, + cpu.PowerManagementCapabilities, + cpu.ProcessorId, + self.get_processor_type(cpu.ProcessorType), + cpu.Revision, + cpu.Role, + cpu.SocketDesignation, + cpu.Status, + cpu.StatusInfo, + cpu.Stepping, + cpu.SystemCreationClassName, + cpu.SystemName, + cpu.UniqueId, + self.get_upgrade_method(cpu.UpgradeMethod), + cpu.Version, + self.get_voltage_caps(cpu.VoltageCaps) + ) + } + end + end + + # Returns a string indicating the type of processor, e.g. GenuineIntel. + # + def self.cpu_type(host = Socket.gethostname) + cs = BASE_CS + "//#{host}/root/cimv2:Win32_Processor='cpu0'" + begin + wmi = WIN32OLE.connect(cs) + rescue WIN32OLERuntimeError => e + raise Error, e + else + return wmi.Manufacturer + end + end + + private + + # Convert the ConfigManagerErrorCode number to its corresponding string + # Note that this value returns nil on my system. + # + def self.get_cmec(num) + case + when 0 + str = "The device is working properly." + return str + when 1 + str = "The device is not configured correctly." + return str + when 2 + str = "Windows cannot load the driver for the device." + return str + when 3 + str = "The driver for the device might be corrupted, or the" + str << " system may be running low on memory or other" + str << " resources." + return str + when 4 + str = "The device is not working properly. One of the drivers" + str << " or the registry might be corrupted." + return str + when 5 + str = "The driver for this device needs a resource that" + str << " Windows cannot manage." + return str + when 6 + str = "The boot configuration for this device conflicts with" + str << " other devices." + return str + when 7 + str = "Cannot filter." + return str + when 8 + str = "The driver loader for the device is missing." + return str + when 9 + str = "This device is not working properly because the" + str << " controlling firmware is reporting the resources" + str << " for the device incorrectly." + return str + when 10 + str = "This device cannot start." + return str + when 11 + str = "This device failed." + return str + when 12 + str = "This device cannot find enough free resources that" + str << " it can use." + return str + when 13 + str = "Windows cannot verify this device's resources." + return str + when 14 + str = "This device cannot work properly until you restart" + str << " your computer." + return str + when 15 + str = "This device is not working properly because there is" + str << " probably a re-enumeration problem." + return str + when 16 + str = "Windows cannot identify all the resources this device " + str << " uses." + return str + when 17 + str = "This device is asking for an unknown resource type." + return str + when 18 + str = "Reinstall the drivers for this device." + return str + when 19 + str = "Failure using the VXD loader." + return str + when 20 + str = "Your registry might be corrupted." + return str + when 21 + str = "System failure: try changing the driver for this device." + str << " If that does not work, see your hardware documentation." + str << " Windows is removing this device." + return str + when 22 + str = "This device is disabled." + return str + when 23 + str = "System failure: try changing the driver for this device." + str << "If that doesn't work, see your hardware documentation." + return str + when 24 + str = "This device is not present, not working properly, or" + str << " does not have all its drivers installed." + return str + when 25 + str = "Windows is still setting up this device." + return str + when 26 + str = "Windows is still setting up this device." + return str + when 27 + str = "This device does not have valid log configuration." + return str + when 28 + str = "The drivers for this device are not installed." + return str + when 29 + str = "This device is disabled because the firmware of the" + str << " device did not give it the required resources." + return str + when 30 + str = "This device is using an Interrupt Request (IRQ)" + str << " resource that another device is using." + return str + when 31 + str = "This device is not working properly because Windows" + str << " cannot load the drivers required for this device" + return str + else + return nil + end + end + + # Convert an cpu architecture number to a string + def self.get_cpu_arch(num) + case num + when 0 + return "x86" + when 1 + return "MIPS" + when 2 + return "Alpha" + when 3 + return "PowerPC" + when 6 + return "IA64" + when 9 + return "x64" + else + return nil + end + end + + # convert an Availability number into a string + def self.get_availability(num) + case num + when 1 + return "Other" + when 2 + return "Unknown" + when 3 + return "Running" + when 4 + return "Warning" + when 5 + return "In Test" + when 6 + return "Not Applicable" + when 7 + return "Power Off" + when 8 + return "Off Line" + when 9 + return "Off Duty" + when 10 + return "Degraded" + when 11 + return "Not Installed" + when 12 + return "Install Error" + when 13 + return "Power Save - Unknown" + when 14 + return "Power Save - Low Power Mode" + when 15 + return "Power Save - Standby" + when 16 + return "Power Cycle" + when 17 + return "Power Save - Warning" + when 18 + return "Paused" + when 19 + return "Not Ready" + when 20 + return "Not Configured" + when 21 + return "Quiesced" + else + return nil + end + end + + # convert CpuStatus to a string form. Note that values 5 and 6 are + # skipped because they're reserved. + def self.get_status(num) + case num + when 0 + return "Unknown" + when 1 + return "Enabled" + when 2 + return "Disabled by User via BIOS Setup" + when 3 + return "Disabled By BIOS (POST Error)" + when 4 + return "Idle" + when 7 + return "Other" + else + return nil + end + end + + # Convert a family number into the equivalent string + def self.get_family(num) + case num + when 1 + return "Other" + when 2 + return "Unknown" + when 3 + return "8086" + when 4 + return "80286" + when 5 + return "80386" + when 6 + return "80486" + when 7 + return "8087" + when 8 + return "80287" + when 9 + return "80387" + when 10 + return "80487" + when 11 + return "Pentium?" + when 12 + return "Pentium?" + when 13 + return "Pentium?" + when 14 + return "Pentium?" + when 15 + return "Celeron?" + when 16 + return "Pentium?" + when 17 + return "Pentium?" + when 18 + return "M1" + when 19 + return "M2" + when 24 + return "K5" + when 25 + return "K6" + when 26 + return "K6-2" + when 27 + return "K6-3" + when 28 + return "AMD" + when 29 + return "AMD?" + when 30 + return "AMD2900" + when 31 + return "K6-2+" + when 32 + return "Power" + when 33 + return "Power" + when 34 + return "Power" + when 35 + return "Power" + when 36 + return "Power" + when 37 + return "Power" + when 38 + return "Power" + when 39 + return "Power" + when 48 + return "Alpha" + when 49 + return "Alpha" + when 50 + return "Alpha" + when 51 + return "Alpha" + when 52 + return "Alpha" + when 53 + return "Alpha" + when 54 + return "Alpha" + when 55 + return "Alpha" + when 64 + return "MIPS" + when 65 + return "MIPS" + when 66 + return "MIPS" + when 67 + return "MIPS" + when 68 + return "MIPS" + when 69 + return "MIPS" + when 80 + return "SPARC" + when 81 + return "SuperSPARC" + when 82 + return "microSPARC" + when 83 + return "microSPARC" + when 84 + return "UltraSPARC" + when 85 + return "UltraSPARC" + when 86 + return "UltraSPARC" + when 87 + return "UltraSPARC" + when 88 + return "UltraSPARC" + when 96 + return "68040" + when 97 + return "68xxx" + when 98 + return "68000" + when 99 + return "68010" + when 100 + return "68020" + when 101 + return "68030" + when 112 + return "Hobbit" + when 120 + return "Crusoe?" + when 121 + return "Crusoe?" + when 128 + return "Weitek" + when 130 + return "Itanium?" + when 144 + return "PA-RISC" + when 145 + return "PA-RISC" + when 146 + return "PA-RISC" + when 147 + return "PA-RISC" + when 148 + return "PA-RISC" + when 149 + return "PA-RISC" + when 150 + return "PA-RISC" + when 160 + return "V30" + when 176 + return "Pentium?" + when 177 + return "Pentium?" + when 178 + return "Pentium?" + when 179 + return "Intel?" + when 180 + return "AS400" + when 181 + return "Intel?" + when 182 + return "AMD" + when 183 + return "AMD" + when 184 + return "Intel?" + when 185 + return "AMD" + when 190 + return "K7" + when 200 + return "IBM390" + when 201 + return "G4" + when 202 + return "G5" + when 250 + return "i860" + when 251 + return "i960" + when 260 + return "SH-3" + when 261 + return "SH-4" + when 280 + return "ARM" + when 281 + return "StrongARM" + when 300 + return "6x86" + when 301 + return "MediaGX" + when 302 + return "MII" + when 320 + return "WinChip" + when 350 + return "DSP" + when 500 + return "Video" + else + return nil + end + end + + # Convert power management capabilities number to its equivalent string + def self.get_pmc(num) + case num + when 0 + return "Unknown" + when 1 + return "Not Supported" + when 2 + return "Disabled" + when 3 + return "Enabled" + when 4 + return "Power Saving Modes Entered Automatically" + when 5 + return "Power State Settable" + when 6 + return "Power Cycling Supported" + when 7 + return "Timed Power On Supported" + else + return nil + end + end + + # Convert a processor type into its equivalent string + def self.get_processor_type(num) + case num + when 1 + return "Other" + when 2 + return "Unknown" + when 3 + return "Central Processor" + when 4 + return "Math Processor" + when 5 + return "DSP Processor" + when 6 + return "Video Processor" + else + return nil + end + end + + # Convert an upgrade method into its equivalent string + def self.get_upgrade_method(num) + case num + when 1 + return "Other" + when 2 + return "Unknown" + when 3 + return "Daughter Board" + when 4 + return "ZIF Socket" + when 5 + return "Replacement/Piggy Back" + when 6 + return "None" + when 7 + return "LIF Socket" + when 8 + return "Slot 1" + when 9 + return "Slot 2" + when 10 + return "370 Pin Socket" + when 11 + return "Slot A" + when 12 + return "Slot M" + else + return nil + end + end + + # Convert return values to voltage cap values (floats) + def self.get_voltage_caps(num) + case num + when 1 + return 5.0 + when 2 + return 3.3 + when 4 + return 2.9 + else + return nil + end + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/sys-cpu.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/sys-cpu.gemspec new file mode 100644 index 000000000..60d84911b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/sys-cpu.gemspec @@ -0,0 +1,30 @@ +require 'rubygems' + +Gem::Specification.new do |spec| + spec.name = 'sys-cpu' + spec.version = '0.7.2' + spec.author = 'Daniel J. Berger' + spec.email = 'djberg96 at nospam at gmail dot com' + spec.license = 'Artistic 2.0' + spec.homepage = 'https://github.com/djberg96/sys-cpu' + spec.summary = 'A Ruby interface for providing CPU information' + spec.test_file = 'test/test_sys_cpu.rb' + spec.files = Dir['**/*'].reject{ |f| f.include?('git') } + spec.cert_chain = ['certs/djberg96_pub.pem'] + + spec.extra_rdoc_files = ['CHANGES', 'README', 'MANIFEST'] + + # The ffi dependency is only relevent for the Unix version. Given the + # ubiquity of ffi these days, I felt a bogus dependency on ffi for Windows + # and Linux was worth the tradeoff of not having to create 3 separate gems. + spec.add_dependency('ffi') + + spec.add_development_dependency('test-unit') + spec.add_development_dependency('rake') + + spec.description = <<-EOF + The sys-cpu library provides an interface for gathering information + about your system's processor(s). Information includes speed, type, + and load average. + EOF +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu.rb new file mode 100644 index 000000000..65a096817 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu.rb @@ -0,0 +1,23 @@ +####################################################################### +# test_sys_cpu.rb +# +# This isn't a test file, just a file that require's the appropriate +# test file base on the platform you're on. +####################################################################### +require 'rbconfig' +require 'test_sys_cpu_version' + +case RbConfig::CONFIG['host_os'] + when /bsd|darwin|mach|osx/i + require 'test_sys_cpu_bsd' + when /hpux/i + require 'test_sys_cpu_hpux' + when /linux/i + require 'test_sys_cpu_linux' + when /sunos|solaris/i + require 'test_sys_cpu_sunos' + when /mswin|win32|dos|mingw|cygwin/i + require 'test_sys_cpu_windows' + else + raise "Platform not supported" +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu_bsd.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu_bsd.rb new file mode 100644 index 000000000..2f129a768 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu_bsd.rb @@ -0,0 +1,97 @@ +############################################################# +# test_sys_cpu_bsd.rb +# +# The test case for sys-cpu on BSD flavors, including OS X. +############################################################# +require 'sys/cpu' +require 'rbconfig' +require 'test-unit' +require 'test_sys_cpu_version' +include Sys + +class TC_Sys_CPU_BSD < Test::Unit::TestCase + test "architecture method basic functionality" do + assert_respond_to(CPU, :architecture) + assert_nothing_raised{ CPU.architecture } + end + + test "architecture method returns a sane value" do + assert_kind_of(String, CPU.architecture) + assert_true(CPU.architecture.size > 0) + end + + test "architecture method does not accept any arguments" do + assert_raises(ArgumentError){ CPU.architecture(0) } + end + + test "freq method basic functionality" do + assert_respond_to(CPU, :freq) + assert_nothing_raised{ CPU.freq } + end + + test "freq method returns expected value" do + assert_kind_of(Integer, CPU.freq) + assert_true(CPU.freq > 0) + end + + test "freq method does not accept any arguments" do + assert_raises(ArgumentError){ CPU.freq(0) } + end + + test "load_avg method basic functionality" do + assert_respond_to(CPU, :load_avg) + assert_nothing_raised{ CPU.load_avg } + end + + test "load_avg returns the expected results" do + assert_kind_of(Array, CPU.load_avg) + assert_equal(3, CPU.load_avg.length) + assert_kind_of(Float, CPU.load_avg[0]) + end + + test "load_avg does not accept any arguments" do + assert_raises(ArgumentError){ CPU.load_avg(0) } + end + + test "machine method basic functionality" do + assert_respond_to(CPU, :machine) + assert_nothing_raised{ CPU.machine } + end + + test "machine method returns sane value" do + assert_kind_of(String, CPU.machine) + assert_true(CPU.machine.size > 0) + end + + test "machine method does not accept any arguments" do + assert_raises(ArgumentError){ CPU.machine(0) } + end + + test "model method basic functionality" do + assert_respond_to(CPU, :model) + assert_nothing_raised{ CPU.model } + end + + test "model method returns sane value" do + assert_kind_of(String, CPU.model) + assert_true(CPU.model.length > 0) + end + + test "model method does not accept any arguments" do + assert_raises(ArgumentError){ CPU.model(0) } + end + + test "num_cpu method basic functionality" do + assert_respond_to(CPU, :num_cpu) + assert_nothing_raised{ CPU.num_cpu } + end + + test "num_cpu method returns expected value" do + assert_kind_of(Integer, CPU.num_cpu) + assert_true(CPU.num_cpu > 0) + end + + test "num_cpu method does not accept any arguments" do + assert_raises(ArgumentError){ CPU.num_cpu(0) } + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu_hpux.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu_hpux.rb new file mode 100644 index 000000000..a6556af02 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu_hpux.rb @@ -0,0 +1,49 @@ +##################################################################### +# test_sys_cpu_hpux.rb +# +# Test suite for the HP-UX platform. This should be run via the +# 'rake test' task. +##################################################################### +require 'sys/cpu' +require 'test-unit' +require 'test_sys_cpu_version' +include Sys + +class TC_Sys_CPU_HPUX < Test::Unit::TestCase + def test_cpu_freq + assert_respond_to(CPU, :freq) + assert_nothing_raised{ CPU.freq } + assert_nothing_raised{ CPU.freq(0) } + assert_kind_of(Integer, CPU.freq, 'Invalid Type') + end + + def test_num_cpu + assert_respond_to(CPU, :num_cpu) + assert_nothing_raised{ CPU.num_cpu } + assert_kind_of(Integer, CPU.num_cpu, 'Invalid Type') + end + + def test_num_active_cpu + assert_respond_to(CPU, :num_active_cpu) + assert_nothing_raised{ CPU.num_active_cpu } + assert_kind_of(Integer, CPU.num_active_cpu, 'Invalid Type') + end + + def test_cpu_architecture + assert_respond_to(CPU, :architecture) + assert_nothing_raised{ CPU.architecture } + assert_kind_of(String, CPU.architecture, 'Invalid Type') + end + + def test_load_avg + assert_respond_to(CPU, :load_avg) + assert_nothing_raised{ CPU.load_avg } + assert_nothing_raised{ CPU.load_avg(0) } + assert_nothing_raised{ CPU.load_avg{ |e| } } + assert_raises(ArgumentError){ CPU.load_avg(0){ } } + assert_kind_of(Array, CPU.load_avg, 'Invalid Type') + assert_kind_of(Array, CPU.load_avg(0), 'Invalid Type') + assert_equal(3, CPU.load_avg.length, 'Bad number of elements') + assert_equal(3, CPU.load_avg(0).length, 'Bad number of elements') + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu_linux.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu_linux.rb new file mode 100644 index 000000000..c64bdc4e2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu_linux.rb @@ -0,0 +1,31 @@ +########################################################### +# test_sys_cpu_linux.rb +# +# Test Suite for sys-cpu for Linux. This should be run via +# the 'rake test' task. +########################################################### +require 'sys/cpu' +require 'test-unit' +require 'test_sys_cpu_version' +include Sys + +class TC_Sys_CPU_Linux < Test::Unit::TestCase + def test_all_dynamic_methods + assert_nothing_raised{ + CPU.processors{ |cs| + cs.members.each{ |m| cs[m].to_s } + } + } + end + + def test_load_avg + assert_nothing_raised{ CPU.load_avg } + assert_equal(3, CPU.load_avg.length) + end + + def test_cpu_stats + assert_nothing_raised{ CPU.cpu_stats } + assert_kind_of(Hash, CPU.cpu_stats) + assert_equal(true, CPU.cpu_stats['cpu0'].length >= 4) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu_sunos.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu_sunos.rb new file mode 100644 index 000000000..d94ea99bd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu_sunos.rb @@ -0,0 +1,81 @@ +########################################################### +# test_sys_cpu_sunos.rb +# +# Test suite for sys-cpu on Solaris. This should be run +# via the 'rake test' task. +########################################################### +require 'sys/cpu' +require 'test-unit' +include Sys + +class TC_Sys_CPU_SunOS < Test::Unit::TestCase + test "freq method basic functionality" do + assert_respond_to(CPU, :freq) + assert_nothing_raised{ CPU.freq } + end + + test "freq method does not accept any arguments" do + assert_raise(ArgumentError){ CPU.freq(0) } + end + + test "freq method returns a sane value" do + assert_kind_of(Integer, CPU.freq) + assert_true(CPU.freq > 100) + end + + test "fpu_type basic functionality" do + assert_respond_to(CPU, :fpu_type) + assert_nothing_raised{ CPU.fpu_type } + end + + test "fpu_type returns a sane value" do + assert_kind_of(String, CPU.fpu_type) + assert_false(CPU.fpu_type.empty?) + end + + test "load_avg basic functionality" do + assert_respond_to(CPU, :load_avg) + assert_nothing_raised{ CPU.load_avg } + end + + test "load_avg method returns the expected values" do + assert_kind_of(Array, CPU.load_avg) + assert_equal(3, CPU.load_avg.length) + assert_kind_of(Float, CPU.load_avg.first) + end + + test "model method basic functionality" do + assert_respond_to(CPU, :model) + assert_nothing_raised{ CPU.model } + end + + test "model method returns a sane value" do + assert_kind_of(String, CPU.model) + assert_false(CPU.model.empty?) + end + + test "num_cpu method basic functionalty" do + assert_respond_to(CPU, :num_cpu) + assert_nothing_raised{ CPU.num_cpu } + end + + test "num_cpu method returns a sane value" do + assert_kind_of(Integer, CPU.num_cpu) + assert_true(CPU.num_cpu > 0) + end + + test "state basic functionality" do + assert_respond_to(CPU, :state) + assert_nothing_raised{ CPU.state } + end + + test "state method accepts one optional argument" do + assert_nothing_raised{ CPU.state(0) } + assert_raise(ArgumentError){ CPU.state(0,0) } + end + + test "state method returns a sane value" do + assert_kind_of(String, CPU.state(0)) + assert_false(CPU.state.empty?) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu_version.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu_version.rb new file mode 100644 index 000000000..324b3e08d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu_version.rb @@ -0,0 +1,15 @@ +####################################################################### +# test_sys_cpu_version.rb +# +# The sole purpose of this test case is to verify the version number. +# This reduces the pain of having separate tests for the VERSION +# constant in every single test case. +####################################################################### +require 'sys/cpu' +require 'test-unit' + +class TC_Sys_CPU_VERSION < Test::Unit::TestCase + test "version number is set to the expected value" do + assert_equal('0.7.2', Sys::CPU::VERSION) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu_windows.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu_windows.rb new file mode 100644 index 000000000..d5392f041 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-cpu-0.7.2/test/test_sys_cpu_windows.rb @@ -0,0 +1,72 @@ +###################################################################### +# test_sys_cpu_windows.rb +# +# Test suite for MS Windows systems. This should be run via the +# 'rake test' task. +###################################################################### +require 'rubygems' +gem 'test-unit' + +require 'test/unit' +require 'sys/cpu' +require 'test_sys_cpu_version' +require 'socket' +include Sys + +class TC_Sys_CPU_Windows < Test::Unit::TestCase + def self.startup + @@host = Socket.gethostname + end + + def test_architecture + assert_respond_to(CPU, :architecture) + assert_nothing_raised{ CPU.architecture } + assert_nothing_raised{ CPU.architecture(@@host) } + assert_kind_of(String, CPU.architecture, 'Invalid Type') + end + + def test_freq + assert_respond_to(CPU, :freq) + assert_nothing_raised{ CPU.freq } + assert_nothing_raised{ CPU.freq(0) } + assert_nothing_raised{ CPU.freq(0, @@host) } + assert_kind_of(Integer, CPU.freq, 'Invalid Type') + end + + def test_model + assert_respond_to(CPU, :model) + assert_nothing_raised{ CPU.model } + assert_nothing_raised{ CPU.model(@@host) } + assert_kind_of(String, CPU.model, 'Invalid Type') + end + + def test_num_cpu + assert_respond_to(CPU, :num_cpu) + assert_nothing_raised{ CPU.num_cpu } + assert_nothing_raised{ CPU.num_cpu(@@host) } + assert_kind_of(Integer, CPU.num_cpu, 'Invalid Type') + end + + def test_cpu_type + assert_respond_to(CPU, :cpu_type) + assert_nothing_raised{ CPU.cpu_type } + assert_nothing_raised{ CPU.cpu_type(@@host) } + assert_kind_of(String, CPU.cpu_type, 'Invalid Type') + end + + def test_load_avg + assert_respond_to(CPU, :load_avg) + assert_nothing_raised{ CPU.load_avg } + assert_nothing_raised{ CPU.load_avg(0, @@host) } + assert_kind_of(Integer, CPU.load_avg, 'Invalid Type') + end + + def test_processors + assert_respond_to(CPU, :processors) + assert_nothing_raised{ CPU.processors{} } + end + + def self.shutdown + @@host = nil + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/CHANGES b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/CHANGES new file mode 100644 index 000000000..37b63f633 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/CHANGES @@ -0,0 +1,353 @@ +== 0.9.9 - 8-Nov-2015 +* Added support for cgroups on Linux. Thanks go to Dennis Günnewig for the patch. +* Added a sys-proctable.rb file for convenience. +* This gem is now signed. +* Gem related tasks in the Rakefile now assume Rubygems 2.x. + +== 0.9.8 - 18-Apr-2015 +* Fixed a bug in the gemspec. Last version got yanked. + +== 0.9.7 - 18-Apr-2015 +* Fixed a bug in the OSX code that could cause the ps method to fail. Thanks + go to Koshevoy Anton for the spot. +* Some internal refactoring of version handling. Now all platforms use a + single version file. +* Replaced vm_size_t and lwpid_t with universal data types on FreeBSD because + FFI on FreeBSD 10 no longer understands them. Thanks go to Mike Owens for + the spot. + +== 0.9.6 - 24-Feb-2015 +* Added NLWP field on Linux. Thanks go to Rich Chatterton for the patch. + +== 0.9.5 - 10-Feb-2015 +* Significant cleanup and memory reduction of the OSX code. Thanks go + to Ivan (toy) for the patches. +* Skip over /proc//status if unreadable on Linux. Thanks go to Jianjun + Mao for the patch. + +== 0.9.4 - 4-Mar-2014 +* Added support for AIX 5.3 or later courtesy of Rick Ohnemus. +* The Solaris version now uses FFI structs instead of a packed array. + It solved issues with 64-bit versions of Ruby and it's self-documenting. +* The FreeBSD version has been converted to use FFI. In addition, additional + struct members have been added, and members that previously returned nil + now return meaningful data. +* Support for NetBSD and OpenBSD has been temporarily dropped. Considering + that the C code did not build on those platforms anyway, I doubt most of + you will notice. Patches for those platforms are welcome, but only using FFI. + +== 0.9.3 - 17-Mar-2013 +* Fixed a bug on OSX where a long command string arg could cause + a segfault. Thanks go to Nathaniel Bibler for the spot. +* Changed the gem platform from mingw to mingw32 for Windows. + +== 0.9.2 - 8-Oct-2012 +* Added cmdline support for OS X. Thanks go to Matthias Zirnstein for + the patch. +* Warning cleanup for 1.9. +* Updated the gem platform handling. Replaced the borked string approach + with a two element array for Gem::Platform.new. +* MS date strings are now parse with DateTime instead of Date. + +== 0.9.1 - 3-Aug-2011 +* Added the pctcpu and pctmem members for Linux. +* Added Errno::ESRCH to a rescue clause on Linux that fixed a bug + where a missing entry wasn't being skipped when run as root. Thanks + go to Austin Ziegler for the spot and patch. +* Fixed a build warning for Darwin. +* Updates to the test suite for both Darwin and Linux. +* Added an explicit type check for BSD for pids. +* Added nicer error messages for BSD if kvm_open fails. +* Added .core files to the clean task. +* Altered the platform settings in the Rakefile so that generated gems + use 'universal' platform architectures for any particular operating system. + +== 0.9.0 - 14-Oct-2009 +* Changed the license to Artistic 2.0. +* Fixed a bug in the OS X code where a segfault would occur when an attempt + was made to gather resource usage information on zombie processes. From + now on that information is always set to nil for zombie processes. Thanks + go to Tom Lianza for the spot and Philip Kromer for investigating the + root cause of the failure. +* Removed the FreeBSD code that read out of /proc. It was a pain from a + maintenance point of view, and most FreeBSD installs do not mount /proc + by default. The FreeBSD platform now uses the same code that the other + BSD platforms use. +* Fixed a bug in the BSD code where the ProcTable::Error class had the + wrong parent class. +* Some major gemspec updates, including an updated license. The platform + handling logic is now in the Rakefile in the 'gem' task. +* Updated the README file to include an additional acknowledgement, a + license change and some minor formatting changes. +* The test-unit library was changed from a runtime to a development dependency. + +== 0.8.1 - 6-Apr-2009 +* The Linux and Solaris libraries now handle the possibility of a process + terminating in the middle of a read more gracefully. If that happens, they + merely skip to the next record, i.e. it's all or nothing. Thanks go to + Heejong Lee for the spot and patch. +* Fixed a bug in the Linux version where embedded nulls were not being + stripped out of the cmdline data. +* Added the comm alias back to the Solaris version. Thanks go to Jun Young Kim + for the spot. + +== 0.8.0 - 26-Jan-2009 +* The Linux and Solaris versions of this library are now pure Ruby. Be warned, + however, that only Solaris 8 and later are now supported. This may change + in a future release if there's demand to support 2.6 and 2.7. +* Some Struct::ProcTableStruct members have changed. As a general rule they + now more closely match the C struct member name. See individual platforms + for more details. +* Bug fix for the cmd_args struct member on Solaris. +* Bug fixes for OS X. Added a VERSION constant, fixed struct name, and changed + pct_cpu to pctcpu. +* The .new method is now explicitly illegal. +* The Struct::ProcTableStruct instances are now frozen. This is read-only data. +* Added the peak_page_file_usage and status members on MS Windows. The status + member is always nil, but was added for completeness. +* Fixed the quota_peak_paged_pool_usage member on MS Windows. +* ProcTableError is now ProcTable::Error. +* Minor test case fix for kvm/bsd based versions. +* Added the 'time' library as a require for Windows (to parse MS date/time + format strings). +* The kvm (bsd.c) implementation now works for FreeBSD 7. +* Added many more tests. +* Added some benchmarking code in the 'benchmarks' directory. +* Added a 'bench' Rake task. +* Renamed the test_ps.rb file to example_ps.rb in order to avoid any possible + confusion with actual test files. +* Added an 'example' rake task to run the example file. + +== 0.7.6 - 11-Jul-2007 +* Fixed the starttime for Linux. Thanks go to Yaroslav Dmitriev for the spot. +* Fixed a bug in the MS Windows version within a private method that parsed + an MS specific date format. This was caused by a backwards incompatible + change in the Time.parse method in Ruby 1.8.6. See ruby-core: 11245 ff. +* Fixed the gemspec (I hope). Please let me know if you have problems. +* Added a Rakefile. Building, testing and installing should now be handled via + Rake tasks. The install.rb file has been removed - that code is now + integrated in the Rakefile. +* Minor directory layout changes and cleanup (mostly for the extconf.rb file). +* Side note - it seems that the code for OS X *does* work, at least on 10.4.10. + I can only conclude that previous reports about it failing were related to + bugs in OS X or were really just build issues. Apologies (and thanks, again) + to David Felstead for the code. However, see the README for more information + specific to OS X, as there are shortcomings. + +== 0.7.5 - 23-Nov-2006 +* Fixed int/long issues for Linux. Thanks go to Matt Lightner for the spot. +* Minor documentation fixes and changes to the extconf.rb file. + +== 0.7.4 - 20-Nov-2006 +* Added a patch that deals with the large file compilation issue on Solaris. + You no longer need to build Ruby with --disable-largefile, or build a + 64 bit Ruby, in order for this package to work. Thanks go to Steven Jenkins + for the information that led to the patch. +* Added inline rdoc to the source code. +* Added a gemspec. +* Fixed some potential 64 bit issues (struct declarations). +* Added preliminary support for Darwin (OS X). The code was provided by + David Felstead, but does not appear to compile successfully. Help wanted. + +== 0.7.3 - 27-Oct-2005 +* Fix for 1.8.3 and later (rb_pid_t). This should have only affected + Solaris. + +== 0.7.2 - 15-May-2005 +* Bug fix for the FreeBSD version that reads from /proc. +* Eliminated the test bug on Linux (inexplicably caused by File.copy). The + test suite should now run without segfaulting. +* Include bsd.c in tarball (oops). +* Minor test updates for FreeBSD. +* The 'pct_cpu' member for the BSD/kvm version has been changed to 'pctcpu' + for consistency with other platforms. + +== 0.7.1 - 8-May-2005 +* Bug fixed for the cmdline info on Linux. Thanks go to Arash Abedinzadeh + for the spot. +* Added an example program. +* Minor setup fix for Win32 in tc_all.rb. + +== 0.7.0 - 25-Apr-2005 +* Scrapped the C implementation for Windows in favor of an OLE + WMI pure Ruby + approach. See documentation for details. +* Added an optional lkvm implementation for BSD users. This is automatically + used if the /proc filesystem isn't found. +* Added prusage info for the Solaris version. +* Added name, eid, euid, gid and guid information for Linux. Thanks go to + James Hranicky for the patch. +* Fixed some potential bugs in the Linux version. Thanks go to James + Hranicky for the spot. +* Added the 'sys/top' package. +* ProcTable.fields no longer supports a block form. +* The BTIME (boot time) information has been removed from the Linux version. + If you want that information, use sys-uptime instead. +* The .html and .rd files have been removed. You can generate html on your + own with rdoc if you like. +* Some code cleanup on the C side of the house. +* Most documents made rdoc friendly. +* Renamed 'install_pure_ruby.rb' to just 'install.rb'. +* Removed the 'INSTALL' file. Installation instructions are in the README. +* Some test suite cleanup and reorganization. +* Moved project to RubyForge. + +== 0.6.4 - 31-Mar-2004 +* Fixed a bug in the pure Ruby version for Win32. Thanks go to Mark Hudson + for the spot. +* Fixed a bug in the C implementation for Win32 where the cmdline and path + values were sometimes wrong for running processes. Thanks go to Park Heesob + for the fix. +* Updated the VERSION constant and removed the VERSION class method in the + pure Ruby version for Win32. +* Updated install_pure_ruby.rb and test.rb scripts. +* Updated warranty information. +* The extconf.rb script has been revamped. See the INSTALL and README files + for important changes since the last release. +* The start ProcInfo struct member on Solaris, HP-UX and FreeBSD is now a + Time object, not a Fixnum/Bignum. +* Modified linux.c yet again to make gcc happy when it comes to multi-line + string literals. +* Minor change to way process state is handled on HP-UX. +* Documentation additions and updates, including warranty information. + +== 0.6.3 - 24-Feb-2004 +* Fixed a bug in the Solaris version where the cmd_args array did not + necessarily contain data on 2.7 and later. The current patch still + does not quite fix the problem for 2.6 and earlier but can be easily + derived manually by parsing the cmdline string. + +== 0.6.2 - 20-Jan-2004 +* Fixed a small memory leak in the solaris version. + +== 0.6.1 - 31-Dec-2003 +* Fixed a minor bug in the cmdline field on Linux where a blank character + was being appended to the end of the field. +* Fixed a minor annoyance where the windows.rb file was being copied into + the Ruby lib directory on install. +* Added a test_memleak.rb file. Currently only supported on Linux and + only does a file descriptor count check. I plan to expand this to + other platforms in the future. +* Minor test suite changes +* MANIFEST correction and update. + +== 0.6.0 - 22-Oct-2003 +* Significant API change (and thus, a version jump) - only a + single argument is now accepted to the ps() method, and only a PID + (Fixnum) is regarded as a valid argument. +* Calling ps() with a pid returns a single ProcTable struct (or nil + if the pid is not found), instead of a one element array. +* Argument to ps() now works properly on HP-UX and Win32. +* Removed the '#include ' in sunos.h. It wasn't needed + and you're not supposed to include it directly. +* Fixed 2.6 compatibility issue with regards to cmdline on Solaris. +* Removed the ProcStatException completely on Linux. There was no reason + to fail on a directory read for /proc/xxx/stat. If the read fails + (meaning the process died in the middle of collecting info for it), it + is simply ignored. +* The ttynum bug on HPUX has been fixed. In addition, the return value for + this field is now a string rather than an int and the field name has + been changed to "ttydev". +* The ttynum field has been changed to ttydev on Solaris and HPUX. On + Solaris, the ttydev is now reported as -1 if there is no associated tty. + In a future release, Solaris and the other *nix platforms will be changed + so that ttydev is always a device name (i.e String). +* Added plain text documentation for all platforms. +* Some test suite cleanup. +* Changed .rd2 extension to just '.rd'. + +== 0.5.2 - 18-Jul-2003 +* Modified cmdline to extend past the traditional 80 character limit on + Solaris, where possible (Solaris 2.6+ only). +* Added the cmdline_args and num_args fields on Solaris, which returns + an array of cmdline arguments and the number of cmdline arguments, + respectively. +* Minor modification to fields() method, in addition to warning cleanup + for Solaris. +* Changed "defunct" state string to "zombie" for Solaris. +* Should cleanly compile with -Wall -W now (gcc) on Solaris. +* Added solaris.txt to doc directory. +* MANIFEST corrections. + +== 0.5.1 - 16-Jul-2003 +* Fixed a nasty file descriptor bug in the Linux code, where file descriptors + were continuously being used up. +* Added the BTIME (boot time) constant for Linux. +* Fixed up the test/test.rb file a bit. +* Added BTIME tests to tc_linux.rb. + +== 0.5.0 - 11-Jul-200 +* Added HP-UX support! +* Note that passing PID's or strings as arguments to ps() is not supported + in the HP-UX version. This functionality will be stripped out of the + other versions in a future release. See the README file for more details. +* Removed the VERSION() class method. Use the constant instead. +* Separated the rd docs from their respective source files. Now in the doc + directory. +* Got rid of the interactive html generation in extconf.rb. +* Changed License to Artistic. + +== 0.4.3 - 30-May-2003 +* Added a version.h file to store the version number. Modified all of the + C source files to use that instead of hard coding the version everywhere. +* Added a generic test.rb script for those without TestUnit installed, or + just futzing in general. Modified the extconf.rb script to copy this + instead of writing an inline HERE document. +* Modified extconf.rb so that it builds with mingw or cygwin. Thanks go to + Peter Fischer for the spot and patch. +* Modified test suite to work with TestUnit 0.1.6 or 0.1.8. + +== 0.4.2 - 14-Apr-2003 +* Added pure Ruby version for Win32 - thanks Park Heesob. +* Modified extconf.rb file to handle pure Ruby versions. +* Added install_pure_ruby.rb file, an alternate installation + script for pure Ruby versions. + +== 0.4.1 - 31-Mar-2003 +* Added support for Solaris 2.5.x. +* All exceptions are now a direct subclass of StandardError. +* Value returned for wchan now more meaningful (2.5.x only for now). +* Fixed the start, utime and ctime for FreeBSD. +* Minor fix to FreeBSD test suite. +* Some changes to extconf.rb. +* Minor doc changes. +* Added License and Copyright info. + +== 0.4.0 - 10-Mar-2003 +* Added MS Windows support (non-cygwin). +* Added environment information for Linux version. +* Added real exceptions (type depends on platform). +* Added a test suite (for those with testunit installed). +* Removed the sys-uname requirement. +* Heavily modified the extconf.rb script. +* Changed "Changelog" to "CHANGES" and "Manifest" to "MANIFEST". +* Added a VERSION constant and class method. +* Minor internal directory layout change (put 'os' under 'lib'). +* Changed package name to lower case. +* Doc changes, including license information. + +== 0.3.1 - 16-Aug-2002 +* Added a "comm" field to the sunos version. I am going to try to make this a + common field for all platforms to help reduce RUBY_PLATFORM checking. +* Fixed the release date for 0.3.0 (was accidentally marked *July*). +* Added an INSTALL file. +* Minor documentation change to the sunos.c source file. + +== 0.3.0 - 11-Aug-2002 +* Added FreeBSD support! +* Struct name changed to just "ProcTableStruct" to be compliant with future + versions of Ruby. +* The ps() function now returns an array of ProcTableStruct's in lvalue context. +* Fixed the ability to search by process name in Linux. +* Modified Linux "comm" field to strip parenthesis. +* Some doc changes/additions. +* Added Sean Chittenden to the "Acknowledgements" section. Sean provided me + with access to a FreeBSD box, which is how I was able to provide FreeBSD + support. Thanks Sean! + +== 0.2.0 - 19-Jul-2002 +* Added the ability to search by process name. +* test.rb modified to be cross-platform. +* Solaris - fixed bug with fname (was accidentally called "name"). + +== 0.1.0 - 2-Jul-2002 +- Initial release. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/MANIFEST b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/MANIFEST new file mode 100644 index 000000000..0a6e1d280 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/MANIFEST @@ -0,0 +1,34 @@ +* CHANGES +* MANIFEST +* Rakefile +* README +* sys-proctable.gemspec +* doc/aix.txt +* doc/bsd.txt +* doc/hpux.txt +* doc/linux.txt +* doc/solaris.txt +* doc/top.txt +* doc/windows.txt +* example/example_ps.rb +* ext/darwin/extconf.rb +* ext/darwin/sys/proctable.c +* ext/hpux/extconf.rb +* ext/hpux/sys/proctable.c +* lib/sys-proctable.rb +* lib/sys/top.rb +* lib/sys/proctable/version.rb +* lib/aix/sys/proctable.rb +* lib/freebsd/sys/proctable.rb +* lib/linux/sys/proctable.rb +* lib/sunos/sys/proctable.rb +* lib/windows/sys/proctable.rb +* test/test_sys_proctable_aix.rb +* test/test_sys_proctable_all.rb +* test/test_sys_proctable_darwin.rb +* test/test_sys_proctable_freebsd.rb +* test/test_sys_proctable_hpux.rb +* test/test_sys_proctable_linux.rb +* test/test_sys_proctable_sunos.rb +* test/test_sys_proctable_windows.rb +* test/test_sys_top.rb diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/README b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/README new file mode 100644 index 000000000..50b5df95c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/README @@ -0,0 +1,118 @@ +== Description + A Ruby interface for gathering process information. + +== Prerequisites +* Test::Unit 2.x (development only) + +== Supported Platforms +* Windows 2000 or later +* Linux 2.6+ +* FreeBSD +* Solaris 8+ +* HP-UX 10+ +* OS X 10.4+ +* AIX 5.3+ + +== Installation + gem install sys-proctable + + You may need to specify a platform in some cases. For example: + + gem install sys-proctable --platform mswin32 # Windows + gem install sys-proctable --platform sunos # Solaris + gem install sys-proctable --platform linux # Linux + gem install sys-proctable --platform freebsd # FreeBSD + +== Synopsis + require 'sys/proctable' + include Sys + + # Everything + ProcTable.ps{ |p| + puts p.pid.to_s + puts p.comm + # ... + } + + # Just one process + s = ProcTable.ps(2123) + puts s.pid.to_s + puts s.comm + # ... + + # Return the results as an array of ProcTableStructs + a = ProcTable.ps + a.each do |p| + puts p.pid + # ... + end + +== Notes + Windows users may pass a host name as a second argument to get process + information from a different host. This relies on the WMI service running. + +== Known Issues +=== FreeBSD + A kvm interface is used. That means the owner of the process using the + sys-proctable library needs to be a member of the kvm group (or root). + +=== Solaris + The cmdline member on Solaris is limited to 80 characters unless you (or + your program) own the process. This is a Solaris design flaw/feature. + +=== Thread Safety + I am not currently using a thread-safe version of readdir() for versions + of this library that use C. I am not especially concerned about it either. + If you are trying to read information out of /proc from different threads + at the same time there is something seriously wrong with your code logic. + Using readdir_r() still won't solve all potential thread safety issues anyway. + +== Future Plans + Add support for NetBSD and OpenBSD. + Convert existing C code to FFI. + +== Acknowledgements + This library was originally based on the Perl module Proc::ProcessTable + by Dan Urist. Many ideas, as well as large chunks of code, were taken + from his work. So, a big THANK YOU goes out to Dan Urist. + + A big thanks also goes out to Mike Hall who was very helpful with ideas, + logic and testing. + + Thanks also go to Sean Chittenden for providing an account on one of his + FreeBSD machines. This is how the FreeBSD support was (initially) added. + + Thanks go to James Hranicky for providing a patch that grabs name, eid, + euid, gid and guid info in the Linux version, along with some general + debugging help. + + Thanks go to David Felstead for the original OS X code. Thanks also go + to Matthias Zirnstein for adding cmdline support for OS X. + + Finally I'd like to thank all the folks who have submitted bug reports + and/or patches. + +== Help Wanted + I do not have access to all platforms. If your platform is not supported + then you will need to either submit a patch or give me a remote account + on a box with a compiler so that I can write the code. + +== More documentation + See the documentation under the 'doc' directory for more information, + including platform specific notes and issues. + +== License + Artistic 2.0 + +== Copyright + (C) 2003-2015 Daniel J. Berger + All Rights Reserved. + +== Contributions + Although this library is free, please consider having your company + setup a gittip if used by your company professionally. + + http://www.gittip.com/djberg96/ + +== Author + Daniel J. Berger diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/Rakefile new file mode 100644 index 000000000..4439b1c00 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/Rakefile @@ -0,0 +1,218 @@ +require 'rake' +require 'rake/clean' +require 'rake/testtask' +require 'rbconfig' +include RbConfig + +CLEAN.include( + '**/*.core', # Core dump files + '**/*.gem', # Gem files + '**/*.rbc', # Rubinius + '**/*.rbx', # Rubinius + '**/*.o', # C object file + '**/*.log', # Ruby extension build log + '**/Makefile', # C Makefile + '**/conftest.dSYM', # OS X build directory + "**/*.#{CONFIG['DLEXT']}" # C shared object +) + +desc 'Build the sys-proctable library for C versions of sys-proctable' +task :build => [:clean] do + if RUBY_PLATFORM == 'java' + if ENV['JRUBY_OPTS'] + ENV['JRUBY_OPTS'] += ' -Xcext.enabled=true' + else + ENV['JRUBY_OPTS'] = '-Xcext.enabled=true' + end + end + + case CONFIG['host_os'] + when /darwin/i + dir = 'ext/darwin' + ext = '.bundle' + when /hpux/i + dir = 'ext/hpux' + ext = '.sl' + end + + if CONFIG['host_os'] =~ /darwin|hpux/i + Dir.chdir(dir) do + ruby 'extconf.rb' + sh 'make' + cp 'proctable' + ext, 'sys' + end + end +end + +desc 'Install the sys-proctable library' +task :install => [:build] do + file = nil + dir = File.join(CONFIG['sitelibdir'], 'sys') + + Dir.mkdir(dir) unless File.exists?(dir) + + case CONFIG['host_os'] + when /mswin|win32|msdos|cygwin|mingw|windows/i + file = 'lib/windows/sys/proctable.rb' + when /linux/i + file = 'lib/linux/sys/proctable.rb' + when /sunos|solaris/i + file = 'lib/sunos/sys/proctable.rb' + when /aix/i + file = 'lib/aix/sys/proctable.rb' + when /freebsd/i + file = 'lib/freebsd/sys/proctable.rb' + when /darwin/i + Dir.chdir('ext/darwin'){ sh 'make install' } + when /hpux/i + Dir.chdir('ext/hpux'){ sh 'make install' } + end + + cp(file, dir, :verbose => true) if file +end + +desc 'Uninstall the sys-proctable library' +task :uninstall do + case CONFIG['host_os'] + when /darwin|hpux/i + dir = File.join(CONFIG['sitearchdir'], 'sys') + file = File.join(dir, 'proctable.' + CONFIG['DLEXT']) + else + dir = File.join(CONFIG['sitelibdir'], 'sys') + file = File.join(dir, 'proctable.rb') + end + + rm(file) +end + +desc 'Run the benchmark suite' +task :bench => [:build] do + sh "ruby -Ilib benchmarks/bench_ps.rb" +end + +desc 'Run the example program' +task :example => [:build] do + sh 'ruby -Ilib -Iext examples/example_ps.rb' +end + +desc 'Run the test suite' +Rake::TestTask.new do |t| + task :test => :build + t.libs << 'test' << '.' + + case CONFIG['host_os'] + when /mswin|msdos|cygwin|mingw|windows/i + t.test_files = FileList['test/test_sys_proctable_windows.rb'] + t.libs << 'lib/windows' + when /linux/i + t.test_files = FileList['test/test_sys_proctable_linux.rb'] + t.libs << 'lib/linux' + when /sunos|solaris/i + t.test_files = FileList['test/test_sys_proctable_sunos.rb'] + t.libs << 'lib/sunos' + when /aix/i + t.test_files = FileList['test/test_sys_proctable_aix.rb'] + t.libs << 'lib/aix' + when /freebsd/i + t.test_files = FileList['test/test_sys_proctable_freebsd.rb'] + t.libs << 'lib/freebsd' + when /darwin/i + t.libs << 'ext/darwin' + t.test_files = FileList['test/test_sys_proctable_darwin.rb'] + when /hpux/i + t.libs << 'ext/hpux' + t.test_files = FileList['test/test_sys_proctable_hpux.rb'] + end +end + +namespace :gem do + desc 'Create a gem for the specified OS, or your current OS by default' + task :create, [:os] => [:clean] do |_task, args| + require 'rubygems/package' + + if args.is_a?(String) + os = args + else + args.with_defaults(:os => CONFIG['host_os']) + os = args[:os] + end + + spec = eval(IO.read('sys-proctable.gemspec')) + spec.files += ['lib/sys-proctable.rb'] + + # I've had to manually futz with the spec here in some cases + # in order to get the universal platform settings I want because + # of some bugginess in Rubygems' platform.rb. + # + case os + when /freebsd/i + spec.platform = Gem::Platform.new(['universal', 'freebsd']) + spec.require_paths = ['lib', 'lib/freebsd'] + spec.files += ['lib/freebsd/sys/proctable.rb'] + spec.test_files << 'test/test_sys_proctable_freebsd.rb' + spec.add_dependency('ffi') + when /darwin/i + spec.platform = Gem::Platform.new(['universal', 'darwin']) + spec.files << 'ext/darwin/sys/proctable.c' + spec.extra_rdoc_files << 'ext/darwin/sys/proctable.c' + spec.test_files << 'test/test_sys_proctable_darwin.rb' + spec.extensions = ['ext/darwin/extconf.rb'] + when /hpux/i + spec.platform = Gem::Platform.new(['universal', 'hpux']) + spec.files << 'ext/hpux/sys/proctable.c' + spec.extra_rdoc_files << 'ext/hpux/sys/proctable.c' + spec.test_files << 'test/test_sys_proctable_hpux.rb' + spec.extensions = ['ext/hpux/extconf.rb'] + when /linux/i + spec.platform = Gem::Platform.new(['universal', 'linux']) + spec.require_paths = ['lib', 'lib/linux'] + spec.files += ['lib/linux/sys/proctable.rb', 'lib/linux/sys/proctable/cgroup_entry.rb'] + spec.test_files << 'test/test_sys_proctable_linux.rb' + when /sunos|solaris/i + spec.platform = Gem::Platform.new(['universal', 'solaris']) + spec.require_paths = ['lib', 'lib/sunos'] + spec.files += ['lib/sunos/sys/proctable.rb'] + spec.test_files << 'test/test_sys_proctable_sunos.rb' + when /aix/i + spec.platform = Gem::Platform.new(['universal', 'aix5']) + spec.require_paths = ['lib', 'lib/aix'] + spec.files += ['lib/aix/sys/proctable.rb'] + spec.test_files << 'test/test_sys_proctable_aix.rb' + when /mswin|win32|dos|cygwin|mingw|windows/i + spec.platform = Gem::Platform.new(['universal', 'mingw32']) + spec.require_paths = ['lib', 'lib/windows'] + spec.files += ['lib/windows/sys/proctable.rb'] + spec.test_files << 'test/test_sys_proctable_windows.rb' + else + raise "Unsupported platform: #{os}" + end + + spec.test_files << 'test/test_sys_top.rb' + + # https://github.com/rubygems/rubygems/issues/147 + spec.original_platform = spec.platform + + spec.signing_key = File.join(Dir.home, '.ssh', 'gem-private_key.pem') + + Gem::Package.build(spec, true) + end + + desc 'Create a gem for each supported OS' + task :create_all => [:clean] do + platforms = %w[aix darwin freebsd hpux linux solaris windows] + Rake::Task["clean"].execute + platforms.each{ |os| + FileUtils.mkdir_p("pkg/#{os}") + Rake::Task["gem:create"].execute(os) + Dir.glob("*.gem").each{ |gem| FileUtils.mv(gem, "pkg/#{os}") } + } + end + + desc 'Install the sys-proctable library as a gem' + task :install => [:create] do + gem_name = Dir['*.gem'].first + sh "gem install -l #{gem_name}" + end +end + +task :default => :test diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/benchmarks/bench_ps.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/benchmarks/bench_ps.rb new file mode 100644 index 000000000..69a6c761f --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/benchmarks/bench_ps.rb @@ -0,0 +1,21 @@ +######################################################################## +# bench_ps.rb +# +# Benchmark program to show overall speed and compare the block form +# versus the non-block form. You should run this benchmark via the +# 'rake bench' Rake task. +######################################################################## +require 'benchmark' +require 'sys/proctable' + +MAX = 10 + +Benchmark.bm do |bench| + bench.report("Block form"){ + MAX.times{ Sys::ProcTable.ps{} } + } + + bench.report("Non-block form"){ + MAX.times{ Sys::ProcTable.ps } + } +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/doc/top.txt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/doc/top.txt new file mode 100644 index 000000000..9eaf75495 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/doc/top.txt @@ -0,0 +1,47 @@ += Description + A simple 'top' interface for Ruby + += Prerequisites + Requires the "sys/proctable" package (which should be installed along + with this package). + += Synopsis + require "sys/top" + + Sys::Top.top(5).each{ |ps| + p ps + } + += Constants +VERSION + Returns the version number of this package as a String. + += Class Methods +Sys::Top.top(number=10, field="pctcpu") + Returns an array of ProcTableStruct's. The size of the array (i.e. the + number of processes) that it returns is based on +number+, and sorted by + +pctcpu+. By default, the size and field values are 10 and "pctcpu", + respectively. + += Notes + Not all fields are available on all platforms. Please check your + platform specific documentation for which fields are available. + += Bugs + None that I'm aware of. Please log bug reports on the project page at + http://www.rubyforge.org/projects/sysutils + += License + Artistic 2.0 + += Copyright + (C) 2004-2009 Daniel J. Berger + All Rights Reserved. + += Warranty + This package is provided "as is" and without any express or + implied warranties, including, without limitation, the implied + warranties of merchantability and fitness for a particular purpose. + += Author + Daniel J. Berger \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/examples/example_ps.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/examples/example_ps.rb new file mode 100644 index 000000000..a255c80e6 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/examples/example_ps.rb @@ -0,0 +1,20 @@ +####################################################################### +# example_ps.rb +# +# Generic test program that demonstrates the use of ProcTable.ps. You +# can run this via the 'rake example' task. +# +# Modify as you see fit +####################################################################### +require 'sys/proctable' +include Sys + +puts "VERSION: " + ProcTable::VERSION +sleep 2 + +ProcTable.ps{ |s| + ProcTable.fields.each{ |field| + puts "#{field}: " + s.send(field).to_s + } + puts '=' * 30 +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/ext/darwin/Makefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/ext/darwin/Makefile new file mode 100644 index 000000000..bc07fdbba --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/ext/darwin/Makefile @@ -0,0 +1,187 @@ + +SHELL = /bin/sh + +#### Start of system configuration section. #### + +srcdir = sys +topdir = /Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 +hdrdir = /Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 +arch_hdrdir = /Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/$(arch) +VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby +prefix = $(DESTDIR)/Users/tacyas/Eos/util/X86MAC64 +rubylibprefix = $(libdir)/$(RUBY_BASE_NAME) +exec_prefix = $(prefix) +vendorhdrdir = $(rubyhdrdir)/vendor_ruby +sitehdrdir = $(rubyhdrdir)/site_ruby +rubyhdrdir = $(includedir)/$(RUBY_BASE_NAME)-$(ruby_version) +vendordir = $(rubylibprefix)/vendor_ruby +sitedir = $(rubylibprefix)/site_ruby +ridir = $(datarootdir)/$(RI_BASE_NAME) +mandir = $(datarootdir)/man +localedir = $(datarootdir)/locale +libdir = $(exec_prefix)/lib +psdir = $(docdir) +pdfdir = $(docdir) +dvidir = $(docdir) +htmldir = $(docdir) +infodir = $(datarootdir)/info +docdir = $(datarootdir)/doc/$(PACKAGE) +oldincludedir = $(DESTDIR)/usr/include +includedir = $(prefix)/include +localstatedir = $(prefix)/var +sharedstatedir = $(prefix)/com +sysconfdir = $(prefix)/etc +datadir = $(datarootdir) +datarootdir = $(prefix)/share +libexecdir = $(exec_prefix)/libexec +sbindir = $(exec_prefix)/sbin +bindir = $(exec_prefix)/bin +rubylibdir = $(rubylibprefix)/$(ruby_version) +archdir = $(rubylibdir)/$(arch) +sitelibdir = $(sitedir)/$(ruby_version) +sitearchdir = $(sitelibdir)/$(sitearch) +vendorlibdir = $(vendordir)/$(ruby_version) +vendorarchdir = $(vendorlibdir)/$(sitearch) + +CC = gcc +CXX = g++ +LIBRUBY = $(LIBRUBY_A) +LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a +LIBRUBYARG_SHARED = -l$(RUBY_SO_NAME) +LIBRUBYARG_STATIC = -l$(RUBY_SO_NAME)-static +OUTFLAG = -o +COUTFLAG = -o + +RUBY_EXTCONF_H = +cflags = $(optflags) $(debugflags) $(warnflags) +optflags = -O3 +debugflags = -ggdb +warnflags = -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long +CFLAGS = -fno-common $(cflags) -pipe +INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir)/ruby/backward -I$(hdrdir) -I$(srcdir) +DEFS = +CPPFLAGS = -DHAVE_TYPE_RB_PID_T -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE $(DEFS) $(cppflags) +CXXFLAGS = $(CFLAGS) $(cxxflags) +ldflags = -L. -L/usr/local/lib +dldflags = -Wl,-undefined,dynamic_lookup -Wl,-multiply_defined,suppress -Wl,-flat_namespace +ARCH_FLAG = +DLDFLAGS = $(ldflags) $(dldflags) +LDSHARED = $(CC) -dynamic -bundle +LDSHAREDXX = $(CXX) -dynamic -bundle +AR = ar +EXEEXT = + +RUBY_BASE_NAME = ruby +RUBY_INSTALL_NAME = ruby +RUBY_SO_NAME = ruby +arch = x86_64-darwin13.2.0 +sitearch = $(arch) +ruby_version = 1.9.1 +ruby = /Users/tacyas/Eos/util/X86MAC64/bin/ruby +RUBY = $(ruby) +RM = rm -f +RM_RF = $(RUBY) -run -e rm -- -rf +RMDIRS = $(RUBY) -run -e rmdir -- -p +MAKEDIRS = mkdir -p +INSTALL = /usr/bin/install -c +INSTALL_PROG = $(INSTALL) -m 0755 +INSTALL_DATA = $(INSTALL) -m 644 +COPY = cp + +#### End of system configuration section. #### + +preload = + +libpath = . $(libdir) +LIBPATH = -L. -L$(libdir) +DEFFILE = + +CLEANFILES = mkmf.log +DISTCLEANFILES = +DISTCLEANDIRS = + +extout = +extout_prefix = +target_prefix = /sys +LOCAL_LIBS = +LIBS = -lpthread -ldl -lobjc +SRCS = proctable.c +OBJS = proctable.o +TARGET = proctable +DLLIB = $(TARGET).bundle +EXTSTATIC = +STATIC_LIB = + +BINDIR = $(bindir) +RUBYCOMMONDIR = $(sitedir)$(target_prefix) +RUBYLIBDIR = /Users/tacyas/Eos/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/lib$(target_prefix) +RUBYARCHDIR = /Users/tacyas/Eos/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/lib$(target_prefix) +HDRDIR = $(rubyhdrdir)/ruby$(target_prefix) +ARCHHDRDIR = $(rubyhdrdir)/$(arch)/ruby$(target_prefix) + +TARGET_SO = $(DLLIB) +CLEANLIBS = $(TARGET).bundle +CLEANOBJS = *.o *.bak + +all: $(DLLIB) +static: $(STATIC_LIB) +.PHONY: all install static install-so install-rb +.PHONY: clean clean-so clean-rb + +clean-rb-default:: +clean-rb:: +clean-so:: +clean: clean-so clean-rb-default clean-rb + @-$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) + +distclean-rb-default:: +distclean-rb:: +distclean-so:: +distclean: clean distclean-so distclean-rb-default distclean-rb + @-$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log + @-$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES) + @-$(RMDIRS) $(DISTCLEANDIRS) + +realclean: distclean +install: install-so install-rb + +install-so: $(RUBYARCHDIR) +install-so: $(RUBYARCHDIR)/$(DLLIB) +$(RUBYARCHDIR)/$(DLLIB): $(DLLIB) + @-$(MAKEDIRS) $(@D) + $(INSTALL_PROG) $(DLLIB) $(@D) +install-rb: pre-install-rb install-rb-default +install-rb-default: pre-install-rb-default +pre-install-rb: Makefile +pre-install-rb-default: Makefile +$(RUBYARCHDIR): + $(MAKEDIRS) $@ + +site-install: site-install-so site-install-rb +site-install-so: install-so +site-install-rb: install-rb + +.SUFFIXES: .c .m .cc .cxx .cpp .C .o + +.cc.o: + $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< + +.cxx.o: + $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< + +.cpp.o: + $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< + +.C.o: + $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< + +.c.o: + $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $< + +$(DLLIB): $(OBJS) Makefile + @-$(RM) $(@) + $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS) + + + +$(OBJS): $(hdrdir)/ruby.h $(hdrdir)/ruby/defines.h $(arch_hdrdir)/ruby/config.h diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/ext/darwin/extconf.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/ext/darwin/extconf.rb new file mode 100644 index 000000000..44f50f426 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/ext/darwin/extconf.rb @@ -0,0 +1,4 @@ +require 'mkmf' + +have_type('rb_pid_t', 'ruby.h') +create_makefile('sys/proctable', 'sys') \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/ext/darwin/mkmf.log b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/ext/darwin/mkmf.log new file mode 100644 index 000000000..ea4889a3c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/ext/darwin/mkmf.log @@ -0,0 +1,24 @@ +have_type: checking for rb_pid_t in ruby.h... -------------------- yes + +"gcc -o conftest -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe conftest.c -L. -L/Users/tacyas/Eos/util/X86MAC64/lib -L. -L/usr/local/lib -lruby-static -lpthread -ldl -lobjc " +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: int main() {return 0;} +/* end */ + +"gcc -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/x86_64-darwin13.2.0 -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1/ruby/backward -I/Users/tacyas/Eos/util/X86MAC64/include/ruby-1.9.1 -I. -D_XOPEN_SOURCE -D_DARWIN_C_SOURCE -O3 -ggdb -Wextra -Wno-unused-parameter -Wno-parentheses -Wpointer-arith -Wwrite-strings -Wno-missing-field-initializers -Wshorten-64-to-32 -Wno-long-long -pipe -c conftest.c" +checked program was: +/* begin */ +1: #include "ruby.h" +2: +3: #include +4: +5: /*top*/ +6: typedef rb_pid_t conftest_type; +7: int conftestval[sizeof(conftest_type)?1:-1]; +/* end */ + +-------------------- + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/ext/darwin/proctable.bundle b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/ext/darwin/proctable.bundle new file mode 100755 index 000000000..a9189d02c Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/ext/darwin/proctable.bundle differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/ext/darwin/proctable.o b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/ext/darwin/proctable.o new file mode 100644 index 000000000..af2894219 Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/ext/darwin/proctable.o differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/ext/darwin/sys/proctable.c b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/ext/darwin/sys/proctable.c new file mode 100644 index 000000000..8d354dda4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/ext/darwin/sys/proctable.c @@ -0,0 +1,451 @@ +/********************************************************************** + * Mac OS X code for sys-proctable Ruby library. * + * * + * Date: 3-Mar-2006 (original submission date) * + * Author: David Felstead (david.felstead at gmail dot com) * + * Based on bsd.c by Daniel J. Berger (djberg96 at gmail dot com) * + *********************************************************************/ +#include "ruby.h" +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +#define pid_of(pproc) pproc->kp_proc.p_pid + +#define PROC_MIB_LEN 4 +#define ARGS_MIB_LEN 3 + +#ifndef ARGS_MAX_LEN +#define ARGS_MAX_LEN sysconf(_SC_ARG_MAX) +#endif + +VALUE cProcTableError, sProcStruct; + +int argv_of_pid(int pid, VALUE* v_cmdline, VALUE* v_exe, VALUE* v_environ) { + int mib[3], argmax, nargs, c = 0; + size_t size; + char *procargs, *sp, *np, *cp; + int show_args = 1; + + mib[0] = CTL_KERN; + mib[1] = KERN_ARGMAX; + + size = sizeof(argmax); + + if (sysctl(mib, 2, &argmax, &size, NULL, 0) == -1) + goto ERROR_A; + + // Allocate space for the arguments. + procargs = (char *)ruby_xmalloc(argmax); + + /* + * Make a sysctl() call to get the raw argument space of the process. + * The layout is documented in start.s, which is part of the Csu + * project. In summary, it looks like: + * + * /---------------\ 0x00000000 + * : : + * : : + * |---------------| + * | argc | + * |---------------| + * | arg[0] | + * |---------------| + * : : + * : : + * |---------------| + * | arg[argc - 1] | + * |---------------| + * | 0 | + * |---------------| + * | env[0] | + * |---------------| + * : : + * : : + * |---------------| + * | env[n] | + * |---------------| + * | 0 | + * |---------------| <-- Beginning of data returned by sysctl() is here. + * | argc | + * |---------------| + * | exec_path | + * |:::::::::::::::| + * | | + * | String area. | + * | | + * |---------------| <-- Top of stack. + * : : + * : : + * \---------------/ 0xffffffff + */ + mib[0] = CTL_KERN; + mib[1] = KERN_PROCARGS2; + mib[2] = pid; + + size = (size_t)argmax; + + if (sysctl(mib, 3, procargs, &size, NULL, 0) == -1) + goto ERROR_B; + + memcpy(&nargs, procargs, sizeof(nargs)); + cp = procargs + sizeof(nargs); + + // Copy exec_path to ruby String. + *v_exe = rb_str_new2(cp); + + // Skip the saved exec_path. + for (; cp < &procargs[size]; cp++) { + if (*cp == '\0') + break; // End of exec_path reached. + } + + if (cp == &procargs[size]) + goto ERROR_B; + + // Skip trailing '\0' characters. + for (; cp < &procargs[size]; cp++){ + if (*cp != '\0') + break; // Beginning of first argument reached. + } + + if (cp == &procargs[size]) + goto ERROR_B; + + // Save where the argv[0] string starts. + sp = cp; + + /* + * Iterate through the '\0'-terminated strings and convert '\0' to ' ' + * until a string is found that has a '=' character in it (or there are + * no more strings in procargs). There is no way to deterministically + * know where the command arguments end and the environment strings + * start, which is why the '=' character is searched for as a heuristic. + */ + for (np = NULL; c < nargs && cp < &procargs[size]; cp++) { + if (*cp == '\0') { + c++; + + if (np != NULL) + *np = ' '; // Convert previous '\0'. + + // Note location of current '\0'. + np = cp; + + if (!show_args) { + /* + * Don't convert '\0' characters to ' '. + * However, we needed to know that the + * command name was terminated, which we + * now know. + */ + break; + } + } + } + + /* + * sp points to the beginning of the arguments/environment string, and + * np should point to the '\0' terminator for the string. + */ + if (np == NULL || np == sp) + goto ERROR_B; // Empty or unterminated string. + + // Make a copy of the string to ruby String. + *v_cmdline = rb_str_new2(sp); + + // Read environment variables to ruby Hash. + *v_environ = rb_hash_new(); + + while (cp[0]) { + sp = strsep(&cp, "="); + + if (!sp || !cp) + break; + + rb_hash_aset(*v_environ, rb_str_new2(sp), rb_str_new2(cp)); + cp += strlen(cp) + 1; + } + + // Cleanup. + ruby_xfree(procargs); + return 0; + + ERROR_B: + ruby_xfree(procargs); + ERROR_A: + return -1; +} + +/* + * call-seq: + * ProcTable.ps(pid=nil) + * ProcTable.ps(pid=nil){ |ps| ... } + * + * In block form, yields a ProcTableStruct for each process entry that you + * have rights to. This method returns an array of ProcTableStruct's in + * non-block form. + * + * If a +pid+ is provided, then only a single ProcTableStruct is yielded or + * returned, or nil if no process information is found for that +pid+. + */ +static VALUE pt_ps(int argc, VALUE* argv, VALUE klass){ + int err; + char state[8]; + struct kinfo_proc* procs; + VALUE v_pid, v_tty_num, v_tty_dev, v_start_time; + VALUE v_pstruct = Qnil; + VALUE v_array = rb_ary_new(); + size_t length, count; + size_t i = 0; + int g; + VALUE v_cmdline, v_exe, v_environ, v_groups; + + // Passed into sysctl call + static const int name_mib[] = {CTL_KERN, KERN_PROC, KERN_PROC_ALL, 0}; + + rb_scan_args(argc, argv, "01", &v_pid); + + // Get size of proc kproc buffer + err = sysctl( (int *) name_mib, PROC_MIB_LEN, NULL, &length, NULL, 0); + + if(err == -1) + rb_raise(cProcTableError, "sysctl: %s", strerror(errno)); + + // Populate the kproc buffer + procs = ruby_xmalloc(length); + + err = sysctl( (int *) name_mib, PROC_MIB_LEN, procs, &length, NULL, 0); + + if(err == -1) + rb_raise(cProcTableError, "sysctl: %s", strerror(errno)); + + // If we're here, we got our list + count = length / sizeof(struct kinfo_proc); + + for(i = 0; i < count; i++) { + v_tty_num = Qnil; + v_tty_dev = Qnil; + v_start_time = Qnil; + + // If a PID is provided, skip unless the PID matches + if( (!NIL_P(v_pid)) && (procs[i].kp_proc.p_pid != NUM2INT(v_pid)) ) + continue; + + // cmdline will be set only if process exists and belongs to current user or + // current user is root + v_cmdline = Qnil; + v_exe = Qnil; + v_environ = Qnil; + argv_of_pid(procs[i].kp_proc.p_pid, &v_cmdline, &v_exe, &v_environ); + + // Get the start time of the process + v_start_time = rb_time_new( + procs[i].kp_proc.p_un.__p_starttime.tv_sec, + procs[i].kp_proc.p_un.__p_starttime.tv_usec + ); + + // Get the state of the process + switch(procs[i].kp_proc.p_stat) + { + case SIDL: + strcpy(state, "idle"); + break; + case SRUN: + strcpy(state, "run"); + break; + case SSLEEP: + strcpy(state, "sleep"); + break; + case SSTOP: + strcpy(state, "stop"); + break; + case SZOMB: + strcpy(state, "zombie"); + break; + default: + strcpy(state, "unknown"); + break; + } + + // Get ttynum and ttydev. If ttynum is -1, there is no tty. + if(procs[i].kp_eproc.e_tdev != -1){ + v_tty_num = INT2FIX(procs[i].kp_eproc.e_tdev), + v_tty_dev = rb_str_new2(devname(procs[i].kp_eproc.e_tdev, S_IFCHR)); + } + + v_groups = rb_ary_new(); + + for (g = 0; g < procs[i].kp_eproc.e_ucred.cr_ngroups; ++g) + rb_ary_push(v_groups, INT2FIX(procs[i].kp_eproc.e_ucred.cr_groups[g])); + + v_pstruct = rb_struct_new( + sProcStruct, + INT2FIX(procs[i].kp_proc.p_pid), + INT2FIX(procs[i].kp_eproc.e_ppid), + INT2FIX(procs[i].kp_eproc.e_pgid), + INT2FIX(procs[i].kp_eproc.e_pcred.p_ruid), + INT2FIX(procs[i].kp_eproc.e_pcred.p_rgid), + INT2FIX(procs[i].kp_eproc.e_ucred.cr_uid), + rb_ary_entry(v_groups, 0), + v_groups, + INT2FIX(procs[i].kp_eproc.e_pcred.p_svuid), + INT2FIX(procs[i].kp_eproc.e_pcred.p_svgid), + rb_str_new2(procs[i].kp_proc.p_comm), + rb_str_new2(state), + rb_float_new(procs[i].kp_proc.p_pctcpu), + Qnil, + v_tty_num, + v_tty_dev, + rb_str_new2(procs[i].kp_eproc.e_wmesg), + INT2FIX(procs[i].kp_proc.p_rtime.tv_sec), + INT2FIX(procs[i].kp_proc.p_priority), + INT2FIX(procs[i].kp_proc.p_usrpri), + INT2FIX(procs[i].kp_proc.p_nice), + v_cmdline, + v_exe, + v_environ, + v_start_time, + (procs[i].kp_proc.p_ru && procs[i].kp_proc.p_stat != 5) ? LONG2NUM(procs[i].kp_proc.p_ru->ru_maxrss) : Qnil, + (procs[i].kp_proc.p_ru && procs[i].kp_proc.p_stat != 5) ? LONG2NUM(procs[i].kp_proc.p_ru->ru_ixrss) : Qnil, + (procs[i].kp_proc.p_ru && procs[i].kp_proc.p_stat != 5) ? LONG2NUM(procs[i].kp_proc.p_ru->ru_idrss) : Qnil, + (procs[i].kp_proc.p_ru && procs[i].kp_proc.p_stat != 5) ? LONG2NUM(procs[i].kp_proc.p_ru->ru_isrss) : Qnil, + (procs[i].kp_proc.p_ru && procs[i].kp_proc.p_stat != 5) ? LONG2NUM(procs[i].kp_proc.p_ru->ru_minflt) : Qnil, + (procs[i].kp_proc.p_ru && procs[i].kp_proc.p_stat != 5) ? LONG2NUM(procs[i].kp_proc.p_ru->ru_majflt) : Qnil, + (procs[i].kp_proc.p_ru && procs[i].kp_proc.p_stat != 5) ? LONG2NUM(procs[i].kp_proc.p_ru->ru_nswap) : Qnil, + (procs[i].kp_proc.p_ru && procs[i].kp_proc.p_stat != 5) ? LONG2NUM(procs[i].kp_proc.p_ru->ru_inblock) : Qnil, + (procs[i].kp_proc.p_ru && procs[i].kp_proc.p_stat != 5) ? LONG2NUM(procs[i].kp_proc.p_ru->ru_oublock) : Qnil, + (procs[i].kp_proc.p_ru && procs[i].kp_proc.p_stat != 5) ? LONG2NUM(procs[i].kp_proc.p_ru->ru_msgsnd) : Qnil, + (procs[i].kp_proc.p_ru && procs[i].kp_proc.p_stat != 5) ? LONG2NUM(procs[i].kp_proc.p_ru->ru_msgrcv) : Qnil, + (procs[i].kp_proc.p_ru && procs[i].kp_proc.p_stat != 5) ? LONG2NUM(procs[i].kp_proc.p_ru->ru_nsignals) : Qnil, + (procs[i].kp_proc.p_ru && procs[i].kp_proc.p_stat != 5) ? LONG2NUM(procs[i].kp_proc.p_ru->ru_nvcsw) : Qnil, + (procs[i].kp_proc.p_ru && procs[i].kp_proc.p_stat != 5) ? LONG2NUM(procs[i].kp_proc.p_ru->ru_nivcsw) : Qnil, + (procs[i].kp_proc.p_ru && procs[i].kp_proc.p_stat != 5) ? LONG2NUM(procs[i].kp_proc.p_ru->ru_utime.tv_sec) : Qnil, + (procs[i].kp_proc.p_ru && procs[i].kp_proc.p_stat != 5) ? LONG2NUM(procs[i].kp_proc.p_ru->ru_stime.tv_sec) : Qnil + ); + + OBJ_FREEZE(v_pstruct); // This is read-only data + + if(rb_block_given_p()) + rb_yield(v_pstruct); + else + rb_ary_push(v_array, v_pstruct); + } + + if(procs) + free(procs); + + if(!rb_block_given_p()){ + if(NIL_P(v_pid)) + return v_array; + else + return v_pstruct; + } + + return Qnil; +} + +/* + * call-seq: + * ProcTable.fields + * + * Returns an array of fields that each ProcTableStruct will contain. This + * may be useful if you want to know in advance what fields are available + * without having to perform at least one read of the /proc table. + */ +static VALUE pt_fields(VALUE klass){ + VALUE v_array = rb_ary_new(); + + VALUE v_members = rb_struct_s_members(sProcStruct), v_member; + long size = RARRAY_LEN(v_members); + int i; + + for(i = 0; i < size; i++) { + v_member = rb_funcall(rb_ary_entry(v_members, i), rb_intern("to_s"), 0); + rb_ary_push(v_array, v_member); + } + + return v_array; +} + +/* + * A Ruby interface for gathering process table information. + */ +void Init_proctable(){ + VALUE mSys, cProcTable; + + /* The Sys module serves as a namespace only */ + mSys = rb_define_module("Sys"); + + /* The ProcTable class encapsulates process table information */ + cProcTable = rb_define_class_under(mSys, "ProcTable", rb_cObject); + + /* The Error class typically raised if any of the ProcTable methods fail */ + cProcTableError = rb_define_class_under(cProcTable, "Error", rb_eStandardError); + + /* Singleton methods */ + + rb_define_singleton_method(cProcTable, "ps", pt_ps, -1); + rb_define_singleton_method(cProcTable, "fields", pt_fields, 0); + + /* There is no constructor */ + rb_funcall(cProcTable, rb_intern("private_class_method"), 1, ID2SYM(rb_intern("new"))); + + /* 0.9.9: The version of the sys-proctable library */ + rb_define_const(cProcTable, "VERSION", rb_str_new2("0.9.9")); + + /* Structs */ + + sProcStruct = rb_struct_define("ProcTableStruct", + "pid", /* Process identifier */ + "ppid", /* Parent process id */ + "pgid", /* Process group id */ + "ruid", /* Real user id */ + "rgid", /* Real group id */ + "euid", /* Effective user id */ + "egid", /* Effective group id */ + "groups", /* All effective group ids */ + "svuid", /* Saved effective user id */ + "svgid", /* Saved effective group id */ + "comm", /* Command name (15 chars) */ + "state", /* Process status */ + "pctcpu", /* %cpu for this process during p_swtime */ + "oncpu", /* nil */ + "tnum", /* Controlling tty dev */ + "tdev", /* Controlling tty name */ + "wmesg", /* Wchan message */ + "rtime", /* Real time */ + "priority", /* Process priority */ + "usrpri", /* User-priority */ + "nice", /* Process "nice" value */ + "cmdline", /* Complete command line */ + "exe", /* Saved pathname of the executed command */ + "environ", /* Hash with process environment variables */ + "starttime", /* Process start time */ + "maxrss", /* Max resident set size (PL) */ + "ixrss", /* Integral shared memory size (NU) */ + "idrss", /* Integral unshared data (NU) */ + "isrss", /* Integral unshared stack (NU) */ + "minflt", /* Page reclaims (NU) */ + "majflt", /* Page faults (NU) */ + "nswap", /* Swaps (NU) */ + "inblock", /* Block input operations (atomic) */ + "oublock", /* Block output operations (atomic) */ + "msgsnd", /* Messages sent (atomic) */ + "msgrcv", /* Messages received (atomic) */ + "nsignals", /* Signals received (atomic) */ + "nvcsw", /* Voluntary context switches (atomic) */ + "nivcsw", /* Involuntary context switches (atomic) */ + "utime", /* User time used (PL) */ + "stime", /* System time used (PL) */ + NULL + ); +} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/lib/sys-proctable.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/lib/sys-proctable.rb new file mode 100644 index 000000000..9c524ff0c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/lib/sys-proctable.rb @@ -0,0 +1 @@ +require 'sys/proctable' diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/lib/sys/proctable.bundle b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/lib/sys/proctable.bundle new file mode 100755 index 000000000..a9189d02c Binary files /dev/null and b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/lib/sys/proctable.bundle differ diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/lib/sys/proctable/version.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/lib/sys/proctable/version.rb new file mode 100644 index 000000000..8feb08f70 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/lib/sys/proctable/version.rb @@ -0,0 +1,6 @@ +module Sys + class ProcTable + # The version of the sys-proctable library + VERSION = '0.9.9' + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/lib/sys/top.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/lib/sys/top.rb new file mode 100644 index 000000000..c377f3de5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/lib/sys/top.rb @@ -0,0 +1,31 @@ +require 'sys/proctable' + +# The Sys module serves as a namespace only +module Sys + + # The Top class serves as a toplevel name for the 'top' method. + class Top + + # The version of the sys-top library + VERSION = '1.0.4' + + # Returns an array of Struct::ProcTableStruct elements containing up + # to +num+ elements, sorted by +field+. The default number of elements + # is 10, while the default field is 'pctcpu'. + # + # Exception: the default sort field is 'pid' on AIX and Windows. + # + def self.top(num=10, field='pctcpu') + field = field.to_s if field.is_a?(Symbol) + + aix = RbConfig::CONFIG['host_os'] =~ /aix/i + + # Sort by pid on Windows and AIX by default + if (File::ALT_SEPARATOR || aix) && field == 'pctcpu' + field = 'pid' + end + + Sys::ProcTable.ps.sort_by{ |obj| obj.send(field) || '' }[0..num-1] + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/sys-proctable.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/sys-proctable.gemspec new file mode 100644 index 000000000..370dd55ea --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/sys-proctable.gemspec @@ -0,0 +1,40 @@ +require 'rubygems' + +Gem::Specification.new do |spec| + spec.name = 'sys-proctable' + spec.version = '0.9.9' + spec.author = 'Daniel J. Berger' + spec.license = 'Artistic 2.0' + spec.email = 'djberg96@gmail.com' + spec.homepage = 'http://github.com/djberg96/sys-proctable' + spec.platform = Gem::Platform::CURRENT # Probably altered by Rake task + spec.summary = 'An interface for providing process table information' + spec.test_files = ['test/test_sys_proctable_all.rb'] + spec.cert_chain = ['certs/djberg96_pub.pem'] + + # Additional files for your platform are added by the 'rake gem' task. + spec.files = [ + 'benchmarks/bench_ps.rb', + 'examples/example_ps.rb', + 'lib/sys/proctable/version.rb', + 'lib/sys/top.rb', + 'CHANGES', + 'MANIFEST', + 'Rakefile', + 'README', + 'sys-proctable.gemspec' + ] + + spec.extra_rdoc_files = ['CHANGES', 'README', 'MANIFEST', 'doc/top.txt'] + + spec.add_development_dependency('test-unit') + spec.add_development_dependency('rake') + + spec.description = <<-EOF + The sys-proctable library provides an interface for gathering information + about processes on your system, i.e. the process table. Most major + platforms are supported and, while different platforms may return + different information, the external interface is identical across + platforms. + EOF +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/test/test_sys_proctable_all.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/test/test_sys_proctable_all.rb new file mode 100644 index 000000000..5c8f63855 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/test/test_sys_proctable_all.rb @@ -0,0 +1,87 @@ +####################################################################### +# test_sys_proctable_all.rb +# +# Test suite for methods common to all platforms. Generally speaking +# you should run this test case using the 'rake test' task. +####################################################################### +require 'test-unit' +require 'sys/proctable' +require 'test/test_sys_top' +include Sys + +class TC_ProcTable_All < Test::Unit::TestCase + def self.startup + @@windows = File::ALT_SEPARATOR + end + + def setup + @pid = @@windows ? 0 : 1 + end + + def test_version + assert_equal('0.9.9', ProcTable::VERSION) + end + + def test_fields + assert_respond_to(ProcTable, :fields) + assert_nothing_raised{ ProcTable.fields } + assert_kind_of(Array, ProcTable.fields) + assert_kind_of(String, ProcTable.fields.first) + end + + def test_ps + assert_respond_to(ProcTable, :ps) + assert_nothing_raised{ ProcTable.ps } + assert_nothing_raised{ ProcTable.ps{} } + end + + def test_ps_with_pid + assert_nothing_raised{ ProcTable.ps(0) } + end + + def test_ps_with_explicit_nil + assert_nothing_raised{ ProcTable.ps(nil) } + assert_kind_of(Array, ProcTable.ps(nil)) + end + + def test_ps_return_value + assert_kind_of(Array, ProcTable.ps) + assert_kind_of(Struct::ProcTableStruct, ProcTable.ps(@pid)) + assert_equal(nil, ProcTable.ps(999999999)) + assert_equal(nil, ProcTable.ps(999999999){}) + assert_equal(nil, ProcTable.ps{}) + end + + def test_ps_returned_struct_is_frozen + assert_true(ProcTable.ps.first.frozen?) + end + + def test_ps_expected_errors + assert_raises(TypeError){ ProcTable.ps('vim') } + omit_if(@@windows, 'ArgumentError check skipped on MS Windows') + assert_raises(ArgumentError){ ProcTable.ps(0, 'localhost') } + end + + def test_new_not_allowed + assert_raise(NoMethodError){ Sys::ProcTable.new } + end + + def test_error_class_defined + assert_not_nil(Sys::ProcTable::Error) + assert_kind_of(StandardError, Sys::ProcTable::Error.new) + end + + def test_from_thread + Thread.new do + Sys::ProcTable.ps + end.value + end + + def teardown + @pid = nil + end + + def self.teardown + @@windows = nil + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/test/test_sys_proctable_darwin.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/test/test_sys_proctable_darwin.rb new file mode 100644 index 000000000..040e80e65 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/test/test_sys_proctable_darwin.rb @@ -0,0 +1,267 @@ +######################################################################## +# test_sys_proctable_darwin.rb +# +# Test suite for the Darwin version of the sys-proctable library. You +# should run these tests via the 'rake test' task. +######################################################################## +require 'test-unit' +require 'sys/proctable' +require 'test/test_sys_proctable_all' +include Sys + +class TC_ProcTable_Darwin < Test::Unit::TestCase + def self.startup + @@fields = %w/ + pid ppid pgid ruid rgid euid egid groups svuid svgid + comm state pctcpu oncpu tnum + tdev wmesg rtime priority usrpri nice cmdline exe environ starttime + maxrss ixrss idrss isrss minflt majflt nswap inblock oublock + msgsnd msgrcv nsignals nvcsw nivcsw utime stime + / + + @@pid = fork do + exec('env', '-i', 'A=B', 'Z=', 'sleep', '60') + end + sleep 1 # wait to make sure env is replaced by sleep + end + + def setup + @ptable = ProcTable.ps.find{ |ptable| ptable.pid == @@pid } + end + + def test_fields + assert_respond_to(ProcTable, :fields) + assert_kind_of(Array, ProcTable.fields) + assert_equal(@@fields, ProcTable.fields) + end + + def test_pid + assert_respond_to(@ptable, :pid) + assert_kind_of(Fixnum, @ptable.pid) + assert_equal(@ptable.pid, @@pid) + end + + def test_ppid + assert_respond_to(@ptable, :ppid) + assert_kind_of(Fixnum, @ptable.ppid) + assert_equal(Process.pid, @ptable.ppid) + end + + def test_pgid + assert_respond_to(@ptable, :pgid) + assert_kind_of(Fixnum, @ptable.pgid) + assert_equal(Process.getpgrp, @ptable.pgid) + end + + def test_ruid + assert_respond_to(@ptable, :ruid) + assert_kind_of(Fixnum, @ptable.ruid) + assert_equal(Process.uid, @ptable.ruid) + end + + def test_rgid + assert_respond_to(@ptable, :rgid) + assert_kind_of(Fixnum, @ptable.rgid) + assert_equal(Process.gid, @ptable.rgid) + end + + def test_euid + assert_respond_to(@ptable, :euid) + assert_kind_of(Fixnum, @ptable.euid) + assert_equal(Process.euid, @ptable.euid) + end + + def test_egid + assert_respond_to(@ptable, :egid) + assert_kind_of(Fixnum, @ptable.egid) + assert_equal(Process.egid, @ptable.egid) + end + + def test_groups + assert_respond_to(@ptable, :groups) + assert_kind_of(Array, @ptable.groups) + assert_equal(Process.groups, @ptable.groups) + end + + def test_svuid + assert_respond_to(@ptable, :svuid) + assert_kind_of(Fixnum, @ptable.svuid) + assert_equal(Process.uid, @ptable.svuid) # not valid for all processes + end + + def test_svgid + assert_respond_to(@ptable, :svgid) + assert_kind_of(Fixnum, @ptable.svgid) + assert_equal(Process.gid, @ptable.svgid) # not valid for all processes + end + + def test_comm + assert_respond_to(@ptable, :comm) + assert_kind_of(String, @ptable.comm) + assert_equal('sleep', @ptable.comm) + end + + def test_state + assert_respond_to(@ptable, :state) + assert_kind_of(String, @ptable.state) + assert_true(%w/idle run sleep stop zombie unknown/.include?(@ptable.state)) + end + + def test_pctcpu + assert_respond_to(@ptable, :pctcpu) + assert_kind_of(Float, @ptable.pctcpu) + end + + def test_oncpu + assert_respond_to(@ptable, :oncpu) + omit("oncpu always nil for now") + end + + def test_tnum + assert_respond_to(@ptable, :tnum) + #assert_kind_of(Fixnum, @ptable.tnum) + end + + def test_tdev + assert_respond_to(@ptable, :tdev) + #assert_kind_of(String, @ptable.tdev) + end + + def test_wmesg + assert_respond_to(@ptable, :wmesg) + assert_kind_of(String, @ptable.wmesg) + end + + def test_rtime + assert_respond_to(@ptable, :rtime) + assert_kind_of(Fixnum, @ptable.rtime) + end + + def test_priority + assert_respond_to(@ptable, :priority) + assert_kind_of(Fixnum, @ptable.priority) + end + + def test_usrpri + assert_respond_to(@ptable, :usrpri) + assert_kind_of(Fixnum, @ptable.usrpri) + end + + def test_nice + assert_respond_to(@ptable, :nice) + assert_kind_of(Fixnum, @ptable.nice) + end + + def test_cmdline + assert_respond_to(@ptable, :cmdline) + assert_kind_of(String, @ptable.cmdline) + assert_equal('sleep 60', @ptable.cmdline) + end + + def test_exe + assert_respond_to(@ptable, :exe) + assert_kind_of(String, @ptable.exe) + assert_equal(`which sleep`.chomp, @ptable.exe) + end + + def test_environ + assert_respond_to(@ptable, :environ) + assert_kind_of(Hash, @ptable.environ) + assert_equal({'A' => 'B', 'Z' => ''}, @ptable.environ) + end + + def test_starttime + assert_respond_to(@ptable, :starttime) + assert_kind_of(Time, @ptable.starttime) + end + + def test_maxrss + assert_respond_to(@ptable, :maxrss) + assert_true([NilClass, Fixnum].include?(@ptable.maxrss.class)) + end + + def test_ixrss + assert_respond_to(@ptable, :ixrss) + assert_true([NilClass, Fixnum].include?(@ptable.ixrss.class)) + end + + def test_idrss + assert_respond_to(@ptable, :idrss) + assert_true([NilClass, Fixnum].include?(@ptable.idrss.class)) + end + + def test_isrss + assert_respond_to(@ptable, :isrss) + assert_true([NilClass, Fixnum].include?(@ptable.isrss.class)) + end + + def test_minflt + assert_respond_to(@ptable, :minflt) + assert_true([NilClass, Fixnum].include?(@ptable.minflt.class)) + end + + def test_majflt + assert_respond_to(@ptable, :majflt) + assert_true([NilClass, Fixnum].include?(@ptable.majflt.class)) + end + + def test_nswap + assert_respond_to(@ptable, :nswap) + assert_true([NilClass, Fixnum].include?(@ptable.nswap.class)) + end + + def test_inblock + assert_respond_to(@ptable, :inblock) + assert_true([NilClass, Fixnum].include?(@ptable.inblock.class)) + end + + def test_oublock + assert_respond_to(@ptable, :oublock) + assert_true([NilClass, Fixnum].include?(@ptable.oublock.class)) + end + + def test_msgsnd + assert_respond_to(@ptable, :msgsnd) + assert_true([NilClass, Fixnum].include?(@ptable.msgsnd.class)) + end + + def test_msgrcv + assert_respond_to(@ptable, :msgrcv) + assert_true([NilClass, Fixnum].include?(@ptable.msgrcv.class)) + end + + def test_nsignals + assert_respond_to(@ptable, :nsignals) + assert_true([NilClass, Fixnum].include?(@ptable.nsignals.class)) + end + + def test_nvcsw + assert_respond_to(@ptable, :nvcsw) + assert_true([NilClass, Fixnum].include?(@ptable.nvcsw.class)) + end + + def test_nivcsw + assert_respond_to(@ptable, :nivcsw) + assert_true([NilClass, Fixnum].include?(@ptable.nivcsw.class)) + end + + def test_utime + assert_respond_to(@ptable, :utime) + assert_true([NilClass, Fixnum].include?(@ptable.utime.class)) + end + + def test_stime + assert_respond_to(@ptable, :stime) + assert_true([NilClass, Fixnum].include?(@ptable.stime.class)) + end + + def teardown + @ptable = nil + end + + def self.shutdown + @@fields = nil + + Process.kill('TERM', @@pid) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/test/test_sys_top.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/test/test_sys_top.rb new file mode 100644 index 000000000..ecfbb8bcd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-proctable-0.9.9-universal-darwin/test/test_sys_top.rb @@ -0,0 +1,46 @@ +############################################################################## +# test_sys_top.rb +# +# Test suite for the sys-top library that is included with this distribution. +############################################################################## +require 'rubygems' +gem 'test-unit' + +require 'test/unit' +require 'sys/top' + +class TC_Top < Test::Unit::TestCase + include Sys + + def test_version + assert_equal('1.0.4', Top::VERSION) + end + + def test_top_basic + assert_respond_to(Top, :top) + assert_nothing_raised{ Top.top } + assert_nothing_raised{ Top.top(5) } + assert_nothing_raised{ Top.top(5, 'cmdline') } + end + + def test_top + assert_equal(10, Top.top.length) + assert_kind_of(Struct::ProcTableStruct, Top.top.first) + end + + def test_top_with_size + assert_equal(5, Top.top(5).length) + end + + def test_top_with_size_and_sort_by_field + assert_equal(5, Top.top(5, :cmdline).length) + end + + def test_top_return_type + assert_kind_of(Array, Top.top) + end + + def test_top_expected_errors + assert_raises(ArgumentError){ Top.top(1, 'foo', 2) } + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/.require_paths b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/.require_paths new file mode 100644 index 000000000..a53fb883d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/.require_paths @@ -0,0 +1,2 @@ +lib +lib/unix diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/CHANGES b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/CHANGES new file mode 100644 index 000000000..c95bd54a2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/CHANGES @@ -0,0 +1,176 @@ +== 0.9.2 - 1-May-2013 +* Added a workaround for a win32ole thread bug. Thanks go to Tianlong Wu + for the spot. +* Altered platform handling slightly for Windows in the Rakefile. + +== 0.9.1 - 3-Jan-2013 +* Made FFI functions private. +* Properly alias uname FFI function. +* Fixed the QuantumLength and QuantumType bug again (see 0.8.4), which I + somehow accidentally reintroduced. + +== 0.9.0 - 8-Dec-2011 +* Conversion to FFI. +* Added some additional methods and information for Solaris. +* Minor tweaks for 1.9 to silence warnings. + +== 0.8.6 - 2-Sep-2011 +* Fixed a failing test for Ruby 1.9.x. +* The gemspec for Windows is now 'universal'. +* Some minor doc updates. + +== 0.8.5 - 11-Dec-2010 +* Removed some non-ascii characters that somehow made it into the source. +* Some updates to the Rakefile, including a default task. + +== 0.8.4 - 29-Jan-2010 +* Bug fix for Windows 7, which appears to have removed the QuantumLength and + QuantumType members of the Win32_OperatingSystem class. Thanks go to Mark + Seymour for the spot. RubyForge bug # 27645. +* Changed license to Artistic 2.0. +* Refactored the Rakefile and gemspec considerably. The gem building code is + now all inlined within the Rakefile build task itself. +* Minor doc updates and some code reformatting. + +== 0.8.3 - 26-Apr-2008 +* Added an explicit "require 'time'" in the Windows version because recent + versions of Ruby now need it. +* Changed the way I do platform checks in the Rakefile. + +== 0.8.2 - 22-Nov-2007 +* Fixed an issue where Ruby no longer parsed a certain type of date that + MS Windows uses. See RubyForge Bug #10646 for more information. + +== 0.8.1 - 29-Aug-2007 +* Made a minor modification to the build script for Linux. It turns out Linux + has sysctl, but not the necessary mibs for the Uname.model method. Thanks go + to Mickey Knox (?) for the spot. +* Removed the install.rb file. The code from that program was integrated + directly into the Rakefile. + +== 0.8.0 - 10-Apr-2007 +* The Uname.model method should now work on most BSD platforms, not just OS X, + since it uses the sysctl() function behind the scenes. +* The 'id' method was changed to 'id_number' on HP-UX to avoid confusion with + the Object.id method. +* The UnameError class is now Uname::Error. +* Added a Rakefile. There are now tasks for building, testing and installing + this package. +* Removed some pre-setup code from the test suite that was no longer necessary + as a result of the Rake test task. + +== 0.7.4 - 19-Nov-2006 +* Internal layout changes, doc updates and gemspec improvements. +* No code changes. + +== 0.7.3 - 30-Jul-2006 +* Bug fix for 64 bit platforms. +* Minor modification of the extconf.rb file. + +== 0.7.2 - 5-Jul-2006 +* Removed '?' from the struct member names on MS Windows since these are no + longer legal. +* Removed duplicate definition of Uname.version on MS Windows (oops). +* Added a gemspec. +* Added inline rdoc documentation to the source files. + +== 0.7.1 - 5-May-2005 +* Removed the uname.rd file. The uname.txt file is rdoc friendly, so you + can autogenerate html from that file if you wish. +* Removed the version.h file - no longer needed now that the Windows version + is pure Ruby. +* Renamed test.rb to uname_test.rb +* Minor setup modifications to the test suite. +* This package is now hosted on RubyForge. + +== 0.7.0 - 11-Jan-2004 +* Scrapped the C version for Windows in favor of a pure Ruby version that uses + WMI + OLE. I highly recommend using Ruby 1.8.2 or later on Win32 systems. + Earlier versions may cause segfaults. +* Added the isa_list, hw_provider, hw_serial_number, srpc_domain and + dhcp_cache methods for Solaris. +* Added install.rb program for Windows, and modified extconf.rb to only run on + non-Windows systems. +* The 'examples' directory has been moved to the toplevel directory. +* Removed the INSTALL file. That information is now included in the README. +* Documentation updates. + +== 0.6.1 - 25-Apr-2004 +* Simplified extconf.rb script and installation instructions. +* Combined three test scripts into a single test script. +* Warranty information added. + +== 0.6.0 - 25-Jun-2003 +* Added HP-UX support, including the id() class method (HP-UX only) +* Fixed minor bug in extconf.rb (forgot 'require ftools' at top) +* Added HP-UX specific tests and support +* Made test.rb friendlier for folks without TestUnit installed + +== 0.5.0 - 16-Jun-2003 +* Added OS X support, including the "model" method. Thanks to Mike Hall + for the patch +* Removed VERSION() class method. Use the constant instead +* Moved rd documentation to its own file (under /doc directory) +* Added a version.h file under 'lib' to store VERSION info for + all source files +* Modified extconf.rb file to handle OS X support. In addition, moved + test.rb into a static file under /test, instead of dynamically + generating it +* Fixed up test suite. Added OS X specific tests and support. Should now + work with TestUnit 0.1.6 or later + +== 0.4.1 - 7-Feb-2003 +* Fixed C89 issue (again) - thanks go to Daniel Zepeda for the spot +* Fixed bugs in extconf.rb file (rescue clause, ftools) + +== 0.4.0 - 6-Feb-2003 +* MS Windows support! +* Added a test suite and automatic test.rb creation +* Documentation additions/fixes +* Internal directory layout and filename changes (Changelog -> CHANGES) + +== 0.3.3 - 6-Jan-2003 +* Made the code C89 compliant for older compilers. Thanks to Paul Brannan + for teaching me how to fix this in general. +* Moved README to doc/uname.txt +* Created an INSTALL file +* Added a copyright notice +* Added a VERSION class method +* Changed tarball name to reflect RAA package name +* Minor doc changes + +== 0.3.2 - 8-Aug-2002 +* Changed the struct name returned by the 'uname()' method from + "Uname::UnameStruct" to just "UnameStruct". This was to make it + compliant with future versions of Ruby. The extra namespace was + redundant anyway. +* I include the documentation now, instead of making you install rd2 :) + +== 0.3.1 - 22-Jul-2002 +* Added the 'uname' class method, which returns a struct that contains all + of the uname information +* Added a test script. Do 'ruby test.rb' to run it. +* If rd2 is installed on your system, the documentation is automatically + generated for you. +* Moved html documentation to 'doc' directory. +* Changed version number style to be consistent with other 'Sys' modules +* Now installs into 'Sys-Uname-x.x.x' directory (instead of just 'Uname') + +== 0.03 - 6-June-2002 +* rd style documentation now inline +* README.html is now uname.html - created via rdtool +* The 'platform()' and 'architecture()' methods have been added for Solaris +* You can now do an 'include Sys' to shorten your syntax +* The whole 'Sys' class has been removed. Delete your sys.so file if you + installed a previous version of Sys-Uname + +== 0.02 - 3-June-2002 +* Potentially fatal memory problems corrected. +* Should now build with C++ as well +* Thanks to Mike Hall for both the spot and the fix +* Added a Changelog file +* Added a README.html file +* Added a Manifest file + +== 0.01 - 31-May-2002 +* Initial release (unannounced) diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/MANIFEST b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/MANIFEST new file mode 100644 index 000000000..fd9a0ffb1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/MANIFEST @@ -0,0 +1,11 @@ +* MANIFEST +* CHANGES +* README +* Rakefile +* sys-uname.gemspec +* doc/uname.txt +* examples/uname_test.rb +* ext/extconf.rb +* ext/uname.c +* lib/sys/uname.rb +* test/tc_uname.rb diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/README b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/README new file mode 100644 index 000000000..0b773996c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/README @@ -0,0 +1,39 @@ += Description + A Ruby interface for getting operating system information. The name comes + from the Unix 'uname' command, but this library works on MS Windows as well. + += Prerequisites + ffi 1.0 or later + += Installation + gem install sys-uname + + # If that doesn't work and you're on Windows try this: + gem install sys-uname --platform universal-mingw32 + += Synopsis + require 'sys/uname' + include Sys + + p Uname.uname + += Solaris Notes + Users on SunOS get several extra methods: architecture, platform, + hw_serial, hw_provider, srpc_domain, isa_list, and dhcp_cache. + += BSD flavors, including OS X + Users on BSD platforms get the extra Uname.model method. + += HP-UX Notes + HP-UX users get the extra Uname.id_number method. This is actually a + String, not a Fixnum, because that's how it's defined in the utsname + struct. + += MS Windows Notes + The C version for Windows has been completely scrapped in favor of an OLE + plus WMI approach. It is pure Ruby. Please see the MSDN documentation for + the Win32_OperatingSystem class for a complete list of what each of the + UnameStruct members mean. + += Documentation + For more details, see the 'uname.txt' file under the 'doc' directory. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/Rakefile new file mode 100644 index 000000000..d27623741 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/Rakefile @@ -0,0 +1,48 @@ +require 'rake' +require 'rake/testtask' +require 'rake/clean' +require 'rbconfig' + +CLEAN.include("**/*.rbc", "**/*.rbx", "**/*.gem") + +desc "Run the example program" +task :example do + if File::ALT_SEPARATOR + sh 'ruby -Ilib/windows examples/uname_test.rb' + else + sh 'ruby -Ilib/unix examples/uname_test.rb' + end +end + +namespace :gem do + desc "Create the sys-uname gem" + task :create => [:clean] do + spec = eval(IO.read('sys-uname.gemspec')) + + if File::ALT_SEPARATOR + spec.platform = Gem::Platform::new(['universal', 'mingw32']) + end + + Gem::Builder.new(spec).build + end + + desc "Install the sys-uname gem" + task :install => [:build] do + file = Dir["*.gem"].first + sh "gem install #{file}" + end +end + +desc "Run the test suite" +Rake::TestTask.new("test") do |t| + if File::ALT_SEPARATOR + t.libs << 'lib/windows' + else + t.libs << 'lib/unix' + end + + t.warning = true + t.verbose = true +end + +task :default => :test diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/doc/uname.txt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/doc/uname.txt new file mode 100644 index 000000000..4ec06e42c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/doc/uname.txt @@ -0,0 +1,127 @@ +== Description + A Ruby interface for getting operating system information. The name comes + from the Unix 'uname' command, but this library works on Windows as well. + +== Synopsis + require 'sys/uname' + include Sys + + # Unix + puts Uname.nodename => my_host + puts Uname.version => #1 Fri Oct 24 22:43:28 MDT 2003 + puts Uname.sysname => Linux + puts Uname.machine => i686 + puts Uname.release => 2.4.22-21mdk + + p Uname.uname => Show all UnameStruct members + + # Windows + u = Uname.uname + puts u.caption => 'Microsoft Windows XP Home Edition + puts u.csd_version => 'Service Pack 2' + +== Constants +VERSION + The current version number of the sys-uname library. This is a String. + +== Class Methods +Uname.sysname + Returns the operating system name. e.g. "SunOS" + +Uname.nodename + Returns the nodename. This is usually, but not necessarily, the + same as the system's hostname. + + You cannot currently set the nodename (root or otherwise). This may + be added in a future release. + +Uname.machine + Returns the machine hardware type. e.g. "i686" + +Uname.version + Returns the operating system version. e.g. "5.8". In the case of MS + Windows, it returns the version plus patch information, separated by + a hyphen, e.g. "2915-Service Pack 2". + +Uname.release + Returns the operating system release. e.g. "2.2.16-3" + +Uname.uname + Returns a struct of type UnameStruct that contains sysname, nodename, + machine, version, and release. On Solaris, it will also include + architecture and platform. On HP-UX, it will also include id_number. + + MS Windows - there are many more, and different, fields in the struct. + Please see the MSDN documenation on the Win32_OperatingSystem WMI class + for a complete explanation of what each of these members mean. + +== Solaris Only +Uname.architecture + Returns the instruction set architecture. e.g. "sparc" + +Uname.platform + Returns the platform identifier. e.g. "SUNW,Sun-Blade-100" + +Uname.isa_list + Returns a space separated string containing a list of all variant + instruction set architectures executable on the current system. + + They are listed in order of performance, from best to worst. + +Uname.hw_provider + Returns the name of the hardware manufacturer. + +Uname.hw_serial_number + Returns the ASCII representation of the hardware-specific serial number + of the machine that executes the function. + +Uname.srpc_domain + Returns the name of the Secure Remote Procedure Call domain, if any. + +Uname.dhcp_cache + Returns a hexidecimal encoding, in String form, of the name of the + interface configured by boot(1M) followed by the DHCPACK reply from + the server. + +== BSD Platforms Only (including OS X) +Uname.model + Returns the model type, e.g. "PowerBook5,1" + +== HP-UX Only +Uname.id + Returns the id number, e.g. 234233587. This is a String, not a Fixnum. + +== Notes + Not all of the information that you might be used to seeing with + a 'uname -a' is available. This may be added in future releases, + but since different implementations provide different information + (via different header files) it will be a bit of a pain. + + Windows users - please see the MSDN documentation for the + Win32_OperatingSystem class for a complete list of what each of the + UnameStruct members mean. + +== Known Bugs + None that I'm aware of. Please log any bugs on the project page at + http://www.rubyforge.org/projects/sysutils. + +== Future Plans + Add additional info for Linux, Solaris, BSD. + +== License + Artistic 2.0 + +== Copyright + (C) 2002-2013 Daniel J. Berger + All Rights Reserved + +== Warranty + This package is provided "as is" and without any express or + implied warranties, including, without limitation, the implied + warranties of merchantability and fitness for a particular purpose. + +== Author + Daniel Berger + +== See Also + uname(1) for unix, or WMI for MS Windows. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/examples/uname_test.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/examples/uname_test.rb new file mode 100644 index 000000000..aa9bba5f8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/examples/uname_test.rb @@ -0,0 +1,42 @@ +######################################################################## +# uname_test.rb +# +# Generic test script for general futzing. Modify as you see fit. This +# should generally be run via the 'rake example' task. +######################################################################## +require 'sys/uname' +require 'rbconfig' +include Sys + +puts "VERSION: " + Uname::VERSION +puts 'Nodename: ' + Uname.nodename +puts 'Sysname: ' + Uname.sysname +puts 'Version: ' + Uname.version +puts 'Release: ' + Uname.release +puts 'Machine: ' + Uname.machine # May be "unknown" on Win32 + +if RbConfig::CONFIG['host_os'] =~ /sun|solaris/i + print "\nSolaris specific tests\n" + puts "===========================" + puts 'Architecture: ' + Uname.architecture + puts 'Platform: ' + Uname.platform + puts 'Instruction Set List: ' + Uname.isa_list.split.join(", ") + puts 'Hardware Provider: ' + Uname.hw_provider + puts 'Serial Number: ' + Uname.hw_serial_number.to_s + puts 'SRPC Domain: ' + Uname.srpc_domain # might be empty + puts 'DHCP Cache: ' + Uname.dhcp_cache # might be empty +end + +if RbConfig::CONFIG['host_os'] =~ /powerpc|darwin|bsd|mach/i + print "\nBSD/OS X specific tests\n" + puts "=======================" + puts 'Model: ' + Uname.model +end + +if RbConfig::CONFIG['host_os'] =~ /hpux/i + print "\nHP-UX specific tests\n" + puts "========================" + puts "ID: " + Uname.id +end + +print "\nTest finished successfully\n" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/lib/unix/sys/uname.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/lib/unix/sys/uname.rb new file mode 100644 index 000000000..1b98d434b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/lib/unix/sys/uname.rb @@ -0,0 +1,330 @@ +require 'ffi' +require 'rbconfig' +require 'ostruct' + +# The Sys module serves as a namespace only. +module Sys + # The Uname class encapsulates information about the system. + class Uname + extend FFI::Library + ffi_lib FFI::Library::LIBC + + # Error raised if the uname() function fails. + class Error < StandardError; end + + # The version of the sys-uname library + VERSION = '0.9.2' + + # :stopdoc + + # Buffer size for uname struct char arrays + case RbConfig::CONFIG['host_os'] + when /linux/i + BUFSIZE = 65 + when /bsd/i + BUFSIZE = 32 # TODO: version method chopped + when /sunos|solaris/i + BUFSIZE = 257 + else + BUFSIZE = 256 + end + + attach_function :uname_c, :uname, [:pointer], :int + private_class_method :uname_c + + begin + attach_function :sysctl, [:pointer, :uint, :pointer, :pointer, :pointer, :size_t], :int + private_class_method :sysctl + + CTL_HW = 6 # Generic hardware/cpu + HW_MODEL = 2 # Specific machine model + rescue FFI::NotFoundError + # Ignore. Not suppored. + end + + begin + attach_function :sysinfo, [:int, :pointer, :long], :long + private_class_method :sysinfo + + SI_SYSNAME = 1 # OS name + SI_HOSTNAME = 2 # Node name + SI_RELEASE = 3 # Operating system release + SI_VERSION = 4 # Version field of utsname + SI_MACHINE = 5 # Machine type + SI_ARCHITECTURE = 6 # Instruction set architecture + SI_HW_SERIAL = 7 # Hardware serial number + SI_HW_PROVIDER = 8 # Hardware manufacturer + SI_SRPC_DOMAIN = 9 # Secure RPC domain + SI_PLATFORM = 513 # Platform identifier + SI_ISALIST = 514 # Supported isalist + SI_DHCP_CACHE = 515 # Kernel cached DHCPACK + rescue FFI::NotFoundError + # Ignore. Not suppored. + end + + class UnameFFIStruct < FFI::Struct + members = [ + :sysname, [:char, BUFSIZE], + :nodename, [:char, BUFSIZE], + :release, [:char, BUFSIZE], + :version, [:char, BUFSIZE], + :machine, [:char, BUFSIZE] + ] + + if RbConfig::CONFIG['host_os'] =~ /linux/i + members.push(:domainname, [:char, BUFSIZE]) + end + + if RbConfig::CONFIG['host_os'] =~ /hpux/i + members.push(:__id_number, [:char, BUFSIZE]) + end + + layout(*members) + end + + fields = %w[ + sysname + nodename + release + version + machine + ] + + if RbConfig::CONFIG['host_os'] =~ /linux/i + fields.push('domainname') + end + + if RbConfig::CONFIG['host_os'] =~ /hpux/i + fields.push('id_number') + end + + if RbConfig::CONFIG['host_os'] =~ /sunos|solaris/i + fields.push( + 'architecture', + 'dhcp_cache', + 'hw_provider', + 'hw_serial', + 'isa_list', + 'platform', + 'srpc_domain' + ) + end + + if RbConfig::CONFIG['host_os'] =~ /darwin|bsd/i + fields.push('model') + end + + # :startdoc: + + UnameStruct = Struct.new("UnameStruct", *fields) + + # Returns a struct that contains the sysname, nodename, machine, version + # and release of your system. + # + # On OS X it will also include the model. + # + # On Solaris, it will also include the architecture and platform. + # + # On HP-UX, it will also include the id_number. + # + # Example: + # + # require 'sys/uname' + # + # p Sys::Uname.uname + # + def self.uname + utsname = UnameFFIStruct.new + + if uname_c(utsname) < 0 + raise Error, "uname() function call failed" + end + + struct = UnameStruct.new + struct[:sysname] = utsname[:sysname].to_s + struct[:nodename] = utsname[:nodename].to_s + struct[:release] = utsname[:release].to_s + struct[:version] = utsname[:version].to_s + struct[:machine] = utsname[:machine].to_s + + if RbConfig::CONFIG['host_os'] =~ /darwin|bsd/i + struct[:model] = get_model() + end + + if RbConfig::CONFIG['host_os'] =~ /sunos|solaris/i + struct[:architecture] = get_si(SI_ARCHITECTURE) + struct[:platform] = get_si(SI_PLATFORM) + struct[:hw_serial] = get_si(SI_HW_SERIAL) + struct[:hw_provider] = get_si(SI_HW_PROVIDER) + struct[:srpc_domain] = get_si(SI_SRPC_DOMAIN) + struct[:isa_list] = get_si(SI_ISALIST) + struct[:dhcp_cache] = get_si(SI_DHCP_CACHE) + + # FFI and Solaris don't get along so well, so we try again + struct[:sysname] = get_si(SI_SYSNAME) if struct.sysname.empty? + struct[:nodename] = get_si(SI_HOSTNAME) if struct.nodename.empty? + struct[:release] = get_si(SI_RELEASE) if struct.release.empty? + struct[:version] = get_si(SI_VERSION) if struct.version.empty? + struct[:machine] = get_si(SI_MACHINE) if struct.machine.empty? + end + + if RbConfig::CONFIG['host_os'] =~ /hpux/i + struct[:id_number] = utsname[:__id_number].to_s + end + + if RbConfig::CONFIG['host_os'] =~ /linux/i + struct[:domainname] = utsname[:domainname].to_s + end + + # Let's add a members method that works for testing and compatibility + if struct.members.nil? + struct.instance_eval(%Q{ + def members + @table.keys.map{ |k| k.to_s } + end + }) + end + + struct.freeze + end + + # Returns the name of this implementation of the operating system. + # + # Example: + # + # Uname.sysname # => 'SunOS' + # + def self.sysname + uname.sysname + end + + # Returns the name of this node within the communications network to + # which this node is attached, if any. This is often, but not + # necessarily, the same as the host name. + # + # Example: + # + # Uname.nodename # => 'your_host.foo.com' + # + def self.nodename + uname.nodename + end + + # Returns the current release level of your operating system. + # + # Example: + # + # Uname.release # => '2.2.16-3' + # + def self.release + uname.release + end + + # Returns the current version level of your operating system. + # + # Example: + # + # Uname.version # => '5.9' + # + def self.version + uname.version + end + + # Returns the machine hardware type. + # + # Example: + # + # Uname.machine # => 'i686' + # + def self.machine + uname.machine + end + + if defined? :sysctl + # Returns the model type. + # + # Example: + # + # Uname.model # => 'MacBookPro5,3' + # + def self.model + uname.model + end + end + + if defined? :sysinfo + # The basic instruction set architecture of the current + # system, e.g. sparc, i386, etc. + # + def self.architecture + uname.architecture + end + + # The specific model of the hardware platform, e.g Sun-Blade-1500, etc. + # + def self.platform + uname.platform + end + + # The string consisting of the ASCII hexidecimal encoding of the name + # of the interface configured by boot(1M) followed by the DHCPACK reply + # from the server. + # + def self.dhcp_cache + uname.dhcp_cache + end + + # The variant instruction set architectures executable on the + # current system. + # + def self.isa_list + uname.isa_list + end + + # The ASCII representation of the hardware-specific serial number + # of the physical machine on which the function is executed. + # + def self.hw_serial + uname.hw_serial.to_i + end + + # The name of the of the hardware provider. + # + def self.hw_provider + uname.hw_provider + end + + # The Secure Remote Procedure Call domain name. + # + def self.srpc_domain + uname.srpc_domain + end + end + + private + + # Returns the model for systems that define sysctl(). + # + def self.get_model + buf = 0.chr * BUFSIZE + mib = FFI::MemoryPointer.new(:int, 2).write_array_of_int([CTL_HW, HW_MODEL]) + size = FFI::MemoryPointer.new(:long, 1).write_int(buf.size) + + sysctl(mib, 2, buf, size, nil, 0) + + buf.strip + end + + private_class_method :get_model + + # Returns the various sysinfo information based on +flag+. + # + def self.get_si(flag) + buf = 0.chr * BUFSIZE + sysinfo(flag, buf, BUFSIZE) + buf.strip + end + + private_class_method :get_si + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/lib/windows/sys/uname.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/lib/windows/sys/uname.rb new file mode 100644 index 000000000..bc3a0c8a1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/lib/windows/sys/uname.rb @@ -0,0 +1,469 @@ +require 'socket' +require 'time' + +# See Ruby bugs #2618 and #7681. This is a workaround. +BEGIN{ + require 'win32ole' + if RUBY_VERSION.to_f < 2.0 + WIN32OLE.ole_initialize + at_exit { WIN32OLE.ole_uninitialize } + end +} + +# The Sys module provides a namespace only. +module Sys + + # The Uname class encapsulates uname (platform) information. + class Uname + + # This is the error raised if any of the Sys::Uname methods should fail. + class Error < StandardError; end + + # The version of the sys-uname library. + VERSION = '0.9.2' + + fields = %w[ + boot_device + build_number + build_type + caption + code_set + country_code + creation_class_name + cscreation_class_name + csd_version + cs_name + current_time_zone + debug + description + distributed + foreground_application_boost + free_physical_memory + free_space_in_paging_files + free_virtual_memory + install_date + last_bootup_time + local_date_time + locale + manufacturer + max_number_of_processes + max_process_memory_size + name + number_of_licensed_users + number_of_processes + number_of_users + organization + os_language + os_product_suite + os_type + other_type_description + plus_product_id + plus_version_number + primary + quantum_length + quantum_type + registered_user + serial_number + service_pack_major_version + service_pack_minor_version + size_stored_in_paging_files + status + system_device + system_directory + total_swap_space_size + total_virtual_memory_size + total_visible_memory_size + version + windows_directory + ] + + # The UnameStruct is used to store platform information for some methods. + UnameStruct = Struct.new("UnameStruct", *fields) + + # Returns the version plus patch information of the operating system, + # separated by a hyphen, e.g. "2915-Service Pack 2". + #-- + # The instance name is unpredictable, so we have to resort to using + # the 'InstancesOf' method to get the data we need, rather than + # including it as part of the connection. + # + def self.version(host=Socket.gethostname) + cs = "winmgmts://#{host}/root/cimv2" + begin + wmi = WIN32OLE.connect(cs) + rescue WIN32OLERuntimeError => e + raise Error, e + else + wmi.InstancesOf("Win32_OperatingSystem").each{ |ole| + str = "#{ole.Version} #{ole.BuildNumber}-" + str << "#{ole.ServicePackMajorVersion}" + return str + } + end + end + + # Returns the operating system name, e.g. "Microsoft Windows XP Home" + # + def self.sysname(host=Socket.gethostname) + cs = "winmgmts:{impersonationLevel=impersonate,(security)}" + cs << "//#{host}/root/cimv2" + begin + wmi = WIN32OLE.connect(cs) + rescue WIN32OLERuntimeError => e + raise Error, e + else + wmi.InstancesOf("Win32_OperatingSystem").each{ |ole| + return ole.Caption + } + end + end + + # Returns the nodename. This is usually, but not necessarily, the + # same as the system's hostname. + # + def self.nodename(host=Socket.gethostname) + cs = "winmgmts:{impersonationLevel=impersonate,(security)}" + cs << "//#{host}/root/cimv2" + begin + wmi = WIN32OLE.connect(cs) + rescue WIN32OLERuntimeError => e + raise Error, e + else + wmi.InstancesOf("Win32_OperatingSystem").each{ |ole| + return ole.CSName + } + end + end + + # Returns the machine hardware type. e.g. "i686". + #-- + # This may or may not return the expected value because some CPU types + # were unknown to the OS when the OS was originally released. It + # appears that MS doesn't necessarily patch this, either. + # + def self.machine(cpu_num=0, host=Socket.gethostname) + cs = "winmgmts:{impersonationLevel=impersonate,(security)}" + cs << "//#{host}/root/cimv2:Win32_Processor='cpu#{cpu_num}'" + begin + wmi = WIN32OLE.connect(cs) + rescue WIN32OLERuntimeError => e + raise Error, e + else + # Convert a family number into the equivalent string + case wmi.Family + when 1 + return "Other" + when 2 + return "Unknown" + when 3 + return "8086" + when 4 + return "80286" + when 5 + return "80386" + when 6 + return "80486" + when 7 + return "8087" + when 8 + return "80287" + when 9 + return "80387" + when 10 + return "80487" + when 11 + return "Pentium brand" + when 12 + return "Pentium Pro" + when 13 + return "Pentium II" + when 14 + return "Pentium processor with MMX technology" + when 15 + return "Celeron" + when 16 + return "Pentium II Xeon" + when 17 + return "Pentium III" + when 18 + return "M1 Family" + when 19 + return "M2 Family" + when 24 + return "K5 Family" + when 25 + return "K6 Family" + when 26 + return "K6-2" + when 27 + return "K6-3" + when 28 + return "AMD Athlon Processor Family" + when 29 + return "AMD Duron Processor" + when 30 + return "AMD2900 Family" + when 31 + return "K6-2+" + when 32 + return "Power PC Family" + when 33 + return "Power PC 601" + when 34 + return "Power PC 603" + when 35 + return "Power PC 603+" + when 36 + return "Power PC 604" + when 37 + return "Power PC 620" + when 38 + return "Power PC X704" + when 39 + return "Power PC 750" + when 48 + return "Alpha Family" + when 49 + return "Alpha 21064" + when 50 + return "Alpha 21066" + when 51 + return "Alpha 21164" + when 52 + return "Alpha 21164PC" + when 53 + return "Alpha 21164a" + when 54 + return "Alpha 21264" + when 55 + return "Alpha 21364" + when 64 + return "MIPS Family" + when 65 + return "MIPS R4000" + when 66 + return "MIPS R4200" + when 67 + return "MIPS R4400" + when 68 + return "MIPS R4600" + when 69 + return "MIPS R10000" + when 80 + return "SPARC Family" + when 81 + return "SuperSPARC" + when 82 + return "microSPARC II" + when 83 + return "microSPARC IIep" + when 84 + return "UltraSPARC" + when 85 + return "UltraSPARC II" + when 86 + return "UltraSPARC IIi" + when 87 + return "UltraSPARC III" + when 88 + return "UltraSPARC IIIi" + when 96 + return "68040" + when 97 + return "68xxx Family" + when 98 + return "68000" + when 99 + return "68010" + when 100 + return "68020" + when 101 + return "68030" + when 112 + return "Hobbit Family" + when 120 + return "Crusoe TM5000 Family" + when 121 + return "Crusoe TM3000 Family" + when 128 + return "Weitek" + when 130 + return "Itanium Processor" + when 144 + return "PA-RISC Family" + when 145 + return "PA-RISC 8500" + when 146 + return "PA-RISC 8000" + when 147 + return "PA-RISC 7300LC" + when 148 + return "PA-RISC 7200" + when 149 + return "PA-RISC 7100LC" + when 150 + return "PA-RISC 7100" + when 160 + return "V30 Family" + when 176 + return "Pentium III Xeon" + when 177 + return "Pentium III Processor with Intel SpeedStep Technology" + when 178 + return "Pentium 4" + when 179 + return "Intel Xeon" + when 180 + return "AS400 Family" + when 181 + return "Intel Xeon processor MP" + when 182 + return "AMD AthlonXP Family" + when 183 + return "AMD AthlonMP Family" + when 184 + return "Intel Itanium 2" + when 185 + return "AMD Opteron Family" + when 190 + return "K7" + when 200 + return "IBM390 Family" + when 201 + return "G4" + when 202 + return "G5" + when 250 + return "i860" + when 251 + return "i960" + when 260 + return "SH-3" + when 261 + return "SH-4" + when 280 + return "ARM" + when 281 + return "StrongARM" + when 300 + return "6x86" + when 301 + return "MediaGX" + when 302 + return "MII" + when 320 + return "WinChip" + when 350 + return "DSP" + when 500 + return "Video Processor" + else + return "Unknown" + end + end + end + + # Returns the release number, e.g. 5.1.2600. + # + def self.release(host=Socket.gethostname) + cs = "winmgmts://#{host}/root/cimv2" + begin + wmi = WIN32OLE.connect(cs) + rescue WIN32OLERuntimeError => e + raise Error, e + else + wmi.InstancesOf("Win32_OperatingSystem").each{ |ole| + return ole.Version + } + end + end + + # Returns a struct of type UnameStruct that contains sysname, nodename, + # machine, version, and release, as well as a plethora of other fields. + # Please see the MSDN documentation for what each of these fields mean. + # + def self.uname(host=Socket.gethostname) + cs = "winmgmts://#{host}/root/cimv2" + begin + wmi = WIN32OLE.connect(cs) + rescue WIN32OLERuntimeError => e + raise Error, e + else + wmi.InstancesOf("Win32_OperatingSystem").each{ |os| + return UnameStruct.new( + os.BootDevice, + os.BuildNumber, + os.BuildType, + os.Caption, + os.CodeSet, + os.CountryCode, + os.CreationClassName, + os.CSCreationClassName, + os.CSDVersion, + os.CSName, + os.CurrentTimeZone, + os.Debug, + os.Description, + os.Distributed, + os.ForegroundApplicationBoost, + self.convert(os.FreePhysicalMemory), + self.convert(os.FreeSpaceInPagingFiles), + self.convert(os.FreeVirtualMemory), + self.parse_ms_date(os.InstallDate), + self.parse_ms_date(os.LastBootUpTime), + self.parse_ms_date(os.LocalDateTime), + os.Locale, + os.Manufacturer, + os.MaxNumberOfProcesses, + self.convert(os.MaxProcessMemorySize), + os.Name, + os.NumberOfLicensedUsers, + os.NumberOfProcesses, + os.NumberOfUsers, + os.Organization, + os.OSLanguage, + os.OSProductSuite, + os.OSType, + os.OtherTypeDescription, + os.PlusProductID, + os.PlusVersionNumber, + os.Primary, + os.respond_to?(:QuantumLength) ? os.QuantumLength : nil, + os.respond_to?(:QuantumType) ? os.QuantumType : nil, + os.RegisteredUser, + os.SerialNumber, + os.ServicePackMajorVersion, + os.ServicePackMinorVersion, + self.convert(os.SizeStoredInPagingFiles), + os.Status, + os.SystemDevice, + os.SystemDirectory, + self.convert(os.TotalSwapSpaceSize), + self.convert(os.TotalVirtualMemorySize), + self.convert(os.TotalVisibleMemorySize), + os.Version, + os.WindowsDirectory + ) + } + end + end + + private + + # Converts a string in the format '20040703074625.015625-360' into a + # Ruby Time object. + # + def self.parse_ms_date(str) + return if str.nil? + return Time.parse(str.split('.')[0]) + end + + # There is a bug in win32ole where uint64 types are returned as a + # String rather than a Fixnum/Bignum. This deals with that for now. + # + def self.convert(str) + return nil if str.nil? # Don't turn nil into 0 + return str.to_i + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/sys-uname.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/sys-uname.gemspec new file mode 100644 index 000000000..1c8560d4b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/sys-uname.gemspec @@ -0,0 +1,31 @@ +require 'rubygems' + +Gem::Specification.new do |spec| + spec.name = 'sys-uname' + spec.version = '0.9.2' + spec.author = 'Daniel J. Berger' + spec.email = 'djberg96@gmail.com' + spec.homepage = 'http://www.rubyforge.org/projects/sysutils' + spec.summary = 'An interface for returning uname (platform) information' + spec.test_file = 'test/test_sys_uname.rb' + spec.license = 'Artistic 2.0' + spec.files = Dir['**/*'].reject{ |f| f.include?('git') } + + spec.extra_rdoc_files = ['CHANGES', 'README', 'MANIFEST', 'doc/uname.txt'] + spec.rubyforge_project = 'sysutils' + + if File::ALT_SEPARATOR + spec.require_paths = ['lib', 'lib/windows'] + else + spec.require_paths = ['lib', 'lib/unix'] + spec.add_dependency('ffi', '>= 1.0.0') + end + + spec.description = <<-EOF + The sys-uname library provides an interface for gathering information + about your current platform. The library is named after the Unix 'uname' + command but also works on MS Windows. Available information includes + OS name, OS version, system name and so on. Additional information is + available for certain platforms. + EOF +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/test/test_sys_uname.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/test/test_sys_uname.rb new file mode 100644 index 000000000..328251758 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/sys-uname-0.9.2/test/test_sys_uname.rb @@ -0,0 +1,463 @@ +############################################################################## +# test_sys_uname.rb +# +# Test suite for the sys-uname library. Run 'rake test' to execute tests. +############################################################################## +require 'test-unit' +require 'sys/uname' +require 'rbconfig' +include Sys + +class TC_Sys_Uname < Test::Unit::TestCase + def self.startup + @@host_os = RbConfig::CONFIG['host_os'] + end + + test "version constant is set to expected value" do + assert_equal('0.9.2', Uname::VERSION) + end + + test "machine singleton method works as expected" do + assert_respond_to(Uname, :machine) + assert_nothing_raised{ Uname.machine } + assert_kind_of(String, Uname.machine) + assert_true(Uname.machine.size > 0) + end + + test "version singleton method works as expected" do + assert_respond_to(Uname, :version) + assert_nothing_raised{ Uname.version } + assert_kind_of(String, Uname.version) + assert_true(Uname.version.size > 0) + end + + test "nodename singleton method works as expected" do + assert_respond_to(Uname, :nodename) + assert_nothing_raised{ Uname.nodename } + assert_kind_of(String, Uname.nodename) + assert_true(Uname.nodename.size > 0) + end + + test "release singleton method works as expected" do + assert_respond_to(Uname, :release) + assert_nothing_raised{ Uname.release } + assert_kind_of(String, Uname.release) + assert_true(Uname.release.size > 0) + end + + test "sysname singleton method works as expected" do + assert_respond_to(Uname, :sysname) + assert_nothing_raised{ Uname.sysname } + assert_kind_of(String, Uname.sysname) + assert_true(Uname.sysname.size > 0) + end + + test "architecture singleton method works as expected on solaris" do + omit_unless(@@host_os =~ /sunos|solaris/i, "Solaris only") + assert_respond_to(Uname, :architecture) + assert_nothing_raised{ Uname.architecture } + assert_kind_of(String, Uname.architecture) + end + + test "platform singleton method works as expected on solaris" do + omit_unless(@@host_os =~ /sunos|solaris/i, "Solaris only") + assert_respond_to(Uname, :platform) + assert_nothing_raised{ Uname.platform } + assert_kind_of(String, Uname.platform) + end + + test "isa_list singleton method works as expected on solaris" do + omit_unless(@@host_os =~ /sunos|solaris/i, "Solaris only") + assert_respond_to(Uname, :isa_list) + assert_nothing_raised{ Uname.isa_list } + assert_kind_of(String, Uname.isa_list) + end + + test "hw_provider singleton method works as expected on solaris" do + omit_unless(@@host_os =~ /sunos|solaris/i, "Solaris only") + assert_respond_to(Uname,:hw_provider) + assert_nothing_raised{ Uname.hw_provider } + assert_kind_of(String, Uname.hw_provider) + end + + test "hw_serial singleton method works as expected on solaris" do + omit_unless(@@host_os =~ /sunos|solaris/i, "Solaris only") + assert_respond_to(Uname, :hw_serial) + assert_nothing_raised{ Uname.hw_serial } + assert_kind_of(Integer, Uname.hw_serial) + end + + test "srpc_domain singleton method works as expected on solaris" do + omit_unless(@@host_os =~ /sunos|solaris/i, "Solaris only") + assert_respond_to(Uname, :srpc_domain) + assert_nothing_raised{ Uname.srpc_domain } + assert_kind_of(String, Uname.srpc_domain) + end + + test "dhcp_cache singleton method works as expected on solaris" do + omit_unless(@@host_os =~ /sunos|solaris/i, "Solaris only") + assert_respond_to(Uname, :dhcp_cache) + assert_nothing_raised{ Uname.dhcp_cache } + assert_kind_of(String, Uname.dhcp_cache) + end + + test "model singleton method works as expected on BSD and Darwin" do + omit_unless(@@host_os =~ /darwin|powerpc|bsd|mach/i, "BSD/Darwin only") + assert_respond_to(Uname, :model) + assert_nothing_raised{ Uname.model } + assert_kind_of(String, Uname.model) + end + + test "id_number singleton method works as expected on HP-UX" do + omit_unless(@@host_os =~ /hpux/i, "HP-UX only") + assert_respond_to(Uname, :id_number) + assert_nothing_raised{ Uname.id_number } + assert_kind_of(String, Uname.id_number) + end + + test "uname struct contains expected members based on platform" do + members = %w/sysname nodename machine version release/ + case RbConfig::CONFIG['host_os'] + when /linux/i + members.push('domainname') + when /sunos|solaris/i + members.push( + 'architecture', 'platform', 'hw_serial', 'hw_provider', + 'srpc_domain', 'isa_list', 'dhcp_cache' + ) + when /powerpc|darwin|bsd/i + members.push('model') + when /hpux/i + members.push('id') + when /win32|mingw|cygwin|dos|windows/i + members = %w[ + boot_device build_number build_type caption code_set country_code + creation_class_name cscreation_class_name csd_version cs_name + current_time_zone debug description distributed + foreground_application_boost free_physical_memory + free_space_in_paging_files free_virtual_memory + install_date last_bootup_time local_date_time locale + manufacturer max_number_of_processes max_process_memory_size + name number_of_licensed_users number_of_processes + number_of_users organization os_language os_product_suite + os_type other_type_description plus_product_id + plus_version_number primary quantum_length quantum_type + registered_user serial_number service_pack_major_version + service_pack_minor_version size_stored_in_paging_files + status system_device system_directory total_swap_space_size + total_virtual_memory_size total_visible_memory_size version + windows_directory + ] + end + + members.map!{ |e| e.to_sym } if RUBY_VERSION.to_f >= 1.9 + + assert_nothing_raised{ Uname.uname } + assert_kind_of(Struct, Uname.uname) + assert_equal(members.sort, Uname.uname.members.sort) + end + + test "ffi and internal functions are not public" do + methods = Uname.methods(false).map{ |e| e.to_s } + assert_false(methods.include?('get_model')) + assert_false(methods.include?('get_si')) + assert_false(methods.include?('uname_c')) + assert_false(methods.include?('sysctl')) + assert_false(methods.include?('sysinfo')) + end + + # The following tests are win32 only + if File::ALT_SEPARATOR + def test_boot_device + assert_nothing_raised{ Uname.uname.boot_device } + assert_kind_of(String, Uname.uname.boot_device) + end + + def test_build_number + assert_nothing_raised{ Uname.uname.build_number } + assert_kind_of(String, Uname.uname.build_number) + end + + def test_build_type + assert_nothing_raised{ Uname.uname.build_type } + assert_kind_of(String, Uname.uname.build_type) + end + + def test_caption + assert_nothing_raised{ Uname.uname.caption } + assert_kind_of(String, Uname.uname.caption) + end + + def test_code_set + assert_nothing_raised{ Uname.uname.code_set } + assert_kind_of(String, Uname.uname.code_set) + end + + def test_country_code + assert_nothing_raised{ Uname.uname.country_code } + assert_kind_of(String, Uname.uname.country_code) + end + + def test_creation_class_name + assert_nothing_raised{ Uname.uname.creation_class_name } + assert_kind_of(String, Uname.uname.creation_class_name) + end + + def test_cscreation_class_name + assert_nothing_raised{ Uname.uname.cscreation_class_name } + assert_kind_of(String, Uname.uname.cscreation_class_name) + end + + def test_csd_version + assert_nothing_raised{ Uname.uname.csd_version } + assert_kind_of(String, Uname.uname.csd_version) + end + + def test_cs_name + assert_nothing_raised{ Uname.uname.cs_name } + assert_kind_of(String, Uname.uname.cs_name) + end + + def test_current_time_zone + assert_nothing_raised{ Uname.uname.current_time_zone } + assert_kind_of(Fixnum, Uname.uname.current_time_zone) + end + + def test_debug + assert_nothing_raised{ Uname.uname.debug } + assert_boolean(Uname.uname.debug) + end + + def test_description + assert_nothing_raised{ Uname.uname.description } + assert_kind_of(String, Uname.uname.description) + end + + def test_distributed + assert_nothing_raised{ Uname.uname.distributed } + assert_boolean(Uname.uname.distributed) + end + + # Not yet supported - WinXP or later only + #def test_encryption_level + # assert_nothing_raised{ Uname.uname.encryption_level } + # assert_kind_of(Fixnum,Uname.uname.encryption_level) + #end + + def test_foreground_application_boost + assert_nothing_raised{ Uname.uname.foreground_application_boost } + assert_kind_of(Fixnum, Uname.uname.foreground_application_boost) + end + + def test_free_physical_memory + assert_nothing_raised{ Uname.uname.free_physical_memory } + assert_kind_of(Fixnum, Uname.uname.free_physical_memory) + end + + def test_free_space_in_paging_files + assert_nothing_raised{ Uname.uname.free_space_in_paging_files } + assert_kind_of(Fixnum, Uname.uname.free_space_in_paging_files) + end + + def test_free_virtual_memory + assert_nothing_raised{ Uname.uname.free_virtual_memory} + assert_kind_of(Fixnum, Uname.uname.free_virtual_memory) + end + + def test_install_date + assert_nothing_raised{ Uname.uname.install_date} + assert_kind_of(Time, Uname.uname.install_date) + end + + # Not yet supported - WinXP or later only + #def test_large_system_cache + # assert_nothing_raised{ Uname.uname.large_system_cache} + # assert_kind_of(Time,Uname.uname.large_system_cache) + #end + + def test_last_bootup_time + assert_nothing_raised{ Uname.uname.last_bootup_time} + assert_kind_of(Time, Uname.uname.last_bootup_time) + end + + def test_local_date_time + assert_nothing_raised{ Uname.uname.local_date_time} + assert_kind_of(Time, Uname.uname.local_date_time) + end + + def test_locale + assert_nothing_raised{ Uname.uname.locale} + assert_kind_of(String, Uname.uname.locale) + end + + def test_manufacturer + assert_nothing_raised{ Uname.uname.manufacturer} + assert_kind_of(String, Uname.uname.manufacturer) + end + + def test_max_number_of_processes + assert_nothing_raised{ Uname.uname.max_number_of_processes} + assert_kind_of(Fixnum, Uname.uname.max_number_of_processes) + end + + def test_max_process_memory_size + assert_nothing_raised{ Uname.uname.max_process_memory_size} + assert_kind_of(Integer, Uname.uname.max_process_memory_size) + end + + def test_name + assert_nothing_raised{ Uname.uname.name} + assert_kind_of(String, Uname.uname.name) + end + + # Fails on Win XP Pro - returns nil - reason unknown + #def test_number_of_licensed_users + # assert_nothing_raised{ Uname.uname.number_of_licensed_users} + # assert_kind_of(Fixnum,Uname.uname.number_of_licensed_users) + #end + + def test_number_of_processes + assert_nothing_raised{ Uname.uname.number_of_processes} + assert_kind_of(Fixnum, Uname.uname.number_of_processes) + end + + def test_number_of_users + assert_nothing_raised{ Uname.uname.number_of_users} + assert_kind_of(Fixnum, Uname.uname.number_of_users) + end + + def test_organization + assert_nothing_raised{ Uname.uname.organization} + assert_kind_of(String, Uname.uname.organization) + end + + # Eventually replace Fixnum with a string (?) + def test_os_language + assert_nothing_raised{ Uname.uname.os_language} + assert_kind_of(Fixnum, Uname.uname.os_language) + end + + # Fails on Win XP Pro - returns nil - reason unknown + #def test_os_product_suite + # assert_nothing_raised{ Uname.uname.os_product_suite} + # assert_kind_of(Fixnum,Uname.uname.os_product_suite) + #end + + def test_os_type + assert_nothing_raised{ Uname.uname.os_type} + assert_kind_of(Fixnum, Uname.uname.os_type) + end + + # Fails? + #def test_other_type_restriction + # assert_nothing_raised{ Uname.uname.other_type_restriction} + # assert_kind_of(Fixnum,Uname.uname.other_type_restriction) + #end + + # Might be nil + def test_plus_product_id + assert_nothing_raised{ Uname.uname.plus_product_id } + end + + # Might be nil + def test_plus_version_number + assert_nothing_raised{ Uname.uname.plus_version_number} + end + + def test_primary + assert_nothing_raised{ Uname.uname.primary} + assert_boolean(Uname.uname.primary) + end + + # Not yet supported - WinXP or later only + # def test_product_type + # assert_nothing_raised{ Uname.uname.product_type} + # assert_kind_of(Fixnum,Uname.uname.product_type) + # end + + def test_quantum_length + assert_nothing_raised{ Uname.uname.quantum_length} + assert_kind_of([Fixnum, NilClass], Uname.uname.quantum_length) + end + + def test_quantum_type + assert_nothing_raised{ Uname.uname.quantum_type} + assert_kind_of([Fixnum, NilClass], Uname.uname.quantum_type) + end + + def test_registered_user + assert_nothing_raised{ Uname.uname.registered_user} + assert_kind_of(String, Uname.uname.registered_user) + end + + def test_serial_number + assert_nothing_raised{ Uname.uname.serial_number} + assert_kind_of(String, Uname.uname.serial_number) + end + + # This is nil on NT 4 + def test_service_pack_major_version + assert_nothing_raised{ Uname.uname.service_pack_major_version} + assert_kind_of(Fixnum, Uname.uname.service_pack_major_version) + end + + # This is nil on NT 4 + def test_service_pack_minor_version + assert_nothing_raised{ Uname.uname.service_pack_minor_version} + assert_kind_of(Fixnum, Uname.uname.service_pack_minor_version) + end + + def test_status + assert_nothing_raised{ Uname.uname.status} + assert_kind_of(String, Uname.uname.status) + end + + # Not yet supported - WinXP or later only + #def test_suite_mask + # assert_nothing_raised{ Uname.uname.suite_mask} + # assert_kind_of(String,Uname.uname.suite_mask) + #end + + def test_system_device + assert_nothing_raised{ Uname.uname.system_device} + assert_kind_of(String, Uname.uname.system_device) + end + + def test_system_directory + assert_nothing_raised{ Uname.uname.system_directory} + assert_kind_of(String, Uname.uname.system_directory) + end + + # Not yet supported - WinXP or later only + #def test_system_drive + # assert_nothing_raised{ Uname.uname.system_drive} + # assert_kind_of(String,Uname.uname.system_drive) + #end + + # Fails on Win XP Pro - returns nil - reason unknown + #def test_total_swap_space_size + # assert_nothing_raised{ Uname.uname.total_swap_space_size} + # assert_kind_of(Fixnum,Uname.uname.total_swap_space_size) + #end + + def test_total_virtual_memory_size + assert_nothing_raised{ Uname.uname.total_virtual_memory_size} + assert_kind_of(Fixnum, Uname.uname.total_virtual_memory_size) + end + + def test_total_visible_memory_size + assert_nothing_raised{ Uname.uname.total_visible_memory_size} + assert_kind_of(Fixnum, Uname.uname.total_visible_memory_size) + end + + def test_version + assert_nothing_raised{ Uname.uname.version} + assert_kind_of(String, Uname.uname.version) + end + + def test_windows_directory + assert_nothing_raised{ Uname.uname.windows_directory} + assert_kind_of(String, Uname.uname.windows_directory) + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/syslog-logger-1.6.8/README.rdoc b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/syslog-logger-1.6.8/README.rdoc new file mode 100644 index 000000000..8d7f95d02 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/syslog-logger-1.6.8/README.rdoc @@ -0,0 +1,115 @@ += SyslogLogger + +http://github.com/ngmoco/sysloglogger + +== DESCRIPTION: + +Logger::Syslog is a Logger replacement that logs to syslog. It is almost drop-in +with a few caveats. You can add Logger::Syslog to your Rails production +environment to aggregate logs between multiple machines. + +NOTE! You can only set the Logger::Syslog program name and facility when you initialize +Logger::Syslog for the first time. This is a limitation of the way Logger::Syslog +uses syslog (and in some ways, a limitation of the way syslog(3) works). +Attempts to change Logger::Syslog's program name or facility after the first initialization +will be ignored. + +This particular Logger::Syslog improves the original by correctly mapping Rails log severities to +the Syslog counterparts. It also adds the ability to select a syslog facility other than "user." + +Version 1.6.7 takes a formatter as logger does and uses call to format the message. + +== SYNOPSIS: + +=== config/environment.rb + + config.gem 'syslog-logger' + +=== Gemfile + + gem 'syslog-logger' + +=== config/environments/production.rb + +(Only this environment, since you probably only want to enable it for Production, and not Test or Development.) + + RAILS_DEFAULT_LOGGER = Logger::Syslog.new + +By default, Logger::Syslog uses the program name 'rails' and the facility 'user', but this can be +changed via the arguments to Logger::Syslog.new: + + RAILS_DEFAULT_LOGGER = Logger::Syslog.new('mygreatapp', Syslog::LOG_LOCAL7) + +=== BSD syslog setup + +==== /etc/syslog.conf + +Add the following lines: + + !rails + *.* /var/log/production.log + +Or, in Mac OS X: + + local7.* /var/log/production.log + +Then touch /var/log/production.log and signal syslogd with a HUP +(killall -HUP syslogd, on FreeBSD and OS X). + +==== /etc/newsyslog.conf + +Add the following line: + + /var/log/production.log 640 7 * @T00 Z + +This creates a log file that is rotated every day at midnight, gzip'd, then +kept for 7 days. Consult newsyslog.conf(5) for more details. + +=== syslog-ng setup + +==== syslog-ng.conf + +A basic setup: + + destination rails_log { file("/var/log/production.log"); }; + filter f_rails { program("rails.*"); }; + log { source(src); filter(f_rails); destination(rails_log); }; + +A more advanced setup with formatting, etc: + + destination rails { file("/var/log/rails_apps" owner("rails") group("rails") perm(0664) template("$DATE $HOST $PROGRAM [$LEVEL] $MSGONLY\n") template_escape(no) ); }; + filter f_rails { (program("railsappone") or program("railsapptwo")) and not match("SQL ") and not match("SELECT") and not match("INSERT INTO") and not match("UPDATE"); }; + log { source(src); filter(f_rails); destination(rails); }; + +=== Starting + +Now restart your Rails app. Your production logs should now be showing up in +/var/log/production.log. If you have mulitple machines, you can log them all +to a central machine with remote syslog logging for analysis. Consult your +syslogd(8) manpage for further details. + +== LICENSE: + +Copyright (c) 2008, 2009 Eric Hodel, Christopher Powell, Ian Lesperance, + Dana Contreras, Brian Smith, Ashley Martens + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +'Software'), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, +TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE +SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/syslog-logger-1.6.8/lib/syslog-formatter.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/syslog-logger-1.6.8/lib/syslog-formatter.rb new file mode 100644 index 000000000..b0420ff8e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/syslog-logger-1.6.8/lib/syslog-formatter.rb @@ -0,0 +1,40 @@ +# Adds some default information to syslog messages. +# Log format: +# [Time.mSec] [SeverityLabel]: message + +class Logger::SyslogFormatter < Logger::Formatter + Format = "[%s] [%5s]: %s\n" + + attr_accessor :datetime_format + + def initialize + @datetime_format = nil + end + + def call(severity, time, progname, msg) + Format % [format_datetime(time), severity, msg2str(msg)] + end + + protected + + def format_datetime(time) + if @datetime_format.nil? + time.strftime("%H:%M:%S.") << "%06d " % time.usec + else + time.strftime(@datetime_format) + end + end + + def msg2str(msg) + case msg + when ::String + msg + when ::Exception + "#{ msg.message } (#{ msg.class })\n" << + (msg.backtrace || []).join("\n") + else + msg.inspect + end + end + +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/syslog-logger-1.6.8/lib/syslog-logger.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/syslog-logger-1.6.8/lib/syslog-logger.rb new file mode 100644 index 000000000..041a2ad19 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/syslog-logger-1.6.8/lib/syslog-logger.rb @@ -0,0 +1,161 @@ +require 'syslog' +require 'logger' +require 'syslog-formatter' + +class Logger::Syslog + include Logger::Severity + + # The version of Logger::Syslog you are using. + VERSION = '1.6.8' + + # From 'man syslog.h': + # LOG_EMERG A panic condition was reported to all processes. + # LOG_ALERT A condition that should be corrected immediately. + # LOG_CRIT A critical condition. + # LOG_ERR An error message. + # LOG_WARNING A warning message. + # LOG_NOTICE A condition requiring special handling. + # LOG_INFO A general information message. + # LOG_DEBUG A message useful for debugging programs. + + # From logger rdoc: + # FATAL: an unhandleable error that results in a program crash + # ERROR: a handleable error condition + # WARN: a warning + # INFO: generic (useful) information about system operation + # DEBUG: low-level information for developers + + # Maps Logger warning types to syslog(3) warning types. + LOGGER_MAP = { + :unknown => :alert, + :fatal => :crit, + :error => :err, + :warn => :warning, + :info => :info, + :debug => :debug + } + + # Maps Logger log levels to their values so we can silence. + LOGGER_LEVEL_MAP = {} + + LOGGER_MAP.each_key do |key| + LOGGER_LEVEL_MAP[key] = Logger.const_get key.to_s.upcase + end + + # Maps Logger log level values to syslog log levels. + LEVEL_LOGGER_MAP = {} + + LOGGER_LEVEL_MAP.invert.each do |level, severity| + LEVEL_LOGGER_MAP[level] = LOGGER_MAP[severity] + end + + # Builds a methods for level +meth+. + for severity in Logger::Severity.constants + class_eval <<-EOT, __FILE__, __LINE__ + def #{severity.downcase}(message = nil, progname = nil, &block) # def debug(message = nil, progname = nil, &block) + add(#{severity}, message, progname, &block) # add(DEBUG, message, progname, &block) + end # end + # + def #{severity.downcase}? # def debug? + @level <= #{severity} # @level <= DEBUG + end # end + EOT + end + + # Log level for Logger compatibility. + attr_accessor :level + + # Logging program name. + attr_accessor :progname + + # Logging date-time format (string passed to +strftime+). + def datetime_format=(datetime_format) + @default_formatter.datetime_format = datetime_format + end + + def datetime_format + @default_formatter.datetime_format + end + + # Logging formatter. formatter#call is invoked with 4 arguments; severity, + # time, progname and msg for each log. Bear in mind that time is a Time and + # msg is an Object that user passed and it could not be a String. It is + # expected to return a logdev#write-able Object. Default formatter is used + # when no formatter is set. + attr_accessor :formatter + + alias sev_threshold level + alias sev_threshold= level= + + # Fills in variables for Logger compatibility. If this is the first + # instance of Logger::Syslog, +program_name+ may be set to change the logged + # program name and +facility+ may be set to specify a custom facility + # with your syslog daemon. + # + # Due to the way syslog works, only one program name may be chosen. + def initialize(program_name = 'rails', facility = Syslog::LOG_USER, logopts=nil) + @default_formatter = Logger::SyslogFormatter.new + @formatter = nil + @progname = nil + @level = Logger::DEBUG + + return if defined? SYSLOG + self.class.const_set :SYSLOG, Syslog.open(program_name, logopts, facility) + end + + # Almost duplicates Logger#add. +progname+ is ignored. + def add(severity, message = nil, progname = nil, &block) + severity ||= Logger::UNKNOWN + if severity < @level + return true + end + if message.nil? + if block_given? + message = yield + else + message = progname + progname = @progname + end + end + SYSLOG.send(LEVEL_LOGGER_MAP[severity], format_message(format_severity(severity), Time.now, progname, clean(message))) + true + end + + # Allows messages of a particular log level to be ignored temporarily. + def silence(temporary_level = Logger::ERROR) + old_logger_level = @level + @level = temporary_level + yield + ensure + @level = old_logger_level + end + + # In Logger, this dumps the raw message; the closest equivalent + # would be Logger::UNKNOWN + def <<(message) + add(Logger::UNKNOWN, message) + end + + private + + # Severity label for logging. (max 5 char) + SEV_LABEL = %w(DEBUG INFO WARN ERROR FATAL ANY) + + def format_severity(severity) + SEV_LABEL[severity] || 'ANY' + end + + def format_message(severity, datetime, progname, msg) + (@formatter || @default_formatter).call(severity, datetime, progname, msg) + end + + # Clean up messages so they're nice and pretty. + def clean(message) + message = message.to_s.dup + message.strip! + message.gsub!(/%/, '%%') # syslog(3) freaks on % (printf) + message.gsub!(/\e\[[^m]*m/, '') # remove useless ansi color codes + return message + end + +end \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/syslog-logger-1.6.8/test/test_syslog_logger.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/syslog-logger-1.6.8/test/test_syslog_logger.rb new file mode 100644 index 000000000..d768f76a1 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/syslog-logger-1.6.8/test/test_syslog_logger.rb @@ -0,0 +1,491 @@ +require 'test/unit' +require 'tempfile' +require 'syslog-logger' + +module MockSyslog; end + +class << MockSyslog + + @line = nil + + Logger::Syslog::LOGGER_MAP.values.uniq.each do |level| + eval <<-EOM + def #{level}(message) + @line = "#{level.to_s.upcase} - \#{message}" + end + EOM + end + + attr_reader :line + attr_reader :program_name + + def open(program_name) + @program_name = program_name + end + + def reset + @line = '' + end + +end + +Logger::Syslog.const_set :SYSLOG, MockSyslog + +class TestLogger < Test::Unit::TestCase + + LEVEL_LABEL_MAP = { + Logger::DEBUG => 'DEBUG', + Logger::INFO => 'INFO', + Logger::WARN => 'WARN', + Logger::ERROR => 'ERROR', + Logger::FATAL => 'FATAL', + Logger::UNKNOWN => 'ANY', + } + + def setup + @logger = Logger.new(nil) + end + + class Log + attr_reader :line, :label, :datetime, :pid, :severity, :progname, :msg + def initialize(line) + @line = line + /\A(\w+), \[([^#]*)#(\d+)\]\s+(\w+) -- (\w*): ([\x0-\xff]*)/ =~ @line + @label, @datetime, @pid, @severity, @progname, @msg = $1, $2, $3, $4, $5, $6 + end + end + + def log_add(severity, msg, progname = nil, &block) + log(:add, severity, msg, progname, &block) + end + + def log(msg_id, *arg, &block) + Log.new(log_raw(msg_id, *arg, &block)) + end + + def log_raw(msg_id, *arg, &block) + logdev = Tempfile.new(File.basename(__FILE__) + '.log') + @logger.instance_eval { @logdev = Logger::LogDevice.new(logdev) } + assert_equal true, @logger.__send__(msg_id, *arg, &block) + logdev.open + msg = logdev.read + logdev.close + msg + end + + def test_initialize + assert_equal Logger::DEBUG, @logger.level + end + + def test_add + msg = log_add nil, 'unknown level message' # nil == unknown + assert_equal LEVEL_LABEL_MAP[Logger::UNKNOWN], msg.severity + + msg = log_add Logger::FATAL, 'fatal level message' + assert_equal LEVEL_LABEL_MAP[Logger::FATAL], msg.severity + + msg = log_add Logger::ERROR, 'error level message' + assert_equal LEVEL_LABEL_MAP[Logger::ERROR], msg.severity + + msg = log_add Logger::WARN, 'warn level message' + assert_equal LEVEL_LABEL_MAP[Logger::WARN], msg.severity + + msg = log_add Logger::INFO, 'info level message' + assert_equal LEVEL_LABEL_MAP[Logger::INFO], msg.severity + + msg = log_add Logger::DEBUG, 'debug level message' + assert_equal LEVEL_LABEL_MAP[Logger::DEBUG], msg.severity + end + + def test_add_level_unknown + @logger.level = Logger::UNKNOWN + + msg = log_add nil, 'unknown level message' # nil == unknown + assert_equal LEVEL_LABEL_MAP[Logger::UNKNOWN], msg.severity + + msg = log_add Logger::FATAL, 'fatal level message' + assert_equal '', msg.line + + msg = log_add Logger::ERROR, 'error level message' + assert_equal '', msg.line + + msg = log_add Logger::WARN, 'warn level message' + assert_equal '', msg.line + + msg = log_add Logger::INFO, 'info level message' + assert_equal '', msg.line + + msg = log_add Logger::DEBUG, 'debug level message' + assert_equal '', msg.line + end + + def test_add_level_fatal + @logger.level = Logger::FATAL + + msg = log_add nil, 'unknown level message' # nil == unknown + assert_equal LEVEL_LABEL_MAP[Logger::UNKNOWN], msg.severity + + msg = log_add Logger::FATAL, 'fatal level message' + assert_equal LEVEL_LABEL_MAP[Logger::FATAL], msg.severity + + msg = log_add Logger::ERROR, 'error level message' + assert_equal '', msg.line + + msg = log_add Logger::WARN, 'warn level message' + assert_equal '', msg.line + + msg = log_add Logger::INFO, 'info level message' + assert_equal '', msg.line + + msg = log_add Logger::DEBUG, 'debug level message' + assert_equal '', msg.line + end + + def test_add_level_error + @logger.level = Logger::ERROR + + msg = log_add nil, 'unknown level message' # nil == unknown + assert_equal LEVEL_LABEL_MAP[Logger::UNKNOWN], msg.severity + + msg = log_add Logger::FATAL, 'fatal level message' + assert_equal LEVEL_LABEL_MAP[Logger::FATAL], msg.severity + + msg = log_add Logger::ERROR, 'error level message' + assert_equal LEVEL_LABEL_MAP[Logger::ERROR], msg.severity + + msg = log_add Logger::WARN, 'warn level message' + assert_equal '', msg.line + + msg = log_add Logger::INFO, 'info level message' + assert_equal '', msg.line + + msg = log_add Logger::DEBUG, 'debug level message' + assert_equal '', msg.line + end + + def test_add_level_warn + @logger.level = Logger::WARN + + msg = log_add nil, 'unknown level message' # nil == unknown + assert_equal LEVEL_LABEL_MAP[Logger::UNKNOWN], msg.severity + + msg = log_add Logger::FATAL, 'fatal level message' + assert_equal LEVEL_LABEL_MAP[Logger::FATAL], msg.severity + + msg = log_add Logger::ERROR, 'error level message' + assert_equal LEVEL_LABEL_MAP[Logger::ERROR], msg.severity + + msg = log_add Logger::WARN, 'warn level message' + assert_equal LEVEL_LABEL_MAP[Logger::WARN], msg.severity + + msg = log_add Logger::INFO, 'info level message' + assert_equal '', msg.line + + msg = log_add Logger::DEBUG, 'debug level message' + assert_equal '', msg.line + end + + def test_add_level_info + @logger.level = Logger::INFO + + msg = log_add nil, 'unknown level message' # nil == unknown + assert_equal LEVEL_LABEL_MAP[Logger::UNKNOWN], msg.severity + + msg = log_add Logger::FATAL, 'fatal level message' + assert_equal LEVEL_LABEL_MAP[Logger::FATAL], msg.severity + + msg = log_add Logger::ERROR, 'error level message' + assert_equal LEVEL_LABEL_MAP[Logger::ERROR], msg.severity + + msg = log_add Logger::WARN, 'warn level message' + assert_equal LEVEL_LABEL_MAP[Logger::WARN], msg.severity + + msg = log_add Logger::INFO, 'info level message' + assert_equal LEVEL_LABEL_MAP[Logger::INFO], msg.severity + + msg = log_add Logger::DEBUG, 'debug level message' + assert_equal '', msg.line + end + + def test_add_level_debug + @logger.level = Logger::DEBUG + + msg = log_add nil, 'unknown level message' # nil == unknown + assert_equal LEVEL_LABEL_MAP[Logger::UNKNOWN], msg.severity + + msg = log_add Logger::FATAL, 'fatal level message' + assert_equal LEVEL_LABEL_MAP[Logger::FATAL], msg.severity + + msg = log_add Logger::ERROR, 'error level message' + assert_equal LEVEL_LABEL_MAP[Logger::ERROR], msg.severity + + msg = log_add Logger::WARN, 'warn level message' + assert_equal LEVEL_LABEL_MAP[Logger::WARN], msg.severity + + msg = log_add Logger::INFO, 'info level message' + assert_equal LEVEL_LABEL_MAP[Logger::INFO], msg.severity + + msg = log_add Logger::DEBUG, 'debug level message' + assert_equal LEVEL_LABEL_MAP[Logger::DEBUG], msg.severity + end + + def test_unknown + msg = log :unknown, 'unknown level message' + assert_equal LEVEL_LABEL_MAP[Logger::UNKNOWN], msg.severity + + @logger.level = Logger::UNKNOWN + msg = log :unknown, 'unknown level message' + assert_equal LEVEL_LABEL_MAP[Logger::UNKNOWN], msg.severity + + @logger.level = Logger::FATAL + msg = log :unknown, 'unknown level message' + assert_equal LEVEL_LABEL_MAP[Logger::UNKNOWN], msg.severity + + @logger.level = Logger::ERROR + msg = log :unknown, 'unknown level message' + assert_equal LEVEL_LABEL_MAP[Logger::UNKNOWN], msg.severity + + @logger.level = Logger::WARN + msg = log :unknown, 'unknown level message' + assert_equal LEVEL_LABEL_MAP[Logger::UNKNOWN], msg.severity + + @logger.level = Logger::INFO + msg = log :unknown, 'unknown level message' + assert_equal LEVEL_LABEL_MAP[Logger::UNKNOWN], msg.severity + + @logger.level = Logger::DEBUG + msg = log :unknown, 'unknown level message' + assert_equal LEVEL_LABEL_MAP[Logger::UNKNOWN], msg.severity + end + + # def test_unknown_eh + # @logger.level = Logger::UNKNOWN + # assert_equal true, @logger.unknown? + # + # @logger.level = Logger::UNKNOWN + 1 + # assert_equal false, @logger.unknown? + # end + + def test_fatal + msg = log :fatal, 'fatal level message' + assert_equal LEVEL_LABEL_MAP[Logger::FATAL], msg.severity + + @logger.level = Logger::UNKNOWN + msg = log :fatal, 'fatal level message' + assert_equal '', msg.line + + @logger.level = Logger::FATAL + msg = log :fatal, 'fatal level message' + assert_equal LEVEL_LABEL_MAP[Logger::FATAL], msg.severity + + @logger.level = Logger::ERROR + msg = log :fatal, 'fatal level message' + assert_equal LEVEL_LABEL_MAP[Logger::FATAL], msg.severity + + @logger.level = Logger::WARN + msg = log :fatal, 'fatal level message' + assert_equal LEVEL_LABEL_MAP[Logger::FATAL], msg.severity + + @logger.level = Logger::INFO + msg = log :fatal, 'fatal level message' + assert_equal LEVEL_LABEL_MAP[Logger::FATAL], msg.severity + + @logger.level = Logger::DEBUG + msg = log :fatal, 'fatal level message' + assert_equal LEVEL_LABEL_MAP[Logger::FATAL], msg.severity + end + + def test_fatal_eh + @logger.level = Logger::FATAL + assert_equal true, @logger.fatal? + + @logger.level = Logger::UNKNOWN + assert_equal false, @logger.fatal? + end + + def test_error + msg = log :error, 'error level message' + assert_equal LEVEL_LABEL_MAP[Logger::ERROR], msg.severity + + @logger.level = Logger::UNKNOWN + msg = log :error, 'error level message' + assert_equal '', msg.line + + @logger.level = Logger::FATAL + msg = log :error, 'error level message' + assert_equal '', msg.line + + @logger.level = Logger::ERROR + msg = log :error, 'error level message' + assert_equal LEVEL_LABEL_MAP[Logger::ERROR], msg.severity + + @logger.level = Logger::WARN + msg = log :error, 'error level message' + assert_equal LEVEL_LABEL_MAP[Logger::ERROR], msg.severity + + @logger.level = Logger::INFO + msg = log :error, 'error level message' + assert_equal LEVEL_LABEL_MAP[Logger::ERROR], msg.severity + + @logger.level = Logger::DEBUG + msg = log :error, 'error level message' + assert_equal LEVEL_LABEL_MAP[Logger::ERROR], msg.severity + end + + def test_error_eh + @logger.level = Logger::ERROR + assert_equal true, @logger.error? + + @logger.level = Logger::FATAL + assert_equal false, @logger.error? + end + + def test_warn + msg = log :warn, 'warn level message' + assert_equal LEVEL_LABEL_MAP[Logger::WARN], msg.severity + + @logger.level = Logger::UNKNOWN + msg = log :warn, 'warn level message' + assert_equal '', msg.line + + @logger.level = Logger::FATAL + msg = log :warn, 'warn level message' + assert_equal '', msg.line + + @logger.level = Logger::ERROR + msg = log :warn, 'warn level message' + assert_equal '', msg.line + + @logger.level = Logger::WARN + msg = log :warn, 'warn level message' + assert_equal LEVEL_LABEL_MAP[Logger::WARN], msg.severity + + @logger.level = Logger::INFO + msg = log :warn, 'warn level message' + assert_equal LEVEL_LABEL_MAP[Logger::WARN], msg.severity + + @logger.level = Logger::DEBUG + msg = log :warn, 'warn level message' + assert_equal LEVEL_LABEL_MAP[Logger::WARN], msg.severity + end + + def test_warn_eh + @logger.level = Logger::WARN + assert_equal true, @logger.warn? + + @logger.level = Logger::ERROR + assert_equal false, @logger.warn? + end + + def test_info + msg = log :info, 'info level message' + assert_equal LEVEL_LABEL_MAP[Logger::INFO], msg.severity + + @logger.level = Logger::UNKNOWN + msg = log :info, 'info level message' + assert_equal '', msg.line + + @logger.level = Logger::FATAL + msg = log :info, 'info level message' + assert_equal '', msg.line + + @logger.level = Logger::ERROR + msg = log :info, 'info level message' + assert_equal '', msg.line + + @logger.level = Logger::WARN + msg = log :info, 'info level message' + assert_equal '', msg.line + + @logger.level = Logger::INFO + msg = log :info, 'info level message' + assert_equal LEVEL_LABEL_MAP[Logger::INFO], msg.severity + + @logger.level = Logger::DEBUG + msg = log :info, 'info level message' + assert_equal LEVEL_LABEL_MAP[Logger::INFO], msg.severity + end + + def test_info_eh + @logger.level = Logger::INFO + assert_equal true, @logger.info? + + @logger.level = Logger::WARN + assert_equal false, @logger.info? + end + + def test_debug + msg = log :debug, 'debug level message' + assert_equal LEVEL_LABEL_MAP[Logger::DEBUG], msg.severity + + @logger.level = Logger::UNKNOWN + msg = log :debug, 'debug level message' + assert_equal '', msg.line + + @logger.level = Logger::FATAL + msg = log :debug, 'debug level message' + assert_equal '', msg.line + + @logger.level = Logger::ERROR + msg = log :debug, 'debug level message' + assert_equal '', msg.line + + @logger.level = Logger::WARN + msg = log :debug, 'debug level message' + assert_equal '', msg.line + + @logger.level = Logger::INFO + msg = log :debug, 'debug level message' + assert_equal '', msg.line + + @logger.level = Logger::DEBUG + msg = log :debug, 'debug level message' + assert_equal LEVEL_LABEL_MAP[Logger::DEBUG], msg.severity + end + + def test_debug_eh + @logger.level = Logger::DEBUG + assert_equal true, @logger.debug? + + @logger.level = Logger::INFO + assert_equal false, @logger.debug? + end + +end + +class TestSyslogLogger < TestLogger + + def setup + super + @logger = Logger::Syslog.new + end + + class Log + attr_reader :line, :label, :datetime, :pid, :severity, :progname, :msg + def initialize(line) + @line = line + return unless /\A(\w+) - (.*)\Z/ =~ @line + severity, @msg = $1, $2 + severity = Logger::Syslog::LOGGER_MAP.invert[severity.downcase.intern] + @severity = severity.to_s.upcase + @severity = 'ANY' if @severity == 'UNKNOWN' + end + end + + def log_add(severity, msg, progname = nil, &block) + log(:add, severity, msg, progname, &block) + end + + def log(msg_id, *arg, &block) + Log.new(log_raw(msg_id, *arg, &block)) + end + + def log_raw(msg_id, *arg, &block) + assert_equal true, @logger.__send__(msg_id, *arg, &block) + msg = MockSyslog.line + MockSyslog.reset + return msg + end + +end + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/.gitignore b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/.gitignore new file mode 100644 index 000000000..293399776 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/.gitignore @@ -0,0 +1,20 @@ +*.gem +*.rbc +.bundle +.config +.yardoc +Gemfile.lock +InstalledFiles +_yardoc +coverage +doc/ +lib/bundler/man +pkg +rdoc +spec/reports +test/tmp +test/version_tmp +tmp +html +gems +vendor diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/.simplecov b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/.simplecov new file mode 100644 index 000000000..666f1c2d0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/.simplecov @@ -0,0 +1,8 @@ +require 'coveralls' +Coveralls.wear! +SimpleCov.formatter = SimpleCov::Formatter::MultiFormatter[ + SimpleCov::Formatter::HTMLFormatter, + Coveralls::SimpleCov::Formatter +] +SimpleCov.command_name 'bacon' +SimpleCov.start {add_filter 'test'} diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/.travis.yml b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/.travis.yml new file mode 100644 index 000000000..23e1a15f3 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/.travis.yml @@ -0,0 +1,8 @@ +language: ruby +rvm: + - "1.9.2" + - "1.9.3" + - "2.0.0" + - jruby-19mode # JRuby in 1.9 mode + - rbx-19mode +script: rake test diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/Gemfile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/Gemfile new file mode 100644 index 000000000..ffe243345 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/Gemfile @@ -0,0 +1,7 @@ +source 'https://rubygems.org' + +# Specify your gem's dependencies in forwardablex.gemspec +gemspec + +gem 'simplecov', :require => false, :group => :test +gem 'coveralls', :require => false, :group => :test diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/LICENSE.txt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/LICENSE.txt new file mode 100644 index 000000000..74bf5ff05 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2013 Keita Yamaguchi + +MIT License + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. \ No newline at end of file diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/README.md b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/README.md new file mode 100644 index 000000000..30e0ed653 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/README.md @@ -0,0 +1,91 @@ +# Temppath + +Temppath is a Ruby library for generating temporary file path. The differences +from standard tempfile.rb are that this library generates Pathname objects with +no files and filenames are based on UUID. Files in paths generated by this are +deleted when Ruby exits. + +[![Gem Version](https://badge.fury.io/rb/temppath.png)](http://badge.fury.io/rb/temppath) [![Build Status](https://travis-ci.org/keita/temppath.png?branch=master)](https://travis-ci.org/keita/temppath) [![Coverage Status](https://coveralls.io/repos/keita/temppath/badge.png?branch=master)](https://coveralls.io/r/keita/temppath) [![Code Climate](https://codeclimate.com/github/keita/temppath.png)](https://codeclimate.com/github/keita/temppath) + +## Features + +* You can generate a path without file. +* Temppath can generate files and directories as well. Therefore you are free + from confusion which is correct tmpfile/tempfile or tmpdir/tempdir. +* Generated paths are `Pathname` objects. + +## Installation + + $ gem install temppath + +## Usage + +#### Create a path + +```ruby +path = Temppath.create +#=> # +path.exist? #=> false +path.open("w") +"%o" % path.stat.mode #=> "100600" (default permission 0600) +``` + +#### Create a directory + +```ruby +path = Temppath.mkdir +path.exist? #=> true +path.directory? #=> true +"%o" % path.stat.mode #=> "40700" +``` + +#### Create an empty file + +```ruby +path = Temppath.touch +path.exist? #=> true +path.file? #=> true +"%o" % path.stat.mode #=> "100600" +``` + +#### Use temporary path generator + +You can use `Temppath::Generator` when you want to use multiple base +directory. Generated paths have same natures as paths from `Tempath.create`, +`mkdir`, and `touch`. + +```ruby +# make a generator +temppath = Temppath::Generator.new("/tmp/other-dir") + +path = temppath.create +path.exist? #=> false +path.open("w") +"%o" % path.stat.mode #=> "100600" + +path = temppath.mkdir +path.exist? #=> true +path.directory? #=> true +"%o" % path.stat.mode #=> "40700" + +path = temppath.touch +path.exist? #=> true +path.file? #=> true +"%o" % path.stat.mode #=> "100600" +``` + +## Documentation + +- [API Documentation](http://www.rubydoc.info/gems/temppath/) + +## License + +Temppath is free software distributed under MIT license. + +## Contributing + +1. Fork it +2. Create your feature branch (`git checkout -b my-new-feature`) +3. Commit your changes (`git commit -am 'Add some feature'`) +4. Push to the branch (`git push origin my-new-feature`) +5. Create new Pull Request diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/Rakefile new file mode 100644 index 000000000..4aabcb2d5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/Rakefile @@ -0,0 +1,16 @@ +require "bundler/gem_tasks" + +desc 'Test specs' +task 'test' do + sh "bundle exec bacon -a -rsimplecov" +end + +desc 'Generate API document' +task 'html' do + sh "bundle exec yard doc -o html --hide-void-return --no-api" +end + +desc 'Show undocumented function list' +task 'html:undoc' do + sh "bundle exec yard stats --list-undoc --no-api --compact" +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/lib/temppath.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/lib/temppath.rb new file mode 100644 index 000000000..46773e39e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/lib/temppath.rb @@ -0,0 +1,308 @@ +require 'temppath/version' +require 'uuidtools' +require 'pathname' +require 'tmpdir' +require 'fileutils' + +# Temppath creates temporary path. The differences from standard tempfile.rb are +# that this library generates Pathname objects with no files and filenames are +# based on UUID. Files in paths generated by this are deleted when Ruby exits. +# +# @example Create a temporary path +# path = Temppath.create +# #=> # +# path.exist? #=> false +# path.open("w") +# "%o" % path.stat.mode #=> "100600" (default permission 0600) +# @example Touch a temporary file +# path = Temppath.touch +# path.exist? #=> true +# path.file? #=> true +# "%o" % path.stat.mode #=> "100600" +# @example Create a temporary directory +# path = Temppath.mkdir +# path.exist? #=> true +# path.directory? #=> true +# "%o" % path.stat.mode #=> "40700" +# @example Use temporary path generator +# temppath = Temppath::Generator.new("/tmp/other-dir") +# temppath.create +# temppath.mkdir +# temppath.touch +module Temppath + # OriginalMethodHolder keeps some original methods of Pathname. + module OriginalMethodHolder + # @api private + def self.extended(obj) + # keep original methods + obj.instance_exec do + class << self + alias :orig_open :open + alias :orig_mkdir :mkdir + alias :orig_mkpath :mkpath + alias :orig_sysopen :sysopen + end + end + end + end + + # SecurePermissionMethods provides some Pathname methods with secure default + # permission. + module SecurePermissionMethods + # Open file with permission 0600 by default. Otherwise, this is same as + # Pathname#open. + def open(*args, &b) + args[1] = 0600 unless args[1] + orig_open(*args, &b) + end + + # Make a directory with permission 0700 by defautl. Otherwise, this is same + # as Pathname#mkdir. + def mkdir(*args) + args[0] = 0700 unless args[0] + orig_mkdir(*args) + end + + # Make paths with permission 0700 by defautl. Otherwise, this is same as + # Pathname#mkpath. + def mkpath(*args) + args[0] = {} unless args[0] + args[0] = args[0].merge(mode: 0700) unless args[0][:mode] + FileUtils.mkpath(self.to_s, *args) + end + + # Open file with permission 0600 by default. Otherwise, this is same as + # Pathname#sysopen. + def sysopen(*args) + args[1] = 0600 unless args[1] + orig_sysopen(*args) + end + end + + # Generator generates temporary path in the base directory. + class Generator + # @return [Pathname] + # defalut base directory for paths created by Temppath + attr_reader :basedir + + # @return [String] + # defalut base name + attr_accessor :basename + + # @return [Boolean] + # true if unlink mode is enabled + attr_accessor :unlink + + # @param basedir [Pathname] + # generator's base directory + # @param option [Hash] + # @option option [String] :basename + # prefix of filename + def initialize(basedir, option={}) + @basedir = Pathname.new(basedir) + @basename = (option[:basename] || "").to_s + @unlink = true + + # extend basedir with secure methods + @basedir.extend OriginalMethodHolder + @basedir.extend SecurePermissionMethods + + # register a cleaner for temporary directory + Kernel.at_exit do + if @unlink + remove_basedir rescue Errno::ENOENT + end + end + end + + # Create a temporary path. This method creates no files. + # + # @param option [Hash] + # @option option [String] :basename + # prefix of filename + # @option option [Pathname] :basedir + # pathname of base directory + def create(option={}) + _basename = option[:basename] || @basename + _basedir = @basedir + if option[:basedir] + _basedir = Pathname.new(option[:basedir]) + + # extend basedir with secure methods + _basedir.extend OriginalMethodHolder + _basedir.extend SecurePermissionMethods + end + + # init basedir + unless _basedir.exist? + _basedir.mkpath + end + + # make a path + path = Pathname.new(_basedir) + (_basename.to_s + generate_uuid) + + # extend path object with secure methods + path.extend OriginalMethodHolder + path.extend SecurePermissionMethods + + # register a file cleaner if the path is not in basedir + if _basedir != @basedir + Kernel.at_exit do + if @unlink + FileUtils.remove_entry_secure(path) rescue Errno::ENOENT + end + end + end + + return path + end + + # Create a temporary directory. + # + # @param option [Hash] + # @option option [Integer] :mode + # mode for the directory permission + # @option option [String] :basename + # prefix of directory name + # @option option [Pathname] :basedir + # pathname of base directory + def mkdir(option={}) + mode = option[:mode] || 0700 + path = create(option) + path.mkdir(mode) + return path + end + + # Create a empty file. + # + # @param option [Hash] + # @option option [Integer] :mode + # mode for the file permission + # @option option [String] :basename + # prefix of filename + # @option option [Pathname] :basedir + # pathname of base directory + def touch(option={}) + mode = option[:mode] || 0600 + path = create(option) + path.open("w", mode) + return path + end + + # Remove current temporary directory. + # + # @return [void] + def remove_basedir + FileUtils.remove_entry_secure(@basedir) if @basedir.exist? + end + + private + + # Generate random UUID for filename of temporary path. + # + # @return [String] + # UUID string + def generate_uuid + UUIDTools::UUID.random_create.to_s + end + end + + class << self + # Create a new base directory. + # + # @return [Pathname] + # base directory + def create_basedir + Pathname.new(Dir.mktmpdir("ruby-temppath-")) + end + private :create_basedir + end + + # default generator + @generator = Generator.new(create_basedir) + + class << self + # Return base directory of paths created by Temppath. + # + # @return [Pathname] + # base directory + def basedir + @generator.basedir + end + + # Return base name of paths created by Temppath. + def basename + @generator.basename + end + + # Set the base name. + def basename=(name) + @generator.basename = name + end + + # Return true if unlink mode is enabled. + # + # @return [Boolean] + # true if unlink mode is enabled + def unlink + @generator.unlink + end + + # Set true or false for unlink mode. + # + # @param b [Boolean] + # unlink mode + def unlink=(b) + @generator.unlink = b + end + + # Create a temporary path. This method creates no files. + # + # @param option [Hash] + # @option option [String] :basename + # prefix of filename + # @option option [Pathname] :basedir + # pathname of base directory + def create(option={}) + @generator.create(option) + end + + # Create a temporary directory. + # + # @param option [Hash] + # @option option [Integer] :mode + # mode for the directory permission + # @option option [String] :basename + # prefix of directory name + # @option option [Pathname] :basedir + # pathname of base directory + def mkdir(option={}) + @generator.mkdir(option) + end + + # Create a empty file. + def touch(option={}) + @generator.touch(option) + end + + # Remove current base directory and change to use a new base directory. + # + # @param basedir [Pathname] + # new base directory, or nil + # @return [Pathname] + # new base directory + def update_basedir(basedir=nil) + @generator.remove_basedir + _basedir = basedir || create_basedir + @generator = Generator.new(_basedir) + return _basedir + end + + # Remove current temporary directory. + # + # @return [void] + def remove_basedir + @generator.remove_basedir + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/lib/temppath/version.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/lib/temppath/version.rb new file mode 100644 index 000000000..adf7c4bea --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/lib/temppath/version.rb @@ -0,0 +1,4 @@ +module Temppath + # version of temppath gem + VERSION = "0.3.1" +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/temppath.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/temppath.gemspec new file mode 100644 index 000000000..91e8da847 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/temppath.gemspec @@ -0,0 +1,26 @@ +# -*- ruby -*- +# -*- encoding: utf-8 -*- +lib = File.expand_path('../lib', __FILE__) +$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib) +require 'temppath/version' + +Gem::Specification.new do |gem| + gem.name = "temppath" + gem.version = Temppath::VERSION + gem.authors = ["Keita Yamaguchi"] + gem.email = ["keita.yamaguchi@gmail.com"] + gem.description = "temppath provides the method to create temporary path" + gem.summary = "temppath provides the method to create temporary path" + gem.homepage = "https://github.com/keita/temppath" + + gem.files = `git ls-files`.split($/) + gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) } + gem.test_files = gem.files.grep(%r{^(test|spec|features)/}) + gem.require_paths = ["lib"] + + gem.add_dependency "uuidtools" + gem.add_development_dependency "bacon" + gem.add_development_dependency "yard" + gem.add_development_dependency "redcarpet" unless RUBY_PLATFORM == 'java' + gem.add_development_dependency "rake" +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/test/spec_temppath.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/test/spec_temppath.rb new file mode 100644 index 000000000..99409d077 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/temppath-0.3.1/test/spec_temppath.rb @@ -0,0 +1,209 @@ +require 'temppath' + +describe Temppath do + before do + Temppath.update_basedir + end + + it 'should get temporary path' do + Temppath.create.should.kind_of Pathname + Temppath.create.should != Temppath.create + end + + it 'should get temporary path with basename' do + Temppath.create(basename: "A_").basename.to_s[0,2].should == "A_" + end + + it 'should get base directory path with basedir' do + dir = Dir.mktmpdir + Temppath.create(basedir: dir).dirname.should == Pathname.new(dir) + end + + it 'should be in the base directory' do + Temppath.create.dirname.should == Temppath.basedir + end + + it 'should update current base directory' do + old_dir = Temppath.basedir + new_dir = Temppath.update_basedir + old_dir.should != new_dir + old_dir.should.not.exist + new_dir.should.exist + end + + it 'should update current base directory to specific directory' do + old_dir = Temppath.basedir + new_dir = Pathname.new(Dir.mktmpdir("ruby-temppath-test")) + _new_dir = Temppath.update_basedir(new_dir) + old_dir.should != _new_dir + old_dir.should.not.exist + _new_dir.should.exist + _new_dir.should == new_dir + end + + it 'should remove current base directory' do + dir = Temppath.basedir + Temppath.remove_basedir + dir.should.not.exist + end + + it 'should get basename' do + Temppath.basename.should == "" + end + + it 'should set basename' do + Temppath.basename = "test_" + Temppath.basename.should == "test_" + Temppath.create.basename.to_s.should.start_with "test_" + Temppath.basename = "" + Temppath.create.basename.to_s.should.not.start_with "test_" + end + + it 'should get unlink mode' do + Temppath.unlink.should == true + end + + it 'should set unlink mode' do + Temppath.unlink = false + Temppath.unlink.should == false + Temppath.unlink = true + end + + it 'should create a file with permission 0600 by default' do + path = Temppath.create + path.open("w") + ("%o" % path.stat.mode).should == "100600" + end + + it 'should create a file with permission 0644 explicitly' do + path = Temppath.create + path.open("w", 0644) + ("%o" % path.stat.mode).should == "100644" + end + + it 'should create a directory with permission 0700 by default' do + path = Temppath.create + path.mkdir + ("%o" % path.stat.mode).should == "40700" + end + + it 'should create a directory with permission 0755 explicitly' do + path = Temppath.create + path.mkdir(0755) + ("%o" % path.stat.mode).should == "40755" + end + + it 'should do mkpath with permission 0700 by default' do + path = Temppath.create + path.mkpath + ("%o" % path.stat.mode).should == "40700" + end + + it 'should do mkpath with permission 0755 explicitly' do + path = Temppath.create + path.mkpath(mode: 0755) + ("%o" % path.stat.mode).should == "40755" + end + + it 'should do sysopen with permission 0600 by default' do + path = Temppath.create + path.sysopen("w") + ("%o" % path.stat.mode).should == "100600" + end + + it 'should do sysopen with permission 0644 explicitly' do + path = Temppath.create + path.sysopen("w", 0644) + ("%o" % path.stat.mode).should == "100644" + end + + it 'should make a directory' do + path = Temppath.mkdir + path.should.directory + ("%o" % path.stat.mode).should == "40700" + end + + it 'should touch a file' do + path = Temppath.touch + path.should.file + ("%o" % path.stat.mode).should == "100600" + end +end + +describe Temppath::Generator do + before do + Temppath.update_basedir + @dir = Dir.mktmpdir("ruby-temppath-generator-test") + @generator = Temppath::Generator.new(@dir, basename: "test_") + end + + it "should generate a path" do + path = @generator.create + path.should.kind_of Pathname + path.dirname.to_s.should == @dir + path.should.not.exist + end + + it "should make a directory" do + path = @generator.mkdir + path.should.kind_of Pathname + path.dirname.to_s.should == @dir + path.should.exist + path.should.directory + end + + it "should make a file" do + path = @generator.touch + path.should.kind_of Pathname + path.dirname.to_s.should == @dir + path.should.exist + path.should.file + end + + it "should have own base directory" do + Temppath.basedir.should != @generator.basedir + + dir = Pathname.new(Dir.mktmpdir("ruby-temppath-generator-test")) + generator = Temppath::Generator.new(dir) + generator.basedir.should != @generator.basedir + end + + it "should make base directory with #create if it doesn't exist" do + dir = Pathname.new(Dir.mktmpdir("ruby-temppath-generator-test")) + generator = Temppath::Generator.new(dir + "create") + generator.basedir.should.not.exist + generator.create + generator.basedir.should.exist + end + + it "should make base directory with #mkdir if it doesn't exist" do + dir = Pathname.new(Dir.mktmpdir("ruby-temppath-generator-test")) + generator = Temppath::Generator.new(dir + "mkdir") + generator.basedir.should.not.exist + generator.create + generator.basedir.should.exist + end + + it "should make base directory with #touch if it doesn't exist" do + dir = Pathname.new(Dir.mktmpdir("ruby-temppath-generator-test")) + generator = Temppath::Generator.new(dir + "touch") + generator.basedir.should.not.exist + generator.create + generator.basedir.should.exist + end + + it "should make base directory and parents" do + dir = Pathname.new(Dir.mktmpdir("ruby-temppath-generator-test")) + generator = Temppath::Generator.new(dir + "a" + "b" + "c") + generator.basedir.should.not.exist + path = generator.create + generator.basedir.should.exist + ("%o" % (dir + "a").stat.mode).should == "40700" + ("%o" % (dir + "a" + "b").stat.mode).should == "40700" + ("%o" % (dir + "a" + "b" + "c").stat.mode).should == "40700" + end + + it "should make path with generator's basename" do + @generator.create.basename.to_s.should.start_with "test_" + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/CHANGELOG b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/CHANGELOG new file mode 100644 index 000000000..f0c27f5be --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/CHANGELOG @@ -0,0 +1,67 @@ +== UUIDTools 2.1.5 + * fixed issue with ip command vs ifconfig + * dumped RubyForge related cruft + * updated to modern RSpec syntax +== UUIDTools 2.1.4 + * various OS-specific improvements to obtaining MAC address +== UUIDTools 2.1.3 + * changes to build system +== UUIDTools 2.1.2 + * fixed issue with frozen objects + * fixed issue with running specs in Ruby 1.9.2 +== UUIDTools 2.1.1 + * fixed issue with Ruby 1.9 compatibility +== UUIDTools 2.1.0 + * completely reworked the MAC address detection code + * added additional parsing methods +== UUIDTools 2.0.0 + * moved to its own module to avoid collisions +== UUIDTools 1.0.7 + * fixed incompatible SecureRandom implementation +== UUIDTools 1.0.6 + * fixed Bignum hash issue + * added implicit to_str cast +== UUIDTools 1.0.5 + * improved specs + * fixed minor bugs + * better JRuby compatibility + * uses securerandom library + * updated rake tasks +== UUIDTools 1.0.4 + * calculates random node id with multicast bit if there is no MAC address + * uses RSpec instead of Test::Unit + * works in Ruby 1.9 + * cleaned up some code + * removed deprecated methods + * changed version constant + * new gem file structure +== UUIDTools 1.0.3 + * improved code for obtaining a MAC address within JRuby +== UUIDTools 1.0.2 + * improved code for obtaining a MAC address for Solaris and OpenBSD + * added hash and eql? methods +== UUIDTools 1.0.1 + * improved code for obtaining a MAC address for Solaris and NetBSD + * MAC addresses can now be set manually + * replaced random number generator, less effective on Windows, but faster + * fixed inheritance issues + * changed UUID#to_uri method to return a string instead of a URI object + * removed UUID#to_uri_string +== UUIDTools 1.0.0 + * slight improvements to the random number generator + * fixed issue with failing to obtain mac address in certain environments +== UUIDTools 0.1.4 + * improved speed when generating timestamp-based uuids + * fixed bug with rapid generation of timestamp uuids leading to duplicates + * improved code for detection of mac address +== UUIDTools 0.1.3 + * fixed issue with UUID#raw attempting to call protected class methods +== UUIDTools 0.1.2 + * fixed variant method + * added valid? method + * changed timestamp_create method to allow creation of UUIDs from + arbitrary timestamps +== UUIDTools 0.1.1 + * changed helper methods to be protected like they should have been +== UUIDTools 0.1.0 + * parsing and generation of UUIDs implemented diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/LICENSE.txt b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/LICENSE.txt new file mode 100644 index 000000000..ef51da2b0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/LICENSE.txt @@ -0,0 +1,202 @@ + + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/README.md b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/README.md new file mode 100644 index 000000000..2d11e81af --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/README.md @@ -0,0 +1,39 @@ +# UUIDTools + +
    +
    Homepage
    sporkmonger/uuidtools
    +
    Author
    Bob Aman
    +
    Copyright
    Copyright © 2005-2014 Bob Aman
    +
    License
    Apache 2.0
    +
    + +[![Build Status](https://secure.travis-ci.org/sporkmonger/uuidtools.png)](http://travis-ci.org/sporkmonger/uuidtools) +[![Dependency Status](https://gemnasium.com/sporkmonger/uuidtools.png)](https://gemnasium.com/sporkmonger/uuidtools) +[![Gittip Donate](http://img.shields.io/gittip/sporkmonger.png)](https://www.gittip.com/sporkmonger/ "Support Open Source Development w/ Gittip") + +# Description + +UUIDTools was designed to be a simple library for generating any +of the various types of UUIDs. It conforms to RFC 4122 whenever +possible. + +# Reference + +- {UUIDTools::UUID} + +# Example usage + + require "uuidtools" + + UUIDTools::UUID.md5_create(UUIDTools::UUID_DNS_NAMESPACE, "www.widgets.com") + # => # + UUIDTools::UUID.sha1_create(UUIDTools::UUID_DNS_NAMESPACE, "www.widgets.com") + # => # + UUIDTools::UUID.timestamp_create + # => # + UUIDTools::UUID.random_create + # => # + +# Install + + $ sudo gem install uuidtools diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/Rakefile b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/Rakefile new file mode 100644 index 000000000..d4bf2b94b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/Rakefile @@ -0,0 +1,35 @@ +require 'rubygems' +require 'rake' + +require File.join(File.dirname(__FILE__), 'lib', 'uuidtools', 'version') + +PKG_DISPLAY_NAME = 'UUIDTools' +PKG_NAME = PKG_DISPLAY_NAME.downcase +PKG_VERSION = UUIDTools::VERSION::STRING +PKG_FILE_NAME = "#{PKG_NAME}-#{PKG_VERSION}" + +RELEASE_NAME = "REL #{PKG_VERSION}" + +GIT_HUB_USER = "sporkmonger" +GIT_HUB_URL = "https://github.com/#{GIT_HUB_USER}/#{PKG_NAME}" + +PKG_AUTHOR = "Bob Aman" +PKG_AUTHOR_EMAIL = "bob@sporkmonger.com" +PKG_HOMEPAGE = GIT_HUB_URL +PKG_SUMMARY = "UUID generator" +PKG_DESCRIPTION = <<-TEXT +A simple universally unique ID generation library. +TEXT + +PKG_FILES = FileList[ + "lib/**/*", "spec/**/*", "vendor/**/*", + "tasks/**/*", "website/**/*", + "[A-Z]*", "Rakefile" +].exclude(/database\.yml/).exclude(/[_\.]git$/).exclude(/Gemfile/).exclude(/Gemfile\.lock/) + +task :default => "spec" + +WINDOWS = (RUBY_PLATFORM =~ /mswin|win32|mingw|bccwin|cygwin/) rescue false +SUDO = WINDOWS ? '' : ('sudo' unless ENV['SUDOLESS']) + +Dir['tasks/**/*.rake'].each { |rake| load rake } diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/lib/compat/securerandom.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/lib/compat/securerandom.rb new file mode 100644 index 000000000..23ab23463 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/lib/compat/securerandom.rb @@ -0,0 +1,202 @@ +# = Secure random number generator interface. +# +# This library is an interface for secure random number generator which is +# suitable for generating session key in HTTP cookies, etc. +# +# It supports following secure random number generators. +# +# * openssl +# * /dev/urandom +# * Win32 +# +# == Example +# +# # random hexadecimal string. +# p SecureRandom.hex(10) #=> "52750b30ffbc7de3b362" +# p SecureRandom.hex(10) #=> "92b15d6c8dc4beb5f559" +# p SecureRandom.hex(11) #=> "6aca1b5c58e4863e6b81b8" +# p SecureRandom.hex(12) #=> "94b2fff3e7fd9b9c391a2306" +# p SecureRandom.hex(13) #=> "39b290146bea6ce975c37cfc23" +# ... +# +# # random base64 string. +# p SecureRandom.base64(10) #=> "EcmTPZwWRAozdA==" +# p SecureRandom.base64(10) #=> "9b0nsevdwNuM/w==" +# p SecureRandom.base64(10) #=> "KO1nIU+p9DKxGg==" +# p SecureRandom.base64(11) #=> "l7XEiFja+8EKEtY=" +# p SecureRandom.base64(12) #=> "7kJSM/MzBJI+75j8" +# p SecureRandom.base64(13) #=> "vKLJ0tXBHqQOuIcSIg==" +# ... +# +# # random binary string. +# p SecureRandom.random_bytes(10) #=> "\016\t{\370g\310pbr\301" +# p SecureRandom.random_bytes(10) #=> "\323U\030TO\234\357\020\a\337" +# ... + +if !defined?(SecureRandom) + begin + require 'openssl' + rescue LoadError + end + + module SecureRandom + # SecureRandom.random_bytes generates a random binary string. + # + # The argument n specifies the length of the result string. + # + # If n is not specified, 16 is assumed. + # It may be larger in future. + # + # If secure random number generator is not available, + # NotImplementedError is raised. + def self.random_bytes(n=nil) + n ||= 16 + + if defined? OpenSSL::Random + return OpenSSL::Random.random_bytes(n) + end + + if !defined?(@has_urandom) || @has_urandom + flags = File::RDONLY + flags |= File::NONBLOCK if defined? File::NONBLOCK + flags |= File::NOCTTY if defined? File::NOCTTY + flags |= File::NOFOLLOW if defined? File::NOFOLLOW + begin + File.open("/dev/urandom", flags) {|f| + unless f.stat.chardev? + raise Errno::ENOENT + end + @has_urandom = true + ret = f.readpartial(n) + if ret.length != n + raise NotImplementedError, + "Unexpected partial read from random device" + end + return ret + } + rescue Errno::ENOENT + @has_urandom = false + end + end + + if !defined?(@has_win32) + begin + require 'Win32API' + + crypt_acquire_context = Win32API.new( + "advapi32", "CryptAcquireContext", 'PPPII', 'L' + ) + @crypt_gen_random = Win32API.new( + "advapi32", "CryptGenRandom", 'LIP', 'L' + ) + + hProvStr = " " * 4 + prov_rsa_full = 1 + crypt_verifycontext = 0xF0000000 + + if crypt_acquire_context.call( + hProvStr, nil, nil, prov_rsa_full, crypt_verifycontext) == 0 + raise SystemCallError, + "CryptAcquireContext failed: #{lastWin32ErrorMessage}" + end + @hProv, = hProvStr.unpack('L') + + @has_win32 = true + rescue LoadError + @has_win32 = false + end + end + if @has_win32 + bytes = " " * n + if @crypt_gen_random.call(@hProv, bytes.size, bytes) == 0 + raise SystemCallError, + "CryptGenRandom failed: #{lastWin32ErrorMessage}" + end + return bytes + end + + raise NotImplementedError, "No random device" + end + + # SecureRandom.hex generates a random hex string. + # + # The argument n specifies the length of the random length. + # The length of the result string is twice of n. + # + # If n is not specified, 16 is assumed. + # It may be larger in future. + # + # If secure random number generator is not available, + # NotImplementedError is raised. + def self.hex(n=nil) + random_bytes(n).unpack("H*")[0] + end + + # SecureRandom.base64 generates a random base64 string. + # + # The argument n specifies the length of the random length. + # The length of the result string is about 4/3 of n. + # + # If n is not specified, 16 is assumed. + # It may be larger in future. + # + # If secure random number generator is not available, + # NotImplementedError is raised. + def self.base64(n=nil) + [random_bytes(n)].pack("m*").delete("\n") + end + + # SecureRandom.random_number generates a random number. + # + # If an positive integer is given as n, + # SecureRandom.random_number returns an integer: + # 0 <= SecureRandom.random_number(n) < n. + # + # If 0 is given or an argument is not given, + # SecureRandom.random_number returns an float: + # 0.0 <= SecureRandom.random_number() < 1.0. + def self.random_number(n=0) + if 0 < n + hex = n.to_s(16) + hex = '0' + hex if (hex.length & 1) == 1 + bin = [hex].pack("H*") + first = bin[0..0] + mask = first.respond_to?(:ord) ? first.ord : first.sum(8) + mask |= mask >> 1 + mask |= mask >> 2 + mask |= mask >> 4 + begin + rnd = SecureRandom.random_bytes(bin.length) + first = rnd[0..0] + ordinal = first.respond_to?(:ord) ? first.ord : first.sum(8) + rnd[0..0] = (ordinal & mask).chr + end until rnd < bin + rnd.unpack("H*")[0].hex + else + # assumption: Float::MANT_DIG <= 64 + i64 = SecureRandom.random_bytes(8).unpack("Q")[0] + Math.ldexp(i64 >> (64-Float::MANT_DIG), -Float::MANT_DIG) + end + end + + # Following code is based on David Garamond's GUID library for Ruby. + def self.lastWin32ErrorMessage # :nodoc: + get_last_error = Win32API.new( + "kernel32", "GetLastError", '', 'L' + ) + format_message = Win32API.new( + "kernel32", "FormatMessageA", 'LPLLPLPPPPPPPP', 'L' + ) + format_message_ignore_inserts = 0x00000200 + format_message_from_system = 0x00001000 + + code = get_last_error.call + msg = "\0" * 1024 + len = format_message.call( + format_message_ignore_inserts + format_message_from_system, + 0, code, 0, msg, 1024, nil, nil, nil, nil, nil, nil, nil, nil + ) + msg[0, len].tr("\r", '').chomp + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/lib/uuidtools.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/lib/uuidtools.rb new file mode 100644 index 000000000..5bfbf7f85 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/lib/uuidtools.rb @@ -0,0 +1,745 @@ +# encoding:utf-8 +#-- +# Copyright (C) 2005-2014 Bob Aman +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#++ + + +$:.unshift(File.dirname(__FILE__)) + +require 'uri' +require 'time' +require 'thread' +require 'digest/sha1' +require 'digest/md5' + +require 'uuidtools/version' + +begin + require 'securerandom' +rescue LoadError + require File.join(File.dirname(__FILE__), 'compat', 'securerandom') +end + +module UUIDTools + ## + # UUIDTools was designed to be a simple library for generating any + # of the various types of UUIDs. It conforms to RFC 4122 whenever + # possible. + # + # @example + # UUID.md5_create(UUID_DNS_NAMESPACE, "www.widgets.com") + # # => # + # UUID.sha1_create(UUID_DNS_NAMESPACE, "www.widgets.com") + # # => # + # UUID.timestamp_create + # # => # + # UUID.random_create + # # => # + class UUID + include Comparable + + ## + # @api private + @@last_timestamp = nil + + ## + # @api private + @@last_node_id = nil + + ## + # @api private + @@last_clock_sequence = nil + + ## + # @api private + @@state_file = nil + + ## + # @api private + @@mutex = Mutex.new + + ## + # Creates a new UUID structure from its component values. + # @see UUID.md5_create + # @see UUID.sha1_create + # @see UUID.timestamp_create + # @see UUID.random_create + # @api private + def initialize(time_low, time_mid, time_hi_and_version, + clock_seq_hi_and_reserved, clock_seq_low, nodes) + unless time_low >= 0 && time_low < 4294967296 + raise ArgumentError, + "Expected unsigned 32-bit number for time_low, got #{time_low}." + end + unless time_mid >= 0 && time_mid < 65536 + raise ArgumentError, + "Expected unsigned 16-bit number for time_mid, got #{time_mid}." + end + unless time_hi_and_version >= 0 && time_hi_and_version < 65536 + raise ArgumentError, + "Expected unsigned 16-bit number for time_hi_and_version, " + + "got #{time_hi_and_version}." + end + unless clock_seq_hi_and_reserved >= 0 && clock_seq_hi_and_reserved < 256 + raise ArgumentError, + "Expected unsigned 8-bit number for clock_seq_hi_and_reserved, " + + "got #{clock_seq_hi_and_reserved}." + end + unless clock_seq_low >= 0 && clock_seq_low < 256 + raise ArgumentError, + "Expected unsigned 8-bit number for clock_seq_low, " + + "got #{clock_seq_low}." + end + unless nodes.kind_of?(Enumerable) + raise TypeError, + "Expected Enumerable, got #{nodes.class.name}." + end + unless nodes.size == 6 + raise ArgumentError, + "Expected nodes to have size of 6." + end + for node in nodes + unless node >= 0 && node < 256 + raise ArgumentError, + "Expected unsigned 8-bit number for each node, " + + "got #{node}." + end + end + @time_low = time_low + @time_mid = time_mid + @time_hi_and_version = time_hi_and_version + @clock_seq_hi_and_reserved = clock_seq_hi_and_reserved + @clock_seq_low = clock_seq_low + @nodes = nodes + end + + ## + # Returns the value of attribute `time_low` + attr_accessor :time_low + + ## + # Returns the value of attribute `time_mid` + attr_accessor :time_mid + + ## + # Returns the value of attribute `time_hi_and_version` + attr_accessor :time_hi_and_version + + ## + # Returns the value of attribute `clock_seq_hi_and_reserved` + attr_accessor :clock_seq_hi_and_reserved + + ## + # Returns the value of attribute `clock_seq_low` + attr_accessor :clock_seq_low + + ## + # Returns the value of attribute `nodes` + attr_accessor :nodes + + ## + # Parses a UUID from a string. + def self.parse(uuid_string) + unless uuid_string.kind_of? String + raise TypeError, + "Expected String, got #{uuid_string.class.name} instead." + end + uuid_components = uuid_string.downcase.scan(UUIDTools::UUID_REGEXP).first + raise ArgumentError, "Invalid UUID format." if uuid_components.nil? + time_low = uuid_components[0].to_i(16) + time_mid = uuid_components[1].to_i(16) + time_hi_and_version = uuid_components[2].to_i(16) + clock_seq_hi_and_reserved = uuid_components[3].to_i(16) + clock_seq_low = uuid_components[4].to_i(16) + nodes = [] + for i in 0..5 + nodes << uuid_components[5][(i * 2)..(i * 2) + 1].to_i(16) + end + return self.new(time_low, time_mid, time_hi_and_version, + clock_seq_hi_and_reserved, clock_seq_low, nodes) + end + + ## + # Parses a UUID from a raw byte string. + def self.parse_raw(raw_string) + unless raw_string.kind_of? String + raise TypeError, + "Expected String, got #{raw_string.class.name} instead." + end + integer = self.convert_byte_string_to_int(raw_string) + + time_low = (integer >> 96) & 0xFFFFFFFF + time_mid = (integer >> 80) & 0xFFFF + time_hi_and_version = (integer >> 64) & 0xFFFF + clock_seq_hi_and_reserved = (integer >> 56) & 0xFF + clock_seq_low = (integer >> 48) & 0xFF + nodes = [] + for i in 0..5 + nodes << ((integer >> (40 - (i * 8))) & 0xFF) + end + return self.new(time_low, time_mid, time_hi_and_version, + clock_seq_hi_and_reserved, clock_seq_low, nodes) + end + + ## + # Parses a UUID from an Integer. + def self.parse_int(uuid_int) + unless uuid_int.kind_of?(Integer) + raise ArgumentError, + "Expected Integer, got #{uuid_int.class.name} instead." + end + return self.parse_raw(self.convert_int_to_byte_string(uuid_int, 16)) + end + + ## + # Parse a UUID from a hexdigest String. + def self.parse_hexdigest(uuid_hexdigest) + unless uuid_hexdigest.kind_of?(String) + raise ArgumentError, + "Expected String, got #{uuid_hexdigest.class.name} instead." + end + return self.parse_int(uuid_hexdigest.to_i(16)) + end + + ## + # Creates a UUID from a random value. + def self.random_create() + new_uuid = self.parse_raw(SecureRandom.random_bytes(16)) + new_uuid.time_hi_and_version &= 0x0FFF + new_uuid.time_hi_and_version |= (4 << 12) + new_uuid.clock_seq_hi_and_reserved &= 0x3F + new_uuid.clock_seq_hi_and_reserved |= 0x80 + return new_uuid + end + + ## + # Creates a UUID from a timestamp. + def self.timestamp_create(timestamp=nil) + # We need a lock here to prevent two threads from ever + # getting the same timestamp. + @@mutex.synchronize do + # Always use GMT to generate UUIDs. + if timestamp.nil? + gmt_timestamp = Time.now.gmtime + else + gmt_timestamp = timestamp.gmtime + end + # Convert to 100 nanosecond blocks + gmt_timestamp_100_nanoseconds = (gmt_timestamp.tv_sec * 10000000) + + (gmt_timestamp.tv_usec * 10) + 0x01B21DD213814000 + mac_address = self.mac_address + node_id = 0 + if mac_address != nil + nodes = mac_address.split(":").collect do |octet| + octet.to_i(16) + end + else + nodes = SecureRandom.random_bytes(6).unpack("C*") + nodes[0] |= 0b00000001 + end + for i in 0..5 + node_id += (nodes[i] << (40 - (i * 8))) + end + clock_sequence = @@last_clock_sequence + if clock_sequence.nil? + clock_sequence = self.convert_byte_string_to_int( + SecureRandom.random_bytes(16) + ) + end + if @@last_node_id != nil && @@last_node_id != node_id + # The node id has changed. Change the clock id. + clock_sequence = self.convert_byte_string_to_int( + SecureRandom.random_bytes(16) + ) + elsif @@last_timestamp != nil && + gmt_timestamp_100_nanoseconds <= @@last_timestamp + clock_sequence = clock_sequence + 1 + end + @@last_timestamp = gmt_timestamp_100_nanoseconds + @@last_node_id = node_id + @@last_clock_sequence = clock_sequence + + time_low = gmt_timestamp_100_nanoseconds & 0xFFFFFFFF + time_mid = ((gmt_timestamp_100_nanoseconds >> 32) & 0xFFFF) + time_hi_and_version = ((gmt_timestamp_100_nanoseconds >> 48) & 0x0FFF) + time_hi_and_version |= (1 << 12) + clock_seq_low = clock_sequence & 0xFF; + clock_seq_hi_and_reserved = (clock_sequence & 0x3F00) >> 8 + clock_seq_hi_and_reserved |= 0x80 + + return self.new(time_low, time_mid, time_hi_and_version, + clock_seq_hi_and_reserved, clock_seq_low, nodes) + end + end + + ## + # Creates a UUID using the MD5 hash. (Version 3) + def self.md5_create(namespace, name) + return self.create_from_hash(Digest::MD5, namespace, name) + end + + ## + # Creates a UUID using the SHA1 hash. (Version 5) + def self.sha1_create(namespace, name) + return self.create_from_hash(Digest::SHA1, namespace, name) + end + + ## + # This method applies only to version 1 UUIDs. + # Checks if the node ID was generated from a random number + # or from an IEEE 802 address (MAC address). + # Always returns false for UUIDs that aren't version 1. + # This should not be confused with version 4 UUIDs where + # more than just the node id is random. + def random_node_id? + return false if self.version != 1 + return ((self.nodes.first & 0x01) == 1) + end + + ## + # Returns true if this UUID is the + # nil UUID (00000000-0000-0000-0000-000000000000). + def nil_uuid? + return false if self.time_low != 0 + return false if self.time_mid != 0 + return false if self.time_hi_and_version != 0 + return false if self.clock_seq_hi_and_reserved != 0 + return false if self.clock_seq_low != 0 + self.nodes.each do |node| + return false if node != 0 + end + return true + end + + ## + # Returns the UUID version type. + # Possible values: + # 1 - Time-based with unique or random host identifier + # 2 - DCE Security version (with POSIX UIDs) + # 3 - Name-based (MD5 hash) + # 4 - Random + # 5 - Name-based (SHA-1 hash) + def version + return (time_hi_and_version >> 12) + end + + ## + # Returns the UUID variant. + # Possible values: + # 0b000 - Reserved, NCS backward compatibility. + # 0b100 - The variant specified in this document. + # 0b110 - Reserved, Microsoft Corporation backward compatibility. + # 0b111 - Reserved for future definition. + def variant + variant_raw = (clock_seq_hi_and_reserved >> 5) + result = nil + if (variant_raw >> 2) == 0 + result = 0x000 + elsif (variant_raw >> 1) == 2 + result = 0x100 + else + result = variant_raw + end + return (result >> 6) + end + + ## + # Returns true if this UUID is valid. + def valid? + if [0b000, 0b100, 0b110, 0b111].include?(self.variant) && + (1..5).include?(self.version) + return true + else + return false + end + end + + ## + # Returns the IEEE 802 address used to generate this UUID or + # nil if a MAC address was not used. + def mac_address + return nil if self.version != 1 + return nil if self.random_node_id? + return (self.nodes.collect do |node| + sprintf("%2.2x", node) + end).join(":") + end + + ## + # Returns the timestamp used to generate this UUID + def timestamp + return nil if self.version != 1 + gmt_timestamp_100_nanoseconds = 0 + gmt_timestamp_100_nanoseconds += + ((self.time_hi_and_version & 0x0FFF) << 48) + gmt_timestamp_100_nanoseconds += (self.time_mid << 32) + gmt_timestamp_100_nanoseconds += self.time_low + return Time.at( + (gmt_timestamp_100_nanoseconds - 0x01B21DD213814000) / 10000000.0) + end + + ## + # Compares two UUIDs lexically + def <=>(other_uuid) + return nil unless other_uuid.is_a?(UUIDTools::UUID) + check = self.time_low <=> other_uuid.time_low + return check if check != 0 + check = self.time_mid <=> other_uuid.time_mid + return check if check != 0 + check = self.time_hi_and_version <=> other_uuid.time_hi_and_version + return check if check != 0 + check = self.clock_seq_hi_and_reserved <=> + other_uuid.clock_seq_hi_and_reserved + return check if check != 0 + check = self.clock_seq_low <=> other_uuid.clock_seq_low + return check if check != 0 + for i in 0..5 + if (self.nodes[i] < other_uuid.nodes[i]) + return -1 + end + if (self.nodes[i] > other_uuid.nodes[i]) + return 1 + end + end + return 0 + end + + ## + # Returns a representation of the object's state + def inspect + return "#" + end + + ## + # Returns the hex digest of the UUID object. + def hexdigest + (self.frozen? ? + generate_hexdigest : (@hexdigest ||= generate_hexdigest) + ).dup + end + + ## + # Returns the raw bytes that represent this UUID. + def raw + (self.frozen? ? generate_raw : (@raw ||= generate_raw)).dup + end + + ## + # Returns a string representation for this UUID. + def to_s + (self.frozen? ? generate_s : (@string ||= generate_s)).dup + end + alias_method :to_str, :to_s + + ## + # Returns an integer representation for this UUID. + def to_i + self.frozen? ? generate_i : (@integer ||= generate_i) + end + + ## + # Returns a URI string for this UUID. + def to_uri + return "urn:uuid:#{self.to_s}" + end + + ## + # Returns an integer hash value. + def hash + self.frozen? ? generate_hash : (@hash ||= generate_hash) + end + + protected + ## + # Generates the hex digest of the UUID object. + # + # @api private + def generate_hexdigest + return self.to_i.to_s(16).rjust(32, "0") + end + + # Generates an integer hash value. + # + # @api private + def generate_hash + return self.to_i % 0x3fffffff + end + + ## + # Generates an integer representation for this UUID. + # + # @api private + def generate_i + return (begin + bytes = (time_low << 96) + (time_mid << 80) + + (time_hi_and_version << 64) + (clock_seq_hi_and_reserved << 56) + + (clock_seq_low << 48) + for i in 0..5 + bytes += (nodes[i] << (40 - (i * 8))) + end + bytes + end) + end + + ## + # Generates a string representation for this UUID. + # + # @api private + def generate_s + result = sprintf("%8.8x-%4.4x-%4.4x-%2.2x%2.2x-", @time_low, @time_mid, + @time_hi_and_version, @clock_seq_hi_and_reserved, @clock_seq_low); + for i in 0..5 + result << sprintf("%2.2x", @nodes[i]) + end + return result.downcase + end + + ## + # Generates the raw bytes that represent this UUID. + # + # @api private + def generate_raw + return self.class.convert_int_to_byte_string(self.to_i, 16) + end + + public + ## + # Returns true if this UUID is exactly equal to the other UUID. + def eql?(other) + return self == other + end + + # + # Determine what OS we're running on. Helps decide how to find the MAC + # + def self.os_class + require 'rbconfig' + os_platform = RbConfig::CONFIG['target_os'] + os_class = nil + if (os_platform =~ /win/i && !(os_platform =~ /darwin/i)) || + os_platform =~ /w32/i + os_class = :windows + elsif os_platform =~ /solaris/i + os_class = :solaris + elsif os_platform =~ /netbsd/i + os_class = :netbsd + elsif os_platform =~ /openbsd/i + os_class = :openbsd + end + end + + # making these class variables helps with testing + @ifconfig_command = "ifconfig" + @ifconfig_path_default = "/sbin/ifconfig" + @ip_command = "ip" + @ip_path_default = "/sbin/ip" + + class << self + attr_accessor :ifconfig_command, :ifconfig_path_default + attr_accessor :ip_command, :ip_path_default + end + + # + # Find the path of the ifconfig(8) command if it is present + # + def self.ifconfig_path + path = `which #{UUID.ifconfig_command} 2>/dev/null`.strip + path = UUID.ifconfig_path_default if (path == "" && File.exist?(UUID.ifconfig_path_default)) + return (path === "" ? nil : path) + end + + # + # Find the path of the ip(8) command if it is present + # + def self.ip_path + path = `which #{UUID.ip_command} 2>/dev/null`.strip + path = UUID.ip_path_default if (path == "" && File.exist?(UUID.ip_path_default)) + return (path === "" ? nil : path) + end + + # + # Call the ifconfig or ip command that is found + # + def self.ifconfig(all=nil) + # find the path of the ifconfig command + ifconfig_path = UUID.ifconfig_path + + # if it does not exist, try the ip command + if ifconfig_path == nil + ifconfig_path = "#{UUID.ip_path} addr list" + # all makes no sense when using ip(1) + all = nil + end + + all_switch = all == nil ? "" : "-a" + return `#{ifconfig_path} #{all_switch}` if not ifconfig_path == nil + end + + # Match and return the first Mac address found + def self.first_mac(instring) + mac_regexps = [ + Regexp.new("address:? (#{(["[0-9a-fA-F]{2}"] * 6).join(":")})"), + Regexp.new("addr:? (#{(["[0-9a-fA-F]{2}"] * 6).join(":")})"), + Regexp.new("ether:? (#{(["[0-9a-fA-F]{1,2}"] * 6).join(":")})"), + Regexp.new("HWaddr:? (#{(["[0-9a-fA-F]{2}"] * 6).join(":")})"), + Regexp.new("link/ether? (#{(["[0-9a-fA-F]{2}"] * 6).join(":")})"), + Regexp.new("(#{(["[0-9a-fA-F]{2}"] * 6).join(":")})"), + Regexp.new("(#{(["[0-9a-fA-F]{2}"] * 6).join("-")})") + ] + parse_mac = lambda do |output| + (mac_regexps.map do |regexp| + result = output[regexp, 1] + result.downcase.gsub(/-/, ":") if result != nil + end).compact.first + end + + mac = parse_mac.call(instring) + if mac + # expand octets that were compressed (solaris) + return (mac.split(':').map do |octet| + (octet.length == 1 ? "0#{octet}" : octet) + end).join(':') + else + return nil + end + end + + ## + # Returns the MAC address of the current computer's network card. + # Returns nil if a MAC address could not be found. + def self.mac_address + if !defined?(@@mac_address) + require 'rbconfig' + + os_class = UUID.os_class + + if os_class == :windows + begin + @@mac_address = UUID.first_mac `ipconfig /all` + rescue + end + else # linux, bsd, macos, solaris + @@mac_address = UUID.first_mac(UUID.ifconfig(:all)) + end + + if @@mac_address != nil + if @@mac_address.respond_to?(:to_str) + @@mac_address = @@mac_address.to_str + else + @@mac_address = @@mac_address.to_s + end + @@mac_address.downcase! + @@mac_address.strip! + end + + # Verify that the MAC address is in the right format. + # Nil it out if it isn't. + unless @@mac_address.respond_to?(:scan) && + @@mac_address.scan(/#{(["[0-9a-f]{2}"] * 6).join(":")}/) + @@mac_address = nil + end + end + return @@mac_address + end + + ## + # Allows users to set the MAC address manually in cases where the MAC + # address cannot be obtained programatically. + def self.mac_address=(new_mac_address) + @@mac_address = new_mac_address + end + + # The following methods are not part of the public API, + # and generally should not be called directly. + + + ## + # Creates a new UUID from a SHA1 or MD5 hash + # + # @api private + def self.create_from_hash(hash_class, namespace, name) + if hash_class == Digest::MD5 + version = 3 + elsif hash_class == Digest::SHA1 + version = 5 + else + raise ArgumentError, + "Expected Digest::SHA1 or Digest::MD5, got #{hash_class.name}." + end + hash = hash_class.new + hash.update(namespace.raw) + hash.update(name) + hash_string = hash.to_s[0..31] + new_uuid = self.parse("#{hash_string[0..7]}-#{hash_string[8..11]}-" + + "#{hash_string[12..15]}-#{hash_string[16..19]}-#{hash_string[20..31]}") + + new_uuid.time_hi_and_version &= 0x0FFF + new_uuid.time_hi_and_version |= (version << 12) + new_uuid.clock_seq_hi_and_reserved &= 0x3F + new_uuid.clock_seq_hi_and_reserved |= 0x80 + return new_uuid + end + + ## + # @api private + def self.convert_int_to_byte_string(integer, size) + byte_string = "" + if byte_string.respond_to?(:force_encoding) + byte_string.force_encoding(Encoding::ASCII_8BIT) + end + for i in 0..(size - 1) + byte_string << ((integer >> (((size - 1) - i) * 8)) & 0xFF) + end + return byte_string + end + + ## + # @api private + def self.convert_byte_string_to_int(byte_string) + if byte_string.respond_to?(:force_encoding) + byte_string.force_encoding(Encoding::ASCII_8BIT) + end + integer = 0 + size = byte_string.size + for i in 0..(size - 1) + ordinal = (byte_string[i].respond_to?(:ord) ? + byte_string[i].ord : byte_string[i]) + integer += (ordinal << (((size - 1) - i) * 8)) + end + return integer + end + end + + ## + # Constant Regexp that matches a UUID and captures its components. + UUID_REGEXP = Regexp.new("^([0-9a-f]{8})-([0-9a-f]{4})-([0-9a-f]{4})-" + + "([0-9a-f]{2})([0-9a-f]{2})-([0-9a-f]{12})$") + + ## + # Constant that represents the DNS namespace. + UUID_DNS_NAMESPACE = UUID.parse("6ba7b810-9dad-11d1-80b4-00c04fd430c8") + + ## + # Constant that represents the URL namespace. + UUID_URL_NAMESPACE = UUID.parse("6ba7b811-9dad-11d1-80b4-00c04fd430c8") + + ## + # Constant that represents the OID namespace. + UUID_OID_NAMESPACE = UUID.parse("6ba7b812-9dad-11d1-80b4-00c04fd430c8") + + ## + # Constant that represents the X500 namespace. + UUID_X500_NAMESPACE = UUID.parse("6ba7b814-9dad-11d1-80b4-00c04fd430c8") +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/lib/uuidtools/version.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/lib/uuidtools/version.rb new file mode 100644 index 000000000..22dccd133 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/lib/uuidtools/version.rb @@ -0,0 +1,30 @@ +# encoding:utf-8 +#-- +# Copyright (C) 2005-2014 Bob Aman +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +#++ + + +# Used to prevent the class/module from being loaded more than once +unless defined? UUIDTools::VERSION + module UUIDTools + module VERSION #:nodoc: + MAJOR = 2 + MINOR = 1 + TINY = 5 + + STRING = [MAJOR, MINOR, TINY].join('.') + end + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/spec/spec.opts b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/spec/spec.opts new file mode 100644 index 000000000..53607ea52 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/spec/spec.opts @@ -0,0 +1 @@ +--colour diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/spec/spec_helper.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/spec/spec_helper.rb new file mode 100644 index 000000000..a5737f503 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/spec/spec_helper.rb @@ -0,0 +1,9 @@ +$VERBOSE=true + +spec_dir = File.expand_path(File.dirname(__FILE__)) +lib_dir = File.expand_path(File.join(spec_dir, "../lib")) + +$:.unshift(lib_dir) +$:.uniq! + +require "uuidtools" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/spec/uuidtools/mac_address_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/spec/uuidtools/mac_address_spec.rb new file mode 100644 index 000000000..ed5331bbe --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/spec/uuidtools/mac_address_spec.rb @@ -0,0 +1,454 @@ +require File.expand_path("../../spec_helper.rb", __FILE__) + +def pending_if_root_required + if @mac_address == nil + output = `ifconfig -a 2>&1` + if output =~ /inet/ && + output =~ /\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/ && + output =~ /Warning: cannot open/ + pending("Cannot get MAC address without root?") + end + end +end + +# =========================================================================== +# +# Samples of ifconfig -a output +# +# =========================================================================== + +# +# solaris +# +solaris_sample = < mtu 8232 index 1 + inet 127.0.0.1 netmask ff000000 +igb1: flags=1000843 mtu 1500 index 2 + inet 10.51.0.18 netmask ffffff00 broadcast 10.51.0.255 + ether 0:21:28:fa:c6:65 +igb2: flags=1000843 mtu 1500 index 3 + inet 10.99.0.12 netmask ffffff00 broadcast 10.99.0.255 + ether 0:21:28:fa:c6:66 +EOF + +solaris_mac = "00:21:28:fa:c6:65" + +# +# windows +# +windows_sample = < mtu 1500 + inet 10.16.187.71 netmask 255.255.252.0 broadcast 10.16.187.255 + inet6 fe80::226:2dff:fef6:b94 prefixlen 64 scopeid 0x20 + ether 00:26:2d:f6:0b:94 txqueuelen 1000 (Ethernet) + RX packets 172074 bytes 82784684 (78.9 MiB) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 99075 bytes 23551085 (22.4 MiB) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 + device interrupt 20 memory 0xf2600000-f2620000 + +lo: flags=73 mtu 65536 + inet 127.0.0.1 netmask 255.0.0.0 + inet6 ::1 prefixlen 128 scopeid 0x10 + loop txqueuelen 0 (Local Loopback) + RX packets 20 bytes 2148 (2.0 KiB) + RX errors 0 dropped 0 overruns 0 frame 0 + TX packets 20 bytes 2148 (2.0 KiB) + TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 +EOF + +linux_mac = "00:26:2d:f6:0b:94" + +# +# alternate linux +# +linux_sample_2 = < mtu 65536 qdisc noqueue state UNKNOWN + link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00 + inet 127.0.0.1/8 scope host lo + inet6 ::1/128 scope host + valid_lft forever preferred_lft forever +2: eth0: mtu 1500 qdisc pfifo_fast state UP qlen 1000 + link/ether 00:26:2d:f6:0b:94 brd ff:ff:ff:ff:ff:ff + inet 10.16.187.125/22 brd 10.16.187.255 scope global eth0 + inet6 fe80::226:2dff:fef6:b94/64 scope link + valid_lft forever preferred_lft forever +3: wlan0: mtu 1500 qdisc mq state DOWN qlen 1000 + link/ether 00:26:c6:c6:1a:b4 brd ff:ff:ff:ff:ff:ff +4: virbr0: mtu 1500 qdisc noqueue state DOWN + link/ether 52:54:00:e3:cf:d3 brd ff:ff:ff:ff:ff:ff + inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0 +5: virbr0-nic: mtu 1500 qdisc pfifo_fast master virbr0 state DOWN qlen 500 + link/ether 52:54:00:e3:cf:d3 brd ff:ff:ff:ff:ff:ff +EOF + +linux_ip_mac = "00:26:2d:f6:0b:94" + +# +# freebsd +# +freebsd_sample = < metric 0 mtu 1500 + options=401bb + ether 00:25:90:2b:81:32 + inet6 fe80::225:90ff:fe2b:8132%igb0 prefixlen 64 scopeid 0x1 + nd6 options=29 + media: Ethernet autoselect (1000baseT ) + status: active +igb1: flags=8843 metric 0 mtu 1500 + options=401bb + ether 00:25:90:2b:81:32 + inet6 fe80::225:90ff:fe2b:8133%igb1 prefixlen 64 scopeid 0x2 + nd6 options=29 + media: Ethernet autoselect (1000baseT ) +EOF + +freebsd_mac = "00:25:90:2b:81:32" + +# +# openbsd +# +openbsd_sample = < mtu 33200 + priority: 0 + groups: lo + inet 127.0.0.1 netmask 0xff000000 + inet6 ::1 prefixlen 128 + inet6 fe80::1%lo0 prefixlen 64 scopeid 0x5 +vr0: flags=8843 mtu 1500 + lladdr 00:0d:b9:28:ab:44 + priority: 0 + media: Ethernet autoselect (100baseTX full-duplex) + status: active + inet 192.168.7.2 netmask 0xffffff00 broadcast 192.168.7.255 + inet6 fe80::20d:b9ff:fe28:ab44%vr0 prefixlen 64 scopeid 0x1 +EOF + +openbsd_mac = "00:0d:b9:28:ab:44" + +# +# MacOS 10 +# +macos_sample = < mtu 16384 + options=3 + inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 + inet 127.0.0.1 netmask 0xff000000 + inet6 ::1 prefixlen 128 +gif0: flags=8010 mtu 1280 +stf0: flags=0<> mtu 1280 +en0: flags=8963 mtu 1500 + options=27 + ether 58:b0:35:a4:cd:0c + inet6 fe80::5ab0:35ff:fea4:cd0c%en0 prefixlen 64 scopeid 0x4 + inet 192.168.142.136 netmask 0xfffffff0 broadcast 192.168.142.143 + media: autoselect (1000baseT ) + status: active +en1: flags=8823 mtu 1500 + ether d8:30:62:51:dd:3d + media: autoselect () + status: inactive +p2p0: flags=8802 mtu 2304 + ether 0a:30:62:51:dd:3d + media: autoselect + status: inactive +EOF + +macos_mac = "58:b0:35:a4:cd:0c" + +# Gather the samples and MAC addresses for simple access +samples = { + :macos => macos_sample, + :windows => windows_sample, + :solaris => solaris_sample, + :freebsd => freebsd_sample, + :openbsd => openbsd_sample, + :linux => linux_sample, + :linux2 => linux_sample_2, + :linuxip => linux_ip_sample +} + +macs = { + :macos => macos_mac, + :windows => windows_mac, + :solaris => solaris_mac, + :freebsd => freebsd_mac, + :openbsd => openbsd_mac, + :linux => linux_mac, + :linux2 => linux_mac_2, + :linuxip => linux_ip_mac +} + +# -------------------------------------------------------------------------- +# +# TESTS +# +# -------------------------------------------------------------------------- + +describe UUIDTools::UUID, "when obtaining a MAC address" do + before do + @mac_address = UUIDTools::UUID.mac_address + end + + it "should obtain a MAC address" do + pending_if_root_required() + expect(@mac_address).not_to be_nil + end + + it "should cache the MAC address" do + pending_if_root_required() + expect(@mac_address.object_id).to eql(UUIDTools::UUID.mac_address.object_id) + end +end + +describe UUIDTools::UUID, "before obtaining a MAC address" do + + before do + module UUIDTools + class UUID + remove_class_variable(:@@mac_address) if defined?(@@mac_address) + end + end + end + + it "should parse windows MAC addresses" do + # mock ifconfig() to return the windows sample + allow(UUIDTools::UUID).to receive(:ifconfig) { samples[:windows] } + mac = UUIDTools::UUID.mac_address + expect(mac).to eql(macs[:windows]) + end + + it "should parse solaris MAC addresses" do + allow(UUIDTools::UUID).to receive(:ifconfig) { samples[:solaris] } + mac = UUIDTools::UUID.mac_address + expect(mac).to eql(macs[:solaris]) + end + + it "should parse freebsd MAC addresses" do + allow(UUIDTools::UUID).to receive(:ifconfig) { samples[:freebsd] } + mac = UUIDTools::UUID.mac_address + expect(mac).to eql(macs[:freebsd]) + end + + it "should parse openbsd MAC addresses" do + allow(UUIDTools::UUID).to receive(:ifconfig) { samples[:openbsd] } + mac = UUIDTools::UUID.mac_address + expect(mac).to eql(macs[:openbsd]) + end + + it "should parse linux MAC addresses with ifconfig" do + allow(UUIDTools::UUID).to receive(:ifconfig) { samples[:linux] } + mac = UUIDTools::UUID.mac_address + expect(mac).to eql(macs[:linux]) + end + + it "should parse a linux HWaddr address with ifconfig" do + allow(UUIDTools::UUID).to receive(:ifconfig) { samples[:linux2] } + mac = UUIDTools::UUID.mac_address + expect(mac).to eql(macs[:linux2]) + end + + it "should parse macos MAC addresses with ifconfig" do + allow(UUIDTools::UUID).to receive(:ifconfig) { samples[:macos] } + mac = UUIDTools::UUID.mac_address + expect(mac).to eql(macs[:macos]) + end + + it "should parse linux MAC addresses with ip" do + allow(UUIDTools::UUID).to receive(:ifconfig) { samples[:linuxip] } + mac = UUIDTools::UUID.mac_address + expect(mac).to eql(macs[:linuxip]) + end + + it "should identify the default os classes" do + module RbConfig + CONFIG['target_os'] = nil + end + + os_class = UUIDTools::UUID.os_class + expect(os_class).to be_nil + + RbConfig::CONFIG['target_os'] = 'linux' + os_class = UUIDTools::UUID.os_class + expect(os_class).to be_nil + + RbConfig::CONFIG['target_os'] = 'darwin' + os_class = UUIDTools::UUID.os_class + expect(os_class).to be_nil + end + + it "should identify the solaris os classes" do + module RbConfig + CONFIG['target_os'] = "solaris" + end + + os_class = UUIDTools::UUID.os_class + expect(os_class).to eql(:solaris) + end + + it "should identify the BSD os classes" do + module RbConfig + CONFIG['target_os'] = "netbsd" + end + + os_class = UUIDTools::UUID.os_class + expect(os_class).to eql(:netbsd) + + RbConfig::CONFIG['target_os'] = "openbsd" + os_class = UUIDTools::UUID.os_class + expect(os_class).to eql(:openbsd) + + end + + it "should identify the Windows os classes" do + module RbConfig + CONFIG['target_os'] = "win" + end + os_class = UUIDTools::UUID.os_class + expect(os_class).to eql(:windows) + + RbConfig::CONFIG['target_os'] = "w32" + os_class = UUIDTools::UUID.os_class + expect(os_class).to eql(:windows) + + RbConfig::CONFIG['target_os'] = "darwin" + os_class = UUIDTools::UUID.os_class + expect(os_class).to be_nil + + end + + it "should find the ifconfig program" do + save_ifconfig_command = UUIDTools::UUID.ifconfig_command + save_ifconfig_path = UUIDTools::UUID.ifconfig_path_default + + # this should always exist + UUIDTools::UUID.ifconfig_command="sh" + UUIDTools::UUID.ifconfig_path_default="notfound" + ifconfig_path = UUIDTools::UUID.ifconfig_path +# expect(ifconfig_path).to eql("/usr/bin/sh") + + # Test what happens if it does not + UUIDTools::UUID.ifconfig_command="nosuchthing" + UUIDTools::UUID.ifconfig_path_default="default" + + # ifconfig_path checks if the IFCONFIG_PATH command file exists + allow(File).to receive(:exist?) { true } + + ifconfig_path = UUIDTools::UUID.ifconfig_path +# expect(ifconfig_path).to eql("default") + + UUIDTools::UUID.ifconfig_command=save_ifconfig_command + UUIDTools::UUID.ifconfig_path_default=save_ifconfig_path + + end + + it "should find the ip program" do + save_ip_command = UUIDTools::UUID.ip_command + save_ip_path = UUIDTools::UUID.ip_path_default + + # this should always exist + UUIDTools::UUID.ip_command="sh" + UUIDTools::UUID.ip_path_default="notfound" + ip_path = UUIDTools::UUID.ip_path +# expect(ip_path).to eql("/usr/bin/sh") + + # Test what happens if it does not + UUIDTools::UUID.ip_command="nosuchthing" + UUIDTools::UUID.ip_path_default="default" + + # ifconfig_path checks if the IP_PATH command file exists + allow(File).to receive(:exist?) { true } + + ifconfig_path = UUIDTools::UUID.ip_path +# expect(ifconfig_path).to eql("default") + + UUIDTools::UUID.ip_command=save_ip_command + UUIDTools::UUID.ip_path_default=save_ip_path + end + + it "should be able to parse windows ipconfig output" do + mac = UUIDTools::UUID.first_mac samples[:windows] + expect(mac).to eql(macs[:windows]) + end + + it "should be able to parse solaris ifconfig output" do + mac = UUIDTools::UUID.first_mac samples[:solaris] + expect(mac).to eql(macs[:solaris]) + end + + it "should be able to parse freebsd ifconfig output" do + mac = UUIDTools::UUID.first_mac samples[:freebsd] + expect(mac).to eql(macs[:freebsd]) + end + + it "should be able to parse openbsd ifconfig output" do + mac = UUIDTools::UUID.first_mac samples[:openbsd] + expect(mac).to eql(macs[:openbsd]) + end + + it "should be able to parse linux ifconfig output" do + mac = UUIDTools::UUID.first_mac samples[:linux] + expect(mac).to eql(macs[:linux]) + + mac2 = UUIDTools::UUID.first_mac samples[:linux2] + expect(mac2).to eql(macs[:linux2]) + end + + it "should be able to parse macos ifconfig output" do + mac = UUIDTools::UUID.first_mac samples[:macos] + expect(mac).to eql(macs[:macos]) + end + + it "should be able to parse ip addr output" do + mac = UUIDTools::UUID.first_mac samples[:linuxip] + expect(mac).to eql(macs[:linuxip]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/spec/uuidtools/utility_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/spec/uuidtools/utility_spec.rb new file mode 100644 index 000000000..9348776d4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/spec/uuidtools/utility_spec.rb @@ -0,0 +1,21 @@ +require File.expand_path("../../spec_helper.rb", __FILE__) + +describe SecureRandom do + it "should correctly obtain random bits" do + bits = [] + 1000.times do + bits << SecureRandom.random_bytes(16) + end + # Check to make sure that none of the 10,000 strings were duplicates + expect((bits.map {|x| x.to_s}).uniq.size).to eql(bits.size) + end + + it "should return the correct number of random bits" do + expect(SecureRandom.random_bytes(16).size).to eql(16) + expect(SecureRandom.random_bytes(6).size).to eql(6) + end + + it "should return a sane random number" do + expect(SecureRandom.random_number(5000)).to be < 5000 + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/spec/uuidtools/uuid_creation_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/spec/uuidtools/uuid_creation_spec.rb new file mode 100644 index 000000000..bd94d7a02 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/spec/uuidtools/uuid_creation_spec.rb @@ -0,0 +1,130 @@ +require File.expand_path("../../spec_helper.rb", __FILE__) + +describe UUIDTools::UUID, "when generating" do + it "should correctly generate SHA1 variant UUIDs" do + expect(UUIDTools::UUID.sha1_create( + UUIDTools::UUID_URL_NAMESPACE, 'http://sporkmonger.com' + ).to_s).to eql('f2d04685-b787-55da-8644-9bd28a6f5a53') + end + + it "should correctly generate MD5 variant UUIDs" do + expect(UUIDTools::UUID.md5_create( + UUIDTools::UUID_URL_NAMESPACE, 'http://sporkmonger.com' + ).to_s).to eql('15074785-9071-3fe3-89bd-876e4b9e919b') + end + + it "should correctly generate timestamp variant UUIDs" do + expect(UUIDTools::UUID.timestamp_create).not_to be_random_node_id + expect(UUIDTools::UUID.timestamp_create.to_s).not_to eql( + UUIDTools::UUID.timestamp_create.to_s + ) + current_time = Time.now + expect(UUIDTools::UUID.timestamp_create(current_time).to_s).not_to eql( + UUIDTools::UUID.timestamp_create(current_time).to_s + ) + uuids = [] + 1000.times do + uuids << UUIDTools::UUID.timestamp_create + end + # Check to make sure that none of the 1,000 UUIDs were duplicates + expect((uuids.map {|x| x.to_s}).uniq.size).to eql(uuids.size) + end + + it "should correctly generate UUIDs without a MAC address" do + mac_address = UUIDTools::UUID.mac_address + UUIDTools::UUID.mac_address = nil + expect(UUIDTools::UUID.timestamp_create).to be_random_node_id + UUIDTools::UUID.mac_address = mac_address + end + + it "should correctly generate random number variant UUIDs" do + uuids = [] + 1000.times do + uuids << UUIDTools::UUID.random_create + end + # Check to make sure that none of the 1,000 UUIDs were duplicates + expect((uuids.map {|x| x.to_s}).uniq.size).to eql(uuids.size) + end + + it "should not have internal state used in string representations" do + uuid = UUIDTools::UUID.random_create + uuid_string = uuid.to_s.dup + uuid.to_s.gsub!("-", "/") + expect(uuid.to_s).to eql(uuid_string) + end + + it "should throw an exception if a segment has an invalid value" do + expect(lambda do + UUIDTools::UUID.new(-1, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]) + end).to raise_error(ArgumentError) + expect(lambda do + UUIDTools::UUID.new(4294967296, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]) + end).to raise_error(ArgumentError) + end + + it "should throw an exception if a segment has an invalid value" do + expect(lambda do + UUIDTools::UUID.new(0, -1, 0, 0, 0, [0, 0, 0, 0, 0, 0]) + end).to raise_error(ArgumentError) + expect(lambda do + UUIDTools::UUID.new(0, 65536, 0, 0, 0, [0, 0, 0, 0, 0, 0]) + end).to raise_error(ArgumentError) + end + + it "should throw an exception if a segment has an invalid value" do + expect(lambda do + UUIDTools::UUID.new(0, 0, -1, 0, 0, [0, 0, 0, 0, 0, 0]) + end).to raise_error(ArgumentError) + expect(lambda do + UUIDTools::UUID.new(0, 0, 65536, 0, 0, [0, 0, 0, 0, 0, 0]) + end).to raise_error(ArgumentError) + end + + it "should throw an exception if a segment has an invalid value" do + expect(lambda do + UUIDTools::UUID.new(0, 0, 0, -1, 0, [0, 0, 0, 0, 0, 0]) + end).to raise_error(ArgumentError) + expect(lambda do + UUIDTools::UUID.new(0, 0, 0, 256, 0, [0, 0, 0, 0, 0, 0]) + end).to raise_error(ArgumentError) + end + + it "should throw an exception if a segment has an invalid value" do + expect(lambda do + UUIDTools::UUID.new(0, 0, 0, 0, -1, [0, 0, 0, 0, 0, 0]) + end).to raise_error(ArgumentError) + expect(lambda do + UUIDTools::UUID.new(0, 0, 0, 0, 256, [0, 0, 0, 0, 0, 0]) + end).to raise_error(ArgumentError) + end + + it "should throw an exception if nodes are not a collection" do + expect(lambda do + UUIDTools::UUID.new(0, 0, 0, 0, 0, :bogus) + end).to raise_error(TypeError) + end + + it "should throw an exception if nodes are the wrong size" do + expect(lambda do + UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0]) + end).to raise_error(ArgumentError) + end + + it "should throw an exception if any nodes have invalid values" do + expect(lambda do + UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 256]) + end).to raise_error(ArgumentError) + end + + it "should throw an exception if parsing anything but a String" do + expect(lambda do + UUIDTools::UUID.parse(:bogus) + end).to raise_error(TypeError) + end + + it "should throw an exception if raw parsing anything but a String" do + expect(lambda do + UUIDTools::UUID.parse_raw(:bogus) + end).to raise_error(TypeError) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/spec/uuidtools/uuid_parsing_spec.rb b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/spec/uuidtools/uuid_parsing_spec.rb new file mode 100644 index 000000000..1d46d4c91 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/spec/uuidtools/uuid_parsing_spec.rb @@ -0,0 +1,128 @@ +require File.expand_path("../../spec_helper.rb", __FILE__) + +describe UUIDTools::UUID, "when parsing" do + it "should correctly parse the MAC address from a timestamp version UUID" do + expect(UUIDTools::UUID.timestamp_create.mac_address).to eql( + UUIDTools::UUID.mac_address + ) + end + + it "should correctly parse the variant from a timestamp version UUID" do + expect(UUIDTools::UUID.timestamp_create.variant).to eql(0b100) + end + + it "should correctly parse the version from a timestamp version UUID" do + expect(UUIDTools::UUID.timestamp_create.version).to eql(1) + end + + it "should correctly parse the timestamp from a timestamp version UUID" do + expect(UUIDTools::UUID.timestamp_create.timestamp).to be < (Time.now + 1) + expect(UUIDTools::UUID.timestamp_create.timestamp).to be > (Time.now - 1) + end + + it "should not treat a timestamp version UUID as a nil UUID" do + expect(UUIDTools::UUID.timestamp_create).not_to be_nil_uuid + end + + it "should not treat a timestamp version UUID as a random node UUID" do + expect(UUIDTools::UUID.timestamp_create).not_to be_random_node_id + end + + it "should treat a timestamp version UUID as a random node UUID " + + "if there is no MAC address" do + old_mac_address = UUIDTools::UUID.mac_address + UUIDTools::UUID.mac_address = nil + expect(UUIDTools::UUID.timestamp_create).to be_random_node_id + UUIDTools::UUID.mac_address = old_mac_address + end + + it "should correctly identify the nil UUID" do + expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])).to be_nil_uuid + end + + it "should correctly identify timestamp version UUIDs as valid" do + expect(UUIDTools::UUID.timestamp_create).to be_valid + end + + it "should correctly identify random number version UUIDs as valid" do + expect(UUIDTools::UUID.random_create).to be_valid + end + + it "should correctly identify SHA1 hash version UUIDs as valid" do + expect(UUIDTools::UUID.sha1_create( + UUIDTools::UUID_URL_NAMESPACE, 'http://sporkmonger.com' + )).to be_valid + end + + it "should correctly identify MD5 hash version UUIDs as valid" do + expect(UUIDTools::UUID.md5_create( + UUIDTools::UUID_URL_NAMESPACE, 'http://sporkmonger.com' + )).to be_valid + end + + it "should not identify the nil UUID as valid" do + expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])).not_to be_valid + end + + it "should allow for sorting of UUID arrays" do + uuids = [] + 1000.times do + uuids << UUIDTools::UUID.timestamp_create + end + uuids.sort! + expect(uuids.first).to be < uuids.last + expect(uuids.last).to be > uuids.first + end + + it "should allow for comparison of UUIDs" do + expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])).to be < + UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 1]) + expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 1])).to be > + UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]) + expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])).to eql( + UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])) + end + + it "should produce the correct hexdigest for a UUID" do + expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]).hexdigest).to eql( + '00000000000000000000000000000000') + expect(UUIDTools::UUID.new(1, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]).hexdigest).to eql( + '00000001000000000000000000000000') + expect(UUIDTools::UUID.timestamp_create.hexdigest.size).to eql(32) + end + + it "should produce a sane hash value for a UUID" do + uuid = UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]) + expect(uuid.to_i).to eql(0) + expect(uuid.hash).to be_kind_of(Fixnum) + end + + it "should produce the correct URI for a UUID" do + expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]).to_uri).to eql( + 'urn:uuid:00000000-0000-0000-0000-000000000000') + end + + it "should correctly test UUID equality" do + expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])).to eql( + UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0]) + ) + end + + it "should correctly parse integers" do + expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])).to eql( + UUIDTools::UUID.parse_int(0)) + expect(UUIDTools::UUID.parse_int(0)).to be_nil_uuid + uuid = UUIDTools::UUID.timestamp_create + expect(UUIDTools::UUID.parse_int(uuid.to_i)).to eql(uuid) + end + + it "should correctly parse hexdigests" do + expect(UUIDTools::UUID.new(0, 0, 0, 0, 0, [0, 0, 0, 0, 0, 0])).to eql( + UUIDTools::UUID.parse_hexdigest('00000000000000000000000000000000')) + expect(UUIDTools::UUID.parse_hexdigest( + '00000000000000000000000000000000' + )).to be_nil_uuid + uuid = UUIDTools::UUID.timestamp_create + expect(UUIDTools::UUID.parse_hexdigest(uuid.hexdigest)).to eql(uuid) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/tasks/benchmark.rake b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/tasks/benchmark.rake new file mode 100644 index 000000000..b88bf1276 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/tasks/benchmark.rake @@ -0,0 +1,38 @@ +task :benchmark do + require 'lib/uuidtools' + require 'benchmark' + + # Version 1 + result = Benchmark.measure do + 10000.times do + UUID.timestamp_create.to_s + end + end + puts "#{(10000.0 / result.real)} version 1 per second." + + # Version 3 + result = Benchmark.measure do + 10000.times do + UUID.md5_create(UUID_URL_NAMESPACE, + "http://www.ietf.org/rfc/rfc4122.txt").to_s + end + end + puts "#{(10000.0 / result.real)} version 3 per second." + + # Version 4 + result = Benchmark.measure do + 10000.times do + UUID.random_create.to_s + end + end + puts "#{(10000.0 / result.real)} version 4 per second." + + # Version 5 + result = Benchmark.measure do + 10000.times do + UUID.sha1_create(UUID_URL_NAMESPACE, + "http://www.ietf.org/rfc/rfc4122.txt").to_s + end + end + puts "#{(10000.0 / result.real)} version 5 per second." +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/tasks/gem.rake b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/tasks/gem.rake new file mode 100644 index 000000000..69d6030ce --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/tasks/gem.rake @@ -0,0 +1,86 @@ +require "rubygems/package_task" +require "rake" +require "rake/clean" + +CLOBBER.include("pkg") + +namespace :gem do + GEM_SPEC = Gem::Specification.new do |s| + s.name = PKG_NAME + s.version = PKG_VERSION + s.summary = PKG_SUMMARY + s.description = PKG_DESCRIPTION + + s.files = PKG_FILES.to_a + + s.extra_rdoc_files = %w( README.md ) + s.rdoc_options.concat ["--main", "README.md"] + + if !s.respond_to?(:add_development_dependency) + puts "Cannot build Gem with this version of RubyGems." + exit(1) + end + + s.add_development_dependency("rake", ">= 0.7.3") + s.add_development_dependency("rspec", ">= 2.9.0") + s.add_development_dependency("yard", ">= 0.8.2") + s.add_development_dependency("launchy", ">= 2.0.0") + + s.require_path = "lib" + + s.author = PKG_AUTHOR + s.email = PKG_AUTHOR_EMAIL + s.homepage = PKG_HOMEPAGE + end + + Gem::PackageTask.new(GEM_SPEC) do |p| + p.gem_spec = GEM_SPEC + p.need_tar = true + p.need_zip = true + end + + desc "Generates .gemspec file" + task :gemspec do + spec_string = GEM_SPEC.to_ruby + + begin + Thread.new { eval("$SAFE = 3\n#{spec_string}", binding) }.join + rescue + abort "unsafe gemspec: #{$!}" + else + File.open("#{GEM_SPEC.name}.gemspec", 'w') do |file| + file.write spec_string + end + end + end + + desc "Show information about the gem" + task :debug do + puts GEM_SPEC.to_ruby + end + + desc "Install the gem" + task :install => ["clobber", "gem:package"] do + sh "#{SUDO} gem install --local pkg/#{GEM_SPEC.full_name}" + end + + desc "Uninstall the gem" + task :uninstall do + installed_list = Gem.source_index.find_name(PKG_NAME) + if installed_list && + (installed_list.collect { |s| s.version.to_s}.include?(PKG_VERSION)) + sh( + "#{SUDO} gem uninstall --version '#{PKG_VERSION}' " + + "--ignore-dependencies --executables #{PKG_NAME}" + ) + end + end + + desc "Reinstall the gem" + task :reinstall => [:uninstall, :install] +end + +desc "Alias to gem:package" +task "gem" => "gem:package" + +task "gem:release" => "gem:gemspec" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/tasks/git.rake b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/tasks/git.rake new file mode 100644 index 000000000..8c318cb96 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/tasks/git.rake @@ -0,0 +1,40 @@ +namespace :git do + namespace :tag do + desc "List tags from the Git repository" + task :list do + tags = `git tag -l` + tags.gsub!("\r", "") + tags = tags.split("\n").sort {|a, b| b <=> a } + puts tags.join("\n") + end + + desc "Create a new tag in the Git repository" + task :create do + changelog = File.open("CHANGELOG", "r") { |file| file.read } + puts "-" * 80 + puts changelog + puts "-" * 80 + puts + + v = ENV["VERSION"] or abort "Must supply VERSION=x.y.z" + abort "Versions don't match #{v} vs #{PKG_VERSION}" if v != PKG_VERSION + + tag = "#{PKG_NAME}-#{PKG_VERSION}" + msg = "Release #{PKG_NAME}-#{PKG_VERSION}" + + existing_tags = `git tag -l #{PKG_NAME}-*`.split("\n") + if existing_tags.include?(tag) + warn("Tag already exists, deleting...") + unless system "git tag -d #{tag}" + abort "Tag deletion failed." + end + end + puts "Creating git tag '#{tag}'..." + unless system "git tag -a -m \"#{msg}\" #{tag}" + abort "Tag creation failed." + end + end + end +end + +task "gem:release" => "git:tag:create" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/tasks/metrics.rake b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/tasks/metrics.rake new file mode 100644 index 000000000..41fc5c2b9 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/tasks/metrics.rake @@ -0,0 +1,22 @@ +namespace :metrics do + task :lines do + lines, codelines, total_lines, total_codelines = 0, 0, 0, 0 + for file_name in FileList["lib/**/*.rb"] + f = File.open(file_name) + while line = f.gets + lines += 1 + next if line =~ /^\s*$/ + next if line =~ /^\s*#/ + codelines += 1 + end + puts "L: #{sprintf("%4d", lines)}, " + + "LOC #{sprintf("%4d", codelines)} | #{file_name}" + total_lines += lines + total_codelines += codelines + + lines, codelines = 0, 0 + end + + puts "Total: Lines #{total_lines}, LOC #{total_codelines}" + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/tasks/rspec.rake b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/tasks/rspec.rake new file mode 100644 index 000000000..7ae05dfd4 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/tasks/rspec.rake @@ -0,0 +1,55 @@ +require "rspec/core/rake_task" +require "rake/clean" + +CLOBBER.include("coverage", "specdoc") + +namespace :spec do + RSpec::Core::RakeTask.new(:rcov) do |t| + t.pattern = FileList['spec/**/*_spec.rb'] + t.rspec_opts = ['--color', '--format', 'documentation'] + + t.rcov_opts = [ + '--exclude', 'lib\\/compat', + '--exclude', 'spec', + '--exclude', '\\.rvm\\/gems', + '--exclude', '1\\.8\\/gems', + '--exclude', '1\\.9\\/gems', + '--exclude', '\\.rvm', + '--exclude', '\\/Library\\/Ruby' + ] + end + + RSpec::Core::RakeTask.new(:normal) do |t| + t.pattern = FileList['spec/**/*_spec.rb'].exclude(/compat/) + t.rspec_opts = ['--color', '--format', 'documentation'] + end + + RSpec::Core::RakeTask.new(:all) do |t| + t.pattern = FileList['spec/**/*_spec.rb'] + t.rspec_opts = ['--color', '--format', 'documentation'] + end + + desc "Generate HTML Specdocs for all specs" + RSpec::Core::RakeTask.new(:specdoc) do |t| + specdoc_path = File.expand_path( + File.join(File.dirname(__FILE__), '..', 'documentation') + ) + Dir.mkdir(specdoc_path) if !File.exist?(specdoc_path) + + output_file = File.join(specdoc_path, 'index.html') + t.pattern = FileList['spec/**/*_spec.rb'] + t.rspec_opts = ["--format", "\"html:#{output_file}\"", "--diff"] + t.fail_on_error = false + end + + namespace :rcov do + desc "Browse the code coverage report." + task :browse => "spec:rcov" do + require "launchy" + Launchy::Browser.run("coverage/index.html") + end + end +end + +desc "Alias to spec:normal" +task "spec" => "spec:normal" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/tasks/yard.rake b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/tasks/yard.rake new file mode 100644 index 000000000..b6daf26d5 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/tasks/yard.rake @@ -0,0 +1,22 @@ +require "rake" +require "rake/clean" + +CLOBBER.include("doc") + +require "yard" +require "yard/rake/yardoc_task" + +namespace :doc do + desc "Generate Yardoc documentation" + YARD::Rake::YardocTask.new do |yardoc| + yardoc.name = "yard" + yardoc.options = ["--verbose", "--markup", "markdown"] + yardoc.files = FileList[ + "lib/**/*.rb", "ext/**/*.c", + "README.md", "CHANGELOG.md", "LICENSE.txt" + ].exclude(/idna/) + end +end + +desc "Alias to doc:yard" +task "doc" => "doc:yard" diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/website/index.html b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/website/index.html new file mode 100644 index 000000000..f329ad351 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/gems/uuidtools-2.1.5/website/index.html @@ -0,0 +1,95 @@ + + + + + UUIDTools + + + +

    UUIDTools

    +
    +

    + A simple universally unique ID generation library. +

    + +

    + You know what to do: +

    +

    + sudo gem install uuidtools +

    +
    + + diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/blankslate-2.1.2.4.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/blankslate-2.1.2.4.gemspec new file mode 100644 index 000000000..2fe656919 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/blankslate-2.1.2.4.gemspec @@ -0,0 +1,33 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{blankslate} + s.version = "2.1.2.4" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Jim Weirich", "David Masover", "Jack Danger Canty"] + s.date = %q{2011-03-16} + s.email = %q{rubygems@6brand.com} + s.files = ["README", "Rakefile", "VERSION", "blankslate.gemspec", "lib/blankslate.rb", "spec/blankslate_spec.rb"] + s.homepage = %q{http://github.com/masover/blankslate} + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.7} + s.summary = %q{BlankSlate extracted from Builder.} + s.test_files = ["spec/blankslate_spec.rb"] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/childprocess-0.3.9.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/childprocess-0.3.9.gemspec new file mode 100644 index 000000000..6a509bd9d --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/childprocess-0.3.9.gemspec @@ -0,0 +1,41 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{childprocess} + s.version = "0.3.9" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Jari Bakken"] + s.date = %q{2013-03-02} + s.description = %q{This gem aims at being a simple and reliable solution for controlling external programs running in the background on any Ruby / OS combination.} + s.email = ["jari.bakken@gmail.com"] + s.files = [".document", ".gitignore", ".rspec", ".travis.yml", "Gemfile", "LICENSE", "README.md", "Rakefile", "childprocess.gemspec", "lib/childprocess.rb", "lib/childprocess/abstract_io.rb", "lib/childprocess/abstract_process.rb", "lib/childprocess/errors.rb", "lib/childprocess/jruby.rb", "lib/childprocess/jruby/io.rb", "lib/childprocess/jruby/process.rb", "lib/childprocess/jruby/pump.rb", "lib/childprocess/tools/generator.rb", "lib/childprocess/unix.rb", "lib/childprocess/unix/fork_exec_process.rb", "lib/childprocess/unix/io.rb", "lib/childprocess/unix/lib.rb", "lib/childprocess/unix/platform/i386-linux.rb", "lib/childprocess/unix/platform/i386-solaris.rb", "lib/childprocess/unix/platform/x86_64-linux.rb", "lib/childprocess/unix/platform/x86_64-macosx.rb", "lib/childprocess/unix/posix_spawn_process.rb", "lib/childprocess/unix/process.rb", "lib/childprocess/version.rb", "lib/childprocess/windows.rb", "lib/childprocess/windows/handle.rb", "lib/childprocess/windows/io.rb", "lib/childprocess/windows/lib.rb", "lib/childprocess/windows/process.rb", "lib/childprocess/windows/process_builder.rb", "lib/childprocess/windows/structs.rb", "spec/abstract_io_spec.rb", "spec/childprocess_spec.rb", "spec/io_spec.rb", "spec/jruby_spec.rb", "spec/pid_behavior.rb", "spec/spec_helper.rb", "spec/unix_spec.rb", "spec/windows_spec.rb"] + s.homepage = %q{http://github.com/jarib/childprocess} + s.require_paths = ["lib"] + s.rubyforge_project = %q{childprocess} + s.rubygems_version = %q{1.3.7} + s.summary = %q{This gem aims at being a simple and reliable solution for controlling external programs running in the background on any Ruby / OS combination.} + s.test_files = ["spec/abstract_io_spec.rb", "spec/childprocess_spec.rb", "spec/io_spec.rb", "spec/jruby_spec.rb", "spec/pid_behavior.rb", "spec/spec_helper.rb", "spec/unix_spec.rb", "spec/windows_spec.rb"] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_development_dependency(%q, [">= 2.0.0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, ["~> 0.9.2"]) + s.add_runtime_dependency(%q, ["~> 1.0", ">= 1.0.11"]) + else + s.add_dependency(%q, [">= 2.0.0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 0.9.2"]) + s.add_dependency(%q, ["~> 1.0", ">= 1.0.11"]) + end + else + s.add_dependency(%q, [">= 2.0.0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 0.9.2"]) + s.add_dependency(%q, ["~> 1.0", ">= 1.0.11"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/dropbox-sdk-1.6.5.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/dropbox-sdk-1.6.5.gemspec new file mode 100644 index 000000000..b9f6a7def --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/dropbox-sdk-1.6.5.gemspec @@ -0,0 +1,39 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{dropbox-sdk} + s.version = "1.6.5" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Dropbox, Inc."] + s.date = %q{2015-07-29} + s.description = %q{ A library that provides a plain function-call interface to the + Dropbox API web endpoints. +} + s.email = ["support-api@dropbox.com"] + s.files = ["CHANGELOG", "LICENSE", "README", "examples/chunked_upload.rb", "examples/cli_example.rb", "examples/copy_between_accounts.rb", "examples/dropbox_controller.rb", "examples/oauth1_upgrade.rb", "examples/search_cache.rb", "examples/web_file_browser.rb", "lib/dropbox_sdk.rb", "lib/trusted-certs.crt"] + s.homepage = %q{http://www.dropbox.com/developers/} + s.licenses = ["MIT"] + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.7} + s.summary = %q{Dropbox REST API Client.} + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 4 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, ["~> 4.3.2"]) + s.add_development_dependency(%q, [">= 0"]) + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 4.3.2"]) + s.add_dependency(%q, [">= 0"]) + end + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 4.3.2"]) + s.add_dependency(%q, [">= 0"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/em-ftpd-0.0.1.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/em-ftpd-0.0.1.gemspec new file mode 100644 index 000000000..2ff71116c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/em-ftpd-0.0.1.gemspec @@ -0,0 +1,56 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{em-ftpd} + s.version = "0.0.1" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["James Healy"] + s.date = %q{2011-11-18} + s.default_executable = %q{em-ftpd} + s.description = %q{Build a custom FTP daemon backed by a datastore of your choice} + s.email = ["jimmy@deefa.com"] + s.executables = ["em-ftpd"] + s.extra_rdoc_files = ["README.markdown", "MIT-LICENSE"] + s.files = ["bin/em-ftpd", "examples/fake.rb", "examples/redis.rb", "lib/em-ftpd.rb", "lib/em-ftpd/configurator.rb", "lib/em-ftpd/directories.rb", "lib/em-ftpd/app.rb", "lib/em-ftpd/passive_socket.rb", "lib/em-ftpd/active_socket.rb", "lib/em-ftpd/server.rb", "lib/em-ftpd/authentication.rb", "lib/em-ftpd/files.rb", "lib/em-ftpd/base_socket.rb", "lib/em-ftpd/directory_item.rb", "Gemfile", "README.markdown", "MIT-LICENSE"] + s.homepage = %q{http://github.com/yob/em-ftpd} + s.rdoc_options = ["--title", "EM::FTPd Documentation", "--main", "README.markdown", "-q"] + s.require_paths = ["lib"] + s.required_ruby_version = Gem::Requirement.new(">= 1.9.2") + s.rubygems_version = %q{1.3.7} + s.summary = %q{An FTP daemon framework} + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, ["~> 2.6"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_runtime_dependency(%q, ["~> 1.0.0.beta1"]) + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 2.6"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 1.0.0.beta1"]) + end + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 2.6"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 1.0.0.beta1"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/eventmachine-1.0.0.rc.4.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/eventmachine-1.0.0.rc.4.gemspec new file mode 100644 index 000000000..e0350dd7b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/eventmachine-1.0.0.rc.4.gemspec @@ -0,0 +1,46 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{eventmachine} + s.version = "1.0.0.rc.4" + + s.required_rubygems_version = Gem::Requirement.new("> 1.3.1") if s.respond_to? :required_rubygems_version= + s.authors = ["Francis Cianfrocca", "Aman Gupta"] + s.date = %q{2012-06-28} + s.description = %q{EventMachine implements a fast, single-threaded engine for arbitrary network +communications. It's extremely easy to use in Ruby. EventMachine wraps all +interactions with IP sockets, allowing programs to concentrate on the +implementation of network protocols. It can be used to create both network +servers and clients. To create a server or client, a Ruby program only needs +to specify the IP address and port, and provide a Module that implements the +communications protocol. Implementations of several standard network protocols +are provided with the package, primarily to serve as examples. The real goal +of EventMachine is to enable programs to easily interface with other programs +using TCP/IP, especially if custom protocols are required.} + s.email = ["garbagecat10@gmail.com", "aman@tmm1.net"] + s.extensions = ["ext/extconf.rb", "ext/fastfilereader/extconf.rb"] + s.extra_rdoc_files = ["README.md", "docs/DocumentationGuidesIndex.md", "docs/GettingStarted.md", "docs/old/ChangeLog", "docs/old/DEFERRABLES", "docs/old/EPOLL", "docs/old/INSTALL", "docs/old/KEYBOARD", "docs/old/LEGAL", "docs/old/LIGHTWEIGHT_CONCURRENCY", "docs/old/PURE_RUBY", "docs/old/RELEASE_NOTES", "docs/old/SMTP", "docs/old/SPAWNED_PROCESSES", "docs/old/TODO"] + s.files = [".gitignore", ".yardopts", "GNU", "Gemfile", "LICENSE", "README.md", "Rakefile", "docs/DocumentationGuidesIndex.md", "docs/GettingStarted.md", "docs/old/ChangeLog", "docs/old/DEFERRABLES", "docs/old/EPOLL", "docs/old/INSTALL", "docs/old/KEYBOARD", "docs/old/LEGAL", "docs/old/LIGHTWEIGHT_CONCURRENCY", "docs/old/PURE_RUBY", "docs/old/RELEASE_NOTES", "docs/old/SMTP", "docs/old/SPAWNED_PROCESSES", "docs/old/TODO", "eventmachine.gemspec", "examples/guides/getting_started/01_eventmachine_echo_server.rb", "examples/guides/getting_started/02_eventmachine_echo_server_that_recognizes_exit_command.rb", "examples/guides/getting_started/03_simple_chat_server.rb", "examples/guides/getting_started/04_simple_chat_server_step_one.rb", "examples/guides/getting_started/05_simple_chat_server_step_two.rb", "examples/guides/getting_started/06_simple_chat_server_step_three.rb", "examples/guides/getting_started/07_simple_chat_server_step_four.rb", "examples/guides/getting_started/08_simple_chat_server_step_five.rb", "examples/old/ex_channel.rb", "examples/old/ex_queue.rb", "examples/old/ex_tick_loop_array.rb", "examples/old/ex_tick_loop_counter.rb", "examples/old/helper.rb", "ext/binder.cpp", "ext/binder.h", "ext/cmain.cpp", "ext/ed.cpp", "ext/ed.h", "ext/em.cpp", "ext/em.h", "ext/eventmachine.h", "ext/extconf.rb", "ext/fastfilereader/extconf.rb", "ext/fastfilereader/mapper.cpp", "ext/fastfilereader/mapper.h", "ext/fastfilereader/rubymain.cpp", "ext/kb.cpp", "ext/page.cpp", "ext/page.h", "ext/pipe.cpp", "ext/project.h", "ext/rubymain.cpp", "ext/ssl.cpp", "ext/ssl.h", "java/.classpath", "java/.project", "java/src/com/rubyeventmachine/EmReactor.java", "java/src/com/rubyeventmachine/EmReactorException.java", "java/src/com/rubyeventmachine/EventableChannel.java", "java/src/com/rubyeventmachine/EventableDatagramChannel.java", "java/src/com/rubyeventmachine/EventableSocketChannel.java", "lib/em/buftok.rb", "lib/em/callback.rb", "lib/em/channel.rb", "lib/em/completion.rb", "lib/em/connection.rb", "lib/em/deferrable.rb", "lib/em/deferrable/pool.rb", "lib/em/file_watch.rb", "lib/em/future.rb", "lib/em/iterator.rb", "lib/em/messages.rb", "lib/em/pool.rb", "lib/em/process_watch.rb", "lib/em/processes.rb", "lib/em/protocols.rb", "lib/em/protocols/header_and_content.rb", "lib/em/protocols/httpclient.rb", "lib/em/protocols/httpclient2.rb", "lib/em/protocols/line_and_text.rb", "lib/em/protocols/line_protocol.rb", "lib/em/protocols/linetext2.rb", "lib/em/protocols/memcache.rb", "lib/em/protocols/object_protocol.rb", "lib/em/protocols/postgres3.rb", "lib/em/protocols/saslauth.rb", "lib/em/protocols/smtpclient.rb", "lib/em/protocols/smtpserver.rb", "lib/em/protocols/socks4.rb", "lib/em/protocols/stomp.rb", "lib/em/protocols/tcptest.rb", "lib/em/pure_ruby.rb", "lib/em/queue.rb", "lib/em/resolver.rb", "lib/em/spawnable.rb", "lib/em/streamer.rb", "lib/em/threaded_resource.rb", "lib/em/tick_loop.rb", "lib/em/timers.rb", "lib/em/version.rb", "lib/eventmachine.rb", "lib/jeventmachine.rb", "rakelib/cpp.rake_example", "rakelib/package.rake", "rakelib/test.rake", "tests/client.crt", "tests/client.key", "tests/em_test_helper.rb", "tests/test_attach.rb", "tests/test_basic.rb", "tests/test_channel.rb", "tests/test_completion.rb", "tests/test_connection_count.rb", "tests/test_defer.rb", "tests/test_deferrable.rb", "tests/test_epoll.rb", "tests/test_error_handler.rb", "tests/test_exc.rb", "tests/test_file_watch.rb", "tests/test_futures.rb", "tests/test_get_sock_opt.rb", "tests/test_handler_check.rb", "tests/test_hc.rb", "tests/test_httpclient.rb", "tests/test_httpclient2.rb", "tests/test_idle_connection.rb", "tests/test_inactivity_timeout.rb", "tests/test_kb.rb", "tests/test_ltp.rb", "tests/test_ltp2.rb", "tests/test_next_tick.rb", "tests/test_object_protocol.rb", "tests/test_pause.rb", "tests/test_pending_connect_timeout.rb", "tests/test_pool.rb", "tests/test_process_watch.rb", "tests/test_processes.rb", "tests/test_proxy_connection.rb", "tests/test_pure.rb", "tests/test_queue.rb", "tests/test_resolver.rb", "tests/test_running.rb", "tests/test_sasl.rb", "tests/test_send_file.rb", "tests/test_servers.rb", "tests/test_set_sock_opt.rb", "tests/test_shutdown_hooks.rb", "tests/test_smtpclient.rb", "tests/test_smtpserver.rb", "tests/test_spawn.rb", "tests/test_ssl_args.rb", "tests/test_ssl_methods.rb", "tests/test_ssl_verify.rb", "tests/test_threaded_resource.rb", "tests/test_tick_loop.rb", "tests/test_timers.rb", "tests/test_ud.rb", "tests/test_unbind_reason.rb"] + s.homepage = %q{http://rubyeventmachine.com} + s.rdoc_options = ["--title", "EventMachine", "--main", "README.md", "-x", "lib/em/version", "-x", "lib/jeventmachine"] + s.require_paths = ["lib"] + s.rubyforge_project = %q{eventmachine} + s.rubygems_version = %q{1.3.7} + s.summary = %q{Ruby/EventMachine library} + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_development_dependency(%q, ["~> 0.8.1"]) + s.add_development_dependency(%q, [">= 0.7.2"]) + else + s.add_dependency(%q, ["~> 0.8.1"]) + s.add_dependency(%q, [">= 0.7.2"]) + end + else + s.add_dependency(%q, ["~> 0.8.1"]) + s.add_dependency(%q, [">= 0.7.2"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/ffi-1.9.10.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/ffi-1.9.10.gemspec new file mode 100644 index 000000000..362804fef --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/ffi-1.9.10.gemspec @@ -0,0 +1,46 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{ffi} + s.version = "1.9.10" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Wayne Meissner"] + s.date = %q{2015-07-01} + s.description = %q{Ruby FFI library} + s.email = %q{wmeissner@gmail.com} + s.extensions = ["ext/ffi_c/extconf.rb"] + s.files = ["COPYING", "LICENSE", "README.md", "Rakefile", "ext/ffi_c/AbstractMemory.c", "ext/ffi_c/AbstractMemory.h", "ext/ffi_c/ArrayType.c", "ext/ffi_c/ArrayType.h", "ext/ffi_c/Buffer.c", "ext/ffi_c/Call.c", "ext/ffi_c/Call.h", "ext/ffi_c/ClosurePool.c", "ext/ffi_c/ClosurePool.h", "ext/ffi_c/DataConverter.c", "ext/ffi_c/DynamicLibrary.c", "ext/ffi_c/DynamicLibrary.h", "ext/ffi_c/Function.c", "ext/ffi_c/Function.h", "ext/ffi_c/FunctionInfo.c", "ext/ffi_c/LastError.c", "ext/ffi_c/LastError.h", "ext/ffi_c/LongDouble.c", "ext/ffi_c/LongDouble.h", "ext/ffi_c/MappedType.c", "ext/ffi_c/MappedType.h", "ext/ffi_c/MemoryPointer.c", "ext/ffi_c/MemoryPointer.h", "ext/ffi_c/MethodHandle.c", "ext/ffi_c/MethodHandle.h", "ext/ffi_c/Platform.c", "ext/ffi_c/Platform.h", "ext/ffi_c/Pointer.c", "ext/ffi_c/Pointer.h", "ext/ffi_c/Struct.c", "ext/ffi_c/Struct.h", "ext/ffi_c/StructByReference.c", "ext/ffi_c/StructByReference.h", "ext/ffi_c/StructByValue.c", "ext/ffi_c/StructByValue.h", "ext/ffi_c/StructLayout.c", "ext/ffi_c/Thread.c", "ext/ffi_c/Thread.h", "ext/ffi_c/Type.c", "ext/ffi_c/Type.h", "ext/ffi_c/Types.c", "ext/ffi_c/Types.h", "ext/ffi_c/Variadic.c", "ext/ffi_c/compat.h", "ext/ffi_c/extconf.rb", "ext/ffi_c/ffi.c", "ext/ffi_c/libffi.bsd.mk", "ext/ffi_c/libffi.darwin.mk", "ext/ffi_c/libffi.gnu.mk", "ext/ffi_c/libffi.mk", "ext/ffi_c/libffi.vc.mk", "ext/ffi_c/libffi.vc64.mk", "ext/ffi_c/libffi/ChangeLog", "ext/ffi_c/libffi/ChangeLog.libffi", "ext/ffi_c/libffi/ChangeLog.libgcj", "ext/ffi_c/libffi/ChangeLog.v1", "ext/ffi_c/libffi/LICENSE", "ext/ffi_c/libffi/Makefile.am", "ext/ffi_c/libffi/Makefile.in", "ext/ffi_c/libffi/Makefile.vc", "ext/ffi_c/libffi/Makefile.vc64", "ext/ffi_c/libffi/README", "ext/ffi_c/libffi/acinclude.m4", "ext/ffi_c/libffi/aclocal.m4", "ext/ffi_c/libffi/build-ios.sh", "ext/ffi_c/libffi/compile", "ext/ffi_c/libffi/config.guess", "ext/ffi_c/libffi/config.sub", "ext/ffi_c/libffi/configure", "ext/ffi_c/libffi/configure.ac", "ext/ffi_c/libffi/configure.host", "ext/ffi_c/libffi/depcomp", "ext/ffi_c/libffi/doc/libffi.info", "ext/ffi_c/libffi/doc/libffi.texi", "ext/ffi_c/libffi/doc/stamp-vti", "ext/ffi_c/libffi/doc/version.texi", "ext/ffi_c/libffi/fficonfig.h.in", "ext/ffi_c/libffi/fficonfig.hw", "ext/ffi_c/libffi/include/Makefile.am", "ext/ffi_c/libffi/include/Makefile.in", "ext/ffi_c/libffi/include/ffi.h.in", "ext/ffi_c/libffi/include/ffi.h.vc", "ext/ffi_c/libffi/include/ffi.h.vc64", "ext/ffi_c/libffi/include/ffi_common.h", "ext/ffi_c/libffi/install-sh", "ext/ffi_c/libffi/libffi.pc.in", "ext/ffi_c/libffi/libtool-version", "ext/ffi_c/libffi/ltmain.sh", "ext/ffi_c/libffi/m4/ax_cc_maxopt.m4", "ext/ffi_c/libffi/m4/ax_cflags_warn_all.m4", "ext/ffi_c/libffi/m4/ax_check_compiler_flags.m4", "ext/ffi_c/libffi/m4/ax_compiler_vendor.m4", "ext/ffi_c/libffi/m4/ax_configure_args.m4", "ext/ffi_c/libffi/m4/ax_enable_builddir.m4", "ext/ffi_c/libffi/m4/ax_gcc_archflag.m4", "ext/ffi_c/libffi/m4/ax_gcc_x86_cpuid.m4", "ext/ffi_c/libffi/m4/libtool.m4", "ext/ffi_c/libffi/m4/ltoptions.m4", "ext/ffi_c/libffi/m4/ltsugar.m4", "ext/ffi_c/libffi/m4/ltversion.m4", "ext/ffi_c/libffi/m4/lt~obsolete.m4", "ext/ffi_c/libffi/man/Makefile.am", "ext/ffi_c/libffi/man/Makefile.in", "ext/ffi_c/libffi/man/ffi.3", "ext/ffi_c/libffi/man/ffi_call.3", "ext/ffi_c/libffi/man/ffi_prep_cif.3", "ext/ffi_c/libffi/mdate-sh", "ext/ffi_c/libffi/missing", "ext/ffi_c/libffi/msvcc.sh", "ext/ffi_c/libffi/src/alpha/ffi.c", "ext/ffi_c/libffi/src/alpha/ffitarget.h", "ext/ffi_c/libffi/src/alpha/osf.S", "ext/ffi_c/libffi/src/arm/ffi.c", "ext/ffi_c/libffi/src/arm/ffitarget.h", "ext/ffi_c/libffi/src/arm/gentramp.sh", "ext/ffi_c/libffi/src/arm/sysv.S", "ext/ffi_c/libffi/src/arm/trampoline.S", "ext/ffi_c/libffi/src/avr32/ffi.c", "ext/ffi_c/libffi/src/avr32/ffitarget.h", "ext/ffi_c/libffi/src/avr32/sysv.S", "ext/ffi_c/libffi/src/closures.c", "ext/ffi_c/libffi/src/cris/ffi.c", "ext/ffi_c/libffi/src/cris/ffitarget.h", "ext/ffi_c/libffi/src/cris/sysv.S", "ext/ffi_c/libffi/src/debug.c", "ext/ffi_c/libffi/src/dlmalloc.c", "ext/ffi_c/libffi/src/frv/eabi.S", "ext/ffi_c/libffi/src/frv/ffi.c", "ext/ffi_c/libffi/src/frv/ffitarget.h", "ext/ffi_c/libffi/src/ia64/ffi.c", "ext/ffi_c/libffi/src/ia64/ffitarget.h", "ext/ffi_c/libffi/src/ia64/ia64_flags.h", "ext/ffi_c/libffi/src/ia64/unix.S", "ext/ffi_c/libffi/src/java_raw_api.c", "ext/ffi_c/libffi/src/m32r/ffi.c", "ext/ffi_c/libffi/src/m32r/ffitarget.h", "ext/ffi_c/libffi/src/m32r/sysv.S", "ext/ffi_c/libffi/src/m68k/ffi.c", "ext/ffi_c/libffi/src/m68k/ffitarget.h", "ext/ffi_c/libffi/src/m68k/sysv.S", "ext/ffi_c/libffi/src/mips/ffi.c", "ext/ffi_c/libffi/src/mips/ffitarget.h", "ext/ffi_c/libffi/src/mips/n32.S", "ext/ffi_c/libffi/src/mips/o32.S", "ext/ffi_c/libffi/src/moxie/eabi.S", "ext/ffi_c/libffi/src/moxie/ffi.c", "ext/ffi_c/libffi/src/pa/ffi.c", "ext/ffi_c/libffi/src/pa/ffitarget.h", "ext/ffi_c/libffi/src/pa/hpux32.S", "ext/ffi_c/libffi/src/pa/linux.S", "ext/ffi_c/libffi/src/powerpc/aix.S", "ext/ffi_c/libffi/src/powerpc/aix_closure.S", "ext/ffi_c/libffi/src/powerpc/asm.h", "ext/ffi_c/libffi/src/powerpc/darwin.S", "ext/ffi_c/libffi/src/powerpc/darwin_closure.S", "ext/ffi_c/libffi/src/powerpc/ffi.c", "ext/ffi_c/libffi/src/powerpc/ffi_darwin.c", "ext/ffi_c/libffi/src/powerpc/ffitarget.h", "ext/ffi_c/libffi/src/powerpc/linux64.S", "ext/ffi_c/libffi/src/powerpc/linux64_closure.S", "ext/ffi_c/libffi/src/powerpc/ppc_closure.S", "ext/ffi_c/libffi/src/powerpc/sysv.S", "ext/ffi_c/libffi/src/prep_cif.c", "ext/ffi_c/libffi/src/raw_api.c", "ext/ffi_c/libffi/src/s390/ffi.c", "ext/ffi_c/libffi/src/s390/ffitarget.h", "ext/ffi_c/libffi/src/s390/sysv.S", "ext/ffi_c/libffi/src/sh/ffi.c", "ext/ffi_c/libffi/src/sh/ffitarget.h", "ext/ffi_c/libffi/src/sh/sysv.S", "ext/ffi_c/libffi/src/sh64/ffi.c", "ext/ffi_c/libffi/src/sh64/ffitarget.h", "ext/ffi_c/libffi/src/sh64/sysv.S", "ext/ffi_c/libffi/src/sparc/ffi.c", "ext/ffi_c/libffi/src/sparc/ffitarget.h", "ext/ffi_c/libffi/src/sparc/v8.S", "ext/ffi_c/libffi/src/sparc/v9.S", "ext/ffi_c/libffi/src/types.c", "ext/ffi_c/libffi/src/x86/darwin.S", "ext/ffi_c/libffi/src/x86/darwin64.S", "ext/ffi_c/libffi/src/x86/ffi.c", "ext/ffi_c/libffi/src/x86/ffi64.c", "ext/ffi_c/libffi/src/x86/ffitarget.h", "ext/ffi_c/libffi/src/x86/freebsd.S", "ext/ffi_c/libffi/src/x86/sysv.S", "ext/ffi_c/libffi/src/x86/unix64.S", "ext/ffi_c/libffi/src/x86/win32.S", "ext/ffi_c/libffi/src/x86/win64.S", "ext/ffi_c/libffi/testsuite/Makefile.am", "ext/ffi_c/libffi/testsuite/Makefile.in", "ext/ffi_c/libffi/testsuite/config/default.exp", "ext/ffi_c/libffi/testsuite/lib/libffi-dg.exp", "ext/ffi_c/libffi/testsuite/lib/libffi.exp", "ext/ffi_c/libffi/testsuite/lib/target-libpath.exp", "ext/ffi_c/libffi/testsuite/lib/wrapper.exp", "ext/ffi_c/libffi/testsuite/libffi.call/call.exp", "ext/ffi_c/libffi/testsuite/libffi.call/closure_fn0.c", "ext/ffi_c/libffi/testsuite/libffi.call/closure_fn1.c", "ext/ffi_c/libffi/testsuite/libffi.call/closure_fn2.c", "ext/ffi_c/libffi/testsuite/libffi.call/closure_fn3.c", "ext/ffi_c/libffi/testsuite/libffi.call/closure_fn4.c", "ext/ffi_c/libffi/testsuite/libffi.call/closure_fn5.c", "ext/ffi_c/libffi/testsuite/libffi.call/closure_fn6.c", "ext/ffi_c/libffi/testsuite/libffi.call/closure_loc_fn0.c", "ext/ffi_c/libffi/testsuite/libffi.call/closure_stdcall.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_12byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_16byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_18byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_19byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_1_1byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_20byte1.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_24byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_2byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_3_1byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte1.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_3byte2.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_4_1byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_4byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_5_1_byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_5byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_64byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_6_1_byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_6byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_7_1_byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_7byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_8byte.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte1.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_9byte2.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_align_double.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_align_float.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_align_longdouble_split2.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_align_pointer.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint16.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint32.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_align_sint64.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint16.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint32.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_align_uint64.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_dbls_struct.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_double.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_double_va.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_float.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_longdouble_va.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_schar.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshort.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_sshortchar.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_uchar.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushort.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_multi_ushortchar.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_pointer_stack.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_schar.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_sint.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_sshort.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_uchar.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_uint.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_ulonglong.c", "ext/ffi_c/libffi/testsuite/libffi.call/cls_ushort.c", "ext/ffi_c/libffi/testsuite/libffi.call/err_bad_abi.c", "ext/ffi_c/libffi/testsuite/libffi.call/err_bad_typedef.c", "ext/ffi_c/libffi/testsuite/libffi.call/ffitest.h", "ext/ffi_c/libffi/testsuite/libffi.call/float.c", "ext/ffi_c/libffi/testsuite/libffi.call/float1.c", "ext/ffi_c/libffi/testsuite/libffi.call/float2.c", "ext/ffi_c/libffi/testsuite/libffi.call/float3.c", "ext/ffi_c/libffi/testsuite/libffi.call/float4.c", "ext/ffi_c/libffi/testsuite/libffi.call/huge_struct.c", "ext/ffi_c/libffi/testsuite/libffi.call/many.c", "ext/ffi_c/libffi/testsuite/libffi.call/many_win32.c", "ext/ffi_c/libffi/testsuite/libffi.call/negint.c", "ext/ffi_c/libffi/testsuite/libffi.call/nested_struct.c", "ext/ffi_c/libffi/testsuite/libffi.call/nested_struct1.c", "ext/ffi_c/libffi/testsuite/libffi.call/nested_struct10.c", "ext/ffi_c/libffi/testsuite/libffi.call/nested_struct2.c", "ext/ffi_c/libffi/testsuite/libffi.call/nested_struct3.c", "ext/ffi_c/libffi/testsuite/libffi.call/nested_struct4.c", "ext/ffi_c/libffi/testsuite/libffi.call/nested_struct5.c", "ext/ffi_c/libffi/testsuite/libffi.call/nested_struct6.c", "ext/ffi_c/libffi/testsuite/libffi.call/nested_struct7.c", "ext/ffi_c/libffi/testsuite/libffi.call/nested_struct8.c", "ext/ffi_c/libffi/testsuite/libffi.call/nested_struct9.c", "ext/ffi_c/libffi/testsuite/libffi.call/problem1.c", "ext/ffi_c/libffi/testsuite/libffi.call/promotion.c", "ext/ffi_c/libffi/testsuite/libffi.call/pyobjc-tc.c", "ext/ffi_c/libffi/testsuite/libffi.call/return_dbl.c", "ext/ffi_c/libffi/testsuite/libffi.call/return_dbl1.c", "ext/ffi_c/libffi/testsuite/libffi.call/return_dbl2.c", "ext/ffi_c/libffi/testsuite/libffi.call/return_fl.c", "ext/ffi_c/libffi/testsuite/libffi.call/return_fl1.c", "ext/ffi_c/libffi/testsuite/libffi.call/return_fl2.c", "ext/ffi_c/libffi/testsuite/libffi.call/return_fl3.c", "ext/ffi_c/libffi/testsuite/libffi.call/return_ldl.c", "ext/ffi_c/libffi/testsuite/libffi.call/return_ll.c", "ext/ffi_c/libffi/testsuite/libffi.call/return_ll1.c", "ext/ffi_c/libffi/testsuite/libffi.call/return_sc.c", "ext/ffi_c/libffi/testsuite/libffi.call/return_sl.c", "ext/ffi_c/libffi/testsuite/libffi.call/return_uc.c", "ext/ffi_c/libffi/testsuite/libffi.call/return_ul.c", "ext/ffi_c/libffi/testsuite/libffi.call/stret_large.c", "ext/ffi_c/libffi/testsuite/libffi.call/stret_large2.c", "ext/ffi_c/libffi/testsuite/libffi.call/stret_medium.c", "ext/ffi_c/libffi/testsuite/libffi.call/stret_medium2.c", "ext/ffi_c/libffi/testsuite/libffi.call/strlen.c", "ext/ffi_c/libffi/testsuite/libffi.call/strlen_win32.c", "ext/ffi_c/libffi/testsuite/libffi.call/struct1.c", "ext/ffi_c/libffi/testsuite/libffi.call/struct2.c", "ext/ffi_c/libffi/testsuite/libffi.call/struct3.c", "ext/ffi_c/libffi/testsuite/libffi.call/struct4.c", "ext/ffi_c/libffi/testsuite/libffi.call/struct5.c", "ext/ffi_c/libffi/testsuite/libffi.call/struct6.c", "ext/ffi_c/libffi/testsuite/libffi.call/struct7.c", "ext/ffi_c/libffi/testsuite/libffi.call/struct8.c", "ext/ffi_c/libffi/testsuite/libffi.call/struct9.c", "ext/ffi_c/libffi/testsuite/libffi.call/testclosure.c", "ext/ffi_c/libffi/testsuite/libffi.special/ffitestcxx.h", "ext/ffi_c/libffi/testsuite/libffi.special/special.exp", "ext/ffi_c/libffi/testsuite/libffi.special/unwindtest.cc", "ext/ffi_c/libffi/testsuite/libffi.special/unwindtest_ffi_call.cc", "ext/ffi_c/libffi/texinfo.tex", "ext/ffi_c/rbffi.h", "ext/ffi_c/rbffi_endian.h", "ext/ffi_c/win32/stdbool.h", "ext/ffi_c/win32/stdint.h", "ffi.gemspec", "gen/Rakefile", "lib/ffi.rb", "lib/ffi/autopointer.rb", "lib/ffi/buffer.rb", "lib/ffi/callback.rb", "lib/ffi/enum.rb", "lib/ffi/errno.rb", "lib/ffi/ffi.rb", "lib/ffi/io.rb", "lib/ffi/library.rb", "lib/ffi/managedstruct.rb", "lib/ffi/memorypointer.rb", "lib/ffi/platform.rb", "lib/ffi/platform/aarch64-linux/types.conf", "lib/ffi/platform/arm-linux/types.conf", "lib/ffi/platform/i386-cygwin/types.conf", "lib/ffi/platform/i386-darwin/types.conf", "lib/ffi/platform/i386-freebsd/types.conf", "lib/ffi/platform/i386-gnu/types.conf", "lib/ffi/platform/i386-linux/types.conf", "lib/ffi/platform/i386-netbsd/types.conf", "lib/ffi/platform/i386-openbsd/types.conf", "lib/ffi/platform/i386-solaris/types.conf", "lib/ffi/platform/i386-windows/types.conf", "lib/ffi/platform/ia64-linux/types.conf", "lib/ffi/platform/mips-linux/types.conf", "lib/ffi/platform/mips64el-linux/types.conf", "lib/ffi/platform/mipsel-linux/types.conf", "lib/ffi/platform/powerpc-aix/types.conf", "lib/ffi/platform/powerpc-darwin/types.conf", "lib/ffi/platform/powerpc-linux/types.conf", "lib/ffi/platform/powerpc64-linux/types.conf", "lib/ffi/platform/s390-linux/types.conf", "lib/ffi/platform/s390x-linux/types.conf", "lib/ffi/platform/sparc-linux/types.conf", "lib/ffi/platform/sparc-solaris/types.conf", "lib/ffi/platform/sparcv9-solaris/types.conf", "lib/ffi/platform/x86_64-cygwin/types.conf", "lib/ffi/platform/x86_64-darwin/types.conf", "lib/ffi/platform/x86_64-freebsd/types.conf", "lib/ffi/platform/x86_64-linux/types.conf", "lib/ffi/platform/x86_64-netbsd/types.conf", "lib/ffi/platform/x86_64-openbsd/types.conf", "lib/ffi/platform/x86_64-solaris/types.conf", "lib/ffi/platform/x86_64-windows/types.conf", "lib/ffi/pointer.rb", "lib/ffi/struct.rb", "lib/ffi/struct_layout_builder.rb", "lib/ffi/tools/const_generator.rb", "lib/ffi/tools/generator.rb", "lib/ffi/tools/generator_task.rb", "lib/ffi/tools/struct_generator.rb", "lib/ffi/tools/types_generator.rb", "lib/ffi/types.rb", "lib/ffi/union.rb", "lib/ffi/variadic.rb", "lib/ffi/version.rb", "libtest/Benchmark.c", "libtest/BoolTest.c", "libtest/BufferTest.c", "libtest/ClosureTest.c", "libtest/EnumTest.c", "libtest/FunctionTest.c", "libtest/GNUmakefile", "libtest/GlobalVariable.c", "libtest/LastErrorTest.c", "libtest/NumberTest.c", "libtest/PointerTest.c", "libtest/ReferenceTest.c", "libtest/StringTest.c", "libtest/StructTest.c", "libtest/UnionTest.c", "libtest/VariadicTest.c", "spec/ffi/LICENSE.SPECS", "spec/ffi/async_callback_spec.rb", "spec/ffi/bool_spec.rb", "spec/ffi/buffer_spec.rb", "spec/ffi/callback_spec.rb", "spec/ffi/custom_param_type.rb", "spec/ffi/custom_type_spec.rb", "spec/ffi/dup_spec.rb", "spec/ffi/enum_spec.rb", "spec/ffi/errno_spec.rb", "spec/ffi/ffi_spec.rb", "spec/ffi/fixtures/Benchmark.c", "spec/ffi/fixtures/BoolTest.c", "spec/ffi/fixtures/BufferTest.c", "spec/ffi/fixtures/ClosureTest.c", "spec/ffi/fixtures/EnumTest.c", "spec/ffi/fixtures/FunctionTest.c", "spec/ffi/fixtures/GNUmakefile", "spec/ffi/fixtures/GlobalVariable.c", "spec/ffi/fixtures/LastErrorTest.c", "spec/ffi/fixtures/NumberTest.c", "spec/ffi/fixtures/PointerTest.c", "spec/ffi/fixtures/ReferenceTest.c", "spec/ffi/fixtures/StringTest.c", "spec/ffi/fixtures/StructTest.c", "spec/ffi/fixtures/UnionTest.c", "spec/ffi/fixtures/VariadicTest.c", "spec/ffi/fixtures/classes.rb", "spec/ffi/function_spec.rb", "spec/ffi/io_spec.rb", "spec/ffi/library_spec.rb", "spec/ffi/long_double.rb", "spec/ffi/managed_struct_spec.rb", "spec/ffi/memorypointer_spec.rb", "spec/ffi/number_spec.rb", "spec/ffi/platform_spec.rb", "spec/ffi/pointer_spec.rb", "spec/ffi/rbx/attach_function_spec.rb", "spec/ffi/rbx/memory_pointer_spec.rb", "spec/ffi/rbx/spec_helper.rb", "spec/ffi/rbx/struct_spec.rb", "spec/ffi/spec_helper.rb", "spec/ffi/string_spec.rb", "spec/ffi/strptr_spec.rb", "spec/ffi/struct_by_ref_spec.rb", "spec/ffi/struct_callback_spec.rb", "spec/ffi/struct_initialize_spec.rb", "spec/ffi/struct_packed_spec.rb", "spec/ffi/struct_spec.rb", "spec/ffi/typedef_spec.rb", "spec/ffi/union_spec.rb", "spec/ffi/variadic_spec.rb", "spec/spec.opts"] + s.homepage = %q{http://wiki.github.com/ffi/ffi} + s.licenses = ["BSD"] + s.rdoc_options = ["--exclude=ext/ffi_c/.*\\.o$", "--exclude=ffi_c\\.(bundle|so)$"] + s.require_paths = ["lib"] + s.required_ruby_version = Gem::Requirement.new(">= 1.8.7") + s.rubygems_version = %q{1.3.7} + s.summary = %q{Ruby FFI} + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 4 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_development_dependency(%q, ["~> 10.1"]) + s.add_development_dependency(%q, ["~> 0.9"]) + s.add_development_dependency(%q, ["~> 0.4.0"]) + s.add_development_dependency(%q, ["~> 2.14.1"]) + s.add_development_dependency(%q, ["~> 0.2.4"]) + else + s.add_dependency(%q, ["~> 10.1"]) + s.add_dependency(%q, ["~> 0.9"]) + s.add_dependency(%q, ["~> 0.4.0"]) + s.add_dependency(%q, ["~> 2.14.1"]) + s.add_dependency(%q, ["~> 0.2.4"]) + end + else + s.add_dependency(%q, ["~> 10.1"]) + s.add_dependency(%q, ["~> 0.9"]) + s.add_dependency(%q, ["~> 0.4.0"]) + s.add_dependency(%q, ["~> 2.14.1"]) + s.add_dependency(%q, ["~> 0.2.4"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/forwardablex-0.1.4.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/forwardablex-0.1.4.gemspec new file mode 100644 index 000000000..72eb2090c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/forwardablex-0.1.4.gemspec @@ -0,0 +1,40 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{forwardablex} + s.version = "0.1.4" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Keita Yamaguchi"] + s.date = %q{2013-05-03} + s.description = %q{This is a library to extend Forwardable functions} + s.email = ["keita.yamaguchi@gmail.com"] + s.files = [".gitignore", ".travis.yml", "Gemfile", "HISTORY.md", "LICENSE.txt", "README.md", "Rakefile", "forwardablex.gemspec", "lib/forwardablex.rb", "lib/forwardablex/version.rb", "test/spec_forwardablex.rb"] + s.homepage = %q{https://github.com/keita/forwardablex} + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.7} + s.summary = %q{Forwardable extension} + s.test_files = ["test/spec_forwardablex.rb"] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/hamster-0.4.3.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/hamster-0.4.3.gemspec new file mode 100644 index 000000000..87f34c10a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/hamster-0.4.3.gemspec @@ -0,0 +1,35 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{hamster} + s.version = "0.4.3" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Simon Harris"] + s.date = %q{2012-10-01} + s.description = %q{Efficient, Immutable, Thread-Safe Collection classes for Ruby} + s.email = %q{haruki_zaemon@mac.com} + s.extra_rdoc_files = ["README.rdoc", "History.rdoc", "LICENSE"] + s.files = ["lib/hamster/core_ext/enumerable.rb", "lib/hamster/core_ext/enumerator.rb", "lib/hamster/core_ext/io.rb", "lib/hamster/core_ext.rb", "lib/hamster/enumerable.rb", "lib/hamster/experimental/mutable_hash.rb", "lib/hamster/experimental/mutable_queue.rb", "lib/hamster/experimental/mutable_set.rb", "lib/hamster/experimental/mutable_stack.rb", "lib/hamster/experimental/read_copy_update.rb", "lib/hamster/hash.rb", "lib/hamster/immutable.rb", "lib/hamster/list.rb", "lib/hamster/queue.rb", "lib/hamster/set.rb", "lib/hamster/sorter.rb", "lib/hamster/stack.rb", "lib/hamster/trie.rb", "lib/hamster/tuple.rb", "lib/hamster/undefined.rb", "lib/hamster/vector.rb", "lib/hamster/version.rb", "lib/hamster.rb", "spec/hamster/core_ext/array_spec.rb", "spec/hamster/core_ext/coverage/assets/0.4.4/app.js", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/blank.gif", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_close.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_loading.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_nav_left.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_nav_right.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_e.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_n.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_ne.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_nw.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_s.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_se.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_sw.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_shadow_w.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_title_left.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_title_main.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_title_over.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancy_title_right.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancybox-x.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancybox-y.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/fancybox.png", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.css", "spec/hamster/core_ext/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.pack.js", "spec/hamster/core_ext/coverage/assets/0.4.4/favicon.png", "spec/hamster/core_ext/coverage/assets/0.4.4/jquery-1.4.2.min.js", "spec/hamster/core_ext/coverage/assets/0.4.4/jquery.dataTables.min.js", "spec/hamster/core_ext/coverage/assets/0.4.4/jquery.timeago.js", "spec/hamster/core_ext/coverage/assets/0.4.4/jquery.url.js", "spec/hamster/core_ext/coverage/assets/0.4.4/loading.gif", "spec/hamster/core_ext/coverage/assets/0.4.4/magnify.png", "spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png", "spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_75_ffffff_40x100.png", "spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png", "spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_65_ffffff_1x400.png", "spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_dadada_1x400.png", "spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png", "spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png", "spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png", "spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_222222_256x240.png", "spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_2e83ff_256x240.png", "spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_454545_256x240.png", "spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_888888_256x240.png", "spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/images/ui-icons_cd0a0a_256x240.png", "spec/hamster/core_ext/coverage/assets/0.4.4/smoothness/jquery-ui-1.8.4.custom.css", "spec/hamster/core_ext/coverage/assets/0.4.4/stylesheet.css", "spec/hamster/core_ext/coverage/covered_percent", "spec/hamster/core_ext/coverage/index.html", "spec/hamster/core_ext/coverage/resultset.yml", "spec/hamster/core_ext/enumerable_spec.rb", "spec/hamster/core_ext/enumerator_spec.rb", "spec/hamster/core_ext/io_spec.rb", "spec/hamster/core_ext/io_spec.txt", "spec/hamster/experimental/mutable_set/add?_spec.rb", "spec/hamster/experimental/mutable_set/add_spec.rb", "spec/hamster/experimental/mutable_set/delete?_spec.rb", "spec/hamster/experimental/mutable_set/delete_spec.rb", "spec/hamster/experimental/mutable_stack/pop_spec.rb", "spec/hamster/experimental/mutable_stack/push_spec.rb", "spec/hamster/hash/all_spec.rb", "spec/hamster/hash/any_spec.rb", "spec/hamster/hash/clear_spec.rb", "spec/hamster/hash/construction_spec.rb", "spec/hamster/hash/copying_spec.rb", "spec/hamster/hash/delete_spec.rb", "spec/hamster/hash/each_spec.rb", "spec/hamster/hash/empty_spec.rb", "spec/hamster/hash/eql_spec.rb", "spec/hamster/hash/except_spec.rb", "spec/hamster/hash/fetch_spec.rb", "spec/hamster/hash/filter_spec.rb", "spec/hamster/hash/find_spec.rb", "spec/hamster/hash/get_spec.rb", "spec/hamster/hash/has_key_spec.rb", "spec/hamster/hash/hash_spec.rb", "spec/hamster/hash/immutable_spec.rb", "spec/hamster/hash/inspect_spec.rb", "spec/hamster/hash/keys_spec.rb", "spec/hamster/hash/map_spec.rb", "spec/hamster/hash/merge_spec.rb", "spec/hamster/hash/none_spec.rb", "spec/hamster/hash/put_spec.rb", "spec/hamster/hash/reduce_spec.rb", "spec/hamster/hash/remove_spec.rb", "spec/hamster/hash/size_spec.rb", "spec/hamster/hash/slice_spec.rb", "spec/hamster/hash/uniq_spec.rb", "spec/hamster/hash/values_spec.rb", "spec/hamster/immutable/copying_spec.rb", "spec/hamster/immutable/immutable_spec.rb", "spec/hamster/immutable/memoize_spec.rb", "spec/hamster/immutable/new_spec.rb", "spec/hamster/immutable/transform_spec.rb", "spec/hamster/immutable/transform_unless_spec.rb", "spec/hamster/list/all_spec.rb", "spec/hamster/list/any_spec.rb", "spec/hamster/list/append_spec.rb", "spec/hamster/list/at_spec.rb", "spec/hamster/list/break_spec.rb", "spec/hamster/list/cadr_spec.rb", "spec/hamster/list/chunk_spec.rb", "spec/hamster/list/clear_spec.rb", "spec/hamster/list/combinations_spec.rb", "spec/hamster/list/compact_spec.rb", "spec/hamster/list/cons_spec.rb", "spec/hamster/list/construction_spec.rb", "spec/hamster/list/copying_spec.rb", "spec/hamster/list/count_spec.rb", "spec/hamster/list/coverage/assets/0.4.4/app.js", "spec/hamster/list/coverage/assets/0.4.4/fancybox/blank.gif", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_close.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_loading.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_nav_left.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_nav_right.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_e.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_n.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_ne.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_nw.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_s.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_se.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_sw.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_shadow_w.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_title_left.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_title_main.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_title_over.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancy_title_right.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancybox-x.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancybox-y.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/fancybox.png", "spec/hamster/list/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.css", "spec/hamster/list/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.pack.js", "spec/hamster/list/coverage/assets/0.4.4/favicon.png", "spec/hamster/list/coverage/assets/0.4.4/jquery-1.4.2.min.js", "spec/hamster/list/coverage/assets/0.4.4/jquery.dataTables.min.js", "spec/hamster/list/coverage/assets/0.4.4/jquery.timeago.js", "spec/hamster/list/coverage/assets/0.4.4/jquery.url.js", "spec/hamster/list/coverage/assets/0.4.4/loading.gif", "spec/hamster/list/coverage/assets/0.4.4/magnify.png", "spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png", "spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_75_ffffff_40x100.png", "spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png", "spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_65_ffffff_1x400.png", "spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_dadada_1x400.png", "spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png", "spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png", "spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png", "spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_222222_256x240.png", "spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_2e83ff_256x240.png", "spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_454545_256x240.png", "spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_888888_256x240.png", "spec/hamster/list/coverage/assets/0.4.4/smoothness/images/ui-icons_cd0a0a_256x240.png", "spec/hamster/list/coverage/assets/0.4.4/smoothness/jquery-ui-1.8.4.custom.css", "spec/hamster/list/coverage/assets/0.4.4/stylesheet.css", "spec/hamster/list/coverage/covered_percent", "spec/hamster/list/coverage/index.html", "spec/hamster/list/coverage/resultset.yml", "spec/hamster/list/cycle_spec.rb", "spec/hamster/list/drop_spec.rb", "spec/hamster/list/drop_while_spec.rb", "spec/hamster/list/each_slice_spec.rb", "spec/hamster/list/each_spec.rb", "spec/hamster/list/each_with_index_spec.rb", "spec/hamster/list/elem_index_spec.rb", "spec/hamster/list/elem_indices_spec.rb", "spec/hamster/list/empty_spec.rb", "spec/hamster/list/eql_spec.rb", "spec/hamster/list/filter_spec.rb", "spec/hamster/list/find_index_spec.rb", "spec/hamster/list/find_indices_spec.rb", "spec/hamster/list/find_spec.rb", "spec/hamster/list/flatten_spec.rb", "spec/hamster/list/grep_spec.rb", "spec/hamster/list/group_by_spec.rb", "spec/hamster/list/hash_spec.rb", "spec/hamster/list/head_spec.rb", "spec/hamster/list/include_spec.rb", "spec/hamster/list/init_spec.rb", "spec/hamster/list/inits_spec.rb", "spec/hamster/list/inspect_spec.rb", "spec/hamster/list/intersperse_spec.rb", "spec/hamster/list/join_spec.rb", "spec/hamster/list/last_spec.rb", "spec/hamster/list/map_spec.rb", "spec/hamster/list/maximum_spec.rb", "spec/hamster/list/merge_by_spec.rb", "spec/hamster/list/merge_spec.rb", "spec/hamster/list/minimum_spec.rb", "spec/hamster/list/none_spec.rb", "spec/hamster/list/one_spec.rb", "spec/hamster/list/partition_spec.rb", "spec/hamster/list/product_spec.rb", "spec/hamster/list/reduce_spec.rb", "spec/hamster/list/remove_spec.rb", "spec/hamster/list/reverse_spec.rb", "spec/hamster/list/size_spec.rb", "spec/hamster/list/slice_spec.rb", "spec/hamster/list/sorting_spec.rb", "spec/hamster/list/span_spec.rb", "spec/hamster/list/split_at_spec.rb", "spec/hamster/list/sum_spec.rb", "spec/hamster/list/tail_spec.rb", "spec/hamster/list/tails_spec.rb", "spec/hamster/list/take_spec.rb", "spec/hamster/list/take_while_spec.rb", "spec/hamster/list/to_a_spec.rb", "spec/hamster/list/to_ary_spec.rb", "spec/hamster/list/to_list_spec.rb", "spec/hamster/list/to_set_spec.rb", "spec/hamster/list/union_spec.rb", "spec/hamster/list/uniq_spec.rb", "spec/hamster/list/zip_spec.rb", "spec/hamster/queue/clear_spec.rb", "spec/hamster/queue/construction_spec.rb", "spec/hamster/queue/dequeue_spec.rb", "spec/hamster/queue/empty_spec.rb", "spec/hamster/queue/enqueue_spec.rb", "spec/hamster/queue/head_spec.rb", "spec/hamster/queue/inspect_spec.rb", "spec/hamster/queue/size_spec.rb", "spec/hamster/queue/to_a_spec.rb", "spec/hamster/queue/to_ary_spec.rb", "spec/hamster/queue/to_list_spec.rb", "spec/hamster/set/add_spec.rb", "spec/hamster/set/all_spec.rb", "spec/hamster/set/any_spec.rb", "spec/hamster/set/clear_spec.rb", "spec/hamster/set/compact_spec.rb", "spec/hamster/set/construction_spec.rb", "spec/hamster/set/copying_spec.rb", "spec/hamster/set/count_spec.rb", "spec/hamster/set/coverage/assets/0.4.4/app.js", "spec/hamster/set/coverage/assets/0.4.4/fancybox/blank.gif", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_close.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_loading.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_nav_left.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_nav_right.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_e.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_n.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_ne.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_nw.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_s.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_se.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_sw.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_shadow_w.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_title_left.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_title_main.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_title_over.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancy_title_right.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancybox-x.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancybox-y.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/fancybox.png", "spec/hamster/set/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.css", "spec/hamster/set/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.pack.js", "spec/hamster/set/coverage/assets/0.4.4/favicon.png", "spec/hamster/set/coverage/assets/0.4.4/jquery-1.4.2.min.js", "spec/hamster/set/coverage/assets/0.4.4/jquery.dataTables.min.js", "spec/hamster/set/coverage/assets/0.4.4/jquery.timeago.js", "spec/hamster/set/coverage/assets/0.4.4/jquery.url.js", "spec/hamster/set/coverage/assets/0.4.4/loading.gif", "spec/hamster/set/coverage/assets/0.4.4/magnify.png", "spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png", "spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_75_ffffff_40x100.png", "spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png", "spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_65_ffffff_1x400.png", "spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_dadada_1x400.png", "spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png", "spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png", "spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png", "spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_222222_256x240.png", "spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_2e83ff_256x240.png", "spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_454545_256x240.png", "spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_888888_256x240.png", "spec/hamster/set/coverage/assets/0.4.4/smoothness/images/ui-icons_cd0a0a_256x240.png", "spec/hamster/set/coverage/assets/0.4.4/smoothness/jquery-ui-1.8.4.custom.css", "spec/hamster/set/coverage/assets/0.4.4/stylesheet.css", "spec/hamster/set/coverage/covered_percent", "spec/hamster/set/coverage/index.html", "spec/hamster/set/coverage/resultset.yml", "spec/hamster/set/delete_spec.rb", "spec/hamster/set/difference_spec.rb", "spec/hamster/set/each_spec.rb", "spec/hamster/set/empty_spec.rb", "spec/hamster/set/eql_spec.rb", "spec/hamster/set/exclusion_spec.rb", "spec/hamster/set/filter_spec.rb", "spec/hamster/set/find_spec.rb", "spec/hamster/set/flatten_spec.rb", "spec/hamster/set/grep_spec.rb", "spec/hamster/set/group_by_spec.rb", "spec/hamster/set/hash_spec.rb", "spec/hamster/set/head_spec.rb", "spec/hamster/set/immutable_spec.rb", "spec/hamster/set/include_spec.rb", "spec/hamster/set/inspect_spec.rb", "spec/hamster/set/intersection_spec.rb", "spec/hamster/set/join_spec.rb", "spec/hamster/set/map_spec.rb", "spec/hamster/set/maximum_spec.rb", "spec/hamster/set/minimum_spec.rb", "spec/hamster/set/none_spec.rb", "spec/hamster/set/one_spec.rb", "spec/hamster/set/partition_spec.rb", "spec/hamster/set/product_spec.rb", "spec/hamster/set/reduce_spec.rb", "spec/hamster/set/remove_spec.rb", "spec/hamster/set/size_spec.rb", "spec/hamster/set/sorting_spec.rb", "spec/hamster/set/subset_spec.rb", "spec/hamster/set/sum_spec.rb", "spec/hamster/set/superset_spec.rb", "spec/hamster/set/to_a_spec.rb", "spec/hamster/set/to_list_spec.rb", "spec/hamster/set/to_set_spec.rb", "spec/hamster/set/union_spec.rb", "spec/hamster/set/uniq_spec.rb", "spec/hamster/sorter/coverage/assets/0.4.4/app.js", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/blank.gif", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_close.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_loading.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_nav_left.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_nav_right.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_e.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_n.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_ne.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_nw.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_s.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_se.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_sw.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_shadow_w.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_title_left.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_title_main.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_title_over.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancy_title_right.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancybox-x.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancybox-y.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/fancybox.png", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.css", "spec/hamster/sorter/coverage/assets/0.4.4/fancybox/jquery.fancybox-1.3.1.pack.js", "spec/hamster/sorter/coverage/assets/0.4.4/favicon.png", "spec/hamster/sorter/coverage/assets/0.4.4/jquery-1.4.2.min.js", "spec/hamster/sorter/coverage/assets/0.4.4/jquery.dataTables.min.js", "spec/hamster/sorter/coverage/assets/0.4.4/jquery.timeago.js", "spec/hamster/sorter/coverage/assets/0.4.4/jquery.url.js", "spec/hamster/sorter/coverage/assets/0.4.4/loading.gif", "spec/hamster/sorter/coverage/assets/0.4.4/magnify.png", "spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_0_aaaaaa_40x100.png", "spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_flat_75_ffffff_40x100.png", "spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_55_fbf9ee_1x400.png", "spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_65_ffffff_1x400.png", "spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_dadada_1x400.png", "spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_75_e6e6e6_1x400.png", "spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_glass_95_fef1ec_1x400.png", "spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-bg_highlight-soft_75_cccccc_1x100.png", "spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_222222_256x240.png", "spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_2e83ff_256x240.png", "spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_454545_256x240.png", "spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_888888_256x240.png", "spec/hamster/sorter/coverage/assets/0.4.4/smoothness/images/ui-icons_cd0a0a_256x240.png", "spec/hamster/sorter/coverage/assets/0.4.4/smoothness/jquery-ui-1.8.4.custom.css", "spec/hamster/sorter/coverage/assets/0.4.4/stylesheet.css", "spec/hamster/sorter/coverage/covered_percent", "spec/hamster/sorter/coverage/index.html", "spec/hamster/sorter/coverage/resultset.yml", "spec/hamster/sorter/immutable_spec.rb", "spec/hamster/stack/clear_spec.rb", "spec/hamster/stack/construction_spec.rb", "spec/hamster/stack/copying_spec.rb", "spec/hamster/stack/empty_spec.rb", "spec/hamster/stack/eql_spec.rb", "spec/hamster/stack/immutable_spec.rb", "spec/hamster/stack/inspect_spec.rb", "spec/hamster/stack/peek_spec.rb", "spec/hamster/stack/pop_spec.rb", "spec/hamster/stack/push_spec.rb", "spec/hamster/stack/size_spec.rb", "spec/hamster/stack/to_a_spec.rb", "spec/hamster/stack/to_ary.rb", "spec/hamster/stack/to_list_spec.rb", "spec/hamster/trie/remove_spec.rb", "spec/hamster/tuple/copying_spec.rb", "spec/hamster/tuple/eql_spec.rb", "spec/hamster/tuple/first_spec.rb", "spec/hamster/tuple/immutable_spec.rb", "spec/hamster/tuple/inspect_spec.rb", "spec/hamster/tuple/last_spec.rb", "spec/hamster/tuple/to_a_spec.rb", "spec/hamster/tuple/to_ary_spec.rb", "spec/hamster/undefined/erase_spec.rb", "spec/hamster/vector/add_spec.rb", "spec/hamster/vector/any_spec.rb", "spec/hamster/vector/clear_spec.rb", "spec/hamster/vector/copying_spec.rb", "spec/hamster/vector/each_spec.rb", "spec/hamster/vector/each_with_index_spec.rb", "spec/hamster/vector/empty_spec.rb", "spec/hamster/vector/eql_spec.rb", "spec/hamster/vector/filter_spec.rb", "spec/hamster/vector/first_spec.rb", "spec/hamster/vector/get_spec.rb", "spec/hamster/vector/include_spec.rb", "spec/hamster/vector/inspect_spec.rb", "spec/hamster/vector/last_spec.rb", "spec/hamster/vector/map_spec.rb", "spec/hamster/vector/reduce_spec.rb", "spec/hamster/vector/set_spec.rb", "spec/hamster/vector/size_spec.rb", "spec/hamster/vector/to_a_spec.rb", "spec/hamster/vector/to_ary_spec.rb", "spec/spec_helper.rb", "tasks/bundler.rb", "tasks/publish.rb", "tasks/spec.rb", "Rakefile", "README.rdoc", "History.rdoc", "LICENSE"] + s.homepage = %q{http://github.com/harukizaemon/hamster} + s.require_paths = ["lib"] + s.required_ruby_version = Gem::Requirement.new(">= 1.8.7") + s.rubygems_version = %q{1.3.7} + s.summary = %q{Efficient, Immutable, Thread-Safe Collection classes for Ruby} + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_development_dependency(%q, ["~> 2"]) + s.add_development_dependency(%q, ["~> 0.3"]) + else + s.add_dependency(%q, ["~> 2"]) + s.add_dependency(%q, ["~> 0.3"]) + end + else + s.add_dependency(%q, ["~> 2"]) + s.add_dependency(%q, ["~> 0.3"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/highline-1.6.21.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/highline-1.6.21.gemspec new file mode 100644 index 000000000..e43401fb0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/highline-1.6.21.gemspec @@ -0,0 +1,36 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{highline} + s.version = "1.6.21" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["James Edward Gray II"] + s.date = %q{2014-02-28} + s.description = %q{A high-level IO library that provides validation, type conversion, and more for +command-line interfaces. HighLine also includes a complete menu system that can +crank out anything from simple list selection to complete shells with just +minutes of work. +} + s.email = %q{james@graysoftinc.com} + s.extra_rdoc_files = ["README.rdoc", "INSTALL", "TODO", "CHANGELOG", "LICENSE"] + s.files = [".gitignore", "AUTHORS", "CHANGELOG", "COPYING", "INSTALL", "LICENSE", "README.rdoc", "Rakefile", "TODO", "doc/.cvsignore", "examples/ansi_colors.rb", "examples/asking_for_arrays.rb", "examples/basic_usage.rb", "examples/color_scheme.rb", "examples/get_character.rb", "examples/limit.rb", "examples/menus.rb", "examples/overwrite.rb", "examples/page_and_wrap.rb", "examples/password.rb", "examples/repeat_entry.rb", "examples/trapping_eof.rb", "examples/using_readline.rb", "highline.gemspec", "lib/highline.rb", "lib/highline/color_scheme.rb", "lib/highline/compatibility.rb", "lib/highline/import.rb", "lib/highline/menu.rb", "lib/highline/question.rb", "lib/highline/simulate.rb", "lib/highline/string_extensions.rb", "lib/highline/style.rb", "lib/highline/system_extensions.rb", "setup.rb", "site/.cvsignore", "site/highline.css", "site/images/logo.png", "site/index.html", "test/string_methods.rb", "test/tc_color_scheme.rb", "test/tc_highline.rb", "test/tc_import.rb", "test/tc_menu.rb", "test/tc_string_extension.rb", "test/tc_string_highline.rb", "test/tc_style.rb", "test/ts_all.rb"] + s.homepage = %q{http://highline.rubyforge.org} + s.licenses = ["Ruby"] + s.rdoc_options = ["--title", "HighLine Documentation", "--main", "README"] + s.require_paths = ["lib"] + s.rubyforge_project = %q{highline} + s.rubygems_version = %q{1.3.7} + s.summary = %q{HighLine is a high-level command-line IO library.} + s.test_files = ["test/string_methods.rb", "test/tc_color_scheme.rb", "test/tc_highline.rb", "test/tc_import.rb", "test/tc_menu.rb", "test/tc_string_extension.rb", "test/tc_string_highline.rb", "test/tc_style.rb", "test/ts_all.rb"] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 4 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + else + end + else + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/json-1.8.3.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/json-1.8.3.gemspec new file mode 100644 index 000000000..259086e6c --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/json-1.8.3.gemspec @@ -0,0 +1,38 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{json} + s.version = "1.8.3" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Florian Frank"] + s.date = %q{2015-06-01} + s.description = %q{This is a JSON implementation as a Ruby extension in C.} + s.email = %q{flori@ping.de} + s.extensions = ["ext/json/ext/generator/extconf.rb", "ext/json/ext/parser/extconf.rb", "ext/json/extconf.rb"] + s.extra_rdoc_files = ["README.rdoc"] + s.files = ["./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_generic_object.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb", ".gitignore", ".travis.yml", "CHANGES", "COPYING", "COPYING-json-jruby", "GPL", "Gemfile", "README-json-jruby.markdown", "README.rdoc", "Rakefile", "TODO", "VERSION", "data/example.json", "data/index.html", "data/prototype.js", "diagrams/.keep", "ext/json/ext/fbuffer/fbuffer.h", "ext/json/ext/generator/depend", "ext/json/ext/generator/extconf.rb", "ext/json/ext/generator/generator.c", "ext/json/ext/generator/generator.h", "ext/json/ext/parser/depend", "ext/json/ext/parser/extconf.rb", "ext/json/ext/parser/parser.c", "ext/json/ext/parser/parser.h", "ext/json/ext/parser/parser.rl", "ext/json/extconf.rb", "install.rb", "java/src/json/ext/ByteListTranscoder.java", "java/src/json/ext/Generator.java", "java/src/json/ext/GeneratorMethods.java", "java/src/json/ext/GeneratorService.java", "java/src/json/ext/GeneratorState.java", "java/src/json/ext/OptionsReader.java", "java/src/json/ext/Parser.java", "java/src/json/ext/Parser.rl", "java/src/json/ext/ParserService.java", "java/src/json/ext/RuntimeInfo.java", "java/src/json/ext/StringDecoder.java", "java/src/json/ext/StringEncoder.java", "java/src/json/ext/Utils.java", "json-java.gemspec", "json.gemspec", "json_pure.gemspec", "lib/json.rb", "lib/json/add/bigdecimal.rb", "lib/json/add/complex.rb", "lib/json/add/core.rb", "lib/json/add/date.rb", "lib/json/add/date_time.rb", "lib/json/add/exception.rb", "lib/json/add/ostruct.rb", "lib/json/add/range.rb", "lib/json/add/rational.rb", "lib/json/add/regexp.rb", "lib/json/add/struct.rb", "lib/json/add/symbol.rb", "lib/json/add/time.rb", "lib/json/common.rb", "lib/json/ext.rb", "lib/json/ext/.keep", "lib/json/generic_object.rb", "lib/json/pure.rb", "lib/json/pure/generator.rb", "lib/json/pure/parser.rb", "lib/json/version.rb", "tests/fixtures/fail1.json", "tests/fixtures/fail10.json", "tests/fixtures/fail11.json", "tests/fixtures/fail12.json", "tests/fixtures/fail13.json", "tests/fixtures/fail14.json", "tests/fixtures/fail18.json", "tests/fixtures/fail19.json", "tests/fixtures/fail2.json", "tests/fixtures/fail20.json", "tests/fixtures/fail21.json", "tests/fixtures/fail22.json", "tests/fixtures/fail23.json", "tests/fixtures/fail24.json", "tests/fixtures/fail25.json", "tests/fixtures/fail27.json", "tests/fixtures/fail28.json", "tests/fixtures/fail3.json", "tests/fixtures/fail4.json", "tests/fixtures/fail5.json", "tests/fixtures/fail6.json", "tests/fixtures/fail7.json", "tests/fixtures/fail8.json", "tests/fixtures/fail9.json", "tests/fixtures/pass1.json", "tests/fixtures/pass15.json", "tests/fixtures/pass16.json", "tests/fixtures/pass17.json", "tests/fixtures/pass2.json", "tests/fixtures/pass26.json", "tests/fixtures/pass3.json", "tests/setup_variant.rb", "tests/test_json.rb", "tests/test_json_addition.rb", "tests/test_json_encoding.rb", "tests/test_json_fixtures.rb", "tests/test_json_generate.rb", "tests/test_json_generic_object.rb", "tests/test_json_string_matching.rb", "tests/test_json_unicode.rb", "tools/fuzz.rb", "tools/server.rb"] + s.homepage = %q{http://flori.github.com/json} + s.licenses = ["Ruby"] + s.rdoc_options = ["--title", "JSON implemention for Ruby", "--main", "README.rdoc"] + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.7} + s.summary = %q{JSON Implementation for Ruby} + s.test_files = ["./tests/test_json.rb", "./tests/test_json_addition.rb", "./tests/test_json_encoding.rb", "./tests/test_json_fixtures.rb", "./tests/test_json_generate.rb", "./tests/test_json_generic_object.rb", "./tests/test_json_string_matching.rb", "./tests/test_json_unicode.rb"] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 4 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, ["~> 0.3.16"]) + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 0.3.16"]) + end + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 0.3.16"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/kramdown-1.2.0.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/kramdown-1.2.0.gemspec new file mode 100644 index 000000000..f12a89d13 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/kramdown-1.2.0.gemspec @@ -0,0 +1,40 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{kramdown} + s.version = "1.2.0" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Thomas Leitner"] + s.date = %q{2013-08-31} + s.default_executable = %q{kramdown} + s.description = %q{kramdown is yet-another-markdown-parser but fast, pure Ruby, +using a strict syntax definition and supporting several common extensions. +} + s.email = %q{t_leitner@gmx.at} + s.executables = ["kramdown"] + s.files = ["Rakefile", "setup.rb", "COPYING", "README.md", "AUTHORS", "VERSION", "CONTRIBUTERS", "bin/kramdown", "benchmark/benchmark.rb", "benchmark/benchmark.sh", "benchmark/generate_data.rb", "benchmark/mdbasics.text", "benchmark/mdsyntax.text", "benchmark/testing.sh", "benchmark/timing.sh", "lib/kramdown.rb", "lib/kramdown/compatibility.rb", "lib/kramdown/converter.rb", "lib/kramdown/converter/base.rb", "lib/kramdown/converter/html.rb", "lib/kramdown/converter/kramdown.rb", "lib/kramdown/converter/latex.rb", "lib/kramdown/converter/remove_html_tags.rb", "lib/kramdown/converter/toc.rb", "lib/kramdown/document.rb", "lib/kramdown/element.rb", "lib/kramdown/error.rb", "lib/kramdown/options.rb", "lib/kramdown/parser.rb", "lib/kramdown/parser/base.rb", "lib/kramdown/parser/gfm.rb", "lib/kramdown/parser/html.rb", "lib/kramdown/parser/kramdown.rb", "lib/kramdown/parser/kramdown/abbreviation.rb", "lib/kramdown/parser/kramdown/autolink.rb", "lib/kramdown/parser/kramdown/blank_line.rb", "lib/kramdown/parser/kramdown/block_boundary.rb", "lib/kramdown/parser/kramdown/blockquote.rb", "lib/kramdown/parser/kramdown/codeblock.rb", "lib/kramdown/parser/kramdown/codespan.rb", "lib/kramdown/parser/kramdown/emphasis.rb", "lib/kramdown/parser/kramdown/eob.rb", "lib/kramdown/parser/kramdown/escaped_chars.rb", "lib/kramdown/parser/kramdown/extensions.rb", "lib/kramdown/parser/kramdown/footnote.rb", "lib/kramdown/parser/kramdown/header.rb", "lib/kramdown/parser/kramdown/horizontal_rule.rb", "lib/kramdown/parser/kramdown/html.rb", "lib/kramdown/parser/kramdown/html_entity.rb", "lib/kramdown/parser/kramdown/line_break.rb", "lib/kramdown/parser/kramdown/link.rb", "lib/kramdown/parser/kramdown/list.rb", "lib/kramdown/parser/kramdown/math.rb", "lib/kramdown/parser/kramdown/paragraph.rb", "lib/kramdown/parser/kramdown/smart_quotes.rb", "lib/kramdown/parser/kramdown/table.rb", "lib/kramdown/parser/kramdown/typographic_symbol.rb", "lib/kramdown/parser/markdown.rb", "lib/kramdown/utils.rb", "lib/kramdown/utils/entities.rb", "lib/kramdown/utils/html.rb", "lib/kramdown/utils/ordered_hash.rb", "lib/kramdown/utils/unidecoder.rb", "lib/kramdown/version.rb", "man/man1/kramdown.1", "data/kramdown/document.html", "data/kramdown/document.latex", "doc/_design.scss", "doc/bg.png", "doc/default.scss", "doc/default.template", "doc/documentation.page", "doc/documentation.template", "doc/index.page", "doc/installation.page", "doc/links.markdown", "doc/metainfo", "doc/news.feed", "doc/news.page", "doc/options.page", "doc/quickref.page", "doc/sidebar.template", "doc/syntax.page", "doc/tests.page", "doc/virtual", "test/run_tests.rb", "test/test_files.rb", "test/testcases/block/01_blank_line/spaces.html", "test/testcases/block/01_blank_line/spaces.text", "test/testcases/block/01_blank_line/tabs.html", "test/testcases/block/01_blank_line/tabs.text", "test/testcases/block/02_eob/beginning.html", "test/testcases/block/02_eob/beginning.text", "test/testcases/block/02_eob/end.html", "test/testcases/block/02_eob/end.text", "test/testcases/block/02_eob/middle.html", "test/testcases/block/02_eob/middle.text", "test/testcases/block/03_paragraph/indented.html", "test/testcases/block/03_paragraph/indented.html.gfm", "test/testcases/block/03_paragraph/indented.text", "test/testcases/block/03_paragraph/no_newline_at_end.html", "test/testcases/block/03_paragraph/no_newline_at_end.text", "test/testcases/block/03_paragraph/one_para.html", "test/testcases/block/03_paragraph/one_para.text", "test/testcases/block/03_paragraph/two_para.html", "test/testcases/block/03_paragraph/two_para.text", "test/testcases/block/04_header/atx_header.html", "test/testcases/block/04_header/atx_header.text", "test/testcases/block/04_header/atx_header_no_newline_at_end.html", "test/testcases/block/04_header/atx_header_no_newline_at_end.text", "test/testcases/block/04_header/header_type_offset.html", "test/testcases/block/04_header/header_type_offset.kramdown", "test/testcases/block/04_header/header_type_offset.latex", "test/testcases/block/04_header/header_type_offset.options", "test/testcases/block/04_header/header_type_offset.text", "test/testcases/block/04_header/setext_header.html", "test/testcases/block/04_header/setext_header.text", "test/testcases/block/04_header/setext_header_no_newline_at_end.html", "test/testcases/block/04_header/setext_header_no_newline_at_end.text", "test/testcases/block/04_header/with_auto_id_prefix.html", "test/testcases/block/04_header/with_auto_id_prefix.options", "test/testcases/block/04_header/with_auto_id_prefix.text", "test/testcases/block/04_header/with_auto_ids.html", "test/testcases/block/04_header/with_auto_ids.options", "test/testcases/block/04_header/with_auto_ids.text", "test/testcases/block/05_blockquote/indented.html", "test/testcases/block/05_blockquote/indented.text", "test/testcases/block/05_blockquote/lazy.html", "test/testcases/block/05_blockquote/lazy.text", "test/testcases/block/05_blockquote/nested.html", "test/testcases/block/05_blockquote/nested.text", "test/testcases/block/05_blockquote/no_newline_at_end.html", "test/testcases/block/05_blockquote/no_newline_at_end.text", "test/testcases/block/05_blockquote/very_long_line.html", "test/testcases/block/05_blockquote/very_long_line.text", "test/testcases/block/05_blockquote/with_code_blocks.html", "test/testcases/block/05_blockquote/with_code_blocks.text", "test/testcases/block/06_codeblock/disable-highlighting.html", "test/testcases/block/06_codeblock/disable-highlighting.options", "test/testcases/block/06_codeblock/disable-highlighting.text", "test/testcases/block/06_codeblock/error.html", "test/testcases/block/06_codeblock/error.text", "test/testcases/block/06_codeblock/highlighting.html", "test/testcases/block/06_codeblock/highlighting.options", "test/testcases/block/06_codeblock/highlighting.text", "test/testcases/block/06_codeblock/issue_gh45.html", "test/testcases/block/06_codeblock/issue_gh45.test", "test/testcases/block/06_codeblock/lazy.html", "test/testcases/block/06_codeblock/lazy.text", "test/testcases/block/06_codeblock/no_newline_at_end.html", "test/testcases/block/06_codeblock/no_newline_at_end.text", "test/testcases/block/06_codeblock/no_newline_at_end_1.html", "test/testcases/block/06_codeblock/no_newline_at_end_1.text", "test/testcases/block/06_codeblock/normal.html", "test/testcases/block/06_codeblock/normal.text", "test/testcases/block/06_codeblock/tilde_syntax.html", "test/testcases/block/06_codeblock/tilde_syntax.text", "test/testcases/block/06_codeblock/whitespace.html", "test/testcases/block/06_codeblock/whitespace.text", "test/testcases/block/06_codeblock/with_blank_line.html", "test/testcases/block/06_codeblock/with_blank_line.text", "test/testcases/block/06_codeblock/with_eob_marker.html", "test/testcases/block/06_codeblock/with_eob_marker.text", "test/testcases/block/06_codeblock/with_ial.html", "test/testcases/block/06_codeblock/with_ial.text", "test/testcases/block/06_codeblock/with_lang_in_fenced_block.html", "test/testcases/block/06_codeblock/with_lang_in_fenced_block.options", "test/testcases/block/06_codeblock/with_lang_in_fenced_block.text", "test/testcases/block/07_horizontal_rule/error.html", "test/testcases/block/07_horizontal_rule/error.html.19", "test/testcases/block/07_horizontal_rule/error.text", "test/testcases/block/07_horizontal_rule/normal.html", "test/testcases/block/07_horizontal_rule/normal.text", "test/testcases/block/07_horizontal_rule/sepspaces.html", "test/testcases/block/07_horizontal_rule/sepspaces.text", "test/testcases/block/07_horizontal_rule/septabs.html", "test/testcases/block/07_horizontal_rule/septabs.text", "test/testcases/block/08_list/escaping.html", "test/testcases/block/08_list/escaping.text", "test/testcases/block/08_list/item_ial.html", "test/testcases/block/08_list/item_ial.text", "test/testcases/block/08_list/lazy.html", "test/testcases/block/08_list/lazy.text", "test/testcases/block/08_list/list_and_hr.html", "test/testcases/block/08_list/list_and_hr.text", "test/testcases/block/08_list/list_and_others.html", "test/testcases/block/08_list/list_and_others.text", "test/testcases/block/08_list/mixed.html", "test/testcases/block/08_list/mixed.text", "test/testcases/block/08_list/nested.html", "test/testcases/block/08_list/nested.text", "test/testcases/block/08_list/other_first_element.html", "test/testcases/block/08_list/other_first_element.text", "test/testcases/block/08_list/simple_ol.html", "test/testcases/block/08_list/simple_ol.text", "test/testcases/block/08_list/simple_ul.html", "test/testcases/block/08_list/simple_ul.text", "test/testcases/block/08_list/single_item.html", "test/testcases/block/08_list/single_item.text", "test/testcases/block/08_list/special_cases.html", "test/testcases/block/08_list/special_cases.text", "test/testcases/block/09_html/comment.html", "test/testcases/block/09_html/comment.text", "test/testcases/block/09_html/content_model/deflists.html", "test/testcases/block/09_html/content_model/deflists.options", "test/testcases/block/09_html/content_model/deflists.text", "test/testcases/block/09_html/content_model/tables.html", "test/testcases/block/09_html/content_model/tables.options", "test/testcases/block/09_html/content_model/tables.text", "test/testcases/block/09_html/html5_attributes.html", "test/testcases/block/09_html/html5_attributes.text", "test/testcases/block/09_html/html_and_codeblocks.html", "test/testcases/block/09_html/html_and_codeblocks.options", "test/testcases/block/09_html/html_and_codeblocks.text", "test/testcases/block/09_html/html_and_headers.html", "test/testcases/block/09_html/html_and_headers.text", "test/testcases/block/09_html/html_to_native/code.html", "test/testcases/block/09_html/html_to_native/code.text", "test/testcases/block/09_html/html_to_native/comment.html", "test/testcases/block/09_html/html_to_native/comment.text", "test/testcases/block/09_html/html_to_native/emphasis.html", "test/testcases/block/09_html/html_to_native/emphasis.text", "test/testcases/block/09_html/html_to_native/entity.html", "test/testcases/block/09_html/html_to_native/entity.text", "test/testcases/block/09_html/html_to_native/header.html", "test/testcases/block/09_html/html_to_native/header.options", "test/testcases/block/09_html/html_to_native/header.text", "test/testcases/block/09_html/html_to_native/list_dl.html", "test/testcases/block/09_html/html_to_native/list_dl.text", "test/testcases/block/09_html/html_to_native/list_ol.html", "test/testcases/block/09_html/html_to_native/list_ol.text", "test/testcases/block/09_html/html_to_native/list_ul.html", "test/testcases/block/09_html/html_to_native/list_ul.text", "test/testcases/block/09_html/html_to_native/options", "test/testcases/block/09_html/html_to_native/paragraph.html", "test/testcases/block/09_html/html_to_native/paragraph.text", "test/testcases/block/09_html/html_to_native/table_normal.html", "test/testcases/block/09_html/html_to_native/table_normal.text", "test/testcases/block/09_html/html_to_native/table_simple.html", "test/testcases/block/09_html/html_to_native/table_simple.text", "test/testcases/block/09_html/html_to_native/typography.html", "test/testcases/block/09_html/html_to_native/typography.html.19", "test/testcases/block/09_html/html_to_native/typography.text", "test/testcases/block/09_html/invalid_html_1.html", "test/testcases/block/09_html/invalid_html_1.text", "test/testcases/block/09_html/invalid_html_2.html", "test/testcases/block/09_html/invalid_html_2.text", "test/testcases/block/09_html/markdown_attr.html", "test/testcases/block/09_html/markdown_attr.text", "test/testcases/block/09_html/not_parsed.html", "test/testcases/block/09_html/not_parsed.text", "test/testcases/block/09_html/parse_as_raw.html", "test/testcases/block/09_html/parse_as_raw.htmlinput", "test/testcases/block/09_html/parse_as_raw.options", "test/testcases/block/09_html/parse_as_raw.text", "test/testcases/block/09_html/parse_as_span.html", "test/testcases/block/09_html/parse_as_span.htmlinput", "test/testcases/block/09_html/parse_as_span.options", "test/testcases/block/09_html/parse_as_span.text", "test/testcases/block/09_html/parse_block_html.html", "test/testcases/block/09_html/parse_block_html.options", "test/testcases/block/09_html/parse_block_html.text", "test/testcases/block/09_html/processing_instruction.html", "test/testcases/block/09_html/processing_instruction.text", "test/testcases/block/09_html/simple.html", "test/testcases/block/09_html/simple.html.19", "test/testcases/block/09_html/simple.options", "test/testcases/block/09_html/simple.text", "test/testcases/block/10_ald/simple.html", "test/testcases/block/10_ald/simple.text", "test/testcases/block/11_ial/auto_id_and_ial.html", "test/testcases/block/11_ial/auto_id_and_ial.options", "test/testcases/block/11_ial/auto_id_and_ial.text", "test/testcases/block/11_ial/nested.html", "test/testcases/block/11_ial/nested.text", "test/testcases/block/11_ial/simple.html", "test/testcases/block/11_ial/simple.text", "test/testcases/block/12_extension/comment.html", "test/testcases/block/12_extension/comment.text", "test/testcases/block/12_extension/ignored.html", "test/testcases/block/12_extension/ignored.text", "test/testcases/block/12_extension/nomarkdown.html", "test/testcases/block/12_extension/nomarkdown.kramdown", "test/testcases/block/12_extension/nomarkdown.latex", "test/testcases/block/12_extension/nomarkdown.text", "test/testcases/block/12_extension/options.html", "test/testcases/block/12_extension/options.text", "test/testcases/block/12_extension/options2.html", "test/testcases/block/12_extension/options2.text", "test/testcases/block/12_extension/options3.html", "test/testcases/block/12_extension/options3.text", "test/testcases/block/13_definition_list/definition_at_beginning.html", "test/testcases/block/13_definition_list/definition_at_beginning.text", "test/testcases/block/13_definition_list/deflist_ial.html", "test/testcases/block/13_definition_list/deflist_ial.text", "test/testcases/block/13_definition_list/item_ial.html", "test/testcases/block/13_definition_list/item_ial.text", "test/testcases/block/13_definition_list/multiple_terms.html", "test/testcases/block/13_definition_list/multiple_terms.text", "test/testcases/block/13_definition_list/no_def_list.html", "test/testcases/block/13_definition_list/no_def_list.text", "test/testcases/block/13_definition_list/para_wrapping.html", "test/testcases/block/13_definition_list/para_wrapping.text", "test/testcases/block/13_definition_list/separated_by_eob.html", "test/testcases/block/13_definition_list/separated_by_eob.text", "test/testcases/block/13_definition_list/simple.html", "test/testcases/block/13_definition_list/simple.text", "test/testcases/block/13_definition_list/styled_terms.html", "test/testcases/block/13_definition_list/styled_terms.text", "test/testcases/block/13_definition_list/too_much_space.html", "test/testcases/block/13_definition_list/too_much_space.text", "test/testcases/block/13_definition_list/with_blocks.html", "test/testcases/block/13_definition_list/with_blocks.text", "test/testcases/block/14_table/errors.html", "test/testcases/block/14_table/errors.text", "test/testcases/block/14_table/escaping.html", "test/testcases/block/14_table/escaping.text", "test/testcases/block/14_table/footer.html", "test/testcases/block/14_table/footer.text", "test/testcases/block/14_table/header.html", "test/testcases/block/14_table/header.text", "test/testcases/block/14_table/no_table.html", "test/testcases/block/14_table/no_table.text", "test/testcases/block/14_table/simple.html", "test/testcases/block/14_table/simple.html.19", "test/testcases/block/14_table/simple.text", "test/testcases/block/14_table/table_with_footnote.html", "test/testcases/block/14_table/table_with_footnote.latex", "test/testcases/block/14_table/table_with_footnote.text", "test/testcases/block/15_math/normal.html", "test/testcases/block/15_math/normal.text", "test/testcases/block/16_toc/no_toc.html", "test/testcases/block/16_toc/no_toc.text", "test/testcases/block/16_toc/toc_exclude.html", "test/testcases/block/16_toc/toc_exclude.options", "test/testcases/block/16_toc/toc_exclude.text", "test/testcases/block/16_toc/toc_levels.html", "test/testcases/block/16_toc/toc_levels.options", "test/testcases/block/16_toc/toc_levels.text", "test/testcases/block/16_toc/toc_with_footnotes.html", "test/testcases/block/16_toc/toc_with_footnotes.options", "test/testcases/block/16_toc/toc_with_footnotes.text", "test/testcases/encoding.html", "test/testcases/encoding.text", "test/testcases/span/01_link/empty.html", "test/testcases/span/01_link/empty.text", "test/testcases/span/01_link/image_in_a.html", "test/testcases/span/01_link/image_in_a.text", "test/testcases/span/01_link/imagelinks.html", "test/testcases/span/01_link/imagelinks.text", "test/testcases/span/01_link/inline.html", "test/testcases/span/01_link/inline.html.19", "test/testcases/span/01_link/inline.text", "test/testcases/span/01_link/link_defs.html", "test/testcases/span/01_link/link_defs.text", "test/testcases/span/01_link/links_with_angle_brackets.html", "test/testcases/span/01_link/links_with_angle_brackets.text", "test/testcases/span/01_link/reference.html", "test/testcases/span/01_link/reference.html.19", "test/testcases/span/01_link/reference.options", "test/testcases/span/01_link/reference.text", "test/testcases/span/02_emphasis/empty.html", "test/testcases/span/02_emphasis/empty.text", "test/testcases/span/02_emphasis/errors.html", "test/testcases/span/02_emphasis/errors.text", "test/testcases/span/02_emphasis/nesting.html", "test/testcases/span/02_emphasis/nesting.text", "test/testcases/span/02_emphasis/normal.html", "test/testcases/span/02_emphasis/normal.text", "test/testcases/span/03_codespan/empty.html", "test/testcases/span/03_codespan/empty.text", "test/testcases/span/03_codespan/errors.html", "test/testcases/span/03_codespan/errors.text", "test/testcases/span/03_codespan/highlighting.html", "test/testcases/span/03_codespan/highlighting.text", "test/testcases/span/03_codespan/normal.html", "test/testcases/span/03_codespan/normal.text", "test/testcases/span/04_footnote/definitions.html", "test/testcases/span/04_footnote/definitions.latex", "test/testcases/span/04_footnote/definitions.text", "test/testcases/span/04_footnote/footnote_nr.html", "test/testcases/span/04_footnote/footnote_nr.latex", "test/testcases/span/04_footnote/footnote_nr.options", "test/testcases/span/04_footnote/footnote_nr.text", "test/testcases/span/04_footnote/markers.html", "test/testcases/span/04_footnote/markers.latex", "test/testcases/span/04_footnote/markers.text", "test/testcases/span/05_html/across_lines.html", "test/testcases/span/05_html/across_lines.text", "test/testcases/span/05_html/invalid.html", "test/testcases/span/05_html/invalid.text", "test/testcases/span/05_html/link_with_mailto.html", "test/testcases/span/05_html/link_with_mailto.text", "test/testcases/span/05_html/markdown_attr.html", "test/testcases/span/05_html/markdown_attr.text", "test/testcases/span/05_html/normal.html", "test/testcases/span/05_html/normal.text", "test/testcases/span/abbreviations/abbrev.html", "test/testcases/span/abbreviations/abbrev.text", "test/testcases/span/abbreviations/abbrev_defs.html", "test/testcases/span/abbreviations/abbrev_defs.text", "test/testcases/span/autolinks/url_links.html", "test/testcases/span/autolinks/url_links.text", "test/testcases/span/escaped_chars/normal.html", "test/testcases/span/escaped_chars/normal.text", "test/testcases/span/extension/comment.html", "test/testcases/span/extension/comment.text", "test/testcases/span/extension/ignored.html", "test/testcases/span/extension/ignored.text", "test/testcases/span/extension/nomarkdown.html", "test/testcases/span/extension/nomarkdown.text", "test/testcases/span/extension/options.html", "test/testcases/span/extension/options.text", "test/testcases/span/ial/simple.html", "test/testcases/span/ial/simple.text", "test/testcases/span/line_breaks/normal.html", "test/testcases/span/line_breaks/normal.latex", "test/testcases/span/line_breaks/normal.text", "test/testcases/span/math/normal.html", "test/testcases/span/math/normal.text", "test/testcases/span/text_substitutions/entities.html", "test/testcases/span/text_substitutions/entities.options", "test/testcases/span/text_substitutions/entities.text", "test/testcases/span/text_substitutions/entities_as_char.html", "test/testcases/span/text_substitutions/entities_as_char.html.19", "test/testcases/span/text_substitutions/entities_as_char.options", "test/testcases/span/text_substitutions/entities_as_char.text", "test/testcases/span/text_substitutions/entities_as_input.html", "test/testcases/span/text_substitutions/entities_as_input.options", "test/testcases/span/text_substitutions/entities_as_input.text", "test/testcases/span/text_substitutions/entities_numeric.html", "test/testcases/span/text_substitutions/entities_numeric.options", "test/testcases/span/text_substitutions/entities_numeric.text", "test/testcases/span/text_substitutions/entities_symbolic.html", "test/testcases/span/text_substitutions/entities_symbolic.options", "test/testcases/span/text_substitutions/entities_symbolic.text", "test/testcases/span/text_substitutions/greaterthan.html", "test/testcases/span/text_substitutions/greaterthan.text", "test/testcases/span/text_substitutions/lowerthan.html", "test/testcases/span/text_substitutions/lowerthan.text", "test/testcases/span/text_substitutions/typography.html", "test/testcases/span/text_substitutions/typography.options", "test/testcases/span/text_substitutions/typography.text", "test/testcases_gfm/backticks_disable_highlighting.html", "test/testcases_gfm/backticks_disable_highlighting.options", "test/testcases_gfm/backticks_disable_highlighting.text", "test/testcases_gfm/backticks_syntax.html", "test/testcases_gfm/backticks_syntax.text", "test/testcases_gfm/two_para_hard_line_breaks.html", "test/testcases_gfm/two_para_hard_line_breaks.text"] + s.homepage = %q{http://kramdown.rubyforge.org} + s.licenses = ["MIT"] + s.rdoc_options = ["--main", "lib/kramdown/document.rb"] + s.require_paths = ["lib"] + s.rubyforge_project = %q{kramdown} + s.rubygems_version = %q{1.3.7} + s.summary = %q{kramdown is a fast, pure-Ruby Markdown-superset converter.} + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 4 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_development_dependency(%q, ["~> 1.0.0"]) + s.add_development_dependency(%q, ["~> 1.5.1"]) + else + s.add_dependency(%q, ["~> 1.0.0"]) + s.add_dependency(%q, ["~> 1.5.1"]) + end + else + s.add_dependency(%q, ["~> 1.0.0"]) + s.add_dependency(%q, ["~> 1.5.1"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/lettercase-0.0.3.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/lettercase-0.0.3.gemspec new file mode 100644 index 000000000..abd17f234 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/lettercase-0.0.3.gemspec @@ -0,0 +1,32 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{lettercase} + s.version = "0.0.3" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Kenichi Kamiya"] + s.date = %q{2012-09-13} + s.description = %q{Convert some letter cases around programming.} + s.email = ["kachick1+ruby@gmail.com"] + s.files = [".gitignore", ".travis.yml", ".yardopts", "Gemfile", "History.rdoc", "LICENSE", "Manifest.txt", "README.md", "Rakefile", "example/README.rb", "lettercase.gemspec", "lib/lettercase.rb", "lib/lettercase/constants.rb", "lib/lettercase/core_ext.rb", "lib/lettercase/singleton_class.rb", "lib/lettercase/stringableextension.rb", "lib/lettercase/stringextension.rb", "lib/lettercase/symbolextension.rb", "lib/lettercase/version.rb", "test/helper.rb", "test/test_lettercase.rb"] + s.homepage = %q{https://github.com/kachick/lettercase} + s.require_paths = ["lib"] + s.required_ruby_version = Gem::Requirement.new(">= 1.9.2") + s.rubygems_version = %q{1.3.7} + s.summary = %q{Convert some letter cases around programming.} + s.test_files = ["test/helper.rb", "test/test_lettercase.rb"] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_development_dependency(%q, ["~> 0.8.2.1"]) + else + s.add_dependency(%q, ["~> 0.8.2.1"]) + end + else + s.add_dependency(%q, ["~> 0.8.2.1"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/naming-0.1.0.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/naming-0.1.0.gemspec new file mode 100644 index 000000000..9b1032b5e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/naming-0.1.0.gemspec @@ -0,0 +1,43 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{naming} + s.version = "0.1.0" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Keita Yamaguchi"] + s.date = %q{2013-06-02} + s.description = %q{naming provides name and value container with useful functions} + s.email = ["keita.yamaguchi@gmail.com"] + s.files = [".gitignore", ".simplecov", ".travis.yml", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "lib/naming.rb", "lib/naming/meta.rb", "lib/naming/name-set.rb", "lib/naming/version.rb", "naming.gemspec", "test/spec_naming.rb"] + s.homepage = %q{https://github.com/keita/naming} + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.7} + s.summary = %q{naming provides name and value container with useful functions} + s.test_files = ["test/spec_naming.rb"] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, ["~> 0.1.4"]) + s.add_runtime_dependency(%q, ["~> 0.1.0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + else + s.add_dependency(%q, ["~> 0.1.4"]) + s.add_dependency(%q, ["~> 0.1.0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end + else + s.add_dependency(%q, ["~> 0.1.4"]) + s.add_dependency(%q, ["~> 0.1.0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/os-0.9.6.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/os-0.9.6.gemspec new file mode 100644 index 000000000..1011a0e94 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/os-0.9.6.gemspec @@ -0,0 +1,31 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{os} + s.version = "0.9.6" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["rdp", "David McCullars"] + s.date = %q{2012-02-17} + s.description = %q{The OS gem allows for some useful and easy functions, like OS.windows? (=> true or false) OS.bits ( => 32 or 64) etc"} + s.email = %q{rogerpack2005@gmail.com} + s.extra_rdoc_files = ["ChangeLog", "LICENSE", "README.rdoc"] + s.files = [".autotest", ".document", "ChangeLog", "Gemfile", "Gemfile.lock", "LICENSE", "README.rdoc", "Rakefile", "VERSION", "autotest/discover.rb", "lib/os.rb", "os.gemspec", "spec/linux_spec.rb", "spec/os_spec.rb", "spec/osx_spec.rb", "spec/spec_helper.rb"] + s.homepage = %q{http://github.com/rdp/os} + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.7} + s.summary = %q{Simple and easy way to know if you're on windows or not (reliably), as well as how many bits the OS is, etc.} + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_development_dependency(%q, [">= 2.0"]) + else + s.add_dependency(%q, [">= 2.0"]) + end + else + s.add_dependency(%q, [">= 2.0"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/parslet-1.5.0.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/parslet-1.5.0.gemspec new file mode 100644 index 000000000..f144ba18b --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/parslet-1.5.0.gemspec @@ -0,0 +1,55 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{parslet} + s.version = "1.5.0" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Kaspar Schiess"] + s.date = %q{2012-12-27} + s.email = %q{kaspar.schiess@absurd.li} + s.extra_rdoc_files = ["README"] + s.files = ["HISTORY.txt", "LICENSE", "Rakefile", "README", "lib/parslet/atoms/alternative.rb", "lib/parslet/atoms/base.rb", "lib/parslet/atoms/can_flatten.rb", "lib/parslet/atoms/capture.rb", "lib/parslet/atoms/context.rb", "lib/parslet/atoms/dsl.rb", "lib/parslet/atoms/dynamic.rb", "lib/parslet/atoms/entity.rb", "lib/parslet/atoms/lookahead.rb", "lib/parslet/atoms/named.rb", "lib/parslet/atoms/re.rb", "lib/parslet/atoms/repetition.rb", "lib/parslet/atoms/scope.rb", "lib/parslet/atoms/sequence.rb", "lib/parslet/atoms/str.rb", "lib/parslet/atoms/visitor.rb", "lib/parslet/atoms.rb", "lib/parslet/cause.rb", "lib/parslet/convenience.rb", "lib/parslet/error_reporter/deepest.rb", "lib/parslet/error_reporter/tree.rb", "lib/parslet/error_reporter.rb", "lib/parslet/export.rb", "lib/parslet/expression/treetop.rb", "lib/parslet/expression.rb", "lib/parslet/parser.rb", "lib/parslet/pattern/binding.rb", "lib/parslet/pattern.rb", "lib/parslet/rig/rspec.rb", "lib/parslet/scope.rb", "lib/parslet/slice.rb", "lib/parslet/source/line_cache.rb", "lib/parslet/source.rb", "lib/parslet/transform/context.rb", "lib/parslet/transform.rb", "lib/parslet.rb", "example/boolean_algebra.rb", "example/calc.rb", "example/capture.rb", "example/comments.rb", "example/deepest_errors.rb", "example/documentation.rb", "example/email_parser.rb", "example/empty.rb", "example/erb.rb", "example/ignore.rb", "example/ip_address.rb", "example/json.rb", "example/local.rb", "example/mathn.rb", "example/minilisp.rb", "example/modularity.rb", "example/nested_errors.rb", "example/output/boolean_algebra.out", "example/output/calc.out", "example/output/capture.out", "example/output/comments.out", "example/output/deepest_errors.out", "example/output/documentation.err", "example/output/documentation.out", "example/output/email_parser.out", "example/output/empty.err", "example/output/erb.out", "example/output/ignore.out", "example/output/ignore_whitespace.out", "example/output/ip_address.out", "example/output/json.out", "example/output/local.out", "example/output/mathn.out", "example/output/minilisp.out", "example/output/modularity.out", "example/output/nested_errors.out", "example/output/parens.out", "example/output/readme.out", "example/output/scopes.out", "example/output/seasons.out", "example/output/sentence.out", "example/output/simple_xml.out", "example/output/string_parser.out", "example/parens.rb", "example/readme.rb", "example/scopes.rb", "example/seasons.rb", "example/sentence.rb", "example/simple.lit", "example/simple_xml.rb", "example/string_parser.rb", "example/test.lit"] + s.homepage = %q{http://kschiess.github.com/parslet} + s.rdoc_options = ["--main", "README"] + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.7} + s.summary = %q{Parser construction library with great error reporting in Ruby.} + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, ["~> 2.0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + else + s.add_dependency(%q, ["~> 2.0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end + else + s.add_dependency(%q, ["~> 2.0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/rainbow-1.1.4.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/rainbow-1.1.4.gemspec new file mode 100644 index 000000000..cdde62f76 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/rainbow-1.1.4.gemspec @@ -0,0 +1,26 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{rainbow} + s.version = "1.1.4" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Marcin Kulik"] + s.date = %q{2012-04-28} + s.email = %q{marcin.kulik@gmail.com} + s.files = ["README.markdown", "Changelog", "LICENSE", "lib/rainbow.rb", "lib/ansi_color.rb", "lib/ansi_rgb.rb", "test/rainbow_test.rb"] + s.homepage = %q{http://ku1ik.com/} + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.7} + s.summary = %q{Rainbow extends ruby String class enabling coloring text on ANSI terminals} + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + else + end + else + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/retriable-1.3.3.1.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/retriable-1.3.3.1.gemspec new file mode 100644 index 000000000..4e183f17a --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/retriable-1.3.3.1.gemspec @@ -0,0 +1,35 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{retriable} + s.version = "1.3.3.1" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Jack Chu"] + s.date = %q{2013-07-02} + s.description = %q{Retriable is an simple DSL to retry a code block if an exception should be raised. This is especially useful when interacting external api/services or file system calls.} + s.email = ["jack@jackchu.com"] + s.files = [".gitignore", ".travis.yml", "CHANGELOG.md", "Gemfile", "LICENSE", "README.md", "Rakefile", "lib/retriable.rb", "lib/retriable/core_ext/kernel.rb", "lib/retriable/no_kernel.rb", "lib/retriable/retriable.rb", "lib/retriable/version.rb", "retriable.gemspec", "test/retriable_test.rb"] + s.homepage = %q{http://github.com/kamui/retriable} + s.require_paths = ["lib"] + s.rubyforge_project = %q{retriable} + s.rubygems_version = %q{1.3.7} + s.summary = %q{Retriable is an simple DSL to retry a code block if an exception should be raised.} + s.test_files = ["test/retriable_test.rb"] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/ruby-xes-0.1.0.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/ruby-xes-0.1.0.gemspec new file mode 100644 index 000000000..0b8b8f1b0 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/ruby-xes-0.1.0.gemspec @@ -0,0 +1,37 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{ruby-xes} + s.version = "0.1.0" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Keita Yamaguchi"] + s.date = %q{2013-04-17} + s.description = %q{ruby-xes is a library for generating XES event log.} + s.email = ["keita.yamaguchi@gmail.com"] + s.files = [".gitignore", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "lib/xes.rb", "lib/xes/attribute-accessor.rb", "lib/xes/attribute.rb", "lib/xes/classifier.rb", "lib/xes/document.rb", "lib/xes/event.rb", "lib/xes/extension.rb", "lib/xes/format-error.rb", "lib/xes/global.rb", "lib/xes/log.rb", "lib/xes/trace.rb", "lib/xes/version.rb", "ruby-xes.gemspec", "test/spec_attribute.rb", "test/spec_classifier.rb", "test/spec_document.rb", "test/spec_event.rb", "test/spec_extension.rb", "test/spec_global.rb", "test/spec_log.rb", "test/spec_trace.rb"] + s.homepage = %q{https://github.com/pione/ruby-xes} + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.7} + s.summary = %q{ruby-xes is a library for generating XES event log.} + s.test_files = ["test/spec_attribute.rb", "test/spec_classifier.rb", "test/spec_document.rb", "test/spec_event.rb", "test/spec_extension.rb", "test/spec_global.rb", "test/spec_log.rb", "test/spec_trace.rb"] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, ["~> 0.8.5"]) + s.add_development_dependency(%q, [">= 0"]) + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 0.8.5"]) + s.add_dependency(%q, [">= 0"]) + end + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 0.8.5"]) + s.add_dependency(%q, [">= 0"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/rubyzip-1.0.0.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/rubyzip-1.0.0.gemspec new file mode 100644 index 000000000..8f1dac749 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/rubyzip-1.0.0.gemspec @@ -0,0 +1,27 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{rubyzip} + s.version = "1.0.0" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Alexander Simonov"] + s.date = %q{2013-08-29} + s.email = ["alex@simonov.me"] + s.files = ["samples/example.rb", "samples/example_filesystem.rb", "samples/example_recursive.rb", "samples/gtkRubyzip.rb", "samples/qtzip.rb", "samples/write_simple.rb", "samples/zipfind.rb", "lib/zip/central_directory.rb", "lib/zip/compressor.rb", "lib/zip/constants.rb", "lib/zip/decompressor.rb", "lib/zip/deflater.rb", "lib/zip/dos_time.rb", "lib/zip/entry.rb", "lib/zip/entry_set.rb", "lib/zip/errors.rb", "lib/zip/extra_field/generic.rb", "lib/zip/extra_field/universal_time.rb", "lib/zip/extra_field/unix.rb", "lib/zip/extra_field/zip64.rb", "lib/zip/extra_field.rb", "lib/zip/file.rb", "lib/zip/filesystem.rb", "lib/zip/inflater.rb", "lib/zip/input_stream.rb", "lib/zip/ioextras/abstract_input_stream.rb", "lib/zip/ioextras/abstract_output_stream.rb", "lib/zip/ioextras.rb", "lib/zip/null_compressor.rb", "lib/zip/null_decompressor.rb", "lib/zip/null_input_stream.rb", "lib/zip/output_stream.rb", "lib/zip/pass_thru_compressor.rb", "lib/zip/pass_thru_decompressor.rb", "lib/zip/streamable_directory.rb", "lib/zip/streamable_stream.rb", "lib/zip/version.rb", "lib/zip.rb", "README.md", "NEWS", "TODO", "Rakefile"] + s.homepage = %q{http://github.com/rubyzip/rubyzip} + s.require_paths = ["lib"] + s.required_ruby_version = Gem::Requirement.new(">= 1.9.2") + s.rubygems_version = %q{1.3.7} + s.summary = %q{rubyzip is a ruby module for reading and writing zip files} + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 4 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + else + end + else + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/simple-identity-0.1.2.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/simple-identity-0.1.2.gemspec new file mode 100644 index 000000000..a7820f136 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/simple-identity-0.1.2.gemspec @@ -0,0 +1,41 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{simple-identity} + s.version = "0.1.2" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Keita Yamaguchi"] + s.date = %q{2013-05-23} + s.description = %q{simple-identity provides simple identity methods of #eql?, #==, and #hash} + s.email = ["keita.yamaguchi@gmail.com"] + s.files = [".gitignore", ".simplecov", ".travis.yml", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "lib/simple-identity.rb", "lib/simple-identity/version.rb", "simple-identity.gemspec", "test/spec_simple-identity.rb"] + s.homepage = %q{https://github.com/keita/simple-identity} + s.licenses = ["MIT"] + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.7} + s.summary = %q{simple-identity provides simple identity methods of #eql?, #==, and #hash} + s.test_files = ["test/spec_simple-identity.rb"] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, ["~> 1.3"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 1.3"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 1.3"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/structx-0.1.3.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/structx-0.1.3.gemspec new file mode 100644 index 000000000..ed6b6563e --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/structx-0.1.3.gemspec @@ -0,0 +1,47 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{structx} + s.version = "0.1.3" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Keita Yamaguchi"] + s.date = %q{2013-09-04} + s.description = %q{sturctx is a Ruby library that extends standard Struct} + s.email = ["keita.yamaguchi@gmail.com"] + s.files = [".gitignore", ".simplecov", ".travis.yml", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "lib/structx.rb", "lib/structx/version.rb", "structx.gemspec", "test/compatibility-test.rb", "test/ruby/1.9/envutil.rb", "test/ruby/1.9/test_struct.rb", "test/ruby/2.0/envutil.rb", "test/ruby/2.0/test_struct.rb", "test/run.sh", "test/spec_structx.rb"] + s.homepage = %q{https://github.com/keita/structx} + s.licenses = ["MIT"] + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.7} + s.summary = %q{sturctx is a Ruby library that extends standard Struct} + s.test_files = ["test/compatibility-test.rb", "test/ruby/1.9/envutil.rb", "test/ruby/1.9/test_struct.rb", "test/ruby/2.0/envutil.rb", "test/ruby/2.0/test_struct.rb", "test/run.sh", "test/spec_structx.rb"] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, ["~> 1.3"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 1.3"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, ["~> 1.3"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/sys-cpu-0.7.2.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/sys-cpu-0.7.2.gemspec new file mode 100644 index 000000000..43b262efd --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/sys-cpu-0.7.2.gemspec @@ -0,0 +1,43 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{sys-cpu} + s.version = "0.7.2" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Daniel J. Berger"] + s.cert_chain = ["-----BEGIN CERTIFICATE-----\nMIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl\ncmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t\nMB4XDTE1MDkwMjIwNDkxOFoXDTE2MDkwMTIwNDkxOFowPzERMA8GA1UEAwwIZGpi\nZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv\nbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMyTkvXqRp6hLs9eoJOS\nHmi8kRYbq9Vkf15/hMxJpotYMgJVHHWrmDcC5Dye2PbnXjTkKf266Zw0PtT9h+lI\nS3ts9HO+vaCFSMwFFZmnWJSpQ3CNw2RcHxjWkk9yF7imEM8Kz9ojhiDXzBetdV6M\ngr0lV/alUr7TNVBDngbXEfTWscyXh1qd7xZ4EcOdsDktCe5G45N/o3662tPQvJsi\nFOF0CM/KuBsa/HL1/eoEmF4B3EKIRfTHrQ3hu20Kv3RJ88QM4ec2+0dd97uX693O\nzv6981fyEg+aXLkxrkViM/tz2qR2ZE0jPhHTREPYeMEgptRkTmWSKAuLVWrJEfgl\nDtkCAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFEwe\nnn6bfJADmuIDiMSOzedOrL+xMB0GA1UdEQQWMBSBEmRqYmVyZzk2QGdtYWlsLmNv\nbTAdBgNVHRIEFjAUgRJkamJlcmc5NkBnbWFpbC5jb20wDQYJKoZIhvcNAQEFBQAD\nggEBAHmNOCWoDVD75zHFueY0viwGDVP1BNGFC+yXcb7u2GlK+nEMCORqzURbYPf7\ntL+/hzmePIRz7i30UM//64GI1NLv9jl7nIwjhPpXpf7/lu2I9hOTsvwSumb5UiKC\n/sqBxI3sfj9pr79Wpv4MuikX1XPik7Ncb7NPsJPw06Lvyc3Hkg5X2XpPtLtS+Gr2\nwKJnmzb5rIPS1cmsqv0M9LPWflzfwoZ/SpnmhagP+g05p8bRNKjZSA2iImM/GyYZ\nEJYzxdPOrx2n6NYR3Hk+vHP0U7UBSveI6+qx+ndQYaeyCn+GRX2PKS9h66YF/Q1V\ntGSHgAmcLlkdGgan182qsE/4kKM=\n-----END CERTIFICATE-----\n"] + s.date = %q{2015-09-05} + s.description = %q{ The sys-cpu library provides an interface for gathering information + about your system's processor(s). Information includes speed, type, + and load average. +} + s.email = %q{djberg96 at nospam at gmail dot com} + s.extra_rdoc_files = ["CHANGES", "README", "MANIFEST"] + s.files = ["CHANGES", "MANIFEST", "README", "Rakefile", "certs/djberg96_pub.pem", "doc/bsd.txt", "doc/hpux.txt", "doc/linux.txt", "doc/sunos.txt", "doc/windows.txt", "examples/example_sys_cpu_bsd.rb", "examples/example_sys_cpu_hpux.rb", "examples/example_sys_cpu_linux.rb", "examples/example_sys_cpu_sunos.rb", "examples/example_sys_cpu_windows.rb", "install.rb", "lib/sys-cpu.rb", "lib/sys/cpu.rb", "lib/sys/linux/sys/cpu.rb", "lib/sys/unix/sys/cpu.rb", "lib/sys/windows/sys/cpu.rb", "sys-cpu.gemspec", "test/test_sys_cpu.rb", "test/test_sys_cpu_bsd.rb", "test/test_sys_cpu_hpux.rb", "test/test_sys_cpu_linux.rb", "test/test_sys_cpu_sunos.rb", "test/test_sys_cpu_version.rb", "test/test_sys_cpu_windows.rb"] + s.homepage = %q{https://github.com/djberg96/sys-cpu} + s.licenses = ["Artistic 2.0"] + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.7} + s.summary = %q{A Ruby interface for providing CPU information} + s.test_files = ["test/test_sys_cpu.rb"] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 4 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/sys-proctable-0.9.9-universal-darwin.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/sys-proctable-0.9.9-universal-darwin.gemspec new file mode 100644 index 000000000..ad0f6be09 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/sys-proctable-0.9.9-universal-darwin.gemspec @@ -0,0 +1,44 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{sys-proctable} + s.version = "0.9.9" + s.platform = %q{universal-darwin} + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Daniel J. Berger"] + s.cert_chain = ["-----BEGIN CERTIFICATE-----\nMIIDcDCCAligAwIBAgIBATANBgkqhkiG9w0BAQUFADA/MREwDwYDVQQDDAhkamJl\ncmc5NjEVMBMGCgmSJomT8ixkARkWBWdtYWlsMRMwEQYKCZImiZPyLGQBGRYDY29t\nMB4XDTE1MDkwMjIwNDkxOFoXDTE2MDkwMTIwNDkxOFowPzERMA8GA1UEAwwIZGpi\nZXJnOTYxFTATBgoJkiaJk/IsZAEZFgVnbWFpbDETMBEGCgmSJomT8ixkARkWA2Nv\nbTCCASIwDQYJKoZIhvcNAQEBBQADggEPADCCAQoCggEBAMyTkvXqRp6hLs9eoJOS\nHmi8kRYbq9Vkf15/hMxJpotYMgJVHHWrmDcC5Dye2PbnXjTkKf266Zw0PtT9h+lI\nS3ts9HO+vaCFSMwFFZmnWJSpQ3CNw2RcHxjWkk9yF7imEM8Kz9ojhiDXzBetdV6M\ngr0lV/alUr7TNVBDngbXEfTWscyXh1qd7xZ4EcOdsDktCe5G45N/o3662tPQvJsi\nFOF0CM/KuBsa/HL1/eoEmF4B3EKIRfTHrQ3hu20Kv3RJ88QM4ec2+0dd97uX693O\nzv6981fyEg+aXLkxrkViM/tz2qR2ZE0jPhHTREPYeMEgptRkTmWSKAuLVWrJEfgl\nDtkCAwEAAaN3MHUwCQYDVR0TBAIwADALBgNVHQ8EBAMCBLAwHQYDVR0OBBYEFEwe\nnn6bfJADmuIDiMSOzedOrL+xMB0GA1UdEQQWMBSBEmRqYmVyZzk2QGdtYWlsLmNv\nbTAdBgNVHRIEFjAUgRJkamJlcmc5NkBnbWFpbC5jb20wDQYJKoZIhvcNAQEFBQAD\nggEBAHmNOCWoDVD75zHFueY0viwGDVP1BNGFC+yXcb7u2GlK+nEMCORqzURbYPf7\ntL+/hzmePIRz7i30UM//64GI1NLv9jl7nIwjhPpXpf7/lu2I9hOTsvwSumb5UiKC\n/sqBxI3sfj9pr79Wpv4MuikX1XPik7Ncb7NPsJPw06Lvyc3Hkg5X2XpPtLtS+Gr2\nwKJnmzb5rIPS1cmsqv0M9LPWflzfwoZ/SpnmhagP+g05p8bRNKjZSA2iImM/GyYZ\nEJYzxdPOrx2n6NYR3Hk+vHP0U7UBSveI6+qx+ndQYaeyCn+GRX2PKS9h66YF/Q1V\ntGSHgAmcLlkdGgan182qsE/4kKM=\n-----END CERTIFICATE-----\n"] + s.date = %q{2015-11-08} + s.description = %q{ The sys-proctable library provides an interface for gathering information + about processes on your system, i.e. the process table. Most major + platforms are supported and, while different platforms may return + different information, the external interface is identical across + platforms. +} + s.email = %q{djberg96@gmail.com} + s.extensions = ["ext/darwin/extconf.rb"] + s.extra_rdoc_files = ["CHANGES", "README", "MANIFEST", "doc/top.txt", "ext/darwin/sys/proctable.c"] + s.files = ["CHANGES", "MANIFEST", "README", "Rakefile", "benchmarks/bench_ps.rb", "doc/top.txt", "examples/example_ps.rb", "lib/sys-proctable.rb", "lib/sys/proctable/version.rb", "lib/sys/top.rb", "sys-proctable.gemspec", "test/test_sys_proctable_all.rb", "ext/darwin/sys/proctable.c", "test/test_sys_proctable_darwin.rb", "test/test_sys_top.rb", "ext/darwin/extconf.rb"] + s.homepage = %q{http://github.com/djberg96/sys-proctable} + s.licenses = ["Artistic 2.0"] + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.7} + s.summary = %q{An interface for providing process table information} + s.test_files = ["test/test_sys_proctable_all.rb", "test/test_sys_proctable_darwin.rb", "test/test_sys_top.rb"] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 4 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/sys-uname-0.9.2.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/sys-uname-0.9.2.gemspec new file mode 100644 index 000000000..ce84cdfa8 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/sys-uname-0.9.2.gemspec @@ -0,0 +1,39 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{sys-uname} + s.version = "0.9.2" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Daniel J. Berger"] + s.date = %q{2013-05-01} + s.description = %q{ The sys-uname library provides an interface for gathering information + \ about your current platform. The library is named after the Unix 'uname' + command but also works on MS Windows. Available information includes + OS name, OS version, system name and so on. Additional information is + available for certain platforms. +} + s.email = %q{djberg96@gmail.com} + s.extra_rdoc_files = ["CHANGES", "README", "MANIFEST", "doc/uname.txt"] + s.files = ["CHANGES", "doc/uname.txt", "examples/uname_test.rb", "lib/unix/sys/uname.rb", "lib/windows/sys/uname.rb", "MANIFEST", "Rakefile", "README", "sys-uname.gemspec", "test/test_sys_uname.rb"] + s.homepage = %q{http://www.rubyforge.org/projects/sysutils} + s.licenses = ["Artistic 2.0"] + s.require_paths = ["lib", "lib/unix"] + s.rubyforge_project = %q{sysutils} + s.rubygems_version = %q{1.3.7} + s.summary = %q{An interface for returning uname (platform) information} + s.test_files = ["test/test_sys_uname.rb"] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, [">= 1.0.0"]) + else + s.add_dependency(%q, [">= 1.0.0"]) + end + else + s.add_dependency(%q, [">= 1.0.0"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/syslog-logger-1.6.8.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/syslog-logger-1.6.8.gemspec new file mode 100644 index 000000000..f88d45a76 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/syslog-logger-1.6.8.gemspec @@ -0,0 +1,30 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{syslog-logger} + s.version = "1.6.8" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Eric Hodel; Chris Powell; Matthew Boeh; Ian Lesperance; Dana Danger; Brian Smith; Ashley Martens"] + s.date = %q{2012-02-14} + s.description = %q{An improved Logger replacement that logs to syslog. It is almost drop-in with a few caveats.} + s.email = %q{teamplatform@ngmoco.com} + s.extra_rdoc_files = ["README.rdoc"] + s.files = ["README.rdoc", "lib/syslog-formatter.rb", "lib/syslog-logger.rb", "test/test_syslog_logger.rb"] + s.homepage = %q{http://github.com/ngmoco/syslog_logger} + s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "SyslogLogger", "--main", "README.rdoc"] + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.7} + s.summary = %q{An improved Logger replacement that logs to syslog. It is almost drop-in with a few caveats.} + s.test_files = ["test/test_syslog_logger.rb"] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + else + end + else + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/temppath-0.3.1.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/temppath-0.3.1.gemspec new file mode 100644 index 000000000..942ed03d2 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/temppath-0.3.1.gemspec @@ -0,0 +1,43 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{temppath} + s.version = "0.3.1" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Keita Yamaguchi"] + s.date = %q{2013-10-26} + s.description = %q{temppath provides the method to create temporary path} + s.email = ["keita.yamaguchi@gmail.com"] + s.files = [".gitignore", ".simplecov", ".travis.yml", "Gemfile", "LICENSE.txt", "README.md", "Rakefile", "lib/temppath.rb", "lib/temppath/version.rb", "temppath.gemspec", "test/spec_temppath.rb"] + s.homepage = %q{https://github.com/keita/temppath} + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.7} + s.summary = %q{temppath provides the method to create temporary path} + s.test_files = ["test/spec_temppath.rb"] + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 3 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_runtime_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + s.add_development_dependency(%q, [">= 0"]) + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end + else + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + s.add_dependency(%q, [">= 0"]) + end +end diff --git a/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/uuidtools-2.1.5.gemspec b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/uuidtools-2.1.5.gemspec new file mode 100644 index 000000000..1c106c339 --- /dev/null +++ b/util/X86MAC64/lib/ruby/gems/1.9.1/specifications/uuidtools-2.1.5.gemspec @@ -0,0 +1,42 @@ +# -*- encoding: utf-8 -*- + +Gem::Specification.new do |s| + s.name = %q{uuidtools} + s.version = "2.1.5" + + s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= + s.authors = ["Bob Aman"] + s.date = %q{2014-08-12} + s.description = %q{A simple universally unique ID generation library. +} + s.email = %q{bob@sporkmonger.com} + s.extra_rdoc_files = ["README.md"] + s.files = ["CHANGELOG", "LICENSE.txt", "README.md", "Rakefile", "lib/compat/securerandom.rb", "lib/uuidtools.rb", "lib/uuidtools/version.rb", "spec/spec.opts", "spec/spec_helper.rb", "spec/uuidtools/mac_address_spec.rb", "spec/uuidtools/utility_spec.rb", "spec/uuidtools/uuid_creation_spec.rb", "spec/uuidtools/uuid_parsing_spec.rb", "tasks/benchmark.rake", "tasks/gem.rake", "tasks/git.rake", "tasks/metrics.rake", "tasks/rspec.rake", "tasks/yard.rake", "website/index.html"] + s.homepage = %q{https://github.com/sporkmonger/uuidtools} + s.rdoc_options = ["--main", "README.md"] + s.require_paths = ["lib"] + s.rubygems_version = %q{1.3.7} + s.summary = %q{UUID generator} + + if s.respond_to? :specification_version then + current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION + s.specification_version = 4 + + if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then + s.add_development_dependency(%q, [">= 0.7.3"]) + s.add_development_dependency(%q, [">= 2.9.0"]) + s.add_development_dependency(%q, [">= 0.8.2"]) + s.add_development_dependency(%q, [">= 2.0.0"]) + else + s.add_dependency(%q, [">= 0.7.3"]) + s.add_dependency(%q, [">= 2.9.0"]) + s.add_dependency(%q, [">= 0.8.2"]) + s.add_dependency(%q, [">= 2.0.0"]) + end + else + s.add_dependency(%q, [">= 0.7.3"]) + s.add_dependency(%q, [">= 2.9.0"]) + s.add_dependency(%q, [">= 0.8.2"]) + s.add_dependency(%q, [">= 2.0.0"]) + end +end